Przeglądaj źródła

提交数据 添加库位

lvhao 17 godzin temu
rodzic
commit
419e1d01da

+ 24 - 0
core/CoreApp/controllers/Goodimglibrary.php

@@ -38,6 +38,8 @@ class Goodimglibrary extends Start_Controller {
             $this->_excelgood();
         }elseif($arg == 'editsku'){
             $this->_editsku();
+        }elseif($arg == 'editkuwei'){
+            $this->_editkuwei();
         }else{
 			$this->_index();
 		}
@@ -925,4 +927,26 @@ class Goodimglibrary extends Start_Controller {
             echo json_encode(['success'=>false,'msg'=>'请求不合法']);exit;
         }
     }
+
+
+    private function _editkuwei(){
+        if($this->input->method() == 'post'){
+            $id = $this->input->post('id',true);
+            $kuwei = $this->input->post('kuwei',true);
+            $info = $this->goods->read($id);
+            if(empty($info)){
+                echo json_encode(['success'=>false,'msg'=>'料品不存在']);exit;
+            }
+            if($info['kuwei'] == $kuwei){
+                echo json_encode(['success'=>false,'msg'=>'料品SKU未变动']);exit;
+            }
+            if($this->goods->save(array('kuwei'=>$kuwei,'kuwei_set'=>1),$id)){
+                echo json_encode(['success'=>true,'msg'=>'料品SKU修改成功']);exit;
+            }else{
+                echo json_encode(['success'=>false,'msg'=>'料品SKU修改失败']);exit;
+            }
+        }else{
+            echo json_encode(['success'=>false,'msg'=>'请求不合法']);exit;
+        }
+    }
 }

+ 41 - 0
template/erp/goodimglibrary_noimg.html

@@ -243,6 +243,47 @@ function escDo(){
     $(".boundtj p").html("");
     $(".boundtj").hide();
 }
+
+function editkw(){
+    let id = $(that).data('id');
+    let kuwei = $(that).data('kuwei');
+    $(".boundtj div p:eq(0)").html('<textarea style="width:95%" name="kuwei" >'+kuwei+'</textarea><input type="hidden" name="id" value="'+id+'" />');
+    $(".boundtj div p:eq(1)").html("<font class='obaddgo' onclick='doAddKw()'>确 定</font><font class='esc' onclick='escDo()'>取 消</font>");
+    $(".boundtj").show();
+}
+
+function doAddKw(){
+     let obj = {}
+     obj.id = $(".boundtj input[name='id']").val();
+     obj.kuwei = $(".boundtj textarea[name='kuwei']").val();
+     escDo();
+     $.post("/goodimglibrary/editkuwei", obj, function(a){
+        if(a.success){
+            layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+                            $(".search span").click();
+						}
+					}
+				],dialogIcon:'success',shadable:0.6
+			})
+        }else{
+           layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+						}
+					}
+				],dialogIcon:'error',shadable:0.6
+			})
+        }
+     }, "json")
+}
 </script>
 <script type="text/javascript" src="{$theme}js/excel/xlxswidth.js"></script>
 {Template footer}