<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8" />
|
<title>工序计划单</title>
|
<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>
|
|
<style>
|
.main-btn { /*头部主按钮*/
|
padding: 0 2px; /*调整按钮左右空隙大小*/
|
height: 30px;
|
line-height: 30px;
|
}
|
|
.btn-title {
|
font-size: 16px;
|
}
|
</style>
|
</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 layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-print layuiadmin-button-btn"><span class="btn-title">预览</span></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-add-1 layuiadmin-button-btn"><span class="btn-title">新增</span></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
|
<i class="layui-icon layui-icon-edit layuiadmin-button-btn"><span class="btn-title">修改</span></i>
|
</button>
|
<button class="layui-btn layuiadmin-btn-order main-btn" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">
|
<i class="layui-icon layui-icon-delete layuiadmin-button-btn"><span class="btn-title">保存</span></i>
|
</button>
|
</div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill">
|
<ul class="layui-tab-title" lay-filter="tab-all">
|
<li lay-id="1" style="padding:1px;" class="layui-this">基本信息</li>
|
</ul>
|
<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="text" class="layui-input" name="HBillNo" lay-verify="HBillNo" id="HBillNo" style="background-color:#efefef4d;" 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;">日期</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: 32px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">任务单号</label>
|
<div class="layui-input-block" style="margin-left: 77px;">
|
<input type="text" class="layui-input" name="HICMOBillNo" lay-verify="HICMOBillNo" id="HICMOBillNo" style="width: 60%;display: inline-block;">
|
<!--<input type="hidden" class="layui-input" name="HRepairID" lay-verify="HRepairID" id="HRepairID" value="0">-->
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="" id="" style="padding: 0 10px;float: left;margin-right: 3px;background-color:gainsboro;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="color:black;"></i>
|
</button>
|
</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" lay-verify="HMaterNumber" name="HMaterNumber" id="HMaterNumber" 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: 77px;">
|
<input type="text" class="layui-input" name="HMaterIDName" lay-verify="HMaterIDName" id="HMaterIDName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" name="HMaterID" lay-verify="HMaterID" id="HMaterID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHMaterID" id="btnHMaterID" style="padding: 0 10px;float: left;margin-right: 3px;background-color:gainsboro;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="color:black;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 65px;">规格型号</label>
|
<div class="layui-input-block" style="margin-left: 100px;">
|
<input type="text" class="layui-input" lay-verify="HMaterIDNum" name="HMaterIDNum" id="HMaterIDNum" style="background-color:#efefef4d;" 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" lay-verify="HUnitNumber" name="HUnitNumber" id="HUnitNumber" 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: 77px;">
|
<input type="text" class="layui-input" name="HUnitIDName" lay-verify="HUnitIDName" id="HUnitIDName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" class="layui-input" name="HUnitID" lay-verify="HUnitID" id="HUnitID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHUnitID" id="btnHUnitID" style="padding: 0 10px;float: left;margin-right: 3px;background-color:gainsboro;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="color:black;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 70px;">内部单据号</label>
|
<div class="layui-input-block" style="margin-left: 100px;">
|
<input type="text" class="layui-input" lay-verify="HInnerBillNo" name="HInnerBillNo" id="HInnerBillNo">
|
</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="date" class="layui-input" lay-verify="HPlanBeginDate" name="HPlanBeginDate" id="HPlanBeginDate" style="padding-left: 32px;">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">计划完工日期</label>
|
<div class="layui-input-block" style="margin-left: 130px;">
|
<input type="date" class="layui-input" lay-verify="HPlanEndDate" name="HPlanEndDate" id="HPlanEndDate" style="padding-left: 32px;">
|
</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" lay-verify="HPlanQty" name="HPlanQty" id="HPlanQty">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline" style="width: 56%;">
|
<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="HExplanation" id="HExplanation" lay-verify="HExplanation" placeholder="请输入内容" onmouseover="this.title=this.value">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-inline" style="width: 56%;">
|
<label class="layui-form-label" style="width: 85px;">备注</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="hidden" class="layui-input" name="HMaker" id="HMaker" lay-verify="HMaker" value="">
|
<input type="hidden" class="layui-input" name="HUpDater" id="HUpDater" lay-verify="HUpDater" value="">
|
<input type="text" class="layui-input" name="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
|
<script type="text/html" id="toolbarDemo">
|
<div class="layui-btn-container">
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
|
</div>
|
</script>
|
</form>
|
</div>
|
</div>
|
</div>
|
|
<script type="text/html" id="barDemo">
|
<!--<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>-->
|
<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;
|
//#endregion
|
|
//#region 进入页面即加载
|
|
var params = getUrlVars();
|
var OperationType = params[params[0]]; //从参数中获取 数据类型 添加 保存
|
var linterid = params[params[1]]; //从参数中获取 单据内码
|
var HSouceBillType = params[params[2]]; //从单据获取 源单类型
|
var linteridSub = params[params[3]]; //从参数获取 子表级别
|
|
//判断是否新增
|
if (linterid == null || linterid == 0) {
|
OperationType = 1;
|
linteridSub = -1;
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
type: "GET",
|
data: { "HBillType": '3715' },
|
success: function (d) {
|
//赋值
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
}
|
});
|
}
|
else {//如果修改则走下面 new
|
RoadBillMain(linterid, linteridSub);
|
}
|
|
//初始化界面
|
set_ClearBill();
|
|
//子表 初始化表格数据
|
var option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, limit: 500 //每页默认显示的数量
|
, cellMinWidth: 120
|
, height: 400
|
, cols: [[ //表头
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', totalRow: true }
|
, { field: 'HProcNo', title: '工序号', edit: 'text' }
|
|
, { field: '工序代码', title: '工序代码', edit: 'text', event:"hprocid" }//f7
|
, { field: '工序', title: '工序'}
|
, { field: 'hprocid', title: '工序id', hide: true}// ,hide: true
|
|
, { field: 'HWorkRemark', title: '加工说明', edit: 'text' }
|
|
, { field: '工作中心', title: '工作中心', edit: 'text', event: "HCenterID" }//f7
|
, { field: 'HCenterID', title: '工作中心id', hide: true}// hide: true
|
|
, { field: '加工车间代码', title: '加工车间代码', edit: 'text', event: "HDeptID" }//f7
|
, { field: '加工车间', title: '加工车间'}
|
, { field: 'HDeptID', title: '加工车间代码id', hide: true}// hide: true
|
|
, { field: '班组代码', title: '班组代码', edit: 'text', event: "HGroupID" }//f7
|
, { field: '班组', title: '班组' }
|
, { field: 'HGroupID', title: '班组代码id', hide: true}// hide: true
|
|
, { field: '操作员代码', title: '操作工代码', edit: 'text', event: "HWorkerID" }//f7
|
, { field: '操作员', title: '操作工' }
|
, { field: 'HWorkerID', title: '操作工代码id', hide: true }// hide: true
|
|
, { field: '生产资源', title: '生产资源', edit: 'text', event: "HSourceID" }//f7
|
, { field: 'HSourceID', title: '生产资源id', hide: true }// hide: true
|
|
, { field: 'HQty', title: '计划数量', edit: 'text' }
|
, { field: 'HWorkingQty', title: '在制品数量', edit: 'text' }
|
, { field: 'HTimeUnit', title: '时间单位', edit: 'text' }
|
, { field: 'HPlanWorkTimes', title: '计划加工时间', edit: 'text' }
|
, { field: 'hplanbegindate', title: '计划开工时间', edit: 'text' }
|
, { field: 'hplanenddate', title: '计划完工时间', edit: 'text' }
|
, { field: 'HICMOInterID', title: '任务ID', edit: 'text' }
|
, { field: 'HICMOBillNo', title: '任务单号', edit: 'text' }
|
, { field: 'HBeginDayQty', title: '开工余量(天数)', edit: 'text' }
|
, { field: 'HBeginFixQty', title: '开工余量(固数)', edit: 'text' }
|
, { field: 'HFixWorkDays', title: '上道固定天数', edit: 'text' }
|
, { field: 'HTrunWorkDays', title: '上道循环周期', edit: 'text' }
|
, { field: 'HReadyTimes', title: '本道准备时间', edit: 'text' }
|
, { field: 'HReadyTime', title: '准备时间', edit: 'text' }
|
, { field: 'HQueueTime', title: '排队时间', edit: 'text' }
|
, { field: 'HMoveTime', title: '转移时间', edit: 'text' }
|
, { field: 'HSeOrderInterID', title: '销售订单主ID', edit: 'text' }
|
, { field: 'HSeOrderEntryID', title: '销售订单子ID', edit: 'text' }
|
, { field: 'HSeOrderBillNo', title: '销售订单号', edit: 'text' }
|
, { fixed: 'right', title: '操作', toolbar: '#barDemo' }
|
]]
|
};
|
var rowdata = [{
|
"HProcNo": "", "工序代码": "", "工序": "", "hprocid": 0, "HWorkRemark": "",
|
"工作中心": "", "HCenterID": 0, "加工车间代码": "", "加工车间": "", "HDeptID": 0,
|
"班组代码": "", "班组": "", "HGroupID": 0, "操作员代码": "", "操作员": "",
|
"HWorkerID": 0, "生产资源": "", "HSourceID": 0, "HQty": "", "HWorkingQty": "",
|
"HTimeUnit": "", "HPlanWorkTimes": "", "hplanbegindate": null, "hplanenddate": null, "HICMOInterID": "",
|
"HICMOBillNo": "", "HBeginDayQty": "", "HBeginFixQty": "", "HFixWorkDays": "", "HTrunWorkDays": "",
|
"HReadyTimes": "", "HReadyTime": "", "HQueueTime": "", "HMoveTime": "", "HSeOrderInterID": "",
|
"HSeOrderEntryID": "", "HSeOrderBillNo": ""
|
}];
|
option.data = rowdata;
|
table.render(option);
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
//产品按钮
|
form.on("submit(btnHMaterID)", function () {
|
CheckHMaterID();
|
})
|
|
//单位按钮
|
form.on("submit(btnHUnitID)", function () {
|
CheckHUnitID();
|
})
|
|
//保存提交
|
form.on('submit(btnSave)', function (data) {//提交
|
//为空验证
|
if (AllowLoadData(data)) {
|
set_AddNew(data);
|
}
|
});
|
|
//#region 子表头部触发事件
|
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
//新增行表格数据
|
var NewRow = {
|
"HProcNo": "", "工序代码": "", "工序": "", "hprocid": 0, "HWorkRemark": "",
|
"工作中心": "", "HCenterID": 0, "加工车间代码": "", "加工车间": "", "HDeptID": 0,
|
"班组代码": "", "班组": "", "HGroupID": 0, "操作员代码": "", "操作员": "",
|
"HWorkerID": 0, "生产资源": "", "HSourceID": 0, "HQty": "", "HWorkingQty": "",
|
"HTimeUnit": "", "HPlanWorkTimes": "", "hplanbegindate": null, "hplanenddate": null, "HICMOInterID": "",
|
"HICMOBillNo": "", "HBeginDayQty": "", "HBeginFixQty": "", "HFixWorkDays": "", "HTrunWorkDays": "",
|
"HReadyTimes": "", "HReadyTime": "", "HQueueTime": "", "HMoveTime": "", "HSeOrderInterID": "",
|
"HSeOrderEntryID": "", "HSeOrderBillNo": ""
|
};
|
switch (obj.event) {
|
case 'btn-AddLine':
|
table.cache["mainTable"].push(NewRow);
|
option.data = table.cache["mainTable"];
|
table.render(option);
|
break;
|
case 'btn-CopyLine':
|
var copydata = JSON.stringify(data);
|
if (data.length <= 0) {
|
layer.msg("请选择需要复制的一行!");
|
}
|
else if (data.length > 1) {
|
layer.msg("只能选择复制一行!");
|
}
|
else {
|
var copydata2 = copydata.substring(1, copydata.length);//去除首行字符'['
|
var copyrow = copydata2.substring(0, copydata2.length - 1);//去除末尾字符']'
|
table.cache["mainTable"].push(JSON.parse(copyrow));//将复制的行强转成json追加到表格上
|
option.data = table.cache["mainTable"];//将数据绑定到data上
|
table.render(option);//将数据渲染到表格上
|
//layer.alert(copyrow);
|
}
|
break;
|
}
|
});
|
|
//行内事件
|
table.on('tool(mainTable)', function (obj) {
|
set_GridDelete(obj); //行内删除
|
set_GridCellCheck(obj); //行内快捷键筛选
|
});
|
|
//#endregion
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
// 初始化界面
|
function set_ClearBill() {
|
//制单人
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
//修改人
|
$("#HUpDater").val(sessionStorage["HUserName"]);
|
//初始化日期
|
$("#HPlanBeginDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HPlanEndDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
}
|
|
//产品选择页面
|
function CheckHMaterID() {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "物料表" //标题
|
, area: ["90%", "90%"] //大小
|
, shift: 2 //弹出动画
|
, content: ["../../Baseset/基础资料/Gy_MaterialList.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) { //按钮一 回调
|
var iframeWindow = window['layui-layer-iframe' + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
|
//获取数据
|
$("#HMaterNumber").val(checkStatus.data[0].HNumber);//产品代码
|
$("#HMaterIDName").val(checkStatus.data[0].HName);//产品名称
|
$("#HMaterID").val(checkStatus.data[0].HItemID);//产品id
|
$("#HMaterIDNum").val(checkStatus.data[0].HModel);//产品规格型号
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
|
//单位选择页面
|
function CheckHUnitID() {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, area: ["90%", "90%"] //大小
|
, title:"单位列表" //标题
|
, shift: 2 //弹出动画
|
, content: ["../../Baseset/基础资料/Gy_UnitList.html"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {
|
var iframeWindow = window['layui-layer-iframe' + index] //获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable'); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据!");
|
}
|
else {
|
//获取数据
|
$("#HUnitNumber").val(checkStatus.data[0].HNumber);//单位代码
|
$("#HUnitID").val(checkStatus.data[0].HItemID);//单位id
|
$("#HUnitIDName").val(checkStatus.data[0].HName);//单位名称
|
|
//关闭页面
|
layer.close(index);
|
}
|
}
|
})
|
}
|
|
//行内删除
|
function set_GridDelete(obj) {
|
var data = obj.data;
|
var rowIndex = $(obj.tr).attr("data-index");
|
if (obj.event === 'del') {
|
layer.confirm('真的删除行吗?', function (index) {
|
console.log("索引为:" + rowIndex);
|
if (rowIndex === '0') {
|
layer.msg('首行无法删除!!!');
|
} else {
|
obj.del();
|
option.data = table.cache["mainTable"];//将数据绑定到data上
|
table.reload(option);
|
layer.close(index);
|
}
|
});
|
}
|
}
|
|
//行内快捷键
|
function set_GridCellCheck(obj) {
|
$(document).off('keydown', ".layui-table-edit").on('keydown', ".layui-table-edit", function (e) {
|
if (event.key == "F7") {
|
//工序
|
if (obj.event == "hprocid") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "工序表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../Baseset/基础资料/Gy_ProcList.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"工序代码": checkStatus.data[0].工序代码
|
, "工序": checkStatus.data[0].工序
|
, "hprocid": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
//工作中心
|
if (obj.event == "HCenterID") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "工作中心表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../Baseset/基础资料/Gy_WorkCenterList.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"工作中心": checkStatus.data[0].工作中心
|
, "HCenterID": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
//加工车间
|
if (obj.event == "HDeptID") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "部门表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../Baseset/基础资料/Gy_DepartmentList.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"加工车间代码": checkStatus.data[0].HNumber
|
, "加工车间": checkStatus.data[0].HName
|
, "HDeptID": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
//班组
|
if (obj.event == "HGroupID") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "班组表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../基础资料/工资基础资料/Gy_Group.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"班组代码": checkStatus.data[0].班组代码
|
, "班组": checkStatus.data[0].班组名称
|
, "HGroupID": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
//操作工
|
if (obj.event == "HWorkerID") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "人员表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../Baseset/基础资料/Gy_EmployeeList.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"操作员": checkStatus.data[0].HName
|
, "操作员代码": checkStatus.data[0].HNumber
|
, "HWorkerID": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
//生产资源
|
if (obj.event == "HSourceID") {
|
layer.open({
|
type: 2 //弹窗类型
|
, skin: "layui-layer-rim" //加上边框
|
, title: "生产资源表" //标题
|
, closeBtn: 1 //窗体右上角 关闭的样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置窗体最大最小按钮是否显示
|
, content: ["../../基础资料/生产基础资料/Gy_Source.html", "yes"]
|
, btn: ["确定", "取消"]
|
, btn1: function (index) {//按钮一 回调
|
var iframeWindow = window["layui-layer-iframe" + index]; //获取弹窗页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable"); //获取选中行数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选中一条数据!");
|
}
|
|
//获取数据/绑定数据
|
obj.update({
|
"生产资源": checkStatus.data[0].生产资源名称
|
, "HSourceID": checkStatus.data[0].HItemID
|
})
|
|
//关闭页面
|
layer.close(index);
|
}
|
})
|
}
|
}
|
})
|
}
|
|
//保存数据
|
function set_AddNew(data) {
|
//过滤子表删除之后留下的空数据
|
var num = [];
|
for (var i = 0; i < table.cache['mainTable'].length; i++) {
|
//给不能为空的数据 赋值(子)
|
if (table.cache['mainTable'][i] != "") {
|
if (table.cache['mainTable'][i].HProcNo == "") {
|
table.cache['mainTable'][i].HProcNo = 0;
|
}
|
if (table.cache['mainTable'][i].HQty == "") {
|
table.cache['mainTable'][i].HQty = 0;
|
}
|
if (table.cache['mainTable'][i].HWorkingQty == "") {
|
table.cache['mainTable'][i].HWorkingQty = 0;
|
}
|
if (table.cache['mainTable'][i].HPlanWorkTimes == "") {
|
table.cache['mainTable'][i].HPlanWorkTimes = 0;
|
}
|
if (table.cache['mainTable'][i].HICMOInterID == "") {
|
table.cache['mainTable'][i].HICMOInterID = 0;
|
}
|
if (table.cache['mainTable'][i].HBeginDayQty == "") {
|
table.cache['mainTable'][i].HBeginDayQty = 0;
|
}
|
if (table.cache['mainTable'][i].HBeginFixQty == "") {
|
table.cache['mainTable'][i].HBeginFixQty = 0;
|
}
|
if (table.cache['mainTable'][i].HFixWorkDays == "") {
|
table.cache['mainTable'][i].HFixWorkDays = 0;
|
}
|
if (table.cache['mainTable'][i].HTrunWorkDays == "") {
|
table.cache['mainTable'][i].HTrunWorkDays = 0;
|
}
|
if (table.cache['mainTable'][i].HReadyTimes == "") {
|
table.cache['mainTable'][i].HReadyTimes = 0;
|
}
|
if (table.cache['mainTable'][i].HReadyTime == "") {
|
table.cache['mainTable'][i].HReadyTime = 0;
|
}
|
if (table.cache['mainTable'][i].HQueueTime == "") {
|
table.cache['mainTable'][i].HQueueTime = 0;
|
}
|
if (table.cache['mainTable'][i].HMoveTime == "") {
|
table.cache['mainTable'][i].HMoveTime = 0;
|
}
|
if (table.cache['mainTable'][i].HSeOrderInterID == "") {
|
table.cache['mainTable'][i].HSeOrderInterID = 0;
|
}
|
if (table.cache['mainTable'][i].HSeOrderEntryID == "") {
|
table.cache['mainTable'][i].HSeOrderEntryID = 0;
|
}
|
|
num.push(table.cache['mainTable'][i]);
|
}
|
}
|
|
//给不能为空的数据 赋值(主)
|
if (data.field.HPlanQty == "") {
|
data.field.HPlanQty = 0
|
}
|
|
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(num);
|
var hentryid = linteridSub;//子表 排序id
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + hentryid + ';' + OperationType;
|
var index = layer.load();
|
|
//console.log(JSON.stringify(table.cache['mainTable'][0]))
|
//return false;
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Sc_ProcessMangement/AddBill",
|
async: true,
|
data: { "sMainSub": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) {
|
layer.close(index);
|
layer.msg("提交成功");
|
}
|
else {
|
layer.close(index);
|
layer.msg(data.Message, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
},
|
error: function (err) {
|
layer.close(index);
|
layer.msg("错误:" + err, { icon: 5, btn: ['确认'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "温馨提示" });
|
}
|
});
|
}
|
|
//编辑
|
function RoadBillMain(linterid, linteridSub) {
|
var sWhere = " and hmainid ='" + linterid + "' and hsubid='" + linteridSub + "' ";
|
|
$.ajax({
|
url: GetWEBURL() + '/Sc_ProcessMangement/MES_Sc_ProcessPlanMain_Json',
|
type: "GET",
|
data: { "sWhere": sWhere },
|
success: function (d) {
|
//主表
|
form.val("formData", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
|
"HBillNo": d.data[0].单据号
|
, "HInterID": d.data[0].hmainid
|
, "HDate": Format(new Date(d.data[0].日期), "yyyy-MM-dd")
|
, "HICMOBillNo": d.data[0].任务单号
|
, "HMaterNumber": d.data[0].物料代码
|
, "HMaterIDName": d.data[0].物料名称
|
, "HMaterID": d.data[0].HMaterID
|
, "HMaterIDNum": d.data[0].规格型号
|
, "HUnitNumber": d.data[0].计量单位代码
|
, "HUnitIDName": d.data[0].计量单位
|
, "HUnitID": d.data[0].hunitid
|
, "HInnerBillNo": d.data[0].内部单据号
|
, "HPlanBeginDate": Format(new Date(d.data[0].计划开工日期), "yyyy-MM-dd")
|
, "HPlanEndDate": Format(new Date(d.data[0].计划完工日期), "yyyy-MM-dd")
|
, "HPlanQty": d.data[0].生产数量
|
, "HExplanation": d.data[0].摘要
|
, "HRemark": d.data[0].表头备注
|
});
|
//子表
|
var rowdata = [{
|
"HProcNo": d.data[0].工序号, "工序代码": d.data[0].工序代码, "工序": d.data[0].工序, "hprocid": d.data[0].hprocid, "HWorkRemark": d.data[0].加工说明,
|
"工作中心": d.data[0].工作中心, "HCenterID": d.data[0].HCenterID, "加工车间代码": d.data[0].加工车间代码, "加工车间": d.data[0].加工车间, "HDeptID": d.data[0].HDeptID,
|
"班组代码": d.data[0].班组代码, "班组": d.data[0].班组名称, "HGroupID": d.data[0].HGroupID, "操作员代码": d.data[0].操作员代码, "操作员": d.data[0].操作员,
|
"HWorkerID": d.data[0].HWorkerID, "生产资源": d.data[0].生产资源, "HSourceID": d.data[0].HSourceID, "HQty": d.data[0].计划数量, "HWorkingQty": d.data[0].在制品数量,
|
"HTimeUnit": d.data[0].时间单位, "HPlanWorkTimes": d.data[0].计划加工时间, "hplanbegindate": (Format(new Date(d.data[0].工序计划开工日期), "yyyyMMdd") == "19000101" ? null : Format(new Date(d.data[0].工序计划开工日期), "yyyy-MM-dd")), "hplanenddate": (Format(new Date(d.data[0].工序计划完工日期), "yyyyMMdd") == "19000101" ? null : Format(new Date(d.data[0].工序计划完工日期), "yyyy-MM-dd")), "HICMOInterID": d.data[0].任务单号id,
|
"HICMOBillNo": d.data[0].子任务单号, "HBeginDayQty": d.data[0].开工固天, "HBeginFixQty": d.data[0].开工固数, "HFixWorkDays": d.data[0].上道固定天数, "HTrunWorkDays": d.data[0].上道循环周期,
|
"HReadyTimes": d.data[0].本道准备时间, "HReadyTime": d.data[0].准备时间, "HQueueTime": d.data[0].排队时间, "HMoveTime": d.data[0].转移时间, "HSeOrderInterID": d.data[0].销售订单主ID,
|
"HSeOrderEntryID": d.data[0].销售订单子ID, "HSeOrderBillNo": d.data[0].销售订单号
|
}];
|
option.data = rowdata;
|
table.render(option);
|
}
|
})
|
}
|
|
//数据验证
|
function AllowLoadData(data) {
|
var HMaterIDName = data.field.HMaterIDName;//产品
|
var HUnitIDName = data.field.HUnitIDName;//单位
|
if (HMaterIDName == "") {
|
layer.msg("请选择产品!");
|
return false;
|
}
|
if (HUnitIDName == "") {
|
layer.msg("请选择单位!");
|
return false;
|
}
|
return true;
|
}
|
|
//获取参数
|
function getUrlVars() {
|
var vars = [], hash;
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
for (var i = 0; i < hashes.length; i++) {
|
hash = hashes[i].split('=');
|
vars.push(hash[0]);
|
vars[hash[0]] = hash[1];
|
}
|
return vars;
|
}
|
//#endregion
|
|
});
|
</script>
|
</body>
|
</html>
|