<!DOCTYPE html>
|
<html>
|
<head>
|
<meta 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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
<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="../../../layuiadmin/PageTitle.js"></script>
|
<style>
|
.main-btn { /*头部主按钮*/
|
padding: 0 2px; /*调整按钮左右空隙大小*/
|
height: 30px;
|
line-height: 30px;
|
}
|
|
.btn-title {
|
font-size: 16px;
|
}
|
/* 防止下拉框的下拉列表被隐藏---必须设置--- */
|
.layui-table-cell {
|
overflow: visible !important;
|
}
|
/* 使得下拉框与单元格刚好合适 */
|
td .layui-form-select {
|
margin-top: -10px;
|
margin-left: -15px;
|
margin-right: -15px;
|
}
|
|
.layui-form-item .layui-inline {
|
margin-top: 5px;
|
margin-bottom: 5px;
|
margin-right: 0px;
|
}
|
|
.layui-form-label {
|
width: 25%;
|
}
|
</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 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="btnEdit" id="btnEdit">退出</button>
|
</div>
|
<div class="layui-tab" lay-filter="tab-POStockInBill">
|
<h1 style="text-align: center; padding: 10px 0;"><b>生产订单</b></h1>
|
<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">
|
<!--基本信息-->
|
<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">
|
<input type="hidden" name="HSTOCKINORGID" id="HSTOCKINORGID" lay-verify="HSTOCKINORGID">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">组织</label>
|
<div class="layui-input-block" style="margin-left: 120px; width: 185px;">
|
<select name="HPRDORGID" id="HPRDORGID" lay-filter="HPRDORGID">
|
<!--动态渲染组织-->
|
</select>
|
</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: 80px;">
|
</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="HSeOrderBillNo" name="HSeOrderBillNo" id="HSeOrderBillNo" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HSeOrderInterID" id="HSeOrderInterID" lay-verify="HSeOrderInterID" value="0">
|
<input type="hidden" name="HSeOrderEntryID" id="HSeOrderEntryID" lay-verify="HSeOrderEntryID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHSeOrder" id="btnHSeOrder" 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" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HEmpID" id="HEmpID" lay-verify="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="HCusName" name="HCusName" id="HCusName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HCusID" id="HCusID" lay-verify="HCusID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHCus" id="btnHCus" 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="HCenterName" name="HCenterName" id="HCenterName" style="background-color:#efefef4d;width: 60%;display: inline-block;" readonly>
|
<input type="hidden" name="HCenterID" id="HCenterID" lay-verify="HCenterID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnHCenter" id="btnHCenter" 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="HPlanQty" lay-verify="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="HRemark" id="HRemark" lay-verify="HRemark" placeholder="请输入内容" onmouseover="this.title=this.value">
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<!--其他信息-->
|
<div class="layui-tab-item">
|
<div class="layui-form-item">
|
<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="hmakers" id="hmakers" 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="hchecker" id="hchecker" 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="" id="" 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" name="hmakedate" id="hmakedate" 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="hcheckdate" id="hcheckdate" 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="" id="" 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" name="" id="" 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="hupdater" id="hupdater" 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="hdeleteman" id="hdeleteman" 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" name="" id="" 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="hupdatedate" id="hupdatedate" 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="hdeletedate" id="hdeletedate" style="background-color:#efefef4d;" readonly>
|
</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>
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><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-danger layui-btn-xs" lay-event="del">删除</a>
|
</script>
|
|
<!--行下拉选择(业务状态)-->
|
<script type="text/html" id="HSTATUS">
|
<select name="HSTATUS" lay-filter="HSTATUS" id="HSTATUS{{d.LAY_TABLE_INDEX+1}}">
|
<option value="1">计划</option>
|
<option value="2">计划确认</option>
|
<option value="3">下达</option>
|
<option value="4">开工</option>
|
<option value="5">完工</option>
|
<option value="6">结案</option>
|
<option value="7">结算</option>
|
</select>
|
</script>
|
|
<script>
|
var OptionData = [];
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'form', 'laydate', 'table', 'element', 'laydate'], function () {
|
|
//#region 公共变量
|
|
var $ = layui.$
|
, admin = layui.admin
|
, layer = layui.layer
|
, table = layui.table
|
, form = layui.form
|
, element = layui.element
|
, laydate = layui.laydate
|
var option = [];
|
|
|
//#endregion
|
|
//#region 进入页面即加载
|
|
//#region 【动态获取模块名称】
|
var HModuleType = "3710";
|
//通过单据类型,从数据库动态获取单据模块命名,引用js文件 PageTitle.js
|
var HPageTitle = get_PageTitle(HModuleType) == "" ? $("h1").html() : get_PageTitle(HModuleType);
|
$("h1").html('<b>' + HPageTitle + '</b>');
|
//#endregion
|
|
var rowdata = [{
|
"HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HModel": "", "HSourceID": 0
|
, "HSourceName": "", "HDeptID": 0, "HDeptName": "", "HUnitID": 0, "HUnitName": ""
|
, "HQty": "", "HSTATUS": "1", "HPlanBeginDate": "", "HPlanEndDate": "", "HOrderLevID": "0", "订单等级代码": "", "订单等级名称": "",
|
}];
|
//初始化
|
set_ClearBill();
|
|
var params = getUrlVars();
|
var OperationType = params[params[0]]; //从参数中获取 数据类型 1添加 保存 2复制 3 编辑
|
var linterid = params[params[1]]; //从参数中获取 单据内码
|
|
if (linterid == null || linterid == 0) {
|
OperationType = 1;
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
type: "GET",
|
data: { "HBillType": '3710' },
|
success: function (d) {
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
}
|
});
|
}
|
else if (OperationType == 2)
|
{
|
RoadBillMain(linterid);
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
type: "GET",
|
data: { "HBillType": '3710' },
|
success: function (d) {
|
$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
}
|
});
|
}
|
else if(OperationType == 3)
|
{//如果修改则走下面
|
//禁用组织选项
|
$("#HPRDORGID").attr("disabled", true);
|
$("#HDate").attr("disabled", true);
|
RoadBillMain(linterid);
|
}
|
|
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
//新增行表格数据
|
var NewRow = {
|
"HMaterID": 0, "HMaterNumber": "", "HMaterName": "", "HModel": "", "HSourceID": 0
|
, "HSourceName": "", "HDeptID": 0, "HDeptName": "", "HUnitID": 0, "HUnitName": ""
|
, "HQty": "", "HSTATUS": "1", "HPlanBeginDate": "", "HPlanEndDate": "", "HOrderLevID": "0", "订单等级代码": "", "订单等级名称": ""
|
};
|
switch (obj.event) {
|
case 'btn-AddLine':
|
table.cache["mainTable"].push(NewRow);
|
option.data = table.cache["mainTable"];
|
|
table.render(option);
|
//刷新复选框
|
checkRefresh();
|
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);//将数据渲染到表格上
|
//刷新复选框
|
checkRefresh();
|
}
|
break;
|
////列设置
|
//case 'set_HideColumn':
|
// get_HideColumn();
|
// break;
|
}
|
});
|
|
//选择销售订单号按钮
|
form.on('submit(btnHSeOrder)', function () {
|
get_btnHSeOrder();
|
});
|
|
//选择业务员按钮
|
form.on('submit(btnHEmp)', function () {
|
get_btnHEmp();
|
});
|
|
//选择客户按钮
|
form.on('submit(btnHCus)', function () {
|
get_btnHCus();
|
});
|
|
//选择工作中心按钮
|
form.on('submit(btnHCenter)', function () {
|
get_btnHCenter();
|
});
|
|
|
//行选择处理(工序类型)
|
form.on('select(HSTATUS)', function (data) {
|
//获取下拉框选中的值
|
var elem = data.othis.parents('tr');
|
var dataindex = elem.attr("data-index");
|
$.each(option.data, function (index, value) {
|
if (value.LAY_TABLE_INDEX == dataindex) {
|
value.HSTATUS = data.value;//把选中下拉框id值赋值给表格缓存
|
}
|
});
|
});
|
|
//退出
|
form.on('submit(btnEdit)', function (data) {
|
if (OperationType == 1 && linterid != "") {
|
Pub_Close(2);
|
} else {
|
Pub_Close(1);
|
}
|
});
|
|
//保存提交
|
form.on('submit(btnSave)', function (data) {//提交
|
set_AddNew(data);
|
});
|
|
//行内事件
|
table.on('tool(mainTable)', function (obj) {
|
set_GridDelete(obj); //行内删除
|
set_GridCellCheck(obj); //行内快捷键筛选
|
|
//#region 修改行 时间
|
|
var data = obj.data;
|
//计划开始日期
|
if (obj.event == 'HPlanBeginDate') {
|
var field = $(this).data('field');
|
laydate.render({
|
elem: this.firstChild
|
, show: true //直接显示
|
, closeStop: this
|
, done: function (nowDate) {
|
//时间选择完成,行数据更新
|
data[field] = nowDate;
|
obj.update(data);
|
//刷新复选框
|
checkRefresh();
|
}
|
});
|
}
|
|
//计划完工日期
|
if (obj.event == 'HPlanEndDate') {
|
var field = $(this).data('field');
|
laydate.render({
|
elem: this.firstChild
|
, show: true //直接显示
|
, closeStop: this
|
, done: function (nowDate) {
|
//时间选择完成,行数据更新
|
data[field] = nowDate;
|
obj.update(data);
|
//刷新复选框
|
checkRefresh();
|
}
|
});
|
}
|
|
//#endregion
|
|
});
|
|
|
//下拉框时间 组织
|
form.on('select(HPRDORGID)', function (data) {
|
$("#HSTOCKINORGID").val(data.value);
|
});
|
|
//#endregion
|
|
//#region 此页面所有的方法
|
|
// 初始化界面
|
function set_ClearBill() {
|
//初始化日期
|
$("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
|
$("#hmakers").val(sessionStorage["HUserName"]);
|
$("#hmakedate").val(Format(new Date(), "yyyy-MM-dd"));
|
//初始化 组织
|
Organ();
|
|
set_InitGrid();
|
}
|
|
//获取组织
|
function Organ() {
|
//获取登录页组织列
|
var Organization = '';
|
$.ajax({
|
type: "get",
|
url: GetWEBURL() + "/Web/GetOrganizations",
|
success: function (result) {
|
if (result.count == 1) { // 说明验证成功了,
|
var data = result.data;
|
for (var i = 0; i < data.length; i++) {
|
Organization += '<option style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
|
}
|
$("#HPRDORGID").append(Organization);
|
$("#HPRDORGID").val(sessionStorage["OrganizationID"])
|
$("#HSTOCKINORGID").val(sessionStorage["OrganizationID"])
|
form.render('select');
|
}
|
layer.closeAll("loading");
|
}
|
})
|
}
|
|
function set_InitGrid() {
|
option = {
|
elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, limit: 500
|
, height: 500
|
, totalRow: true
|
, loading: false
|
, cols: [[ //表头
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', totalRow: true }
|
, { field: 'HMaterID', title: 'HMaterID', hide: true }
|
, { field: 'HMaterNumber', title: '物料编码', edit: 'text', event: "HMaterID" }
|
, { field: 'HMaterName', title: '物料名称' }
|
, { field: 'HModel', title: '规格型号' }
|
, { field: 'HOrderLevID', title: 'HOrderLevID', hide: true }
|
, { field: '订单等级代码', title: '订单等级代码', edit: 'text', event: "HOrderLevID" }
|
, { field: '订单等级名称', title: '订单等级名称' }
|
, { field: 'HSourceID', title: 'HSourceID', hide: true }
|
, { field: 'HSourceName', title: '生产资源', edit: 'text', event: "HSourceID" }//f7
|
, { field: 'HDeptID', title: 'HDeptID', hide: true }
|
, { field: 'HDeptName', title: '生产车间', edit: 'text', event: "HDeptID" }//f7
|
, { field: 'HUnitID', title: 'HUnitID', hide: true }
|
, { field: 'HUnitName', title: '计量单位', edit: 'text', event: "HUnitID" }//f7
|
, { field: 'HQty', title: '数量', edit: 'text', totalRow: true }
|
, { field: 'HSTATUS', title: '业务状态', templet: "#HSTATUS" }
|
, { field: 'HPlanBeginDate', title: '计划开工日期', event: 'HPlanBeginDate' }
|
, { field: 'HPlanEndDate', title: '计划完工日期', event: 'HPlanEndDate' }
|
, { fixed: 'right', title: '操作', toolbar: '#barDemo' }
|
]]
|
}
|
|
option.data = rowdata;
|
table.render(option);
|
}
|
|
//销售订单
|
function get_btnHSeOrder() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '销售订单'//标题
|
, shift: 2//弹出动画
|
, content: ['../../销售管理/销售订单/Xs_SeOrderBillList.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('请选择数据');
|
}
|
//获取数据
|
$("#HSeOrderInterID").val(checkStatus.data[0].hmainid);
|
$("#HSeOrderBillNo").val(checkStatus.data[0].单据号);
|
$("#HSeOrderEntryID").val(checkStatus.data[0].hsubid);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//业务员
|
function get_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('请选择数据');
|
}
|
//获取数据
|
$("#HEmpID").val(checkStatus.data[0].HItemID);
|
$("#HEmpName").val(checkStatus.data[0].职员名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//客户
|
function get_btnHCus() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '客户'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/销售基础资料/Gy_Customer.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('请选择数据');
|
}
|
//获取数据
|
$("#HCusID").val(checkStatus.data[0].HItemID);
|
$("#HCusName").val(checkStatus.data[0].客户名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//工作中心
|
function get_btnHCenter() {
|
layer.open({
|
type: 2//弹窗类型
|
, skin: 'layui-layer-rim' //加上边框
|
, area: ['90%', '90%']//大小
|
, title: '工作中心'//标题
|
, shift: 2//弹出动画
|
, content: ['../../基础资料/公用基础资料/Gy_WorkCenter.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('请选择数据');
|
}
|
//获取数据
|
$("#HCenterID").val(checkStatus.data[0].HItemID);
|
$("#HCenterName").val(checkStatus.data[0].工作中心名称);
|
|
layer.close(index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) { }
|
})
|
}
|
|
//行内删除
|
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 == "HMaterID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "物料列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
|
//更新表格缓存的数据
|
obj.update({
|
"HMaterID": checkStatus.data[0].HItemID
|
, "HMaterNumber": checkStatus.data[0].物料代码
|
, "HMaterName": checkStatus.data[0].物料名称
|
, "HModel": checkStatus.data[0].规格型号
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (OptionData.length > 0) {
|
//更新表格缓存的数据
|
obj.update({
|
"HMaterID": OptionData[0].HItemID
|
, "HMaterNumber": OptionData[0].物料代码
|
, "HMaterName": OptionData[0].物料名称
|
, "HModel": OptionData[0].规格型号
|
})
|
OptionData = [];
|
}
|
}
|
})
|
}
|
//生产资源
|
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, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HSourceID": checkStatus.data[0].HItemID
|
, "HSourceName": checkStatus.data[0].生产资源名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (OptionData.length > 0) {
|
//更新表格缓存的数据
|
obj.update({
|
"HSourceID": OptionData[0].HItemID
|
, "HSourceName": OptionData[0].生产资源名称
|
})
|
OptionData = [];
|
}
|
}
|
})
|
}
|
//生产车间
|
if (obj.event == "HDeptID") {
|
//打开人员表 小窗体
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "生产车间列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/公用基础资料/Gy_DepartmentList.html', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HDeptID": checkStatus.data[0].HItemID
|
, "HDeptName": checkStatus.data[0].部门名称
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (OptionData.length > 0) {
|
//更新表格缓存的数据
|
obj.update({
|
"HDeptID": OptionData[0].HItemID
|
, "HDeptName": OptionData[0].部门名称
|
})
|
OptionData = [];
|
}
|
}
|
})
|
}
|
//计量单位
|
if (obj.event == "HUnitID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "计量单位列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/公用基础资料/Gy_Unit.html', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
|
var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
|
|
if (checkStatus.data.length != 1) {
|
return layer.msg("请选择一条数据");
|
}
|
//更新表格缓存的数据
|
obj.update({
|
"HUnitName": checkStatus.data[0].计量单位名称
|
, "HUnitID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (OptionData.length > 0) {
|
//更新表格缓存的数据
|
obj.update({
|
"HUnitName": OptionData[0].计量单位名称
|
, "HUnitID": OptionData[0].HItemID
|
})
|
OptionData = [];
|
}
|
}
|
})
|
}
|
//订单等级
|
if (obj.event == "HOrderLevID") {
|
layer.open({
|
type: 2
|
, skin: "layui-layer-rim" //加上边框
|
, title: "订单等级列表" //标题
|
, closeBtn: 1 //窗体右上角关闭 的 样式
|
, shift: 2 //弹出动画
|
, area: ["90%", "90%"] //窗体大小
|
, maxmin: true //设置最大最小按钮是否显示
|
, content: ['../../基础资料/公用基础资料/Gy_OrderLev.html', 'yes']
|
, btn: ["确定", "取消"]
|
, btn1: function (index, laero) {
|
//按钮一 的回调
|
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].订单等级代码
|
,"HOrderLevID": checkStatus.data[0].HItemID
|
})
|
layer.close(index);//关闭弹窗
|
}
|
, end: function () {
|
if (OptionData.length > 0) {
|
//更新表格缓存的数据
|
obj.update({
|
"订单等级名称": OptionData[0].订单等级
|
, "订单等级代码": OptionData[0].订单等级代码
|
, "HOrderLevID": OptionData[0].HItemID
|
})
|
OptionData = [];
|
}
|
}
|
})
|
}
|
obj.event = "";
|
return false;
|
}
|
})
|
}
|
|
//多选 刷新表格
|
function checkRefresh() {
|
for (var i = 1; i <= option.data.length; i++) {
|
//是否手工关闭
|
if (option.data[i - 1].HSTATUS) {
|
$('#HSTATUS' + i + '').attr("checked", true);
|
}
|
}
|
form.render('select');
|
}
|
|
//保存HMaker
|
function set_AddNew(data) {
|
|
if ($("#hchecker").val() != "") {
|
layer.msg("单据已审核,不允许修改!");
|
return false;
|
}
|
|
var num = [];
|
for (var i = 0; i < table.cache["mainTable"].length; i++) {
|
if (table.cache["mainTable"][i] != "") {
|
table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
|
num.push(table.cache["mainTable"][i])
|
}
|
}
|
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(num);
|
//var hentryid = linteridSub;//子表 排序id
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + OperationType + ";" + sessionStorage["HUserName"];
|
|
var index = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/Sc_ICMOBill/ICMOBillEdit",
|
async: true,
|
data: { "sMainSub": sMainSub },
|
dataType: "json",
|
success: function (data) {
|
if (data.count == 1) {
|
$('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
|
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)//加载表头
|
{
|
var sWhere = " and HPRDORGID=" + sessionStorage["OrganizationID"] + " and hmainid='" + linterid + "'";
|
$.ajax({
|
url: GetWEBURL() + "/LEMS/MES_IF_ICMOBillList_Json",
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (d) {
|
|
//$("#HPRDORGID").val(d.data[0].HPRDORGID);
|
//主表
|
form.val("formData", {
|
"HBillNo": d.data[0].单据号
|
, "HInterID":d.data[0].hmainid
|
, "HDate": Format(new Date(d.data[0].日期), "yyyy-MM-dd")
|
, "HSeOrderBillNo": d.data[0].源单单号
|
, "HSeOrderInterID": d.data[0].源单主内码
|
, "HSeOrderEntryID": d.data[0].源单子内码
|
, "HEmpID": d.data[0].HEmpID
|
, "HEmpName": d.data[0].业务员
|
, "HCenterID": d.data[0].HCenterID
|
, "HCenterName": d.data[0].工作中心
|
, "HRemark": d.data[0].表头备注
|
, "HPlanQty": d.data[0].计划生产数量
|
, "HPRDORGID": d.data[0].HPRDORGID
|
//其他信息
|
, "hmakers": OperationType == 2 ? "" :d.data[0].制单人
|
, "hmakedate": OperationType == 2 ? "" :d.data[0].制单日期 == null ? "" : Format(new Date(d.data[0].制单日期), "yyyy-MM-dd")
|
, "hchecker": OperationType==2?"":d.data[0].审核人
|
, "hcheckdate": OperationType == 2 ? "" :d.data[0].审核日期 == null ? "" : Format(new Date(d.data[0].审核日期), "yyyy-MM-dd")
|
, "hupdater": OperationType == 2 ? "" : d.data[0].修改人
|
, "hupdatedate": OperationType == 2 ? "" : d.data[0].修改日期 == null ? "" : Format(new Date(d.data[0].修改日期), "yyyy-MM-dd")
|
, "hdeleteman": OperationType == 2 ? "" :d.data[0].作废人
|
, "hdeletedate": OperationType == 2 ? "" : d.data[0].作废日期 == null ? "" : Format(new Date(d.data[0].作废日期), "yyyy-MM-dd")
|
});
|
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < d.data.length; i++) {
|
var HSTATUS = "";
|
switch (d.data[i].状态) {
|
case "计划":
|
HSTATUS = "1";
|
break;
|
case "计划确认":
|
HSTATUS = "2";
|
break;
|
case "下达":
|
HSTATUS = "3";
|
break;
|
case "开工":
|
HSTATUS = "4";
|
break;
|
case "完工":
|
HSTATUS = "5";
|
break;
|
case "结案":
|
HSTATUS = "6";
|
break;
|
}
|
rowdata.push(
|
{
|
"HMaterID": d.data[i].HMaterID, "HMaterNumber": d.data[i].产品代码, "HMaterName": d.data[i].产品名称
|
, "HModel": d.data[i].规格型号, "HSourceID": d.data[i].HSourceID, "HSourceName": d.data[i].生产资源
|
, "HDeptID": d.data[i].HDeptID, "HDeptName": d.data[i].生产车间, "HUnitID": d.data[i].HUnitID
|
, "HUnitName": d.data[i].计量单位, "HQty": d.data[i].生产任务单数量, "HSTATUS": HSTATUS
|
, "HPlanBeginDate": Format(new Date(d.data[i].计划开工日期), "yyyy-MM-dd"), "HPlanEndDate": Format(new Date(d.data[i].计划完工日期), "yyyy-MM-dd")
|
, "HOrderLevID": d.data[i]["HOrderLevID"], "订单等级代码": d.data[i]["订单等级代码"], "订单等级名称": d.data[i]["订单等级"],
|
}
|
)
|
}
|
option.data = rowdata;
|
table.render(option);
|
for (var i = 0; i < d.data.length; i++) {
|
var HSTATUS = "";
|
switch (d.data[i].状态) {
|
case "计划":
|
HSTATUS = "1";
|
break;
|
case "计划确认":
|
HSTATUS = "2";
|
break;
|
case "下达":
|
HSTATUS = "3";
|
break;
|
case "开工":
|
HSTATUS = "4";
|
break;
|
case "完工":
|
HSTATUS = "5";
|
break;
|
case "结案":
|
HSTATUS = "6";
|
break;
|
}
|
$('#HSTATUS' + (i + 1)).find("option[value='" + HSTATUS + "']").attr("selected", true);
|
}
|
|
form.render('select');
|
}
|
})
|
}
|
|
//获取参数
|
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
|
|
});
|
|
//业务员
|
function GetHEmpValue(obj) {
|
$("#HEmpID").val(obj[0].HItemID);
|
$("#HEmpName").val(obj[0].职员名称);
|
}
|
//工作中心
|
function GetWorkCenterValue(obj) {
|
$("#HCenterID").val(obj[0].HItemID);
|
$("#HCenterName").val(obj[0].工作中心名称);
|
}
|
//物料
|
function GetMaterValue(obj) {
|
OptionData = obj;
|
}
|
//计量单位
|
function GetUnitValue(obj) {
|
OptionData = obj;
|
}
|
//客户
|
function GetHCusNameValue(obj) {
|
OptionData = obj;
|
}
|
//生产车间
|
function GetHDeptNameValue(obj) {
|
OptionData = obj;
|
}
|
//生产资源
|
function GetGySource(obj) {
|
OptionData[0] = obj;
|
}
|
//订单等级
|
function GetOrderLevValue(obj) {
|
OptionData = obj;
|
}
|
|
</script>
|
</body>
|
</html>
|