From 585e878b169bdeb2bc8cc452b9d2e640d00caa6d Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期二, 04 七月 2023 09:00:35 +0800
Subject: [PATCH] 质检报告

---
 igds-web/src/main/resources/static/admin/inout/in-check.js |  290 +++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 179 insertions(+), 111 deletions(-)

diff --git a/igds-web/src/main/resources/static/admin/inout/in-check.js b/igds-web/src/main/resources/static/admin/inout/in-check.js
index 0a780a4..39ab7d8 100644
--- a/igds-web/src/main/resources/static/admin/inout/in-check.js
+++ b/igds-web/src/main/resources/static/admin/inout/in-check.js
@@ -1,5 +1,6 @@
 //褰撳墠鑺傜偣 鍏ュ簱璐ㄦ
 var layer;
+var laydate;
 var form;
 var table;
 var page = 1;
@@ -12,7 +13,7 @@
         layer = layui.layer;
         form = layui.form;
         table = layui.table;
-        var laydate = layui.laydate;
+        laydate = layui.laydate;
 
         laydate.render({
             elem: '#start',
@@ -27,9 +28,10 @@
         });
 
         laydate.render({
-            elem: '#foodYear',
+            elem: '#checkTime',
             theme: '#7b8e9f',
-            type: 'year',
+            format: 'yyyy-MM-dd HH:mm:ss',
+            type: 'datetime'
         });
 
         // 鍒濆鍖栬〃鍗曟暟鎹�
@@ -45,9 +47,14 @@
             }
         });
 
-        //鐩戝惉绮鍝佺
+        //鐩戝惉绮鍝佺锛岃幏鍙栧寲楠岄」
         layui.form.on('select(select_foodVariety)', function (data) {
             updateFoodVariety(data.value);
+        });
+
+        //鐩戝惉绮绛夌骇锛岃幏鍙栫伯椋熷畾浠�
+        layui.form.on('select(select_foodLevel)', function (data) {
+            getPriceByFoodLevel(data.value);
         });
 
         //鐩戝惉鍖栭獙缁撴灉鍗曞~鍐欐暟鎹�,骞剁粰鍑烘彁绀虹粨鏋�
@@ -108,23 +115,23 @@
     if (symbol && limit) {
         if (">=" == symbol) {
             if (newValue < limit) {
-                data.remarks = "涓嶅悎鏍�";
+                data.result = "0";
             } else {
-                data.remarks = "鍚堟牸";
+                data.result = "1";
             }
         }
         if ("<=" == symbol) {
             if (newValue > limit) {
-                data.remarks = "涓嶅悎鏍�";
+                data.result = "0";
             } else {
-                data.remarks = "鍚堟牸";
+                data.result = "1";
             }
         }
         if ("==" == symbol) {
             if (newValue != limit) {
-                data.remarks = "涓嶅悎鏍�";
+                data.result = "0";
             } else {
-                data.remarks = "鍚堟牸";
+                data.result = "1";
             }
         }
     }
@@ -144,7 +151,7 @@
     form.render('select');
 }
 
-//鏍规嵁閫夋嫨浠撳簱鏄剧ず绮鍝佺
+//鏍规嵁鍝佺鑾峰彇鍖栭獙椤�
 function updateFoodVariety(foodVariety) {
     if (null == foodVariety || "" == foodVariety) return;
     form.val("form-detail", {
@@ -153,6 +160,34 @@
     form.render();
 
     flushCheckItem(foodVariety);
+}
+
+//鏍规嵁閫夋嫨浠撳簱鏄剧ず绮鍝佺
+function getPriceByFoodLevel(foodLevel) {
+    if (null == foodLevel || "" == foodLevel) return;
+    form.val("form-detail", {
+        foodLevel: foodLevel
+    });
+    form.render();
+    var data = form.val("form-detail");
+
+    $.ajax({
+        type: "POST",
+        url: "../../basic/inout/get-price",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(data),
+        success: function (result) {
+            if (result.code != "0000") {
+                layer.msg(result.msg);
+            } else {
+                $("#check-result-tip2").text("绮瀹氫环锛�" + result.data.price + "鍏�/鍏枻");
+            }
+        },
+        error: function () {
+            layer.msg("鍚庡彴寮傚父锛岃閲嶈瘯鎴栬�呰仈绯荤鐞嗗憳锛侊紒");
+        }
+    });
 }
 
 // 鏌ヨ
@@ -253,6 +288,7 @@
         }
     });
 };
