From 52ea5fd92596267379be7924deb27de6cb10632b Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期四, 04 十二月 2025 20:33:46 +0800
Subject: [PATCH] 称重及值仓页面及逻辑

---
 fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js |  592 +++++++++++++++++++++++++---------------------------------
 1 files changed, 254 insertions(+), 338 deletions(-)

diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
index 847f491..4b14cbf 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-weight2.js
@@ -5,10 +5,9 @@
 var page = 1;
 var limit = 15;
 var recordData = null;
-var selectData = null;  //鍗曢�夌殑淇℃伅
 var snapData;//绯荤粺鎶撴媿瀵硅薄淇℃伅
 var timerWeight;
-var img1, img2, img3;// 椤甸潰涓殑鍥剧墖涓婁紶鍚嶇О
+var curProgress = null;
 
 $(function () {
     layui.use(['layer', 'laydate', 'form', 'table'], function () {
@@ -43,28 +42,14 @@
             }
         });
 
-        // 鐩戝惉浠撳簱閫夋嫨锛岄�夋嫨鍚庤嚜鍔ㄨ皟鐢ㄤ粨搴撶殑绮搧绉嶅拰浜у湴淇℃伅
-        form.on('select(select_depotId)', function (obj) {
-            updateFoodVarietyByDepot(obj.value);
-        });
         // 鍒濆鍖栬〃鍗曟暟鎹�
         renderTable();
     });
 
-    //鏄剧ず绉伴噸寮圭獥娴佺▼
-    showProgress();
-
-    // 鐩戝惉姣斾緥鍊煎~鍐�
-    $(".per").blur(function () {
-        deAutoByPer();
-    });
-
-    // 鐩戝惉姣斾緥鍊煎~鍐�
+    // 鐩戝惉閲嶉噺鍙樺寲
     $(".weight").blur(function () {
-        deAutoByWeight();
+        deAuto(this.name);
     });
-    //鍒濆鍖朩ebSocket
-    // initWS(deptId, bizType, progress, userId);
 });
 
 window.onload = function () {
@@ -75,7 +60,7 @@
     }, 2500);
 
     // 鍔犺浇瑙嗛
-    initVideo(lprDto, snapDto1, snapDto2);
+    initVideo(snapDto1, snapDto2, snapDto3);
 
     //璁剧疆鍦扮
     $("#scaleName").val(weightDto.sort);
