lvhao преди 10 часа
родител
ревизия
0de689f61e
променени са 2 файла, в които са добавени 73 реда и са изтрити 2 реда
  1. 27 0
      core/CoreApp/controllers/Beihuogl.php
  2. 46 2
      template/erp/beihuogl_ckbherprk.html

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

@@ -113,6 +113,8 @@ class Beihuogl extends Start_Controller {
             $this->_bhcxedit($arg_array);
         }elseif($arg == 'bhcxlistexcel'){
             $this->_bhcxlistexcel();
+        }elseif($arg == 'wlrlpdc'){
+            $this->_wlrlpdc();
         }
 		else
 		{
@@ -2636,4 +2638,29 @@ class Beihuogl extends Start_Controller {
            
         }
     }
+    //未录入料品导出
+    private function _wlrlpdc(){
+        if($this->input->method() === 'post'){
+            $dcd_no = $this->input->post('dcd_no');
+            $where = "dcd_no = '".$dcd_no."' and (title = '' or  title is Null)";
+            $this->db->where($where);
+            $query = $this->db->get('bhdcd');
+            $list = $query->result_array();
+            if(empty($list)){
+                echo json_encode(['success'=>false,'msg'=>'未录入料品导出失败']);exit;
+            }
+            $final_list = [];
+            foreach($list as $v){
+                $final_list[] = [
+                    '调出单'=>$v['dcd_no'],
+                    '中文品名'=>$v['zh'],
+                    '用友料号'=>$v['jm'],
+                    '备货单号'=>$v['bh_no']
+                ];
+            }
+            echo json_encode(['success'=>true,'msg'=>"导入成功",'data'=>$final_list]);exit;
+        }else{
+            echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit;
+        }
+    }
 }

+ 46 - 2
template/erp/beihuogl_ckbherprk.html

@@ -369,14 +369,58 @@ function doAddYcrkNew(){
 //未录入料品导出
 function wlrlpdc(){
     let dcd_no = $("input[name='dcd_no']").val();
-    alert(dcd_no)
+    $.post("/beihuogl/wlrlpdc", {dcd_no: dcd_no}, function(res){
+        if(res.success){
+            downloadexcel(res.data,dcd_no)
+        }else{
+            layx.confirm('提示',a.msg,null,{
+				buttons:[
+					{
+						label:'确定',
+						callback:function(id, button, event){
+							layx.destroy(id);
+						}
+					}
+				],dialogIcon:'error',shadable:0.6
+			})
+        }
+    },'json')
 }
 //重置料品信息
 function czlpxx(){
     let dcd_no = $("input[name='dcd_no']").val();
     alert(dcd_no)
 }
-</script>
 
+function downloadexcel(data,dcd_no){
+    let  sheet = XLSX.utils.json_to_sheet(data)
+
+    sheet['!cols'] = [
+            //订单号
+            {
+                wch:15,
+            },
+            //订单编码
+            {
+                wch:80,
+            },
+            //店铺名称
+            {
+                wch:60,
+            },
+            //状态
+            {
+                wch:15,
+            },
+    ];
+
+
+    let workbook = XLSX.utils.book_new();
+
+    XLSX.utils.book_append_sheet(workbook, sheet, "Sheet1");
+    XLSX.writeFile(workbook, dcd_no+"_料品未录入信息.xlsx");
+}
+</script>
 
+<script type="text/javascript" src="{$theme}js/excel/xlxswidth.js"></script>
 {Template footer}