From a556270e96bc6e7fa4202c466d57cc75f778c614 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期三, 10 一月 2024 14:20:29 +0800
Subject: [PATCH] 批次上料

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/params/BomInfoParam.java                                      |    3 
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/entity/BomInfo.java                                                 |   13 +
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/result/BomInfoResult.java                                     |    3 
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/mapper/mapping/ProductionOrderBatchInfoMapper.xml  |    1 
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java |   36 +++++
 guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html                                        |   22 ++
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/model/params/ProductionOrderBatchInfoParam.java    |    1 
 guns-vip-main/src/main/webapp/assets/modular/om/productionOrderBatchInfo/productionOrderBatchInfo.js                                 |   16 +-
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/mapper/mapping/BomInfoMapper.xml                                    |    4 
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java          |    7 
 guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js                                         |  254 ++++++++++++++++++++++-------------
 guns-vip-main/src/main/webapp/assets/modular/bs/bomInfo/bomInfo.js                                                                   |    1 
 12 files changed, 251 insertions(+), 110 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/entity/BomInfo.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/entity/BomInfo.java
index d5de23a..dc20686 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/entity/BomInfo.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/entity/BomInfo.java
@@ -107,6 +107,19 @@
     @TableField("remarks")
     private String remarks;
 
+    /**
+     * 澶囨敞
+     */
+    @TableField("line_code")
+    private String lineCode;
+
+    public String getLineCode() {
+        return lineCode;
+    }
+
+    public void setLineCode(String lineCode) {
+        this.lineCode = lineCode;
+    }
 
     public Long getId() {
         return id;
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/mapper/mapping/BomInfoMapper.xml b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/mapper/mapping/BomInfoMapper.xml
index 62740e6..718dacb 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/mapper/mapping/BomInfoMapper.xml
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/mapper/mapping/BomInfoMapper.xml
@@ -16,6 +16,8 @@
         <result column="traceability_type" property="traceabilityType" />
         <result column="quantity" property="quantity" />
         <result column="remarks" property="remarks" />
+        <result column="line_code" property="lineCode" />
+
     </resultMap>
 
     <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
@@ -23,7 +25,7 @@
         id AS "id", material_code AS "materialCode", material_name AS "materialName", product_code AS "productCode", product_name AS "productName",
         location_code AS "locationCode", location_name AS "locationName",
         loading_code AS "loadingCode", loading_name AS "loadingName",
-        traceability_type AS "traceabilityType", quantity AS "quantity", remarks AS "remarks"
+        traceability_type AS "traceabilityType", quantity AS "quantity", remarks AS "remarks", line_code AS "lineCode"
     </sql>
 
 
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/params/BomInfoParam.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/params/BomInfoParam.java
index 26347cd..19a4354 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/params/BomInfoParam.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/params/BomInfoParam.java
@@ -76,6 +76,9 @@
      */
     private String remarks;
 
+    private String lineCode;
+
+
     @Override
     public String checkParam() {
         return null;
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/result/BomInfoResult.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/result/BomInfoResult.java
index 7d0c9a7..af97d3f 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/result/BomInfoResult.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/bs/bomInfo/model/result/BomInfoResult.java
@@ -55,6 +55,9 @@
      */
     private String locationCode;
 
+    private String lineCode;
+
+
     /**
      * 宸ヤ綅鍚嶇О
      */
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java
index 1c3b059..d8db867 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/service/impl/ProductionOrdeInfoServiceImpl.java
@@ -124,7 +124,10 @@
 
     @Override
     public void saveOrderBatchInfo(ProductionOrdeInfoParam productionOrdeInfoParam) {
-        List<BomInfo> productCode = bomInfoService.list(new QueryWrapper<BomInfo>().eq("product_code", productionOrdeInfoParam.getMaterialCode()));
+        List<BomInfo> productCode = bomInfoService.list(new QueryWrapper<BomInfo>()
+                .eq("product_code", productionOrdeInfoParam.getMaterialCode())
+                .isNotNull("location_code")
+        );
         List<ProductionOrderBatchInfo> workOrderNo = orderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
         if(workOrderNo.size()==0){
             for (BomInfo bomInfo : productCode) {
@@ -135,6 +138,8 @@
                 param.setLoadingCode(bomInfo.getLoadingCode());
                 param.setMaterialCode(bomInfo.getMaterialCode());
                 param.setState("鍚�");
+                param.setSpareField1("0");
+                param.setSpareField2(bomInfo.getLineCode());
                 param.setCreateTime(new Date());
                 orderBatchInfoService.save(param);
             }
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java
index 8173e60..5d20245 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java
@@ -7,6 +7,7 @@
 import cn.stylefeng.roses.core.base.controller.BaseController;
 import cn.stylefeng.roses.kernel.model.response.ResponseData;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -130,9 +131,10 @@
     @ResponseBody
     @RequestMapping("/boardList")
     public ResponseData boardList(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
+        productionOrderBatchInfoService.findPageBySpec(productionOrderBatchInfoParam);
         List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
                 .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
-                .eq("loading_code", productionOrderBatchInfoParam.getLoadingCode())
+                .isNotNull("location_code")
         );
         return ResponseData.success(0,null,list);
     }
@@ -151,6 +153,38 @@
         return ResponseData.success();
     }
 
+    @ResponseBody
+    @RequestMapping("/checkLocationCode")
+    public ResponseData checkLocationCode(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
+        List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
+                .eq("material_code", productionOrderBatchInfoParam.getMaterialCode())
+                .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
+                .isNotNull("location_code")
+                .eq("state", "鍚�")
+        );
+        return ResponseData.success(list.size());
+    }
+
+    @ResponseBody
+    @RequestMapping("/updateOrderBatchInfo")
+    public ResponseData updateOrderBatchInfo(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
+        Long id = getCheckLocationCodeList(productionOrderBatchInfoParam).get(0).getId();
+        ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(id);
+        byId.setState("鏄�");
+        byId.setLoadingCode(productionOrderBatchInfoParam.getLoadingCode());
+        byId.setSpareField1(productionOrderBatchInfoParam.getSpareField1());
+        productionOrderBatchInfoService.saveOrUpdate(byId);
+        return ResponseData.success();
+    }
+
+    public List<ProductionOrderBatchInfo> getCheckLocationCodeList(ProductionOrderBatchInfoParam productionOrderBatchInfoParam){
+        List<ProductionOrderBatchInfo> list = productionOrderBatchInfoService.list(new QueryWrapper<ProductionOrderBatchInfo>()
+                .eq("material_code", productionOrderBatchInfoParam.getMaterialCode())
+                .eq("work_order_no", productionOrderBatchInfoParam.getWorkOrderNo())
+                .isNotNull("location_code")
+        );
+        return list;
+    }
 }
 
 
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/mapper/mapping/ProductionOrderBatchInfoMapper.xml b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/mapper/mapping/ProductionOrderBatchInfoMapper.xml
index c770b32..494c5a3 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/mapper/mapping/ProductionOrderBatchInfoMapper.xml
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/mapper/mapping/ProductionOrderBatchInfoMapper.xml
@@ -57,6 +57,7 @@
         <if test="paramCondition.loadingCode != null and paramCondition.loadingCode != ''">
             and loading_code like CONCAT('%',#{paramCondition.loadingCode},'%')
         </if>
+
     </select>
 
     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam">
diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/model/params/ProductionOrderBatchInfoParam.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/model/params/ProductionOrderBatchInfoParam.java
index d1561e3..9363d2d 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/model/params/ProductionOrderBatchInfoParam.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/model/params/ProductionOrderBatchInfoParam.java
@@ -57,6 +57,7 @@
      */
     private String state;
 
+
     /**
      * 棰勭暀瀛楁1
      */
diff --git a/guns-vip-main/src/main/webapp/assets/modular/bs/bomInfo/bomInfo.js b/guns-vip-main/src/main/webapp/assets/modular/bs/bomInfo/bomInfo.js
index 9b5de34..554041e 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/bs/bomInfo/bomInfo.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/bs/bomInfo/bomInfo.js
@@ -31,6 +31,7 @@
             // {field: 'traceabilityType', sort: true, title: '杩芥函绫诲瀷'},
             {field: 'traceabilityType', title: '杩芥函绫诲瀷',width: 100, templet: function (data) {if (data.traceabilityType === '1') return '缂栧彿杩芥函';else if (data.traceabilityType === '2') return '鎵规杩芥函'; else return '杩芥函';}},
             {field: 'quantity', sort: true, title: '鏁伴噺',align:'center'},
+            {field: 'lineCode', sort: true, title: '鍗曚綅',align:'center'},
             {field: 'remarks', sort: true, title: '澶囨敞'},
             {align: 'center', toolbar: '#tableBar', title: '鎿嶄綔', width: 125}
         ]];
