From 1b72fc0dd1d7004de54ab0886e0323cb1b96198d Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期三, 10 一月 2024 16:38:53 +0800
Subject: [PATCH] 批次上料

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrderBatchInfo/controller/ProductionOrderBatchInfoController.java |   26 +++++++++++-
 guns-vip-main/src/main/webapp/pages/modular/kb/materialRegistration/materialRegistration.html                                        |   10 ++++-
 guns-vip-main/src/main/webapp/assets/modular/kb/materialRegistration/materialRegistration.js                                         |   44 ++++++++++++++++++---
 3 files changed, 68 insertions(+), 12 deletions(-)

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 5d20245..0db2488 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
@@ -168,11 +168,31 @@
     @ResponseBody
     @RequestMapping("/updateOrderBatchInfo")
     public ResponseData updateOrderBatchInfo(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
-        Long id = getCheckLocationCodeList(productionOrderBatchInfoParam).get(0).getId();
-        ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(id);
+        List<ProductionOrderBatchInfo> checkLocationCodeList = getCheckLocationCodeList(productionOrderBatchInfoParam);
+        ProductionOrderBatchInfo batchInfo = checkLocationCodeList.get(0);
+        ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(batchInfo.getId());
+        byId.setSpareField1(productionOrderBatchInfoParam.getSpareField1());
+        if(batchInfo.getState().equals("鏄�")){
+            if(!productionOrderBatchInfoParam.getLoadingCode().equals(batchInfo.getLoadingCode())){
+                return  ResponseData.success("0");
+            }else {
+                Integer count1 = Integer.parseInt(productionOrderBatchInfoParam.getSpareField1())+Integer.parseInt(batchInfo.getSpareField1());
+                byId.setSpareField1(count1.toString());
+            }
+        }
         byId.setState("鏄�");
         byId.setLoadingCode(productionOrderBatchInfoParam.getLoadingCode());
-        byId.setSpareField1(productionOrderBatchInfoParam.getSpareField1());
+        productionOrderBatchInfoService.saveOrUpdate(byId);
+        return ResponseData.success("1");
+    }
+
+    @ResponseBody
+    @RequestMapping("/resetting")
+    public ResponseData resetting(ProductionOrderBatchInfoParam productionOrderBatchInfoParam) {
+        ProductionOrderBatchInfo byId = productionOrderBatchInfoService.getById(productionOrderBatchInfoParam.getId());
+        byId.setState("鍚�");
+        byId.setSpareField1("0");
+        byId.setLoadingCode("");
         productionOrderBatchInfoService.saveOrUpdate(byId);
         return ResponseData.success();
     }
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 6f2896d..b1da3de 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
@@ -127,7 +127,7 @@
      */
     MaterialShortage.initColumn = function () {
         return [[
-            {type: 'numbers'},
+            {type: 'checkbox', fixed: 'left'},
             {field: 'id', hide: true, title: 'ID'},
             {field: 'workOrderNo', sort: true, title: '宸ュ崟鍙�', width: 150},
             // {field: 'loadingCode', sort: true, title: '涓婃枡宸ヤ綅', width: 105},
@@ -154,10 +154,36 @@
             url: Feng.ctxPath + '/productionOrderBatchInfo/boardList',
             // page: true,
             height: 345,
+            toolbar: '#toolbarDemo',
             cellMinWidth: 80,
             where:queryData,
             cols: MaterialShortage.initColumn()
         });
+    }
+
+    // 宸ュ叿鏍忎簨浠�
+    table.on('toolbar(materialShortageTable)', function(obj){
+        var id = obj.config.id;
+        var checkStatus = table.checkStatus(id);
+        switch(obj.event){
+            case 'getCheckData':
+                var data = checkStatus.data;
+                console.log(data.length)
+                console.log(data)
+                if(data.length!==1){
+                    Feng.error("璇锋纭�夋嫨涓�鏉℃暟鎹�")
+                    return
+                }
+                resetting(data[0].id)
+                break;
+        };
+    });
+
+    function resetting(data){
+        var resetting = new $ax(Feng.ctxPath + "/productionOrderBatchInfo/resetting?id=" + data);
+        var resettingResult = resetting.start();
+        initMaterialShortage()
+        Feng.success("閲嶇疆鎴愬姛")
     }
 
     // 鐢熶骇宸ュ崟璁剧疆鎸夐挳鐐瑰嚮浜嬩欢
@@ -335,14 +361,18 @@
             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 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();
+        if(updateOrderBatchInfoResult.data === "0"){
+            Feng.error("鎵规涓嶅悓鏃犳硶褰曞叆");
+            return;
+        }
         Feng.success("褰曞叆鎴愬姛")
         clean()
         initMaterialShortage()
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 aa929e2..f1ab9d1 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
@@ -44,7 +44,7 @@
                             <div class="layui-inline layui-col-md8">
                                 <label class="layui-form-label">鎵弿鏉$爜:</label>
                                 <div class="layui-input-block">
-                                    <input id="barCode" name="barCode" placeholder="鐗╂枡缂栫爜+鎵规鐮侊紙渚嬪瓙锛�101.021090-0120240110001锛�" type="text" class="layui-input" />
+                                    <input id="barCode" name="barCode" placeholder="鐗╂枡缂栫爜+鎵规鐮侊紙渚嬪瓙锛�1239920000036620240110001锛�" type="text" class="layui-input" />
                                 </div>
                             </div>
                             <div class="layui-inline">
@@ -100,7 +100,8 @@
 
     <div class="layui-col-sm8 layui-col-md8 layui-col-lg8">
         <div class="layui-card">
-            <div class="layui-card-header" style="font-weight: bold"><i class="layui-icon layui-icon-rate-solid"></i> 涓婃枡淇℃伅</div>
+            <div class="layui-card-header" style="font-weight: bold"><i class="layui-icon layui-icon-rate-solid"></i> 涓婃枡淇℃伅
+            </div>
             <div class="layui-card-body" style="height: 345px">
 <!--                <table class="layui-table" id="bomInfoTable" lay-filter="bomInfoTable"></table>-->
                 <table class="layui-table" id="materialShortageTable" lay-filter="materialShortageTable"></table>
@@ -212,6 +213,11 @@
     <span style="color: red;">鍚�</span>
     {{#  } }}
 </script>
+<script type="text/html" id="toolbarDemo">
+    <div class="layui-btn-container">
+        <button class="layui-btn layui-btn-sm" lay-event="getCheckData">閲嶇疆</button>
+    </div>
+</script>
 
 @}
 

--
Gitblit v1.9.3