<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>工序单品过站平台(彩盒SN打印生成)</title>
|
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
|
<script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../layuiadmin/Scripts/json2.js"></script>
|
<script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
|
<script src="../../../layuiadmin/Scripts/webConfig.js"></script>
|
<!--<script src="../../../layuiadmin/PubCustom.js"></script>-->
|
<script src="../../CreateControl.js"></script>
|
<script src="../../../layuiadmin/MESLanguage.js"></script>
|
<script src="../../../layuiadmin/SetColumn.js"></script>
|
<script src="../../../layuiadmin/PubCustom.js"></script>
|
<script src="../../../layuiadmin/grwebapp.js"></script>
|
</head>
|
<body>
|
<div class="layui-fluid" style="padding: 0;">
|
<div class="layui-card" style="padding: 2px;background-color: #efefef;">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" action="" lay-filter="formData" style="background-color:white;">
|
<div style="padding: 10px;">
|
<h1 style="text-align: center; padding: 10px 0;"><b>彩盒SN打印过站平台</b></h1>
|
</div>
|
<div class="layui-tab" style="width: 100%; float: left; background-color:white;">
|
<div class="layui-row">
|
<div class="layui-input-block" style="display: inline-block; margin-left: 0px; float: left">
|
<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:right" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">退出</button>
|
|
|
|
</div>
|
|
|
</div>
|
<div class="layui-tab layui-tab-card" style="float: left; background-color: white;height:200px;width:100%">
|
<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>
|
</ul>
|
<div class="layui-tab-content" style="">
|
<!--基本信息-->
|
<div class="layui-tab-item layui-show">
|
<div class="layui-form-item" style="padding-top: 10px;">
|
|
<div class="layui-row">
|
<!--<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="HBarCode_BatchSec" lay-verify="HBarCode_BatchSec" id="HBarCode_BatchSec" 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="HBatchNo" lay-verify="HBatchNo" id="HBatchNo" 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="HSupName" lay-verify="HSupName" id="HSupName" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" class="layui-input" lay-verify="HSupID" name="HSupID" id="HSupID">
|
</div>
|
</div>-->
|
|
</div>
|
<div class="layui-row">
|
<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="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(共四位前两位代表年份后两位代表月份)">
|
</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"
|
lay-verify="HPrintTemplate">
|
<!--动态渲染组织-->
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;" id="BT_HProcExchBillNo">工序流转卡</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HProcExchBillNo" lay-verify="HProcExchBillNo" id="HProcExchBillNo" value="" style="background-color:#efefef4d;">
|
<input type="hidden" class="layui-input" name="HProcExchInterID" lay-verify="HProcExchInterID" id="HProcExchInterID" value="0">
|
<input type="hidden" class="layui-input" name="HProcExchEntryID" lay-verify="HProcExchEntryID" id="HProcExchEntryID" value="0">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;" id="BT_HICMOBillNo">生产订单</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HICMOBillNo" lay-verify="HICMOBillNo" id="HICMOBillNo" value="" style="background-color:#efefef4d;">
|
<input type="hidden" class="layui-input" name="HICMOInterID" lay-verify="HICMOInterID" id="HICMOInterID" value="0">
|
<input type="hidden" class="layui-input" name="HICMOEntryID" lay-verify="HICMOEntryID" id="HICMOEntryID" value="0">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;" id="BT_HProcName">工序</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" name="HProcName" lay-verify="HProcName" id="HProcName" style="background-color: #efefef4d; width: 60%; display: inline-block;" readonly>
|
<input type="hidden" name="HProcID" id="HProcID" lay-verify="HProcID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHProc" id="btnHProc" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;" id="BT_HMaterNumber">产品编码</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" class="layui-input" lay-verify="HMaterID" name="HMaterID" id="HMaterID">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;" id="BT_HMaterName">产品名称</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HMaterName" name="HMaterName" id="HMaterName" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;" id="BT_HMaterModel">规格型号</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" lay-verify="HMaterModel" name="HMaterModel" id="HMaterModel" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
|
</div>
|
<div class="layui-row">
|
|
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HDeptName">当前车间</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HDeptName" name="HDeptName" id="HDeptName" style="background-color: #efefef4d; width: 60%; display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" lay-verify="HDeptID" name="HDeptID" id="HDeptID">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHDept" id="btnHDept" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;" id="BT_HEmpName">操作员</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HEmpName" name="HEmpName" id="HEmpName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" lay-verify="HEmpID" name="HEmpID" id="HEmpID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHEmp" id="btnHEmp" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HGroupName">生产班组</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" name="HGroupName" id="HGroupName" lay-verify="HGroupName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" name="HGroupID" lay-verify="HGroupID" id="HGroupID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHGroup" id="btnHGroup" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px; padding: 9px 18px;" id="BT_HSourceName">生产资源</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" name="HSourceName" id="HSourceName" lay-verify="HSourceName" value="" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" name="HSourceID" lay-verify="HSourceID" id="HSourceID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHSource" id="btnHSource" style="padding: 0 10px;float: right;margin-right: 3px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
|
</div>
|
<div class="layui-row">
|
|
</div>
|
<div class="layui-row">
|
|
|
</div>
|
</div>
|
</div>
|
<!--其他信息-->
|
<div class="layui-tab-item">
|
<div class="layui-form-item" style="padding-top: 10px;">
|
<div class="layui-row">
|
<div class="layui-inline">
|
<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="HMaker" id="HMaker" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<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="HMakeDate" id="HMakeDate" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div class="layui-tab layui-tab-card" style=" float: left;width:100%">
|
<ul class="layui-tab-title">
|
<li class="layui-this">历史过站清单</li>
|
</ul>
|
<label class="layui-form-label" style="color: red; font-size: 24px; width:auto;position:absolute;left:300px;margin-top:-40px" id="HReturnMessage">成功扫码:</label>
|
<div class="layui-tab-content" style="background-color: white;">
|
|
<div class="layui-tab-item layui-show">
|
<table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
|
</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>解绑</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>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="refresh" id="refresh"><i class="layui-icon layui-icon-form"></i>刷新</button>
|
</div>
|
</script>
|
|
</form>
|
</div>
|
</div>
|
</div>
|
</body>
|
</html>
|
<script>
|
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'table', 'element'], function () {
|
|
//#region 公共变量
|
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element;
|
|
//定义全局变量
|
|
var HModName = "Cj_ProcessItemStationPlatform_generateSN";
|
//var HModName2 = "Cj_ProcessItemStationPlatform_batch2";
|
var option = [];
|
var previousHBarCode = "";
|
//var option2 = [];
|
//#endregion
|
|
//#region 进入页面即加载
|
var params = get_UrlVars();
|
set_ClearBill();
|
|
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
|
form.on('select(HPrintTemplate)', function (data) {
|
// 2. 获取选中的值
|
const selectedValue = data.value;
|
|
// 3. 保存到 localStorage(键名为 "BlueToothselectedTemplate")
|
localStorage.setItem('SNselectedTemplate', selectedValue);
|
|
// 如果需要会话级存储(浏览器关闭后清除),改用 sessionStorage:
|
// sessionStorage.setItem('selectedTemplate', selectedValue);
|
|
console.log('已保存选择的模板:', selectedValue);
|
});
|
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
switch (obj.event) {
|
//删除按钮
|
case 'btn-Delete': btn_Delete();
|
break;
|
//列设置
|
case 'set_HideColumn': get_HideColumnNoPage(HModName, sessionStorage["HUserName"], option, get_Display);
|
break;
|
//刷新
|
case 'refresh': get_Display();
|
break;
|
};
|
});
|
table.on('toolbar(mainTable2)', function (obj) {
|
switch (obj.event) {
|
//删除按钮
|
case 'btn-Delete2': set_DeleteBill2();
|
break;
|
//列设置
|
case 'set_HideColumn2': get_HideColumnNoPage(HModName2, sessionStorage["HUserName"], option2, get_Display);
|
break;
|
};
|
});
|
|
//镭雕码回车方法
|
$('#HBarCode_SN').on('keydown', function (event) {
|
var HBarCode = $('#HBardCodeProcExchBillNo').val();
|
if (event.keyCode == 13) {
|
var HBarCode = $('#HBarCode_SN').val();
|
if (event.keyCode == 13) {
|
|
if (!checkHSNAndDate(HBarCode)) {
|
return
|
}
|
//如果镭雕码不为空
|
if (HBarCode) {
|
txtHBarCode_KeyDown(HBarCode);
|
//txtHBarCodeSN_KeyDown(HBarCode);
|
}
|
|
}
|
|
|
}
|
});
|
|
//选择操作员
|
form.on('submit(btnHEmp)', function () {
|
btnHEmp();
|
});
|
|
|
//选择生产资源
|
form.on('submit(btnHSource)', function () {
|
btnHSource();
|
});
|
|
//选择生产班组按钮
|
form.on('submit(btnHGroup)', function () {
|
btnHGroup();
|
});
|
|
//选择生产车间按钮
|
form.on('submit(btnHDept)', function () {
|
btnHDept();
|
});
|
|
//选择工序按钮
|
form.on('submit(btnHProc)', function () {
|
btnHProc();
|
});
|
|
|
//退出
|
form.on('submit(btnExit)', function (data) {
|
if (params[1] != null) {
|
Pub_Close(1);
|
} else if (params[1] == null) {
|
Pub_Close(2);
|
}
|
});
|
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
//#region 获取打印模板
|
function getTem() {
|
//获取登录页组织列
|
$.ajax({
|
type: "get",
|
async: false,
|
url: GetWEBURL() + "/Open_PrintTem/GetOpenTmpList_Json",
|
data: { "HNumber": "HGy_BarCodeBill" },
|
success: function (result) {
|
var template = "";
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
template += '<option style="color:blue;" value="' + data[i].HName + '">' + data[i].HName + '</option>';
|
}
|
$("#HPrintTemplate").append(template);
|
$("#HPrintTemplate").val(localStorage.getItem('SNselectedTemplate'))
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
//#endregion
|
|
//初始化界面
|
function set_ClearBill() {
|
//进入页面默认光标在流转卡上
|
$("#HBarCode_SN").focus();
|
//制单人
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd"));
|
//通过登录用户获取默认值
|
GetDefValByUser();
|
//初始化表格
|
set_InitGrid();
|
//
|
get_Display();
|
|
getTem();
|
}
|
|
//#region 通过登录用户获取默认值
|
function GetDefValByUser() {
|
var index = layer.load();
|
$.ajax({
|
url: GetWEBURL() + "/Cj_StationInBill/GetDefValByUser",
|
type: "GET",
|
async: false,
|
data: { "Czybm": sessionStorage["Czybm"], "Czymc": sessionStorage["HUserName"] },
|
success: function (result) {
|
var data = result.data[0];
|
|
form.val("formData", {
|
"HSourceID": data.HSourceID,
|
"HSourceName": data.生产资源名称,
|
"HGroupID": data.HGroupID,
|
"HGroupName": data.生产班组名称,
|
"HEmpID": data.HEmpID,
|
"HEmpName": data.操作员名称,
|
"HDeptID": data.HDeptID,
|
"HDeptName": data.部门名称,
|
"HProcNumber": data.工序代码,
|
"HProcName": data.工序名称,
|
"HProcID": data.HProcID
|
});
|
layer.close(index);
|
}
|
, error: function () {
|
layer.close(index);
|
layer.alert(get_MessageError("[0000-1-002]接口请求失败!", sessionStorage["HTranSlate"]), { icon: 5 });
|
}
|
})
|
}
|
//#endregion
|
|
//关键件清单
|
function set_InitGrid() {
|
option= {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, page: false
|
, totalRow: true
|
, cellMinWidth: 120
|
, data: []
|
, height: 550
|
, limit: 10
|
, cols: [[
|
{ type: 'numbers', title: '序号' }
|
, { field: '日期', title: '日期' }
|
, { field: '配件代码', title: '配件代码' }
|
, { 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 }
|
, { field: 'HMaterID', title: 'HMaterID', hide: true }
|
, { field: 'HBarCode', title: 'HBarCode', hide: true }
|
]]
|
}
|
|
table.render(option);
|
|
}
|
|
//条码回车查询
|
function txtHBarCode_KeyDown(HBarCode) {
|
|
var indexs = layer.load();
|
$.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);
|
$("#HBarCode_SN").val(HBarCode);
|
$("#HSNNo").val(HBarCode);
|
|
$("#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"])
|
$("#HICMOBillNo").val(data1.data[0]["HSourceBillNo"])
|
|
txtHBarCodeSN_KeyDown(HBarCode);
|
}
|
else {
|
layer.close(indexs);
|
$("#HBarCode_SN").val("");
|
$("#HBarCode_SN").focus();
|
layer.msg(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"]) });
|
}
|
});
|
}
|
/**
|
* 扫彩盒SN码
|
* @param HBarCode
|
*/
|
//镭雕码回车查询
|
function txtHBarCodeSN_KeyDown(HBarCode) {
|
|
var data = {
|
"field": {
|
"HProcID": $("#HProcID").val(), "HBatchNo": "",
|
"HGroupID": $("#HGroupID").val(), "HSourceID": $("#HSourceID").val(),
|
"HPRDOrgID": sessionStorage["OrganizationID"],
|
"HEmpID": $("#HEmpID").val(), "HDeptID": $("#HDeptID").val()
|
}
|
};
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = HBarCode;
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
|
var indexs = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Cj_SingleStation/AddStationOutBillList",
|
async: false,
|
data: { "sMainSub": sMainSub },
|
dataType: "json",
|
success: function (data1) {
|
if (data1.count == 1) {
|
layer.close(indexs);
|
//光标在镭雕码上
|
$("#HBarCode_SN").val("");
|
$("#HBarCode_SN").focus();
|
|
$("#HReturnMessage").text("成功扫码一个:" + HBarCode);
|
//自动打印
|
dy_PL(HBarCode);
|
get_Display();
|
}
|
else {
|
$("#HBarCode_SN").val("");
|
layer.close(indexs);
|
layer.msg(data1.Message, { icon: 5, btn: ["确认"], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "出现错误" });
|
}
|
|
},
|
error: function (err) {
|
$("#HBarCode_SN").val("");
|
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"]) });
|
}
|
});
|
}
|
|
//批量打印
|
function dy_PL(HBarCode) {
|
var sWhere = "select Top 1 * from h_v_IF_BarCodeBillList with(nolock) where 条码编号 = '" + HBarCode + "'"
|
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Gy_SOPBillList/WindowPrintList", //方法所在页面和方法名
|
async: false,
|
data: { "sWhere": sWhere },
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了,
|
|
if (data.data.length != 0) {
|
|
|
var Customer = {
|
"Table": data.data
|
}
|
|
var args = {
|
type: "print",//打印模式
|
//type: "preview",//预览模式
|
showOptionDlg: false, //如果不显示打印对话框而直接打印,将此行注释去掉即可
|
report: urlAddRandomNo("../../grf/" + $("#HPrintTemplate").val()+".grf"),
|
data: Customer
|
};
|
|
console.log(data.data[0].条码编号);
|
//var args = {
|
// report: urlAddRandomNo("../../grf/cs10.grf"),
|
// data: Customer
|
//};
|
webapp_ws_ajax_run(args);
|
|
} else {
|
layer.msg("查无数据!");
|
}
|
}
|
else {
|
layer.msg(data.Message, { icon: 5 });
|
}
|
layer.closeAll("loading");
|
},
|
error: function (err) {
|
layer.msg("错误:" + err, { icon: 5 });
|
}
|
})
|
|
}
|
|
//校验 产品和年月
|
function checkHSNAndDate(HBarCode) {
|
// 1. 校验HBarCode长度
|
if (!HBarCode || HBarCode.length < 20) {
|
layer.confirm("HBarCode长度不足20位");
|
return false;
|
}
|
|
// 2. 解析HBarCode的年月日
|
const yearLastDigit = HBarCode[12]; // 第13位(索引12),年份最后一位
|
const monthCode = HBarCode[13].toUpperCase(); // 第14位,月份(N-Z)
|
|
|
// 计算年份(假设当前世纪,如2020-2029)
|
|
const year = yearLastDigit;
|
|
// 计算月份(N=1, ..., Z=12)
|
const validChars = "NPQRSTUVWXYZ";
|
if (!validChars.includes(monthCode)) {
|
layer.confirm("字符必须是 N, P-Z 之一(跳过 O)");
|
return false;
|
}
|
|
// 计算月份:N=1, P=2, ..., Z=12
|
const month = validChars.indexOf(monthCode) + 1;
|
|
|
// 3. 获取输入框的年月(格式NNMM,如2307表示2023年7月)
|
const checkDateInput = document.getElementById("HCheckDate");
|
if (!checkDateInput) {
|
layer.confirm("找不到HCheckDate输入框");
|
return false;
|
}
|
const inputValue = checkDateInput.value.trim();
|
if (!/^\d{4}$/.test(inputValue)) {
|
layer.confirm("输入框格式错误(必须是NNMM,如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": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = [];//列字段数据
|
var col = [];
|
var titleData = []
|
var totalArray = ["数量", "关联数量", "未关联数量", "打印条码数量", "未打印条码数量", "实收数量", "金额"];
|
//给空的数组赋值
|
for (var key in data1.list) {
|
data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
|
}
|
//在列表左边添加勾选框
|
col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
|
for (var i = 0; i < data.length; i++) {
|
// if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
|
if ($.inArray(data[i].name, titleData) > -1) {
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
|
}
|
else if ($.inArray(data[i].name, totalArray) > -1) { //计算列
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
|
} else if (data[i].name == '单据号') {//添加超链接
|
col.push({
|
field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '单据号', templet: function (d) {
|
return '<span style="color: blue;">' + d.单据号 + '</span>'
|
}, style: 'cursor: pointer;'
|
});
|
} else if (data[i].name == '当前审核项目') {//添加超链接
|
col.push({
|
field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200, event: '当前审核项目', templet: function (d) {
|
return '<span style="color: blue;">' + d.当前审核项目 + '</span>'
|
}, style: 'cursor: pointer;'
|
});
|
} else {
|
switch (data[i].Type) {
|
//int
|
case 'DateTime':
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + (data[i].name == "行关闭日期" ? "行关闭人" : data[i].name) + " ==''?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 200 });
|
break;
|
default:
|
col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
|
}
|
}
|
}
|
option.cols = [col]
|
option.data = data1.data;
|
|
|
|
//刷新表格数据
|
DisPlay_HideColumn(HModName, sessionStorage["HUserName"], option, []);
|
|
table.render(option);
|
layer.close(ajaxLoad);
|
//layer.alert("查询成功", { icon: 1 });
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//删除单据
|
function btn_Delete() {
|
var checkStatus = table.checkStatus('mainTable')
|
, 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_StationOutBill',
|
type: "GET",
|
data: { "HInterID": data[0].hmainid, "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 btnHEmp() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '质检员列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HEmp', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg(get_MessageError('[0000-1-020]请选择数据', sessionStorage["HTranSlate"]));
|
}
|
//获取数据
|
$("#HEmpID").val(checkStatus.data[0].HItemID);
|
$("#HEmpName").val(checkStatus.data[0].职员名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
})
|
}
|
|
|
//生产资源选择页面
|
function btnHSource() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '生产资源列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/生产基础资料/Gy_Source.html', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length === 0) {
|
return layer.msg(get_MessageError('[0000-1-020]请选择数据', sessionStorage["HTranSlate"]));
|
}
|
//获取数据
|
$("#HSourceID").val(checkStatus.data[0].HItemID);
|
$("#HSourceName").val(checkStatus.data[0].生产资源名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//生产班组选择页面
|
function btnHGroup() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '班组表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/工资基础资料/Gy_Group.html?Type=HGroup', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length != 1) {
|
return layer.msg(get_MessageError('[0000-1-020]请选择数据', sessionStorage["HTranSlate"]));
|
}
|
//获取数据
|
$("#HGroupID").val(checkStatus.data[0].HItemID);//班组id
|
$("#HGroupName").val(checkStatus.data[0].班组名称);//计量单位名称
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//生产车间选择页面
|
function btnHDept() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '生产车间列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length != 1) {
|
return layer.msg(get_MessageError('[0000-1-020]请选择数据', sessionStorage["HTranSlate"]));
|
}
|
//获取数据
|
$("#HDeptID").val(checkStatus.data[0].HItemID);//
|
$("#HDeptName").val(checkStatus.data[0].部门名称);//
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//工序选择页面
|
function btnHProc() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '工序列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/生产基础资料/Gy_Process.html', 'yes']
|
, btn: ['确定', '取消']
|
, btn1: function (index, layero) {//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
|
if (checkStatus.data.length != 1) {
|
return layer.msg(get_MessageError('[0000-1-020]请选择数据', sessionStorage["HTranSlate"]));
|
}
|
//获取数据
|
$("#HProcID").val(checkStatus.data[0].HItemID);//
|
$("#HProcNumber").val(checkStatus.data[0].工序代码);
|
$("#HProcName").val(checkStatus.data[0].工序名称);//
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
|
//非空验证
|
function AllowLoadData() {
|
|
var HBarCode = $("#HBarCode_P").val();
|
if (HBarCode == "") {
|
layer.msg(get_MessageError("[0000-2-019]产品SN不能为空!", sessionStorage["HTranSlate"]))
|
return false;
|
}
|
|
var HEmpID2 = $("#HEmpID2").val();
|
if (HEmpID2 == 0) {
|
layer.msg(get_MessageError("[0000-2-030]操作员不能为空!", sessionStorage["HTranSlate"]))
|
return false;
|
}
|
|
//var HBadReasonID = $("#HBadReasonID").val();
|
//if (HBadReasonID == 0) {
|
// layer.msg("不良原因不能为空!")
|
// return false;
|
//}
|
return true;
|
}
|
|
//#endregion
|
|
});
|
function GetHEmpValue(obj) //返回职员
|
{
|
$("#HEmpName").val(obj[0].职员名称);
|
$("#HEmpID").val(obj[0].HItemID);
|
|
}
|
function GetHDeptNameValue(obj) //返回部门
|
{
|
$("#HDeptName").val(obj[0].部门名称);
|
$("#HDeptID").val(obj[0].HItemID);
|
}
|
function GetHGroupValue(obj) //返回班组
|
{
|
$("#HGroupName").val(obj[0].班组名称);
|
$("#GroupID").val(obj[0].HItemID);
|
}
|
function GetProcessValue(obj) //返回工序
|
{
|
$("#HProcNumber").val(obj[0].工序代码);
|
$("#HProcName").val(obj[0].工序名称);//
|
$("#HProcID").val(obj[0].HItemID);
|
}
|
function GetGySource(obj) //返回生产资源
|
{
|
$("#HSourceName").val(obj[0].生产资源名称);
|
$("#HSourceID").val(obj[0].HItemID);
|
}
|
</script>
|