You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1236 lines
44 KiB
1236 lines
44 KiB
<#import "../master.ftl" as master>
|
|
<@master.layout>
|
|
<style>
|
|
/* 新增的样式 */
|
|
#delivery_fm label {
|
|
width: 135px;
|
|
}
|
|
/* 去下划线 */
|
|
a.disabled-underscore{
|
|
text-decoration: none;
|
|
}
|
|
</style>
|
|
|
|
<div class="page-header">
|
|
<h2>Customer Order Shipment</h2>
|
|
</div>
|
|
|
|
<table id="dg" class="easyui-datagrid" style="width:100%;height:460px;display: none;"
|
|
data-options="pagination: true, pageSize:20, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
queryParams:{status: $('#search_delivery_status').val()},
|
|
url:'/sales/delivery/getSalesDeliverysByCon', method:'POST', toolbar:'#tb'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'deliveryNo',width:90">Delivery No</th>
|
|
<th data-options="field:'ifsDeliveryNo',width:10">IFS Shipment ID</th>
|
|
<th data-options="field:'customerNo',width:110">Customer Part No</th>
|
|
<th data-options="field:'customerName',width:150">Customer Part Desc.</th>
|
|
<th data-options="field:'trackingNo',width:110, align: 'center'">Express Bill No</th>
|
|
<th data-options="field:'createdBy',width:80,align:'left'">Created By</th>
|
|
<th data-options="field:'createdDate',width:100,align:'center',formatter:formatStringTime">Created Time</th>
|
|
<#-- <th data-options="field:'ifsDeliveryNo',width:100,editor:'text'">IFS 单号</th>-->
|
|
<th data-options="field:'status', width:70,editor:'text', formatter: formatStatusRemark">Status</th>
|
|
<th data-options="field:'remark', width:70, editor:'textbox'">Remark</th>
|
|
<th data-options="field:'id',width:200, formatter: formatDeliveryAction">Actions</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
|
|
<div id="tb" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
Delivery No: <input class="easyui-textbox" id="search_delivery_no" name="deliveryNo" style="width:100px">
|
|
IFS Shipment No: <input class="easyui-textbox" id="search_ifs_delivery_no" name="ifsDeliveryNo" style="width:100px">
|
|
Status: <select class="easyui-combobox" panelHeight="auto" name="status" id="search_delivery_status" style="width:100px">
|
|
<option value="ALL">ALL</option>
|
|
<option value="Created">Created</option>
|
|
<option value="Boxing">Packing</option>
|
|
<option value="Boxed">Packed</option>
|
|
<option value="Shipped">Shipped</option>
|
|
</select>
|
|
<a id="queryLink" onclick="searchData()" class="easyui-linkbutton" iconCls="icon-search">Search</a>
|
|
|
|
<a href="javascript:void(0)" id="tbAdd" class="easyui-linkbutton" iconCls="icon-add" onclick="newSalesDeliveryModal()">New Shipment</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新增出库单 -->
|
|
<div id="sales_delivery_modal" class="easyui-dialog" style="width: 380px;display: none;"
|
|
data-options="modal:true, onClose: function(){ $('#dg').datagrid('reload')}"
|
|
closed="true" buttons="#sales-delivery-buttons">
|
|
<form id="sales_delivery_fm" method="post" novalidate style="margin:0;padding:20px 20px">
|
|
<div style="margin-bottom:10px; display: none;" >
|
|
<input id="id" name="id" class="easyui-textbox" style="display: none;" value="0">
|
|
<input id="created_by" name="createdBy" class="easyui-textbox" style="display: none;" value="">
|
|
<input id="updated_by" name="updatedBy" class="easyui-textbox" style="display: none;" value="">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="ifs_delivery_no" name="ifsDeliveryNo" class="easyui-textbox" required="true" label="IFS Shipment No:" data-options="buttonText: 'IFS',onClickButton:getIfsDeliveryOrder" style="width: 100%;">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="customer_no" name="customerNo" class="easyui-textbox" required="true" label="Customer No:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="customer_name" name="customerName" class="easyui-textbox" required="true" label="Customer Name:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="tracking_no" name="trackingNo" class="easyui-textbox" label="Express Bill No:" style="width:100%">
|
|
</div>
|
|
<div style="margin-bottom:10px">
|
|
<input id="delivery_remark" name="remark" class="easyui-textbox" label="Remak:" style="width:100%">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="sales-delivery-buttons" style="display: none; text-align: center;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveSalesDelivery()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#sales_delivery_modal').dialog('close')" style="width:90px">Close</a>
|
|
</div>
|
|
|
|
<!-- 发货计划 -->
|
|
<div id="sales_delivery_plan" class="easyui-dialog" style="width:600px;display: none;" closed="true" data-options="modal:true" >
|
|
<table id="sales_delivery_plan_table" class="easyui-datagrid" style="height:300px; display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'POST',
|
|
pageSize:50, toolbar:'#sales_delivery_table_buttons'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'partNo', width:60">Part No</th>
|
|
<th data-options="field:'shipQty', width:60">Planned Qty</th>
|
|
<th data-options="field:'shippedQty', width:60">Actual Qty</th>
|
|
<th data-options="field:'id', width:100, formatter: shipmentPlanAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="sales_delivery_table_buttons" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<!-- <a id="new_delivery" class="easyui-linkbutton" iconCls="icon-add" onclick="newSalesDeliveryPlanModal()">新增发货计划</a> -->
|
|
<a class="easyui-linkbutton" iconCls="icon-add" onclick="importSalesDeliveryPlan()">Import Shipment Plan</a>
|
|
<a id="boxed_plan" class="easyui-linkbutton" onclick="preFinishBoxing()">
|
|
<span class="glyphicon glyphicon-folder-close"></span>Complete Packing
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="operate_sales_delivery_plan" class="easyui-dialog" style="width:500px;display: none;"
|
|
closed="true" buttons="#plan-buttons" data-options="modal:true">
|
|
<div style="margin-bottom:10px;padding:20px 20px">
|
|
<input id="plan_part_no" class="easyui-textbox" required="true" label="Part No:" style="width:100%">
|
|
<br/><br>
|
|
<input id="plan_ship_qty" class="easyui-numberbox" required="true" label="Qty:" style="width:100%">
|
|
</div>
|
|
</div>
|
|
<div id="plan-buttons" style="display: none; text-align: center;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveSalesDeliveryPlan()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#operate_sales_delivery_plan').dialog('close')" style="width:90px">Close</a>
|
|
</div>
|
|
|
|
<!-- 库存箱 -->
|
|
<div id="stock_box_modal" class="easyui-dialog" style="width: 580px;display: none;" closed="true" data-options="modal:true" >
|
|
<table id="stock_box_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
method:'POST', pageSize:20,toolbar:'#stock_box_buttons'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'boxNo',width:130">Box No</th>
|
|
<th data-options="field:'partNo',width:100">Part No</th>
|
|
<th data-options="field:'boxQty',width:100">Qty</th>
|
|
<th data-options="field:'locationNo',width:80">Location No</th>
|
|
<th data-options="field:'labelDate',width:100">Production Date</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="stock_box_buttons" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<a class="easyui-linkbutton" iconCls="icon-add" onclick="downStockBoxExcel()">Export to Excel</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 发货箱 -->
|
|
<div id="sales_delivery_box" class="easyui-dialog" style="width:800px;display: none;" closed="true" data-options="modal:true" >
|
|
<table id="sales_delivery_box_table" class="easyui-datagrid" style="width:100%;height:300px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true ,
|
|
method:'POST', pageSize:20,toolbar:'#sales_delivery_box_buttons'">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'boxNo',width:130">Box No</th>
|
|
<th data-options="field:'partNo',width:100">Part No</th>
|
|
<th data-options="field:'boxQty',width:100">Qty</th>
|
|
<th data-options="field:'status',width:100">Status</th>
|
|
<th data-options="field:'id',width:300,formatter: formatBoxAction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
<div id="sales_delivery_box_buttons" style="padding:10px 5px;display: none;">
|
|
<div>
|
|
<a id="add_box" class="easyui-linkbutton" iconCls="icon-add" onclick="newSalesDeliveryBox()">New Box</a>
|
|
<a id="add_box_not_unpack" class="easyui-linkbutton" iconCls="icon-add" onclick="scanStockBoxModal()">Scanning Box</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 扫描箱modal -->
|
|
<div id="scan_box_modal" class="easyui-dialog" style="width: 600px; display: none;" closed="true" data-options="modal: true, onClose: function(){
|
|
$('#sales_delivery_box_table').datagrid('reload')}">
|
|
<form id="scan_box_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
|
|
<div style="margin-bottom:10px">
|
|
<label>Box No:</label>
|
|
<input id="scan_box_no" name="boxNo" style="width: 75%; margin-left: 10px;">
|
|
</div>
|
|
</form>
|
|
<table id="scan_box_no_table" class="easyui-datagrid" style="width:100%;height: 200px;">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'sortNo',width: 60, formatter: formatBoxSort">Item No</th>
|
|
<th data-options="field:'boxNo',width: 180,editor:'textbox'">Box No</th>
|
|
<th data-options="field:'boxQty',width: 100,editor:'textbox'">Qty</th>
|
|
<th data-options="field:'id',width: 200, formatter: formatBoxFunction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
<!-- 发货计划 -->
|
|
<table id="cache_sales_delivery_plan_table" class="easyui-datagrid" style="margin-top: 5px; width:100%;height:200px;display: none;"
|
|
data-options="pagination: false, showFooter: true, singleSelect:true, fitColumns:true , method:'POST',
|
|
pageSize:50,">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'partNo',width:60">Part No</th>
|
|
<th data-options="field:'shipQty',width:60">Planned Qty</th>
|
|
<th data-options="field:'shippedQty',width:60">Actual Qty</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 扫描卷modal -->
|
|
<div id="sales_delivery_roll" class="easyui-dialog" style="width: 600px; display: none;" closed="true" data-options="modal:true">
|
|
<form id="sales_delivery_roll_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
|
|
<div style="margin-bottom: 0px">
|
|
<label>Roll No:</label>
|
|
<input id="scan_roll_no" name="rollNo" style="width: 75%; margin-left: 10px;">
|
|
</div>
|
|
</form>
|
|
<table id="scan_roll_table" class="easyui-datagrid" style="width:100%;height: 300px;">
|
|
<thead>
|
|
<tr>
|
|
<th data-options="field:'sortNo',width:60, formatter: formatRollSort">Item No</th>
|
|
<th data-options="field:'rollNo',width:180,editor:'textbox'">Roll No</th>
|
|
<th data-options="field:'rollQty',width:60,editor:'textbox'">Qty</th>
|
|
<th data-options="field:'id',width:200, formatter:formatRollFunction">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 发运modal -->
|
|
<div id="shipment_sales" class="easyui-dialog" style="width: 320px; display: none;" closed="true" data-options="modal:true"
|
|
buttons="#shipment-sale-buttons">
|
|
<form id="shipment_sales_fm" method="post" novalidate style="margin:0; padding: 20px 20px">
|
|
<div style="margin-bottom: 10px">
|
|
<label>Express Bill No:</label>
|
|
<input id="shipment_no" name="trackingNo" style="margin-left: 10px;">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div id="shipment-sale-buttons" style="display: none; text-align: center;">
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveShipmentNo()" style="width:90px">Save</a>
|
|
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#shipment_sales').dialog('close')" style="width:90px">Close</a>
|
|
</div>
|
|
<script src='http://127.0.0.1:8000/CLodopfuncs.js'></script>
|
|
<!-- <script language="javascript" src="LodopFuncs.js"></script> -->
|
|
<script type="text/javascript" src="/js/print/print_label.js"></script>
|
|
<script>
|
|
|
|
//公共参数
|
|
var currentRow;//销售出库单
|
|
let currentPrinter = ${currentPrinter};
|
|
let currentPlanRow;//发运计划
|
|
let currentBoxRow;//发运箱row
|
|
let currentRollRow;//发运卷
|
|
let currentCheckOrderRow;//检验单行
|
|
let addSaleFlag;//新增销售发货单标记
|
|
let addPlanFlag;//新增发运计划
|
|
let scanBoxNoList;
|
|
let site = $('#current_site').val();
|
|
let username = $('#current_username').val();
|
|
$(window).resize(function () {
|
|
$("#dg").datagrid({"height": $(window).height() - $(".datagrid").offset().top - 30});
|
|
});
|
|
|
|
$(function () {
|
|
$(window).resize();
|
|
});
|
|
|
|
//延时
|
|
var delay = (function(){
|
|
var timer = 0;
|
|
return function(callback, ms){
|
|
clearTimeout (timer);
|
|
timer = setTimeout(callback, ms);
|
|
};
|
|
})();
|
|
|
|
//状态中文翻译
|
|
function formatStatusRemark(value, row){
|
|
if('Created' == value){
|
|
return 'Created';
|
|
}else if('Boxing' == value){
|
|
return 'Packing';
|
|
}else if('Boxed' == value){
|
|
return 'Packed';
|
|
}else if('Shipped' == value){
|
|
return 'Shipped';
|
|
}
|
|
}
|
|
|
|
// 销售交货单功能
|
|
function formatDeliveryAction(value, row){
|
|
//根据状态区分不同的按钮
|
|
let status = row.status;
|
|
let tags = '';
|
|
tags += '<a onclick="stockBoxModal(\''+row.deliveryNo+'\')" class="disabled-underscore">Stock List</a> | ';
|
|
if('Created' == status){
|
|
tags += '<a onclick="editSaleDeliveryModal()" class="disabled-underscore">Edit</a> | ';
|
|
tags += '<a onclick="preDeleteSalesDelivery(\''+row.deliveryNo+'\')" class="disabled-underscore">Delete</a> | ';
|
|
}else if('Boxed' == status){
|
|
tags += '<a onclick="shipmentModal(\''+row.deliveryNo+'\')" class="disabled-underscore">Final Ship</a> | ';
|
|
}
|
|
tags += '<a onclick="salesDeliveryBoxModal(\''+row.deliveryNo+'\')" class="disabled-underscore">List of Shipped</a> | ';
|
|
tags += '<a onclick="salesDeliveryPlanModal(\''+row.deliveryNo+'\')" class="disabled-underscore">Shipment Plan</a> | ';
|
|
return tags;
|
|
}
|
|
|
|
//查询主表的数据
|
|
function searchData(){
|
|
var dg = $('#dg').datagrid({
|
|
queryParams: {
|
|
deliveryNo: $('#search_delivery_no').val(),
|
|
ifsDeliveryNo: $('#search_ifs_delivery_no').val(),
|
|
status: $('#search_delivery_status').val()
|
|
}
|
|
});
|
|
}
|
|
|
|
//销售交货的网址
|
|
let url = '';
|
|
//新增出货单的modal
|
|
function newSalesDeliveryModal(){
|
|
addSalesFlag = 'Y';
|
|
$('#id').textbox("setValue", 0);
|
|
$('#sales_delivery_modal').dialog('open').dialog('center').dialog('setTitle','New Shipment');
|
|
$('#sales_delivery_fm').form('clear');
|
|
$('#ifs_delivery_no').textbox('textbox').removeAttr('disabled');
|
|
$('#customer_no').textbox('textbox').removeAttr('disabled');
|
|
$('#customer_name').textbox('textbox').removeAttr('disabled');
|
|
url = '/sales/delivery/addSalesDelivery';
|
|
$("#delivery_remark").textbox("setValue", '');
|
|
}
|
|
|
|
//修改销售出库单的数据
|
|
function editSaleDeliveryModal(){
|
|
addSalesFlag = 'N';
|
|
//取到当前的行
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#sales_delivery_modal').dialog('open').dialog('center').dialog('setTitle','New Shipment');
|
|
$('#sales_delivery_fm').form('clear');
|
|
//加载当前的行数据
|
|
$('#sales_delivery_fm').form('load', currentRow);
|
|
//禁用一些字段的输入
|
|
$('#ifs_delivery_no').textbox('textbox').attr('disabled', 'disabled');
|
|
$('#customer_no').textbox('textbox').attr('disabled', 'disabled');
|
|
$('#customer_name').textbox('textbox').attr('disabled', 'disabled');
|
|
url = '/sales/delivery/editSalesDelivery';
|
|
//设置参数
|
|
$("#ifs_delivery_no").textbox("setValue", currentRow.ifsDeliveryNo);
|
|
$("#delivery_remark").textbox("setValue", currentRow.remark);
|
|
}, 500);
|
|
}
|
|
|
|
//保存销售交货的主表信息
|
|
function saveSalesDelivery(){
|
|
let trackingNo = $.trim($("#tracking_no").val());
|
|
let customerNo = $.trim($("#customer_no").val());
|
|
let customerName = $.trim($("#customer_name").val());
|
|
let ifsDeliveryNo = $.trim($("#ifs_delivery_no").val());
|
|
let remark = $.trim($("#delivery_remark").val());
|
|
//空值判断
|
|
if(null == customerNo || '' == customerNo){
|
|
$.messager.alert('error','The customer no should have value!', 'error');
|
|
return false;
|
|
}
|
|
if(null == customerName || '' == customerName){
|
|
$.messager.alert('error','The customer name should have value!', 'error');
|
|
return false;
|
|
}
|
|
if(null == ifsDeliveryNo || '' == ifsDeliveryNo){
|
|
$.messager.alert('error','The IFS SO No should have value!', 'error');
|
|
return false;
|
|
}
|
|
let postData;
|
|
//判断是否新增
|
|
if(addSalesFlag == 'N'){
|
|
postData = {'deliveryNo': currentRow.deliveryNo, 'ifsDeliveryNo': ifsDeliveryNo, 'customerNo': customerNo,
|
|
'customerName': customerName, 'trackingNo': trackingNo,'remark': remark, 'updatedBy': username};
|
|
}else{
|
|
postData = {'ifsDeliveryNo': ifsDeliveryNo, 'customerNo': customerNo, 'customerName': customerName,
|
|
'trackingNo': trackingNo, 'remark': remark, 'createdBy': username};
|
|
}
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post(url, postData, function(result){
|
|
if (result.success){
|
|
//刷新主表数据
|
|
$('#dg').datagrid('reload');
|
|
//隐藏modal
|
|
$('#sales_delivery_modal').dialog('close');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//删除确认
|
|
function preDeleteSalesDelivery(deliveryNo){
|
|
$.messager.confirm('Confirm','Are you sure to delete the delivery order: <b>'+deliveryNo+'</b> ?', function(r){
|
|
if (r){
|
|
deleteSalesDelivery(deliveryNo);
|
|
}
|
|
});
|
|
}
|
|
|
|
//删除销售交货单
|
|
function deleteSalesDelivery(deliveryNo){
|
|
let postData = {'deliveryNo': deliveryNo, 'updatedBy': username, 'status': 'Deleted', 'statusCode': -1};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/deleteSalesDelivery', postData, function(result){
|
|
if (result.success){
|
|
//刷新主表数据
|
|
$('#dg').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//发运计划
|
|
function salesDeliveryPlanModal(deliveryNo){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#sales_delivery_plan').dialog('open').dialog('center').dialog('setTitle', deliveryNo+'Shipment Plan');
|
|
//已经发货的不允许新增和重新导入
|
|
let saleStatus = currentRow.status;
|
|
if('Created' == saleStatus || 'Boxing' == saleStatus){
|
|
$("#new_delivery").linkbutton({"disabled": false});
|
|
$("#boxed_plan").linkbutton({"disabled": false});
|
|
}else{
|
|
$("#new_delivery").linkbutton({"disabled": true});
|
|
$("#boxed_plan").linkbutton({"disabled": true});
|
|
}
|
|
let opts = $('#sales_delivery_plan_table').datagrid('options');
|
|
opts.queryParams = {'deliveryNo': deliveryNo};
|
|
$("#sales_delivery_plan_table").datagrid({url: "/sales/delivery/getSalesDeliveryPlans",
|
|
onLoadSuccess: function(data) {
|
|
|
|
},
|
|
rowStyler: function(index, row){
|
|
if (Number(row.shipQty)!=Number(row.shippedQty)){
|
|
return 'background-color:#ff534d;font-weight:bold;';
|
|
}
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
let planUrl = '';
|
|
//新增发运计划
|
|
function newSalesDeliveryPlanModal(){
|
|
//设置modal
|
|
$('#operate_sales_delivery_plan').dialog('open').dialog('center').dialog('setTitle', 'New Shipment Plan');
|
|
//清空数据
|
|
$("#plan_part_no").textbox("setValue", '');
|
|
$("#plan_ship_qty").textbox("setValue", '');
|
|
$("#plan_part_no").textbox({"disabled" : false});
|
|
planUrl = '/sales/delivery/newSalesDeliveryPlan';
|
|
addPlanFlag = 'Y';
|
|
}
|
|
|
|
//修改发运计划
|
|
function editPlanModal(){
|
|
delay(function(){
|
|
currentPlanRow = $('#sales_delivery_plan_table').datagrid('getSelected');
|
|
//设置modal
|
|
$('#operate_sales_delivery_plan').dialog('open').dialog('center').dialog('setTitle', 'Edit Shipment Plan');
|
|
//清空数据
|
|
$("#plan_part_no").textbox("setValue", currentPlanRow.partNo);
|
|
$("#plan_ship_qty").textbox("setValue", currentPlanRow.shipQty);
|
|
//不允许修改物料编码
|
|
$("#plan_part_no").textbox({"disabled" : true});
|
|
planUrl = '/sales/delivery/editSalesDeliveryPlan';
|
|
addPlanFlag = 'N';
|
|
}, 500);
|
|
}
|
|
|
|
//保存发运计划
|
|
function saveSalesDeliveryPlan(){
|
|
//获取当前的行
|
|
currentPlanRow = $('#sales_delivery_plan_table').datagrid('getSelected');
|
|
let partNo = $.trim($('#plan_part_no').val());
|
|
let shipQty = $.trim($('#plan_ship_qty').val());
|
|
let postData;
|
|
//区分新增还是修改
|
|
if('N' == addPlanFlag){
|
|
postData = {'deliveryNo': currentPlanRow.deliveryNo, 'partNo': currentPlanRow.partNo, 'shipQty': shipQty, 'updatedBy': username};
|
|
}else{
|
|
postData = {'deliveryNo': currentRow.deliveryNo, 'ifsDeliveryNo': currentRow.ifsDeliveryNo, 'partNo': partNo,
|
|
'shipQty': shipQty, 'shippedQty': 0, 'status': 'Created', 'statusCode': 1, 'createdBy': username};
|
|
}
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post(planUrl, postData, function(result){
|
|
if (result.success){
|
|
//关闭模态框
|
|
$('#operate_sales_delivery_plan').dialog('close');
|
|
//刷新发货计划的数据
|
|
$('#sales_delivery_plan_table').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//发运计划的操作
|
|
function shipmentPlanAction(value, row){
|
|
//currentRow = $('#dg').datagrid('getSelected');
|
|
let status = currentRow.status;
|
|
let tags = '';
|
|
if('Created' == status || 'Boxing' == status){
|
|
tags += '<a onclick="preDeletePlan()" class="disabled-underscore">Delete</a> | ';
|
|
tags += '<a onclick="editPlanModal()" class="disabled-underscore">Update</a>';
|
|
}
|
|
return tags;
|
|
}
|
|
|
|
//页面打开关闭选中的箱
|
|
$("#sales_delivery_plan").dialog({
|
|
onClose: function () {
|
|
//清空当前的入库箱数据
|
|
currentBoxRow = null;
|
|
//刷新订单的列表
|
|
$('#dg').datagrid('reload');
|
|
}
|
|
});
|
|
|
|
//提示是否删除
|
|
function preDeletePlan(){
|
|
delay(function(){
|
|
$.messager.confirm('Confirm','Are you sure to delete the shipment plan?', function(r){
|
|
if (r){
|
|
deleteSalesDeliveryPlan();
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//删除发运计划
|
|
function deleteSalesDeliveryPlan(){
|
|
//获取当前的行
|
|
currentPlanRow = $('#sales_delivery_plan_table').datagrid('getSelected');
|
|
let postData = {'deliveryNo': currentPlanRow.deliveryNo, 'partNo': currentPlanRow.partNo, 'updatedBy': username, 'status': 'Deleted', 'statusCode': -1};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/deleteSalesDeliveryPlan', postData, function(result){
|
|
if (result.success){
|
|
//刷新主表数据
|
|
$('#sales_delivery_plan_table').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//查询库存箱的modal
|
|
function stockBoxModal(deliveryNo){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#stock_box_modal').dialog('open').dialog('center').dialog('setTitle', deliveryNo+'List of Stock');
|
|
//已经发货的不允许新增和重新导入
|
|
let opts = $('#stock_box_table').datagrid('options');
|
|
opts.queryParams = {'deliveryNo': deliveryNo};
|
|
$("#stock_box_table").datagrid({url: "/sales/delivery/getStockBoxsWithFirstInAndFirstOut",
|
|
onLoadSuccess: function(data) {
|
|
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//下载Excel数据
|
|
function downStockBoxExcel(){
|
|
let deliveryNo = currentRow.deliveryNo;
|
|
let print_url = '/export/sales/downStockBoxExcel?deliveryNo='+deliveryNo;
|
|
$("#ifmforprint").attr('src', print_url);
|
|
}
|
|
|
|
//打开发货箱的modal
|
|
function salesDeliveryBoxModal(){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
let deliveryNo = currentRow.deliveryNo;
|
|
let opts = $('#sales_delivery_box_table').datagrid('options');
|
|
//根据状态判断是否新增箱子
|
|
let saleStatus = currentRow.status;
|
|
if('Created' == saleStatus || 'Boxing' == saleStatus){
|
|
$("#add_box").linkbutton({"disabled": false});
|
|
$("#add_box_not_unpack").linkbutton({"disabled": false});
|
|
}else if('Boxed' == saleStatus || 'Shipped' == saleStatus){
|
|
$("#add_box").linkbutton({"disabled": true});
|
|
$("#add_box_not_unpack").linkbutton({"disabled": true});
|
|
}
|
|
opts.queryParams = {'deliveryNo': deliveryNo};
|
|
//设置modal
|
|
$('#sales_delivery_box').dialog('open').dialog('center').dialog('setTitle', currentRow.deliveryNo+'List of Boxes!');
|
|
$("#sales_delivery_box_table").datagrid({url: "/sales/delivery/getSalesDeliveryBoxs",
|
|
onLoadSuccess: function(data) {
|
|
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//箱的操作放大
|
|
function formatBoxAction(value, row){
|
|
var tags = "";
|
|
if(row.status == 'Created'){
|
|
tags += '<a onclick="boxRollModal()" class="disabled-underscore">Scanning Rolls</a> | ';
|
|
tags += '<a onclick="preDeleteBox(\''+row.boxNo+'\')" class="disabled-underscore">Delete</a>';
|
|
}else if(row.status == 'Boxing'){
|
|
tags += '<a onclick="boxRollModal()" class="disabled-underscore">Scanning Rolls</a> | ';
|
|
tags += '<a onclick="preSealingBox(\''+row.boxNo+'\')" class="disabled-underscore">Packed</a>';
|
|
}else if(row.status == 'Boxed'){
|
|
tags += '<a onclick="boxRollModal(\''+row.boxNo+'\')" class="disabled-underscore">List of Rolls</a> | ';
|
|
tags += '<a onclick="preDeleteBoxed(\''+row.boxNo+'\',' +'\'table'+'\')" class="disabled-underscore">Delete</a> | ';
|
|
tags += '<a onclick="printBoxLabel(\''+row.boxNo+'\')" class="disabled-underscore">Print Box Label</a>';
|
|
}
|
|
return tags;
|
|
}
|
|
|
|
//扫描外箱
|
|
function scanStockBoxModal(){
|
|
//打开扫描卷的modal
|
|
$('#scan_box_modal').dialog('open').dialog('center').dialog('setTitle', 'Scanning Box');
|
|
$("#scan_box_no").val("");
|
|
//获取焦点
|
|
$('#scan_box_no').focus();
|
|
//刷新当前箱号表的table
|
|
//空集合数据
|
|
let cacheData = {
|
|
total: 0,
|
|
rows:[]
|
|
};
|
|
$('#scan_box_no_table').datagrid('loadData', cacheData);
|
|
|
|
//加载发货计划的数据
|
|
let opts = $('#cache_sales_delivery_plan_table').datagrid('options');
|
|
opts.queryParams = {'deliveryNo': currentRow.deliveryNo};
|
|
$("#cache_sales_delivery_plan_table").datagrid({url: "/sales/delivery/getSalesDeliveryPlans",
|
|
onLoadSuccess: function(data) {
|
|
|
|
},
|
|
rowStyler: function(index, row){
|
|
if (Number(row.shipQty)!=Number(row.shippedQty)){
|
|
return 'background-color:#ff534d;font-weight:bold;';
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/* 格式化箱号序号 */
|
|
function formatBoxSort(value, row, index){
|
|
let rows = $("#scan_box_no_table").datagrid("getData").rows;
|
|
let total = rows.length;
|
|
return total - index;
|
|
}
|
|
|
|
/* 添加方法 */
|
|
function formatBoxFunction(value, row){
|
|
let tags = '';
|
|
tags += '<a style="text-decoration:none;" onclick="preDeleteBoxed(\''+row.boxNo+'\',' +'\'cache'+'\')" class="disabled-underscore">Delete</a>';
|
|
return tags;
|
|
}
|
|
|
|
//绑定的enter事件
|
|
$('#scan_box_modal').bind("keydown", function (e) {
|
|
if (e.keyCode == 13) {
|
|
let boxNo = $.trim($("#scan_box_no").val());
|
|
if(null == boxNo || '' == boxNo){
|
|
$.messager.alert('error', 'Please scan box no!', 'error', function(){
|
|
$("#scan_box_no").val('');
|
|
$("#scan_box_no").focus();
|
|
});
|
|
return false;
|
|
}else{
|
|
//处理卷号
|
|
// if(!boxNo.includes(';')){
|
|
// $.messager.alert('error', '箱码不符合规则!', 'error', function(){
|
|
// $("#scan_box_no").val('');
|
|
// $("#scan_box_no").focus();
|
|
// });
|
|
// return false;
|
|
// }
|
|
//boxNo = processBoxNoData(boxNo);
|
|
scanSalesDeliveryBox(boxNo);
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
//处理外箱号的方法
|
|
function processBoxNoData(boxNo){
|
|
let strArray = boxNo.split(';');
|
|
return strArray[3];
|
|
}
|
|
|
|
//扫描外箱号
|
|
function scanSalesDeliveryBox(boxNo){
|
|
delay(function(){
|
|
let postData = {'boxNo': boxNo, 'deliveryNo': currentRow.deliveryNo, 'ifsDeliveryNo': currentRow.ifsDeliveryNo,
|
|
'boxQty': 0, 'status': 'Created', 'statusCode': 1, 'createdBy': username};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/scanSalesDeliveryBox', postData, function(result){
|
|
if (result.success){
|
|
printBoxLabel(boxNo);
|
|
//刷新发货箱的数据
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
let rows = $('#scan_box_no_table').datagrid('getRows');
|
|
//从第一行开始加
|
|
rows.unshift({"deliveryNo": currentRow.deliveryNo, "boxNo": boxNo, "boxQty": result.boxQty});
|
|
$('#scan_box_no_table').datagrid('loadData', rows);
|
|
//重新加载表格数据
|
|
$("#cache_sales_delivery_plan_table").datagrid('reload');
|
|
$("#scan_box_no").val("");
|
|
$("#scan_box_no").focus();
|
|
// $('#scan_box_modal').dialog('close');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error', function(){
|
|
$("#scan_box_no").val("");
|
|
$("#scan_box_no").focus();
|
|
});
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}, 500);
|
|
}
|
|
|
|
//确认删除封箱的出货箱的操作
|
|
function preDeleteBoxed(boxNo, sourceMethod){
|
|
delay(function(){
|
|
//重置缓存箱行
|
|
//区分删除的是扫描装箱还是创建装箱
|
|
if(sourceMethod == 'cache'){
|
|
currentBoxRow = $('#scan_box_no_table').datagrid('getSelected');
|
|
}else{
|
|
currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
}
|
|
$.messager.confirm('Confirm','Are sure to delete the box?', function(r){
|
|
if (r){
|
|
cancelScanSalesDeliveryBox(sourceMethod);
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//删除已经封箱的发货箱
|
|
function cancelScanSalesDeliveryBox(sourceMethod){
|
|
let postData = {'site': site, 'deliveryNo': currentBoxRow.deliveryNo, 'boxNo': currentBoxRow.boxNo,
|
|
'partNo': currentBoxRow.partNo, 'updatedBy': username, 'status': 'Deleted', 'statusCode': -1};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/cancelScanSalesDeliveryBox', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//区分删除的是扫描装箱还是创建装箱
|
|
if(sourceMethod == 'cache'){
|
|
let rows = $('#scan_box_no_table').datagrid('getRows');
|
|
//删除当前选中的行数据
|
|
deleteBoxCacheData(rows, currentBoxRow.boxNo);
|
|
//刷新发货箱的数据
|
|
$('#scan_box_no_table').datagrid('loadData', rows);
|
|
//重新加载表格数据
|
|
$("#cache_sales_delivery_plan_table").datagrid('reload');
|
|
//获取焦点继续扫描
|
|
$('#scan_box_no').focus();
|
|
}else{
|
|
//刷新发货箱的数据
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
}
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//新建箱子的方法
|
|
function newSalesDeliveryBox(){
|
|
delay(function(){
|
|
let postData = {'deliveryNo': currentRow.deliveryNo, 'ifsDeliveryNo': currentRow.ifsDeliveryNo, 'partNo': '',
|
|
'boxQty': 0, 'status': 'Created', 'statusCode': 1, 'createdBy': username};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/newSalesDeliveryBox', postData, function(result){
|
|
if (result.success){
|
|
//刷新发货箱的数据
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}, 500);
|
|
}
|
|
|
|
//确认删除箱的操作
|
|
function preDeleteBox(boxNo, sourceMethod){
|
|
delay(function(){
|
|
//重置缓存箱行
|
|
currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
$.messager.confirm('Confirm','Are sure to delete the box?', function(r){
|
|
if (r){
|
|
deleteSalesDeliveryBox();
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//删除发货箱
|
|
function deleteSalesDeliveryBox(sourceMethod){
|
|
let postData = {'site': site, 'deliveryNo': currentBoxRow.deliveryNo, 'boxNo': currentBoxRow.boxNo,
|
|
'updatedBy': username, 'status': 'Deleted', 'statusCode': -1};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/deleteSalesDeliveryBox', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//刷新发货箱的数据
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//删除当前箱的数据
|
|
function deleteBoxCacheData(boxRows, boxNo){
|
|
//循环删除缓存中的数据
|
|
for(let i = 0; i < boxRows.length; i++){
|
|
let temBoxNo = boxRows[i].boxNo;
|
|
//如果箱号相同删掉数据
|
|
if(temBoxNo == boxNo){
|
|
boxRows.splice(i, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
//扫码装箱页面
|
|
function boxRollModal(){
|
|
delay(function(){
|
|
currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
let boxNo = currentBoxRow.boxNo;
|
|
let opts = $('#scan_roll_table').datagrid('options');
|
|
opts.queryParams = {'deliveryNo': currentBoxRow.deliveryNo, 'boxNo': boxNo};
|
|
//根据箱子的状态判断是否封箱
|
|
let boxStatus = currentBoxRow.status;
|
|
if('Boxed' == boxStatus){
|
|
//封箱去掉
|
|
$("#close_box").linkbutton({"disabled": true});
|
|
//隐藏扫描卷的功能
|
|
$('#sales_delivery_roll_fm').hide();
|
|
}else{
|
|
$("#close_box").linkbutton({"disabled": false});
|
|
//隐藏扫描卷的功能
|
|
$('#sales_delivery_roll_fm').show();
|
|
}
|
|
//设置modal
|
|
$('#sales_delivery_roll').dialog('open').dialog('center').dialog('setTitle', boxNo+'List of Boxes!');
|
|
//获取焦点
|
|
$('#scan_roll_no').focus();
|
|
$("#scan_roll_table").datagrid({url: "/sales/delivery/getSalesDeliveryRolls",
|
|
onLoadSuccess: function(data) {
|
|
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//表格序号
|
|
function formatRollSort(value, row, index){
|
|
let rows = $("#scan_roll_table").datagrid("getData").rows;
|
|
let total = rows.length;
|
|
return total - index;
|
|
}
|
|
|
|
//pack列表的功能
|
|
function formatRollFunction(value, row){
|
|
let boxStatus = currentBoxRow.status;
|
|
let tags = '';
|
|
//没有封包的时候才可以删除
|
|
if('Boxed' != boxStatus){
|
|
tags += '<a style="text-decoration:none;" onclick="preCancelScanRollNo(\''+row.rollNo+'\')">Delete</a>';
|
|
}
|
|
return tags;
|
|
}
|
|
|
|
//页面打开关闭选中的箱
|
|
$("#sales_delivery_roll").dialog({
|
|
onClose: function () {
|
|
//清空当前的入库箱数据
|
|
currentBoxRow = null;
|
|
//刷新订单的列表
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
},
|
|
onOpen: function () {
|
|
$('#scan_roll_no').val('');
|
|
$('#scan_roll_no').focus();
|
|
}
|
|
});
|
|
|
|
//绑定的enter事件
|
|
$('#sales_delivery_roll').bind("keydown", function (e) {
|
|
if (e.keyCode == 13) {
|
|
let rollNo = $.trim($("#scan_roll_no").val());
|
|
if(null == rollNo || '' == rollNo){
|
|
$.messager.alert('error', 'Please scan roll no!', 'error');
|
|
$("#scan_roll_no").focus();
|
|
return false;
|
|
}else{
|
|
//rollNo = processRollNoData(rollNo);
|
|
scanRollNo(rollNo);
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
//处理卷号的方法
|
|
function processRollNoData(rollNo){
|
|
let strArray = rollNo.split(';');
|
|
return strArray[3];
|
|
}
|
|
|
|
//扫描卷
|
|
function scanRollNo(rollNo){
|
|
let postData = {'deliveryNo': currentRow.deliveryNo, 'ifsDeliveryNo': currentRow.ifsDeliveryNo,
|
|
'boxNo': currentBoxRow.boxNo, 'rollNo': rollNo, "createdBy": username};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/scanStockRoll', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//获取当前的行数
|
|
//判断是否触发封箱
|
|
if(result.sealFlag){
|
|
sealingSalesDeliveryBox(currentBoxRow.boxNo);
|
|
}
|
|
$('#scan_roll_table').datagrid('reload');
|
|
$('#scan_roll_no').val('');
|
|
$("#scan_roll_no").focus();
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error', function(){
|
|
//自动获取焦点
|
|
$('#scan_roll_no').val('');
|
|
$("#scan_roll_no").focus();
|
|
});
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//准备取消扫描卷
|
|
function preCancelScanRollNo(rollNo){
|
|
delay(function(){
|
|
//重置缓存箱行
|
|
currentRollRow = $('#scan_roll_table').datagrid('getSelected');
|
|
$.messager.confirm('Confirm','Are you sure to delete the roll '+rollNo+'?', function(r){
|
|
if (r){
|
|
cancelScanRollNo(rollNo);
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//取消扫描卷
|
|
function cancelScanRollNo(rollNo){
|
|
let postData = {'deliveryNo': currentRollRow.deliveryNo, 'boxNo': currentRollRow.boxNo, 'rollNo': rollNo,
|
|
'updatedBy': username, 'status': 'Deleted', 'statusCode': -1};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/cancelScanStockRoll', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//获取当前的行数
|
|
$('#scan_roll_table').datagrid('reload');
|
|
$('#scan_roll_no').val('');
|
|
$("#scan_roll_no").focus();
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error', function(){
|
|
//自动获取焦点
|
|
$('#scan_roll_no').val('');
|
|
$("#scan_roll_no").focus();
|
|
});
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//确认封箱的操作
|
|
function preSealingBox(boxNo){
|
|
delay(function(){
|
|
//重置缓存箱行
|
|
currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
$.messager.confirm('Confirm','Are you sure to complete packing?', function(r){
|
|
if (r){
|
|
sealingSalesDeliveryBox(boxNo);
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//封箱操作
|
|
function sealingSalesDeliveryBox(boxNo){
|
|
//重置缓存箱行
|
|
currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
let postData = {'deliveryNo': currentBoxRow.deliveryNo, 'boxNo': boxNo, 'updatedBy': username, 'status': 'Boxed', 'statusCode': 3};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/sealingSalesDeliveryBox', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//先打印标签
|
|
printBoxLabel(boxNo);
|
|
//刷新发货箱的数据
|
|
$('#sales_delivery_box_table').datagrid('reload');
|
|
//隐藏modal
|
|
$('#sales_delivery_roll').dialog('close');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//打印外箱标签
|
|
function printBoxLabel(boxNo){
|
|
delay(function(){
|
|
// if('cache' == cacheFlag){
|
|
// //重置缓存箱行
|
|
// currentBoxRow = $('#sales_delivery_box_table').datagrid('getSelected');
|
|
// }
|
|
// let postData = {'deliveryNo': currentBoxRow.deliveryNo, 'boxNo': currentBoxRow.boxNo};
|
|
// console.log(postData)
|
|
/* 缓存打印信息 */
|
|
// $.get('/print/box/'+postData.boxNo,
|
|
// function(result){
|
|
// if (result.success){
|
|
// $('#pack_dlg_table').datagrid('reload');
|
|
// //调用打印的方法打印标签
|
|
// printOutBoxLabel(JSON.parse(result.printData), currentPrinter);
|
|
// } else {
|
|
// $.messager.alert('error',result.msg, 'error');
|
|
// }
|
|
// });//临时调用的
|
|
$("#ifmforprint").attr('src', "/aoi/box/" + boxNo );
|
|
}, 500);
|
|
}
|
|
|
|
//准备完成装箱
|
|
function preFinishBoxing(){
|
|
delay(function(){
|
|
//重置缓存行
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$.messager.confirm('Confirm','Are you sure to complete packing'+currentRow.deliveryNo+'?', function(r){
|
|
if (r){
|
|
finishBoxing();
|
|
}
|
|
});
|
|
}, 500);
|
|
}
|
|
|
|
//完成装箱
|
|
function finishBoxing(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
let postData = {'deliveryNo': currentRow.deliveryNo, 'updatedBy': username, 'status': 'Boxed', 'status_code': 3};
|
|
//转json字符串
|
|
postData = JSON.stringify(postData);
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/finishBoxing', postData,
|
|
function(result){
|
|
if (result.success){
|
|
//关闭modal
|
|
$('#sales_delivery_plan').dialog('close');
|
|
//刷新table
|
|
$('#sales_delivery_plan_table').datagrid('reload');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
//设置请求的类型
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
|
|
//发货信息
|
|
function shipmentModal(deliveryNo){
|
|
//重置缓存行
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
$('#shipment_sales').dialog('open').dialog('center').dialog('setTitle', deliveryNo+' Inspection Info!');
|
|
}
|
|
|
|
//保存快递单号行
|
|
function saveShipmentNo(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
let trackingNo = $('#shipment_no').val();
|
|
let postData = {'deliveryNo': currentRow.deliveryNo, 'trackingNo': trackingNo, 'remark': 'Shipped',
|
|
'updatedBy': username, 'status': 'Shipped', 'statusCode': 5};
|
|
//保存或修改数据
|
|
//序列化
|
|
postData = JSON.stringify(postData);
|
|
//post请求类型修改
|
|
$.ajaxSetup({
|
|
contentType: "application/json;charset=utf-8"});
|
|
$.post('/sales/delivery/saveTrackingNo', postData, function(result){
|
|
if (result.success){
|
|
//刷新主表数据
|
|
$('#dg').datagrid('reload');
|
|
//隐藏modal
|
|
$('#shipment_sales').dialog('close');
|
|
} else {
|
|
$.messager.alert('error',result.msg, 'error');
|
|
}
|
|
},'json');
|
|
$.ajaxSetup({
|
|
contentType: " application/x-www-form-urlencoded"});
|
|
}
|
|
|
|
//下载Excel数据
|
|
function downSalesDeliveryExcel(deliveryNo){
|
|
let print_url = '/export/sales/downSalesDeliveryExcel?deliveryNo='+deliveryNo;
|
|
$("#ifmforprint").attr('src', print_url);
|
|
}
|
|
|
|
//获取ifs出货单得信息
|
|
function getIfsDeliveryOrder(){
|
|
var ifsDeliveryNo = $("#ifs_delivery_no").val();
|
|
if (ifsDeliveryNo != ""){
|
|
$.post("/sales/delivery/getIfsDeliveryOrder", {ifsDeliveryNo: ifsDeliveryNo}, function (data) {
|
|
if(data.success){
|
|
$('#customer_no').textbox("setValue", data.customerNo);
|
|
$('#customer_name').textbox("setValue", data.customerName);
|
|
}else{
|
|
$.messager.alert('Warning', data.msg, 'warning');
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
//导入发货计划
|
|
function importSalesDeliveryPlan(){
|
|
delay(function(){
|
|
currentRow = $('#dg').datagrid('getSelected');
|
|
let requestParam = {'ifsDeliveryNo': currentRow.ifsDeliveryNo, 'deliveryNo': currentRow.deliveryNo};
|
|
$.post("/sales/delivery/importSalesDeliveryPlan", requestParam, function (data) {
|
|
if(data.success){
|
|
//重新加载表格数据
|
|
$.messager.alert('Warning', data.msg, 'warning');
|
|
$("sales_delivery_plan_table").datagrid('reload');
|
|
}else{
|
|
$.messager.alert('Warning', data.msg, 'warning');
|
|
}
|
|
})
|
|
}, 500);
|
|
}
|
|
|
|
</script>
|
|
|
|
</@master.layout>
|
|
|