<!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">
|
</head>
|
<body>
|
<div class="layui-fluid" style="padding-bottom: 0;">
|
<div class="layui-card">
|
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
|
<div class="layui-form-item">
|
<div class="layui-inline">
|
<label class="layui-form-label">出库单号</label>
|
<div class="layui-input-inline">
|
<input type="text" id="BillCode" name="BillCode" placeholder="出库单号"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">执行状态</label>
|
<div class="layui-input-inline" style="">
|
<select name="ExecuteFlag" id="ExecuteFlag" lay-filter="ExecuteFlag" lay-search>
|
<option value=""></option>
|
<option value="0">等待执行</option>
|
<option value="1">正在分配</option>
|
<option value="2">正在执行</option>
|
<option value="3">执行完毕</option>
|
<option value="5">上传完毕</option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">批次</label>
|
<div class="layui-input-inline">
|
<input type="text" id="LotNo" name="LotNo" placeholder="批次"
|
autocomplete="off" class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">单据类型</label>
|
<div class="layui-input-inline">
|
<select name="ExportBillType" id="ExportBillType" lay-filter="ExportBillType" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">物品编码</label>
|
<div class="layui-input-inline">
|
<input type="text" id="GoodsCode" name="GoodsCode" placeholder="物品编码" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">物品名称</label>
|
<div class="layui-input-inline">
|
<input type="text" id="GoodsName" name="GoodsName" placeholder="物品名称" autocomplete="off"
|
class="layui-input">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">开始时间</label>
|
<div class="layui-input-inline">
|
<input type="text" autocomplete="off" id="StartTime" class="layui-input"
|
placeholder="开始时间">
|
</div>
|
</div>
|
<div class="layui-inline">
|
<label class="layui-form-label">结束时间</label>
|
<div class="layui-input-inline">
|
<input type="text" autocomplete="off" id="EndTime" class="layui-input"
|
placeholder="结束时间">
|
</div>
|
</div>
|
<div class="layui-inline" id="divPickingArea" style="display: none;">
|
<label class="layui-form-label">拣货区</label>
|
<div class="layui-input-inline">
|
<select name="PickingArea" id="PickingArea" lay-search>
|
<option value=""></option>
|
</select>
|
</div>
|
</div>
|
<div class="layui-inline">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" lay-submit
|
lay-filter="LAY-app-contlist-search">
|
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索
|
</button>
|
</div>
|
</div>
|
</div>
|
<div class="layui-card-body">
|
<div style="position: relative;">
|
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
<ul class="layui-tab-title">
|
<li class="layui-this">总单</li>
|
<li>明细</li>
|
</ul>
|
<div class="layui-tab-content">
|
<div class="layui-tab-item layui-show">
|
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
|
</div>
|
<div class="layui-tab-item">
|
<table id="LAY-app-content-list2" lay-filter="LAY-app-content-list2"></table>
|
</div>
|
</div>
|
</div>
|
<div style="padding-bottom: 1px; position: absolute; top: 0; right: 16px;">
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list" data-type="add" id="approvalBtn">
|
<i class="layui-icon"></i>添加
|
</button>
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-list layui-hide layui-btn-danger" data-type="hide">
|
<i class="layui-icon"></i>隐藏按钮
|
</button>
|
</div>
|
</div>
|
<script type="text/html" id="buttonTpl">
|
{{# if(d.ExecuteFlag=='0'){ }}
|
<button class="layui-btn layui-btn-radius layui-btn-xs">等待执行</button>
|
{{# } else if(d.ExecuteFlag=='1') { }}
|
<button class="layui-btn layui-btn-radius layui-btn-warm layui-btn-xs">正在分配</button>
|
{{# } else if(d.ExecuteFlag=='2') { }}
|
<button class="layui-btn layui-btn-radius layui-btn-danger layui-btn-xs">正在执行</button>
|
{{# } else if(d.ExecuteFlag=='3') { }}
|
<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">执行完毕</button>
|
{{# } else{ }}
|
<button class="layui-btn layui-btn-radius layui-btn-normal layui-btn-xs">上传完毕</button>
|
{{# } }}
|
</script>
|
<script type="text/html" id="table-content-list">
|
{{# if(d.ExecuteFlag == '0' && d.WarehouseName != '平库'){ }}
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="auto">
|
<i class="layui-icon layui-icon-ok"></i>自动分配
|
</a>
|
{{# } }}
|
{{# if(d.ExecuteFlag == '0' && d.Source == 'WMS' && d.WarehouseName == '原辅料库'){ }}
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="pickArea">
|
<i class="layui-icon layui-icon-edit"></i>拣货区
|
</a>
|
{{# } }}
|
{{# if(d.ExecuteFlag == '0' && d.Source == 'WMS'){ }}
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">
|
<i class="layui-icon layui-icon-edit"></i>编辑
|
</a>
|
{{# } }}
|
{{# if(d.ExecuteFlag == '3'){ }}
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="finish">
|
<i class="layui-icon layui-icon-ok"></i>关单
|
</a>
|
{{# } }}
|
{{# if(d.ExecuteFlag == '1'){ }}
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancel">
|
<i class="layui-icon layui-icon-delete"></i>取消分配
|
</a>
|
{{# } }}
|
{{# if(d.ExecuteFlag == '0'){ }}
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">
|
<i class="layui-icon layui-icon-delete"></i>删除
|
</a>
|
{{# } }}
|
</script>
|
<script type="text/html" id="table-content-list2">
|
{{# if(d.Status == 0){ }}
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="wan">
|
<i class="layui-icon layui-icon-ok"></i>手动分配
|
</a>
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
|
<i class="layui-icon layui-icon-delete"></i>删除
|
</a>
|
{{# } }}
|
</script>
|
</div>
|
</div>
|
</div>
|
|
<script src="../../../layuiadmin/layui/layui.js"></script>
|
<script src="../../../js/public.js"></script>
|
<script src="../../../js/jquery-3.5.1.min.js"></script>
|
<script src="../../../js/jquery.cookie.js"></script>
|
<script>
|
var uid = $.cookie('userId');
|
layui.config({
|
base: '../../../layuiadmin/' //静态资源所在路径
|
}).extend({
|
index: 'lib/index' //主入口模块
|
}).use(['index', 'table', 'laypage', 'layer', 'laydate'], function() {
|
var table = layui.table,
|
form = layui.form,
|
laypage = layui.laypage,
|
layer = layui.layer;
|
laydate = layui.laydate;
|
|
laydate.render({
|
elem: '#StartTime'
|
, format: 'dd-MM-yyyy' //可任意组合
|
});
|
laydate.render({
|
elem: '#EndTime'
|
, format: 'dd-MM-yyyy' //可任意组合
|
});
|
|
var xqid = "";
|
initPage();
|
refreshTable();
|
var tableIns;
|
function initPage(){
|
sendData(IP + "/Export/GetExportNotifyInit", {}, 'post', function(res) {
|
var html = '';
|
if (res.code == 1) { //成功
|
for (var i = 0; i < res.PickingArea.length; i++) {
|
html += '<option value =' + res.PickingArea[i].Code +
|
'>' + res.PickingArea[i].TypeName +
|
'</option>';
|
}
|
$("#PickingArea").append(html);
|
html = '';
|
for (var i = 0; i < res.BillType.length; i++) {
|
html += '<option value =' + res.BillType[i].BillTypeCode +
|
'>' + res.BillType[i].BillTypeName +
|
'</option>';
|
}
|
$("#ExportBillType").append(html);
|
form.render('select');
|
} else { //不成功
|
layer.msg('获取信息失败!', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
|
}
|
function refreshTable() {
|
var param = {
|
UserId: uid,
|
BillCode: $("#BillCode").val(),
|
ExecuteFlag: $("#ExecuteFlag").val(),
|
LotNo: $("#LotNo").val(),
|
GoodsCode: $("#GoodsCode").val(),
|
GoodsName: $("#GoodsName").val(),
|
StartTime: $("#StartTime").val(),
|
EndTime: $("#EndTime").val(),
|
BillType: $("#ExportBillType").val(),
|
};
|
var url = IP + "/Export/GetExportBillList";
|
table.render({
|
elem: '#LAY-app-content-list',
|
url: url,
|
method: 'POST',
|
height: 'full-210',
|
id: 'LAY-app-content-list',
|
where: param,
|
contentType: 'application/json',
|
page: true,
|
even: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
done: function(){
|
$("a[lay-event ='auto']").hide();
|
$("a[lay-event ='edit']").hide();
|
$("a[lay-event ='finish']").hide();
|
$("a[lay-event ='delete']").hide();
|
initPermission();
|
},
|
cols: [
|
[{
|
title: '序号',
|
type: 'numbers',
|
width: 60,
|
fixed: 'left',
|
},{
|
field: 'WarehouseName',
|
title: '所属仓库',
|
align: 'center',
|
fixed: 'left',
|
width: 100
|
}, {
|
field: 'BillCode',
|
title: '出库单号',
|
align: 'center',
|
fixed: 'left',
|
width: 180,
|
},{
|
field: 'BillTypeName',
|
title: '单据类型',
|
align: 'center',
|
width: 100
|
},{
|
field: 'ExecuteFlag',
|
title: '执行状态',
|
templet: '#buttonTpl',
|
align: 'center',
|
width: 100
|
},{
|
field: 'Source',
|
title: '来源',
|
align: 'center',
|
width: 100
|
},{
|
field: 'PickingArea',
|
hide: true
|
},{
|
field: 'PickingAreaName',
|
title: '拣货区',
|
align: 'center',
|
},
|
{
|
field: 'CreateUserName',
|
title: '创建人',
|
align: 'center',
|
},
|
{
|
field: 'CreateTime',
|
title: '创建时间',
|
align: 'center',
|
templet: function(d) {
|
return formatDate(d.CreateTime);
|
},
|
},
|
{
|
field: 'UpdateUserName',
|
title: '修改人',
|
align: 'center',
|
},
|
{
|
field: 'UpdateTime',
|
title: '修改时间',
|
align: 'center',
|
templet: function(d) {
|
return formatDate(d.UpdateTime);
|
}
|
}, {
|
title: '操作',
|
fixed: 'right',
|
align: 'left',
|
toolbar: '#table-content-list',
|
width: 300
|
}
|
]
|
]
|
});
|
}
|
function refreshTablemx(billCode) {
|
var param = {
|
BillCode: billCode,
|
};
|
var url = IP + "/Export/GetExportBillDetailList";
|
table.render({
|
elem: '#LAY-app-content-list2',
|
url: url,
|
method: 'POST',
|
height: 'full-210',
|
id: 'LAY-app-content-list2',
|
where: param,
|
contentType: 'application/json',
|
page: true,
|
even: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
done: function(){
|
$("a[lay-event ='wan']").hide();
|
$("a[lay-event ='del']").hide();
|
initPermission();
|
},
|
cols: [
|
[{
|
field: 'Id',
|
hide: true
|
},{
|
title: '序号',
|
type: 'numbers',
|
width: 60,
|
fixed: 'left',
|
},{
|
field: 'WarehouseId',
|
hide: true
|
},{
|
field: 'ExportBillCode',
|
title: '出库单号',
|
align: 'center',
|
fixed: 'left',
|
width: 180
|
}, {
|
field: 'GoodsCode',
|
title: '物品编码',
|
align: 'center',
|
width: 100
|
}, {
|
field: 'GoodsName',
|
title: '物品名称',
|
align: 'center',
|
width: 200
|
}, {
|
field: 'GoodsStandard',
|
title: '物品规格',
|
align: 'center'
|
}, {
|
field: 'LotNo',
|
title: '批次',
|
align: 'center'
|
}, {
|
field: 'ProductionDate',
|
title: '生产日期',
|
align: 'center',
|
templet: function(d) {
|
return formatDate(d.ProductionDate);
|
},
|
hide: true
|
}, {
|
field: 'GoodsStatus',
|
title: '物品状态',
|
align: 'center',
|
hide: true
|
}, {
|
field: 'GoodsUnit',
|
title: '计量单位',
|
align: 'center'
|
}, {
|
field: 'PackagingName',
|
title: '物品包装',
|
align: 'center'
|
}, {
|
field: 'ExportQuantity',
|
title: '计划数量',
|
align: 'center',
|
fixed: 'right',
|
width: 90
|
}, {
|
field: 'AllocateQuantity',
|
title: '分配数量',
|
align: 'center',
|
fixed: 'right',
|
width: 90
|
}, {
|
field: 'FactQuantity',
|
title: '已下发数量',
|
fixed: 'right',
|
align: 'center',
|
width: 100
|
}, {
|
field: 'CompleteQuantity',
|
title: '完成数量',
|
fixed: 'right',
|
align: 'center',
|
width: 90
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 180,
|
align: 'left',
|
toolbar: '#table-content-list2'
|
}
|
]
|
]
|
});
|
}
|
// table.reload()
|
// 表单需要的变量
|
var infoOptions = {
|
elem: '#LAY-app-content-list',
|
height: 'full-100',
|
id: 'LAY-app-content-list',
|
page: true,
|
limit: pageCnt,
|
limits: pageLimits,
|
cellMinWidth: 60, //全局定义常规单元格的最小宽度,layui 2.2.1 新增
|
cols: [
|
[ {
|
field: 'ExportId',
|
title: 'ExportId',
|
type: 'checkbox',
|
width: 50,
|
sort: true,
|
fixed: 'left'
|
}, {
|
field: 'WarehouseName',
|
title: '所属仓库',
|
align: 'center',
|
width: 150,
|
fixed: 'left'
|
}, {
|
field: 'ExportBillCode',
|
title: '出库单号',
|
width: 170,
|
align: 'center',
|
fixed: 'left',
|
sort: true,
|
}, {
|
field: 'ExportListNo',
|
title: '序号',
|
align: 'center',
|
width: 60,
|
}, {
|
field: 'ExportBillType',
|
title: '单据类型',
|
align: 'center',
|
width: 90,
|
}, {
|
field: 'GoodsCode',
|
title: '物品编码',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'GoodsName',
|
title: '物品名称',
|
align: 'center',
|
width: 200,
|
}, {
|
field: 'GoodsStandard',
|
title: '物品规格',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'ExportLotNo',
|
title: '批次',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'ExportGoodsStatus',
|
title: '物品状态',
|
align: 'center',
|
width: 105,
|
}, {
|
field: 'GoodsUnit',
|
title: '计量单位',
|
align: 'center',
|
width: 100,
|
}, {
|
field: 'ExportAddDateTime',
|
title: '建单时间',
|
align: 'center',
|
width: 180
|
}, {
|
field: 'ExportQuantity',
|
title: '计划数量',
|
align: 'center',
|
fixed: 'right',
|
width: 90
|
}, {
|
field: 'ExportFactQuantity',
|
title: '已下发数量',
|
fixed: 'right',
|
align: 'center',
|
width: 100
|
}, {
|
field: 'ExportCompleteQuantity',
|
title: '完成数量',
|
fixed: 'right',
|
align: 'center',
|
width: 90
|
}, {
|
field: 'ExportExecuteFlag',
|
templet: '#buttonTpl',
|
title: '执行状态',
|
fixed: 'right',
|
align: 'center',
|
width: 90,
|
}, {
|
title: '操作',
|
fixed: 'right',
|
width: 178,
|
align: 'center',
|
toolbar: '#table-content-list'
|
}]
|
],
|
|
};
|
form.on('submit(LAY-app-contlist-search)', function(data) {
|
if ($(".layui-tab-title>li[class='layui-this']").html() == "总单") {
|
refreshTable();
|
}
|
if ($(".layui-tab-title>li[class='layui-this']").html() == "明细") {
|
refreshTablemx(xqid);
|
}
|
});
|
//
|
active = {
|
add: function() {
|
layer.open({
|
type: 2,
|
title: '添加出库单',
|
content: 'ExportBillListForm.html',
|
maxmin: true,
|
area: ['1020px', '90%'],
|
//btn: ['确定', '取消'],
|
yes: function(index, layero) {
|
var iframeWindow = window['layui-layer-iframe' + index],
|
submitID = 'layuiadmin-app-form-submit',
|
submit = layero.find('iframe').contents().find('#' + submitID);
|
//监听提交
|
iframeWindow.layui.form.on('submit(' + submitID + ')', function(data) {
|
var field = data.field; //获取提交的字段
|
console.log(field);
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
GoodId: 0,
|
GoodsCode: field.goodsCode,
|
GoodsName: field.goodsName,
|
GoodsStandard: field.goodsStandard,
|
GoodsStockHigh: field.goodsStockHigh,
|
GoodsStockLow: field.goodsStockLow,
|
GoodsValidityDay: field.goodsValidityDay,
|
GoodsAlarmDay: field.goodsAlarmDay,
|
GoodsRemark: field.goodsRemark,
|
GoodsAreaId: field.goodsArea,
|
GoodsUnit: field.goodsUnit
|
};
|
});
|
submit.trigger('click');
|
}
|
});
|
},
|
};
|
$('.layui-btn.layuiadmin-btn-list').on('click', function() {
|
var type = $(this).data('type');
|
active[type] ? active[type].call(this) : '';
|
});
|
$(function() {
|
$("#approvalBtn").hide();
|
});
|
var element = layui.element;
|
var houseId = 0;
|
var userId = $.cookie('userId');
|
var param = {
|
Id: userId
|
}
|
var xml = '';
|
function getchiled(data, mainId) {
|
if (data) {
|
var list = data.filter(item => item.ParentId == mainId);
|
if (list) {
|
for (var i = 0; i < list.length; i++) {
|
var id = list[i].Id;
|
//查询有无子菜单
|
var count = data.filter(item => item.ParentId == id).length;
|
if (count > 0) {
|
xml = xml +
|
'<dd>' +
|
'<a href="javascript:;">' + list[i].Name + '</a>' +
|
'<dl class="layui-nav-child">';
|
getchiled(data, id);
|
xml = xml +
|
'</dl></dd>';
|
|
} else {
|
xml = xml +
|
'<dd>' +
|
'<a lay-href="' + list[i].Url + '">' + list[i].Name + '</a>' +
|
'</dd>';
|
|
}
|
}
|
|
}
|
|
}
|
}
|
initPermission();
|
var menuList;
|
function initPermission(){
|
sendData(IP + "/Menu/GetPermission", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
var list = res.data.filter(item => item.Layer == 0);
|
if (list) {
|
for (var i = 0; i < list.length; i++) {
|
xml = xml +
|
'<li class="layui-nav-item">' +
|
'<a href="javascript:;" lay-tips=' + list[i].Icon + ' lay-direction="2">' +
|
// '<i class="layui-icon ' + list[i].Icon + '"></i>' +
|
'<span class="iconfont ' + list[i].Icon + '"></span>' +
|
'<cite>' + list[i].Name + '</cite>' +
|
'</a>';
|
var id = list[i].Id;
|
//查询有无子菜单
|
var count = res.data.filter(item => item.ParentId == id).length;
|
if (count > 0) {
|
xml = xml +
|
'<dl class="layui-nav-child">';
|
getchiled(res.data, id);
|
xml = xml +
|
'</dl>';
|
}
|
xml = xml +
|
'</li>'
|
}
|
}
|
$("#LAY-system-side-menu").append(xml);
|
element.render("#leftmenu");
|
//$("a[lay-event !=' ']").hide();
|
for (var k = 0; k < res.data.length; k++) {
|
if (res.data[k].ModuleId == "327d4f1e8d3e4d1ba9eca601b32073b5") {
|
$(function() {
|
$("#approvalBtn").show();
|
});
|
}
|
if (res.data[k].ModuleId == "47da9d7de59f40c684e0962346ae780d") {
|
$("a[lay-event ='auto']").show();
|
}
|
if (res.data[k].ModuleId == "831f816113164f4688dbb9c7ddb9c358") {
|
$("a[lay-event ='edit']").show();
|
}
|
if (res.data[k].ModuleId == "42e870ef2e1f496eb9839a89c1f8408a") {
|
$("a[lay-event ='finish']").show();
|
}
|
if (res.data[k].ModuleId == "a82f8187d7f1481ab7373f50bc2c704a") {
|
$("a[lay-event ='delete']").show();
|
}
|
if (res.data[k].ModuleId == "1faa8489850f455eabb5717dbe4fe127") {
|
$("a[lay-event ='wan']").show();
|
}
|
if (res.data[k].ModuleId == "2914cb83e38145feb76445ff22ee0403") {
|
$("a[lay-event ='del']").show();
|
}
|
}
|
} else { //不成功
|
layer.msg('获取信息失败', {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
//回调
|
});
|
}
|
});
|
}
|
var ExportId = "";
|
table.on('tool(LAY-app-content-list)', function(obj) {
|
var data = obj.data;
|
ExportId = data.BillCode;
|
if (obj.event === 'delete') {
|
layer.confirm('确定作废此单据吗?', function(index) {
|
var param = {
|
Id: ExportId,
|
Status:-1,
|
UserId: userId
|
};
|
sendData(IP + "/Export/EditExportBill", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //1秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
} else if (obj.event === 'finish') {
|
layer.confirm('确定完成此单据吗?', function(index) {
|
var param = {
|
Id: ExportId,
|
Status:2,
|
UserId: userId
|
};
|
sendData(IP + "/Export/EditExportBill", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //1秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
}else if(obj.event === 'auto'){
|
autoOut();
|
}else if(obj.event === 'pickArea'){
|
$("#PickingArea").val(data.PickingArea);
|
form.render('select');
|
editPickArea(data.PickingArea);
|
}else if(obj.event === 'cancel'){
|
layer.confirm('确定取消此单据已经分配的货物吗?', function(index) {
|
var param = {
|
Id: ExportId,
|
userId: $.cookie('userId')
|
};
|
sendData(IP + "/Export/CancelAllocate", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
layer.msg(res.msg, {
|
icon: 1,
|
time: 1000 //1秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
}else if(obj.event === 'edit'){
|
layer.open({
|
type: 2,
|
title: '编辑出库单',
|
content: 'ExportBillEdit.html?id=' + ExportId,
|
maxmin: true,
|
area: ['1020px', '90%'],
|
});
|
}
|
});
|
table.on('tool(LAY-app-content-list2)', function(obj) {
|
var data = obj.data;
|
var id = data.Id;
|
var houseId = data.WarehouseId;
|
if(obj.event === 'wan'){
|
handOut(id, houseId);
|
}
|
else if(obj.event === 'del'){
|
delDetail(id);
|
}
|
});
|
function autoOut(){
|
layer.confirm('确定要将选中的单据自动分配吗?', function() {
|
var param = {
|
id: ExportId,
|
userId:$.cookie('userId')
|
};
|
sendData(IP + "/Export/AddExportTaskAuto", param, 'post', function(res) {
|
console.log(res);
|
if (res.code == 1) { //成功
|
layer.msg("操作成功!", {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
}
|
|
function handOut(id, houseId){
|
layer.open({
|
type: 2,
|
title: '手动挑选出库',
|
content: 'ExportBillStockListForm.html?Id='+id+'&houseId='+houseId,
|
maxmin: true,
|
area: ['1100px', '700px'],
|
//btn: ['确定', '取消'],
|
yes: function(index, layero) {
|
var iframeWindow = window['layui-layer-iframe' + index],
|
submitID = 'layuiadmin-app-form-submit',
|
submit = layero.find('iframe').contents().find('#' + submitID);
|
//监听提交
|
iframeWindow.layui.form.on('submit(' + submitID + ')', function(data) {
|
var field = data.field; //获取提交的字段
|
console.log(field);
|
//提交 Ajax 成功后,静态更新表格中的数据
|
var param = {
|
GoodId: 0,
|
GoodsCode: field.goodsCode,
|
GoodsName: field.goodsName,
|
GoodsStandard: field.goodsStandard,
|
GoodsStockHigh: field.goodsStockHigh,
|
GoodsStockLow: field.goodsStockLow,
|
GoodsValidityDay: field.goodsValidityDay,
|
GoodsAlarmDay: field.goodsAlarmDay,
|
GoodsRemark: field.goodsRemark,
|
GoodsAreaId: field.goodsArea,
|
GoodsUnit: field.goodsUnit
|
};
|
});
|
submit.trigger('click');
|
}
|
});
|
}
|
|
function editPickArea(){
|
layer.open({
|
type: 1,
|
title: '编辑拣货区',
|
content: $('#divPickingArea'),
|
maxmin: true,
|
area: ['500px', '300px'],
|
btn: ['确定', '取消'],
|
yes: function(index, layero) {
|
var pa = $('#PickingArea').val();
|
if(pa.trim() != ''){
|
var param = {
|
id: ExportId,
|
pickingArea: pa,
|
userId:$.cookie('userId')
|
};
|
sendData(IP + "/Export/UpdatePickingArea", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
layer.msg("操作成功!", {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
}
|
layer.close(index);
|
}
|
});
|
}
|
|
function delDetail(id){
|
layer.confirm('确定要将选中的单据物品删除吗?', function() {
|
var param = {
|
id: id,
|
userId:$.cookie('userId')
|
};
|
sendData(IP + "/Export/DelDetail", param, 'post', function(res) {
|
if (res.code == 1) { //成功
|
layer.msg("操作成功!", {
|
icon: 1,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {
|
refreshTablemx(xqid);
|
refreshTable();
|
});
|
} else { //不成功
|
layer.msg(res.msg, {
|
icon: 2,
|
time: 2000 //2秒关闭(如果不配置,默认是3秒)
|
}, function() {});
|
}
|
});
|
});
|
}
|
//触发行双击事件
|
table.on('rowDouble(LAY-app-content-list)', function(obj) {
|
$(".layui-tab-title>li").attr("class", "");
|
$('.layui-tab-title>li').eq(1).attr('class', 'layui-this');
|
$('.layui-tab-content .layui-tab-item').attr('class', 'layui-tab-item')
|
$('.layui-tab-content .layui-tab-item').eq(1).attr('class', 'layui-tab-item layui-show')
|
refreshTablemx(obj.data.BillCode);
|
xqid = obj.data.BillCode;
|
});
|
});
|
</script>
|
</body>
|
</html>
|