diff --git a/guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js b/guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js
index 0ed2916..77c317d 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js
@@ -31,11 +31,12 @@
     async function initPageInfo() {
         await initKanBanConfInfo();//鍒濆鍖栭厤缃俊鎭�
         await initOrderInfo();
-        initBomTable();
+       // initBomTable();
         initMaterialShortage();
      /*   xR();
         xa();*/
     }
+
 
 
 
@@ -87,7 +88,7 @@
 
     function initBomTable(){
         var queryData = {};
-        queryData['loadingCode'] = $("#locationCode").val();
+        // queryData['loadingCode'] = $("#locationCode").val();
         // queryData['workOrderNo'] = $("#workOrderNo").val();
 
         // 娓叉煋琛ㄦ牸
@@ -115,7 +116,7 @@
             // {field: 'workorderNo', sort: true, title: '宸ュ崟缂栧彿'},
             // {field: 'productCode', sort: true, title: '浜у搧缂栧彿'},
             {field: 'locationCode', sort: true, title: '宸ヤ綅缂栧彿'},
-            {field: 'loadingCode', sort: true, title: '涓婃枡宸ヤ綅缂栧彿'},
+           // {field: 'loadingCode', sort: true, title: '涓婃枡宸ヤ綅缂栧彿'},
             // {field: 'state', sort: true, title: '鏄惁鎵爜'},
             // {field: 'batchCode', sort: true, title: '鎵规鐮�'},
         ]];
