<!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/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/zgqCustom/zgqCustom.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: 15px;">
|
<div class="layui-card-body" style="padding: 1px;">
|
<form class="layui-form" lay-filter="component-form-group" action="">
|
<div class="layui-card-header">
|
<div class="layui-btn-group">
|
<button type="button" id="btnSave" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="btnSave">保存</button>
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="Cancel">退出</button>
|
<!--<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="btn_print">打印</button>-->
|
<!--<button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="HideColumn" id="HideColumn">隐藏列设置</button>-->
|
</div>
|
</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>
|
<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-col-xs3 layui-inline">
|
<label class="layui-form-label">单据号</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
|
<input type="hidden" name="HInterID" id="HInterID" 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="HDeptName" id="HDeptName" onmouseover="this.title=this.value" style="float: left; width: 150px; background-color: #efefef4d; display: inline-block;" readonly>
|
<input type="hidden" name="HDeptID" id="HDeptID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchDept" id="btnSearchDept" style="width: 40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</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="HSupName" id="HSupName" onmouseover="this.title=this.value" style="float: left; width: 150px; background-color: #efefef4d; display: inline-block;" readonly>
|
<input type="hidden" name="HSupID" id="HSupID" value="0">
|
<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearchSup" id="btnSearchSup" style="width: 40px;">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
|
</button>
|
</div>
|
</div>
|
<div class="layui-col-xs3 layui-inline">
|
<label class="layui-form-label">派工日期</label>
|
<div class="layui-input-inline">
|
<input type="date" class="layui-input" name="HDate" id="HDate">
|
</div>
|
</div>
|
</div>
|
<div class="layui-row">
|
<div class="layui-col-xs6 layui-inline">
|
<label class="layui-form-label" style="width:12.5%">备注</label>
|
<div class="layui-input-inline">
|
<input type="text" class="layui-input" name="HRemark" id="HRemark" style="width:600px;">
|
</div>
|
</div>
|
<div class="layui-col-xs3 layui-inline" style="display:none">
|
<label class="layui-form-label">源单信息</label>
|
<div class="layui-input-inline">
|
<input type="hidden" name="HMainSourceBillType" id="HMainSourceBillType" value="0">
|
<input type="hidden" name="HMainSourceInterID" id="HMainSourceInterID" value="0">
|
<input type="hidden" name="HMainSourceEntryID" id="HMainSourceEntryID" value="0">
|
<input type="hidden" name="HMainSourceBillNo" id="HMainSourceBillNo" 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="HMaker" id="HMaker" style="background-color:#efefef4d;" readonly>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label" style="width: 85px;">审核人</label>
|
<div class="layui-input-block" style="margin-left: 120px;">
|
<input type="text" class="layui-input" name="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="HCloseMan" id="HCloseMan" 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="HCloseDate" id="HCloseDate" 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="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="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>
|
</div>
|
</script>
|
</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
|
, laydate = layui.laydate
|
, element = layui.element;
|
var option;
|
|
//#endregion
|
|
//#region 进入页面即加载
|
|
//初始化界面
|
set_ClearBill();
|
|
var params = get_UrlVars();
|
if (typeof (params[params[0]]) == "undefined") {
|
var OperationType = -1;//操作类型
|
} else {
|
var OperationType = params[params[0]];//操作类型
|
var linterid = params[params[1]];//源单id
|
var HEntryID = params[params[2]];//源单子id
|
var HIeID = params[params[3]]; //源单id + 源单子id
|
}
|
|
//工序委外派工新增
|
if (OperationType == 1) {
|
$.ajax({
|
url: GetWEBURL() + "/Web/GetMAXNum",
|
type: "GET",
|
data: { "HBillType": '3740' },
|
success: function (d) {
|
//$("#HInterID").val(d.data[0].HInterID);
|
$("#HBillNo").val(d.data[0].HBillNo);
|
$("#HMakeDate").val(Format(new Date(), "yyyy-MM-dd hh:mm:ss"));
|
$("#HMaker").val(sessionStorage["HUserName"]);
|
}
|
});
|
//查询工序流转卡
|
get_ProcessExchange();
|
//初始化界面
|
set_ClearBill();
|
} else if (OperationType == 3) {
|
//初始化界面
|
set_ClearBill();
|
RoadBillMain(linterid);
|
}
|
|
//#endregion
|
|
//#region 触发事件:包括form.on(){}格式的所有点击事件、选择事件等
|
|
//头工具栏事件
|
table.on('toolbar(mainTable)', function (obj) {
|
var checkStatus = table.checkStatus('mainTable')
|
, data = checkStatus.data;
|
//新增行表格数据
|
var NewRow = {
|
"HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "", "HSourceBillType": "",
|
"HOrderBillNo": '', "HMaterID": 0, "HMaterNumber": '', "HMaterName": "", "HMaterModel": "", "HQty": 0, "HEntrustType": "", "HNextProcName": "",
|
"HPrice": 0, "HOutQty": 0, "HInQty": 0, "HInDate": new Date(), "HWorkProcFlow": '', "HMaterLenModel": "", "HMaterQty": 0, "HRemark": ''
|
};
|
|
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);//将数据渲染到表格上
|
}
|
break;
|
}
|
});
|
|
//行内事件
|
table.on('tool(mainTable)', function (obj) {
|
var data = obj.data;
|
var rowIndex = $(obj.tr).attr("data-index");
|
if (obj.event === 'del') {
|
layer.confirm('真的删除行吗?', function (index) {
|
if (rowIndex === '0') {
|
layer.msg('首行无法删除!!!');
|
} else {
|
obj.del();
|
option.data = table.cache["mainTable"];//将数据绑定到data上
|
layer.close(index);
|
}
|
});
|
}
|
|
var data = obj.data;
|
if (obj.event == 'HInDate') {
|
var field = $(this).data('field');
|
laydate.render({
|
elem: this.firstChild
|
, show: true //直接显示
|
, closeStop: this
|
, done: function (nowDate) {
|
//时间选择完成,行数据更新
|
data[field] = nowDate;
|
obj.update(data);
|
//刷新复选框
|
//checkRefresh();
|
}
|
});
|
}
|
|
//#region [ 表体F7事件 ]
|
$(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
|
if (event.key == "F7") {
|
if (obj.event == 'HMaterCheck') {
|
layer.open({
|
type: 2,
|
skin: 'layui-layer-rim', //加上边框
|
title: '产品列表',
|
closeBtn: 1,
|
shift: 2,
|
area: ['90%', '90%'],
|
maxmin: true,
|
content: ['../../../views/Baseset/基础资料/Gy_MaterialList.html', 'yes'],
|
btn: ['确定', '取消']
|
, btn1: function (index, layero) {
|
//按钮【按钮一】的回调
|
var iframeWindow = window['layui-layer-iframe' + index];
|
var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');
|
if (checkStatus.data.length === 0) {
|
return layer.msg('请选择数据');
|
}
|
obj.update({
|
HMaterName: checkStatus.data[0].HName
|
, HMaterID: checkStatus.data[0].HItemID
|
, HMaterNumber: checkStatus.data[0].HNumber
|
, HMaterModel: checkStatus.data[0].HModel
|
});
|
|
layer.close(layer.index);
|
}
|
, btn2: function (index, layero) {
|
},
|
end: function () {
|
|
}
|
});
|
}
|
|
obj.event = "";
|
return false;
|
}
|
})
|
//#endregion
|
|
});
|
|
//保存提交
|
form.on('submit(btnSave)', function (data) {//提交
|
//if (AllowLoadData(data)) {
|
set_AddNew(data);
|
//}
|
});
|
|
//退出
|
form.on('submit(Cancel)', function (data) {
|
if (OperationType != "") {
|
Pub_Close(1);
|
}
|
});
|
|
//打印
|
form.on('submit(btn_print)', function (data) {
|
get_print(data);
|
});
|
|
//选择申请部门弹窗
|
form.on('submit(btnSearchDept)', function () {
|
layer.open({
|
type: 2
|
, area: ['80%', '80%']
|
, title: '申请部门'
|
, shade: 0.6 //遮罩透明度
|
//, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../Baseset/基础资料/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 === 0) {
|
return layer.msg('请选择数据');
|
}
|
$("#HDeptName").val(checkStatus.data[0].HName);
|
$("#HDeptID").val(checkStatus.data[0].HItemID);
|
layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) {
|
//按钮【按钮二】的回调
|
//return false 开启该代码可禁止点击该按钮关闭
|
},
|
end: function () {
|
|
},
|
success: function (layero, index) {
|
|
}
|
})
|
});
|
|
//选择外协供应商弹窗
|
form.on('submit(btnSearchSup)', function () {
|
layer.open({
|
type: 2
|
, area: ['80%', '80%']
|
, title: '外协供应商'
|
, shade: 0.6 //遮罩透明度
|
//, maxmin: true //允许全屏最小化
|
, anim: 0 //0-6的动画形式,-1不开启
|
, content: ['../../基础资料/采购基础资料/Gy_Supplier.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('请选择数据');
|
}
|
$("#HSupName").val(checkStatus.data[0].供应商名称);
|
$("#HSupID").val(checkStatus.data[0].HItemID);
|
layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
|
}
|
, btn2: function (index, layero) {
|
//按钮【按钮二】的回调
|
//return false 开启该代码可禁止点击该按钮关闭
|
},
|
end: function () {
|
|
},
|
success: function (layero, index) {
|
|
}
|
})
|
});
|
|
//#region 此页面所有的方法
|
// 初始化界面
|
function set_ClearBill() {
|
$("#HDate").val(Format(new Date(new Date()), "yyyy-MM-dd"));//开始日期
|
//初始化表格
|
set_InitGrid();
|
}
|
|
//初始化表格
|
function set_InitGrid() {
|
//表头
|
columns = [ //表头
|
{ type: 'checkbox', totalRowText: '合计行' }
|
, { type: 'numbers', title: '序号', totalRow: true }
|
, { field: 'HMainID', title: '委外派工单主ID', hide: true }// 用于打印时获取数据
|
, { field: 'HEntryID', title: '委外派工单子ID', hide: true }// 用于打印时获取数据
|
, { field: 'HOrderBillNo', title: '订单号' }
|
, { field: 'HSourceBillNo', title: '流转卡号', width: 165 }
|
, { field: 'HMaterID', title: '加工产品', hide: true }
|
, { field: 'HMaterNumber', title: '加工产品代码' }
|
, { field: 'HMaterName', title: '加工产品名称', width:220 }
|
, { field: 'HMaterModel', title: '加工产品规格' }
|
, { field: 'HQty', title: '委外数量', edit: 'text', width:90 }
|
, { field: 'HEntrustType', title: '委外加工类型', edit: 'text' }
|
, { field: 'HNextProcName', title: '委外下道工序', edit: 'text' }
|
, { field: 'HPrice', title: '加工单价', edit: 'text', width: 90 }
|
, { field: 'HOutQty', title: '转出数量', edit: 'text', width: 90 }
|
, { field: 'HInQty', title: '接收数量', edit: 'text', width: 90}
|
, { field: 'HInDate', title: '回厂时间', width: 120, templet: "<div>{{d.HInDate ==null ?'':layui.util.toDateString(d.HInDate, 'yyyy-MM-dd')}}</div>", event: 'HInDate' }
|
, { field: 'HWorkProcFlow', title: '产品工艺', edit: 'text' }
|
, { field: 'HMaterLenModel', title: '料件尺寸', edit: 'text'}
|
, { field: 'HMaterQty', title: '板材张数', edit: 'text' }
|
, { field: 'HRemark', title: '备注', edit: 'text'}
|
, { field: 'HSourceInterID', title: '流转卡ID', hide: true }
|
, { field: 'HSourceEntryID', title: '流转卡子ID', hide: true }
|
, { field: 'HSourceBillType', title: '单据类型', hide: true }
|
, { fixed: 'right', title: '操作', toolbar: '#barDemo' }
|
];
|
option = {
|
id: 'mainTable'
|
, elem: '#mainTable'
|
, toolbar: '#toolbarDemo'
|
, page: false
|
, cellMinWidth: 120
|
, height: 400
|
, cols: [columns]
|
, limit: Number.MAX_VALUE//默认显示全部
|
, done: function (res, curr, count) {
|
option.data = res.data;
|
//去掉下拉框失焦事件否则在下拉框里输入值
|
$('.layui-form-select').find('input').unbind("blur");
|
//表格重载回显下拉框里的数据
|
$('tr').each(function (e) {
|
var $cr = $(this);
|
var dataIndex = $cr.attr("data-index");
|
$.each(option.data, function (index, value) {
|
if (value.LAY_TNDEX == dataIndex) {
|
$cr.find('input').val(value.HSupFlag);
|
}
|
});
|
});
|
}
|
, done: function (res, curr, count) {
|
|
}
|
};
|
option.data = [{
|
"HSourceInterID": 0, "HSourceEntryID": 0, "HSourceBillNo": "", "HSourceBillType": "",
|
"HOrderBillNo": '', "HMaterID": 0, "HMaterNumber": '', "HMaterName": "", "HMaterModel": "", "HQty": 0, "HEntrustType": "", "HNextProcName": "",
|
"HPrice": 0, "HOutQty": 0, "HInQty": 0, "HInDate": new Date(),"HWorkProcFlow": '', "HMaterLenModel": "", "HMaterQty": 0, "HRemark": ''
|
}];
|
table.render(option);
|
|
}
|
|
//查询工序流转卡
|
function get_ProcessExchange() {
|
var sWhere = " where hmainid in (" + linterid + ") and HEntryID in (" + HEntryID + ") and ieid in (" + HIeID + ")";
|
//编辑加载数据
|
$.ajax({
|
url: GetWEBURL() + 'Sc_ProcExchSendWorkBill/GetProcessExchangeBillSub',
|
type: "GET",
|
data: { "sWhere": sWhere },
|
success: function (result) {
|
if (result.count == 1) {
|
$("#HWorkShopName").val(result.data[0]["生产车间"]);
|
$("#HWorkShopID").val(result.data[0]["HWorkShopID"]);
|
$("#HPRDORGName").val(result.data[0]["组织"]);
|
$("#HPRDORGID").val(result.data[0]["HPRDORGID"]);
|
//$("#HICMOBillNo").val(result.data[0]["任务单号"]);
|
//$("#HICMOInterID").val(result.data[0]["hicmointerid"]);
|
//$("#HICMOEntryID").val(result.data[0]["HICMOEntryID"]);
|
$("#HMainSourceBillType").val(result.data[0]["源单类型"]);
|
$("#HMainSourceInterID").val(result.data[0]["源单主内码"]);
|
$("#HMainSourceEntryID").val(result.data[0]["源单子内码"]);
|
$("#HMainSourceBillNo").val(result.data[0]["流转卡号"]);
|
//$("#HExplanation").val(result.data[0]["摘要"]);
|
//$("#HRemark").val(result.data[0]["表头备注"]);
|
//子表 赋值
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
rowdata.push(
|
{
|
"HSourceInterID": result.data[i]["hmainid"], "HSourceEntryID": result.data[i]["HEntryID"], "HSourceBillNo": result.data[i]["单据号"], "HSourceBillType": result.data[i]["HBillType"],
|
"HOrderBillNo": result.data[i]["任务单号"], "HMaterID": result.data[i]["HMaterID"], "HMaterNumber": result.data[i]["产品代码"], "HMaterName": result.data[i]["产品名称"], "HMaterModel": result.data[i]["规格型号"], "HQty": 0, "HEntrustType": "", "HNextProcName": "",
|
"HPrice": 0, "HOutQty": 0, "HInQty": 0, "HInDate": new Date(), "HWorkProcFlow": '', "HMaterLenModel": "", "HMaterQty": 0, "HRemark": ''
|
}
|
)
|
}
|
option.data = rowdata;
|
table.render(option);
|
form.render('select');
|
} else {
|
layer.msg(result.code + result.Message, { icon: 5 });
|
}
|
}, error: function () {
|
layer.close(index0);
|
layer.alert("接口请求失败!", { icon: 5 });
|
}
|
});
|
|
}
|
|
//非空验证
|
function AllowLoadData(data) {
|
|
}
|
|
//保存HMaker
|
function set_AddNew(data) {
|
var num_1 = [];
|
for (var i = 0; i < table.cache["mainTable"].length; i++) {
|
if (table.cache["mainTable"][i] != "") {
|
table.cache["mainTable"][i].LAY_TABLE_INDEX = i;
|
num_1.push(table.cache["mainTable"][i])
|
}
|
}
|
var sMainStr = JSON.stringify(data.field);
|
var sSubStr = JSON.stringify(num_1);
|
var sMainSub = sMainStr + ';' + sSubStr + ';' + OperationType + ";" + sessionStorage["HUserName"];
|
var index = layer.load();
|
$.ajax({
|
type: "POST",
|
url: GetWEBURL() + "/WW_EntrustWorkOrderBill/SaveEntrustWorkOrderBill",
|
async: true,
|
data: { "msg": 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 hmainid=" + linterid;
|
$.ajax({
|
url: GetWEBURL() + "/WW_EntrustWorkOrderBill/WW_EntrustWorkOrderBillList",
|
type: "GET",
|
async: false,
|
data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
|
success: function (result) {
|
if (result.count == 1) {
|
//主表
|
$("#HBillNo").val(result.data[0]["单据号"]);
|
$("#HInterID").val(result.data[0]["hmainid"]);
|
$("#HDeptName").val(result.data[0]["部门名称"]);
|
$("#HDeptID").val(result.data[0]["HDeptID"]);
|
$("#HSupName").val(result.data[0]["供应商名称"]);
|
$("#HSupID").val(result.data[0]["HSupID"]);
|
$("#HRemark").val(result.data[0]["表头备注"]);
|
|
var rowdata = [];
|
for (var i = 0; i < result.data.length; i++) {
|
//子表 赋值
|
rowdata.push({
|
"HSourceInterID": result.data[i]["hmainid"], "HSourceEntryID": result.data[i]["HEntryID"], "HSourceBillNo": result.data[i]["流转卡号"], "HSourceBillType": result.data[i]["HBillType"],
|
"HOrderBillNo": result.data[i]["订单号"], "HMaterID": result.data[i]["HMaterID"], "HMaterNumber": result.data[i]["加工产品代码"], "HMaterName": result.data[i]["加工产品名称"], "HMaterModel": result.data[i]["规格型号"], "HQty": result.data[i]["委外数量"], "HEntrustType": result.data[i]["委外加工类型"], "HNextProcName": result.data[i]["委外下道工序"],
|
"HPrice": result.data[i]["加工单价"], "HOutQty": result.data[i]["转出数量"], "HInQty": result.data[i]["接收数量"], "HInDate": result.data[i]["回厂时间"],"HWorkProcFlow": result.data[i]["产品工艺"], "HMaterLenModel": result.data[i]["料件尺寸"], "HMaterQty": result.data[i]["板材张数"], "HRemark": result.data[i]["表体备注"]
|
});
|
}
|
option.data = rowdata;
|
table.render(option);
|
} else {
|
layer.msg(result.code + result.Message, { icon: 5 });
|
}
|
}
|
})
|
}
|
|
//打印
|
function get_print(data) {
|
|
}
|
|
function get_UrlVars() {
|
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>
|