|
|
|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PrintTrackingCode.aspx.cs" Inherits="TradeManageNew.OrderPost.PrintTrackingCode" %>
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
|
<title> Print Tracking Code</title>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/DataGrid.css" />
|
|
|
|
|
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/DataGrid.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/DataPager.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/MaskedTextBox.js" type="text/javascript"></script>
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="../Scripts/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
|
|
|
|
|
<script type="text/javascript" src="../Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
|
|
|
|
|
<script type="text/javascript" src="../Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
|
|
|
|
|
<script src="../Scripts/jqprint.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../Scripts/print.js" type="text/javascript"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
var datagrid1 = new nblf.ui.DataGrid("DataGrid1");
|
|
|
|
|
var WindowLoadModel = new WindowLoad();
|
|
|
|
|
var tableArr = [];//表格中的数据数组
|
|
|
|
|
var scanArr = [];//正在扫描匹配的数据数组
|
|
|
|
|
//var printObj = null;//后台匹配返回的打印数据对象
|
|
|
|
|
//var pptableArr = [];//打印匹配上的tableArr中的数据
|
|
|
|
|
var ppReturnObj = null;//后台匹配跟踪码成功后返回的数据对象
|
|
|
|
|
var ppReturnObjLast = null;//后台匹配跟踪码前一个成功后返回的数据对象
|
|
|
|
|
var lastScanSKUTime = null;//上一次扫描SKU的时间
|
|
|
|
|
var isMatch = 1;//是否允许去匹配
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
|
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
|
|
|
WindowLoadModel.Isbgiframe = true;
|
|
|
|
|
WindowLoadModel.Load();
|
|
|
|
|
|
|
|
|
|
ajaxInit(WindowLoadModel);
|
|
|
|
|
//CreateDataGrid();
|
|
|
|
|
//ReadData();
|
|
|
|
|
//GetPrintersList();
|
|
|
|
|
|
|
|
|
|
//var printCallBack = function () {
|
|
|
|
|
// console.log('printing complete - first callback:');
|
|
|
|
|
|
|
|
|
|
// var param = new Object();
|
|
|
|
|
// param.obj = ppReturnObj;
|
|
|
|
|
// WindowLoadModel.Show();
|
|
|
|
|
// $.ajax({
|
|
|
|
|
// url: "../PostGoodServiceNew.asmx/PrintMDImg",
|
|
|
|
|
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
// success: function (data) {
|
|
|
|
|
// WindowLoadModel.Hide();
|
|
|
|
|
// if (data.d.Code == 1) {
|
|
|
|
|
// $("#agmdimg").attr("src", $("#mdimg").attr('src'));
|
|
|
|
|
// $("#mdimg").attr("src", "");
|
|
|
|
|
// $("#ppResult").text("Print Success");
|
|
|
|
|
// scanArr = [];
|
|
|
|
|
// $("#DataGrid2_TBody").empty();//清空扫描表
|
|
|
|
|
// RefreshTrayGoodsTableDatas();//Tray Goods Table 重新刷新数据
|
|
|
|
|
// $("#trayCode").val("");
|
|
|
|
|
// $("#sku_inp").val("");
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// alert("error:" + data.d.Message);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//var printAgainCallBack = function () {
|
|
|
|
|
// $("#agmdimg").hide();
|
|
|
|
|
// $("#mdimg").show();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
$("#btn_sch").bind("click", function () {
|
|
|
|
|
ReadData();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#btn_prsch").bind("click", function () {
|
|
|
|
|
GetPrintedTrayGoods();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#btn_prempty").bind("click", function () {
|
|
|
|
|
$('#pr_trayCode').val('');
|
|
|
|
|
$("#ptgResult").text('');
|
|
|
|
|
$("#DataGrid3_TBody").empty();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#btn_print').bind('click', function () {
|
|
|
|
|
console.log('打印拣货单')
|
|
|
|
|
$('#DataGrid3_Table').jqprint();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#btn_unprint').bind('click', function () {
|
|
|
|
|
var param = new Object();
|
|
|
|
|
// 创建一个新的日期对象
|
|
|
|
|
var currentDate = new Date();
|
|
|
|
|
|
|
|
|
|
// 获取当前日期的年、月和日
|
|
|
|
|
var currentYear = currentDate.getFullYear();
|
|
|
|
|
var currentMonth = currentDate.getMonth() + 1; // 月份从0开始,需要加1
|
|
|
|
|
var currentDay = currentDate.getDate();
|
|
|
|
|
|
|
|
|
|
// 格式化日期,确保月份和日期始终是两位数
|
|
|
|
|
currentMonth = (currentMonth < 10 ? "0" : "") + currentMonth;
|
|
|
|
|
currentDay = (currentDay < 10 ? "0" : "") + currentDay;
|
|
|
|
|
|
|
|
|
|
// 构建日期字符串
|
|
|
|
|
var formattedDate = currentYear + "-" + currentMonth + "-" + currentDay;
|
|
|
|
|
param.date = formattedDate;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/GetWareHouseUnPrintedDatas",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d.Code == 1) {
|
|
|
|
|
$("#DataGrid4_TBody").empty();
|
|
|
|
|
var tHtml = "";
|
|
|
|
|
for (var i = 0; i < data.d.Datas.length; i++) {
|
|
|
|
|
tHtml += "<tr name='DataGridRow' class='DataGridRowStyle'><td>" + data.d.Datas[i]["WareHouse"] + "</td><td>" + data.d.Datas[i]["TrackCode"] + "</td><td>" + data.d.Datas[i]["LocationCode"] + "</td><td>" + data.d.Datas[i]["SKU"] + "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid4_TBody").append(tHtml);
|
|
|
|
|
fopen();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert("error:" + data.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//页面回车事件监听
|
|
|
|
|
$('input').keypress(function (event) {
|
|
|
|
|
if (event.which === 13) {
|
|
|
|
|
var inputId = $(this).attr('id');
|
|
|
|
|
if (inputId === 'trayCode') {
|
|
|
|
|
// 在输入框1按下Enter键的事件处理
|
|
|
|
|
console.log('触发托盘码回车事件');
|
|
|
|
|
ReadData();
|
|
|
|
|
} else if (inputId === 'sku_inp') {
|
|
|
|
|
var thisScanSKUTime = new Date().getTime();
|
|
|
|
|
//上一次扫描时间为空,或者当前扫描时间-上一次扫描时间>2秒
|
|
|
|
|
if (lastScanSKUTime == null || thisScanSKUTime - lastScanSKUTime > 2000) {
|
|
|
|
|
// 在输入框2按下Enter键的事件处理
|
|
|
|
|
lastScanSKUTime = thisScanSKUTime;
|
|
|
|
|
console.log(lastScanSKUTime);
|
|
|
|
|
console.log('触发扫SKU事件');
|
|
|
|
|
MateSKUinTable($("#sku_inp").val());
|
|
|
|
|
} else {
|
|
|
|
|
//$("#sku_inp").val('');
|
|
|
|
|
//alert("请间隔两秒扫描");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else if (inputId === 'pr_trayCode') {
|
|
|
|
|
GetPrintedTrayGoods();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//清空表格,页面数据全部清空
|
|
|
|
|
$("#btn_empty").bind("click", function () {
|
|
|
|
|
if (window.confirm('Are you sure to clear table ?') == false) return;
|
|
|
|
|
tableArr = [];//将表格数组清空
|
|
|
|
|
$("#DataGrid1_TBody").empty();
|
|
|
|
|
scanArr = [];
|
|
|
|
|
$("#DataGrid2_TBody").empty();//清空扫描表
|
|
|
|
|
$("#ppResult").text('');
|
|
|
|
|
|
|
|
|
|
$("#trayCode").val("");
|
|
|
|
|
$("#sku_inp").val("");
|
|
|
|
|
|
|
|
|
|
ppReturnObj = null;
|
|
|
|
|
$("#mdimg").attr("src", "");
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//匹配sku
|
|
|
|
|
$("#pp_sku").bind("click", function () {
|
|
|
|
|
var thisScanSKUTime = new Date().getTime();
|
|
|
|
|
if (lastScanSKUTime == null || thisScanSKUTime - lastScanSKUTime > 2000) {
|
|
|
|
|
lastScanSKUTime = thisScanSKUTime;
|
|
|
|
|
MateSKUinTable($("#sku_inp").val());
|
|
|
|
|
} else {
|
|
|
|
|
//alert("请间隔两秒扫描");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//调用后台接口,打印面单
|
|
|
|
|
$("#printBtn").bind("click", function () {
|
|
|
|
|
var imgUrl = $("#mdimg").attr('src');
|
|
|
|
|
if (imgUrl === '') {
|
|
|
|
|
alert("Image does not exist ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
PrinterTrackingCode(imgUrl, 1, ppReturnObj.ExpressName, ppReturnObj.QtySKU);
|
|
|
|
|
|
|
|
|
|
//if ($("#printerName").val() === '') {
|
|
|
|
|
// alert("Printer name cannot empty");
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//$('#mdimg').print({ deferred: $.Deferred().done(printCallBack) })
|
|
|
|
|
|
|
|
|
|
//var param = new Object();
|
|
|
|
|
//param.imgurl = $("#mdimg").attr('src');
|
|
|
|
|
//param.printer = $("#printerName").val();
|
|
|
|
|
//param.obj = ppReturnObj;
|
|
|
|
|
//WindowLoadModel.Show();
|
|
|
|
|
//$.ajax({
|
|
|
|
|
// url: "../PostGoodServiceNew.asmx/PrintMDImg",
|
|
|
|
|
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
// success: function (data) {
|
|
|
|
|
// WindowLoadModel.Hide();
|
|
|
|
|
// if (data.d.Code == 1) {
|
|
|
|
|
// $("#mdimg").attr("src", "");
|
|
|
|
|
// $("#ppResult").text("Print Success");
|
|
|
|
|
// scanArr = [];
|
|
|
|
|
// $("#DataGrid2_TBody").empty();//清空扫描表
|
|
|
|
|
// RefreshTrayGoodsTableDatas();//Tray Goods Table 重新刷新数据
|
|
|
|
|
// $("#trayCode").val("");
|
|
|
|
|
// $("#sku_inp").val("");
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// alert("error:" + data.d.Message);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
//$("#mdimg").jqprint({ debug: false, importCSS: true, printContainer: true, operaSupport: true });
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$("#printAgainBtn").bind("click", function () {
|
|
|
|
|
var imgUrl = $("#agmdimg").attr('src');
|
|
|
|
|
if (imgUrl === '') {
|
|
|
|
|
alert("Image does not exist ");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$('#mdimg').hide();
|
|
|
|
|
$('#agmdimg').show();
|
|
|
|
|
|
|
|
|
|
PrinterTrackingCode(imgUrl, 2, ppReturnObjLast.ExpressName, ppReturnObjLast.QtySKU);
|
|
|
|
|
//$('#agmdimg').print({ deferred: $.Deferred().done(printAgainCallBack) })
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function fopen() {
|
|
|
|
|
|
|
|
|
|
$.fancybox({
|
|
|
|
|
'width': '40%',
|
|
|
|
|
'height': '40%',
|
|
|
|
|
'autoScale': false,
|
|
|
|
|
'transitionIn': 'elastic',
|
|
|
|
|
'transitionOut': 'elastic',
|
|
|
|
|
'href': '#test',
|
|
|
|
|
'onComplete': function () {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function PrinterTrackingCode(imgUrl, type,postType,text) {
|
|
|
|
|
var apiUrl = 'http://localhost:8090/api/home/PrintTrackingCode';
|
|
|
|
|
var parameter = { imgPath: imgUrl, text: text, postType: postType };
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: apiUrl,
|
|
|
|
|
type: 'GET',
|
|
|
|
|
data: parameter,
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.Code == 1) {
|
|
|
|
|
//alert("打印成功")
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
printCallBack();
|
|
|
|
|
} else {
|
|
|
|
|
$("#agmdimg").hide();
|
|
|
|
|
$("#mdimg").show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert(data.Msg);
|
|
|
|
|
}
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
},
|
|
|
|
|
error: function (xhr, status, error) {
|
|
|
|
|
isMatch =1;
|
|
|
|
|
alert("PrintApp is error");
|
|
|
|
|
// 处理错误
|
|
|
|
|
console.error("PrintApp is error");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//console.log('触发打印事件');
|
|
|
|
|
//$('#mdimg').print({ deferred: $.Deferred().done(zdprintCallBack) });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function printCallBack () {
|
|
|
|
|
var param = new Object();
|
|
|
|
|
if (ppReturnObj === null) {
|
|
|
|
|
alert("error, please rescan the SKU");
|
|
|
|
|
retur;
|
|
|
|
|
}
|
|
|
|
|
param.obj = ppReturnObj;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/PrintMDImg",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d.Code == 1) {
|
|
|
|
|
$("#agmdimg").attr("src", $("#mdimg").attr('src'));
|
|
|
|
|
ppReturnObjLast = ppReturnObj;
|
|
|
|
|
$("#mdimg").attr("src", "");
|
|
|
|
|
$("#ppResult").text("Print Success");
|
|
|
|
|
scanArr = [];
|
|
|
|
|
$("#DataGrid2_TBody").empty();//清空扫描表
|
|
|
|
|
RefreshTrayGoodsTableDatas();//Tray Goods Table 重新刷新数据
|
|
|
|
|
$("#trayCode").val("");
|
|
|
|
|
$("#sku_inp").val("");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
alert("error, please rescan the SKU");
|
|
|
|
|
}
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#region 初始化DataGrid
|
|
|
|
|
function CreateDataGrid() {
|
|
|
|
|
|
|
|
|
|
var col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "SKU";
|
|
|
|
|
col.CellTemplate = "<span>{Bind SKU}</span>";
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "LocationCode";
|
|
|
|
|
col.CellTemplate = "<a>{Bind LocationCode}</a>";
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "PickQty";
|
|
|
|
|
col.CellTemplate = "<a>{Bind PickQty}</a>";
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
|
|
|
|
|
col = new nblf.ui.DataGridColumn();
|
|
|
|
|
col.HeaderText = "PrintQty";
|
|
|
|
|
col.CellTemplate = "<a>{Bind PrintQty}</a>";
|
|
|
|
|
Array.add(datagrid1.Columns, col);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
datagrid1.SetPageSize(200);
|
|
|
|
|
datagrid1.SetPageIndex(1);
|
|
|
|
|
|
|
|
|
|
datagrid1.SortExpression = "Id ";
|
|
|
|
|
datagrid1.ViewSortDirection = "desc";
|
|
|
|
|
datagrid1.IsFixHeader = true;
|
|
|
|
|
datagrid1.ShowIndexColumn = true;
|
|
|
|
|
datagrid1.AllowPaging = true;
|
|
|
|
|
datagrid1.AllowPaging2 = true;
|
|
|
|
|
datagrid1.ShowIndexColumn = true;
|
|
|
|
|
datagrid1.Width = "100%";
|
|
|
|
|
datagrid1.SelectMode = nblf.ui.SelectMode.CheckBox;
|
|
|
|
|
datagrid1.Init();
|
|
|
|
|
datagrid1.Sorting(function () {
|
|
|
|
|
|
|
|
|
|
ReadData();
|
|
|
|
|
});
|
|
|
|
|
datagrid1.add_PageIndexChanged(function () { ReadData(); });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
//#region 读取数据
|
|
|
|
|
function ReadData() {
|
|
|
|
|
var param = new Object();
|
|
|
|
|
if ($("#trayCode").val() == "") {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
param.trayCode = $("#trayCode").val();
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/GetTrayGoodsDetailPrintDatas",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d.RowCount == -1) {
|
|
|
|
|
alert(" Your account can not print tracking code");
|
|
|
|
|
}
|
|
|
|
|
else if (data.d.RowCount > 0) {
|
|
|
|
|
var _html = "";
|
|
|
|
|
for (var i = 0; i < data.d.RowCount; i++) {
|
|
|
|
|
_html += "<tr name='DataGridRow' class='DataGridRowStyle' rowid=" + data.d.DataSource[i]["ID"] + "><td>" + data.d.DataSource[i]["TrayCode"] + "</td><td>" + data.d.DataSource[i]["SKU"] + (data.d.DataSource[i]["NewSKU"] === "" ? "" : "<p>(" + data.d.DataSource[i]["NewSKU"] + ")</p>") + "</td><td>" + data.d.DataSource[i]["PackGoodCode"] + (data.d.DataSource[i]["PackGoodCode2"] === "" ? "" : "<p>(" + data.d.DataSource[i]["PackGoodCode2"] + ")</p>") + "</td><td>" + data.d.DataSource[i]["LocationCode"] + "</td><td>" + data.d.DataSource[i]["PickQty"] + "</td><td>" + data.d.DataSource[i]["PrintQty"] + "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid1_TBody").append(_html);
|
|
|
|
|
|
|
|
|
|
//将查询到的托盘内的数据加入到表格数组中,进行统一计算
|
|
|
|
|
for (var j = 0; j < data.d.DataSource.length; j++) {
|
|
|
|
|
tableArr.push(data.d.DataSource[j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//在表格数据中匹配sku
|
|
|
|
|
function MateSKUinTable(sku) {
|
|
|
|
|
debugger;
|
|
|
|
|
try {
|
|
|
|
|
if (isMatch == 0) //如果isMatch==0,表示上一张面单还没有打印完成,不允许打印
|
|
|
|
|
return;
|
|
|
|
|
isMatch = 0; //将isMatch改为0,打印完成之后,改为1
|
|
|
|
|
if (sku == "")
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//在数组中返回第一条符合条件的数据
|
|
|
|
|
var pgdata = $.grep(tableArr, function (e) {
|
|
|
|
|
return (e.PackGoodCode.toUpperCase() == sku.toUpperCase() || e.PackGoodCode2.toUpperCase() == sku.toUpperCase() || e.SKU.toUpperCase() == sku.toUpperCase() || e.NewSKU.toUpperCase() == sku.toUpperCase()) && (e.PickQty - e.PrintQty) > 0;
|
|
|
|
|
});
|
|
|
|
|
//没有在表格中匹配到对应的数据
|
|
|
|
|
if (pgdata == null || pgdata.length == 0) {
|
|
|
|
|
alert(" No matching data");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
//匹配到数据之后,将数据加入到正在扫描匹配的数据数组scanArr中,到后台去匹配订单跟踪码
|
|
|
|
|
//判断已扫描待匹配的数组中是否存在刚刚扫描的sku,如果存在则数量+1,如果不存在,加入到数组中
|
|
|
|
|
var found = false;
|
|
|
|
|
for (var i = 0; i < scanArr.length; i++) {
|
|
|
|
|
if (scanArr[i].SKU.toUpperCase() === pgdata[0].SKU.toUpperCase()) {
|
|
|
|
|
scanArr[i].ScanQty += 1;
|
|
|
|
|
found = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!found) {
|
|
|
|
|
scanArr.push({ SKU: pgdata[0].SKU, ScanQty: 1 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showScanGoods(scanArr);
|
|
|
|
|
MatchTrackingCode();
|
|
|
|
|
}
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
}
|
|
|
|
|
catch (ex) {
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//匹配打印面单
|
|
|
|
|
function MatchTrackingCode() {
|
|
|
|
|
var currentDate = new Date();
|
|
|
|
|
var nowDate = currentDate.toLocaleDateString();
|
|
|
|
|
//console.log(nowDate + " " + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds());
|
|
|
|
|
|
|
|
|
|
//var previousDate = new Date(currentDate);
|
|
|
|
|
//previousDate.setDate(currentDate.getDate() - 1);
|
|
|
|
|
//var nowDate = previousDate.toLocaleDateString();
|
|
|
|
|
//去后台匹配数据
|
|
|
|
|
var param = new Object();
|
|
|
|
|
param.tpgs = scanArr;
|
|
|
|
|
param.tgoods = tableArr;
|
|
|
|
|
param.nowDate = nowDate;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/MatchOrderTrackingCode",
|
|
|
|
|
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
type: 'POST',
|
|
|
|
|
data: JSON.stringify(param),
|
|
|
|
|
contentType: "application/json; charset=utf-8",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d.Code == 1) {
|
|
|
|
|
$("#mdimg").attr("src", data.d.Obj.LabelUrl);
|
|
|
|
|
$("#ppResult").text(data.d.Msg);
|
|
|
|
|
ppReturnObj = data.d.Obj;
|
|
|
|
|
//当正在匹配的商品数量>1 或者 商品种类>1时需要手动点打印,如果是一个商品匹配到了面单直接打印
|
|
|
|
|
if (scanArr != null && scanArr.length == 1 && scanArr[0]["ScanQty"] == 1) {
|
|
|
|
|
PrinterTrackingCode(data.d.Obj.LabelUrl, 1, data.d.Obj.ExpressName, data.d.Obj.QtySKU);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$("#mdimg").attr("src", "");
|
|
|
|
|
$("#ppResult").text(data.d.Msg);
|
|
|
|
|
ppReturnObj = null;
|
|
|
|
|
}
|
|
|
|
|
$("#sku_inp").val("");
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
isMatch = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//刷新扫描表
|
|
|
|
|
function showScanGoods(scanArr) {
|
|
|
|
|
$("#DataGrid2_TBody").empty();
|
|
|
|
|
var html = "";
|
|
|
|
|
for (var i = 0; i < scanArr.length; i++) {
|
|
|
|
|
html += "<tr><td>" + scanArr[i]["SKU"] + "</td><td>" + scanArr[i]["ScanQty"] + "</td><td><input onclick='DelScanGoods("+i+")' class='btnClass dgbtnDel' type='button' value='Delete'></td></tr>"
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid2_TBody").append(html);
|
|
|
|
|
}
|
|
|
|
|
//删除Scanning Goods Table表中的数据
|
|
|
|
|
function DelScanGoods(row) {
|
|
|
|
|
scanArr.splice(row, 1);//删除指定行元素
|
|
|
|
|
showScanGoods(scanArr);
|
|
|
|
|
MatchTrackingCode();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//打印成功之后刷新托盘商品表中的数据
|
|
|
|
|
function RefreshTrayGoodsTableDatas() {
|
|
|
|
|
//去后台匹配数据
|
|
|
|
|
var param = new Object();
|
|
|
|
|
var trayCodes = [...new Set(tableArr.map(item => item.TrayCode))];
|
|
|
|
|
var _trayCodes = trayCodes.join(",");
|
|
|
|
|
param.trayCodes = _trayCodes;
|
|
|
|
|
WindowLoadModel.Show();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/GetTrayGoodsDetailPrintDatasByTrayCodes",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
WindowLoadModel.Hide();
|
|
|
|
|
if (data.d.RowCount >= 0) {
|
|
|
|
|
tableArr = data.d.DataSource;
|
|
|
|
|
$("#DataGrid1_TBody").empty();
|
|
|
|
|
var _html = "";
|
|
|
|
|
for (var i = 0; i < data.d.RowCount; i++) {
|
|
|
|
|
_html += "<tr name='DataGridRow' class='DataGridRowStyle' rowid=" + data.d.DataSource[i]["ID"] + "><td>" + data.d.DataSource[i]["TrayCode"] + "</td><td>" + data.d.DataSource[i]["SKU"] + (data.d.DataSource[i]["NewSKU"] === "" ? "" : "<p>(" + data.d.DataSource[i]["NewSKU"] + ")</p>") + "</td><td>"+ data.d.DataSource[i]["PackGoodCode"] + (data.d.DataSource[i]["PackGoodCode2"] === "" ? "" : "<p>(" + data.d.DataSource[i]["PackGoodCode2"] + ")</p>") +"</td><td>" + data.d.DataSource[i]["LocationCode"] + "</td><td>" + data.d.DataSource[i]["PickQty"] + "</td><td>" + data.d.DataSource[i]["PrintQty"] + "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid1_TBody").append(_html);
|
|
|
|
|
} else {
|
|
|
|
|
alert("Refresh Tray Goods Table Datas Fail");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function GetPrintersList() {
|
|
|
|
|
$("#printerName").append("<option value=''></option>");
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/GetUsablePrinters",
|
|
|
|
|
//data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
$(data.d).each(function () {
|
|
|
|
|
$("#printerName").append("<option value='" + this + "'>" + this + "</option>");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetPrintedTrayGoods() {
|
|
|
|
|
$("#DataGrid3_TBody").empty();
|
|
|
|
|
var param = new Object();
|
|
|
|
|
if ($('#pr_trayCode').val() == '') {
|
|
|
|
|
$("#btn_print").prop("disabled", true);
|
|
|
|
|
$('#ptgResult').text('');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
param.trayCode = $('#pr_trayCode').val();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "../PostGoodServiceNew.asmx/GetPrintedTrayGoodsDetailDatas",
|
|
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
|
|
success: function (data) {
|
|
|
|
|
if (data.d.Code == 1) {
|
|
|
|
|
$('#ptgResult').text(data.d.Message);
|
|
|
|
|
if (data.d.Datas.length > 0) {
|
|
|
|
|
var html = "";
|
|
|
|
|
for (var i = 0; i < data.d.Datas.length; i++) {
|
|
|
|
|
html += "<tr name='DataGridRow' class='DataGridRowStyle' rowid=" + data.d.Datas[i]["ID"] + "><td>" + data.d.Datas[i]["TrayCode"] + "</td><td>" + data.d.Datas[i]["SKU"] + "</td><td>" + data.d.Datas[i]["LocationCode"] + "</td><td>" + data.d.Datas[i]["PickQty"] + "</td><td>" + data.d.Datas[i]["PrintQty"] + "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid3_TBody").append(html);
|
|
|
|
|
$("#btn_print").prop("disabled", false);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$('#ptgResult').text(data.d.Message);
|
|
|
|
|
$("#btn_print").prop("disabled", true);
|
|
|
|
|
if (data.d.Datas.length > 0) {
|
|
|
|
|
var html = "";
|
|
|
|
|
for (var i = 0; i < data.d.Datas.length; i++) {
|
|
|
|
|
html += "<tr name='DataGridRow' class='DataGridRowStyle' rowid=" + data.d.Datas[i]["ID"] + "><td>" + data.d.Datas[i]["TrayCode"] + "</td><td>" + data.d.Datas[i]["SKU"] + "</td><td>" + data.d.Datas[i]["LocationCode"] + "</td><td>" + data.d.Datas[i]["PickQty"] + "</td><td>" + data.d.Datas[i]["PrintQty"] + "</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
$("#DataGrid3_TBody").append(html);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
@media print {
|
|
|
|
|
@page {
|
|
|
|
|
margin: 1cm;
|
|
|
|
|
width:21.6cm;
|
|
|
|
|
height:27.9cm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#mdimg,#agmdimg{
|
|
|
|
|
max-width:100% !important;
|
|
|
|
|
page-break-inside: avoid; /* 避免图片跨页打印 */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
<body class="headbody">
|
|
|
|
|
<div class="title_ico">UnPrinted Tracking Code</div>
|
|
|
|
|
<div style="display: none">
|
|
|
|
|
|
|
|
|
|
<div id="test" title="Order Ship Info" style="width:600px; height:400px;">
|
|
|
|
|
<table width="95%" class="tableAll" border="1" ellspacing="0" cellpadding="2">
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" colspan="7">
|
|
|
|
|
|
|
|
|
|
<div id="DataGrid4" class="DataGridStyle" style="width:100%;">
|
|
|
|
|
<table id="DataGrid4_Table" class="DataGridTableStyle" style="width:100%;">
|
|
|
|
|
<thead><tr name="DataGridHeader" class="HeaderStyle">
|
|
|
|
|
<th>WareHouse</th>
|
|
|
|
|
<th>Tracking Code</th>
|
|
|
|
|
<th>Location Code</th>
|
|
|
|
|
<th>SKU</th>
|
|
|
|
|
</tr></thead>
|
|
|
|
|
<tbody id="DataGrid4_TBody">
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="left-body" style="width:60%;float:left;">
|
|
|
|
|
<div class="title_ico">Pallet Goods Table</div>
|
|
|
|
|
<table id="tb1" class="tableAll" style="width: 100%;">
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="f1" width="10%">Pallet Code:</td>
|
|
|
|
|
<td><input id="trayCode" class="editTextbox" style="width: 120px;" type="text" autocomplete="off" /></td>
|
|
|
|
|
|
|
|
|
|
<td><input id="btn_sch" class="btnClass btnClassFind" type="button" value="Search" /></td>
|
|
|
|
|
<td><input id="btn_empty" class="btnClass dgbtnDel" type="button" value="Clear Table" /></td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<td class="f1" width="10%">SKU:</td>
|
|
|
|
|
<td><input id="sku_inp" class="editTextbox" style="width: 120px;" type="text" autocomplete="off" /></td>
|
|
|
|
|
<td><input id="pp_sku" class="btnClass btnClassFind" type="button" value="Match SKU" /></td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" colspan="7">
|
|
|
|
|
<div id="DataGrid1" class="DataGridStyle" style="width:100%;">
|
|
|
|
|
<table id="DataGrid1_Table" class="DataGridTableStyle" style="width:100%;">
|
|
|
|
|
<thead><tr name="DataGridHeader" class="HeaderStyle">
|
|
|
|
|
<th>Pallet Code</th>
|
|
|
|
|
<th>SKU</th>
|
|
|
|
|
<th>PackCode</th>
|
|
|
|
|
<th>Location</th>
|
|
|
|
|
<th>PickQty</th>
|
|
|
|
|
<th>PrintQty</th>
|
|
|
|
|
</tr></thead>
|
|
|
|
|
<tbody id="DataGrid1_TBody">
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<div class="title_ico" style="margin-top:50px;">Scanning Goods Table</div>
|
|
|
|
|
<table id="tb2" class="tableAll" style="width: 100%;">
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" colspan="7">
|
|
|
|
|
|
|
|
|
|
<div id="DataGrid2" class="DataGridStyle" style="width:100%;">
|
|
|
|
|
<table id="DataGrid2_Table" class="DataGridTableStyle" style="width:100%;">
|
|
|
|
|
<thead><tr name="DataGridHeader" class="HeaderStyle">
|
|
|
|
|
<th>SKU</th>
|
|
|
|
|
<th>Scan Qty</th>
|
|
|
|
|
<th>Option</th>
|
|
|
|
|
</tr></thead>
|
|
|
|
|
<tbody id="DataGrid2_TBody">
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr><td>Result:<span id="ppResult" style="color:red;"></span></td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<div class="title_ico" style="margin-top:50px;">Printed Pallet Goods Table</div>
|
|
|
|
|
<table id="tb3" class="tableAll" style="width: 100%;">
|
|
|
|
|
<tr>
|
|
|
|
|
<td>
|
|
|
|
|
<span >Pallet Code:</span>
|
|
|
|
|
<span><input id="pr_trayCode" class="editTextbox" style="width: 120px;" type="text" autocomplete="off" /></span>
|
|
|
|
|
|
|
|
|
|
<span><input id="btn_prsch" class="btnClass btnClassFind" type="button" value="Search" /></span>
|
|
|
|
|
<span><input id="btn_prempty" class="btnClass dgbtnDel" type="button" value="Clear Table" /></span>
|
|
|
|
|
<span><input id="btn_print" class="btnClass btnClassFind" type="button" disabled value="Print Table" /></span>
|
|
|
|
|
|
|
|
|
|
<span><input id="btn_unprint" class="btnClass btnClassFind" type="button" value="UnPrinted Tracking Code" /></span>
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top" colspan="7">
|
|
|
|
|
<div id="DataGrid3" class="DataGridStyle" style="width:100%;">
|
|
|
|
|
<table id="DataGrid3_Table" class="DataGridTableStyle" style="width:100%;">
|
|
|
|
|
|
|
|
|
|
<thead>
|
|
|
|
|
<tr name="DataGridHeader" class="HeaderStyle">
|
|
|
|
|
<th>PalletCode</th>
|
|
|
|
|
<th>SKU</th>
|
|
|
|
|
<th>Location</th>
|
|
|
|
|
<th>PickQty</th>
|
|
|
|
|
<th>PrintQty</th>
|
|
|
|
|
</tr></thead>
|
|
|
|
|
<tbody id="DataGrid3_TBody">
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr><td>Result:<span id="ptgResult" style="color:red;"></span></td></tr>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right-body" style="width:35%;float:left;margin-left:3%;">
|
|
|
|
|
<div class="img_div" style="width:100%;height:700px;">
|
|
|
|
|
<%-- <img id="mdimg" src="http://localhost:53137/attached/fedex/789108384579.png" height="700" />--%>
|
|
|
|
|
<img id="mdimg" src="" height="700" />
|
|
|
|
|
<img id="agmdimg" src="" height="700" style="display:none;"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="printMD">
|
|
|
|
|
<%-- <span>Printer Name:</span>--%>
|
|
|
|
|
<%-- <select id="printerName"></select>--%>
|
|
|
|
|
|
|
|
|
|
<%-- <input id="printerName" class="editTextbox" style="width: 300px;" type="text" autocomplete="off"/>--%>
|
|
|
|
|
<input id="printBtn" class="btnClass btnClassFind" type="button" value="Tracking Code Print" style="width:150px;" />
|
|
|
|
|
<input id="printAgainBtn" class="btnClass btnClassFind" type="button" value="Reprint Last Tracking Code" style="width:250px; margin-left:50px;" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|