@@ -131,17 +132,21 @@
             {field: 'workOrderNo', sort: true, title: '宸ュ崟鍙�', width: 165},
             // {field: 'loadingCode', sort: true, title: '涓婃枡宸ヤ綅', width: 105},
             {field: 'locationCode', sort: true, title: '宸ヤ綅缂栧彿', width: 105},
-            {field: 'loadingCode', sort: true, title: '鎵爜宸ヤ綅缂栧彿', width: 105},
-            {field: 'materialCode', sort: true, title: '鐗╂枡缂栫爜'},
-            {field: 'barCode', sort: true, title: '鎵爜缂栧彿'},
-            {field: 'state', sort: true, title: '鏄惁鎵爜', width: 105},
+            //{field: 'loadingCode', sort: true, title: '鎵爜宸ヤ綅缂栧彿', width: 105},
+            {field: 'materialCode', sort: true, title: '鐗╂枡缂栫爜', width: 135},
+            {field: 'spareField1', sort: true, title: '鍓╀綑鏁伴噺'},
+            {field: 'spareField2', sort: true, title: '鍗曚綅'},
+            {field: 'loadingCode', sort: true, title: '鐗╂枡鎵规'},
+            {field: 'state', sort: true, title: '鏄惁鎵爜', width: 105,templet: '#stateTpl'},
+            // {field: 'orderStatus', sort: true, title: '鐘舵��',align:'center',width:80,templet: '#orderStatusTpl'},
+
         ]];
     };
 
     function initMaterialShortage(){
         var queryData = {};
         queryData['workOrderNo'] = $("#workOrderNo").val();
-        queryData['loadingCode'] = $("#locationCode").val();
+        // queryData['loadingCode'] = $("#locationCode").val();
 
         // 娓叉煋琛ㄦ牸
         var tableResult = table.render({
@@ -239,56 +244,110 @@
         });
     };
 
