From 43fccc99f020ca4e495753650d7508110899d1b7 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 15 十二月 2025 15:39:40 +0800
Subject: [PATCH] 小卫过站控制添加
---
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_checkSN.html | 78 +++++++++
WebTM/WebTM.csproj.user | 2
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_batchKeyElement.html | 80 +++++++++
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_batch.html | 79 +++++++++
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_KeyElement_Sec.html | 77 +++++++++
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_checkPackage_Sec.html | 78 +++++++++
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_generateSNCode.html | 80 ++++++++++
7 files changed, 471 insertions(+), 3 deletions(-)
diff --git a/WebTM/WebTM.csproj.user b/WebTM/WebTM.csproj.user
index 59d7e88..4029b36 100644
--- a/WebTM/WebTM.csproj.user
+++ b/WebTM/WebTM.csproj.user
@@ -3,7 +3,7 @@
<PropertyGroup>
<NameOfLastUsedPublishProfile>D:\鏅轰簯杩堟�漒MES\MES-WEB-LayUI\WebTM\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>C:\Users\19858\Desktop\鏅轰簯杩堟�漒MES-WEB-LayUI\WebTM\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
- <ProjectView>ShowAllFiles</ProjectView>
+ <ProjectView>ProjectFiles</ProjectView>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
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_KeyElement_Sec.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_KeyElement_Sec.html"
index 1db25ea..6c73f8b 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_KeyElement_Sec.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_KeyElement_Sec.html"
@@ -80,6 +80,12 @@
</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" 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>
@@ -294,6 +300,7 @@
var option = [];
var option2 = [];
var rowarr = [];//鍏抽敭浠舵竻鍗�
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -341,6 +348,9 @@
if ($('#HProcExchBillNo').val() == "") {
$('#HBarCode_SN').val("");
return layer.alert("璇峰厛閫夋嫨娴佽浆鍗�")
+ }
+ if (!checkHSNAndDate(HBarCode_SN)) {
+ return
}
@@ -708,7 +718,74 @@
});
return result;
}
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ 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;
+ }
//鍔犺浇鍘嗗彶杩囩珯娓呭崟淇℃伅
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_batch.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_batch.html"
index 592e0af..0e1bccf 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_batch.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_batch.html"
@@ -55,6 +55,12 @@
</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" style="display:none">
<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="HBatchNo" lay-verify="HBatchNo" id="HBatchNo" style="background-color:#efefef4d;" readonly>
@@ -237,6 +243,7 @@
var params = get_UrlVars();
var HModName = "Cj_ProcessItemStationPlatform_batch";
var option = [];
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -281,6 +288,9 @@
if ($("#HBarCode_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
$("#HBarCode_Batch").focus();
+ return
+ }
+ if (!checkHSNAndDate(HBarCode_SN)) {
return
}
if (HBarCode_SN) {
@@ -530,6 +540,75 @@
});
}
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ 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 btn_Delete() {
var checkStatus = table.checkStatus('mainTable')
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 e2ad4b3..2a0bb08 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">
@@ -288,6 +294,7 @@
var HModName2 = "Cj_ProcessItemStationPlatform_batchKeyElement2";
var option = [];
var option2 = [];
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -365,6 +372,9 @@
if ($("#HBarCode_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
$("#HBarCode_Batch").focus();
+ return
+ }
+ if (!checkHSNAndDate(HBarCode_SN)) {
return
}
if (HBarCode_SN) {
@@ -862,6 +872,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();
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_checkPackage_Sec.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_checkPackage_Sec.html"
index c13cdd8..8f616bc 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_checkPackage_Sec.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_checkPackage_Sec.html"
@@ -80,6 +80,12 @@
</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" 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>
@@ -294,6 +300,7 @@
var option = [];
var option2 = [];
var rowarr = [];//鍏抽敭浠舵竻鍗�
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -342,7 +349,9 @@
$('#HBarCode_SN').val("");
return layer.alert("璇峰厛閫夋嫨娴佽浆鍗�")
}
-
+ if (!checkHSNAndDate(HBarCode_SN)) {
+ return
+ }
if (HBarCode_SN) {
txtHBarCodeSN_KeyDown(HBarCode_SN);
@@ -709,7 +718,74 @@
return result;
}
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ 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 = '') {
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_checkSN.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_checkSN.html"
index 8c7b775..61a9b79 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_checkSN.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_checkSN.html"
@@ -86,6 +86,12 @@
<input type="text" class="layui-input" name="HSNNo" lay-verify="HSNNo" id="HSNNo" style="background-color:#efefef4d;" readonly>
</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">
<label class="layui-form-label" style="width: 85px; color: red; ">鎵撳嵃妯℃澘</label>
<div class="layui-input-block" style="margin-left: 120px;">
@@ -273,6 +279,7 @@
var HModName = "Cj_ProcessItemStationPlatform_checkSN";
//var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
var option = [];
+ var previousHBarCode = "";
//var option2 = [];
//#endregion
@@ -304,6 +311,9 @@
$('#HBarCode_SN').on('keydown', function (event) {
var HBarCode = $('#HBarCode_SN').val();
if (event.keyCode == 13) {
+ if (!checkHSNAndDate(HBarCode)) {
+ return
+ }
//濡傛灉闀洉鐮佷笉涓虹┖
if (HBarCode) {
txtHBarCode_KeyDown(HBarCode);
@@ -563,6 +573,74 @@
});
}
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ 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 = '') {
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_generateSNCode.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_generateSNCode.html"
index 6a72f00..5f01e8f 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_generateSNCode.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_generateSNCode.html"
@@ -84,6 +84,12 @@
</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">
<label class="layui-form-label">妯℃澘鍚嶇О</label>
<div class="layui-input-block" style="margin-left: 120px; width: 185px;">
<select name="HPrintTemplate" id="HPrintTemplate" class="ForFilteringSchemes" lay-filter="HPrintTemplate"
@@ -270,6 +276,7 @@
var HModName = "Cj_ProcessItemStationPlatform_generateSN";
//var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
var option = [];
+ var previousHBarCode = "";
//var option2 = [];
//#endregion
@@ -328,6 +335,10 @@
if (event.keyCode == 13) {
var HBarCode = $('#HBarCode_SN').val();
if (event.keyCode == 13) {
+
+ if (!checkHSNAndDate(HBarCode)) {
+ return
+ }
//濡傛灉闀洉鐮佷笉涓虹┖
if (HBarCode) {
txtHBarCode_KeyDown(HBarCode);
@@ -632,6 +643,75 @@
}
+ //鏍¢獙 浜у搧鍜屽勾鏈�
+ 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();
--
Gitblit v1.9.1