+
 // 鎵︽牱鏈鸿В闄ゆ�ュ仠
 function checkResetStop() {
     var param = JSON.stringify(checkDto);
@@ -277,6 +313,7 @@
         }
     });
 };
+
 //闅愯棌淇℃伅--鏇挎崲涓�*
 function replaceStr(str) {
     if (!str) {
@@ -295,14 +332,12 @@
 
 function showDetail(obj) {
     curCheckData = obj.data;
-    // console.log(curCheckData);
 
-    curCheckData.foodYear = dateFtt("yyyy", new Date());
-    curCheckData.checkUser = checkUser;
-    if (curCheckData.checkStatus == "NONE") {
-        //闅愯棌杞︾墝閮ㄥ垎淇℃伅
-        curCheckData.plateNum = replaceStr(curCheckData.plateNum);
+    curSampleData = obj.data;
+    if (!curCheckData.checkTime) {
+        curCheckData.checkTime = dateFtt("yyyy-MM-dd hh:mm:ss", new Date());
     }
+    curCheckData.checkUser = checkUser;
 
     // 璧嬪��
     form.val("form-detail", curCheckData);
@@ -311,7 +346,7 @@
     layer.open({
         type: 1,
         title: "鍖栭獙鍗曟槑缁�",
-        area: ['1400px', '650px'],
+        area: ['1400px', '700px'],
         shade: 0,
         content: $('#checkDetail'),
         btnAlign: 'c',
@@ -331,9 +366,9 @@
     });
 
     // 鑾峰彇鍖栭獙椤逛俊鎭�
-    flushCheckItem(null);
-};
-
+    flushCheckItem(curCheckData.foodVariety);
+    getPriceByFoodLevel(curCheckData.foodLevel);
+}
 
 /**
  * 鍒锋柊鍖栭獙缁撴灉椤�
@@ -341,6 +376,7 @@
 function flushCheckItem(foodVariety) {
     curCheckItems = null;
     $("#check-result-tip").text("妫�楠岀粨鏋滐細#");
+    $("#price-result-tip2").text("绮瀹氫环锛�#鍏�/鍏枻");
     curCheckData.foodVariety = foodVariety;
 
     var index = layer.load();
@@ -379,23 +415,23 @@
     }
     var msg;
     $.each(curCheckItems, function (index, data) {
-        if (!data.remarks) {
+        if (!data.result) {
             return true;
         }
-        if (data.remarks == "涓嶅悎鏍�") {
+        if (data.result == "0") {
             msg = "涓嶅悎鏍�";
             return false;
         }
-        if (data.remarks == "鍚堟牸") {
+        if (data.result == "1") {
             msg = "鍚堟牸";
         }
     });
     if (msg) {
-        $("#check-result-tip").text("妫�楠岀粨鏋滐細" + msg);
+        $("#check-result-tip").text("璐ㄦ缁撴灉锛�" + msg);
     } else {
-        $("#check-result-tip").text("妫�楠岀粨鏋滐細鍚堟牸");
+        $("#check-result-tip").text("璐ㄦ缁撴灉锛�#");
     }
-};
+}
 
 /**
  * 娓叉煋琛ㄦ牸
@@ -411,28 +447,68 @@
         even: true,
         cols: [[{
             field: 'standardName',
-            title: '鍖栭獙椤圭洰',
+            title: '妫�楠岄」鐩�',
             align: 'center',
-            width: '20%'
+            width: '10%'
         }, {
             field: 'value',
-            title: '鍖栭獙缁撴灉',
+            title: '妫�楠屽��',
             align: 'center',
-            width: '20%',
+            width: '10%',
             edit: 'text'
+        }, {
+            field: 'operaSymbolValue',
+            title: '鏍囧噯鍊�',
+            align: 'center',
+            width: '10%'
         }, {
             field: 'unit',
             title: '鍗曚綅',
             align: 'center',
             width: '10%'
         }, {
-            field: 'standardValue',
-            title: '鍖栭獙鏍囧噯',
+            field: 'deNum',
+            title: '鎵i噸',
             align: 'center',
-            width: '15%'
+            width: '10%',
+            edit: 'text'
+        }, {
+            field: 'addNum',
+            title: '澧為噸',
+            align: 'center',
+            width: '10%',
+            edit: 'text'
+        }, {
+            field: 'dePrice',
+            title: '鎵d环',
+            align: 'center',
+            width: '10%',
+            edit: 'text'
+        }, {
+            field: 'addPrice',
+            title: '澧炰环',
+            align: 'center',
+            width: '10%',
+            edit: 'text'
+        }, {
+            field: 'result',
+            title: '妫�楠岀粨鏋�',
+            align: 'center',
+            width: '10%',
+            templet: function (item) {
+                if (item.result == null) {
+                    return "";
+                }
+                if (item.result == '0') {
+                    return "涓嶅悎鏍�";
+                }
+                if (item.result == '1') {
+                    return "鍚堟牸";
+                }
+            }
         }, {
             field: 'remarks',
-            title: '璇�  鏄�',
+            title: '澶囨敞璇存槑',
             align: 'center',
             edit: 'text'
         }]]
@@ -451,16 +527,8 @@
         layer.alert("璇风‘璁ゅ寲楠岀粨鏋滐紒锛�");
         return;
     }
-    if (!curCheckData.depotId) {
-        layer.alert("璇烽�夋嫨瑁呭嵏浠撳簱锛侊紒");
-        return;
-    }
     if (!curCheckData.foodVariety) {
         layer.alert("璇风‘璁ょ伯椋熷搧绉嶏紒锛�");
-        return;
-    }
-    if (!curCheckData.foodYear) {
-        layer.alert("璇风‘璁ょ伯椋熷勾浠斤紒锛�");
         return;
     }
     if (!curCheckData.foodLevel) {
@@ -471,13 +539,12 @@
         layer.alert("璇风‘璁ょ伯椋熷畾浠凤紝濡備笉鑰冭檻瀹氫环锛岃濉啓0.0");
         return;
     }
-
     curCheckData.checkItems = curCheckItems;
 
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "../../basic/inout/update-check",
+        url: "../../basic/inout/submit-check",
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(curCheckData),
@@ -516,37 +583,43 @@
         contentType: "application/json;charset=UTF-8",
         cols: [[{
             field: 'checkId',
-            title: '妫�楠屽崟鍙�',
-            width: '13%',
+            title: '璐ㄦ鍗曞彿',
+            width: '10%',
             style: 'color: #f67d06;font-weight: bold'
         }, {
-            field: 'plateNum',
-            title: '杞﹁埞鍙�',
-            width: '11%',
-            style: 'font-weight: bold',
+            field: 'registerTime',
+            title: '鐧昏鏃堕棿',
+            width: '15%',
+            style: 'font-weight: bold'
+        }, {
+            field: 'sampleStatus',
+            title: '鏄惁鎵︽牱',
+            width: '10%',
             templet: function (item) {
-                if (item.checkStatus != "NONE") {
-                    return item.plateNum;
-                } else {
-                    var result = replaceStr(item.plateNum);
-                    return result == null ? "" : result;
+                if (item.sampleStatus == null) {
+                    return "鏈墻鏍�";
+                }
+                if (item.sampleStatus == 'NONE') {
+                    return "鏈墻鏍�";
+                }
+                if (item.sampleStatus == 'SAMPLE') {
+                    return "宸叉墻鏍�";
                 }
             }
         }, {
-            field: 'customerName',
-            title: '寰�鏉ュ崟浣�',
-            templet: function (item) {
-                if (item.checkStatus != "NONE") {
-                    return item.customerName;
-                } else {
-                    var result = replaceStr(item.customerName);
-                    return result == null ? "" : result;
-                }
-            }
+            field: 'sampleUser',
+            title: '鎵︽牱浜�',
+            width: '10%',
+            style: 'font-weight: bold'
+        }, {
+            field: 'sampleTime',
+            title: '鎵︽牱鏃堕棿',
+            width: '15%',
+            style: 'font-weight: bold'
         }, {
             field: 'foodVariety',
             title: '绮鍝佺',
-            width: '10%',
+            width: '11%',
             templet: function (item) {
                 var result = item.foodVariety;
                 $.each(listFoodVariety, function (index, data) {
@@ -560,7 +633,7 @@
         }, {
             field: 'depotId',
             title: '瑁呭嵏浠撳簱',
-            width: '10%',
+            width: '11%',
             templet: function (item) {
                 var result = item.depotId;
                 $.each(listDepot, function (index, data) {
@@ -574,7 +647,6 @@
         }, {
             field: 'checkStatus',
             title: '妫�楠岀粨鏋�',
-            width: '10%',
             style: 'font-weight: bold',
             templet: function (item) {
                 if (item.checkStatus == 'NONE') {
@@ -589,13 +661,9 @@
                 return item.checkStatus == null ? "" : item.checkStatus;
             }
         }, {
-            field: 'registerTime',
-            title: '鐧昏鏃堕棿',
-            width: '14%'
-        }, {
             field: '',
             title: '鎿嶄綔',
-            width: '9%',
+            width: '8%',
             toolbar: "#barControl"
         }]],
         where: param,
@@ -619,48 +687,13 @@
         "border-bottom": "2px solid #53adce",
         "background": "#eff4f6"
     });
-};
+}
 
 // 琛ㄥ崟娓呯┖
 function resetForm() {
     $("#form-param")[0].reset();
     form.render();
-};
-
-/**
- * 寮瑰嚭鎻愰啋妗�
- * @param msg 鎻愰啋淇℃伅
- * @param data 鏁版嵁淇℃伅锛屽彲鑳戒负绌�
- */
-function notify(msg, data) {
-    if (data) {
-        //璧嬪��
-        $("#resultMsg").text(msg);
-        $("#resultUserName").text(data.userName);
-        $("#resultPlateNum").text(data.plateNum);
-        if ("IN" == data.type) {
-            $("#resultType").text("鍏ュ簱-" + INOUT_PROGRESS_MSG(data.progress));
-        } else {
-            $("#resultType").text("鍑哄簱-" + INOUT_PROGRESS_MSG(data.progress));
-        }
-        $("#resultIntelCard").text(data.intelCard);
-
-        layer.open({
-            type: 1,
-            offset: ['150px', '200px'],
-            area: '450px;',
-            shade: 0.8,
-            id: 'dialog_notify_info',
-            btn: ['纭畾'],
-            content: $('#dialog-from-notify'),
-            yes: function (index) {
-                layer.closeAll();
-            }
-        });
-    } else {
-        layer.alert(msg, {offset: ['300px', '300px']});
-    }
-};
+}
 
 // ---------------------------绮浜у湴 -寮�濮� -------------------//
 // 寮瑰嚭绮浜у湴涓嬫媺妗�
@@ -755,4 +788,39 @@
     });
 };
 