-    $("#barCode").bind("keydown",function(e){
-        // 鍏煎FF鍜孖E鍜孫pera
-        var theEvent = e || window.event;
-        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
-        if (code === 13) {
-            var ajax1 = new $ax(Feng.ctxPath + "/bomInfo/bomCheck?materialCode=" +$('#barCode').val()+"&loadingCode="+$('#locationCode').val());
-            var result1 = ajax1.start();
-            console.log(result1.data);
-            if(result1.data!==0) {
-                //鍥炶溅鎵ц鏌ヨ
-                var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/barCodeCheck?materialCode=" + $('#barCode').val() + "&workOrderNo=" + $('#workOrderNo').val());
-                var result = ajax.start();
-                console.log(result.data);
-                if (result.data === 0) {
-                    let ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateState", function (data) {
-                    }, function (data) {
-                        Feng.error("娣诲姞澶辫触锛�" + data.responseJSON.message)
-                    });
-                    ajax.set("materialCode", $('#barCode').val());
-                    ajax.set("workOrderNo", $('#workOrderNo').val());
-                    ajax.set("state", "鏄�");
-                    ajax.start();
-                    // initBomTable();
-                    initMaterialShortage();
-                } else {
-                    layer.open({
-                        title: "鎿嶄綔鎻愮ず",
-                        icon: 0,
-                        closeBtn: 2,
-                        area: ['450px', '160px'],
-                        time: 5000,
-                        content: '<span style="font-size: 30px;color: red">璇ユ爣绛惧凡琚壂鎻�!!!</span>'
-                    });
-                }
-            }else {
-                layer.open({
-                    title: "鎿嶄綔鎻愮ず",
-                    icon: 0,
-                    closeBtn: 2,
-                    area: ['450px', '160px'],
-                    time: 5000,
-                    content: '<span style="font-size: 30px;color: red">BOM鏍¢獙閿欒璇烽噸鏂版壂鐮�!!!</span>'
-                });
-            }
-        }
-    });
+    // $("#barCode").bind("keydown",function(e){
+    //     // 鍏煎FF鍜孖E鍜孫pera
+    //     var theEvent = e || window.event;
+    //     var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
+    //     if (code === 13) {
+    //         var ajax1 = new $ax(Feng.ctxPath + "/bomInfo/bomCheck?materialCode=" +$('#barCode').val()+"&loadingCode="+$('#locationCode').val());
+    //         var result1 = ajax1.start();
+    //         console.log(result1.data);
+    //         if(result1.data!==0) {
+    //             //鍥炶溅鎵ц鏌ヨ
+    //             var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/barCodeCheck?materialCode=" + $('#barCode').val() + "&workOrderNo=" + $('#workOrderNo').val());
+    //             var result = ajax.start();
+    //             console.log(result.data);
+    //             if (result.data === 0) {
+    //                 let ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateState", function (data) {
+    //                 }, function (data) {
+    //                     Feng.error("娣诲姞澶辫触锛�" + data.responseJSON.message)
+    //                 });
+    //                 ajax.set("materialCode", $('#barCode').val());
+    //                 ajax.set("workOrderNo", $('#workOrderNo').val());
+    //                 ajax.set("state", "鏄�");
+    //                 ajax.start();
+    //                 // initBomTable();
+    //                 initMaterialShortage();
+    //             } else {
+    //                 layer.open({
+    //                     title: "鎿嶄綔鎻愮ず",
+    //                     icon: 0,
+    //                     closeBtn: 2,
+    //                     area: ['450px', '160px'],
+    //                     time: 5000,
+    //                     content: '<span style="font-size: 30px;color: red">璇ユ爣绛惧凡琚壂鎻�!!!</span>'
+    //                 });
+    //             }
+    //         }else {
+    //             layer.open({
+    //                 title: "鎿嶄綔鎻愮ず",
+    //                 icon: 0,
+    //                 closeBtn: 2,
+    //                 area: ['450px', '160px'],
+    //                 time: 5000,
+    //                 content: '<span style="font-size: 30px;color: red">BOM鏍¢獙閿欒璇烽噸鏂版壂鐮�!!!</span>'
+    //             });
+    //         }
+    //     }
+    // });
 
     $('#btnClean').click(function (){
-        $('#barCode').val("");
+        clean()
     });
