浏览代码

提交数据

lvhao 5 天之前
父节点
当前提交
238ae9afba
共有 3 个文件被更改,包括 441 次插入10 次删除
  1. 182 0
      core/CoreApp/controllers/Zzququeu9.php
  2. 19 10
      core/CoreApp/models/Model_logic_u9action.php
  3. 240 0
      template/erp/zzququeu9wx.html

+ 182 - 0
core/CoreApp/controllers/Zzququeu9.php

@@ -9,6 +9,7 @@ class Zzququeu9 extends Start_Controller {
         $this->load->_model("Model_logic_u9xgsd","logic_u9xgsd");
         $this->load->_model("Model_logic_u9ztsd","logic_u9ztsd");
         $this->load->_model('Model_zzququeu9_logs','zzququeu9_logs');
+        $this->load->_model("Model_logic_u9action","logic_u9action");
     }
     public function _remap($arg,$arg_array)
     {
@@ -58,6 +59,20 @@ class Zzququeu9 extends Start_Controller {
           {
                $this->_del($arg_array);
           }
+          elseif($arg == 'waixiao')//编辑
+          {
+               $this->_waixiao($arg_array);
+          }
+          elseif($arg == 'wxcprk')//外销成品入库
+          {
+               $this->_wxcprk($arg_array);
+          }
+          elseif($arg == 'wxcprksh'){
+               $this->_wxcprksh($arg_array);
+          }
+          elseif($arg == 'wxxs'){
+               $this->_wxxs($arg_array);
+          }
           else
           {
                $this->_index();
@@ -954,4 +969,171 @@ class Zzququeu9 extends Start_Controller {
           }
           
     }
+
+    public function _waixiao(){
+     $post = $this->input->post(NULL, TRUE);
+
+     if(isset($post['page']))
+     {
+          $page = $this->input->post('page',true);
+          $perpage = $this->input->post('perpage',true);
+          
+          $timetk = $this->input->post('timetk',true);//订单开始时间
+          $timetj = $this->input->post('timetj',true);//订单结束时间
+          $timetk = strtotime($timetk);
+          $timetj = strtotime($timetj);
+          $order_no = $this->input->post('order_no',true);
+          $type = $this->input->post('type',true);
+          $where = " ( type = 20) ";
+          if($order_no){
+              $where .= " and order_no like '%".$order_no."%' ";
+          }
+          if($timetk && $timetj){
+              $where .= " and create_time  > ".$timetk." and create_time  < ".$timetj." ";
+          }
+          if(empty($page))
+          {
+               $start = 0;
+               $perpage = 1;
+          }
+          else
+          {
+               $start = ($page - 1)*$perpage;
+          }
+          
+          $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
+          $type_list = $this->zzquque_u9->getType();
+          $list = [];
+          foreach($info_list as $k=>$v){
+               $bzsh_no = $v['bzsh_no'];
+               if($v['bzsh_status'] == 0){
+                   
+                    $bzsh_no = "<span  data-action='wxcprk' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
+                 
+                   
+               }elseif($v['bzsh_status'] == -1){
+                    $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 20 and two_type = 1 ","*",'id desc',0,1);
+                   
+                    $tmp_str= "";
+                    $ret_data = json_decode($error[0]['ret_data'],true);
+                    if(isset($ret_data[0]["ResMsg"])){
+                              $tmp_str = $ret_data[0]["ResMsg"];
+                    }elseif(isset($ret_data['msg'])){
+                         $tmp_str = $ret_data['msg'];
+                    }elseif(isset($ret_data['Data'])){
+                         foreach($ret_data['Data'] as $iit){
+                              if(!$iit['m_isSucess']){
+                                   $tmp_str .= $iit['m_errorMsg']."<br>";
+                              }
+                              
+                         }
+                         
+                    }else{
+                              $tmp_str = "系统执行失败,请重试";
+                    }
+                    
+                    $bzsh_no = "<span data-action='wxcprk' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>".'<p style="color:blue"><i  class="method fa fa-exclamation-circle" data-t="'.$tmp_str.'"></i><p>';
+               }elseif($v['bzsh_status'] == 1){
+                    $bzsh_no = $v['bzsh_no']."<br/><span data-action='wxcprksh' data-process='1' data-id='".$v['id']."' onclick='doAction(this)'>创建成品入库单</span>";
+               }
+
+               
+               $xs_no = " ";
+               if($v['xs_status'] == -1){
+                    $xs_no .= "<span data-action='wxxs' data-process='1'  onclick='doAction(this)'  data-id='".$v['id']."' >创建销售单</span>";
+               }elseif($v['xs_status'] == 0){
+                    $xs_no .= "<span data-action='wxxs' data-process='1' onclick='doAction(this)' data-id='".$v['id']."' >创建销售单</span>";
+               }
+               if(!empty($v['xs_no'])){
+                    $xs_no = $v['xs_no']."<br/>".$xs_no;
+               }
+               $bzch_no = $v['bzch_no'];               
+               
+               $list[] = [
+                    'id'=>$v['id'],
+                    'order_no'=>$v['order_no'],
+                    'type'=>"工厂外销单",
+                    'bzsh_no'=> $bzsh_no,
+                    'xs_no'=>$xs_no,
+                    'bzch_no'=>$bzch_no,
+                    // 'xs_two_no'=>"",
+                    // 'bzch_no'=>"",
+                    //'bzsh_no'=>$bzsh_no,
+                   
+                    'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
+                    'update_time'=>date("Y-m-d H:i:s",$v['update_time'])
+               ];
+          }
+
+          $total = $this->zzquque_u9->find_count($where);
+          $pagenum = ceil($total/$perpage);
+          $over = $total-($start+$perpage);
+          $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($list));
+          echo json_encode($rows);exit;    
+     }
+     $this->_Template('zzququeu9wx',$this->data);
+    }
+
+    public function _wxcprk($arg_array){
+      $id = $arg_array[0];
+      $info = $this->zzquque_u9->read($id);
+      if(empty($info)){
+          echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
+          exit;
+      }
+      if($info['bzsh_status'] != 0){
+          echo json_encode(array('msg'=>"当前状态不符合创建成品入库单的条件",'success'=>false));
+          exit;
+      }
+      $res = $this->logic_u9action->doRkd($info);
+      if($res['code'] == 1){
+          echo json_encode(array('msg'=>'创建成品入库单成功','success'=>true));
+          exit;
+      }else{
+          echo json_encode(array('msg'=>$res['msg'],'success'=>false));
+          exit;
+      }
+    }
+
+    public function _wxcprksh($arg_array){
+          $id = $arg_array[0];
+          $info = $this->zzquque_u9->read($id);
+          if(empty($info)){
+               echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
+               exit;
+          }
+          if($info['bzsh_status'] != 0){
+               echo json_encode(array('msg'=>"当前状态不符合审核成品入库单的条件",'success'=>false));
+               exit;
+          }
+          $res = $this->logic_u9action->checkRkd($info);
+          if($res['code'] == 1){
+               echo json_encode(array('msg'=>'审核成品入库单成功','success'=>true));
+               exit;
+          }else{
+               echo json_encode(array('msg'=>$res['msg'],'success'=>false));
+               exit;
+          }
+    }
+
+    public function _wxxs($arg_array){
+          $id = $arg_array[0];
+          $info = $this->zzquque_u9->read($id);
+          if(empty($info)){
+               echo json_encode(array('msg'=>"数据异常,请联系技术",'success'=>false));
+               exit;
+          }
+          if($info['xs_status'] != 0){
+               echo json_encode(array('msg'=>"当前状态不符合创建销售单的条件",'success'=>false));
+               exit;
+          }
+          $res = $this->logic_u9action->createXsd($info);
+          if($res['code'] == 1){
+               echo json_encode(array('msg'=>'创建销售单成功','success'=>true));
+               exit;
+          }else{
+               echo json_encode(array('msg'=>$res['msg'],'success'=>false));
+               exit;
+          }
+    }
 }

