Browse Source

出貨序號重取問題修正

PTD
Yiru 2 years ago
parent
commit
2b46b576d5
  1. 37
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 11
      AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs

37
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -9171,23 +9171,24 @@ namespace AMESCoreStudio.Web.Controllers
} }
if (Rule.Contains("SN4]")) if (Rule.Contains("SN4]"))
{ {
NewRule = NewRule.Replace("[SN4]", "0000"); NewRule = NewRule.Replace("[SN4]", "&&&&");
} }
if (Rule.Contains("SN5]")) if (Rule.Contains("SS]"))
{ {
NewRule = NewRule.Replace("[SN5]", "00000"); NewRule = NewRule.Replace("[SS]", "**");
} }
if (Rule.Contains("SN6]")) if (Rule.Contains("SN5]"))
{ {
NewRule = NewRule.Replace("[SN6]", "000000"); NewRule = NewRule.Replace("[SN5]", "&&&&&");
} }
if (Rule.Contains("SS]")) if (Rule.Contains("SN6]"))
{ {
NewRule = NewRule.Replace("[SS]", "**"); NewRule = NewRule.Replace("[SN6]", "&&&&&&");
} }
int SNStart = NewRule.IndexOf('0'); //流水號開始
int SNLen = NewRule.Count(c => c == '0'); //流水號長度 int SNStart = NewRule.IndexOf('&'); //流水號開始
int SNLen = NewRule.Count(c => c == '&'); //流水號長度
#endregion #endregion
// 流水碼預設長度 // 流水碼預設長度
@ -9264,15 +9265,15 @@ namespace AMESCoreStudio.Web.Controllers
} }
string EndNO = model.WipBarcodeOther.EndNO.Substring(0, SNStart) + InputEndNoQty.ToString().PadLeft(SNLen, '0') + model.WipBarcodeOther.EndNO.Substring(SNStart + SNLen); string EndNO = model.WipBarcodeOther.EndNO.Substring(0, SNStart) + InputEndNoQty.ToString().PadLeft(SNLen, '0') + model.WipBarcodeOther.EndNO.Substring(SNStart + SNLen);
//判斷結束序號是否有重覆在其他區間 //判斷結束序號是否有重覆在其他區間
var CheckRepeat = await CheckWipBarcodeOtherRepeat(model.WipInfo.WipNO,model.SerialRuleItem,model.WipBarcodeOther.StartNO,EndNO, SNStart , SNLen); //var CheckRepeat = await CheckWipBarcodeOtherRepeat(model.WipInfo.WipNO,model.SerialRuleItem,model.WipBarcodeOther.StartNO,EndNO, SNStart , SNLen);
if (!CheckRepeat.Success) // if (!CheckRepeat.Success)
{ // {
_msg = CheckRepeat.Msg; // _msg = CheckRepeat.Msg;
// ModelState.AddModelError("error", CheckRepeat.Msg); // // ModelState.AddModelError("error", CheckRepeat.Msg);
} // }
else // else
{ // {
//取相同Rule 年、月、周 的所有料號 //取相同Rule 年、月、周 的所有料號
var result1 = await _pcsApi.GetSerialRuleDetail(model.WipBarcodeOther.SerialRuleDetailID); var result1 = await _pcsApi.GetSerialRuleDetail(model.WipBarcodeOther.SerialRuleDetailID);
var q_Detail = await _pcsApi.GetSerialRuleDetailbyPCS040(model.WipBarcodeOther.SerialRuleDetailID); var q_Detail = await _pcsApi.GetSerialRuleDetailbyPCS040(model.WipBarcodeOther.SerialRuleDetailID);
@ -9387,7 +9388,7 @@ namespace AMESCoreStudio.Web.Controllers
// ModelState.AddModelError("error", result.Msg); // ModelState.AddModelError("error", result.Msg);
//} //}
} }
} // }
return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg }); return RedirectToAction("Refresh", "Home", new { wipNo = model.WipInfo.WipNO, msg = _msg });
// return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipID, msg = _msg }); // return RedirectToAction("PCS040R", "PCS", new { id = model.WipInfo.WipID, msg = _msg });

11
AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeOthersController.cs

@ -95,9 +95,9 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
/// <param name="ItemNo"></param> /// <param name="ItemNo"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("WipBarcodeOtherByItemNo")] [HttpGet("WipBarcodeOtherByItemNo")]
public async Task<ResultModel<WipBarcodeOtherDto>> GetWipBarcodeOtherByItemNo(string WipNo,string ItemNo) public async Task<ResultModel<WipBarcodeOtherDto>> GetWipBarcodeOtherByItemNo(string WipNo, string ItemNo)
{ {
var SerialRule = _context.SerialRuleDetails.Where(W => W.ItemNo == ItemNo) ;//.Select(s =>s.SerialRuleDetailID.ToString()).ToList(); var SerialRule = _context.SerialRuleDetails.Where(W => W.ItemNo == ItemNo);//.Select(s =>s.SerialRuleDetailID.ToString()).ToList();
var wipBarcodeOther = _context.WipBarcodeOthers.Where(W => W.WipNO == WipNo); var wipBarcodeOther = _context.WipBarcodeOthers.Where(W => W.WipNO == WipNo);
@ -108,7 +108,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
join W in _context.WipInfos.Where(w => w.WipScheduleDate >= wipinfo) on O.WipNO equals W.WipNO join W in _context.WipInfos.Where(w => w.WipScheduleDate >= wipinfo) on O.WipNO equals W.WipNO
join A in _context.WipAtts on O.WipNO equals A.WipNO join A in _context.WipAtts on O.WipNO equals A.WipNO
join D in _context.SerialRuleDetails on O.SerialRuleDetailID equals D.SerialRuleDetailID join D in _context.SerialRuleDetails on O.SerialRuleDetailID equals D.SerialRuleDetailID
where D.Rule == SerialRule.Select(s=>s.Rule).FirstOrDefault() where D.Rule == SerialRule.Select(s => s.Rule).FirstOrDefault()
select new WipBarcodeOtherDto select new WipBarcodeOtherDto
{ {
@ -131,7 +131,11 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
ResultModel<WipBarcodeOtherDto> result = new ResultModel<WipBarcodeOtherDto>(); ResultModel<WipBarcodeOtherDto> result = new ResultModel<WipBarcodeOtherDto>();
if (ItemNo.Contains("OTHER"))
{
q = q.Where(w => w.ItemRule == ItemNo);
}
result.Data = await q.ToListAsync(); result.Data = await q.ToListAsync();
// result.Data = result.Data.Select(s => { s.Status = s.Status == "Y" ? "已投產" : s.Status == "N" ? "未投產" : "末知"; return s; }) // result.Data = result.Data.Select(s => { s.Status = s.Status == "Y" ? "已投產" : s.Status == "N" ? "未投產" : "末知"; return s; })
@ -145,6 +149,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return result; return result;
} }
/// <summary> /// <summary>
/// 新增工單出貨條碼區間設定檔 /// 新增工單出貨條碼區間設定檔
/// </summary> /// </summary>

Loading…
Cancel
Save