+
+    function clean(){
+        $('#barCode').val("");
+        $('#number').val("");
+    }
+    $('#confirm').click(function (){
+        inputMethod($('#barCode').val());
+       // let barCode = $('#barCode').val();
+       // let batch = barCode.substring(14,25);
+       // let number = $('#number').val();
+       // if(barCode === '' || number === ''){
+       //     Feng.error("璇疯緭鍏ユ潯鐮佸拰鏁伴噺鐨勫畬鏁翠俊鎭�");
+       //     return
+       // }else if(barCode.length!==25){
+       //     Feng.error("璇疯緭鍏ュ畬鏁撮暱搴︿俊鎭�");
+       //     return
+       // }
+       // var checkLocationCode = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/checkLocationCode?materialCode=" + barCode.substring(0, 14) + "&workOrderNo="+ $('#workOrderNo').val());
+       // var checkLocationCodeResult = checkLocationCode.start();
+       // if(checkLocationCodeResult.data === 0){
+       //     Feng.error("鏉$爜淇℃伅寮傚父")
+       //     return
+       // }
+       //  var updateOrderBatchInfo = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateOrderBatchInfo?materialCode=" + barCode.substring(0, 14) + "&workOrderNo="+ $('#workOrderNo').val()+ "&spareField1="+ number + "&loadingCode="+ batch);
+       //  var updateOrderBatchInfoResult = updateOrderBatchInfo.start();
+       //  Feng.success("褰曞叆鎴愬姛")
+       //  clean()
+       //  initMaterialShortage()
+    });
+
+    function inputMethod(inBarCode){
+        let barCode = inBarCode;
+        let batch = barCode.substring(14,25);
+        let number = $('#number').val();
+        if(barCode === '' || number === ''){
+            Feng.error("璇疯緭鍏ユ潯鐮佸拰鏁伴噺鐨勫畬鏁翠俊鎭�");
+            return
+        }else if(barCode.length!==25){
+            Feng.error("璇疯緭鍏ュ畬鏁撮暱搴︿俊鎭�");
+            return
+        }
+        var checkLocationCode = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/checkLocationCode?materialCode=" + barCode.substring(0, 14) + "&workOrderNo="+ $('#workOrderNo').val());
+        var checkLocationCodeResult = checkLocationCode.start();
+        if(checkLocationCodeResult.data === 0){
+            Feng.error("鏉$爜淇℃伅寮傚父")
+            return
+        }
+        var updateOrderBatchInfo = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateOrderBatchInfo?materialCode=" + barCode.substring(0, 14) + "&workOrderNo="+ $('#workOrderNo').val()+ "&spareField1="+ number + "&loadingCode="+ batch);
+        var updateOrderBatchInfoResult = updateOrderBatchInfo.start();
+        Feng.success("褰曞叆鎴愬姛")
+        clean()
+        initMaterialShortage()
+    }
+
 
     var websocket = null;
     //鍒ゆ柇褰撳墠娴忚鍣ㄦ槸鍚︽敮鎸乄ebSocket