+/**
+ * 寮瑰嚭鎻愰啋妗�
+ * @param msg 鎻愰啋淇℃伅
+ * @param data 鏁版嵁淇℃伅锛屽彲鑳戒负绌�
+ */
+function notify(msg, data) {
+    if (data) {
+        //璧嬪��
+        $("#resultMsg").text(msg);
+        $("#resultUserName").text(data.userName);
+        $("#resultPlateNum").text(data.plateNum);
+        if ("IN" == data.type) {
+            $("#resultType").text("鍏ュ簱-" + INOUT_PROGRESS_MSG(data.progress));
+        } else {
+            $("#resultType").text("鍑哄簱-" + INOUT_PROGRESS_MSG(data.progress));
+        }
+        $("#resultIntelCard").text(data.intelCard);
+
+        layer.open({
+            type: 1,
+            offset: ['150px', '200px'],
+            area: '450px;',
+            shade: 0.8,
+            id: 'dialog_notify_info',
+            btn: ['纭畾'],
+            content: $('#dialog-from-notify'),
+            yes: function (index) {
+                layer.closeAll();
+            }
+        });
+    } else {
+        layer.alert(msg, {offset: ['300px', '300px']});
+    }
+}
+
 // ---------------------------绮浜у湴 -缁撴潫 -------------------//
\ No newline at end of file

--
Gitblit v1.9.3