From 46adcbf7494340a495539708210bb39110bdc33b Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期六, 29 十一月 2025 17:35:03 +0800
Subject: [PATCH] 快速登记、化验及称重作业页面提交1
---
fzzy-igdss-web/src/main/resources/static/inout/inout-register.js | 699 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 699 insertions(+), 0 deletions(-)
diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js
new file mode 100644
index 0000000..927611c
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-register.js
@@ -0,0 +1,699 @@
+//绉伴噸-鍖呮嫭绌鸿溅鍜屾弧杞︾О閲�
+var layer;
+var form;
+var table;
+var recordData = null;// 涓氬姟鏁版嵁淇℃伅
+var snapData;//绯荤粺鎶撴媿瀵硅薄淇℃伅
+var timerWeight;
+var paramIntelCard;//璁惧璇嗗埆缁撴灉
+var paramIdCard;//璁惧璇嗗埆缁撴灉
+var curCheckItems = null;// 褰撳墠鏁版嵁鐨勬鏌ラ」淇℃伅
+var step = 1;
+
+$(function () {
+ layui.use(['layer', 'laydate', 'form', 'table', 'util'], function () {
+ var util = layui.util;
+ layer = layui.layer;
+ form = layui.form;
+ table = layui.table;
+ layui.laydate.render({
+ elem: '#test1',
+ theme: '#7b8e9f'
+ });
+ // 鍙充笅瑙掓坊鍔犲浐瀹氫俊鎭�
+ util.fixbar({
+ bar1: true,
+ css: {
+ left: 10,
+ bottom: 10
+ },
+ bgcolor: '#53adce',
+ click: function (type) {
+ if (type === 'bar1') {
+ layer.closeAll();
+ layer.open({
+ type: 2,
+ title: false,
+ shadeClose: true,
+ shade: 0.3,
+ closeBtn: 2,
+ offset: ['50px', '120px'],
+ area: ['1000px', '640px'],
+ content: '../../basic/inout/inout-progress?type=' + type + "&t=" + Math.random()
+ });
+ }
+ }
+ });
+
+ //鐩戝惉閫夋嫨鏁版嵁浜嬩欢
+ table.on('tool(tableListProgressData)', function (obj) {
+ var data = obj.data;
+ if (obj.event === 'select') {
+ //娓呯┖琛ㄥ崟
+ resetForm();
+ flushData(data.intelCard, null);
+ layer.closeAll();
+ }
+ });
+
+ });
+
+ //鏄剧ず娴佺▼鐜妭
+ showProgress();
+
+ // 鐩戝惉閲嶉噺鍙樺寲
+ $(".weight").blur(function () {
+ deAutoByIn(this.name);
+ });
+
+ // 鍒濆鍖朩ebSocket
+ // initInoutWS(companyId, bizType, progress, userId);
+});
+
+window.onload = function () {
+ //鑷姩杩炴帴鍦扮淇℃伅锛�2.5绉掕幏鍙栦竴娆″湴纾呴噸閲忎俊鎭�
+ clearInterval(timerWeight);
+ timerWeight = setInterval(function () {
+ flushWeight();
+ }, 2500);
+
+ // 鍔犺浇瑙嗛
+ initVideo(snapDto1, snapDto2, snapDto3);
+
+ //璁剧疆鍦扮
+ $("#scaleName").val(weightDto.sort);
+
+ //鐩戝惉鍦扮閫夋嫨
+ $("#scaleName").change(function () {
+ layer.confirm('璋冩暣鍦扮闇�閲嶆柊鍔犺浇椤甸潰锛岀‘瀹氳皟鏁达紵', {
+ btn: ['纭畾', '鍙栨秷']
+ }, function () {
+ updateWeight();
+ });
+ });
+};
+
+// socket淇℃伅杩斿洖铏曠悊
+function socketOnMessage(packet) {
+ //鏆傛棤
+}
+
+//鐐瑰嚮绉伴噸
+function weight() {
+ // 娌℃湁涓氬姟鏁版嵁涓嶅彲鎵ц
+ if (!recordData) {
+ alertError("娌℃湁鏌ヨ鍒颁笟鍔℃暟鎹紝鎵ц琚嫆缁濓紒");
+ return;
+ }
+ // 濡傛灉鏄┖杞︾О閲�
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ form.val("form-data", {
+ emptyWeight: weightDto.weight
+ });
+ form.render();
+ }
+ // 濡傛灉鏄弧杞︾О閲�
+ if (InoutProgress.WEIGHT_FULL == recordData.progress) {
+ form.val("form-data", {
+ fullWeight: weightDto.weight
+ });
+ form.render();
+ }
+
+ // 鐐瑰嚮绉伴噸鑷姩璋冪敤鎶撴媿
+ snapData = {
+ companyId: companyId,
+ deptId: deptId,
+ progress: recordData.progress,
+ bizType: type,
+ bizId: recordData.id,
+ plateNum: recordData.plateNum,
+ id1: snapDto1.id,
+ id2: snapDto2.id,
+ id3: snapDto3.id,
+ id4: snapDto2.id,
+ sort: $("#scaleName").val(),
+ weight: weightDto.weight
+ };
+
+ //褰撳墠AJAX鏈嶅姟涓哄悓姝ユ湇鍔★紝杩斿洖鏁版嵁鍖呰鐓х墖淇℃伅
+ var index = layer.load();
+ $.ajax({
+ sync: false,
+ type: "POST",
+ 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") {
+ alertError(result.msg);
+ } else {
+ snapData = result.data;
+ }
+ },
+ error: function () {
+ layer.close(index);
+ alertError("鍚庡彴璋冪敤鎴浘澶辫触锛岃閲嶆柊灏濊瘯");
+ }
+ });
+ //濡傛灉鏄浜屾绉伴噸锛岄粯璁ゆ墽琛岃嚜鍔ㄨ绠�
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ deAutoByIn("emptyWeight");
+ }
+}
+
+// 浣跨敤鎻掍欢鑾峰彇韬唤璇�
+function flushIdCard() {
+ var index = layer.load();
+ $.ajax({
+ type: "GET",
+ async: true,
+ url: "http://127.0.0.1:9111/IDCARD",
+ data: {},
+ dataType: "json",
+ // jsonp: "callback",
+ // jsonpCallback: "jsonpCallback",
+ success: function (json) {
+ layer.close(index);
+ var data = json;
+ if (data.code === "200" || data.code == 200) {
+ paramIdCard = data.idNum;
+ $("#text-param").text("璇嗗埆韬唤璇侊細" + paramIdCard);
+ flushData(null, paramIdCard);
+ } else {
+ alertError("娌℃湁璇诲彇鍒拌韩浠借瘉淇℃伅锛�");
+ return;
+ }
+
+ },
+ error: function () {
+ alertError("娌℃湁璇诲彇鍒拌韩浠借瘉淇℃伅锛�");
+ layer.close(index);
+ }
+ });
+}
+
+function flushByHand() {
+ var intelCard = $("#intelCard").val();
+ flushData(intelCard, null);
+}
+
+/**
+ * 鎵嬪姩閫夋嫨锛岃幏鍙栧緟绉伴噸鐨勬暟鎹紝寮瑰嚭閫夋嫨
+ */
+function selectByHand() {
+ var param = {
+ deptId: deptId,
+ type: type,
+ timer: Math.random()
+ };
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/list-only-progress",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(param),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ } else {
+ renderTableProgressData(result.data);
+ }
+ },
+ error: function () {
+ layer.msg("绯荤粺鑾峰彇鏁版嵁鍑虹幇寮傚父锛岄噸鏂板皾璇�");
+ }
+ });
+}
+
+
+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 printBill() {
+ if (!recordData) {
+ alertError("娌℃湁鑾峰彇鍒颁笟鍔℃暟鎹紝鎵撳嵃琚嫆缁濓紒");
+ return;
+ }
+ // 浠庡悗鍙拌幏鍙栨ā鐗堝苟鎵撳嵃
+ var data = form.val("form-data");
+ // 鍚堝苟鏇存柊鐣跺墠缂栬緫鏁版嵁
+ Object.assign(recordData, data);
+
+ var index = layer.load();
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/report/bill-weight",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(recordData),
+ success: function (result) {
+ layer.close(index);
+ if (result.code != "0000") {
+ alertError(result.msg);
+ } else {
+ layer.msg("寮�濮嬫覆鏌撴墦鍗板崟鈥︹��");
+ printWeight(result.data);
+ }
+ },
+ error: function () {
+ layer.close(index);
+ alertError("鑾峰彇鎵撳嵃妯$増澶辫触锛岃鑱旂郴绠$悊鍛樻煡鐪嬪師鍥�");
+ }
+ });
+}
+
+// 琛ㄥ崟娓呯┖
+function resetForm() {
+ $("#form-data")[0].reset();
+ form.render();
+ recordData = null;
+ weightDto.weight = 0.0;
+ $("#weightValue").text("0.0");
+ $("#img_scale_statule").attr("src", "/img/web/inout/icon-red.png");
+
+ $("#text-param").val(null);
+}
+
+function flushPage() {
+ layer.confirm('纭畾瑕佸埛鏂伴〉闈㈠悧锛�', {icon: 3, title: '鎻愮ず'}, function (index) {
+ resetForm();
+ layer.close(index);
+ });
+}
+
+
+//鐩戝惉琛ㄥ崟閲岀殑鏁板�煎彉鍖�
+document.getElementById('intelCard').addEventListener('input', function (event) {
+ var intelCard = $("#intelCard").val();
+ if (intelCard.length == 10) {
+ flushData(intelCard, null);
+ }
+});
+
+// --鏌ヨ鏂规硶,鑾峰彇韬唤璇佸彿銆佸崱鍙枫�佽溅鐗屽彿锛岃繘琛屾煡璇�
+function flushData(intelCard, userIdCard) {
+ var index = layer.load();
+ var userIdCard = userIdCard;
+ var intelCard = intelCard;
+ var plateNum = $("#plateNum").val();
+ var param = {
+ type: type,
+ progress: progress,
+ intelCard: intelCard,
+ userId: userIdCard,
+ plateNum: plateNum
+ };
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/inout-query",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(param),
+ success: function (result) {
+ layer.close(index);
+ if (result.code != "0000") {
+ notifyProgress(result.msg, result.data);
+ } else {
+ recordData = result.data;
+ // 杩斿洖鐨勬暟鎹繘琛岃祴鍊�
+ form.val("form-data", recordData);
+ form.render();
+
+ updateEditAndProgress();
+ }
+ },
+ error: function () {
+ layer.close(index);
+ alertError("鏌ヨ澶辫触锛岃閲嶆柊灏濊瘯");
+ }
+ });
+}
+
+
+/**
+ * 鏍规嵁涓氬姟鏁版嵁鏇存柊椤甸潰涓殑鐘舵��
+ */
+function updateEditAndProgress() {
+ if (recordData) {
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ $("#emptyWeight").removeClass("rkbk-search-input");
+ $("#emptyWeight").attr("disabled", false);
+
+ $("#progress-hand").addClass("active");
+ $("#progress-emptyWeight").addClass("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").removeClass("active");
+ $("#progress-emptyWeight").removeClass("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-emptyWeight").removeClass("active");
+ }
+ //鏍规嵁閰嶇疆淇℃伅璁剧疆鍦扮鏄惁鍙紪杈�
+ if (weightEditTag && weightEditTag == 'N') {
+ $("#fullWeight").addClass("rkbk-search-input");
+ $("#fullWeight").attr("disabled", true);
+
+ $("#emptyWeight").addClass("rkbk-search-input");
+ $("#emptyWeight").attr("disabled", true);
+ }
+}
+
+// 褰撳墠瀹屾垚
+function submit() {
+ if (!recordData) {
+ alertError("娌℃湁涓氬姟鏁版嵁淇℃伅锛屾墽琛岃鎷掔粷");
+ return;
+ }
+ var data = form.val("form-data");
+
+ if (!data.depotId) {
+ alertError("鎻愮ず锛氳鍗镐粨搴撳繀濉�");
+ return;
+ }
+ if (!data.customerName) {
+ alertError("鎻愮ず锛氬鎴峰悕绉板繀濉�");
+ return;
+ }
+
+ // 鏍¢獙-鍏ュ簱婊¤溅绉伴噸
+ if (InoutProgress.WEIGHT_FULL == recordData.progress) {
+ if (data.fullWeight <= 0.0) {
+ alertError("鎻愮ず锛氭弧杞︾О閲嶄俊鎭繀濉�");
+ return;
+ }
+ }
+ if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
+ if (data.emptyWeight <= 0.0) {
+ alertError("鎻愮ず锛氱┖杞︾О閲嶄俊鎭繀濉�");
+ return;
+ }
+ if (!data.foodVariety) {
+ alertError("鎻愮ず锛氱伯椋熷搧绉嶅繀濉�");
+ return;
+ }
+
+ if (!data.settleWeight || data.settleWeight <= 0.0) {
+ alertError("缁撶畻閲嶉噺涓嶅悎瑙勶紝璇锋牳瀵�");
+ return;
+ }
+ if (!data.recordWeight || data.recordWeight <= 0.0) {
+ alertError("鍏ュ簱閲嶉噺涓嶅悎瑙勶紝璇锋牳瀵�");
+ return;
+ }
+ }
+ //鍚堝苟鏁版嵁
+ Object.assign(recordData, data);
+ // 鑾峰彇鐓х墖
+ var files = [{
+ fileName: snapData.fileName1
+ }, {
+ fileName: snapData.fileName2
+ }, {
+ fileName: snapData.fileName3
+ }, {
+ fileName: snapData.fileName4
+ }];
+ recordData.files = files;
+ var index = layer.load();
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/submit-weight",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(recordData),
+ success: function (result) {
+ if (result.code != "0000") {
+ alertError(result.msg);
+ } else {
+ notify("鏁版嵁鎻愪氦鎴愬姛", result.data);
+ if (InoutProgress.WEIGHT_FULL == recordData.progress) {
+ resetForm();
+ }
+ }
+ layer.close(index);
+ },
+ error: function () {
+ layer.close(index);
+ alertError("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯");
+ }
+ });
+}
+
+//鏄剧ず璐ㄦ淇℃伅
+function showCheck() {
+ if (!recordData) {
+ alertError("娌℃湁涓氬姟鏁版嵁淇℃伅锛屾墽琛岃鎷掔粷");
+ return;
+ }
+ // 鑾峰彇鍖栭獙椤逛俊鎭�
+ flushCheckItem();
+ layer.open({
+ type: 1,
+ title: "璐ㄦ璇︾粏",
+ offset: ['120px', '100px'],
+ area: ['1000px', '520px'],
+ shade: 0,
+ content: $('#checkDetail'),
+ btnAlign: 'c',
+ btn: ['鍙栨秷'],
+ yes: function () {
+ layer.closeAll();
+ },
+ closeBtn: 0
+ });
+}
+
+/**
+ * 鍒锋柊鍖栭獙缁撴灉椤�
+ */
+function flushCheckItem() {
+ curCheckItems = null;
+ $.ajax({
+ type: "POST",
+ url: "../../basic/inout/get-check-item",
+ dataType: "json",
+ contentType: "application/json;charset=UTF-8",
+ data: JSON.stringify(recordData),
+ success: function (result) {
+ if (result.code != "0000") {
+ layer.msg(result.msg);
+ } else {
+ curCheckItems = result.data;
+
+ // 椤甸潰娓叉煋妫�娴嬮」
+ renderTableCheckItem();
+ }
+ },
+ error: function () {
+ layer.msg("鍚庡彴寮傚父锛岃閲嶈瘯鎴栬�呰仈绯荤鐞嗗憳锛侊紒");
+ }
+ });
+}
+
+/**
+ * 寮瑰嚭鎻愰啋妗�
+ * @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']});
+ }
+}
+
+/**
+ * 娓叉煋琛ㄦ牸
+ */
+function renderTableCheckItem() {
+ // 娓呯┖鏁版嵁
+ $("#tableCheckItem").empty();
+ table.render({
+ elem: '#tableCheckItem',
+ data: curCheckItems,
+ page: false,
+ even: true,
+ cols: [[{
+ field: 'standardName',
+ title: '妫�楠岄」鐩�',
+ align: 'center',
+ width: '13%'
+ }, {
+ field: 'value',
+ title: '妫�楠屽��',
+ align: 'center',
+ width: '9%'
+ }, {
+ field: 'operaSymbolValue',
+ title: '鏍囧噯鍊�',
+ align: 'center',
+ width: '10%'
+ }, {
+ field: 'unit',
+ title: '鍗曚綅',
+ align: 'center',
+ width: '10%'
+ }, {
+ field: 'deNum',
+ title: '鎵i噸',
+ align: 'center',
+ width: '9%'
+ }, {
+ field: 'addNum',
+ title: '澧為噸',
+ align: 'center',
+ width: '9%'
+ }, {
+ field: 'dePrice',
+ title: '鎵d环',
+ align: 'center',
+ width: '9%'
+ }, {
+ field: 'addPrice',
+ title: '澧炰环',
+ align: 'center',
+ width: '9%'
+ }, {
+ 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'
+ }]]
+ });
+
+ $("thead tr").css({
+ "border-bottom": "2px solid #53adce",
+ "background": "#eff4f6"
+ });
+}
+
+function renderTableProgressData(list) {
+ // 娓呯┖鏁版嵁
+ $("#tableListProgressData").empty();
+ layer.open({
+ type: 1,
+ title: "閫夋嫨娴佺▼涓溅杈�",
+ offset: ['120px', '100px'],
+ area: ['1000px', '520px'],
+ shade: 0,
+ content: $('#listProgressData'),
+ closeBtn: 1
+ });
+ table.render({
+ elem: '#tableListProgressData',
+ data: list,
+ page: true,
+ even: true,
+ cols: [[
+ {type: 'numbers'}, {
+ field: 'id',
+ title: '鍗曟嵁鍙�',
+ align: 'center'
+ }, {
+ field: 'userName',
+ title: '鎵胯繍浜�',
+ align: 'center'
+ }, {
+ field: 'plateNum',
+ title: '杞︾墝鍙�',
+ align: 'center'
+ }, {fixed: 'right', title: '閫夋嫨鎿嶄綔', align: 'center', toolbar: '#barSelectProgress'}]]
+ });
+ $("thead tr").css({
+ "border-bottom": "2px solid #53adce",
+ "background": "#eff4f6"
+ });
+}
\ No newline at end of file
--
Gitblit v1.9.3