|
|
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Form.cshtml"; } <script> var Type = $.request("Type"); var InvCode = $.request("InvCode"); var Sequence = $.request("Sequence"); var OOCode = decodeURI($.request("OOCode")) var OODetailID = $.request("OODetailID"); var OOPickCode = decodeURI($.request("OOPickCode"))
var Mtime = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate(); debugger; var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location' var Prorate; //料品辅助计量开关 var InvAmountEnable = false;
//主计量、辅计量标志 var minPackQtyEnable = false; var AmountEnable = false;
//本次生成数量、最小包装量、计量标志 var thisCreateQtyEnable = false; var MeasureEnable = false; var cretePageCountEnable = 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); var VenCode = ""; var WorkPoint = "";
//GetScale(); debugger; $("#INVUOM").attr("disabled", "disabled"); $("#InvCode").attr("disabled", "disabled"); $("#INVNAME").attr("disabled", "disabled"); $("#INVSTD").attr("disabled", "disabled"); $("#Quantity").attr("disabled", "disabled"); $("#CreatedQty").attr("disabled", "disabled"); //initControl(); GetScale(); SeachMeasure(); SeachLableofDisable(); SeachAmountEnablebyInvCode(InvCode); 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); } } 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"); $("#cretePageCount").attr("disabled", "disabled"); $("#minPackQty").change(minPack_Change); $("#thisCreateQty").change(thisCreate_Change); } }
ControlVendorLotNo(VenCode); ControlICSExtensionEnable(); ControlICSColumnEnable(); LoadShow(); LoadShowForColumn(); });
function GetScale() { $.ajax({ url: "/OMAY/ICSOOCreateLot/GetScale" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { debugger; Prorate = data.rows[0].Prorate; } }); }
//加载页面信息 function SeachInfoByCodeAndSequence() {
if (Type == '201') { if (!!OOCode && !!Sequence) { $.ajax({ url: "/OMAY/ICSOOCreateLot/GetSubGridJsonChengPingByCreate?OOCode=" + OOCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints, dataType: "json", async: false, success: function (data) { debugger;
$("#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) } });
} }
if (Type == '20') { if (!!OOPickCode && !!Sequence) { $.ajax({ url: "/OMAY/ICSOOCreateLot/GetSubGridJsonOOPickCreate?OOPickCode=" + OOPickCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints, dataType: "json", async: false, success: function (data) { 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) } });
} }
}
//查询料品辅计量开关 function SeachAmountEnablebyInvCode(InvCode) { $.ajax({ url: "/OMAY/ICSMoCreateLot/SeachAmountEnablebyInvCode?InvCode=" + InvCode + "&" + Math.random(), dataType: "json", async: false, success: function (data) { if (data.rows[0].AmountEnable == '1') { InvAmountEnable = true; $("#InvProportion").val(data.rows[0].EATTRIBUTE1);
} } }); }
//查询配置项-计量单位 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 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=" + WorkPoints, //data: { keyValue: keyValue }, dataType: "json", async: false, success: function (data) { $("#VendorLotNo").val(data.VendorLotNo); } });
}
//加载自由项名字 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 minPackQty_Change() {
var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6); var minPackQty = $("#minPackQty").val() * 1;//最小包装量 minPackQty = minPackQty.toFixed(6); var createPageCount = $("#cretePageCount").val() * 1;//本次生成张数 var Quantity = $("#Quantity").val() * 1;//数量 var YAmount = $("#YAmount").val() * 1;//辅计量数量
createPageCount = createPageCount.toFixed(0); //if (minPackQty <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} //不可以整除,生成张数+1; //if (thisCreateQty % minPackQty != 0) { 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); } var Ratio = YAmount / Quantity * minPackQty;
$("#Amount").val(Ratio);//自动计算出的条码辅计量数量
} //本次生成数量值改变事件(原输入本次+最小) function thisCreateQty_Change() {
var Quantity_str = $("#Quantity").val() * 1;//采购订单总数
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var thisCreateQty_str = $("#thisCreateQty").val() * 1;//本次生成数量
var Quantity = Number(Quantity_str); var CreatedQty = Number(CreatedQty_str); var thisCreateQty = Number(thisCreateQty_str);
//if (thisCreateQty <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} if (thisCreateQty <= 0 || thisCreateQty > (Quantity - CreatedQty)) { var maxQty = Quantity - CreatedQty; $.modalAlertNew("WMS00103", maxQty); //$.modalAlert("请输入0到" + maxQty + "范围内的数!"); $("#thisCreateQty").val(""); return false; } else { minPackQty_Change(); return true; } var minPackQty = $("#minPackQty").val() * 1;//最小包装量 minPackQty_Change(); }
//本次生成数量改变事件 function thisCreate_Change() { var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6);
if (thisCreateQty <= 0) { $.modalAlertNew("WMS00102"); return false; } //本+辅 if (thisCreateQtyEnable == true && AmountEnable == true) { thisCreateAndAmount(); } //本+张数 else if (thisCreateQtyEnable == true && cretePageCountEnable == true) { thisCreateAndcretePageCount(); } //本+最小 else { thisCreateAndminPack(); }
}
//最小包装量改变事件 function minPack_Change() {
var thisCreateQty = $("#minPackQty").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6);
if (thisCreateQty <= 0) { $.modalAlertNew("WMS00102"); return false; }
//最小+张数 if (minPackQtyEnable == true && cretePageCountEnable == true) { minPackAndcretePageCount(); } //最小+本 else { thisCreateAndminPack(); }
}
//辅计量数量改变事件 function Amount_Change() {
var thisCreateQty = $("#Amount").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6);
if (thisCreateQty <= 0) { $.modalAlertNew("WMS00102"); return false; }
//辅+张数 if (AmountEnable == true && cretePageCountEnable == true) { AmountAndcretePageCount(); } //辅+本 else { thisCreateAndAmount(); } }
//生成张数改变事件 function cretePageCount_Change() {
var thisCreateQty = $("#cretePageCount").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6);
if (thisCreateQty <= 0) { $.modalAlertNew("WMS00102"); return false; }
//张数+本 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;//单据辅计量数量 var InvProportion= $("#InvProportion").val();//转换率
//if (Amount <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} //if (cretePageCount <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} var thisCreateQty = Amount * InvProportion * cretePageCount; var minPackQty = Amount * InvProportion; $("#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) / InvProportion; maxQty = parseFloat(maxQty.toFixed(4)); $.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 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 = parseInt(thisCreateQty / minPackQty) + 1; $("#cretePageCount").val(createPageCount); } else { createPageCount = parseInt(thisCreateQty / minPackQty); $("#cretePageCount").val(createPageCount); }
// var Ratio = YAmount / Quantity * minPackQty; var Ratio =0;
$("#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 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) { $("#INVUOM").val(InvUnit); $("#InvCode").val(InvCode); $("#ClassCode").val(ClassCode); $("#INVNAME").val(InvName); $("#INVSTD").val(InvStd); $("#Quantity").val(Quantity);
$("#CreatedQty").val(CreatedQty); $("#thisCreateQty").val(thisCreateQty); $("#YAmount").val(Amount); $("#EffectiveEnable").val(EffectiveEnable); $("#EffectiveDays").val(EffectiveDays);
VenCode = VenCode; WorkPoint = WorkPoint; if (Quantity == CreatedQty) { $("#thisCreateQty").attr("disabled", "disabled"); $("#minPackQty").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); }
}
function LoadShow() { $.ajax({ url: "/WMS/WMSCreateItemLot/GetLoadShow" + "?" + Math.random(), dataType: "json", async: false, success: function (data) { debugger;
$("#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) { debugger; $("#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 minPackQty_Change() { debugger; var thisCreateQty = $("#thisCreateQty").val() * 1;//本次生成数量 thisCreateQty = thisCreateQty.toFixed(6); var minPackQty = $("#minPackQty").val() * 1;//最小包装量 minPackQty = minPackQty.toFixed(6); var createPageCount = $("#cretePageCount").val() * 1;//本次生成张数 var Quantity = $("#Quantity").val() * 1;//数量 var YAmount = $("#YAmount").val() * 1;//辅计量数量
createPageCount = createPageCount.toFixed(0); //if (minPackQty <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} //不可以整除,生成张数+1; //if (thisCreateQty % minPackQty != 0) { 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); } var Ratio = YAmount / Quantity * minPackQty;
$("#Amount").val(Ratio);//自动计算出的条码辅计量数量
} //本次生成数量值改变事件 function thisCreateQty_Change() { debugger; var Quantity_str = $("#Quantity").val() * 1;//采购订单总数
var CreatedQty_str = $("#CreatedQty").val() * 1;//已生成数量
var thisCreateQty_str = $("#thisCreateQty").val() * 1;//本次生成数量
var Quantity = Number(Quantity_str); var CreatedQty = Number(CreatedQty_str); var thisCreateQty = Number(thisCreateQty_str);
//if (thisCreateQty <= 0) { // $.modalAlertNew("WMS00102"); // return false; //} if (thisCreateQty <= 0 || thisCreateQty > (Quantity - CreatedQty)) { var maxQty = Quantity - CreatedQty; $.modalAlertNew("WMS00103",maxQty); //$.modalAlert("请输入0到" + maxQty + "范围内的数!"); $("#thisCreateQty").val(""); return false; } else { minPackQty_Change(); return true; } var minPackQty = $("#minPackQty").val() * 1;//最小包装量 minPackQty_Change(); }
function submitForm() { debugger; if (!$('#form1').formValid()) { return false; } if ($("#BatchCode").val() == "") { $.modalAlert("请输入批次!", "warning"); return; } var AMEnable; $.ajax({ url: "/WMS/WMSCreateItemLot/GetAMEnable", //data: { keyValue: keyValue }, dataType: "json", async: false, success: function (data) { debugger; if (data.rows != "" && data.rows=="奥美") { AMEnable = true ; } else { AMEnable = 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 YAmount = $("#YAmount").val() * 1;//单据辅计量数量 //校验 var flag1 = thisCreateQty_Change(); //var flag2 = CheckNum();
if (flag1) { } else { return false; } 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 Complete = ''; $.ajax({ url: "/WMS/WMSCreateItemLot/GetInvBatchEnable?InvCode=" + InvCode, dataType: "json", async: false, success: function (data) { debugger; if (data != null && data.length > 0) { Complete = data[0].BatchEnable; } } });
if (Complete == true) { if ($("#BatchCode").val()=="") { $.modalAlert("该料品已开启批次,请输入批次!", "warning"); return; } }
var obj = { thisCreateQty: thisCreateQty, minPackQty: minPackQty, createPageCount: createPageCount, 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 }
if (Type == '201') { var AvailQty = ''; var AllQty = ''; var Msg = ''; var Qty= $("#thisCreateQty").val() //$.ajax({ // url: "/OMAY/ICSOOCreateLot/GetAbsolveQty?OOCode=" + OOCode + "&Sequence=" + Sequence + "&Qty=" + Qty, // //data: { keyValue: JSON.stringify(keyValue) }, // dataType: "json", // async: false, // success: function (data) { // Msg = data.msg; // AvailQty = data.AvailQty; // AllQty = data.AllQty; // } //}); //if (Msg != '') { // $.modalAlert(Msg); // return; //} $.submitForm({ url: "/OMAY/ICSOOCreateLot/SubmitFormChengPing?OOCode=" + OOCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints + "&AMEnable=" + AMEnable, param: { keyValue: JSON.stringify(obj) }, success: function () { $.currentWindow().$("#gridList").trigger("reloadGrid"); } }) }
if (Type == '20') { //var Flag = GetGetGeneratedNum(OOPickCode, Sequence, thisCreateQty); //if (Flag==false) { // $.modalAlert("该单据生成数量异常,请重新确认单据信息!"); // return; //}
//var AvailQty = ''; //var AllQty = ''; //var Msg = ''; //var Qty = $("#thisCreateQty").val() //$.ajax({ // url: "/OMAY/ICSOOCreateLot/GetOOPickAbsolveQty?OOCode=" + OOCode + "&Sequence=" + Sequence + "&Qty=" + Qty, // // data: { keyValue: JSON.stringify(keyValue) }, // dataType: "json", // async: false, // success: function (data) { // Msg = data.msg; // AvailQty = data.AvailQty; // AllQty = data.AllQty; // } //}); //if (Msg != '') { // $.modalAlert(Msg); // return; //}
$.submitForm({ url: "/OMAY/ICSOOCreateLot/SubmitFormOOPick?OOPickCode=" + OOPickCode + "&Sequence=" + Sequence + "&WorkPoint=" + WorkPoints + "&AMEnable=" + AMEnable, 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);//转换为时间p 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, 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" /> <input id="InvProportion" name="InvProportion" 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">辅计量数量</th> <td class="formValue"> <input id="Amount" name="Amount" class="form-control" 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="trEATTRIBUTE1"> <th class="formTitle"><label id="LableEATTRIBUTE1"></label></th> <td class="formValue"> <input id="EATTRIBUTE1" name="EATTRIBUTE1" 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>
|