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.
 
 
 
 
 

1211 lines
51 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
var ID = $.request("ID");
var Type = $.request("Type");
var InvCode = $.request("InvCode");
var ApplyNegCode = $.request("ApplyNegCode");
var OApplyNegCode = $.request("OApplyNegCode");
var SDNCode = $.request("SDNCode");
var InCode = $.request("InCode");
var Sequence = $.request("Sequence");
// var MOCode = $.request("MOCode");
var MOCode = decodeURI($.request("MOCode"))
var ReturnCode = $.request("ReturnCode");
var DNCode = $.request("DNCode");
var ODNCode = $.request("ODNCode");
var RCVCode = $.request("RCVCode");
var LLApplyNegCode = $.request("LLApplyNegCode");
var CLApplyNegCode = $.request("CLApplyNegCode");
var WWLLOApplyNegCode = $.request("WWLLOApplyNegCode");
var WWCLOApplyNegCode = $.request("WWCLOApplyNegCode");
var TransferNO = $.request("TransferNO");
var FGGDMOCode = $.request("FGGDMOCode");
var MODetailID = $.request("MODetailID");
var OODetailID = $.request("OODetailID");
//var FCPMOCode = $.request("FCPMOCode");
var FCPMOCode = decodeURI($.request("FCPMOCode"))
var VenCode = "";
var WorkPoint = "";
var Quantitys = $.request("Quantity");
var Mtime = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate();
var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
//料品辅助计量开关
var InvAmountEnable = false;
//主计量、辅计量标志
var minPackQtyEnable = false;
var AmountEnable = false;
//本次生成数量、最小包装量、计量标志
var thisCreateQtyEnable = false;
var MeasureEnable = false;
var cretePageCountEnable = false;
var IsContainerEnable = false;
$(function () {
$("#minPackQty").keyup(function () {
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).bind("paste", function () { //CTR+V事件处理
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).css("ime-mode", "disabled"); //CSS设置输入法不可用
$("#thisCreateQty").keyup(function () {
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).bind("paste", function () { //CTR+V事件处理
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).css("ime-mode", "disabled"); //CSS设置输入法不可用
$("#cretePageCount").keyup(function () {
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).bind("paste", function () { //CTR+V事件处理
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).css("ime-mode", "disabled"); //CSS设置输入法不可用
$("#PRODUCTDATE").val(Mtime);
$("#creatPackCount").keyup(function () {
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).bind("paste", function () { //CTR+V事件处理
$(this).val($(this).val().replace(/[^0-9.]/g, ''));
}).css("ime-mode", "disabled"); //CSS设置输入法不可用
$("#INVUOM").attr("disabled", "disabled");
$("#InvCode").attr("disabled", "disabled");
$("#INVNAME").attr("disabled", "disabled");
$("#INVSTD").attr("disabled", "disabled");
$("#Quantity").attr("disabled", "disabled");
$("#CreatedQty").attr("disabled", "disabled");
//$("#Amount").attr("disabled", "disabled");
SeachMeasure();
SeachLableofDisable();
SeachDatabyInvCode(InvCode);//查是否启用府计量 AmountEnable;是否自动生成箱号 ContainerEnable;
SeachInfoByCodeAndSequence();
debugger;
if (thisCreateQtyEnable == true && cretePageCountEnable == true)
{
$("#Amount").attr("disabled", "disabled");
$("#minPackQty").attr("disabled", "disabled");
$("#cretePageCount").change(cretePageCount_Change);
$("#thisCreateQty").change(thisCreate_Change);
}
else if (thisCreateQtyEnable == true && MeasureEnable==true)
{
if (InvAmountEnable == true && AmountEnable == true)
{
$("#cretePageCount").attr("disabled", "disabled");
$("#minPackQty").attr("disabled", "disabled");
$("#Amount").change(Amount_Change);
$("#thisCreateQty").change(thisCreate_Change);
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (YAmount==0) {
$.modalMsg("源头单据辅计量数量不可0,请确认!", "warning");
return;
}
}
else
{
//基础版原逻辑
$("#Amount").attr("disabled", "disabled");
$("#cretePageCount").attr("disabled", "disabled");
$("#minPackQty").change(minPack_Change);
$("#thisCreateQty").change(thisCreate_Change);
//$("#minPackQty").change(minPackQty_Change);
//$("#thisCreateQty").change(thisCreateQty_Change);
//$("#cretePageCount").change(function () {
// var createPageCount = $("#cretePageCount").val() * 1;//本次生成张数
// createPageCount = createPageCount.toFixed(0);
// if (createPageCount <= 0) {
// $.modalAlertNew("WMS00102");
// return false;
// }
//});
}
}
else if (MeasureEnable == true && cretePageCountEnable==true)
{
if (InvAmountEnable == true && AmountEnable == true)
{
$("#minPackQty").attr("disabled", "disabled");
$("#thisCreateQty").attr("disabled", "disabled");
$("#Amount").change(Amount_Change);
$("#cretePageCount").change(cretePageCount_Change);
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (YAmount == 0) {
$.modalMsg("源头单据辅计量数量不可0,请确认!", "warning");
return;
}
}
else
{
$("#Amount").attr("disabled", "disabled");
$("#thisCreateQty").attr("disabled", "disabled");
$("#minPackQty").change(minPack_Change);
$("#cretePageCount").change(cretePageCount_Change);
}
}
if (IsContainerEnable == true)//是否自动生成箱号 ContainerEnable=true
{
}
else//是否自动生成箱号 ContainerEnable=false
{
$(".HideTxt").css('display', 'none');
}
ControlVendorLotNo(VenCode);
ControlICSExtensionEnable();
ControlICSColumnEnable();
LoadShow();
LoadShowForColumn();
});
//查询料品辅计量开关
function SeachDatabyInvCode(InvCode) {
$.ajax({
url: "/WMS/WMSCreateItemLot/SeachDatabyInvCode?InvCode=" + InvCode + "&" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data.rows[0].AmountEnable == '1') {
InvAmountEnable = true;
}
if (data.rows[0].ContainerEnable == '1') {
IsContainerEnable = true;
}
}
});
}
//查询配置项-计量单位
function SeachMeasure() {
$.ajax({
url: "/WMS/WMSCreateItemLot/SeachMeasure" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data.rows[0].Code == 'AmountEnable') {
AmountEnable = true;
} else {
minPackQtyEnable = true;
}
}
});
}
//查询配置项-栏位输入限制
function SeachLableofDisable() {
$.ajax({
url: "/WMS/WMSCreateItemLot/SeachLableofDisable" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data.rows[0].Code == 'thisCreateQtyEnable' && data.rows[0].Enable==true) {
thisCreateQtyEnable = true;
}
if (data.rows[1].Code == 'MeasureEnable' && data.rows[1].Enable == true) {
MeasureEnable = true;
}
if (data.rows[2].Code == 'cretePageCountEnable' && data.rows[2].Enable == true) {
cretePageCountEnable = true;
}
}
});
}
//加载页面信息
function SeachInfoByCodeAndSequence() {
if (Type == '3') {
if (!!MOCode && !!Sequence) {
$.ajax({
url: "/WMS/WMSCreateItemLot/GetSubGridJsonChengPingByCreate?MOCode=" + MOCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints + "&Quantity=" + Quantitys + "&InvCode=" + InvCode,
dataType: "json",
async: false,
success: function (data) {
$("#Enable").val(data.rows[0].Enable);
debugger;
LotNoInfoControlFreeTerm( data.rows[0].InvCode, data.rows[0].InvUnit, data.rows[0].InvName, data.rows[0].InvStd, data.rows[0].Quantity, data.rows[0].CreatedQty, data.rows[0].thisCreateQty, data.rows[0].Amount, data.rows[0].EffectiveEnable, data.rows[0].EffectiveDays, data.rows[0].BatchCode, data.rows[0].VenCode, data.rows[0].WorkPoint, data.rows[0].ProjectCode, data.rows[0].BatchCode, data.rows[0].Version, data.rows[0].Brand, data.rows[0].cFree1, data.rows[0].cFree2, data.rows[0].cFree3, data.rows[0].cFree4, data.rows[0].cFree5, data.rows[0].cFree6, data.rows[0].cFree7, data.rows[0].cFree8, data.rows[0].cFree9, data.rows[0].cFree10, data.rows[0].ClassCode, data.rows[0].EATTRIBUTE2, data.rows[0].EATTRIBUTE3, data.rows[0].EATTRIBUTE4, data.rows[0].EATTRIBUTE5, data.rows[0].EATTRIBUTE6, data.rows[0].EATTRIBUTE7, data.rows[0].EATTRIBUTE8, data.rows[0].EATTRIBUTE9, data.rows[0].EATTRIBUTE10)
}
});
//$.ajax({
// url: "/WMS/WMSCreateItemLot/GetVendorBatch",
// //data: { keyValue: keyValue },
// dataType: "json",
// async: false,
// success: function (data) {
// $("#BatchCode").val(data.VendorLotNo);
// }
//});
}
}
if (Type == '8') {
if (!!ODNCode && !!Sequence) {
$.ajax({
url: "/WMS/WMSCreateItemLot/GetSubGridJsonWWSHDHByCreate?ODNCode=" + ODNCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints + "&Quantity=" + Quantitys + "&InvCode=" + InvCode,
dataType: "json",
async: false,
success: function (data) {
$("#Enable").val(data.rows[0].Enable);
LotNoInfoControlFreeTerm( data.rows[0].InvCode, data.rows[0].InvUnit, data.rows[0].InvName, data.rows[0].InvStd, data.rows[0].Quantity, data.rows[0].CreatedQty, data.rows[0].thisCreateQty, data.rows[0].Amount, data.rows[0].EffectiveEnable, data.rows[0].EffectiveDays, data.rows[0].BatchCode, data.rows[0].VenCode, data.rows[0].WorkPoint, data.rows[0].ProjectCode, data.rows[0].BatchCode, data.rows[0].Version, data.rows[0].Brand, data.rows[0].cFree1, data.rows[0].cFree2, data.rows[0].cFree3, data.rows[0].cFree4, data.rows[0].cFree5, data.rows[0].cFree6, data.rows[0].cFree7, data.rows[0].cFree8, data.rows[0].cFree9, data.rows[0].cFree10, data.rows[0].ClassCode, data.rows[0].EATTRIBUTE2, data.rows[0].EATTRIBUTE3, data.rows[0].EATTRIBUTE4, data.rows[0].EATTRIBUTE5, data.rows[0].EATTRIBUTE6, data.rows[0].EATTRIBUTE7, data.rows[0].EATTRIBUTE8, data.rows[0].EATTRIBUTE9, data.rows[0].EATTRIBUTE10)
}
});
}
}
}
//查询后台自由项表(控制前台显示)
function ControlICSExtensionEnable() {
$.ajax({
url: "/WMS/WMSCreateItemLot/SelectICSExtensionEnable" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data != null && data.length > 0) {
for (var i = 0; i < data.length; i++) {
if (data[i].ColCode == 'ProjectCode') { $("#trProjectCode").css('display', 'none'); }
if (data[i].ColCode == 'BatchCode') { $("#trBatchCode").css('display', 'none'); }
if (data[i].ColCode == 'Version') { $("#trVersion").css('display', 'none'); }
if (data[i].ColCode == 'Brand') { $("#trBrand").css('display', 'none'); }
if (data[i].ColCode == 'cFree1') { $("#trcFree1").css('display', 'none'); }
if (data[i].ColCode == 'cFree2') { $("#trcFree2").css('display', 'none'); }
if (data[i].ColCode == 'cFree3') { $("#trcFree3").css('display', 'none'); }
if (data[i].ColCode == 'cFree4') { $("#trcFree4").css('display', 'none'); }
if (data[i].ColCode == 'cFree5') { $("#trcFree5").css('display', 'none'); }
if (data[i].ColCode == 'cFree6') { $("#trcFree6").css('display', 'none'); }
if (data[i].ColCode == 'cFree7') { $("#trcFree7").css('display', 'none'); }
if (data[i].ColCode == 'cFree8') { $("#trcFree8").css('display', 'none'); }
if (data[i].ColCode == 'cFree9') { $("#trcFree9").css('display', 'none'); }
if (data[i].ColCode == 'cFree10') { $("#trcFree10").css('display', 'none'); }
//if (i >= 4) {
// if (data[i].ColName == 'cFree' + (i - 3)) {$("#trcFree'" + (i - 3) + "'").css('display', 'none');}
//}
}
}
}
});
}
//查询后台条码表单据自定义项(控制前台显示)
function ControlICSColumnEnable() {
$.ajax({
url: "/WMS/WMSCreateItemLot/SelectICSColumnEnableForLotEnable" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data != null && data.length > 0) {
for (var i = 0; i < data.length; i++) {
//if (data[i].ColumnCode == 'EATTRIBUTE1') { $("#trEATTRIBUTE1").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE2') { $("#trEATTRIBUTE2").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE3') { $("#trEATTRIBUTE3").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE4') { $("#trEATTRIBUTE4").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE5') { $("#trEATTRIBUTE5").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE6') { $("#trEATTRIBUTE6").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE7') { $("#trEATTRIBUTE7").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE8') { $("#trEATTRIBUTE8").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE9') { $("#trEATTRIBUTE9").css('display', 'none'); }
if (data[i].ColumnCode == 'EATTRIBUTE10') { $("#trEATTRIBUTE10").css('display', 'none'); }
}
}
}
});
}
function ControlVendorLotNo(VenCode) {
$.ajax({
url: "/WMS/WMSCreateItemLot/GetVendorLotNo?VenCode=" + VenCode + "&WorkPoint=" + WorkPoint,
//data: { keyValue: keyValue },
dataType: "json",
async: false,
success: function (data) {
$("#VendorLotNo").val(data.VendorLotNo);
}
});
}
//控制加载信息的公共方法
function LotNoInfoControlFreeTerm(InvCode, InvUnit, InvName, InvStd, Quantity, CreatedQty, thisCreateQty, Amount, EffectiveEnable, EffectiveDays, BatchCode, VenCode, WorkPoint, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10, ClassCode, EATTRIBUTE2, EATTRIBUTE3, EATTRIBUTE4, EATTRIBUTE5, EATTRIBUTE6, EATTRIBUTE7, EATTRIBUTE8, EATTRIBUTE9, EATTRIBUTE10) {
debugger;
$("#INVUOM").val(InvUnit);
$("#InvCode").val(InvCode);
$("#ClassCode").val(ClassCode);
$("#INVNAME").val(InvName);
$("#INVSTD").val(InvStd);
$("#Quantity").val(Quantity);
$("#CreatedQty").val(CreatedQty);
$("#thisCreateQty").val(thisCreateQty);
$("#minPackQty").val(thisCreateQty);
$("#cretePageCount").val(1);
$("#YAmount").val(Amount);
$("#EffectiveEnable").val(EffectiveEnable);
$("#EffectiveDays").val(EffectiveDays);
VenCode = VenCode;
WorkPoint = WorkPoint;
if (Quantity == CreatedQty) {
$("#thisCreateQty").attr("disabled", "disabled");
$("#minPackQty").attr("disabled", "disabled");
$("#VendorLotNo").attr("disabled", "disabled");
}
if (ProjectCode != "") { $("#ProjectCode").prop("disabled", true); $("#ProjectCode").val(ProjectCode);}
if (BatchCode != "") { $("#BatchCode").prop("disabled", true); $("#BatchCode").val(BatchCode); }
if (Version != "") { $("#Version").prop("disabled", true); $("#Version").val(Version); }
if (Brand != "") { $("#Brand").prop("disabled", true); $("#Brand").val(Brand); }
if (cFree1 != "") { $("#cFree1").prop("disabled", true); $("#cFree1").val(cFree1); }
if (cFree2 != "") { $("#cFree2").prop("disabled", true); $("#cFree2").val(cFree2); }
if (cFree3 != "") { $("#cFree3").prop("disabled", true); $("#cFree3").val(cFree3); }
if (cFree4 != "") { $("#cFree4").prop("disabled", true); $("#cFree4").val(cFree4); }
if (cFree5 != "") { $("#cFree5").prop("disabled", true); $("#cFree5").val(cFree5); }
if (cFree6 != "") { $("#cFree6").prop("disabled", true); $("#cFree6").val(cFree6); }
if (cFree7 != "") { $("#cFree7").prop("disabled", true); $("#cFree7").val(cFree7); }
if (cFree8 != "") { $("#cFree8").prop("disabled", true); $("#cFree8").val(cFree8); }
if (cFree9 != "") { $("#cFree9").prop("disabled", true); $("#cFree9").val(cFree9); }
if (cFree10 != "") { $("#cFree10").prop("disabled", true); $("#cFree10").val(cFree10); }
//if (EATTRIBUTE1 != "") { $("#EATTRIBUTE1").prop("disabled", true); $("#EATTRIBUTE1").val(EATTRIBUTE1); }
if (EATTRIBUTE2 != "") { $("#EATTRIBUTE2").prop("disabled", true); $("#EATTRIBUTE2").val(EATTRIBUTE2); }
if (EATTRIBUTE3 != "") { $("#EATTRIBUTE3").prop("disabled", true); $("#EATTRIBUTE3").val(EATTRIBUTE3); }
if (EATTRIBUTE4 != "") { $("#EATTRIBUTE4").prop("disabled", true); $("#EATTRIBUTE4").val(EATTRIBUTE4); }
if (EATTRIBUTE5 != "") { $("#EATTRIBUTE5").prop("disabled", true); $("#EATTRIBUTE5").val(EATTRIBUTE5); }
if (EATTRIBUTE6 != "") { $("#EATTRIBUTE6").prop("disabled", true); $("#EATTRIBUTE6").val(EATTRIBUTE6); }
if (EATTRIBUTE7 != "") { $("#EATTRIBUTE7").prop("disabled", true); $("#EATTRIBUTE7").val(EATTRIBUTE7); }
if (EATTRIBUTE8 != "") { $("#EATTRIBUTE8").prop("disabled", true); $("#EATTRIBUTE8").val(EATTRIBUTE8); }
if (EATTRIBUTE9 != "") { $("#EATTRIBUTE9").prop("disabled", true); $("#EATTRIBUTE9").val(EATTRIBUTE9); }
if (EATTRIBUTE10 != "") { $("#EATTRIBUTE10").prop("disabled", true); $("#EATTRIBUTE10").val(EATTRIBUTE10); }
}
//加载自由项名字
function LoadShow() {
$.ajax({
url: "/WMS/WMSCreateItemLot/GetLoadShow" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$("#LableProjectCode").text(data.rows[0].ColName);
$("#LableBatchCode").text(data.rows[1].ColName);
$("#LableVersion").text(data.rows[2].ColName);
$("#LableBrand").text(data.rows[3].ColName);
$("#LablecFree1").text(data.rows[4].ColName);
$("#LablecFree2").text(data.rows[5].ColName);
$("#LablecFree3").text(data.rows[6].ColName);
$("#LablecFree4").text(data.rows[7].ColName);
$("#LablecFree5").text(data.rows[8].ColName);
$("#LablecFree6").text(data.rows[9].ColName);
$("#LablecFree7").text(data.rows[10].ColName);
$("#LablecFree8").text(data.rows[11].ColName);
$("#LablecFree9").text(data.rows[12].ColName);
$("#LablecFree10").text(data.rows[13].ColName);
}
});
}
//加载自定义项名字
function LoadShowForColumn() {
$.ajax({
url: "/WMS/WMSCreateItemLot/GetLoadShowForColumn" + "?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
$("#LableEATTRIBUTE2").text(data.rows[0].Name);
$("#LableEATTRIBUTE3").text(data.rows[1].Name);
$("#LableEATTRIBUTE4").text(data.rows[2].Name);
$("#LableEATTRIBUTE5").text(data.rows[3].Name);
$("#LableEATTRIBUTE6").text(data.rows[4].Name);
$("#LableEATTRIBUTE7").text(data.rows[5].Name);
$("#LableEATTRIBUTE8").text(data.rows[6].Name);
$("#LableEATTRIBUTE9").text(data.rows[7].Name);
$("#LableEATTRIBUTE10").text(data.rows[8].Name);
// $("#LableEATTRIBUTE10").text(data.rows[9].Name);
}
});
}
//本次生成数量改变事件
function thisCreate_Change() {
$("#minPackQty").val($("#thisCreateQty").val());
//本+辅
if (thisCreateQtyEnable == true && AmountEnable == true) {
thisCreateAndAmount();
}
//本+张数
else if (thisCreateQtyEnable == true && cretePageCountEnable == true)
{
thisCreateAndcretePageCount();
}
//本+最小
else
{
thisCreateAndminPack();
}
}
//最小包装量改变事件
function minPack_Change() {
$("#thisCreateQty").val($("#minPackQty").val());
//最小+张数
if (minPackQtyEnable == true && cretePageCountEnable == true) {
minPackAndcretePageCount();
}
//最小+本
else {
thisCreateAndminPack();
}
}
//辅计量数量改变事件
function Amount_Change() {
//辅+张数
if (AmountEnable == true && cretePageCountEnable == true) {
AmountAndcretePageCount();
}
//辅+本
else
{
thisCreateAndAmount();
}
}
//生成张数改变事件
function cretePageCount_Change() {
//张数+本
if (thisCreateQtyEnable == true && cretePageCountEnable == true) {
thisCreateAndcretePageCount();
}
//张数+最小
else if (minPackQtyEnable == true && cretePageCountEnable == true)
{
minPackAndcretePageCount();
}
//张数+辅
else
{
AmountAndcretePageCount();
}
}
//辅+张数
function AmountAndcretePageCount() {
var Amount = $("#Amount").val() * 1;//辅计量数量
Amount = Amount.toFixed(6);
var cretePageCount = $("#cretePageCount").val() * 1;//张数
cretePageCount = cretePageCount.toFixed(6);
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (Amount <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
if (cretePageCount <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
var minPackQty = Amount / (YAmount / Quantity);
var thisCreateQty = minPackQty * cretePageCount;
$("#thisCreateQty").val(thisCreateQty);
$("#minPackQty").val(minPackQty);
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var CreatedQty = Number(CreatedQty_str);
if (thisCreateQty + CreatedQty > Quantity) {
var maxQty = Quantity - CreatedQty;
$.modalAlert("请输入0到" + maxQty + "范围内的数!");
return false;
}
}
//最小+张数
function minPackAndcretePageCount() {
var minPackQty = $("#minPackQty").val() * 1;//最小包装量
minPackQty = minPackQty.toFixed(6);
var cretePageCount = $("#cretePageCount").val() * 1;//张数
cretePageCount = cretePageCount.toFixed(6);
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (cretePageCount <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
if (minPackQty <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
var thisCreateQty = minPackQty * cretePageCount;
$("#thisCreateQty").val(thisCreateQty);
var Ratio = YAmount / Quantity * minPackQty;
$("#Amount").val(Ratio);//自动计算出的条码辅计量数量
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var CreatedQty = Number(CreatedQty_str);
if (thisCreateQty + CreatedQty > Quantity) {
var maxQty = Quantity - CreatedQty;
$.modalAlert("请输入0到" + maxQty + "范围内的数!");
return false;
}
}
//本+辅
function thisCreateAndAmount() {
var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量
thisCreateQty = thisCreateQty.toFixed(6);
var Amount = $("#Amount").val() * 1;//辅计量数量
Amount = Amount.toFixed(6);
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (Amount <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
var minPackQty = Amount / (YAmount / Quantity);
if (parseInt(Math.ceil(thisCreateQty * 10000)) % parseInt(Math.ceil(minPackQty * 10000)) != 0) {
createPageCount = parseInt(thisCreateQty / minPackQty) + 1;
$("#cretePageCount").val(createPageCount);
}
else {
createPageCount = parseInt(thisCreateQty / minPackQty);
$("#cretePageCount").val(createPageCount);
}
$("#minPackQty").val(minPackQty);
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var CreatedQty = Number(CreatedQty_str);
if (thisCreateQty + CreatedQty > Quantity) {
var maxQty = Quantity - CreatedQty;
$.modalAlert("请输入0到" + maxQty + "范围内的数!");
return false;
}
}
//本+张数
function thisCreateAndcretePageCount() {
var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量
thisCreateQty = thisCreateQty.toFixed(6);
var cretePageCount = $("#cretePageCount").val() * 1;//张数
cretePageCount = cretePageCount.toFixed(6);
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (cretePageCount <= 0) {
$.modalAlertNew("WMS00102");
return false;
}
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
var minPackQty = thisCreateQty / cretePageCount;//最小包装量
minPackQty = minPackQty.toFixed(6);
$("#minPackQty").val(minPackQty);
var Ratio = YAmount / Quantity * minPackQty;
$("#Amount").val(Ratio);//自动计算出的条码辅计量数量
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var CreatedQty = Number(CreatedQty_str);
if (thisCreateQty + CreatedQty > Quantity) {
var maxQty = Quantity - CreatedQty;
$.modalAlert("请输入0到" + maxQty + "范围内的数!");
return false;
}
}
//本+最小
function thisCreateAndminPack() {
var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量
thisCreateQty = thisCreateQty.toFixed(6);
var minPackQty = $("#minPackQty").val() * 1;//最小包装量
minPackQty = minPackQty.toFixed(6);
var Quantity = $("#Quantity").val() * 1;//数量
var YAmount = $("#YAmount").val() * 1;//单据辅计量数量
if (parseInt(Math.ceil(thisCreateQty * 10000)) % parseInt(Math.ceil(minPackQty * 10000)) != 0) {
createPageCount = Math.floor(thisCreateQty / minPackQty) + 1;
$("#cretePageCount").val(createPageCount);
}
else {
createPageCount = parseInt(thisCreateQty / minPackQty);
$("#cretePageCount").val(createPageCount);
}
var Ratio = YAmount / Quantity * minPackQty;
$("#Amount").val(Ratio);//自动计算出的条码辅计量数量
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var CreatedQty = Number(CreatedQty_str);
if (thisCreateQty + CreatedQty > Quantity) {
var maxQty = Quantity - CreatedQty;
$.modalAlert("请输入0到" + maxQty + "范围内的数!");
return false;
}
}
//提交
function submitForm() {
if (!$('#form1').formValid()) {
return false;
}
var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量
thisCreateQty = thisCreateQty.toFixed(6);
var minPackQty = $("#minPackQty").val() * 1;//最小包装量
minPackQty = minPackQty.toFixed(6);
var createPageCount = $("#cretePageCount").val() * 1;//本次生成张数
createPageCount = createPageCount.toFixed(0);
var VendorLot = $("#VendorLotNo").val();
var Quantity = $("#Quantity").val() * 1;//采购订单总数
Quantity = Quantity.toFixed(6);
var CreatedQty = $("#CreatedQty").val() * 1;//已生成数量
CreatedQty = CreatedQty.toFixed(6);
if (Quantity == CreatedQty ) {
return false;
}
var ExpirationDate = '';//条码失效日期
var EffectiveEnable = $("#EffectiveEnable").val();//料品是否启用有效天数
var EffectiveDays = $("#EffectiveDays").val();//料品有效期天数
var PRODUCTDATE = $("#PRODUCTDATE").val();//条码生产日期
if (EffectiveEnable=='true') {
var ExpirationDate= dateChange(EffectiveDays, PRODUCTDATE);
} else {
var ExpirationDate = '2999-12-31 00:00:00.000';
}
var InvCode= $("#InvCode").val();
var ClassCode = $("#ClassCode").val();
var Location = $("#Location").val();
var Complete = '';
$.ajax({
url: "/WMS/WMSCreateItemLot/GetInvBatchEnable?InvCode=" + InvCode,
dataType: "json",
async: false,
success: function (data) {
if (data != null && data.length > 0) {
Complete = data[0].BatchEnable;
}
}
});
if (Complete == true) {
if ($("#BatchCode").val()=="") {
$.modalAlert("该料品已开启批次,请输入批次!", "warning");
return;
}
}
var createPackCount = 0;
if (IsContainerEnable == true)//是否自动生成箱号 ContainerEnable=true
{
if ($("#creatPackCount").val() == "") {
$.modalAlert("该料品已开启自动生成箱号功能,请输入生成箱数!", "warning");
return;
}
var createPackCount = $("#creatPackCount").val() * 1;//本次生成箱数
createPackCount = createPackCount.toFixed(0);
if (parseInt(createPackCount) > parseInt(createPageCount)) {
$.modalAlert("该料品生成箱数:" + createPackCount + "不能大于生成张数:" + createPageCount + "!", "warning");
return;
}
if (createPackCount <= 0)
{
$.modalAlert("该料品生成箱数:" + createPackCount + "必须大于0!", "warning");
return;
}
}
var obj = {
ID:ID,
thisCreateQty: thisCreateQty,
minPackQty: minPackQty,
createPageCount: createPageCount,
VendorLot: VendorLot,
PRODUCTDATE: PRODUCTDATE,
ExpirationDate:ExpirationDate,
Amount: $("#Amount").val(),
//自由项
ProjectCode: $("#ProjectCode").val(),
BatchCode: $("#BatchCode").val(),
Version: $("#Version").val(),
Brand: $("#Brand").val(),
cFree1: $("#cFree1").val(),
cFree2: $("#cFree2").val(),
cFree3: $("#cFree3").val(),
cFree4: $("#cFree4").val(),
cFree5: $("#cFree5").val(),
cFree6: $("#cFree6").val(),
cFree7: $("#cFree7").val(),
cFree8: $("#cFree8").val(),
cFree9: $("#cFree9").val(),
cFree10: $("#cFree10").val(),
//单据自定义项
EATTRIBUTE1: '',
EATTRIBUTE2: $("#EATTRIBUTE2").val(),
EATTRIBUTE3: $("#EATTRIBUTE3").val(),
EATTRIBUTE4: $("#EATTRIBUTE4").val(),
EATTRIBUTE5: $("#EATTRIBUTE5").val(),
EATTRIBUTE6: $("#EATTRIBUTE6").val(),
EATTRIBUTE7: $("#EATTRIBUTE7").val(),
EATTRIBUTE8: $("#EATTRIBUTE8").val(),
EATTRIBUTE9: $("#EATTRIBUTE9").val(),
EATTRIBUTE10: $("#EATTRIBUTE10").val(),
InvCode: InvCode,
ClassCode: ClassCode,
createPackCount: createPackCount,
VenCode: VenCode,
Location: Location,
}
if (Type == '3') {
var Flag = GetGetGeneratedNum(MOCode, Sequence, thisCreateQty);
if (Flag == false) {
$.modalAlert("该单据生成数量异常,请重新确认单据信息!");
return;
}
//var Complete = '';
//$.ajax({
// url: "/WMS/WMSCreateItemLot/GetComplete" + "?" + Math.random(),
// dataType: "json",
// async: false,
// success: function (data) {
// if (data != null && data.length > 0) {
// Complete = data[0].Enable;
// }
// }
//});
//if (Complete == true) {
// var QiSetNum = '';
// var Msg = '';
// if ($("#Enable").val() == 'true') {
// var Header = {
// WorkPoint: WorkPoints,
// DetailID: MODetailID,
// Type: '生产订单',
// }
// var keyValue = [];
// keyValue.push(Header);
// $.ajax({
// url: "/WMS/WMSCreateItemLot/GetQiSetNum" + "?" + Math.random(),
// data: { keyValue: JSON.stringify(keyValue) },
// dataType: "json",
// async: false,
// success: function (data) {
// Msg = data.msg;
// QiSetNum = data.Num;
// //Msg = '';
// //QiSetNum = 200;
// }
// });
// }
// if (Msg != '') {
// $.modalAlert(Msg);
// return;
// }
// if (thisCreateQty > (QiSetNum - CreatedQty)) {
// $.modalAlert("该订单未发料,请发料后生成条码!");
// $("#thisCreateQty").val("");
// return;
// }
//}
$.submitForm({
url: "/MFWMS/ScrapDocumentDealWith/SubmitFormChengPing?MOCode=" + MOCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints + "&Quantity=" + Quantity,
param: {
keyValue: JSON.stringify(obj)
},
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
if (Type == '8') {
var Flag = GetGetGeneratedNum(ODNCode, Sequence, thisCreateQty);
if (Flag == false) {
$.modalAlert("该单据生成数量异常,请重新确认单据信息!");
return;
}
//var WWComplete = '';
//$.ajax({
// url: "/WMS/WMSCreateItemLot/GetWWComplete" + "?" + Math.random(),
// dataType: "json",
// async: false,
// success: function (data) {
// if (data != null && data.length > 0) {
// WWComplete = data[0].Enable;
// }
// }
//});
//if (WWComplete == true) {
// var QiSetNum = '';
// var Msg = '';
// if ($("#Enable").val() == 'true') {
// var Header = {
// WorkPoint: WorkPoints,
// DetailID: OODetailID,
// Type: '委外订单',
// }
// var keyValue = [];
// keyValue.push(Header);
// $.ajax({
// url: "/WMS/WMSCreateItemLot/GetQiSetNum" + "?" + Math.random(),
// data: { keyValue: JSON.stringify(keyValue) },
// dataType: "json",
// async: false,
// success: function (data) {
// Msg = data.msg;
// QiSetNum = data.Num;
// //Msg = '';
// //QiSetNum = 200;
// }
// });
// }
// if (Msg != '') {
// $.modalAlert(Msg);
// return;
// }
// if (thisCreateQty > (QiSetNum - CreatedQty)) {
// $.modalAlert("该订单未发料,请发料后生成条码!");
// $("#thisCreateQty").val("");
// return;
// }
//}
$.submitForm({
url: "/MFWMS/ScrapDocumentDealWith/SubmitFormWWSHDH?ODNCode=" + ODNCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints,
param: {
keyValue: JSON.stringify(obj)
},
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
}
function dateChange(num ,date ) {
if (!date) {
date = new Date();//没有传入值时,默认是当前日期
date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
}
date += " 00:00:00";//设置为当天凌晨12点
date = Date.parse(new Date(date))/1000;//转换为时间戳
date += (86400) * num;//修改后的时间戳
var newDate = new Date(parseInt(date) * 1000);//转换为时间
return newDate.getFullYear() + '-' + (newDate.getMonth() + 1) + '-' + newDate.getDate();
}
//解决网络延迟问题每次实时验证本次生成数量 有没有超
function GetGetGeneratedNum(Code, Sequence, thisCreateQty) {
var Flags;
$.ajax({
url: "/WMS/WMSCreateItemLot/GetGeneratedNum?Code=" + Code + "&Sequence=" + Sequence + "&Type=" + Type + "&thisCreateQty=" + thisCreateQty + "&InvCode=" + InvCode + "&Quantitys=" + Quantitys,
dataType: "json",
async: false,
success: function (data) {
Flags = data.Flag;
}
});
return Flags;
}
</script>
<form id="form1">
<div style="padding-top: 20px; margin-right: 20px;">
<table class="form">
<tr>
<th class="formTitle">料品编码</th>
<td class="formValue">
<input id="InvCode" name="InvCode" type="text" class="form-control " />
<input id="Enable" name="Enable" type="text" style="display:none" />
<input id="ClassCode" name="ClassCode" type="text" style="display:none" />
</td>
</tr>
<tr>
<th class="formTitle">料品名称</th>
<td class="formValue">
<input id="INVNAME" name="INVNAME" type="text" class="form-control " />
</td>
</tr>
<tr>
<th class="formTitle">规格型号</th>
<td class="formValue">
<input id="INVSTD" name="INVSTD" type="text" class="form-control " />
</td>
</tr>
<tr>
<th class="formTitle">计量单位</th>
<td class="formValue">
<input id="INVUOM" name="INVUOM" type="text" class="form-control " />
</td>
</tr>
<tr>
<th class="formTitle">数量</th>
<td class="formValue">
<input id="Quantity" name="Quantity" type="text" class="form-control " />
<input id="YAmount" name="YAmount" type="text" style="display:none" />
<input id="DJQuantity" name="DJQuantity" type="text" style="display:none" />
</td>
</tr>
<tr>
<th class="formTitle">已生成条码数量</th>
<td class="formValue">
<input id="CreatedQty" name="CreatedQty" type="text" class="form-control " />
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>本次生成数量</th>
<td class="formValue">
<input id="thisCreateQty" name="thisCreateQty" type="text" class="form-control required" placeholder="请输入本次生成数量" />
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>最小包装量</th>
<td class="formValue">
<input id="minPackQty" name="minPackQty" type="text" class="form-control required" placeholder="请输入最小包装量" />
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>生产日期</th>
<td class="formValue">
<input type="text" name="PRODUCTDATE" id="PRODUCTDATE" class="form-control required" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="生产日期" />
<input id="EffectiveEnable" name="EffectiveEnable" type="text" style="display:none" />
<input id="EffectiveDays" name="EffectiveDays" type="text" style="display:none" />
</td>
</tr>
<tr>
<th class="formTitle"><span style="color: red;">*</span>生成张数</th>
<td class="formValue">
<input id="cretePageCount" name="cretePageCount" class="form-control required" type="text" placeholder="请输入生成张数" />
</td>
</tr>
<tr>
<th class="formTitle HideTxt"><span style="color: red;">*</span>生成箱数</th>
<td class="formValue HideTxt">
<input id="creatPackCount" name="creatPackCount" class="form-control HideTxt" type="text" placeholder="请输入生成箱数" />
</td>
</tr>
<tr>
<th class="formTitle">辅计量数量</th>
<td class="formValue">
<input id="Amount" name="Amount" class="form-control" type="text" placeholder="请输入辅计量数量" />
</td>
</tr>
<tr>
<th class="formTitle "><span style="color: red;">*</span>目标库位</th>
<td class="formValue ">
<input id="Location" name="Location" class="form-control required" type="text" placeholder="请输入目标库位" />
</td>
</tr>
@*自由项*@
<tr id="trProjectCode">
<th class="formTitle"><label id="LableProjectCode"></label></th>
<td class="formValue">
<input id="ProjectCode" name="ProjectCode" class="form-control " type="text" />
</td>
</tr>
<tr id="trBatchCode">
<th class="formTitle"><label id="LableBatchCode"></label></th>
<td class="formValue">
<input id="BatchCode" name="BatchCode" class="form-control " type="text" />
</td>
</tr>
<tr id="trVersion">
<th class="formTitle"><label id="LableVersion"></label></th>
<td class="formValue">
<input id="Version" name="Version" class="form-control " type="text" />
</td>
</tr>
<tr id="trBrand">
<th class="formTitle"><label id="LableBrand"></label></th>
<td class="formValue">
<input id="Brand" name="Brand" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree1">
<th class="formTitle"><label id="LablecFree1"></label></th>
<td class="formValue">
<input id="cFree1" name="cFree1" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree2">
<th class="formTitle"><label id="LablecFree2"></label></th>
<td class="formValue">
<input id="cFree2" name="cFree2" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree3">
<th class="formTitle"><label id="LablecFree3"></label></th>
<td class="formValue">
<input id="cFree3" name="cFree3" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree4">
<th class="formTitle"><label id="LablecFree4"></label></th>
<td class="formValue">
<input id="cFree4" name="cFree4" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree5">
<th class="formTitle"><label id="LablecFree5"></label></th>
<td class="formValue">
<input id="cFree5" name="cFree5" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree6">
<th class="formTitle"><label id="LablecFree6"></label></th>
<td class="formValue">
<input id="cFree6" name="cFree6" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree7">
<th class="formTitle"><label id="LablecFree7"></label></th>
<td class="formValue">
<input id="cFree7" name="cFree7" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree8">
<th class="formTitle"><label id="LablecFree8"></label></th>
<td class="formValue">
<input id="cFree8" name="cFree8" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree9">
<th class="formTitle"><label id="LablecFree9"></label></th>
<td class="formValue">
<input id="cFree9" name="cFree9" type="text" class="form-control " />
</td>
</tr>
<tr id="trcFree10">
<th class="formTitle"><label id="LablecFree10"></label></th>
<td class="formValue">
<input id="cFree10" name="cFree10" type="text" class="form-control " />
</td>
</tr>
@*单据自由项*@
<tr id="trEATTRIBUTE2">
<th class="formTitle"><label id="LableEATTRIBUTE2"></label></th>
<td class="formValue">
<input id="EATTRIBUTE2" name="EATTRIBUTE2" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE3">
<th class="formTitle"><label id="LableEATTRIBUTE3"></label></th>
<td class="formValue">
<input id="EATTRIBUTE3" name="EATTRIBUTE3" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE4">
<th class="formTitle"><label id="LableEATTRIBUTE4"></label></th>
<td class="formValue">
<input id="EATTRIBUTE4" name="EATTRIBUTE4" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE5">
<th class="formTitle"><label id="LableEATTRIBUTE5"></label></th>
<td class="formValue">
<input id="EATTRIBUTE5" name="EATTRIBUTE5" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE6">
<th class="formTitle"><label id="LableEATTRIBUTE6"></label></th>
<td class="formValue">
<input id="EATTRIBUTE6" name="EATTRIBUTE6" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE7">
<th class="formTitle"><label id="LableEATTRIBUTE7"></label></th>
<td class="formValue">
<input id="EATTRIBUTE7" name="EATTRIBUTE7" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE8">
<th class="formTitle"><label id="LableEATTRIBUTE8"></label></th>
<td class="formValue">
<input id="EATTRIBUTE8" name="EATTRIBUTE8" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE9">
<th class="formTitle"><label id="LableEATTRIBUTE9"></label></th>
<td class="formValue">
<input id="EATTRIBUTE9" name="EATTRIBUTE9" type="text" class="form-control " />
</td>
</tr>
<tr id="trEATTRIBUTE10">
<th class="formTitle"><label id="LableEATTRIBUTE10"></label></th>
<td class="formValue">
<input id="EATTRIBUTE10" name="EATTRIBUTE10" type="text" class="form-control " />
</td>
</tr>
</table>
</div>
</form>