Ver código fonte

提交数据 仓库和库存校验

lvhao 10 horas atrás
pai
commit
b8080f7174

+ 135 - 27
core/CoreApp/controllers/Beihuogl.php

@@ -95,6 +95,8 @@ class Beihuogl extends Start_Controller {
            $this->_ckexcel($arg_array);
         }elseif($arg == 'checkdcdsku'){
             $this->_checkdcdsku($arg_array);
+        }elseif($arg == 'dcdkwyz'){
+            $this->_dcdkwyz();
         }
 		else
 		{
@@ -1547,7 +1549,7 @@ class Beihuogl extends Start_Controller {
                     $start = ($page - 1)*$perpage;
                 }
     
-                $list = $this->bhdcd->find_all($where,"id,bh_no,dcd_no,drd_no,status,jm,num,kw,create_time,rk_time,is_rk",$order_str,$start,$perpage);
+                $list = $this->bhdcd->find_all($where,"id,bh_no,dcd_no,drd_no,status,jm,num,kw,create_time,rk_time,is_rk,szkw",$order_str,$start,$perpage);
     
                 if(empty($list)){
                     $rows = array('total'=>0,'over'=>1,'pagenum'=>0,'rows'=>([]));
@@ -1562,15 +1564,28 @@ class Beihuogl extends Start_Controller {
                     $list[$k]['create_time'] = empty($v['create_time'])?"":date("Y-m-d",$v['create_time']);
 
                     $str = "";
-                    if($v['is_rk'] == 0){
-                       $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#DC143C;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dcdjzrk(this)'  data-id='".$v['id']."' data-num='".$v['num']."'>禁止入库</a>";
-                    }
+                   
                    
                     if(!empty($v['rk_time'])){
                         $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#D2691E;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dybq(this)'  data-id='".$v['id']."' >打印标签</a>";
+                    }else{
+                        if($v['is_rk'] == 0){
+                            $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#DC143C;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dcdrk(this)' data-type='1'  data-id='".$v['id']."' data-num='".$v['num']."'>禁止入库</a>";
+                        }else{
+                            $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#778899;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dcdrk(this)' data-type='2'    data-id='".$v['id']."' data-num='".$v['num']."'>允许入库</a>";
+                        }
+
+                        if(empty($v['szkw'])){
+                            $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#9932CC;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dcdyz(this)' data-type='1'    data-id='".$v['id']."' data-num='".$v['num']."'>禁止验证</a>";
+                        }else{
+                            $str .= "<a href='javascript:void(0)'  style='margin-right:4px;color: #fff;background-color:#00CED1;padding:4px 8px;border-radius:5px;font-size:13px' onclick='dcdyz(this)' data-type='2'    data-id='".$v['id']."' data-num='".$v['num']."'>允许验证</a>";   
+
+                        }
+
                     }
                     $list[$k]['rk_time'] = $str;
                     unset($list[$k]['is_rk']);
+                    unset($list[$k]['szkw']);
                 }
     
     
@@ -1666,7 +1681,7 @@ class Beihuogl extends Start_Controller {
             $dcd_no = $data['dcd_no'];
             $drd_no = $data['drd_no'];
             $list = $this->bhdcd->find_all("dcd_no = '".$dcd_no."' and is_rk = 0");
-            $whlabel_arr = [];
+            $spec_arr = $whlabel_arr = [];
             $time = time();
             $err_list= [];
             foreach($list as $k=>$v){
@@ -1674,31 +1689,73 @@ class Beihuogl extends Start_Controller {
                     $err_list[] = $v['jm']."不存在";
                     continue;
                 }
-                for($i=0;$i<$v['num'];$i++){
-                    $whlabel_arr[] = [
-                        'purchase'=>1,
-                        'sku'=>$v['sku'],
-                        'number'=>$v['number'],
-                        'features'=>$v['features'],
-                        'title'=>$v['title'],
-                        'zh'=>$v['zh'],
-                        'warehouse'=>'13',
-                        'enter'=>$time,
-                        'state'=>0,
-                        'retreatwarehouse'=>'13',
-                        'time'=>$time,
-                        'details'=>$v['kw'],
-                        'bs'=>1,
-                        'rktype'=>9,
-                    ];
+                if(empty($v['szkw'])){
+                    $tmp_info = $this->whlabel->find("warehouse = '".$v['erp_warehouse']."' and sku = '".$v['sku']."' and details != 'DZ001'  ","*","id desc");
+                    if(!empty($tmp_info)){
+                        if(!empty($tmp_info['details'])){
+                           if($tmp_info['details'] != $v['kw']){
+                                $err_list[] = $v['jm']."的库位信息";
+                                continue;
+                           }
+                        }
+                    }
+                }
+                if($v['erp_warehouse'] == '12'){
+                    //特殊仓处理方案
+                    for($i=0;$i<$v['num'];$i++){
+                        $spec_arr[] = [
+                            'purchase'=>1,
+                            'sku'=>$v['sku'],
+                            'number'=>$v['number'],
+                            'features'=>$v['features'],
+                            'featurespp'=>'',
+                            'label'=>'',
+                            'title'=>$v['title'],
+                           // 'zh'=>$v['zh'],
+                            'warehouse'=>$v['erp_warehouse'],
+                            'enter'=>$time,
+                            'state'=>0,
+                            'retreatwarehouse'=>$v['erp_warehouse'],
+                            'time'=>$time,
+                            'details'=>$v['kw'],
+                            'bs'=>1,
+                            'rktype'=>9,
+                        ];
+                    }
+                }else{
+                    for($i=0;$i<$v['num'];$i++){
+                        $whlabel_arr[] = [
+                            'purchase'=>1,
+                            'sku'=>$v['sku'],
+                            'number'=>$v['number'],
+                            'features'=>$v['features'],
+                            'title'=>$v['title'],
+                            'zh'=>$v['zh'],
+                            'warehouse'=>$v['erp_warehouse'],
+                            'enter'=>$time,
+                            'state'=>0,
+                            'retreatwarehouse'=>$v['erp_warehouse'],
+                            'time'=>$time,
+                            'details'=>$v['kw'],
+                            'bs'=>1,
+                            'rktype'=>9,
+                        ];
+                    }
                 }
                 
+                
              }
              if(!empty($err_list)){
                 echo json_encode(['success'=>false,'msg'=>implode('<br/>', $err_list)]);exit;
              }
              $this->db->trans_start();
-             $this->db->insert_batch('whlabel',$whlabel_arr);
+             if(!empty($whlabel_arr)){
+               $this->db->insert_batch('whlabel',$whlabel_arr);
+             }
+             if(!empty($spec_arr)){
+                $this->db->insert_batch('specialstock',$spec_arr);
+             }
+            
              $this->db->where('dcd_no',$dcd_no);
              //$this->db->where('drd_no',$drd_no);
              $this->db->update('bhdcd',['status'=>3,'rk_time'=>$time,'is_rk'=>1]);
@@ -1723,9 +1780,15 @@ class Beihuogl extends Start_Controller {
             }
             $in_where = rtrim($in_where,",");
             $in_where .= " )";
+            $warehouse_list =  [
+                12=>'特殊仓',
+                13=>'许昌仓',
+                16=>'定制头套仓'
+            ];
             foreach($list as $k=>$v){
                 $list[$k]['status_show'] = isset($status_list[$v['status']])?$status_list[$v['status']]:"";
                 $list[$k]['drd_no'] = empty($v['drd_no'])?"":$v['drd_no'];
+                $list[$k]['warehouse_show'] = isset($warehouse_list[$v['erp_warehouse']])?$warehouse_list[$v['erp_warehouse']]:"";
                 if(!empty($v['kw'])){
                     $list[$k]['kw'] = $v['kw'];
                 }else{
@@ -1782,6 +1845,10 @@ class Beihuogl extends Start_Controller {
             $update_arr = [
                 'kw'=>trim($val),
             ];
+          }elseif($column == 'ck'){
+            $update_arr = [
+                'erp_warehouse'=>trim($val),
+            ];
           }else{
             echo json_encode(['success'=>false,'msg'=>'请求参数未设置']);exit;
           }
@@ -1910,12 +1977,26 @@ class Beihuogl extends Start_Controller {
     private function _dcdjzrk(){
         if($this->input->method() === 'post'){
             $id = $this->input->post('id',true);
+            $type = $this->input->post('type',true);
+            $is_rk = 0;
+            if($type == 1){
+                $is_rk = 1;
+            }else{
+                $is_rk = 0;
+            }
+
+
             $info = $this->bhdcd->read($id);
-            if($info['is_rk'] == 0){
-                $this->bhdcd->save(['is_rk'=>1],$id);
-                echo json_encode(['success'=>true,'msg'=>'此条信息已禁止入库']);exit;
+
+            if($info['is_rk'] != $is_rk){
+                $this->bhdcd->save(['is_rk'=>$is_rk],$id);
+                echo json_encode(['success'=>true,'msg'=>'修改成功']);exit;
             }else{
-                echo json_encode(['success'=>true,'msg'=>'此条信息已禁止入库']);exit;
+                if($type ==1){
+                   echo json_encode(['success'=>false,'msg'=>'此条信息已禁止入库']);exit;
+                }else{
+                   echo json_encode(['success'=>false,'msg'=>'此条信息已允许入库']);exit;
+                }
             }
         }else{
             echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit;
@@ -1935,6 +2016,33 @@ class Beihuogl extends Start_Controller {
         }
     }
 
+    private function _dcdkwyz(){
+        if($this->input->method() === 'post'){
+            $id = $this->input->post('id',true);
+            $type = $this->input->post('type',true);
+            $szkw = 0;
+            if($type == 1){
+                $szkw = 1;
+            }else{
+                $szkw = 0;
+            }
+            $info = $this->bhdcd->read($id);
+            if($info['szkw'] != $szkw){
+                $this->bhdcd->save(['szkw'=>$szkw],$id);
+                echo json_encode(['success'=>true,'msg'=>'修改成功']);exit;
+            }else{
+                if($type ==1){
+                  echo json_encode(['success'=>false,'msg'=>'此条信息已禁止验证库位']);exit;
+                }else{  
+                 echo json_encode(['success'=>false,'msg'=>'此条信息已允许验证库位']);exit;
+                }
+            }
+
+        }else{
+            echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit;
+        }
+    }
+
     private function _ckexcel($arg_array){
         $id = $arg_array[0];
         $info = $this->bhccwl->read($id);

+ 84 - 7
template/erp/beihuogl_ckbherprk.html

@@ -139,11 +139,11 @@
         <!-- 简约表头:含必要列,其中包含两个输入域列 -->
         <thead>
             <tr>
-                <th width="70%">中文品名|u9</th>
+                <th width="65%">中文品名|u9</th>
 
                 <th style="width:40px;">入库数</th>
-                <th>备货单号</th>
-                <th>erp库位</th>
+                <th >备货单号</th>
+                <th>erp库位|仓库</th>
             </tr>
         </thead>
         <tbody id="goodsList">
@@ -164,10 +164,19 @@
                     {$good['bh_no']}
                 </td>
                 <td {if $good['is_rk'] == 1} style="background-color:#ccc !important;color:red !important;"  {/if}>
-                    {$good['kw']}
-                    {if $list[0]['status'] < 3  && $good['is_rk'] == 0}
-                    <i class='fa fa-edit' data-id="{$good['id']}" data-kw="{$good['kw']}" onclick='edit_kw(this)'></i>
-                    {/if}
+                    <div>
+                        {$good['kw']}   
+                        {if $list[0]['status'] < 3  && $good['is_rk'] == 0}
+                        <i class='fa fa-edit' data-id="{$good['id']}" data-kw="{$good['kw']}" onclick='edit_kw(this)'></i>
+                        {/if}
+                    </div>
+                    <div>
+                        {$good['warehouse_show']}   
+                        {if $list[0]['status'] < 3  && $good['is_rk'] == 0}
+                        <i class='fa fa-edit' data-id="{$good['id']}" data-cw="{$good['erp_warehouse']}" onclick='edit_cw(this)'></i>
+                        {/if}
+                    </div>
+                    
                 </td>
             </tr>
             {/loop}
@@ -285,6 +294,74 @@ function shrk(){
         ],dialogIcon:'error',shadable:0.6
     })
 }
+
+function edit_cw(that){
+    let id = $(that).data('id')
+    let cw = $(that).data('cw')
+    let str = '';
+    let ck_list = [
+        {
+            'id':12,
+            'name':'特殊仓'
+        },
+        {
+            'id':13,
+            'name':'许昌仓'
+        },
+        {
+            'id':16,
+            'name':'定制头套仓'
+        }
+    ];
+    str += '<select name="val">'
+    for(let i=0;i<ck_list.length;i++){
+        if(ck_list[i].id == cw){
+            str += '<option selected value="'+ck_list[i].id+'">'+ck_list[i].name+'</option>';
+        }else{
+            str += '<option value="'+ck_list[i].id+'">'+ck_list[i].name+'</option>';
+        }   
+    }
+    str += '</select>';
+    
+    $(".boundtj div p:eq(0)").html('<label>仓 库:'+str+'<input type="hidden" name="id" value="'+id+'" /><input type="hidden" name="column" value="ck" />');
+    $(".boundtj div p:eq(1)").html("<font class='obaddgo' onclick='doAddYcrkNew()'>确 定</font><font class='esc' onclick='escDo()'>取 消</font>");
+    $(".boundtj").show();
+}
+
+function doAddYcrkNew(){
+     let obj = {}
+     obj.id = $(".boundtj input[name='id']").val();
+     obj.val = $(".boundtj select[name='val']").val();
+     obj.column = $(".boundtj input[name='column']").val();
+
+     escDo();
+     $.post("/beihuogl/bhdcdsave", obj, function(a){
+        if(a.success){
+            layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+                            location.reload();
+						}
+					}
+				],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>
 
 

+ 56 - 3
template/erp/beihuogl_ckdcd.html

@@ -215,15 +215,22 @@ function escDo(){
     $(".boundtj").hide();
 }
 
-function dcdjzrk(that){
+function dcdrk(that){
     let del_id = $(that).data('id')
-    layx.confirm('提示','确定此条信息不允许入库吗?',null,{
+    let do_type = $(that).data('type') 
+    let msg = ''
+    if(do_type == 1){
+        msg = '确定此条信息不允许入库吗?'
+    }else{
+        msg = '确定此条信息允许入库吗?'
+    }
+    layx.confirm('提示',msg,null,{
         buttons:[
             {
                 label:'确定',
                 callback:function(id, button, event){
                     layx.destroy(id);
-                    $.post("/beihuogl/dcdjzrk",{id:del_id},function(a){
+                    $.post("/beihuogl/dcdjzrk",{id:del_id,type:do_type},function(a){
                         if(a.success){
                             $(".search span").click();
                         }else{
@@ -252,6 +259,52 @@ function dcdjzrk(that){
 
     
 }
+
+function dcdyz(that){
+    let del_id = $(that).data('id')
+    let do_type = $(that).data('type') 
+
+    let msg = ''
+    if(do_type == 1){
+        msg = '确定此条信息不允许验证库位吗?'
+    }else{
+        msg = '确定此条信息允许验证库位吗?'
+    }
+    layx.confirm('提示',msg,null,{
+        buttons:[
+            {
+                label:'确定',
+                callback:function(id, button, event){
+                    layx.destroy(id);
+                    $.post("/beihuogl/dcdkwyz",{id:del_id,type:do_type},function(a){
+                        if(a.success){
+                            $(".search span").click();
+                        }else{
+                            layx.confirm('错误提示',a.msg,null,{
+                                buttons:[
+                                    {
+                                        label:'确定',
+                                        callback:function(id, button, event){
+                                            layx.destroy(id);
+                                        }
+                                    }
+                                ],dialogIcon:'error',shadable:0.6
+                            });
+                        }
+                    },'json')  
+                }
+            },
+            {
+                label:'取消',
+                callback:function(id, button, event){
+                    layx.destroy(id);
+                }
+            }
+        ],dialogIcon:'success',shadable:0.6
+    });
+}
+
+
 </script>
 <script type="text/javascript" src="{$theme}js/laydate.js"></script>
 <script type="text/javascript" src="{$theme}js/excel/xlxs.js" ></script>