@@ -301,48 +360,49 @@
     }
     //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶
     websocket.onmessage = function(event) {
-        console.log(event);
-        console.log(event.data)
-        $('#barCode').val(event.data);
-            var ajax1 = new $ax(Feng.ctxPath + "/bomInfo/bomCheck?materialCode=" +$('#barCode').val()+"&loadingCode="+$('#locationCode').val());
-            var result1 = ajax1.start();
-            console.log(result1.data);
-            if(result1.data!==0) {
-                //鍥炶溅鎵ц鏌ヨ
-                var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/barCodeCheck?materialCode=" + $('#barCode').val() + "&workOrderNo=" + $('#workOrderNo').val());
-                var result = ajax.start();
-                console.log(result.data);
-                if (result.data === 0) {
-                    let ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateState", function (data) {
-                    }, function (data) {
-                        Feng.error("娣诲姞澶辫触锛�" + data.responseJSON.message)
-                    });
-                    ajax.set("materialCode", $('#barCode').val());
-                    ajax.set("workOrderNo", $('#workOrderNo').val());
-                    ajax.set("state", "鏄�");
-                    ajax.start();
-                    // initBomTable();
-                    initMaterialShortage();
-                } else {
-                    layer.open({
-                        title: "鎿嶄綔鎻愮ず",
-                        icon: 0,
-                        closeBtn: 2,
-                        area: ['450px', '160px'],
-                        time: 5000,
-                        content: '<span style="font-size: 30px;color: red">璇ユ爣绛惧凡琚壂鎻�!!!</span>'
-                    });
-                }
-            }else {
-                layer.open({
-                    title: "鎿嶄綔鎻愮ず",
-                    icon: 0,
-                    closeBtn: 2,
-                    area: ['450px', '160px'],
-                    time: 5000,
-                    content: '<span style="font-size: 30px;color: red">BOM鏍¢獙閿欒璇烽噸鏂版壂鐮�!!!</span>'
-                });
-            }
+        inputMethod(event.data);
+        // console.log(event);
+        // console.log(event.data)
+        // $('#barCode').val(event.data);
+        //     var ajax1 = new $ax(Feng.ctxPath + "/bomInfo/bomCheck?materialCode=" +$('#barCode').val()+"&loadingCode="+$('#locationCode').val());
+        //     var result1 = ajax1.start();
+        //     console.log(result1.data);
+        //     if(result1.data!==0) {
+        //         //鍥炶溅鎵ц鏌ヨ
+        //         var ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/barCodeCheck?materialCode=" + $('#barCode').val() + "&workOrderNo=" + $('#workOrderNo').val());
+        //         var result = ajax.start();
+        //         console.log(result.data);
+        //         if (result.data === 0) {
+        //             let ajax = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/updateState", function (data) {
+        //             }, function (data) {
+        //                 Feng.error("娣诲姞澶辫触锛�" + data.responseJSON.message)
+        //             });
+        //             ajax.set("materialCode", $('#barCode').val());
+        //             ajax.set("workOrderNo", $('#workOrderNo').val());
+        //             ajax.set("state", "鏄�");
+        //             ajax.start();
+        //             // initBomTable();
+        //             initMaterialShortage();
+        //         } else {
+        //             layer.open({
+        //                 title: "鎿嶄綔鎻愮ず",
+        //                 icon: 0,
+        //                 closeBtn: 2,
+        //                 area: ['450px', '160px'],
+        //                 time: 5000,
+        //                 content: '<span style="font-size: 30px;color: red">璇ユ爣绛惧凡琚壂鎻�!!!</span>'
+        //             });
+        //         }
+        //     }else {
+        //         layer.open({
+        //             title: "鎿嶄綔鎻愮ず",
+        //             icon: 0,
+        //             closeBtn: 2,
+        //             area: ['450px', '160px'],
+        //             time: 5000,
+        //             content: '<span style="font-size: 30px;color: red">BOM鏍¢獙閿欒璇烽噸鏂版壂鐮�!!!</span>'
+        //         });
+        //     }
     }
 
     //杩炴帴鎴愬姛寤虹珛鐨勫洖璋冩柟娉�
