diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 7a6d4c2b..fabe1d65 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -7426,12 +7426,12 @@ namespace AMESCoreStudio.Web.Controllers , boxNo: boxNo, inhouseNo: inhouseNo, date_str: date_str, date_end: date_end , status: status, page: page, limit: limit); - + result_EVER.Data = result_EVER.Data.Where(w => w.BoxQty != "0");//排除數量是0的(簡易包裝後又拆箱) foreach (var item in result_EVER.Data) { var wipresult = await _pcsApi.GetWipInfoByWipNO_EVER(wipno: item.WipNo); //查對應安勤工單&料號 - item.WipNo = wipresult.Select(s => s.RelatedWONO).FirstOrDefault(); + item.WipNo = wipresult.Where(w=>w.RelatedWONO !=null).Select(s => s.RelatedWONO).FirstOrDefault(); if (!string.IsNullOrWhiteSpace(item.WipNo)) { @@ -7504,7 +7504,8 @@ namespace AMESCoreStudio.Web.Controllers string locationNo = ids[i].Split(',')[4]; string recordDate = ids[i].Split(',')[5]; string Factority_ID = ids[i].Split(',')[6]; - var result = await PCS0311inhouse(InhouseNo, boxNo, Convert.ToInt16(seq), recordNumber, locationNo, recordDate,Factority_ID); + string ItemNO = ids[i].Split(',')[7]; + var result = await PCS0311inhouse(InhouseNo, boxNo, Convert.ToInt16(seq), recordNumber, locationNo, recordDate,Factority_ID,ItemNO); if (!result.success) { @@ -7521,9 +7522,9 @@ namespace AMESCoreStudio.Web.Controllers } } - public async Task PCS031inhouseAsync(string InhouseNo, string boxNo, int seq, string recordNumber, string locationNo, string recordDate, string factorityID) + public async Task PCS031inhouseAsync(string InhouseNo, string boxNo, int seq, string recordNumber, string locationNo, string recordDate, string factorityID,string ItemNO) { - var result = await PCS0311inhouse(InhouseNo, boxNo, seq, recordNumber, locationNo, recordDate, factorityID); + var result = await PCS0311inhouse(InhouseNo, boxNo, seq, recordNumber, locationNo, recordDate, factorityID,ItemNO); return Json(new Result() { success = result.success, msg = result.msg }); @@ -7531,7 +7532,7 @@ namespace AMESCoreStudio.Web.Controllers } - private async Task PCS0311inhouse(string InhouseNo, string boxNo, int seq, string recordNumber, string locationNo, string recordDate, string factorityID) + private async Task PCS0311inhouse(string InhouseNo, string boxNo, int seq, string recordNumber, string locationNo, string recordDate, string factorityID,string ItemNO) { /* 1.先查詢是否已入庫過 * 2.依barcodeinfo 查詢 該箱號所屬序號 @@ -7660,15 +7661,32 @@ namespace AMESCoreStudio.Web.Controllers } var Wipinfo_LineID = Wipinfo_result.Select(s => s.LineID).First(); //lineid - var WipAtt_result = new WipAtt(); - if (factorityID == "1") - { - WipAtt_result = await _pcsApi.GetWipAtt(Wipinfo_result.Select(s => s.WipNO).FirstOrDefault()); //料號 - } - else - {//這裡需要對應到安勤的料號 - WipAtt_result = await _pcsApi.GetWipAtt(Wipinfo_result.Select(s => s.RelatedWONO).FirstOrDefault()); //料號 - } + // var WipAtt_result = new WipAtt(); + //string ItemNO = string.Empty; + //if (factorityID == "1") + //{ + // WipAtt_result = await _pcsApi.GetWipAtt(Wipinfo_result.Select(s => s.WipNO).FirstOrDefault()); //料號 + // ItemNO = WipAtt_result.ItemNO; + //} + //else + //{//這裡需要對應到安勤的料號 + // // WipAtt_result = await _pcsApi.GetWipAtt(Wipinfo_result.Select(s => s.RelatedWONO).FirstOrDefault()); //料號 + + // var wipresult = await _pcsApi.GetWipInfoByWipNO_EVER(wipno: Wipinfo_result.Select(s => s.WipNO).FirstOrDefault()); //查對應安勤工單&料號 + + // string RelatedWONO = wipresult.Where(w => w.RelatedWONO != null).Select(s => s.RelatedWONO).FirstOrDefault(); + // if (!string.IsNullOrWhiteSpace(RelatedWONO)) + // { + + // WipAtt_result = await _pcsApi.GetWipAtt(RelatedWONO); + // ItemNO = WipAtt_result.ItemNO; + // } + // else + // { + // ItemNO = ""; + // } + + //} var Userinfo_result = new List(); if (factorityID == "1") { @@ -7799,7 +7817,7 @@ namespace AMESCoreStudio.Web.Controllers SSN = item.ExtraBarcodeNo, ISN = item.BarcodeNo, RecordNumber = recordNumber, - PN = WipAtt_result.ItemNO, + PN = ItemNO,//WipAtt_result.ItemNO, EmpID = Userinfo_result.Select(s => s.UserNo).FirstOrDefault(), Location = AppSetting.Setting.Location, Key = AppSetting.Setting.PTD101Key, @@ -9582,23 +9600,23 @@ namespace AMESCoreStudio.Web.Controllers } if (Rule.Contains("SN4]")) { - Rule = Rule.Replace("[SN4]", "0000"); + Rule = Rule.Replace("[SN4]", "&&&&"); } if (Rule.Contains("SN5]")) { - Rule = Rule.Replace("[SN5]", "00000"); + Rule = Rule.Replace("[SN5]", "&&&&&"); } if (Rule.Contains("SN6]")) { - Rule = Rule.Replace("[SN6]", "000000"); + Rule = Rule.Replace("[SN6]", "&&&&&&"); } if (Rule.Contains("SS]")) { Rule = Rule.Replace("[SS]", "**"); } - int SNStart = Rule.IndexOf('0'); //流水號開始 - int SNLen = Rule.Count(c => c == '0'); //流水號長度 + int SNStart = Rule.IndexOf('&'); //流水號開始 + int SNLen = Rule.Count(c => c == '&'); //流水號長度 return SNStart.ToString() + "-" + SNLen.ToString(); } diff --git a/AMESCoreStudio.Web/Views/PCS/PCS031.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS031.cshtml index 35825e2b..503fb583 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS031.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS031.cshtml @@ -380,7 +380,7 @@ hg.confirm("送驗單號_箱號:【" + obj.data.inhouseNo + "_" + obj.data.serialNo + "】,確定要入庫嗎?", function () { $.ajax({ url: '/PCS/PCS031inhouse', - data: { InhouseNo: obj.data.inhouseNo, boxNo: obj.data.serialNo, seq: obj.data.seqID, recordNumber: recordmumber, locationNo: obj.data.locationNo, recordDate: recordDate, factorityID: Factority_ID }, + data: { InhouseNo: obj.data.inhouseNo, boxNo: obj.data.serialNo, seq: obj.data.seqID, recordNumber: recordmumber, locationNo: obj.data.locationNo, recordDate: recordDate, factorityID: Factority_ID, itemNo: obj.data.itemNo }, type: 'POST', success: function (data) { if (data.success) { @@ -417,7 +417,7 @@ hg.confirm("批量入庫所有选中的数据,確定要入庫吗?", function () { $.ajax({ url: '/PCS/PCS031inhouse_all', - data: { ids: obj.checkstatus.data.map(function (x) { return x.inhouseNo + "," + x.serialNo + "," + x.seqID + "," + recordmumber + "," + x.locationNo + "," + recorddate + "," +Factority_ID }) }, + data: { ids: obj.checkstatus.data.map(function (x) { return x.inhouseNo + "," + x.serialNo + "," + x.seqID + "," + recordmumber + "," + x.locationNo + "," + recorddate + "," + Factority_ID + "," + x.itemNo }) }, type: 'POST', success: function (data) { if (data.success) {