From b7237a51c665ec1150bef9ab6c9bcfc7847755aa Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期三, 08 四月 2026 16:34:38 +0800
Subject: [PATCH] 1
---
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_batchKeyElement.html | 167 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 134 insertions(+), 33 deletions(-)
diff --git "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_batchKeyElement.html" "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_batchKeyElement.html"
index f64b0bc..5a30764 100644
--- "a/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_batchKeyElement.html"
+++ "b/WebTM/views/\350\275\246\351\227\264\347\256\241\347\220\206/\345\215\225\345\223\201\350\277\207\347\253\231_\345\260\217\345\215\253/Cj_ProcessItemStationPlatform_batchKeyElement.html"
@@ -64,11 +64,17 @@
<input type="text" class="layui-input" name="HBarCode_BatchSec" lay-verify="HBarCode_BatchSec" id="HBarCode_BatchSec" style="background-color:#efefef4d;" readonly>
</div>
</div>
- <div class="layui-inline">
+ <div class="layui-inline" style="display: none">
<label class="layui-form-label" style="width: 85px;">杩芥函鍗曞彿</label>
<div class="layui-input-block" style="margin-left: 120px;">
<input type="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#EDEDED;" readonly>
<input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <label class="layui-form-label" style="width: 85px;" id="">鏍¢獙骞存湀:</label>
+ <div class="layui-input-block" style="margin-left: 120px;">
+ <input type="text" class="layui-input" name="HCheckDate" lay-verify="HCheckDate" id="HCheckDate" style="background-color:#efefef4d;"placeholder="璇疯緭鍏ュ勾鏈堟牸寮忓2501锛堝叡鍥涗綅鍓嶄袱浣嶄唬琛ㄥ勾浠藉悗涓や綅浠h〃鏈堜唤锛�">
</div>
</div>
<!--<div class="layui-inline">
@@ -251,7 +257,8 @@
<script type="text/html" id="toolbarDemo2">
<div class="layui-btn-container">
- <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete2"><i class="layui-icon layui-icon-form"></i>鍒犻櫎</button>
+ <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete2"><i class="layui-icon layui-icon-form"></i>鍒犻櫎</button>-->
+ <button type="button" class="layui-btn layui-btn-sm" lay-event="refresh" id="refresh"><i class="layui-icon layui-icon-form"></i>鍒锋柊</button>
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn2" id="HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
</div>
</script>
@@ -287,6 +294,7 @@
var HModName2 = "Cj_ProcessItemStationPlatform_batchKeyElement2";
var option = [];
var option2 = [];
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -313,6 +321,7 @@
//鍒楄缃�
case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_Display);
break;
+
};
});
table.on('toolbar(mainTable2)', function (obj) {
@@ -322,6 +331,9 @@
break;
//鍒楄缃�
case 'set_HideColumn2': get_HideColumnNoPage(HModName2, sessionStorage["HUserName"], option2, get_Display);
+ break;
+ //鍒锋柊
+ case 'refresh': get_Display();
break;
};
});
@@ -362,6 +374,9 @@
$("#HBarCode_Batch").focus();
return
}
+ if (!checkHSNAndDate(HBarCode_SN)) {
+ return
+ }
if (HBarCode_SN) {
createBillNo();
txtHBarCodeSN_KeyDown(HBarCode_SN);
@@ -383,6 +398,19 @@
$("#HBarCode_SN").focus();
return
}
+ if ($("#HBarCode_SN").val().substring(0, 5) == "51510" || $("#HBarCode_SN").val().substring(0, 5) == "77217") {
+ var sql = "exec h_p_Cj_BlueToothBarCodeSave '" + $("#HBarCode_Key").val() + "'," + option.data[0].HMaterID + "," + "100004" + ",'" + sessionStorage["HUserName"] + "'";
+ $.ajax({
+ type: "GET",
+ url: GetWEBURL() + "/Gy_SOPBillList/UpDelSQL", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+ async: false,
+ data: { "sWhere": sql },
+ success: function (result) {
+
+ }
+ })
+ }
+
if (HBarCode_Key) {
txtHBarCodeKey_KeyDown(HBarCode_Key);
}
@@ -398,36 +426,17 @@
});
//鎹骇鍝�
form.on('submit(btnNextProc)', function (data) {
- //for (var i = 0; i < option.data.length; i++) {
- // if (option.data[i].HBindingQty < 1 || option.data[i].HBarCode == "") {
- // layer.alert("绗�<span style='color: red;'>" + (i + 1) + "</span>琛岋紝閰嶄欢 <span style='color: blue;'>" + option.data[i].HMaterName + "</span> 鏈粦瀹氶綈鏁达紒")
- // return;
- // }
- //}
- //淇濆瓨鍏抽敭浠�
- if (AllowLoadData(data)) {
- set_SaveBill(data);
- }
+ $("#HBarCode_SN").val("");
+ $("#HBarCode_Key").val("");
+ option.data = [];
+ table.render(option);
-
+ //鍚敤杈撳叆妗�,鑳屾櫙鑹叉仮澶�
+ $("#HBarCode_SN").prop("readonly", false);
+ $("#HBarCode_SN").css('background', '#FFFFFF')//浜у搧鐮佹枃鏈鑳屾櫙鑹叉仮澶�
+ $("#HBarCode_SN").focus();
- //閲嶆柊鑾峰彇鍗曟嵁鍙�
- //$.ajax({
- // url: GetWEBURL() + "/Web/GetMAXNumPDA",
- // type: "GET",
- // data: { "HBillType": '3727' },
- // success: function (d) {
- // $("#HInterID").val(d.data[0].HInterID);
- // $("#HBillNo").val(d.data[0].HBillNo);
- // $("#HDate").val(Format(new Date(), "yyyy-MM-dd")); //榛樿涓哄綋鍓嶆棩鏈�
- // //閲嶆柊鍚敤淇濆瓨鎸夐挳
- // $("#btnSave").removeClass("layui-btn-disabled").attr("disabled", false);
- // }
- //});
-
- //鍘嗗彶缁戝畾璁板綍鏌ヨ
- //get_Display();
});
@@ -735,12 +744,13 @@
var HBillNo = $("#HBillNo").val();
$.ajax({
type: "GET",
- url: GetWEBURL() + "/Cj_SingleStation/BarCodeBillBomMatch_XW",
+ url: GetWEBURL() + "/Cj_SingleStation/BarCodeBillBomBind_XW",
async: false,
data: { "HBillNo": HBillNo,"HBarCode": HBarCode, "HBarCode_P": $('#HBarCode_SN').val(), "HProcID": $('#HProcID').val(), "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
dataType: "json",
success: function (data1) {
if (data1.count == 1) {
+ layer.close(indexs);
var data = data1.data
for (var i = 0; i < option.data.length; i++) {
@@ -766,8 +776,13 @@
//鍏夋爣璺宠浆鍒伴厤浠剁爜鏂囨湰妗嗕笂
$("#HBarCode_Key").focus();
$("#HBarCode_Key").val("");
-
- layer.close(indexs);
+ //濡傛灉閰嶄欢閰嶅畬鑷甫鎻愪氦
+ if (areQuantitiesEqual(option.data)) {
+ //淇濆瓨鍏抽敭浠�
+ if (AllowLoadData(data)) {
+ set_SaveBill(data);
+ }
+ }
}
else {
layer.close(indexs);
@@ -809,7 +824,7 @@
"field": {
"HProcID": $("#HProcID").val(), "HBatchNo": $("#HBarCode_Batch").val(),
"HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
- "HProdOrgID": sessionStorage["OrganizationID"],
+ "HPRDOrgID": sessionStorage["OrganizationID"],
"HEmpID": $("#HEmpID").val(), "HDeptID": $("#HDeptID").val()
}
};
@@ -850,6 +865,74 @@
}
//#endregion
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ function checkHSNAndDate(HBarCode) {
+ // 1. 鏍¢獙HBarCode闀垮害
+ if (!HBarCode || HBarCode.length < 20) {
+ layer.confirm("HBarCode闀垮害涓嶈冻20浣�");
+ return false;
+ }
+
+ // 2. 瑙f瀽HBarCode鐨勫勾鏈堟棩
+ const yearLastDigit = HBarCode[12]; // 绗�13浣嶏紙绱㈠紩12锛夛紝骞翠唤鏈�鍚庝竴浣�
+ const monthCode = HBarCode[13].toUpperCase(); // 绗�14浣嶏紝鏈堜唤锛圢-Z锛�
+
+
+ // 璁$畻骞翠唤锛堝亣璁惧綋鍓嶄笘绾紝濡�2020-2029锛�
+
+ const year = yearLastDigit;
+
+ // 璁$畻鏈堜唤锛圢=1, ..., Z=12锛�
+ const validChars = "NPQRSTUVWXYZ";
+ if (!validChars.includes(monthCode)) {
+ layer.confirm("瀛楃蹇呴』鏄� N, P-Z 涔嬩竴锛堣烦杩� O锛�");
+ return false;
+ }
+
+ // 璁$畻鏈堜唤锛歂=1, P=2, ..., Z=12
+ const month = validChars.indexOf(monthCode) + 1;
+
+
+ // 3. 鑾峰彇杈撳叆妗嗙殑骞存湀锛堟牸寮廚NMM锛屽2307琛ㄧず2023骞�7鏈堬級
+ const checkDateInput = document.getElementById("HCheckDate");
+ if (!checkDateInput) {
+ layer.confirm("鎵句笉鍒癏CheckDate杈撳叆妗�");
+ return false;
+ }
+ const inputValue = checkDateInput.value.trim();
+ if (!/^\d{4}$/.test(inputValue)) {
+ layer.confirm("杈撳叆妗嗘牸寮忛敊璇紙蹇呴』鏄疦NMM锛屽2307锛�");
+ return false;
+ }
+ const inputYear = inputValue.substring(1, 2); // NN锛堝23锛�
+ const inputMonth = parseInt(inputValue.substring(2, 4), 10); // MM锛堝07锛�
+
+ // 4. 鏍¢獙骞存湀鏄惁涓�鑷�
+ if (year !== inputYear || month !== inputMonth) {
+ layer.confirm(
+ `骞存湀涓嶅尮閰嶏細HBarCode=${year}骞�${month}鏈堬紝杈撳叆妗�=${inputYear}骞�${inputMonth}鏈坄
+ );
+ return false;
+ }
+
+ // 5. 鏍¢獙鍓嶄簲浣嶆槸鍚︿笌涓婁竴娆′竴鑷�
+ const currentFirstFive = HBarCode.substring(0, 5);
+ if (previousHBarCode) {
+ const previousFirstFive = previousHBarCode.substring(0, 5);
+ if (currentFirstFive !== previousFirstFive) {
+ layer.confirm(
+ `鍓嶄簲浣嶄笉涓�鑷达細褰撳墠=${currentFirstFive}锛屼笂涓�娆�=${previousFirstFive}`
+ );
+ return false;
+ }
+ }
+
+ // 6. 鏇存柊涓婁竴娆$殑HBarCode
+ previousHBarCode = HBarCode;
+ $("#HCheckDate").prop("readonly", true);
+ console.log("鏍¢獙閫氳繃");
+ return true;
+ }
function get_Display(sWhere = '') {
var ajaxLoad = layer.load();
@@ -1165,6 +1248,24 @@
}
}
+ //鍒ゆ柇鏄惁缁戝畾瀹�
+ function areQuantitiesEqual(arr) {
+ if (arr.length === 0) {
+ return false; // 绌烘暟缁勯粯璁よ涓烘弧瓒虫潯浠�
+ }
+
+ const firstHPartsQty = arr[0].HPartsQty;
+ const firstHBindingQty = arr[0].HBindingQty;
+
+ for (let i = 1; i < arr.length; i++) {
+ if (arr[i].HPartsQty !== firstHPartsQty || arr[i].HBindingQty !== firstHBindingQty) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
//#endregion
});
--
Gitblit v1.9.1