From a04453432c9898df83961eaea26dd97b65537f02 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期三, 03 十二月 2025 09:56:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
fzzy-igdss-web/src/main/resources/static/inout/out-easy.js | 1053 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,053 insertions(+), 0 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/out-easy.js b/fzzy-igdss-web/src/main/resources/static/inout/out-easy.js
new file mode 100644
index 0000000..127e2cf
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/inout/out-easy.js
@@ -0,0 +1,1053 @@
+//褰撳墠鑺傜偣 鍏ュ簱璐ㄦ
+var layer;
+var form;
+var table;
+var upload;
+var page = 1;
+var limit = 15;
+var recordData = null;
+var selectData = null; //鍗曢�夌殑淇℃伅
+var snapData;//绯荤粺鎶撴媿瀵硅薄淇℃伅
+var timerWeight;
+var img1, img2, img3;// 椤甸潰涓殑鍥剧墖涓婁紶鍚嶇О
+
+$(function () {
+ layui.use(['layer', 'laydate', 'form', 'table', 'util', 'upload'], function () {
+ var util = layui.util;
+ upload = layui.upload;
+ layer = layui.layer;
+ form = layui.form;
+ table = layui.table;
+ var laydate = layui.laydate;
+
+ laydate.render({
+ elem: '#start',
+ theme: '#7b8e9f',
+ value: startTime
+ });
+
+ laydate.render({
+ elem: '#end',
+ theme: '#7b8e9f',
+ value: endTime
+ });
+
+ laydate.render({
+ elem: '#foodYear',
+ theme: '#7b8e9f',
+ type: 'year'
+ });
+ //涓婁紶
+ upload.render({
+ elem: '#kccz-r-btn1',
+ url: '../file/update-file', //涓婁紶鎺ュ彛
+ size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+ accept: 'images',
+ before: function (obj) {
+ var plateNum = $("#plateNum").val();
+ this.data = {"plateNum": plateNum, "type": "1"};//鎼哄甫鍙傛暟
+ //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+ obj.preview(function (index, file, result) {
+ $('#kccz-r-img1').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+ });
+ },
+ done: function (res) {
+ //濡傛灉涓婁紶澶辫触
+ if (res.code > 0) {
+ layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+ }
+ //涓婁紶鎴愬姛
+ img1 = res.msg;
+ layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+ //console.log(img1);
+ }
+ });
+ upload.render({
+ elem: '#kccz-r-btn2',
+ url: '../file/update-file', //涓婁紶鎺ュ彛
+ size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+ accept: 'images',
+ before: function (obj) {
+ var plateNum = $("#plateNum").val();
+ this.data = {"plateNum": plateNum, "type": "1"};//鎼哄甫鍙傛暟
+ //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+ obj.preview(function (index, file, result) {
+ $('#kccz-r-img2').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+ });
+ },
+ done: function (res) {
+ //濡傛灉涓婁紶澶辫触
+ if (res.code > 0) {
+ layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+ }
+ //涓婁紶鎴愬姛
+ img2 = res.msg;
+ layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+ // console.log(img2);
+ }
+ });
+ upload.render({
+ elem: '#kccz-r-btn3',
+ url: '../file/update-file', //涓婁紶鎺ュ彛
+ size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+ accept: 'images',
+ before: function (obj) {
+ var plateNum = $("#plateNum").val();
+ this.data = {"plateNum": plateNum}; //鎼哄甫鍙傛暟
+ //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+ obj.preview(function (index, file, result) {
+ $('#kccz-r-img3').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+ });
+ },
+ done: function (res) {
+ //濡傛灉涓婁紶澶辫触
+ if (res.code > 0) {
+ layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+ }
+ //涓婁紶鎴愬姛
+ img3 = res.msg;
+ layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+ }
+ });
+
+ // 鐩戝惉琛屽伐鍏蜂簨浠�
+ table.on('tool(tableData)', function (obj) {
+ if (obj.event === 'edit') {
+ //灞曠ず寮圭獥
+ afreshGetData(obj);
+ }
+ });
+
+ // 鐩戝惉浠撳簱閫夋嫨锛岄�夋嫨鍚庤嚜鍔ㄨ皟鐢ㄤ粨搴撶殑绮搧绉嶅拰浜у湴淇℃伅
+ form.on('select(select_depotId)', function (obj) {
+ updateFoodVarietyByDepot(obj.value);
+ });
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ renderTable();
+ });
+
+ //鏄剧ず绉伴噸寮圭獥娴佺▼
+ showProgress();
+
+ // 鐩戝惉姣斾緥鍊煎~鍐�
+ $(".per").blur(function () {
+ deAutoByPer();
+ });
+
+ // 鐩戝惉姣斾緥鍊煎~鍐�
+ $(".weight").blur(function () {
+ deAutoByWeight();
+ });
+ //鍒濆鍖朩ebSocket
+ // initWS(deptId, bizType, progress, userId);
+});
+
+window.onload = function () {
+ //鑷姩杩炴帴鍦扮淇℃伅锛�2.5绉掕幏鍙栦竴娆″湴纾呴噸閲忎俊鎭�
+ clearInterval(timerWeight);
+ timerWeight = setInterval(function () {
+ flushWeight();
+ }, 2500);
+
+ // 鍔犺浇瑙嗛
+ initVideo(lprDto, snapDto1, snapDto2);
+
+ //璁剧疆鍦扮
+ $("#scaleName").val(weightDto.sort);
+
+ //鐩戝惉鍦扮閫夋嫨
+ $("#scaleName").change(function () {
+ layer.confirm('璋冩暣鍦扮闇�閲嶆柊鍔犺浇椤甸潰锛岀‘瀹氳皟鏁达紵', {
+ btn: ['纭畾', '鍙栨秷']
+ }, function () {
+ updateWeight();
+ });
+ });
+};
+
+//鏍规嵁鏉′欢鏌ヨ鏁版嵁
+function flushData() {
+ var index = layer.load();
+ var param = form.val("form-param");
+ table.reload('tableData', {
+ url: "/basic/inout/page-inout-data",
+ where: param
+ });
+ $("thead tr").css({
+ "border-bottom": "2px solid #53adce",
+ "background": "#eff4f6"
+ });
+ layer.close(index);
+}
+
+//琛ㄥ崟娓呯┖
+function resetForm() {
+ $("#form-param")[0].reset();
+ form.render();
+}
+
+// 娓叉煋琛ㄥ崟鏁版嵁
+function renderTable() {
+ var param = form.val("form-param");
+ // 娓呯┖鏁版嵁
+ $("#tableData").empty();
+ table.render({
+ elem: '#tableData',
+ url: '/basic/inout/page-inout-data',
+ page: true,
+ limit: limit,
+ even: true,
+ method: 'POST',
+ contentType: "application/json;charset=UTF-8",
+ cols: [[{
+ type: 'numbers',
+ title: '搴忓彿'
+ }, {
+ field: 'id',
+ title: '鍗曟嵁鍙�',
+ width: '13%',
+ style: 'color: #f67d06;font-weight: bold'
+ }, {
+ field: 'plateNum',
+ title: '杞︾墝',
+ width: '11%',
+ style: 'font-weight: bold'
+ }, {
+ field: 'type',
+ title: '绫诲瀷',
+ templet: function (item) {
+ var result = item.type;
+ return result == "IN" ? "鍏ュ簱" : "鍑哄簱";
+ }
+ }, {
+ field: 'customerName',
+ title: '鍙戣揣鍗曚綅'
+ }, {
+ field: 'deptName',
+ title: '鏀惰揣鍗曚綅'
+ }, {
+ field: 'depotId',
+ title: '瑁呭嵏浠撳簱',
+ width: '10%',
+ templet: function (item) {
+ var result = item.depotId;
+ $.each(listDepot, function (index, data) {
+ if (item.depotId == data.id) {
+ result = data.name;
+ return true;
+ }
+ });
+ return result == null ? "" : result;
+ }
+ }, {
+ field: 'foodVariety',
+ title: '鍝佺',
+ width: '10%',
+ templet: function (item) {
+ var result = item.foodVariety;
+ $.each(listFoodVariety, function (index, data) {
+ if (item.foodVariety == data.code) {
+ result = data.name;
+ return true;
+ }
+ });
+ return result == null ? "" : result;
+ }
+ }, {
+ field: 'progress',
+ title: '娴佺▼杩涘害',
+ width: '10%',
+ style: 'font-weight: bold',
+ templet: function (item) {
+ return INOUT_PROGRESS_MSG(item.progress);
+ }
+ }, {
+ field: '',
+ title: '鎿嶄綔',
+ width: '9%',
+ toolbar: "#barControl"
+ }]],
+ where: param,
+ parseData: function (res) {
+ if ("0000" == res.code) {
+ return {
+ "code": "0",
+ "msg": res.msg,
+ "count": res.data.total,
+ "data": res.data.records
+ }
+ } else {
+ return {
+ "code": "1",
+ "msg": res.msg
+ }
+ }
+ }
+ });
+ $("thead tr").css({
+ "border-bottom": "2px solid #53adce",
+ "background": "#eff4f6"
+ });
+}
+
+/*-----------------------寮圭獥鏄剧ず娓叉煋-寮�濮�------------------------------*/
+
+//鎿嶄綔鍓嶏紝閲嶆柊娴佹按鏁版嵁褰撳墠淇℃伅
+function afreshGetData(obj) {
+ var index = layer.load();
+ recordData = null;
+ var data = obj.data;
+ var param = {
+ userId: data.userId,
+ plateNum: data.plateNum,
+ id: data.id
+ };
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/inout-query",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(param),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.alert("璇峰埛鏂伴〉闈㈠悗锛岄噸鏂版搷浣滐紒锛�");
+ } else {
+ recordData = result.data;
+ showWindows(recordData.progress);
+ }
+ layer.close(index);
+ },
+ error: function () {
+ layer.close(index);
+ layer.alert("璇峰埛鏂伴〉闈㈠悗锛岄噸鏂版搷浣滐紒锛�");
+ }
+ });
+}
+
+//鏄剧ず娴佺▼鎿嶄綔寮圭獥
+function quickRegister() {
+ //鐧昏鎸夐挳鏀惧紑
+ $("#btn_register").css("display", "block");
+ //绉伴噸鎿嶄綔寮圭獥
+ var pro = '鐧昏';
+ updateEditAndProgress();
+ flushPage();
+ layer.open({
+ type: 1,
+ title: pro,
+ area: ['1283px', '815px'],
+ cancel: function (index, layero) {
+ $("#weightDetail").css("display", "none");
+ },
+ shade: 0,
+ scrollbar: 0,
+ content: $('#weightDetail'),
+ offset: ['16px', '16px']
+ });
+}
+
+//鏄剧ず娴佺▼鎿嶄綔寮圭獥
+function showWindows(progress) {
+ console.log(progress);
+ if (progress == 'WEIGHT_FULL' || progress == 'WEIGHT_EMPTY') {
+ //鐧昏鎸夐挳鏀惧紑
+ $("#btn_register").css("display", "none");
+ //绉伴噸鎿嶄綔寮圭獥
+ var pro = '绌鸿溅绉伴噸';
+ if (progress == 'WEIGHT_FULL') {
+ pro = '婊¤溅绉伴噸';
+ }
+ updateEditAndProgress();
+ flushPage();
+ layer.open({
+ type: 1,
+ title: "绉伴噸" + pro + " - 鍗曞彿锛�" + recordData.id,
+ area: ['1283px', '815px'],
+ cancel: function (index, layero) {
+ $("#weightDetail").css("display", "none");
+ },
+ shade: 0,
+ scrollbar: 0,
+ content: $('#weightDetail'),
+ offset: ['16px', '16px']
+ });
+ } else if (progress == 'HANDLE') {
+ //鍊间粨鎿嶄綔寮圭獥
+ form.val("form-handle", recordData);
+ form.render();
+ layer.open({
+ type: 1,
+ title: "鍊间粨 - 鍗曞彿锛�" + recordData.id,
+ area: ['1283px', '815px'],
+ cancel: function (index, layero) {
+ $("#handleDetail").css("display", "none");
+ },
+ shade: 0,
+ scrollbar: 0,
+ content: $('#handleDetail'),
+ offset: ['16px', '16px']
+ });
+ } else {
+ layer.alert("璇峰埌瀵瑰簲椤甸潰杩涜鎿嶄綔锛侊紒锛�");
+ }
+}
+
+//绉伴噸寮圭獥涓祦绋嬬幆鑺傛樉绀�
+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 (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 {
+ $("#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");
+ }
+}
+
+/*-----------------------寮圭獥鏄剧ず娓叉煋-缁撴潫------------------------------*/
+
+/*-----------------------绉伴噸鎿嶄綔-寮�濮�------------------------------*/
+
+//鑷姩杩炴帴鍦扮淇℃伅锛�2.5绉掕幏鍙栦竴娆″湴纾呴噸閲忎俊鎭�
+function timerGetWeight() {
+ clearInterval(timerWeight);
+ timerWeight = setInterval(function () {
+ flushWeight();
+ }, 2500);
+}
+
+//鍙戦�佽姹傝幏鍙栫О閲嶆暟鎹�
+function flushWeight() {
+ var ip = "127.0.0.1";
+ if (weightDto.ip) {
+ ip = weightDto.ip;
+ }
+ var port = "9111";
+ if (weightDto.port) {
+ port = weightDto.port;
+ }
+ var sn = "WEIGHT";
+ if (weightDto.sn) {
+ sn = weightDto.sn;
+ }
+ var url = "http://" + ip + ":" + port + "/" + sn;
+ $.ajax({
+ type: "GET",
+ async: true,
+ timeout: 2000,
+ url: url,
+ data: {},
+ dataType: "json",
+ success: function (json) {
+ var data = json.content;
+ if (!data) data = 0.0;
+ weightDto.weight = data;
+ $("#weightValue").text(data);
+ $("#img_scale_statule").attr("src", "/img/web/inout/icon-gree.png");
+ },
+ error: function () {
+ weightDto.weight = 0.0;
+ $("#weightValue").text("0.0");
+ $("#img_scale_statule").attr("src", "/img/web/inout/icon-red.png");
+ }
+ });
+}
+
+//鐐瑰嚮绉伴噸
+function weight() {
+ // 娌℃湁涓氬姟鏁版嵁涓嶅彲鎵ц
+ if (!recordData) {
+ layer.alert("娌℃湁鏌ヨ鍒颁笟鍔℃暟鎹紝鎵ц琚嫆缁濓紒锛�");
+ return;
+ }
+ // 濡傛灉鏄┖杞︾О閲�
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ form.val("form-weight", {
+ emptyWeight: weightDto.weight
+ });
+ }
+ // 濡傛灉鏄弧杞︾О閲�
+ if (InoutProgress.WEIGHT_FULL == recordData.progress) {
+ form.val("form-weight", {
+ fullWeight: weightDto.weight
+ });
+ }
+ form.render();
+ snapData == null;
+
+ //鐐瑰嚮绉伴噸鏃跺�欒嚜鍔ㄦ姄鎷嶆暟鎹�
+ layer.msg("绯荤粺鑷姩鎶撴媿淇濈暀璁板綍鈥︹��");
+ 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
+ };
+
+ console.log(snapData);
+ //褰撳墠AJAX鏈嶅姟涓哄悓姝ユ湇鍔★紝杩斿洖鏁版嵁鍖呰鐓х墖淇℃伅
+ var index = layer.load();
+ $.ajax({
+ sync: false,
+ type: "POST",
+ url: "../../basic/inout/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);
+ } else {
+ snapData = result.data;
+ }
+ },
+ error: function () {
+ layer.close(index);
+ layer.msg("鍚庡彴璋冪敤鎴浘澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+ }
+ });
+ //浜屾绉伴噸鍚庯紝鑷姩璋冪敤涓嬭嚜鍔ㄨ绠�
+ 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("娌℃湁鑾峰彇鍒颁笟鍔℃暟鎹紝涓嶆敮鎸佹墦鍗帮紒");
+ 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",
+ 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);
+ } else {
+ layer.msg("寮�濮嬫覆鏌撴墦鍗板崟鈥︹��");
+ printWeight(result.data);
+ // 鍒锋柊鎸夐挳
+ flushBtn("btn-printBill");
+ }
+ },
+ error: function () {
+ layer.close(index);
+ layer.msg("鑾峰彇鎵撳嵃妯$増澶辫触锛岃鑱旂郴绠$悊鍛樻煡鐪嬪師鍥狅紒锛�");
+ }
+ });
+};
+
+//瀹屾垚绉伴噸
+function submitWeight() {
+ if (null == recordData) {
+ notify("娌℃湁鏁版嵁鍙互鎻愪氦", null);
+ return;
+ }
+ var data = form.val("form-weight");
+ if (!data.depotId) {
+ notify("瑁呭嵏浠撳簱蹇呴』濉啓", null);
+ return;
+ }
+ // 鏍¢獙-鍑哄簱绌鸿溅
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ if (data.emptyWeight <= 0.0) {
+ notify("绌鸿溅绉伴噸淇℃伅蹇呭~", null);
+ return;
+ }
+ if (!data.customerName) {
+ notify("寰�鏉ュ崟浣嶄俊鎭繀濉�", null);
+ return;
+ }
+ } else {
+ 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);
+ return;
+ }
+ }
+ // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
+ Object.assign(recordData, data);
+
+ // 鑾峰彇鐓х墖
+ var files = [{
+ fileName: snapData.fileName1
+ }, {
+ fileName: snapData.fileName2
+ }, {
+ fileName: snapData.fileName3
+ }];
+ recordData.files = files;
+
+ var index = layer.load();
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/inout-next-step",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(recordData),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.alert("鏁版嵁鎻愪氦澶辫触锛岃閲嶈瘯锛侊紒");
+ } else {
+ clearInterval(timerWeight);
+ layer.alert("鏁版嵁鎻愪氦鎴愬姛锛侊紒");
+ // 鏇存柊鎸夐挳鏄剧ず
+ flushBtn("btn-submit");
+ }
+ layer.close(index);
+ },
+ error: function () {
+ layer.close(index);
+ layer.alert("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+ }
+ });
+}
+
+//閲嶆柊绉伴噸鏃讹紝琛ㄥ崟涓嶆竻绌猴紝鎸夐挳閲嶇疆
+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.render();
+}
+
+//鏍规嵁閫夋嫨鐨勪粨搴撲俊鎭�,鏇存柊绮鍝佺
+function updateFoodVarietyByDepot(selectId) {
+ var selectDepot;
+ $.each(listDepot, function (index, data) {
+ if (data.id === selectId) {
+ selectDepot = data;
+ return false;
+ }
+ });
+
+ if (selectDepot) {
+ form.val("form-weight", {
+ foodVariety: selectDepot.foodVariety,
+ foodLocation: selectDepot.foodLocation,
+ foodLevel: selectDepot.foodLevel,
+ noticeId: selectDepot.noticeId
+ });
+ form.render();
+ }
+}
+
+/*-----------------------绉伴噸鎿嶄綔-缁撴潫------------------------------*/
+
+/*-----------------------鍊间粨鎿嶄綔-寮�濮�------------------------------*/
+
+//鍊间粨鎻愪氦
+function submitHandle() {
+ if (null == recordData) {
+ layer.alert("娌℃湁鏁版嵁鍙互鎻愪氦锛侊紒锛�");
+ return;
+ }
+ var index = layer.load();
+ var data = form.val("form-handle");
+
+ // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
+ Object.assign(recordData, data);
+
+ // 鑾峰彇鍥剧墖鍚嶇О
+ recordData.files = [{
+ fileName: img1
+ }, {
+ fileName: img2
+ }, {
+ fileName: img3
+ }];
+
+ console.log(recordData);
+
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/inout-next-step",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(recordData),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.alert("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+ } else {
+ layer.alert("鍊间粨瀹屾垚锛侊紒");
+ layer.closeAll();
+ flushData();
+ }
+ layer.close(index);
+ },
+ error: function () {
+ layer.close(index);
+ layer.alert("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯锛侊紒");
+ }
+ });
+}
+
+// ---------------------------寰�鏉ュ崟浣嶆搷浣�--寮�濮� -------------------//
+// 寮瑰嚭寰�鏉ュ崟浣嶄笅鎷夋
+function showCustomer() {
+ var index = layer.load();
+
+ // 娓叉煋寰�鏉ュ崟浣嶅垪琛�
+ table.render({
+ elem: '#tableCustomer',
+ url: '../../basic/inout/list-out-customer',
+ page: false,
+ // skin : "nob",
+ // size : 'sm',
+ toolbar: '#toolbarCustomer',
+ even: true,
+ method: 'POST',
+ contentType: "application/json;charset=UTF-8",
+ cols: [[{
+ field: 'id',
+ title: '缂栫爜'
+ }, {
+ field: 'name',
+ title: '鍚嶇О'
+ }, {
+ field: 'cardId',
+ title: '韬唤璇�'
+ }]],
+ parseData: function (res) {
+ if ("0000" == res.code) {
+ return {
+ "code": "0",
+ "msg": res.msg,
+ "data": res.data
+ }
+ } else {
+ return {
+ "code": "1",
+ "msg": res.msg
+ }
+ }
+ },
+ done: function (res) {
+ layer.close(index);
+ }
+ });
+
+ //鍙屽嚮鏄剧ず閫変腑鏁版嵁
+ table.on('rowDouble(tableCustomer)', function (obj) {
+ var data = obj.data;
+ // 璧嬪��
+ form.val("form-weight", {
+ customerId: data.id,
+ customerName: data.name
+ });
+ // 鍏抽棴
+ layer.close(index2);
+ });
+
+ // 寮瑰嚭瀵硅瘽妗�
+ var index2 = layer.open({
+ type: 1,
+ title: "閫夋嫨寰�鏉ュ崟浣�",
+ area: ['600px', '600px'],
+ shade: 0,
+ content: $('#listCustomer'),
+ btn: 0,
+ btn: ['鍙栨秷'],
+ yes: function () {
+ layer.close(index2);
+ },
+ closeBtn: 0
+ });
+}
+
+// 鍒锋柊寰�鏉ュ崟浣嶆暟鎹�
+function flushCustomer() {
+ var key = $("#key").val();
+ var param = {
+ key: key
+ };
+ table.reload('tableCustomer', {
+ url: "../../basic/inout/list-out-customer",
+ where: param,
+ done: function (res) {
+ if (key) {
+ $("#key").val(key);
+ }
+ }
+ });
+}
+
+// ---------------------------寰�鏉ュ崟浣嶆搷浣�--缁撴潫-------------------//
+
+/**
+ * 寮瑰嚭鎻愰啋妗�
+ * @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