From 96785ebcfe1bc9210f3d9d4056f4ec29fb60d810 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期四, 02 四月 2026 10:58:22 +0800
Subject: [PATCH] 1
---
WebTM/views/车间管理/单品过站_小卫/Cj_ProcessItemStationPlatform_batchKeyElement.html | 717 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 589 insertions(+), 128 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 8f054d9..099773e 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"
@@ -33,7 +33,8 @@
<label class="layui-form-label" style="padding-left:0px" id="">闀洉鐮�:</label>
<input type="text" class="layui-input" name="HBarCode_SN" lay-verify="HBarCode_SN" autocomplete="off" placeholder="璇烽敭鍏ュ悗鍥炶溅" id="HBarCode_SN" style="width: 500px;">
</div>
-
+ <button class="layui-btn layui-btn-normal" style="float:left;" type="button" lay-submit="" lay-filter="btnNextProc" id="btnNextProc">鎹骇鍝�</button>
+ <!--<button class="layui-btn layui-btn-normal" style="float:left;" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">淇濆瓨</button>-->
<button class="layui-btn layui-btn-normal" style="float:right" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">閫�鍑�</button>
<button class="layui-btn layui-btn-normal" style="float: right" type="button" lay-submit="" lay-filter="btnChange" id="btnChange">鍙樻洿</button>
@@ -46,7 +47,7 @@
</div>
- <div class="layui-tab layui-tab-card" style="width: 49%; float: left; background-color: white;height:400px">
+ <div class="layui-tab layui-tab-card" style="width: 40%; float: left; background-color: white;height:400px">
<ul class="layui-tab-title" lay-filter="tab-all">
<li lay-id="1" style="padding:1px;" class="layui-this">浜у搧淇℃伅</li>
<li lay-id="2" style="padding:1px;">鍏朵粬淇℃伅</li>
@@ -63,12 +64,25 @@
<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" 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">
<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>
</div>
- </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;">
@@ -213,7 +227,7 @@
</div>
</div>
- <div class="layui-tab layui-tab-card" style="width: 50.5%; float: right;">
+ <div class="layui-tab layui-tab-card" style="width: 59.5%; float: right;">
<ul class="layui-tab-title">
<li class="layui-this">鍏抽敭浠舵竻鍗�</li>
</ul>
@@ -240,15 +254,11 @@
</div>
</div>
</div>
- <script type="text/html" id="toolbarDemo">
- <div class="layui-btn-container">
- <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Delete"><i class="layui-icon layui-icon-form"></i>瑙g粦</button>
- <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn" id="HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
- </div>
- </script>
+
<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>
@@ -258,6 +268,9 @@
</div>
</body>
</html>
+<script type="text/html" id="barDemo">
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
+</script>
<script>
layui.config({
@@ -277,10 +290,11 @@
//瀹氫箟鍏ㄥ眬鍙橀噺
- var HModName = "Cj_ProcessItemStationPlatform_batch";
- var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
+ var HModName = "Cj_ProcessItemStationPlatform_batchKeyElement";
+ var HModName2 = "Cj_ProcessItemStationPlatform_batchKeyElement2";
var option = [];
var option2 = [];
+ var previousHBarCode = "";
//#endregion
//#region 杩涘叆椤甸潰鍗冲姞杞�
@@ -293,83 +307,138 @@
//#region 瑙﹀彂浜嬩欢锛氬寘鎷琭orm.on(){}鏍煎紡鐨勬墍鏈夌偣鍑讳簨浠躲�侀�夋嫨浜嬩欢绛�
//澶村伐鍏锋爮浜嬩欢
+
+ //缁戝畾淇℃伅琛屽唴浜嬩欢
+ table.on('tool(mainTable)', function (obj) {
+ set_GridDelete(obj); //琛屽唴鍒犻櫎
+ });
+
table.on('toolbar(mainTable)', function (obj) {
switch (obj.event) {
//鍒犻櫎鎸夐挳
- case 'btn-Delete': set_DeleteBill();
- break;
+ //case 'btn-Delete': btn_Delete();
+ // break;
//鍒楄缃�
case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_Display);
break;
+
};
});
table.on('toolbar(mainTable2)', function (obj) {
switch (obj.event) {
//鍒犻櫎鎸夐挳
- case 'btn-Delete2': set_DeleteBill2();
+ case 'btn-Delete2': btn_Delete();
break;
//鍒楄缃�
case 'set_HideColumn2': get_HideColumnNoPage(HModName2, sessionStorage["HUserName"], option2, get_Display);
break;
+ //鍒锋柊
+ case 'refresh': get_Display();
+ break;
};
});
+
+ //鍙樻洿
+ form.on('submit(btnChange)', function (data) {
+ $("#HBarCode_Batch").val("");
+ $("#HBarCode_Batch").prop("readonly", false);
+ $("#HBarCode_BatchSec").val("");
+ $("#HBatchNo").val("");
+ $("#HMaterNumber").val("");
+ $("#HMaterName").val("");
+ $("#HMaterModel").val("");
+ $("#HSupID").val(0)
+ $("#HSupName").val(0)
+ //杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ壒娆′笂
+ $("#HBarCode_Batch").focus();
+ });
+
//鎵规鐮佸洖杞︽柟娉�
$('#HBarCode_Batch').on('keydown', function (event) {
- var HBarCode = $('#HBarCodeSN').val();
- var HBardCodeProcExchBillNo = $('#HBardCodeProcExchBillNo').val();
+ var HBarCode = $('#HBarCode_Batch').val();
if (event.keyCode == 13) {
- if (!HBardCodeProcExchBillNo) {
- layer.msg(get_MessageError("[0000-2-034]璇峰厛鎵祦杞崱锛�", sessionStorage["HTranSlate"]))
- return;
- } else {
- HBarCode = HBarCode.toUpperCase();
- if (!HBarCode) {
- layer.msg(get_MessageError("[0000-2-019]鏉″舰鐮佷笉鑳戒负绌猴紒", sessionStorage["HTranSlate"]))
- return;
- } else {
- if (HBarCode.length != 29 && HBarCode.length != 50) {
- layer.alert(get_MessageError("[3791-2-012]瀛愪欢鏉$爜闀垮害涓嶄负29浣嶆垨50浣�!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]閫�鍑�', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
- return;
- }
+ //濡傛灉闀洉鐮佷笉涓虹┖
+ if (HBarCode) {
+ txtHBarCode_KeyDown(HBarCode);
+ }
- if (HBarCode.match(/[^\x00-\xff]/g) != null) {
- layer.alert(get_MessageError("[3791-2-013]蹇呴』鏄崐瑙掑瓧绗�!", sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-035]閫�鍑�', sessionStorage["HTranSlate"])], time: 100000, offset: 't' });
- return;
- }
- }
- }
- for (var i = 0; i < option.data.length; i++) {
- if (option.data[i]["HBatchNo"] == "") {
- layer.msg(get_MessageError("[3791-2-014]褰撳墠宸ュ簭鎵规涓嶈兘涓虹┖锛�", sessionStorage["HTranSlate"]))
- return;
- }
- }
- txtHBarCode_KeyDown(HBarCode);
}
});
//闀洉鐮佸洖杞︽柟娉�
$('#HBarCode_SN').on('keydown', function (event) {
- var HBarCode = $('#HBardCodeProcExchBillNo').val();
+ var HBarCode_SN = $('#HBarCode_SN').val();
if (event.keyCode == 13) {
- if (!HBarCode) {
- layer.msg(get_MessageError("[0000-1-057]娴佽浆鍗′笉鑳戒负绌猴紒", sessionStorage["HTranSlate"]))
- return;
+ if ($("#HBarCode_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
+ layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
+ $("#HBarCode_Batch").focus();
+ return
}
- setIntervalIndex = setInterval(setIntervalList, 30000);
- get_BomList(HBarCode);
- //if (option.data != 0) {
- // //淇濆瓨鍒颁复鏃惰〃
- // get_AddBomTempList();
- //}
- //鏌ヨ涓嶈壇璁板綍
- get_BadRecords();
- //鏌ヨ鍚堟牸璁板綍
- get_HGRecords();
+ if (!checkHSNAndDate(HBarCode_SN)) {
+ return
+ }
+ if (HBarCode_SN) {
+ createBillNo();
+ txtHBarCodeSN_KeyDown(HBarCode_SN);
+ }
-
}
});
+ //鍏抽敭浠跺洖杞︽柟娉�
+ $('#HBarCode_Key').on('keydown', function (event) {
+ var HBarCode_Key = $('#HBarCode_Key').val();
+ if (event.keyCode == 13) {
+ if ($("#HBarCode_Batch").val() == "" || $("#HBarCode_Batch").val() == null) {
+ layer.msg("鏈壂鎵规鐮佽鍏堟壂鐮�");
+ $("#HBarCode_Batch").focus();
+ return
+ }
+ if ($("#HBarCode_SN").val() == "" || $("#HBarCode_SN").val() == null) {
+ layer.msg("鏈壂SN鐮佽鍏堟壂鐮�");
+ $("#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);
+ }
+
+ }
+ });
+
+ //淇濆瓨
+ form.on('submit(btnSave)', function (data) {
+ if (AllowLoadData(data)) {
+ set_SaveBill(data);
+ }
+ });
+ //鎹骇鍝�
+ form.on('submit(btnNextProc)', function (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();
+
+ });
+
//閫夋嫨鎿嶄綔鍛�
form.on('submit(btnHEmp)', function () {
@@ -415,16 +484,17 @@
//鍒濆鍖栫晫闈�
function set_ClearBill() {
//杩涘叆椤甸潰榛樿鍏夋爣鍦ㄦ祦杞崱涓�
- $("#HBardCodeProcExchBillNo").focus();
+ $("#HBarCode_Batch").focus();
//鍒跺崟浜�
$("#HMaker").val(sessionStorage["HUserName"]);
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
+
//閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
GetDefValByUser();
//鍒濆鍖栬〃鏍�
set_InitGrid();
//
- //get_Display();
+ get_Display();
}
//#region 閫氳繃鐧诲綍鐢ㄦ埛鑾峰彇榛樿鍊�
@@ -461,33 +531,55 @@
}
//#endregion
+ // 鐢熸垚鍗曟嵁鍙�
+ function createBillNo() {
+ //閲嶆柊鑾峰彇鍗曟嵁鍙�
+ $.ajax({
+ url: GetWEBURL() + "/Web/GetMAXNumPDA",
+ type: "GET",
+ async: false,
+ 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);
+ }
+ });
+ }
+
//鍏抽敭浠舵竻鍗�
function set_InitGrid() {
option= {
elem: '#mainTable'
- , toolbar: '#toolbarDemo'
+ //, toolbar: '#toolbarDemo'
, page: false
, totalRow: true
, cellMinWidth: 120
, data: []
, height: 285
- , limit: 10
- , cols: [[
- { type: 'numbers', title: '搴忓彿' }
- , { field: '鏃ユ湡', title: '鏃ユ湡' }
- , { field: '閰嶄欢浠g爜', title: '閰嶄欢浠g爜' }
- , { field: '閰嶄欢鍚嶇О', title: '閰嶄欢鍚嶇О' }
- , { field: '閰嶄欢瑙勬牸', title: '閰嶄欢瑙勬牸' }
- , { field: '閰嶄欢鏁伴噺', title: '閰嶄欢鏁伴噺', totalRow: true}
- , { field: 'HBatchNo', title: '褰撳墠鎵规' }
- , { field: 'HICMOInterID', title: 'HICMOInterID', hide: true }
- , { field: 'HICMOEntryID', title: 'HICMOEntryID', hide: true }
- , { field: 'HICMOBillNo', title: 'HICMOBillNo', hide: true }
- , { field: 'HProcExchInterID', title: 'HProcExchInterID', hide: true }
- , { field: 'HProcExchEntryID', title: 'HProcExchEntryID', hide: true }
- , { field: 'HProcExchBillNo', title: 'HProcExchBillNo', hide: true }
+ , limit: 50
+ , cols: [[ //缁戝畾淇℃伅琛�
+ { type: 'numbers', title: '搴忓彿', width: 50 }
+ , { field: 'HBarCode_P', title: '浜у搧鐮�', width: 265 }
+ , { field: 'HBarCode', title: '閰嶄欢鐮�', width: 265 }
+ , { field: 'HPartsQty', title: '閰嶄欢鏁�', width: 72 }
+ , { field: 'HBindingQty', title: '宸茬粦鏁�', width: 72 }
, { field: 'HMaterID', title: 'HMaterID', hide: true }
- , { field: 'HBarCode', title: 'HBarCode', hide: true }
+ , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 160 }
+ , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 160 }
+ , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 160, hide: true }
+ , { field: 'HBatchNo', title: '鎵规', width: 160, hide: true }
+ , { field: 'HSourceID', title: 'HSourceID', width: 160, hide: true }
+ , { field: 'HEquipID', title: 'HEquipID', width: 160, hide: true }
+ , { field: 'HGroupID', title: 'HGroupID', width: 160, hide: true }
+ , { field: 'HWorkerID', title: 'HWorkerID', width: 160, hide: true }
+ , { field: 'HScanDate', title: 'HScanDate', width: 160, hide: true }
+ , { field: 'HSourceInterID', title: 'HSourceInterID', width: 160, hide: true }
+ , { field: 'HSourceEntryID', title: 'HSourceEntryID', width: 160, hide: true }
+ , { field: 'HSourceBillNo', title: 'HSourceBillNo', width: 160, hide: true }
+ , { fixed: 'right', title: '鎿嶄綔', toolbar: '#barDemo', width: 66 }
]]
}
option2 = {
@@ -524,53 +616,35 @@
//鏉$爜鍥炶溅鏌ヨ
function txtHBarCode_KeyDown(HBarCode) {
- var HProcExchBillNo = $("#HProcExchBillNo").val();
var indexs = layer.load();
$.ajax({
type: "GET",
- url: GetWEBURL() + "/Cj_SingleStation/SNHBardCodeList",
+ url: GetWEBURL() + "/Cj_SingleStation/checkHBarCode_Batch",
async: false,
- data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+ data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
dataType: "json",
success: function (data1) {
if (data1.count == 1) {
layer.close(indexs);
- var index = layer.load();
+ $("#HBarCode_BatchSec").val(HBarCode);
+ const parts = HBarCode.split('@');
+ $("#HBatchNo").val(parts[2]);
- $.ajax({
- type: "GET",
- url: GetWEBURL() + "/Cj_SingleStation/HBardCodeSNList",
- async: false,
- data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"] },
- dataType: "json",
- success: function (data1) {
- if (data1.count == 1) {
- layer.close(index);
- $("#HBarCode_P").val(HBarCode);
- if (AllowLoadData()) {
- //淇濆瓨鏁版嵁
- set_AddAssemblyBill();
- }
- }
- else {
- layer.close(index);
- layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
- }
- $("#HBarCodeSN").val("");
- },
- error: function (err) {
- layer.close(index);
- layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
- }
- });
+ $("#HMaterNumber").val(data1.data[0]["HMaterNumber"])
+ $("#HMaterName").val(data1.data[0]["HMaterName"])
+ $("#HMaterModel").val(data1.data[0]["HMaterModel"])
+ $("#HSupID").val(data1.data[0]["HSupID"])
+ $("#HSupName").val(data1.data[0]["HSupName"])
+ $("#HBarCode_Batch").prop("readonly", true);
+
+ //鍏夋爣鍦ㄩ暛闆曠爜涓�
+ $("#HBarCode_SN").focus();
}
else {
layer.close(indexs);
- layer.msg(get_MessageError(data1.Message, sessionStorage["HTranSlate"]));
+ layer.msg(data1.Message);
}
- //鍏夋爣璺宠浆鍒癝N鏉$爜鏂囨湰妗嗕笂
- //$("#HBarCodeSN").focus();
- $("#HBarCodeSN").val("");
+
},
error: function (err) {
layer.close(indexs);
@@ -579,19 +653,303 @@
});
}
- //鍔犺浇缃戞牸
- function get_Display() {
- var ajaxLoad = layer.load();
+ //浜у搧SN闀洉鐮佺爜鍥炶溅鏌ヨ
+ function txtHBarCodeSN_KeyDown(HBarCode) {
+ //涓昏〃淇℃伅鏌ヨ
+ var indexs = layer.load();
+ //閰嶄欢淇℃伅鏌ヨ
+ var HBillNo = $("#HBillNo").val();
$.ajax({
- url: GetWEBURL() + '/Cg_POOrderBill/list',
+ type: "GET",
+ url: GetWEBURL() + "/Cj_SingleStation/HBardCodeBomList_XW",
+ async: false,
+ data: { "HBillNo": HBillNo,"HBarCode": HBarCode, "HProcID": $("#HProcID").val(), "HOrgID": sessionStorage["OrganizationID"], "user": sessionStorage["HUserName"] },
+ dataType: "json",
+ success: function (data1) {
+ if (data1.count == 1) {
+ var data = data1.data
+ var rowarr = [];
+
+ for (var i = 0; i < data.length; i++) {
+ rowarr.push({
+ "HBarCode_P": data[i].浜у搧鐮�, "HPartsBarCode": "", "HPartsQty": data[i].鍒嗗瓙瀛愰」鐢ㄩ噺, "HBindingQty": 0
+ , "HMaterID": data[i].瀛愰」鐗╂枡ID, "HMaterNumber": data[i].瀛愰」鐗╂枡浠g爜, "HMaterName": data[i].瀛愰」鐗╂枡鍚嶇О, "HMaterModel": data[i].瀛愰」瑙勬牸鍨嬪彿, "HBatchNo": ""
+ , "HSourceID": $("#HSourceID").val(), "HEquipID": 0, "HGroupID": $("#HGroupID").val(), "HWorkerID": $("#HEmpID").val()
+ , "HScanDate": new Date(), "HSourceInterID": $("#HICMOInterID").val()
+ , "HSourceEntryID": $("#HICMOEntryID").val(), "HSourceBillNo": $("#HICMOBillNo").val()
+ });
+ }
+
+ option.data = rowarr;
+
+ table.render(option);
+
+
+
+ //绂佺敤杈撳叆妗�,鑳屾櫙鑹插彉鐏�
+ $("#HBarCode_SN").prop("readonly", true);
+ $("#HBarCode_SN").css('background', '#EDEDED')//鑳屾櫙鑹插彉鐏�
+ //鍏夋爣璺宠浆鍒伴厤浠剁爜鏂囨湰妗嗕笂
+ $("#HBarCode_Key").focus();
+ //鑾峰彇瀵瑰簲涓昏〃淇℃伅
+ $.ajax({
+ type: "GET",
+ url: GetWEBURL() + "/Cj_SingleStation/checkHBarCode_Batch",
+ async: false,
+ data: { "HBarCode": HBarCode, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
+ dataType: "json",
+ success: function (data1) {
+ if (data1.count == 1) {
+ layer.close(indexs);
+ $("#HSNNo").val(HBarCode);
+ $("#HMaterNumber").val(data1.data[0]["HMaterNumber"])
+ $("#HMaterName").val(data1.data[0]["HMaterName"])
+ $("#HMaterModel").val(data1.data[0]["HMaterModel"])
+ $("#HICMOBillNo").val(data1.data[0]["HSourceBillNo"])
+ }
+ else {
+ layer.close(indexs);
+ layer.confirm(data1.Message);
+ }
+
+ },
+ error: function (err) {
+ layer.close(indexs);
+ layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+ return;
+ }
+ });
+ }
+ else {
+ layer.close(indexs);
+ $("#HBarCode_SN").val("");
+ $("#HBarCode_SN").focus();
+ layer.confirm(data1.Message);
+ }
+ },
+ error: function (err) {
+ layer.close(indexs);
+ layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ $("#HBarCode_SN").val("");
+ $("#HBarCode_SN").focus();
+ layer.confirm(data1.Message);
+ }
+ });
+
+ }
+
+ //閰嶄欢鐮佸洖杞︽煡璇�
+ function txtHBarCodeKey_KeyDown(HBarCode) {
+ var indexs = layer.load();
+ var HBillNo = $("#HBillNo").val();
+ $.ajax({
+ type: "GET",
+ 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) {
+ var data = data1.data
+
+ for (var i = 0; i < option.data.length; i++) {
+ if (data[0].HMaterID == option.data[i].HMaterID && option.data[i].HBindingQty < option.data[i].HPartsQty) {
+ option.data[i].HMaterID = data[0].HMaterID
+ option.data[i].HMaterNumber = data[0].鐗╂枡浠g爜
+ option.data[i].HMaterName = data[0].鐗╂枡鍚嶇О
+ option.data[i].HMaterModel = data[0].瑙勬牸鍨嬪彿
+ option.data[i].HBarCode = data[0].閰嶄欢鐮�
+ option.data[i].HBindingQty = option.data[i].HBindingQty + 1
+ $("#HReturnMessage").text("鎴愬姛鎵爜涓�涓厤浠�:" + data[0].鐗╂枡鍚嶇О);
+ break;
+ } else if (data[0].HMaterID == option.data[i].HMaterID && i == option.data.length - 1) {
+ layer.msg("绗�" + (i + 1) + "琛屽凡鍏ㄩ儴缁戝畾锛岃鍕胯秴閲忕粦瀹�");
+ } else if (data[0].HMaterID != option.data[i].HMaterID && i == option.data.length - 1) {
+ layer.msg("鎵�鎵厤浠剁爜锛�" + HBarCode + " ,瀵瑰簲鐗╂枡涓嶅湪鐢熶骇鐢ㄦ枡娓呭崟涓紒");
+ }
+ }
+
+ //option.data = rowarr;
+
+ table.render(option);
+ //鍏夋爣璺宠浆鍒伴厤浠剁爜鏂囨湰妗嗕笂
+ $("#HBarCode_Key").focus();
+ $("#HBarCode_Key").val("");
+ //濡傛灉閰嶄欢閰嶅畬鑷甫鎻愪氦
+ if (areQuantitiesEqual(option.data)) {
+ //淇濆瓨鍏抽敭浠�
+ if (AllowLoadData(data)) {
+ set_SaveBill(data);
+ }
+ }
+
+ layer.close(indexs);
+ }
+ else {
+ layer.close(indexs);
+ layer.msg(data1.Message);
+ }
+ },
+ error: function (err) {
+ layer.close(indexs);
+ layer.msg("閿欒:" + err, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ }
+ });
+ }
+
+ //鍒囨崲浜у搧鏂规硶
+ function set_changeHBarCodeSN() {
+ $("#HSNNo").val("");
+ $("#HMaterNumber").val("")
+ $("#HMaterName").val("")
+ $("#HMaterModel").val("")
+ $("#HICMOBillNo").val("")
+
+
+ //鍚敤杈撳叆妗�,鑳屾櫙鑹叉仮澶�
+ $("#HBarCode_SN").prop("readonly", false);
+ $("#HBarCode_SN").css('background', '#FFFFFF')//浜у搧鐮佹枃鏈鑳屾櫙鑹叉仮澶�
+ //娓呯┖鏂囨湰妗嗗唴瀹�
+ $("#HBarCode_SN").val("");//浜у搧鐮佹枃鏈鍐呭娓呯┖
+ //鍏夋爣璺宠浆鍒颁骇鍝佺爜鏂囨湰妗嗕笂
+ $("#HBarCode_SN").focus();
+
+ //娓呴櫎缁戝畾淇℃伅缃戞牸鎵爜璁板綍
+ option.data = [];
+ table.render(option);
+ }
+
+ //#region 淇濆瓨鏂规硶
+ function set_SaveBill() {
+ var data = {
+ "field": {
+ "HProcID": $("#HProcID").val(), "HBatchNo": $("#HBarCode_Batch").val(),
+ "HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
+ "HPRDOrgID": sessionStorage["OrganizationID"],
+ "HEmpID": $("#HEmpID").val(), "HDeptID": $("#HDeptID").val()
+ }
+ };
+ var sMainStr = JSON.stringify(data.field);
+ var HBarCode = $("#HBarCode_SN").val();
+ var sSubStr = JSON.stringify(option.data);
+ var sMainSub = sMainStr + ';' + HBarCode + ';' + sSubStr+';' + sessionStorage["HUserName"];
+ var indexs = layer.load();
+ $.ajax({
+ type: "POST",
+ url: GetWEBURL() + "/Cj_SingleStation/AddStationOutBillAndAssemblyBill",
+ async: false,
+ data: { "sMainSub": sMainSub },
+ dataType: "json",
+ success: function (data1) {
+ if (data1.count == 1) {
+ layer.close(indexs);
+
+
+ $("#HReturnMessage").text("鎴愬姛杩囩珯鎵爜涓�涓骇鍝�:" + HBarCode);
+ //鍒囨崲浜у搧
+ set_changeHBarCodeSN();
+ get_Display();
+ }
+ else {
+
+ layer.close(indexs);
+ layer.msg(data1.Message, { icon: 5, btn: ["纭"], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "鍑虹幇閿欒" });
+ }
+
+ },
+ error: function (err) {
+
+ layer.close(indexs);
+ layer.msg(get_MessageError("閿欒:" + err, sessionStorage["HTranSlate"]), { icon: 5, btn: [get_MessageError('[0000-2-008]纭', sessionStorage["HTranSlate"])], time: 100000, offset: 't', skin: 'layui-layer-lan', title: get_MessageError("[0000-2-009]娓╅Θ鎻愮ず", sessionStorage["HTranSlate"]) });
+ }
+ });
+ }
+ //#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();
+ var HProcID = $("#HProcID").val();
+ var HSourceID = $("#HSourceID").val();
+ sWhere += ` and HProcID = ${HProcID} and HSourceID = ${HSourceID}`
+ $.ajax({
+ url: GetWEBURL() + '/Cj_SingleStation/SingleStationOutBillList',
async: false,
type: "GET",
- data: { "sWhere": '', "user": sessionStorage["HUserName"] },
+ data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
success: function (data1) {
if (data1.count == 1) {
var data = [];//鍒楀瓧娈垫暟鎹�
var col = [];
- var titleData=[]
+ var titleData = []
var totalArray = ["鏁伴噺", "鍏宠仈鏁伴噺", "鏈叧鑱旀暟閲�", "鎵撳嵃鏉$爜鏁伴噺", "鏈墦鍗版潯鐮佹暟閲�", "瀹炴敹鏁伴噺", "閲戦"];
//缁欑┖鐨勬暟缁勮祴鍊�
for (var key in data1.list) {
@@ -629,15 +987,15 @@
}
}
}
- option.cols = [col]
- option.data = data1.data;
+ option2.cols = [col]
+ option2.data = data1.data;
-
+
//鍒锋柊琛ㄦ牸鏁版嵁
- DisPlay_HideColumn(HModName, sessionStorage["HUserName"], option, []);
+ DisPlay_HideColumn(HModName2, sessionStorage["HUserName"], option2, []);
- table.render(option);
+ table.render(option2);
layer.close(ajaxLoad);
//layer.alert("鏌ヨ鎴愬姛", { icon: 1 });
} else {
@@ -782,21 +1140,74 @@
})
}
+ //琛ㄦ牸琛屽唴浜嬩欢鍒犻櫎
+ function set_GridDelete(obj) {
+ var data = obj.data;
+ var rowIndex = $(obj.tr).attr("data-index");
+ if (obj.event === 'del') {
+ layer.confirm('鐪熺殑鍒犻櫎琛屽悧锛�', function (index) {
+
+ var wait = layer.load();
+ //鍒犻櫎涓存椂琛ㄦ暟鎹�
+ $.ajax({
+ url: GetWEBURL() + 'Deltet_Sc_AssemblyBill_BindBarCodeTemp',
+ type: "GET",
+ data: { "HBillNo": $("#HBillNo").val(), "HBarCode": option.data[rowIndex].HBarCode, "user": sessionStorage["HUserName"] },
+ success: function (result) {
+ if (result.count == 1) {
+ layer.msg(result.Message, { icon: 1, time: 500 }, function () {
+ //鍏抽棴褰撳墠frame
+ layer.close(wait);
+ });
+ } else {
+ layer.alert(result.code + result.Message, { icon: 5 });
+ layer.close(wait);
+ }
+ }, error: function () {
+ layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+ layer.close(wait);
+ }
+ });
+
+
+ //鍒锋柊琛ㄦ牸鏁版嵁
+ option.data[rowIndex].HBarCode = "";
+ option.data[rowIndex].HBindingQty = 0;
+ //option.data[rowIndex].HMaterID = 0;
+ option.data[rowIndex].HMaterNumber = "";
+ option.data[rowIndex].HMaterName = "";
+ option.data[rowIndex].HMaterModel = "";
+ option.data[rowIndex].HBarCode = "";
+
+ table.render(option);
+ layer.close(index);
+ });
+ }
+ }
//闈炵┖楠岃瘉
function AllowLoadData() {
- var HBarCode = $("#HBarCode_P").val();
+ var HBarCode = $("#HBarCode_SN").val();
if (HBarCode == "") {
layer.msg(get_MessageError("[0000-2-019]浜у搧SN涓嶈兘涓虹┖!", sessionStorage["HTranSlate"]))
return false;
}
+ var sSubStr = JSON.stringify(table.cache['mainTable']);
- var HEmpID2 = $("#HEmpID2").val();
- if (HEmpID2 == 0) {
- layer.msg(get_MessageError("[0000-2-030]鎿嶄綔鍛樹笉鑳戒负绌�!", sessionStorage["HTranSlate"]))
- return false;
+ if (typeof (sSubStr) != "undefined" && typeof (sSubStr) != "") {
+ sSubStr = JSON.parse(sSubStr);
+ for (var i = 0; i < sSubStr.length; i++) {
+ if (sSubStr[i].HBarCode == "" || sSubStr[i].HBarCode == undefined || sSubStr[i].HBarCode == null) {
+ layer.msg("缁戝畾淇℃伅绗�" + (i + 1) + "琛�,閰嶄欢鐮佹湭缁戝畾!", { icon: 5, btn: ['纭'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
+ }
+ }
+ } else {
+ layer.msg("閰嶄欢缁戝畾淇℃伅涓嶅厑璁镐负绌�!", { icon: 5, btn: ['纭'], time: 4000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+ return Result = false;
}
+
//var HBadReasonID = $("#HBadReasonID").val();
//if (HBadReasonID == 0) {
@@ -806,6 +1217,56 @@
return true;
}
+ //鍒犻櫎鍗曟嵁
+ function btn_Delete() {
+ var checkStatus = table.checkStatus('mainTable2')
+ , data = checkStatus.data;
+ if (checkStatus.data.length === 1) {
+ layer.confirm(get_MessageError('[0000-1-003]纭畾鍒犻櫎' + data[0].鍗曟嵁鍙� + '鍚楋紵', sessionStorage["HTranSlate"]), function (index) {
+ var ajaxLoad = layer.load();
+ //閫昏緫鍒犻櫎鏂规硶
+ $.ajax({
+ url: GetWEBURL() + '/Cj_StationOutBill/del_StationOutBillandAssemblyBill',
+ type: "GET",
+ data: { "HInterID": data[0].hmainid, "HBarCode_P": data[0].闀洉SN鐮�, "HDeleteMan": sessionStorage["HUserName"], "HBillSubType": "3791" },
+ success: function (result) {
+ if (result.count == 1) {
+ get_Display();
+ layer.close(ajaxLoad);
+ } else {
+ layer.close(ajaxLoad);
+ layer.alert(get_MessageError(result.Message, sessionStorage["HTranSlate"]) + result.Message, { icon: 5 });
+ }
+ }, error: function () {
+ layer.close(ajaxLoad);
+ layer.alert(get_MessageError("[0000-1-002]鎺ュ彛璇锋眰澶辫触!", sessionStorage["HTranSlate"]), { icon: 5 });
+ }
+ });
+ layer.close(index);
+ });
+ } else {
+ layer.msg(get_MessageError('[0000-1-001]璇烽�夋嫨涓�琛屾暟鎹紪杈戯紒', sessionStorage["HTranSlate"]));
+ }
+ }
+
+ //鍒ゆ柇鏄惁缁戝畾瀹�
+ 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