diff --git a/guns-vip-main/src/main/webapp/assets/modular/om/productionOrderBatchInfo/productionOrderBatchInfo.js b/guns-vip-main/src/main/webapp/assets/modular/om/productionOrderBatchInfo/productionOrderBatchInfo.js
index 8521c05..948a267 100644
--- a/guns-vip-main/src/main/webapp/assets/modular/om/productionOrderBatchInfo/productionOrderBatchInfo.js
+++ b/guns-vip-main/src/main/webapp/assets/modular/om/productionOrderBatchInfo/productionOrderBatchInfo.js
@@ -19,14 +19,16 @@
         return [[
             {type: 'checkbox'},
             {field: 'id', hide: true, title: '涓婚敭id'},
-            {field: 'workOrderNo', sort: true, title: '宸ュ崟缂栧彿',minWidth:160},
-            {field: 'productionLine', sort: true, title: '浜х嚎缂栧彿'},
-            {field: 'locationCode', sort: true, title: '宸ヤ綅缂栧彿'},
-            {field: 'state', sort: true, title: '鏄惁涓婃枡'},
-            {field: 'createUser', sort: true, title: '鍒涘缓鐢ㄦ埛'},
-            {field: 'updateUser', sort: true, title: '鏇存敼鐢ㄦ埛'},
+            {field: 'workOrderNo', sort: true, title: '宸ュ崟鍙�', width: 165},
+            // {field: 'loadingCode', sort: true, title: '涓婃枡宸ヤ綅', width: 105},
+            {field: 'locationCode', sort: true, title: '宸ヤ綅缂栧彿', width: 105},
+            //{field: 'loadingCode', sort: true, title: '鎵爜宸ヤ綅缂栧彿', width: 105},
+            {field: 'materialCode', sort: true, title: '鐗╂枡缂栫爜'},
+            {field: 'spareField1', sort: true, title: '鍓╀綑鏁伴噺'},
+            {field: 'loadingCode', sort: true, title: '鐗╂枡鎵规'},
+            {field: 'state', sort: true, title: '鏄惁鎵爜', width: 105,templet: '#stateTpl'},
             {field: 'createTime', sort: true, title: '鍒涘缓鏃堕棿',minWidth:160},
-            {field: 'updateTime', sort: true, title: '淇敼鏃堕棿',minWidth:160},
+            // {field: 'updateTime', sort: true, title: '淇敼鏃堕棿',minWidth:160},
             {align: 'center', toolbar: '#tableBar', title: '鎿嶄綔'}
         ]];
     };
diff --git a/guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html b/guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html
index a3ef2b0..ba96757 100644
--- a/guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html
+++ b/guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html
@@ -47,8 +47,18 @@
                                     <input id="barCode" name="barCode" placeholder="鎵弿鏉$爜锛岃幏鍙栫墿鏂欑紪鍙凤紝鑾峰彇鎵爜绫诲瀷锛屽鏋滄槸鎵规涓婃枡锛岀洿鎺ュ瓨宸ュ崟鎵规琛紝濡傛灉鏄潯鐮佽拷婧紝鐩存帴瀛樿拷婧〃锛堟壘鏈�鏂扮殑杩涜缁戝畾锛�" type="text" class="layui-input" />
                                 </div>
                             </div>
-                            <div class="layui-inline" >
-                                <button id="btnClean" class="layui-btn layui-btn-radius  layui-btn-normal layui-btn-lg">娓� 闄�</button>
+                            <div class="layui-inline">
+                                <button id="btnClean" class="layui-btn layui-btn-radius layui-btn-danger layui-btn-lg">娓� 闄�</button>
+                            </div>
+                            <br>
+                            <div class="layui-inline layui-col-md8">
+                                <label class="layui-form-label">鍓╀綑鏁伴噺:</label>
+                                <div class="layui-input-block">
+                                    <input id="number" name="number" placeholder="璇疯緭鍏ユ暟閲�" type="number" class="layui-input" />
+                                </div>
+                            </div>
+                            <div class="layui-inline">
+                                <button id="confirm" class="layui-btn layui-btn-radius  layui-btn-normal layui-btn-lg">纭� 璁�</button>
                             </div>
                         </div>
                     </div>
@@ -195,7 +205,13 @@
 
     </div>
 </div>
-
+<script type="text/html" id="stateTpl">
+    {{#  if(d.state == '鏄�'){ }}
+    <span style="color: green">鏄�</span>
+    {{#  } else if(d.state == '鍚�'){ }}
+    <span style="color: red;">鍚�</span>
+    {{#  } }}
+</script>
 
 @}
 

--
Gitblit v1.9.3