<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>关键件绑定</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>
|
</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;">
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnRefresh" id="btnRefresh">刷新</button>
|
<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnExit" id="btnExit">退出</button>
|
</div>
|
<h1 style="text-align:center;margin-bottom:25px;"><b>关键件绑定</b></h1>
|
<div class="layui-form-item" style="padding-top: 3px;">
|
<div class="layui-row" style="text-align: center;">
|
<div class="layui-col-xs3 layui-inline" style="margin-left:140px;">
|
<label class="layui-form-label">流转卡</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HProcessExchangeBillNo" id="HProcessExchangeBillNo" style="width: 300px;" onfocus="this.select();">
|
<input type="hidden" name="HProcessExchangeInterID" id="HProcessExchangeInterID" value="0">
|
<input type="hidden" name="HProcessExchangeEntryID" id="HProcessExchangeEntryID" value="0">
|
</div>
|
</div>
|
<div class="layui-col-xs3 layui-inline">
|
<label class="layui-form-label">产品码</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HBarCode_P" id="HBarCode_P" style="width: 300px;" onfocus="this.select();">
|
</div>
|
</div>
|
<button class="layui-btn layui-btn-normal" style="float:left;margin-left:-15px;" type="button" lay-submit="" lay-filter="btnNextProc" id="btnNextProc">换产品</button>
|
<div class="layui-col-xs3 layui-inline">
|
<label class="layui-form-label">配件码</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HBarCode" id="HBarCode" style="width: 300px;" onfocus="this.select();">
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill" style="width: 45%; float: left; height:calc(43vh);background-color:white;">
|
<div class="layui-tab-content">
|
<!--基本信息-->
|
<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;">日期</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="date" class="layui-input" lay-verify="HDate" name="HDate" id="HDate" style="padding-left: 80px;width:184px;">
|
</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="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#EDEDED;" readonly>
|
<input type="hidden" name="HInterID" id="HInterID" lay-verify="HInterID">
|
</div>
|
</div>
|
</div>
|
<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="HICMOBillNo" lay-verify="HICMOBillNo" id="HICMOBillNo" style=" background-color: #EDEDED;" readonly>
|
<input type="hidden" name="HICMOInterID" id="HICMOInterID" lay-verify="HICMOInterID">
|
<input type="hidden" name="HICMOEntryID" id="HICMOEntryID" lay-verify="HICMOEntryID">
|
</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="HSeOrderBillNo" lay-verify="HSeOrderBillNo" id="HSeOrderBillNo" style=" background-color: #EDEDED;" readonly>
|
<input type="hidden" name="HSeOrderInterID" id="HSeOrderInterID" lay-verify="HSeOrderInterID">
|
<input type="hidden" name="HSeOrderEntryID" id="HSeOrderEntryID" lay-verify="HSeOrderEntryID">
|
</div>
|
</div>
|
</div>
|
<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="HMaterNumber" lay-verify="HMaterNumber" id="HMaterNumber" style=" background-color: #EDEDED;" readonly>
|
<input type="hidden" name="HMaterID" id="HMaterID" lay-verify="HMaterID">
|
</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="HMaterName" lay-verify="HMaterName" id="HMaterName" style=" background-color: #EDEDED;" readonly>
|
</div>
|
</div>
|
</div>
|
<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="HMaterModel" lay-verify="HMaterModel" id="HMaterModel" style=" background-color: #EDEDED;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">生产资源</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" name="HSourceName" lay-verify="HSourceName" id="HSourceName" style="background-color: #EDEDED; width: 60%; display: inline-block;" readonly>
|
<input type="hidden" name="HSourceID" id="HSourceID" lay-verify="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 class="layui-inline">
|
<label class="layui-form-label" style="width: 85px; padding: 9px 18px;">生产车间</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: #EDEDED; 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;">生产班组</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:#EDEDED;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>
|
<div class="layui-row">
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">操作员</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:#EDEDED;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;">质检员</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" lay-verify="HCheckEmpName" name="HCheckEmpName" id="HCheckEmpName" value="" style="background-color:#EDEDED;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" lay-verify="HCheckEmpID" name="HCheckEmpID" id="HCheckEmpID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHCheckEmp" id="btnHCheckEmp" 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 class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;padding: 9px 18px;">工序</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: #EDEDED; 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;">工序号</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="HProcNo" lay-verify="HProcNo" id="HProcNo">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div style="width: 0.2%; float: left; height: calc(43vh);background-color:#2baaca"></div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill" style="width: 54.8%; float: left; height:calc(43vh);background-color:white;">
|
<div style="width:100px;height:23px; background: linear-gradient(-135deg, transparent 30px, #2baaca 0);"><span style="color:aliceblue;">绑定信息</span></div>
|
<table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
|
</div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill" style="width: 99.8%; float: left; height:calc(100vh);background-color:white;margin-left:0.2%">
|
<div style="width:100%;height:23px; background-color: #2baaca;text-align:center;font-weight:bold"><span style="color:aliceblue;">历史记录</span></div>
|
<table class="layui-hide" id="detailTable" lay-filter="detailTable"></table>
|
</div>
|
</form>
|
</div>
|
</div>
|
</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({
|
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 = "Sc_KeyElementBinding";
|
var option = [];
|
var option_detail = [];
|
var setIntervalIndex = null;
|
//#endregion
|
|
//#region 进入页面即加载
|
set_ClearBill();
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
//#region 流转卡回车方法
|
$('#HProcessExchangeBillNo').on('keydown', function (event) {
|
var HBarCode = $('#HProcessExchangeBillNo').val();
|
if (event.keyCode == 13) {
|
if (!HBarCode) {
|
layer.msg("流转卡不能为空!")
|
return;
|
}
|
//查询流转卡相关信息
|
get_ProcessExchangeList(HBarCode);
|
}
|
});
|
//#endregion
|
|
//#region 产品码回车方法
|
$('#HBarCode_P').on('keydown', function (event) {
|
var HBarCode = $('#HBarCode_P').val();
|
var HProcessExchangeBillNo = $('#HProcessExchangeBillNo').val();
|
if (event.keyCode == 13) {
|
if (!HProcessExchangeBillNo) {
|
layer.msg("请先扫流转卡!")
|
return;
|
} else {
|
if (!HBarCode) {
|
layer.msg("条形码不能为空!")
|
return;
|
} else {
|
//if (HBarCode.match(/[^\x00-\xff]/g) != null) {
|
// layer.alert("必须是半角字符!", { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
|
// return;
|
//}
|
}
|
}
|
txtHProductBarCode_KeyDown(HBarCode);
|
}
|
});
|
//#endregion
|
|
//#region 配件回车方法
|
$('#HBarCode').on('keydown', function (event) {
|
var HBarCode = $('#HBarCode').val();
|
var HProcessExchangeBillNo = $('#HProcessExchangeBillNo').val();
|
var HBarCode_P = $('#HBarCode_P').val();
|
if (event.keyCode == 13) {
|
if (!HProcessExchangeBillNo || !HBarCode_P) {
|
layer.msg("请先扫流转卡或产品码!")
|
return;
|
} else {
|
if (!HBarCode) {
|
layer.msg("配件不能为空!")
|
return;
|
}
|
}
|
txtHPartsBarCode_KeyDown(HBarCode);
|
}
|
});
|
//#endregion
|
|
//绑定信息行内事件
|
table.on('tool(mainTable)', function (obj) {
|
set_GridDelete(obj); //行内删除
|
});
|
|
//#region 基础资料按钮
|
//选择质检员
|
form.on('submit(btnHCheckEmp)', function () {
|
btnHCheckEmp();
|
});
|
|
//选择操作员
|
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();
|
});
|
//#endregion
|
|
//保存
|
form.on('submit(btnSave)', function (data) {
|
if (AllowLoadData(data)) {
|
set_SaveBill(data);
|
}
|
});
|
|
//换产品
|
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_P").removeAttr("disabled"); //产品码文本框启用
|
$("#HBarCode_P").css('background', '#FFFFFF')//产品码文本框背景色恢复
|
//清空文本框内容
|
$("#HBarCode_P").val("");//产品码文本框内容清空
|
//光标跳转到产品码文本框上
|
$("#HBarCode_P").focus();
|
//把每个产品的扫码绑定记录迁移到下方历史记录明细网格
|
for (var i = 0; i < option.data.length; i++) {
|
option_detail.data.push(option.data[i])
|
}
|
table.render(option_detail);
|
//清除绑定信息网格扫码记录
|
option.data = [];
|
table.render(option);
|
|
//重新获取单据号
|
$.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();
|
});
|
|
//刷新按钮
|
form.on('submit(btnRefresh)', function () {
|
layer.confirm('刷新后页面数据将消失,是否确认刷新?', { icon: 3, title: '提示' }, function (index) {
|
location.replace('Sc_KeyElementBinding.html');
|
});
|
})
|
|
//退出
|
form.on('submit(btnExit)', function (data) {
|
Pub_Close(2);
|
});
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
//#region 初始化界面
|
function set_ClearBill() {
|
//进入页面默认光标在流转卡上
|
$("#HProcessExchangeBillNo").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")); //默认为当前日期
|
}
|
});
|
|
//#region 基础资料信息根据用户绑定带出
|
$("#HSourceID").val(sessionStorage["HSourceID"]);//生产资源ID
|
$("#HSourceName").val(sessionStorage["HSource"]);//生产资源
|
//$("#HDeptID").val(sessionStorage["HDeptID"]);//生产车间ID
|
//$("#HDeptName").val(sessionStorage["HDept"]);//生产车间
|
$("#HGroupID").val(sessionStorage["HGroupID"]);//班组ID
|
$("#HGroupName").val(sessionStorage["HGroup"]);//班组
|
$("#HCheckEmpID").val(sessionStorage["HCheckEmpID"]);//质检员ID
|
$("#HCheckEmpName").val(sessionStorage["HCheckEmpName"]);//质检员ID
|
$("#HEmpID").val(sessionStorage["HEmpID"]);//操作员ID
|
$("#HEmpName").val(sessionStorage["HEmpName"]);//操作员
|
//#endregion
|
|
//初始化绑定信息表格
|
set_InitGrid();
|
}
|
//#endregion
|
|
//#region 初始化表格
|
function set_InitGrid() {
|
//本次绑定信息
|
option = {
|
elem: '#mainTable'
|
, page: false
|
, height: 'full-500'
|
, loading: false
|
, limit: 200
|
, 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: 'HMaterNumber', title: '物料代码', 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 }
|
]]
|
}
|
//初始表格数据
|
var rowdata = [{
|
"HBarCode_P": "", "HBarCode": "", "HPartsQty": 0, "HBindingQty": 0, "HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HMaterModel": ""
|
, "HBatchNo": "", "HSourceID": 0, "HEquipID": 0, "HGroupID": 0, "HWorkerID": 0, "HScanDate": new Date(), "HSourceInterID": 0
|
, "HSourceEntryID": 0, "HSourceBillNo": ""
|
}];
|
option.data = [];
|
table.render(option);
|
|
//历史绑定信息
|
option_detail = {
|
elem: '#detailTable'
|
, page: false
|
, height: 'full-30'
|
, loading: false
|
, limit: 2000
|
, cols: [[ //历史记录表
|
{ type: 'numbers', title: '序号', width: 50 }
|
, { field: 'HBarCode_P', title: '产品码', width: 400 }
|
, { field: 'HBarCode', title: '配件码', width: 400 }
|
, { field: 'HPartsQty', title: '配件数', width: 90 }
|
, { field: 'HBindingQty', title: '已绑数', width: 72 }
|
, { field: 'HMaterID', title: 'HMaterID', hide: true }
|
, { field: 'HMaterNumber', title: '物料代码', width: 260 }
|
, { field: 'HMaterName', title: '物料名称', width: 260 }
|
, { field: 'HMaterModel', title: '规格型号', width: 160, hide: true }
|
, { field: 'HBatchNo', title: '批次', width: 200, 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 }
|
]]
|
}
|
|
option_detail.data = [];
|
table.render(option_detail);
|
}
|
//#endregion
|
|
//#region 保存方法
|
function set_SaveBill(data) {
|
//把最后一个产品的绑定信息写入到历史记录明细网格
|
//for (var i = 0; i < option.data.length; i++) {
|
// option_detail.data.push(option.data[i])
|
//}
|
|
//序列化表头信息和子表信息
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(option.data);
|
//拼接参数
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + sessionStorage["HUserName"];
|
|
var index = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Sc_KeyElementBinding/Save", //方法所在页面和方法名
|
async: true,
|
data: { "msg": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) { // 说明验证成功了,
|
layer.msg(data.Message, { icon: 1, time: 1000 });
|
|
$("#btnSave").addClass("layui-btn-disabled").attr("disabled", true);
|
layer.close(index);
|
}
|
else {
|
layer.alert(data.Message, { icon: 5 });
|
layer.close(index);
|
}
|
},
|
error: function (err) {
|
layer.alert("错误:" + err, { icon: 5 });
|
layer.close(index);
|
}
|
});
|
}
|
//#endregion
|
|
//查询
|
function get_Display() {
|
var HBillNo = $("#HBillNo").val();
|
var ajaxLoad = layer.load();
|
//进入页面显示的缓存列表
|
$.ajax({
|
url: GetWEBURL() + '/Sc_KeyElementBinding/HistoryInfo_Temp',
|
type: "GET",
|
data: { "HBillNo": HBillNo, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
}
|
|
//流转卡回车查询(查询流转卡相关信息)
|
function get_ProcessExchangeList(HBarCode) {
|
var ajaxLoad = layer.load();
|
$.ajax({
|
url: GetWEBURL() + '/Sc_KeyElementBinding/GetProcessExchangeList',
|
async: false,
|
type: "GET",
|
data: { "HBillNo": HBarCode, "user": sessionStorage["HUserName"] },
|
success: function (data1) {
|
if (data1.count == 1) {
|
var data = data1.data;
|
|
$("#HICMOInterID").val(data[0].HICMOInterID);
|
$("#HICMOEntryID").val(data[0].HICMOEntryID);
|
$("#HICMOBillNo").val(data[0].生产订单号);
|
$("#HSeOrderBillNo").val(data[0].销售订单号);
|
$("#HMaterID").val(data[0].HMaterID);
|
$("#HMaterNumber").val(data[0].物料代码);
|
$("#HMaterName").val(data[0].物料名称);
|
$("#HMaterModel").val(data[0].规格型号);
|
$("#HDeptID").val(data[0].HDeptID);
|
$("#HDeptName").val(data[0].生产车间名称);
|
|
|
//禁用输入框,背景色变灰
|
$("#HDate").prop('disabled', true);//禁用
|
$("#HDate").css('background', '#EDEDED')//背景色变灰
|
$("#HProcessExchangeBillNo").attr('disabled', 'disabled')//禁用
|
$("#HProcessExchangeBillNo").css('background', '#EDEDED')//背景色变灰
|
$("#HProcNo").attr('disabled', 'disabled')//禁用
|
$("#HProcNo").css('background', '#EDEDED')//背景色变灰
|
//按钮禁用
|
$("#btnHSource").addClass("layui-btn-disabled").attr("disabled", true);//生产资源按钮禁用
|
$("#btnHDept").addClass("layui-btn-disabled").attr("disabled", true);//生产车间按钮禁用
|
$("#btnHGroup").addClass("layui-btn-disabled").attr("disabled", true);//生产班组按钮禁用
|
$("#btnHEmp").addClass("layui-btn-disabled").attr("disabled", true);//操作员按钮禁用
|
$("#btnHCheckEmp").addClass("layui-btn-disabled").attr("disabled", true);//质检员按钮禁用
|
$("#btnHProc").addClass("layui-btn-disabled").attr("disabled", true);//工序按钮禁用
|
|
//光标跳转至产品码输入框位置
|
$("#HBarCode_P").focus();
|
|
layer.close(ajaxLoad);
|
} else {
|
layer.close(ajaxLoad);
|
layer.alert(data1.code + data1.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(ajaxLoad);
|
layer.alert("接口请求失败!" + data1.Message, { icon: 5 });
|
}
|
});
|
}
|
|
//产品码回车查询
|
function txtHProductBarCode_KeyDown(HBarCode) {
|
var HProcExchBillNo = $("#HProcessExchangeBillNo").val();
|
var HBillNo = $("#HBillNo").val();
|
var indexs = layer.load();
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_KeyElementBinding/ProductBardCode_JX",
|
async: false,
|
data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "HBillNo": HBillNo, "user": sessionStorage["HUserName"], "HOrgID": sessionStorage["OrganizationID"] },
|
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].子项物料代码, "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);
|
|
layer.close(indexs);
|
|
//禁用输入框,背景色变灰
|
$("#HBarCode_P").attr('disabled', 'disabled')//禁用
|
$("#HBarCode_P").css('background', '#EDEDED')//背景色变灰
|
//光标跳转到配件码文本框上
|
$("#HBarCode").focus();
|
}
|
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 txtHPartsBarCode_KeyDown(HBarCode) {
|
var indexs = layer.load();
|
var HProcExchBillNo = $("#HProcessExchangeBillNo").val();
|
var HBillNo = $("#HBillNo").val();
|
$.ajax({
|
type: "GET",
|
url: GetWEBURL() + "/Sc_KeyElementBinding/PartsBardCode_JX",
|
async: false,
|
data: { "HBarCode": HBarCode, "HProcExchBillNo": HProcExchBillNo, "HBillNo": HBillNo, "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].物料代码
|
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
|
|
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").focus();
|
$("#HBarCode").val("");
|
|
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_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);
|
});
|
}
|
}
|
|
//#region 基础资料选择弹框
|
//质检员选择页面
|
function btnHCheckEmp() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '质检员列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_EmployeeList.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('请选择数据');
|
}
|
//获取数据
|
$("#HCheckEmpID").val(checkStatus.data[0].HItemID);
|
$("#HCheckEmpName").val(checkStatus.data[0].职员名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
})
|
}
|
|
//操作员选择页面
|
function btnHEmp() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '操作员列表'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_EmployeeList.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('请选择数据');
|
}
|
//获取数据
|
$("#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('请选择数据');
|
}
|
//获取数据
|
$("#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', '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('请选择一条数据');
|
}
|
//获取数据
|
$("#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('请选择一条数据');
|
}
|
//获取数据
|
$("#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('请选择一条数据');
|
}
|
//获取数据
|
$("#HProcID").val(checkStatus.data[0].HItemID);//
|
$("#HProcName").val(checkStatus.data[0].工序名称);//
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
//#endregion
|
|
//非空验证
|
function AllowLoadData() {
|
var HBarCode = $("#HBarCode_P").val();
|
if (HBarCode == "") {
|
layer.msg("产品码不能为空!")
|
return false;
|
}
|
|
var sSubStr = JSON.stringify(table.cache['mainTable']);
|
|
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;
|
}
|
|
return true;
|
}
|
//#endregion
|
});
|
</script>
|