|
@ -656,7 +656,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
return View(model); |
|
|
return View(model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 添加
|
|
|
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<IActionResult> FQC007Async(FqcDto model) |
|
|
public async Task<IActionResult> FQC007Async(FqcDto model) |
|
|
{ |
|
|
{ |
|
@ -670,17 +669,6 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
|
|
|
|
|
result = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); |
|
|
result = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); |
|
|
|
|
|
|
|
|
//if (result.Success)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var _msg = "新增成功!";
|
|
|
|
|
|
// return RedirectToAction("Refresh", "Home", new { msg = _msg });
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// ModelState.AddModelError("error", result.Msg);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result.Data.Count() != 0) |
|
|
if (result.Data.Count() != 0) |
|
|
{ |
|
|
{ |
|
|
model = result.Data.FirstOrDefault(); |
|
|
model = result.Data.FirstOrDefault(); |
|
@ -697,6 +685,7 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
return View("FQC007", model); |
|
|
return View("FQC007", model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 抽驗
|
|
|
[HttpGet] |
|
|
[HttpGet] |
|
|
public async Task<IActionResult> FQC007C(string inhouseNo, string seq) |
|
|
public async Task<IActionResult> FQC007C(string inhouseNo, string seq) |
|
|
{ |
|
|
{ |
|
@ -770,6 +759,12 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
NgMemo = model.NgMemo, |
|
|
NgMemo = model.NgMemo, |
|
|
NgReasonNo = model.NgReasonNo |
|
|
NgReasonNo = model.NgReasonNo |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(FqcResultDetail.ExtraBarcodeNo)) |
|
|
|
|
|
{ |
|
|
|
|
|
ModelState.AddModelError("error", "找不到該筆資料的客戶序號"); |
|
|
|
|
|
return View("FQC007C", model); |
|
|
|
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 判斷已有抽驗過
|
|
|
#region 判斷已有抽驗過
|
|
@ -827,21 +822,17 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(FqcResultMaster)); |
|
|
result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(FqcResultMaster)); |
|
|
FqcResultDetail.FqcID = result_FqcResultMaster.FirstOrDefault().FqcID; |
|
|
FqcResultDetail.FqcID = result_FqcResultMaster.FirstOrDefault().FqcID; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//IResultModel<QngInfo> result_QnfInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IResultModel result_detail; |
|
|
IResultModel result_detail; |
|
|
result_detail = await _fqcApi.PostFqcResultDetail(JsonConvert.SerializeObject(FqcResultDetail)); |
|
|
result_detail = await _fqcApi.PostFqcResultDetail(JsonConvert.SerializeObject(FqcResultDetail)); |
|
|
|
|
|
|
|
|
if (result_detail.Success) |
|
|
if (result_detail.Success) |
|
|
{ |
|
|
{ |
|
|
var _msg = "新增成功!"; |
|
|
var _msg = "新增成功!"; |
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
return RedirectToAction("WindowReload", "Home", new { msg = _msg }); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
ModelState.AddModelError("error", result_detail.Msg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -849,44 +840,59 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 檢驗結果
|
|
|
[HttpGet] |
|
|
[HttpGet] |
|
|
public async Task<IActionResult> FQC007B(string inhouseNo, string seq , int fqc) |
|
|
public async Task<IActionResult> FQC007B(string inhouseNo, string seq, int fqc) |
|
|
{ |
|
|
{ |
|
|
var model = new FqcResultMaster(); |
|
|
var model = new FqcResultMaster(); |
|
|
model.InhouseNo = inhouseNo; |
|
|
model.InhouseNo = inhouseNo; |
|
|
model.SeqID = int.Parse(seq); |
|
|
model.SeqID = int.Parse(seq); |
|
|
model.FqcID = fqc; |
|
|
model.FqcID = fqc; |
|
|
|
|
|
var result = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); |
|
|
|
|
|
var fqcItem = result.Data.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
//當抽驗數量 小於 抽樣數量就離開
|
|
|
|
|
|
if (fqcItem.QcQty > fqcItem.PassQty + fqcItem.FailQty) |
|
|
|
|
|
{ |
|
|
|
|
|
var _msg = "抽樣數量不足,無法判定"; |
|
|
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 判斷狀態選擇
|
|
|
|
|
|
if (fqcItem.FailQty >= fqcItem.ReQty) |
|
|
|
|
|
model.QaResult = "R"; |
|
|
|
|
|
else |
|
|
|
|
|
model.QaResult = "P"; |
|
|
|
|
|
|
|
|
return View(model); |
|
|
return View(model); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<IActionResult> FQC007BAsync(FqcResultMaster model) |
|
|
public async Task<IActionResult> FQC007BAsync(FqcResultMaster model, string Result) |
|
|
{ |
|
|
{ |
|
|
var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); |
|
|
var FqcQuery = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID); |
|
|
var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID); |
|
|
var fqcItem = FqcQuery.Data.FirstOrDefault(); |
|
|
if (model.QaResult == "P") |
|
|
// 判斷狀態選擇
|
|
|
|
|
|
if (fqcItem.FailQty >= fqcItem.ReQty) |
|
|
{ |
|
|
{ |
|
|
fqcResultMaster.QaResult = model.QaResult; |
|
|
if (model.QaResult == "P" && string.IsNullOrWhiteSpace(model.SpecialPo)) |
|
|
fqcResultMaster.QaMeno = model.QaMeno; |
|
|
{ |
|
|
fqcResultMaster.EndTime = DateTime.Now; |
|
|
ModelState.AddModelError("error", "請輸入特採單號"); |
|
|
fqcResultMaster.UpdateDate = DateTime.Now; |
|
|
return View("FQC007B", model); |
|
|
|
|
|
} |
|
|
fqcInhouseMaster.Status = model.QaResult; |
|
|
|
|
|
fqcInhouseMaster.UpdateDate = DateTime.Now; |
|
|
|
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
fqcResultMaster.QaResult = model.QaResult; |
|
|
|
|
|
fqcResultMaster.QaMeno = model.QaMeno; |
|
|
|
|
|
fqcResultMaster.EndTime = DateTime.Now; |
|
|
|
|
|
fqcResultMaster.UpdateDate = DateTime.Now; |
|
|
|
|
|
|
|
|
|
|
|
fqcInhouseMaster.Status = model.QaResult; |
|
|
var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); |
|
|
fqcInhouseMaster.UpdateDate = DateTime.Now; |
|
|
var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID); |
|
|
|
|
|
|
|
|
//var qngInfo = new QngInfo();
|
|
|
fqcResultMaster.QaResult = model.QaResult; |
|
|
//qngInfo.FqcID = model.FqcID;
|
|
|
fqcResultMaster.QaMeno = model.QaMeno; |
|
|
} |
|
|
fqcResultMaster.EndTime = DateTime.Now; |
|
|
|
|
|
fqcResultMaster.UpdateDate = DateTime.Now; |
|
|
|
|
|
fqcResultMaster.SpecialPo = model.SpecialPo; |
|
|
|
|
|
|
|
|
|
|
|
fqcInhouseMaster.Status = model.QaResult; |
|
|
|
|
|
fqcInhouseMaster.UpdateDate = DateTime.Now; |
|
|
|
|
|
|
|
|
IResultModel result; |
|
|
IResultModel result; |
|
|
result = await _fqcApi.PutFqcInhouseMaster(JsonConvert.SerializeObject(fqcInhouseMaster)); |
|
|
result = await _fqcApi.PutFqcInhouseMaster(JsonConvert.SerializeObject(fqcInhouseMaster)); |
|
@ -894,16 +900,18 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
if (result.Success) |
|
|
if (result.Success) |
|
|
{ |
|
|
{ |
|
|
var _msg = "新增成功!"; |
|
|
var _msg = "新增成功!"; |
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
return RedirectToAction("WindowReload", "Home", new { msg = _msg }); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
ModelState.AddModelError("error", result.Msg); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return View("FQC007B", model); |
|
|
return View("FQC007B", model); |
|
|
} |
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region FQC008 FQC查詢
|
|
|
#region FQC008 FQC查詢
|
|
|
public IActionResult FQC008() |
|
|
public IActionResult FQC008() |
|
|