@@ -94,6 +79,7 @@
 function flushData() {
     var index = layer.load();
     var param = form.val("form-param");
+    param.weightTag = "WEIGHT";
     table.reload('tableData', {
         url: "/basic/inout/page-inout-data",
         where: param
@@ -108,6 +94,7 @@
 // 娓叉煋琛ㄥ崟鏁版嵁
 function renderTable() {
     var param = form.val("form-param");
+    param.weightTag = "WEIGHT";
     // 娓呯┖鏁版嵁
     $("#tableData").empty();
     table.render({
@@ -162,8 +149,8 @@
             templet: function (item) {
                 var result = item.foodVariety;
                 $.each(listFoodVariety, function (index, data) {
-                    if (item.foodVariety == data.code) {
-                        result = data.name;
+                    if (item.foodVariety == data.dictValue) {
+                        result = data.dictLabel;
                         return true;
                     }
                 });
@@ -206,17 +193,19 @@
     });
 }
 
-/*-----------------------寮圭獥鏄剧ず娓叉煋-寮�濮�------------------------------*/
-
-//鎿嶄綔鍓嶏紝閲嶆柊娴佹按鏁版嵁褰撳墠淇℃伅
+/**
+ * 绉伴噸寮圭獥閲嶆柊鏌ヨ鏁版嵁
+ * @param obj
+ */
 function afreshGetData(obj) {
     var index = layer.load();
     recordData = null;
     var data = obj.data;
     var param = {
-        userId: data.userId,
-        plateNum: data.plateNum,
-        id: data.id
+        type: data.type,
+        progress: data.progress,
+        id: data.id,
+        plateNum: data.plateNum
     };
     $.ajax({
         type: "POST",
@@ -229,7 +218,8 @@
                 layer.alert("璇峰埛鏂伴〉闈㈠悗锛岄噸鏂版搷浣滐紒锛�");
             } else {
                 recordData = result.data;
-                showWindows(recordData.progress);
+                curProgress = recordData.progress;
+                showWindows();
             }
             layer.close(index);
         },
@@ -240,13 +230,16 @@
     });
 }
 
-//鏄剧ず娴佺▼鎿嶄綔寮圭獥
+/**
+ * 鐧昏寮圭獥
+ */
 function quickRegister() {
     //鐧昏鎸夐挳鏀惧紑
     $("#btn_register").css("display", "block");
     $("#text-info").removeClass("text-info");
     //绉伴噸鎿嶄綔寮圭獥
     var pro = '鐧昏';
+    recordData = null;
     updateEditAndProgress();
     flushPage();
     layer.open({
@@ -263,15 +256,18 @@
     });
 }
 
-//鏄剧ず娴佺▼鎿嶄綔寮圭獥
-function showWindows(progress) {
+/**
+ * 绉伴噸寮圭獥
+ * @param progress
+ */
+function showWindows() {
 
     //鐧昏鎸夐挳鏀惧紑
     $("#btn_register").css("display", "none");
     $("#text-info").addClass("text-info");
     //绉伴噸鎿嶄綔寮圭獥
     var pro = '绌鸿溅绉伴噸';
-    if (progress == 'WEIGHT_FULL') {
+    if (curProgress == 'WEIGHT_FULL') {
         pro = '婊¤溅绉伴噸';
     }
     updateEditAndProgress();
@@ -290,61 +286,117 @@
     });
 }
 
-//绉伴噸寮圭獥涓祦绋嬬幆鑺傛樉绀�
-function showProgress() {
-    if (!inoutProgress) {
-        return;
-    }
-    if (inoutProgress.indexOf("REGISTER") == -1) {
-        $("#progress-register").css("display", "none");
-    }
-    if (inoutProgress.indexOf("WEIGHT_FULL") == -1) {
-        $("#progress-fullWeight").css("display", "none");
-    }
-    if (inoutProgress.indexOf("HANDLE") == -1) {
-        $("#progress-hand").css("display", "none");
-    }
-    if (inoutProgress.indexOf("WEIGHT_EMPTY") == -1) {
-        $("#progress-emptyWeight").css("display", "none");
-    }
-    if (inoutProgress.indexOf("CARD_BACK") == -1) {
-        $("#progress-cardBack").css("display", "none");
-    }
-}
-
-//绉伴噸寮圭獥涓洿鏂版祦绋嬭妭鐐�
+/**
+ * 鏍规嵁涓氬姟鏁版嵁鏇存柊椤甸潰涓殑鐘舵��
+ */
 function updateEditAndProgress() {
-    if (recordData) {
-        if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
-            $("#emptyWeight").removeClass("rkbk-search-input");
-            $("#emptyWeight").attr("disabled", false);
-
-            $("#progress-hand").removeClass("active");
-            $("#progress-fullWeight").removeClass("active");
-
-            $("#fullWeight").addClass("rkbk-search-input");
-            $("#fullWeight").attr("disabled", true);
+    //褰撳墠娴佺▼鑺傜偣
+    if (curProgress == null) {
+        if (type === "IN") {
+            curProgress = "WEIGHT_FULL";
         }
+        if (type === "OUT") {
+            curProgress = "WEIGHT_EMPTY";
+        }
+    }
+    //鏄剧ず褰撳墠娴佺▼
+    if (type === "IN") {
+        $("#rk-progress-register").addClass("active");
+        if (curProgress === InoutProgress.WEIGHT_FULL) {
+            $("#rk-progress-fullWeight").addClass("active");
+            $("#rk-progress-hand").removeClass("active");
+            $("#rk-progress-emptyWeight").removeClass("active");
 
-        if (InoutProgress.WEIGHT_FULL == recordData.progress) {
+            //婊¤溅閲嶉噺鍙紪杈�
             $("#fullWeight").removeClass("rkbk-search-input");
             $("#fullWeight").attr("disabled", false);
 
-            $("#progress-hand").addClass("active");
-            $("#progress-fullWeight").addClass("active");
-
+            //绌鸿溅閲嶉噺涓嶈兘缂栬緫
             $("#emptyWeight").addClass("rkbk-search-input");
             $("#emptyWeight").attr("disabled", true);
         }
-    } else {
+        if (curProgress === InoutProgress.WEIGHT_EMPTY) {
+            $("#rk-progress-fullWeight").addClass("active");
+            $("#rk-progress-hand").addClass("active");
+            $("#rk-progress-emptyWeight").addClass("active");
+
+            //婊¤溅閲嶉噺涓嶈兘缂栬緫
+            $("#fullWeight").addClass("rkbk-search-input");
+            $("#fullWeight").attr("disabled", true);
+
+            //绌鸿溅閲嶉噺鍙紪杈�
+            $("#emptyWeight").removeClass("rkbk-search-input");
+            $("#emptyWeight").attr("disabled", false);
+        }
+    }
+    if (type === "OUT") {
+        $("#ck-progress-register").addClass("active");
+        if (curProgress === InoutProgress.WEIGHT_EMPTY) {
+            $("#ck-progress-emptyWeight").addClass("active");
+            $("#ck-progress-hand").removeClass("active");
+            $("#ck-progress-fullWeight").removeClass("active");
+
+            //婊¤溅閲嶉噺涓嶈兘缂栬緫
+            $("#fullWeight").addClass("rkbk-search-input");
+            $("#fullWeight").attr("disabled", true);
+
+            //绌鸿溅閲嶉噺鍙紪杈�
+            $("#emptyWeight").removeClass("rkbk-search-input");
+            $("#emptyWeight").attr("disabled", false);
+        }
+        if (curProgress === InoutProgress.WEIGHT_FULL) {
+            $("#ck-progress-emptyWeight").addClass("active");
+            $("#ck-progress-hand").addClass("active");
+            $("#ck-progress-fullWeight").addClass("active");
+
+            //婊¤溅閲嶉噺鍙紪杈�
+            $("#fullWeight").removeClass("rkbk-search-input");
+            $("#fullWeight").attr("disabled", false);
+
+            //绌鸿溅閲嶉噺涓嶈兘缂栬緫
+            $("#emptyWeight").addClass("rkbk-search-input");
+            $("#emptyWeight").attr("disabled", true);
+        }
+    }
+    //娴佺▼鏄剧ず
+    if (inoutProgress) {
+        if (inoutProgress.indexOf("REGISTER") === -1) {
+            $("#rk-progress-register").css("display", "none");
+            $("#ck-progress-register").css("display", "none");
+        }
+        if (inoutProgress.indexOf("WEIGHT_FULL") === -1) {
+            $("#rk-progress-fullWeight").css("display", "none");
+            $("#ck-progress-fullWeight").css("display", "none");
+        }
+        if (inoutProgress.indexOf("HANDLE") === -1) {
+            $("#rk-progress-hand").css("display", "none");
+            $("#ck-progress-hand").css("display", "none");
+        }
+        if (inoutProgress.indexOf("WEIGHT_EMPTY") === -1) {
+            $("#rk-progress-emptyWeight").css("display", "none");
+            $("#ck-progress-emptyWeight").css("display", "none");
+        }
+        if (inoutProgress.indexOf("CARD_BACK") === -1) {
+            $("#rk-progress-cardBack").css("display", "none");
+            $("#ck-progress-cardBack").css("display", "none");
+        }
+
+        if (type === "IN") {
+            $("#rk_progress").css("display", "block");
+            $("#ck_progress").css("display", "none");
+        }
+        if (type === "OUT") {
+            $("#ck_progress").css("display", "block");
+            $("#rk_progress").css("display", "none");
+        }
+    }
+    //鏍规嵁閰嶇疆淇℃伅璁剧疆鍦扮鏄惁鍙紪杈�
+    if (weightEditTag && weightEditTag == 'N') {
         $("#fullWeight").addClass("rkbk-search-input");
         $("#fullWeight").attr("disabled", true);
 
         $("#emptyWeight").addClass("rkbk-search-input");
         $("#emptyWeight").attr("disabled", true);
-
-        $("#progress-hand").removeClass("active");
-        $("#progress-fullWeight").removeClass("active");
     }
 }
 
@@ -399,308 +451,135 @@
 
 //鐐瑰嚮绉伴噸
 function weight() {
-    // 娌℃湁涓氬姟鏁版嵁涓嶅彲鎵ц
-    if (!recordData) {
-        layer.alert("娌℃湁鏌ヨ鍒颁笟鍔℃暟鎹紝鎵ц琚嫆缁濓紒锛�");
-        return;
-    }
     // 濡傛灉鏄┖杞︾О閲�
-    if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
-        form.val("form-weight", {
+    if (InoutProgress.WEIGHT_EMPTY === curProgress) {
+        form.val("form-data", {
             emptyWeight: weightDto.weight
         });
+        form.render();
     }
     // 濡傛灉鏄弧杞︾О閲�
-    if (InoutProgress.WEIGHT_FULL == recordData.progress) {
-        form.val("form-weight", {
+    if (InoutProgress.WEIGHT_FULL === curProgress) {
+        form.val("form-data", {
             fullWeight: weightDto.weight
         });
+        form.render();
     }
-    form.render();
-    snapData == null;
 
-    //鐐瑰嚮绉伴噸鏃跺�欒嚜鍔ㄦ姄鎷嶆暟鎹�
-    layer.msg("绯荤粺鑷姩鎶撴媿淇濈暀璁板綍鈥︹��");
+    var data = form.val("form-data");
+    if (!data.plateNum) {
+        alertError("鎻愮ず锛氬~鍐欑櫥璁拌溅鐗屼俊鎭�");
+        return;
+    }
+
+    // 鐐瑰嚮绉伴噸鑷姩璋冪敤鎶撴媿
     snapData = {
         companyId: companyId,
         deptId: deptId,
-        bizTag: recordData.progress,
-        bizType: bizType,
-        plateNum: recordData.plateNum + "-" + recordData.carNum,
-
-        id1: (null != lprDto) ? lprDto.id : null,
-        id2: (null != snapDto1) ? snapDto1.id : null,
-        id3: (null != snapDto2) ? snapDto2.id : null
+        progress: curProgress,
+        bizType: type,
+        id1: snapDto1.id,
+        id2: snapDto2.id,
+        id3: snapDto3.id,
+        sort: $("#scaleName").val()
     };
 
-    console.log(snapData);
     //褰撳墠AJAX鏈嶅姟涓哄悓姝ユ湇鍔★紝杩斿洖鏁版嵁鍖呰鐓х墖淇℃伅
     var index = layer.load();
     $.ajax({
         sync: false,
         type: "POST",
-        url: "../../basic/inout/snap-img",
+        url: "/inout/api/snap-img",
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(snapData),
         success: function (result) {
             layer.close(index);
             if (result.code != "0000") {
-                layer.alert(result.msg);
+                alertError(result.msg);
             } else {
+                layer.msg("鎶撴媿鎴愬姛");
                 snapData = result.data;
             }
         },
         error: function () {
             layer.close(index);
-            layer.msg("鍚庡彴璋冪敤鎴浘澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+            alertError("鍚庡彴璋冪敤鎴浘澶辫触锛岃閲嶆柊灏濊瘯");
         }
     });
-    //浜屾绉伴噸鍚庯紝鑷姩璋冪敤涓嬭嚜鍔ㄨ绠�
-    if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
-        deAutoByPer();
-    }
-    flushBtn("btn-weight");
 }
 
-// 鑷姩璁$畻锛屾敞鎰忥細鍑哄簱姘村垎鏄� +锛屽叆搴撴按鍒嗛渶瑕� -
-function deAutoByPer() {
-    var curData = form.val("form-weight");
-
-    var netWeight = 0, deImpurity = 0, deWet = 0, deSum = 0, settleWeight = 0;
-
-    if (curData.fullWeight == 0 || curData.emptyWeight == 0) {
-        return;
-    }
-    // 璁$畻鍑�閲�
-    netWeight = curData.fullWeight - curData.emptyWeight;
-
-    if (netWeight <= 0) {
-        layer.msg("鍑�閲嶅皬浜庣瓑浜�0锛屽綋鍓嶈绠椾笉姝g‘锛�");
-        return;
-    }
-
-    // 鏉傝川鎵i噸
-    if (curData.impurity > 0) {
-        deImpurity = (netWeight * curData.impurity / 100.00).toFixed(0);
-    }
-    // 姘村垎澧為噸
-    if (curData.wet > 0) {
-        deWet = (netWeight * curData.wet / 100.00).toFixed(0);
-    }
-
-
-    // 鎬绘墸閲�
-    deSum = Number(deImpurity) + Number(curData.deOther)
-        + Number(curData.deHandle);
-    deSum = deSum.toFixed(0);
-
-    // 缁撶畻鍑�閲嶏紝鎶婃按鍒嗘坊鍔犺繎鏉�
-    settleWeight = Number(netWeight) - Number(deSum) + Number(deWet);
-    settleWeight = settleWeight.toFixed(0);
-
-    form.val("form-weight", {
-        netWeight: netWeight,
-        deImpurity: deImpurity,
-        deWet: deWet,
-        deSum: deSum,
-        settleWeight: settleWeight
-    });
-    form.render();
-}
-
-// 鑷姩璁$畻
-function deAutoByWeight() {
-    var curData = form.val("form-weight");
-
-    var netWeight = 0, impurity = 0, wet = 0, deSum = 0, settleWeight = 0;
-
-    if (curData.fullWeight == 0 || curData.emptyWeight == 0) {
-        return;
-    }
-    // 鍑�閲�
-    netWeight = curData.fullWeight - curData.emptyWeight;
-
-    if (netWeight <= 0) {
-        layer.msg("鍑�閲嶅皬浜庣瓑浜�0锛屽綋鍓嶈绠椾笉姝g‘锛�");
-        return;
-    }
-
-    // 鏉傝川-鐧惧垎姣�
-    if (curData.deImpurity > 0) {
-        impurity = (curData.deImpurity / netWeight * 100).toFixed(2);
-    }
-    // 姘村垎 -鐧惧垎姣�
-    if (curData.deWet > 0) {
-        wet = (curData.deWet / netWeight * 100).toFixed(2);
-    }
-
-    // 鎬绘墸閲�= 鏉傝川鎵i噸 + 涓嶅畬鍠勬墸閲� + 姘斾綋鎵i噸 + 鍊间粨鎵i噸 + 鍖呰鎵i噸
-    deSum = Number(curData.deImpurity)
-        + Number(curData.deOther) + Number(curData.deHandle);
-
-    deSum = deSum.toFixed(0);
-
-    // 缁撶畻鍑�閲嶏紝鎶婃按鍒嗘坊鍔犺繎鏉�
-    settleWeight = Number(netWeight) - Number(deSum) + Number(curData.deWet);
-    settleWeight = settleWeight.toFixed(0);
-
-    form.val("form-weight", {
-        netWeight: netWeight,
-        impurity: impurity,
-        wet: wet,
-        deSum: deSum,
-        settleWeight: settleWeight
-    });
-    form.render();
-}
-
-//鏍规嵁褰撳墠鎿嶄綔鐨勬寜閽甀D鏇存柊鍏朵粬鎸夐挳鐘舵��
-function flushBtn(btnId) {
-    if ("btn-weight" == btnId) {// 绉伴噸鍚庡彲浠ョ偣鍑诲畬鎴愮О閲�
-        $("#btn-submit").removeClass("layui-btn-disabled");
-        $("#btn-submit").attr("disabled", false);
-    }
-    if ("btn-submit" == btnId) {
-        $("#btn-submit").addClass("layui-btn-disabled");
-        $("#btn-submit").attr("disabled", true);
-        flushData();
-        if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {// 鍑哄簱锛屽鏋滄槸绌鸿溅绉伴噸锛屽畬鎴愭敹鐩存帴鍒锋柊椤甸潰
-            layer.closeAll();
-        } else {
-            // 瀹屾垚绉伴噸鍚庢帶鍒舵寜閽�
-            $("#btn-weight").addClass("layui-btn-disabled");
-            $("#btn-weight").attr("disabled", true);
-
-            $("#btn-printBill").removeClass("layui-btn-disabled");
-            $("#btn-printBill").attr("disabled", false);
-            addDisabled();
-        }
-    }
-    if ("btn-printBill" == btnId) {// 鎵撳嵃杩囩鍗曪紝璇存槑涓氬姟瀹屾垚
-        $("#btn-weight").removeClass("layui-btn-disabled");
-        $("#btn-weight").attr("disabled", false);
-
-        $("#btn-submit").addClass("layui-btn-disabled");
-        $("#btn-submit").attr("disabled", true);
-
-        $("#btn-printBill").addClass("layui-btn-disabled");
-        $("#btn-printBill").attr("disabled", true);
-        layer.closeAll();
-        flushData();
-    }
-}
-
-//鏇存敼鎵i噸淇℃伅妗嗕笉鍙紪杈�
-function addDisabled() {
-    //鏉傝川
-    $("#impurity").attr("disabled", true);
-    $("#deImpurity").attr("disabled", true);
-    //姘村垎
-    $("#wet").attr("disabled", true);
-    $("#deWet").attr("disabled", true);
-    //鍊间粨
-    $("#deHandle").attr("disabled", true);
-    //鍏朵粬
-    $("#deOther").attr("disabled", true);
-}
-
-//鎭㈠鎵i噸淇℃伅妗嗙紪杈戠姸鎬�
-function delDisabled() {
-    //鏉傝川
-    $("#impurity").attr("disabled", false);
-    $("#deImpurity").attr("disabled", false);
-    //姘村垎
-    $("#wet").attr("disabled", false);
-    $("#deWet").attr("disabled", false);
-    //鍊间粨
-    $("#deHandle").attr("disabled", false);
-    //鍏朵粬
-    $("#deOther").attr("disabled", false);
-}
-
-// 鐐瑰嚮鎵撳嵃锛岀郴缁熷垽鏂槸鍚﹀凡缁忔墽琛屽畬鎴愶紝濡傛灉宸茬粡瀹屾垚锛岀洿鎺ユ墦鍗帮紝濡傛灉鏈畬鎴愬垯鍏堟墽琛屽畬鎴�
+/**
+ * 鐐瑰嚮鎵撳嵃锛岀郴缁熷垽鏂槸鍚﹀凡缁忔墽琛屽畬鎴愶紝濡傛灉宸茬粡瀹屾垚锛岀洿鎺ユ墦鍗帮紝濡傛灉鏈畬鎴愬垯鍏堟墽琛屽畬鎴�
+ */
 function printBill() {
     if (!recordData) {
-        layer.alert("娌℃湁鑾峰彇鍒颁笟鍔℃暟鎹紝涓嶆敮鎸佹墦鍗帮紒");
+        alertError("娌℃湁鑾峰彇鍒颁笟鍔℃暟鎹紝鎵撳嵃琚嫆缁濓紒");
         return;
     }
-    // 浠庡悗鍙拌幏鍙栨ā鐗堝苟鎵撳嵃
-    var data = form.val("form-weight");
-    // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
-    Object.assign(recordData, data);
 
-    printBillStep2();
-};
-
-// 鐐瑰嚮鎵撳嵃锛屽厛鎵ц绯荤粺榛樿鎵ц瀹屾垚鍗″洖鏀�
-function printBillStep2() {
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "../../basic/inout-report/inout-bill-weight",
+        url: "/basic/print/bill-weight",
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(recordData),
         success: function (result) {
             layer.close(index);
             if (result.code != "0000") {
-                layer.msg(result.msg);
+                alertError(result.msg);
             } else {
                 layer.msg("寮�濮嬫覆鏌撴墦鍗板崟鈥︹��");
                 printWeight(result.data);
-                // 鍒锋柊鎸夐挳
-                flushBtn("btn-printBill");
             }
         },
         error: function () {
             layer.close(index);
-            layer.msg("鑾峰彇鎵撳嵃妯$増澶辫触锛岃鑱旂郴绠$悊鍛樻煡鐪嬪師鍥狅紒锛�");
+            alertError("鑾峰彇鎵撳嵃妯$増澶辫触锛岃鑱旂郴绠$悊鍛樻煡鐪嬪師鍥�");
         }
     });
-};
+}
+/**
+ * 绉伴噸鎻愪氦
+ */
+function submit() {
 
-//瀹屾垚绉伴噸
-function submitWeight() {
-    if (null == recordData) {
-        notify("娌℃湁鏁版嵁鍙互鎻愪氦", null);
-        return;
-    }
-    var data = form.val("form-weight");
+    var data = form.val("form-data");
     if (!data.depotId) {
-        notify("瑁呭嵏浠撳簱蹇呴』濉啓", null);
+        alertError("鎻愮ず锛氳鍗镐粨搴撳繀濉�");
         return;
     }
-    // 鏍¢獙-鍑哄簱绌鸿溅
-    if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
-        if (data.emptyWeight <= 0.0) {
-            notify("绌鸿溅绉伴噸淇℃伅蹇呭~", null);
-            return;
-        }
-        if (!data.customerName) {
-            notify("寰�鏉ュ崟浣嶄俊鎭繀濉�", null);
-            return;
-        }
-    } else {
+    if (!data.customerName) {
+        alertError("鎻愮ず锛氶�氱煡鍗曚俊鎭繀濉�");
+        return;
+    }
+    if (!data.foodVariety) {
+        alertError("鎻愮ず锛氱伯椋熷搧绉嶅繀濉�");
+        return;
+    }
+
+    // 鏍¢獙-鍏ュ簱婊¤溅绉伴噸
+    if (InoutProgress.WEIGHT_FULL === curProgress) {
         if (data.fullWeight <= 0.0) {
-            notify("婊¤溅绉伴噸淇℃伅蹇呭~", null);
-            return;
-        }
-        if (!data.foodVariety) {
-            notify("绮鍝佺蹇呭~", null);
-            return;
-        }
-        if (!data.foodLocation) {
-            notify("绮浜у湴蹇呭~", null);
-            return;
-        }
-        if (!data.settleWeight || data.settleWeight <= 0.0) {
-            notify("鎵i噸鍚庡噣淇℃伅涓嶆纭紝璇锋牳瀹炶绠�", null);
+            alertError("鎻愮ず锛氭弧杞︾О閲嶄俊鎭繀濉�");
             return;
         }
     }
-    // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
-    Object.assign(recordData, data);
+    if (InoutProgress.WEIGHT_EMPTY === curProgress) {
+        if (data.emptyWeight <= 0.0) {
+            alertError("鎻愮ず锛氱┖杞︾О閲嶄俊鎭繀濉�");
+            return;
+        }
+    }
+
+    if(recordData){
+        //鍚堝苟鏁版嵁
+        Object.assign(recordData, data);
+    }else {
+        recordData = data;
+    }
+    recordData.progress = curProgress;
 
     // 鑾峰彇鐓х墖
     var files = [{
@@ -711,69 +590,106 @@
         fileName: snapData.fileName3
     }];
     recordData.files = files;
-
     var index = layer.load();
     $.ajax({
         type: "POST",
-        url: "../../basic/inout/inout-next-step",
+        url: "/basic/inout/submit-weight",
         dataType: "json",
         contentType: "application/json;charset=UTF-8",
         data: JSON.stringify(recordData),
         success: function (result) {
             if (result.code != "0000") {
-                layer.alert("鏁版嵁鎻愪氦澶辫触锛岃閲嶈瘯锛侊紒");
+                alertError(result.msg);
             } else {
+                curProgress = null;
                 clearInterval(timerWeight);
-                layer.alert("鏁版嵁鎻愪氦鎴愬姛锛侊紒");
-                // 鏇存柊鎸夐挳鏄剧ず
-                flushBtn("btn-submit");
+                notify("鏁版嵁鎻愪氦鎴愬姛", result.data);
+                //绗竴娆$О閲嶅悗锛屽埛鏂伴〉闈�
+                if (recordData.recordWeight <= 0.0) {
+                    flushData();
+                    layer.closeAll();
+                }
             }
             layer.close(index);
         },
         error: function () {
             layer.close(index);
-            layer.alert("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+            alertError("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯");
         }
     });
 }
 
 //閲嶆柊绉伴噸鏃讹紝琛ㄥ崟涓嶆竻绌猴紝鎸夐挳閲嶇疆
 function flushPage() {
-
     weightDto.weight = 0.0;
     $("#weightValue").text("0.0");
     $("#img_scale_statule").attr("src", "/img/web/inout/icon-red.png");
     timerGetWeight();
 
-    //鎵i噸淇℃伅妗嗘仮澶嶄负鍙紪杈�
-    delDisabled();
     //琛ㄥ崟鏁版嵁閲嶇疆
-    form.val("form-weight", recordData);
+    form.val("form-data", recordData);
     form.render();
 }
 
-//鏍规嵁閫夋嫨鐨勪粨搴撲俊鎭�,鏇存柊绮鍝佺
-function updateFoodVarietyByDepot(selectId) {
-    var selectDepot;
-    $.each(listDepot, function (index, data) {
-        if (data.id === selectId) {
-            selectDepot = data;
-            return false;
+/**
+ * 璇诲彇韬唤璇�
+ */
+function flushIdCard() {
+    var index = layer.load();
+    $.ajax({
+        type: "GET",
+        async: true,
+        url: "http://127.0.0.1:9111/IDCARD",
+        data: {},
+        dataType: "json",
+        success: function (json) {
+            layer.close(index);
+            var data = json;
+            if (data.code === "200" || data.code == 200) {
+                // 涓存椂璧嬪��
+                $("#userName").val(data.cnName);
+                $("#userAddress").val(data.address);
+                $("#userId").val(data.idNum);
+            } else {
+                alertError("娌℃湁鑾峰彇鍒拌韩浠借瘉淇℃伅锛�");
+                return;
+            }
+        },
+        error: function () {
+            layer.alert("韬唤璇佽鍙栧け璐ワ紒", {
+                offset: ['300px', '300px']
+            });
+            layer.close(index);
         }
     });
-
-    if (selectDepot) {
-        form.val("form-weight", {
-            foodVariety: selectDepot.foodVariety,
-            foodLocation: selectDepot.foodLocation,
-            foodLevel: selectDepot.foodLevel,
-            noticeId: selectDepot.noticeId
-        });
-        form.render();
-    }
 }
 
-/*-----------------------绉伴噸鎿嶄綔-缁撴潫------------------------------*/
+/**
+ * 璇诲彇杞︾墝鍙�
+ */
+function flushPlateNum() {
+    var param = JSON.stringify(snapDto1);
+    var index = layer.load();
+    $.ajax({
+        type: "POST",
+        url: "/inout/api/get-plateNum",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: param,
+        success: function (result) {
+            if (result.code != "0000") {
+                alertError(result.msg);
+            } else {
+                $("#plateNum").val(result.data.plateNum);
+            }
+            layer.close(index);
+        },
+        error: function () {
+            layer.close(index);
+            alertError("杞︾墝璇嗗埆澶辫触锛�");
+        }
+    });
+}
 
 /**
  * 寮瑰嚭鎻愰啋妗�

--
Gitblit v1.9.3