From db67639449287bcec461916a7dca6003ee5dd03c Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 05 十二月 2025 16:27:18 +0800
Subject: [PATCH] 出入库详单及补单页面及逻辑
---
fzzy-igdss-web/src/main/resources/static/inout/inout-check.js | 683 +++++---------------------------------------------------
1 files changed, 61 insertions(+), 622 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-check.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-check.js
index fab3441..bb78ad3 100644
--- a/fzzy-igdss-web/src/main/resources/static/inout/inout-check.js
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-check.js
@@ -3,7 +3,6 @@
var laydate;
var form;
var table;
-var scanCodeTag = false;
var page = 1;
var limit = 10;
var curCheckData = null;// 褰撳墠缂栬緫鏁版嵁
@@ -28,76 +27,25 @@
value: endTime
});
- laydate.render({
- elem: '#foodYear',
- theme: '#7b8e9f',
- value: foodYear,
- type: 'year'
- });
-
- laydate.render({
- elem: '#checkTime',
- theme: '#7b8e9f',
- format: 'yyyy-MM-dd HH:mm:ss',
- type: 'datetime'
- });
-
- // 鍒濆鍖栬〃鍗曟暟鎹�
- renderTable();
-
// 鐩戝惉琛屽伐鍏蜂簨浠�
table.on('tool(tableData)', function (obj) {
if (obj.event === 'edit') {
- //鏇存柊浠撳簱涓嬫媺鍒楄〃
- updateSelect();
//灞曠ず鏁版嵁
showDetail(obj.data);
}
});
- //鐩戝惉绮鍝佺锛岃幏鍙栧寲楠岄」
- layui.form.on('select(select_foodVariety)', function (data) {
- updateFoodVariety(data.value);
- });
-
- //鐩戝惉绮绛夌骇锛岃幏鍙栫伯椋熷畾浠�
- layui.form.on('select(select_foodLevel)', function (data) {
- getPriceByFoodLevel(data.value);
- });
-
- //鐩戝惉鍖栭獙缁撴灉鍗曞~鍐欐暟鎹�,骞剁粰鍑烘彁绀虹粨鏋�
- table.on('edit(tableCheckItem)', function (obj) {
- getResult(obj);
- });
+ // 鍒濆鍖栬〃鍗曟暟鎹�
+ renderTable();
});
//鏄剧ず鍏ュ簱娴佺▼
showProgress();
});
-window.onbeforeunload = function () {
-}
-window.onunload = function () {
-}
-window.onload = function () {
-
- //鎵弿鏋嚜鍔ㄥ洖杞︿簨浠�
- $('#checkId').bind('keyup', function (event) {
- if (event.keyCode == "13") {
- // //鍘绘帀鐒︾偣锛岄槻姝㈠埛鏂伴〉闈�
- // $('#checkId').blur();
- getDataByCheckId();
- }
- });
-};
-
-// socket淇℃伅杩斿洖铏曠悊
-function socketOnMessage(packet) {
- layer.alert(packet.data);
- window.parent.sysNotify(packet.data);
-}
-
-//鎺у埗娴佺▼鐜妭鏄剧ず
+/**
+ * 鎺у埗娴佺▼鐜妭鏄剧ず
+ */
function showProgress() {
if (!inoutProgress) {
return;
@@ -122,99 +70,13 @@
}
}
-//鏍规嵁濉啓鍖栭獙鏁版嵁,缁欏嚭鎻愰啋鏄惁鍚堟牸
-function getResult(obj) {
- var data = obj.data;
- //濉啓鐨勬暟鎹��
- var newValue = data.value;
- //鏍囧噯鍊�
- var limit = data.upperLimit;
- //杩愮畻绗�
- var symbol = data.operaSymbol;
- if (symbol && limit) {
- if (">=" == symbol) {
- if (newValue < limit) {
- data.result = "0";
- } else {
- data.result = "1";
- }
- }
- if ("<=" == symbol) {
- if (newValue > limit) {
- data.result = "0";
- } else {
- data.result = "1";
- }
- }
- if ("==" == symbol) {
- if (newValue != limit) {
- data.result = "0";
- } else {
- data.result = "1";
- }
- }
- }
- obj.update(data);
- //鏍规嵁鍖栭獙缁撴灉鎻愰啋鏄惁鍚堟牸
- updateCheckResultTip();
-}
-
-//鍔ㄦ�佹洿鎹粨搴撲笅鎷夊垪琛�
-function updateSelect() {
- $('#depotId option').remove();
- for (var i = 0; i < listDepot.length; i++) {
- $('#depotId').append('<option value="' + listDepot[i].id + '">' + listDepot[i].name + '</option>');
- }
- //閲嶆柊娓叉煋
- form.render('select');
-}
-
-//鏍规嵁鍝佺鑾峰彇鍖栭獙椤�
-function updateFoodVariety(foodVariety) {
- if (null == foodVariety || "" == foodVariety) return;
- form.val("form-detail", {
- foodVariety: foodVariety
- });
- 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("鍚庡彴寮傚父锛岃閲嶈瘯鎴栬�呰仈绯荤鐞嗗憳锛侊紒");
- }
- });
-}
-
// 鏌ヨ
function flushData() {
var index = layer.load();
var param = form.val("form-param");
table.reload('tableData', {
- url: "../../basic/inout/page-check-data",
+ url: "/basic/inout/page-inout-data",
where: param,
});
@@ -223,305 +85,51 @@
"background": "#eff4f6"
});
layer.close(index);
-};
-
-// 瀵煎嚭鏁版嵁-- 璺宠浆鏂伴〉闈㈠鐞�
-function exportData() {
- // var url = "com.ld.igds.inout.ReportInoutCheck.d";
- // window.parent.openTab(url, "鍖栭獙缁撴灉瀵煎嚭", "checkDataExport");
-};
-
-// 鎵︽牱鏈鸿В闄ゆ�ュ仠
-function checkResetStop() {
- var param = JSON.stringify(checkDto);
- var index = layer.load();
- $.ajax({
- type: "POST",
- url: "../../api/check/reset-stop",
- dataType: "json",
- contentType: "application/json;charset=UTF-8",
- data: param,
- success: function (result) {
- layer.close(index);
- if (result.code != "0000") {
- layer.alert(result.msg);
- } else {
- layer.msg("鎿嶄綔鍛戒护鍙戦�佹垚鍔燂紒");
- }
- },
- error: function () {
- layer.close(index);
- layer.alert("鍚庡彴寮傚父锛屾搷浣滃懡浠ゅ彂閫佸け璐ワ紒");
- }
- });
-};
-
-// 鏇存柊鍖栭獙缁撴灉鎻愰啋锛屽彧鍋氭彁閱掞紝涓嶅仛鑷姩鍒ゆ柇
-function updateCheckResultTip() {
- if (!curCheckItems || curCheckItems.length == 0) {
- return;
- }
- if (curCheckData.checkStatus != "NONE") {
- return;
- }
- var msg;
- $.each(curCheckItems, function (index, data) {
- if (!data.result) {
- return true;
- }
- if (data.result == "0") {
- msg = "涓嶅悎鏍�";
- return false;
- }
- if (data.result == "1") {
- msg = "鍚堟牸";
- }
- });
- if (msg) {
- $("#check-result-tip").text("璐ㄦ缁撴灉锛�" + msg);
- } else {
- $("#check-result-tip").text("璐ㄦ缁撴灉锛�#");
- }
-}
-
-/**
- * 娓叉煋琛ㄦ牸
- */
-function renderTableCheckItem() {
- // 娓呯┖鏁版嵁
- $("#tableCheckItem").empty();
- table.render({
- elem: '#tableCheckItem',
- data: curCheckItems,
- page: false,
- // skin: 'line',
- even: true,
- cols: [[{
- field: 'standardName',
- title: '妫�楠岄」鐩�',
- align: 'center',
- width: '10%'
- }, {
- field: 'value',
- title: '妫�楠屽��',
- align: 'center',
- width: '10%',
- edit: 'text'
- }, {
- field: 'operaSymbolValue',
- title: '鏍囧噯鍊�',
- align: 'center',
- width: '10%'
- }, {
- field: 'unit',
- title: '鍗曚綅',
- align: 'center',
- width: '10%'
- }, {
- field: 'deNum',
- title: '鎵i噸',
- align: 'center',
- 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: '澶囨敞璇存槑',
- align: 'center',
- edit: 'text'
- }]],
- limit: this.curCheckItems.length //鏄剧ず鐨勬暟閲�
- });
-
- $("thead tr").css({
- "border-bottom": "2px solid #53adce",
- "background": "#eff4f6"
- });
}
function showDetail(data) {
curCheckData = data;
- if (!curCheckData.checkTime) {
- curCheckData.checkTime = dateFtt("yyyy-MM-dd hh:mm:ss", new Date());
- }
- curCheckData.checkUser = checkUser;
// 璧嬪��
- form.val("form-detail", curCheckData);
+ form.val("form-detail", data);
form.render();
layer.open({
type: 1,
- title: "鍖栭獙鍗曟槑缁�",
+ title: "濉啓鍖栭獙淇℃伅",
area: ['1400px', '700px'],
shade: 0,
content: $('#checkDetail'),
btnAlign: 'c',
- btn: ['浠呬繚瀛�', '淇濆瓨鎻愪氦', '鍏抽棴鍙栨秷'],
+ btn: ['淇濆瓨鎻愪氦', '鍏抽棴鍙栨秷'],
yes: function () {
// 鏇存柊鍒伴〉闈�
var data = form.val("form-detail");
// 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
Object.assign(curCheckData, data);
- saveCheckData();
- if (scanCodeTag) {
- showScanCode();
- }
- }, btn2: function () {
- // 鏇存柊鍒伴〉闈�
- var data = form.val("form-detail");
- // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
- Object.assign(curCheckData, data);
submit();
- if (scanCodeTag) {
- showScanCode();
- }
- }, btn3: function () {
+ }, btn2: function () {
parent.layer.closeAll();
- if (scanCodeTag) {
- showScanCode();
- }
},
closeBtn: 0
- });
- //鍒ゆ柇鏄惁鍖栭獙锛岃嫢宸茬粡鍖栭獙锛屽垯涓嶆樉绀烘彁浜ゆ寜閽紝涓嶅厑璁镐慨鏀瑰寲楠岀粨鏋�
- if (curCheckData.checkStatus != "NONE") {
- $(".layui-layer-btn0").css('display', 'none');
- $(".layui-layer-btn1").css('display', 'none');
- }
- // 鑾峰彇鍖栭獙椤逛俊鎭�
- flushCheckItem(curCheckData.foodVariety);
- getPriceByFoodLevel(curCheckData.foodLevel);
-}
-
-/**
- * 鍒锋柊鍖栭獙缁撴灉椤�
- */
-function flushCheckItem(foodVariety) {
- curCheckItems = null;
- $("#check-result-tip").text("妫�楠岀粨鏋滐細#");
- $("#price-result-tip2").text("绮瀹氫环锛�#鍏�/鍏枻");
- curCheckData.foodVariety = foodVariety;
- var index = layer.load();
- $.ajax({
- type: "POST",
- url: "../../basic/inout/get-check-item",
- dataType: "json",
- contentType: "application/json;charset=UTF-8",
- data: JSON.stringify(curCheckData),
- success: function (result) {
- if (result.code != "0000") {
- layer.msg(result.msg);
- } else {
- curCheckItems = result.data;
- // 鏍规嵁鍖栭獙缁撴灉鎻愰啋鏄惁鍚堟牸
- updateCheckResultTip();
- // 椤甸潰娓叉煋妫�娴嬮」
- renderTableCheckItem();
- layer.close(index);
- }
- },
- error: function () {
- layer.close(index);
- layer.msg("鍚庡彴寮傚父锛岃閲嶈瘯鎴栬�呰仈绯荤鐞嗗憳锛侊紒");
- }
- });
-};
-
-//浠呬繚瀛�
-function saveCheckData() {
- if (!curCheckData.foodVariety) {
- layer.alert("璇风‘璁ょ伯椋熷搧绉嶏紒锛�");
- return;
- }
- curCheckData.checkItems = curCheckItems;
- var index1 = layer.load();
- $.ajax({
- type: "POST",
- url: "../../basic/inout/submit-checkItem",
- dataType: "json",
- contentType: "application/json;charset=UTF-8",
- async: false,
- data: JSON.stringify(curCheckData),
- success: function (result) {
- if (result.code != "0000") {
- layer.close(index1);
- notify(result.msg, result.data);
- } else {
- layer.closeAll();
- curCheckData = null;
- notify("鏁版嵁淇濆瓨鎴愬姛", result.data);
- flushData();
- }
- },
- error: function () {
- layer.close(index1);
- layer.alert("淇濆瓨澶辫触锛岃閲嶆柊灏濊瘯锛�");
- }
});
}
//淇濆瓨鎻愪氦
function submit() {
- if (curCheckData.checkStatus == "NONE" || curCheckData.checkStatus == "NONE2") {
- layer.alert("璇风‘璁ゅ寲楠岀粨鏋滐紒锛�");
+ if (!curCheckData.perWet) {
+ layer.alert("璇峰~鍐欒川妫�姘村垎淇℃伅锛侊紒");
return;
}
- if (!curCheckData.foodVariety) {
- layer.alert("璇风‘璁ょ伯椋熷搧绉嶏紒锛�");
+ if (!curCheckData.perImpurity) {
+ layer.alert("璇峰~鍐欒川妫�鏉傝川淇℃伅锛侊紒");
return;
}
- if (!curCheckData.foodLevel) {
- layer.alert("璇风‘璁ょ伯椋熺瓑绾э紒锛�");
- return;
- }
- if (!curCheckData.foodType) {
- layer.alert("璇风‘璁ょ伯椋熸�ц川锛侊紒");
- return;
- }
- if (!curCheckData.price) {
- layer.alert("璇风‘璁ょ伯椋熷畾浠凤紝濡備笉鑰冭檻瀹氫环锛岃濉啓0.0");
- return;
- }
- curCheckData.checkItems = curCheckItems;
var index = layer.load();
$.ajax({
type: "POST",
- url: "../../basic/inout/submit-check",
+ url: "/basic/inout/submit-check",
dataType: "json",
contentType: "application/json;charset=UTF-8",
async: false,
@@ -544,135 +152,45 @@
});
}
-//鎵爜寮圭獥
-function showScanCode() {
- //娓呯┖琛ㄥ崟
- $("#form-sacnCodeDetail")[0].reset();
- form.render();
-
- //鎵爜寮圭獥-璧嬪�紅rue
- scanCodeTag = true;
- layer.open({
- type: 1,
- title: "鎵爜淇℃伅",
- area: ['700px', '320px'],
- shade: 0,
- content: $('#scanCodeDetail'),
- success: function () {
- document.getElementById('checkId').focus();
- },
- btnAlign: 'c',
- btn: ['鏌ヨ', '鍏抽棴鍙栨秷'],
- yes: function () {
- getDataByCheckId();
- }, btn2: function () {
- scanCodeTag = false;
- layer.closeAll();
- },
- closeBtn: 0
- });
-}
-
-//鏍规嵁璐ㄦ鍗曞彿鑾峰彇淇℃伅
-function getDataByCheckId() {
- var param = form.val("form-sacnCodeDetail");
- if (!param.checkId) {
- layer.alert("璐ㄦ鍗曞彿涓虹┖锛岃鎵爜鎴栬緭鍏ヨ川妫�鍗曞彿");
- }
- var index = layer.load();
- $.ajax({
- type: "POST",
- url: "../../basic/inout/inout-check-scan-code",
- dataType: "json",
- contentType: "application/json;charset=UTF-8",
- data: JSON.stringify(param),
- success: function (result) {
- if (result.code != "0000") {
- layer.close(index);
- $("#form-sacnCodeDetail")[0].reset();
- form.render();
- notify(result.msg, result.data);
- } else {
- updateSelect();
- showDetail(result.data);
- }
- },
- error: function () {
- layer.close(index);
- $("#form-sacnCodeDetail")[0].reset();
- form.render();
- alertError("淇濆瓨澶辫触锛岃閲嶆柊灏濊瘯锛�")
- }
- });
-}
-
-// 娓叉煋琛ㄥ崟鏁版嵁
+/**
+ * 娓叉煋琛ㄥ崟鏁版嵁
+ */
function renderTable() {
var param = form.val("form-param");
// 娓呯┖鏁版嵁
$("#tableData").empty();
table.render({
elem: '#tableData',
- url: '../../basic/inout/page-check-data',
+ url: '/basic/inout/page-inout-data',
page: true,
limit: limit,
even: true,
method: 'POST',
contentType: "application/json;charset=UTF-8",
cols: [[{
- field: 'checkId',
- title: '璐ㄦ鍗曞彿',
+ type: 'numbers',
+ title: '搴忓彿'
+ },{
+ field: 'id',
+ title: '鍗曟嵁鍙�',
width: '10%',
style: 'color: #f67d06;font-weight: bold'
}, {
field: 'plateNum',
title: '杞︾墝鍙�',
- width: '9%',
+ width: '8%',
style: 'font-weight: bold'
}, {
- field: 'registerTime',
- title: '鐧昏鏃堕棿',
- width: '13%',
- style: 'font-weight: bold'
- }, {
- field: 'sampleStatus',
- title: '鏄惁鎵︽牱',
- width: '10%',
+ field: 'type',
+ title: '绫诲瀷',
+ width: '6%',
templet: function (item) {
- if (item.sampleStatus == null) {
- return "鏈墻鏍�";
- }
- if (item.sampleStatus == 'NONE') {
- return "鏈墻鏍�";
- }
- if (item.sampleStatus == 'SAMPLE') {
- return "宸叉墻鏍�";
- }
+ var result = item.type;
+ return result == "IN" ? "鍏ュ簱" : "鍑哄簱";
}
- }, {
- field: 'sampleUser',
- title: '鎵︽牱浜�',
- width: '10%',
- style: 'font-weight: bold'
- }, {
- field: 'sampleTime',
- title: '鎵︽牱鏃堕棿',
- width: '13%',
- style: 'font-weight: bold'
- }, {
- field: 'foodVariety',
- title: '绮鍝佺',
- width: '9%',
- 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: 'customerName',
+ title: '寰�鏉ュ崟浣�'
}, {
field: 'depotId',
title: '瑁呭嵏浠撳簱',
@@ -688,30 +206,44 @@
return result == null ? "" : result;
}
}, {
- field: 'checkStatus',
- title: '妫�楠岀粨鏋�',
+ 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: 'perWet',
+ title: '姘村垎',
+ width: '8%'
+ }, {
+ field: 'perImpurity',
+ title: '鏉傝川',
+ width: '8%'
+ }, {
+ field: 'progress',
+ title: '娴佺▼杩涘害',
+ width: '10%',
style: 'font-weight: bold',
templet: function (item) {
- if (item.checkStatus == 'NONE') {
- return "鏈寲楠�";
- }
- if (item.checkStatus == 'PASS') {
- return "鍚堟牸";
- }
- if (item.checkStatus == 'UNPASS') {
- return "涓嶅悎鏍�";
- }
- return item.checkStatus == null ? "" : item.checkStatus;
+ return INOUT_PROGRESS_MSG(item.progress);
}
}, {
field: '',
title: '鎿嶄綔',
- width: '8%',
+ width: '9%',
toolbar: "#barControl"
}]],
where: param,
parseData: function (res) {
- if ("0000" == res.code) {
+ if ("0000" === res.code) {
return {
"code": "0",
"msg": res.msg,
@@ -737,99 +269,6 @@
$("#form-param")[0].reset();
form.render();
}
-
-// ---------------------------绮浜у湴 -寮�濮� -------------------//
-// 寮瑰嚭绮浜у湴涓嬫媺妗�
-function showFoodLocation() {
- var index = layer.load();
- // 娓叉煋寰�鏉ュ崟浣嶅垪琛�
- table.render({
- elem: '#tableFoodLoaction',
- url: '../../basic/common/page-food-location',
- page: false,
- toolbar: '#toolbarFoodLocaton',
- even: true,
- method: 'POST',
- contentType: "application/json;charset=UTF-8",
- cols: [[{
- field: 'code',
- title: '缂栫爜',
- }, {
- field: 'simple',
- title: '绠�鎷�',
- }, {
- field: 'name',
- title: '鍚嶇О',
- width: '60%'
- }]],
- where: {
- "page": 1,
- "limit": 100
- },
- 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
- }
- }
- },
- done: function (res) {
- layer.close(index);
- }
- });
-
- //鍙屽嚮鏄剧ず閫変腑鏁版嵁
- table.on('rowDouble(tableFoodLoaction)', function (obj) {
- var data = obj.data;
- // 璧嬪��
- form.val("form-detail", {
- foodLocation: data.name,
- });
- // 鍏抽棴
- layer.close(index2);
- });
-
- // 寮瑰嚭瀵硅瘽妗�
- var index2 = layer.open({
- type: 1,
- title: "閫夋嫨绮骇鍦�",
- area: ['600px', '600px'],
- shade: 0,
- content: $('#listFoodLocation'),
- btn: 0,
- btn: ['鍙栨秷'],
- yes: function () {
- // 鍏抽棴
- layer.close(index2);
- },
- closeBtn: 0
- });
-
-};
-
-// 鍒锋柊
-function flushFoodLocation() {
- var key = $("#key2").val();
- table.reload('tableFoodLoaction', {
- url: "../../basic/common/page-food-location",
- where: {
- key: key
- },
- done: function (res) {
- if (key) {
- $("#key2").val(key);
- }
- }
- });
-};
/**
* 寮瑰嚭鎻愰啋妗�
--
Gitblit v1.9.3