+ 19 - 10
core/CoreApp/models/Model_logic_u9action.php

@@ -15,6 +15,7 @@ class Model_logic_u9action extends Lin_Model {
         $this->load->_model("Model_systemtransfer","systemtransfer");
         $this->load->_model("Model_shop","shop");
         $this->load->_model("Model_zzququeu9_logs","zzququeu9_logs");
+        $this->load->_model('Model_logic_tools','logic_tools');
     }
     public function getToken($type){
         $name = "get_yytoken_".$type;
@@ -65,14 +66,14 @@ class Model_logic_u9action extends Lin_Model {
        
     }
     //进行入库单操作
-    private function doRkd($data){
+    public function doRkd($data){
         $token = $this->getToken(120);
         if(empty($data['child_order_no'])){
             $this->editData($data['id'],['bzsh_status'=>-1,'update_time'=>time()],$data['order_no'],20,1,'scrk_cj',$data,[
                 'code'=>-1,
                 'msg'=>'没有找到子订单号'
             ]);
-            return ;
+            return $this->logic_tools->ret_arr(-1,"没有找到子订单号");
         }
 
         $info = $this->systemtransfer->read($data['child_order_no']);
@@ -83,7 +84,7 @@ class Model_logic_u9action extends Lin_Model {
                 'code'=>-1,
                 'msg'=>'没有找到子订单号'
             ]);
-            return ;
+            return $this->logic_tools->ret_arr(-1,"没有找到子订单号");
         }
         $sc = explode('~',$info['scid']);
         $info['rkid'] = $sc[0];//配货的生产id
@@ -109,13 +110,15 @@ class Model_logic_u9action extends Lin_Model {
         $res = $this->apiyyv1->cprkCreate($params,$token);
         if(isset($res[0]['Data'][0]['m_isSucess'])&& $res[0]['Data'][0]['m_isSucess'] == 1){
             $this->editData($data['id'],['bzsh_no'=>$res[0]['Data'][0]['m_code'],'bzsh_status'=>1,'update_time'=>time()],$info['number'],20,1,'scrk_cj',$res[1],$res[0]);
+            return $this->logic_tools->ret_arr(1,"成品入库单创建成功");
         }else{
             $this->editData($data['id'],['bzsh_status'=>-1,'update_time'=>time()],$info['number'],20,1,'scrk_cj',$res[1],$res[0]);
+            return $this->logic_tools->ret_arr(-1,"成品入库单创建失败");
         }
         
     }
     //对入库单进行检查
-    private function checkRkd($info){
+    public function checkRkd($info){
         $token = $this->getToken(120);
         $params = [
             [
@@ -131,19 +134,21 @@ class Model_logic_u9action extends Lin_Model {
             $res = $this->apiyyv1->cprkCx($params,$token);
             if(!(isset($res[0]['Data'][0]['m_isSucess']) && $res[0]['Data'][0]['m_isSucess'] == 1)){
                 //查询失败  这里不做状态变更  只是做记录
-              return  $this->editData($info['id'],['update_time'=>time()],$info['order_no'],20,2,'scrk_ck',$res[1],$res[0]);
+                $this->editData($info['id'],['update_time'=>time()],$info['order_no'],20,2,'scrk_ck',$res[1],$res[0]);
+                return $this->logic_tools->ret_arr(-1,"成品入库单还未审核,请稍后审核");
             }
             $res = $this->apiyyv1->cprkApprove($params,$token);
         }
         //如果再错误就 没办法了
         if(isset($res[0]['Data'][0]['m_isSucess']) && $res[0]['Data'][0]['m_isSucess'] == 1){
             $this->editData($info['id'],['bzsh_status'=>3,'update_time'=>time()],$info['order_no'],20,3,'scrk_sh',$res[1],$res[0]);
+            return $this->logic_tools->ret_arr(-1,"成品入库单还未审核,请联系到u9核对成品入库单的状态");
         }
 
 
     }
     //进行销售单操作
-    private function createXsd($info){
+    public function createXsd($info){
             $order_info = $this->logic_order->getInfo('number = "'.$info['order_no'].'"',"number,shop,shouldmoney");
             if(empty($order_info)){
                 return [];
@@ -167,17 +172,19 @@ class Model_logic_u9action extends Lin_Model {
             $res = $this->apiyyv1->gcxsdWaiXiaoCreate($params,$token);
             if($res[0]['Data'][0]['m_isSucess'] != 1){
                 $this->editData($info['id'],['xs_status'=>-1,'update_time'=>time()],$info['order_no'],2,1,'xs',$res[1],$res[0]);
+                return $this->logic_tools->ret_arr(1,"销售单创建成功");
             }else{
                 $this->editData($info['id'],['xs_no'=>$res[0]['Data'][0]['m_code'],'xs_status'=>1,'update_time'=>time()],$info['order_no'],2,1,'xs',$res[1],$res[0]);
+                return $this->logic_tools->ret_arr(-1,"销售单创建失败");
             }
     }
     //
-    private function checkXsd($info){
+    public function checkXsd($info){
 
     }
 
     //对销售单进行检查 并创建标准出货单
-    private function xcXsAndCreateScd($info){
+    public function xcXsAndCreateScd($info){
         $token = $this->getToken(120);
         $res = $this->apiyyv1->xsdCxByNo($info['xs_no'],$token);
         //如果没审核 那么就不管
@@ -212,7 +219,7 @@ class Model_logic_u9action extends Lin_Model {
                 'code'=>-1,
                 'msg'=>'标准出库的信息异常,请查看'
             ]);
-            return ;
+            return $this->logic_tools->ret_arr(-1,"标准出库的信息异常,请查看");
         }
         $tmp_info = [
             'zq_u9_id'=>$info['id'],
@@ -226,13 +233,15 @@ class Model_logic_u9action extends Lin_Model {
         $res = $this->apiyyv1->bzchCreate($tmp_info,$token);
         if($res[0]['Data'][0]['m_isSucess'] != 1){
             $this->editData($info['id'],['bzch_status'=>-1,'update_time'=>time()],$info['order_no'],5,1,'bzch',$res[1],$res[0]);
+            return $this->logic_tools->ret_arr(-1,"标准出库的信息异常,请查看");
         }else{
             $this->editData($info['id'],['bzch_no'=>$res[0]['Data'][0]['m_code'],'bzch_status'=>1,'xs_status'=>3,'update_time'=>time()],$info['order_no'],5,1,'bzch',$res[1],$res[0]);
+            return $this->logic_tools->ret_arr(1,"标准出库创建成功");
         }
 
     }
     //对标准出货单进行审核
-    private function checkBzch($info){
+    public function checkBzch($info){
         $res = $this->apiyyv1->bzchSubmitAndApprove(['number'=>$info['bzch_no']],$this->getToken(120));
         // print_r($res[0]);
         // print_r($res[1]);

+ 240 - 0
template/erp/zzququeu9wx.html

@@ -0,0 +1,240 @@
+{Template header}
+<script src="{$theme}js/system.js"></script>
+<script type="text/javascript" src="{$theme}js/layer/layer.js"></script>
+<style>
+    .layui-layer-page .layui-layer-content {
+        overflow: none;
+    }
+    
+    .layui-layer-content ul {
+        padding: 0 8px;
+    }
+    
+    .layui-layer-content ul li {
+        margin: 8px 0;
+    }
+    
+    #layui-layer1 {
+        overflow: auto;
+    }
+    
+    .layui-form-checked {
+        margin-left: 10px;
+        display: inline-block;
+    }
+    .shou_btn{
+        width: 70px;
+        height: 30px;
+        line-height: 30px;
+        background: #2ca8a1;
+        text-align: center;
+        color: #fff;
+        border-radius: 5px;
+        display: inline-block;
+        margin-left: 20px;
+        cursor: pointer;
+    }
+</style>
+
+<body>
+    <div class="warp">
+        <div class="fixed">
+            <ul class="search">
+                <li>
+                    <li>编号:<input value="" name="order_no" type="text"></li>
+                    <li>出库时间<input id="timetk" value="{date('Y-m-d',time()-29*24*3600)} 0:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"> 至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time()+24*3600)} 0:00"
+                            name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})"></li>
+                    <li><span>确 定</span></li>
+            </ul>
+            <div class="control">
+    
+                <!-- <a href="javascript:void(0);" class="btn btn-success" onclick="addData()">添 加</a> -->
+                
+                <!-- <a href="javascript:void(0);" style="font-size: 15px;" class="check">删 除</a> -->
+                <!-- <a href="javascript:void(0);" style="font-size: 15px;background-color: #f39c12;" onclick="excelexport()">按条件导出</a> -->
+                </div>
+            
+            <table class="datatitle data" border="0" style="border-collapse:collapse;">
+                <tr>
+                    <td><label onClick=""><input name="checkbox" type="checkbox" class="regular-checkbox"></label></td>
+                    <td>编号</td>
+                    <td>类型</td>
+                    <td>成品入库</td>
+                    <td>销售单</td>
+                    <td>标准出货</td>
+                    <!-- <td>标准收货单</td> -->
+                    <td>添加时间</td>
+                    <td>最后更新时间</td>
+                </tr>
+            </table>
+        </div>
+        <table class="datatext data" border="0" style="border-collapse:collapse;">
+        </table>
+        <div class="lbwlxq"></div>
+        <div class="bomf"></div>
+    </div>
+    <div class="ts"><p class="tsn"></p></div>
+    <div class="systemwindow">
+    <div>
+    <p></p>
+    <p><font class="button">确 定</font><font class="esc">取 消</font></p>
+    </div>
+    </div>
+    
+    
+    <div class="lbwlxq"></div>
+    <div class="bomf"></div>
+
+    
+    <script>
+       
+        customon = 1;
+        var dataurl = "/zzququeu9/waixiao";
+        function custom() {
+            $(".data tr").each(function() {
+                $(this).find('td:eq(0)').css("width", "1%");
+                $(this).find('td:eq(1)').css("width", "8%");
+                $(this).find('td:eq(2)').css("width", "6%");
+                $(this).find('td:eq(3)').css("width", "8%");
+                $(this).find('td:eq(4)').css("width", "10%");
+                $(this).find('td:eq(5)').css("width", "8%");
+                $(this).find('td:eq(6)').css("width", "8%");
+                $(this).find('td:eq(7)').css("width", "8%");
+            });
+        }
+
+        function doAction(that){
+            let action = $(that).data('action')
+            let process = $(that).data('process')
+            let id = $(that).data('id')
+            layx.load('loadId','提交中,请稍后',{shadable:0.6});
+            $.ajax({
+                url:"/zzququeu9/"+action+"/"+id,
+                data:{},
+                type:"post",
+                dataType:"json",
+                success:function(a){
+                    layx.destroy('loadId');
+                    if (a && a.success) {
+                        $(".systemwindow div p:eq(0)").html(a.msg);
+                        $(".systemwindow div p:eq(1)").html("<font  onclick='doCheck()'>确 定</font>");
+                        $(".systemwindow").show();
+                    }else{
+                        $(".systemwindow div p:eq(0)").text(a.msg);
+                        $(".systemwindow div p:eq(1)").html("<p><font onclick='doCheck()'>确 定</font></p>");
+                        $(".systemwindow").show();
+                    }
+                }
+            })
+        }
+
+
+    //记录重发单的信息
+    function addData(){
+        layx.html('no-icon', '<span style="font-size:18px;padding-left:10px">录入订单编码</span>', layx.multiLine(function() {
+            /*
+            <style type="text/css">
+                p{
+                        padding:10px;
+                }
+                .order_no {width:98%;margin:0px;height:90px}
+            </style>
+            <p><textarea class='order_no' name="order_no" style="border: 1px solid #000" placeholder="请输入要执行订单编码" ></textarea></p>
+            */
+        }), {
+            minMenu: false,
+            closeMenu: false,
+            movable: false,
+            shadable: true,
+            width: 300,
+            height: 50,
+            statusBar: true,
+            buttons: [
+                {
+                    label: '取消',
+                    callback: function(id, button, event) {
+                        layx.destroy(id);
+                    },
+                    style: 'color:#000;font-size:16px;'
+                },
+                {
+                    label: '提交',
+                    callback: function(id, button, event) {
+                        let order_no = $(".order_no").val()
+                        layx.destroy(id);
+                        
+                        layx.load('loadId','提交中,请稍后',{shadable:0.6});
+                        $.post("/zzququeu9/add",{
+                            order_no:order_no
+                        },function(a){
+                            layx.destroy('loadId');
+                            if (a && a.success) {
+                                $(".systemwindow div p:eq(0)").html(a.msg);
+                                $(".systemwindow div p:eq(1)").html("<font  onclick='doCheck()'>确 定</font>");
+                                $(".systemwindow").show();
+                            }else{
+                                $(".systemwindow div p:eq(0)").text(a.msg);
+                                $(".systemwindow div p:eq(1)").html("<p><font onclick='doCheck()'>确 定</font></p>");
+                                $(".systemwindow").show();
+                            }
+                        },'json')
+                        
+                    },
+                    style: 'color:#000;font-size:16px;'
+                }
+            ]
+        });
+    }
+
+    function doCheck(){
+        $(".systemwindow").hide();
+        setTimeout('searchspan(2)', 500);
+    }
+    
+    $(".datatext").on('mouseover mouseout',".method",function(event) {
+        if (event.type === "mouseover") {
+         $(this).parent().parent("td").append('<font style="position: absolute;z-index: 1;border-radius:3px;border: 1px solid #39F;padding:0 10px;background-color: #FFF;box-shadow: rgba(0, 0, 0, 0.3) 1px 1px 24px;">'+$(this).data("t")+'</font>');
+        }else if(event.type == "mouseout"){
+         $(this).parent().siblings("font").remove();
+        }
+    });
+    $(".data").on('mouseover',".lbwlxx",function() {
+        var offset = $(this).offset();
+        ///得到位置
+        var left1 = offset.left + 20;
+        ///得到位置
+        var top1 = offset.top + 20;
+        $(".lbwlxq").css({'top': top1, 'left': left1});
+        $(".lbwlxx").mouseover(function(){
+            $(".lbwlxq").html($(this).find('font').html());
+            $(".lbwlxq").show();
+        });
+        $(".data").on('mouseout',".lbwlxx",function() {
+            $(".lbwlxq").html("");
+            $(".lbwlxq").hide();
+        });
+    });
+    function excelexport(){
+        let url = "/zzququeu9/excel"
+        //timetk="+$("input[name='timetk']").val()+"&timetj="+$("input[name='timetj']").val();
+        let order_no = $("input[name='order_no']").val();
+        url += "?order_no="+order_no
+        let timetk = $("input[name='timetk']").val();
+        url += "&timetk="+timetk;
+        let timetj = $("input[name='timetj']").val()
+        url += "&timetj="+timetj;
+        let status = $(".select").val()
+        if(status){
+            url += "&status="+status;
+        }
+        
+        window.location.href = url
+    }
+
+     
+    </script>
+    <script type="text/javascript" src="{$theme}js/laydate.js"></script>
+    <script type="text/javascript" src="{$theme}js/print.js?v=202007160001"></script>
+
+
+    {Template footer}