Browse Source

1. Controller:Home 新增頁面(WindowReload.cshtml) 刷新整個頁面

2. 修正FQC007 抽驗判斷標準
PTD
Ray 3 years ago
parent
commit
89d199a827
  1. 80
      AMESCoreStudio.Web/Controllers/FQCController.cs
  2. 11
      AMESCoreStudio.Web/Controllers/HomeController.cs
  3. 24
      AMESCoreStudio.Web/Views/FQC/FQC007.cshtml
  4. 7
      AMESCoreStudio.Web/Views/FQC/FQC007B.cshtml
  5. 26
      AMESCoreStudio.Web/Views/Home/WindowReload.cshtml

80
AMESCoreStudio.Web/Controllers/FQCController.cs

@ -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,6 +840,7 @@ 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)
{ {
@ -856,54 +848,70 @@ namespace AMESCoreStudio.Web.Controllers
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 FqcQuery = await _fqcApi.GetFqcQuery(model.InhouseNo, model.SeqID);
var fqcItem = FqcQuery.Data.FirstOrDefault();
// 判斷狀態選擇
if (fqcItem.FailQty >= fqcItem.ReQty)
{
if (model.QaResult == "P" && string.IsNullOrWhiteSpace(model.SpecialPo))
{ {
ModelState.AddModelError("error", "請輸入特採單號");
return View("FQC007B", model);
}
}
var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID); var fqcResultMaster = await _fqcApi.GetFqcResultMaster(model.FqcID);
var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID); var fqcInhouseMaster = await _fqcApi.GetFqcInhouseMaster(model.InhouseNo, model.SeqID);
if (model.QaResult == "P")
{
fqcResultMaster.QaResult = model.QaResult;
fqcResultMaster.QaMeno = model.QaMeno;
fqcResultMaster.EndTime = DateTime.Now;
fqcResultMaster.UpdateDate = DateTime.Now;
fqcInhouseMaster.Status = model.QaResult;
fqcInhouseMaster.UpdateDate = DateTime.Now;
}
else
{
fqcResultMaster.QaResult = model.QaResult; fqcResultMaster.QaResult = model.QaResult;
fqcResultMaster.QaMeno = model.QaMeno; fqcResultMaster.QaMeno = model.QaMeno;
fqcResultMaster.EndTime = DateTime.Now; fqcResultMaster.EndTime = DateTime.Now;
fqcResultMaster.UpdateDate = DateTime.Now; fqcResultMaster.UpdateDate = DateTime.Now;
fqcResultMaster.SpecialPo = model.SpecialPo;
fqcInhouseMaster.Status = model.QaResult; fqcInhouseMaster.Status = model.QaResult;
fqcInhouseMaster.UpdateDate = DateTime.Now; fqcInhouseMaster.UpdateDate = DateTime.Now;
//var qngInfo = new QngInfo();
//qngInfo.FqcID = model.FqcID;
}
IResultModel result; IResultModel result;
result = await _fqcApi.PutFqcInhouseMaster(JsonConvert.SerializeObject(fqcInhouseMaster)); result = await _fqcApi.PutFqcInhouseMaster(JsonConvert.SerializeObject(fqcInhouseMaster));
result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(fqcResultMaster)); result = await _fqcApi.PutFqcResultMaster(JsonConvert.SerializeObject(fqcResultMaster));
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()

11
AMESCoreStudio.Web/Controllers/HomeController.cs

@ -112,6 +112,17 @@ namespace AMESCoreStudio.Web.Controllers
return View(); return View();
} }
/// <summary>
/// 彈子視窗關閉後,刷新母視窗整個頁面
/// </summary>
/// <param name="msg">Msg提示訊息</param>
/// <returns></returns>
public IActionResult WindowReload(string msg = "保存成功!")
{
ViewBag.Msg = msg;
return View();
}
public IActionResult Privacy() public IActionResult Privacy()
{ {
return View(); return View();

24
AMESCoreStudio.Web/Views/FQC/FQC007.cshtml

@ -205,7 +205,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-row" id="click"> <div class="layui-row" id="click" style="display:none">
<div class="layui-col-xs10"> <div class="layui-col-xs10">
</div> </div>
<div class="layui-col-xs1 layui-col-xs-offset10"> <div class="layui-col-xs1 layui-col-xs-offset10">
@ -290,11 +290,7 @@
area: ['600px', '600px'], area: ['600px', '600px'],
fixed: false, //不固定 fixed: false, //不固定
maxmin: true, maxmin: true,
content: '/FQC/FQC007C?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID', content: '/FQC/FQC007C?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID'
end: function () {
//hg.msg('新增成功');
window.location.reload();
}
}); });
}); });
//hg.open('抽驗', '/FQC/FQC007C?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID', 600, 600); //hg.open('抽驗', '/FQC/FQC007C?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID', 600, 600);
@ -311,31 +307,23 @@
area: ['600px', '400px'], area: ['600px', '400px'],
fixed: false, //不固定 fixed: false, //不固定
maxmin: true, maxmin: true,
content: '/FQC/FQC007B?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID&fqc=@Model.FqcID', content: '/FQC/FQC007B?inhouseNo=@Model.h_InhouseNo&seq=@Model.h_SeqID&fqc=@Model.FqcID'
end: function () {
//hg.msg('新增成功');
window.location.reload();
}
}); });
}); });
}; };
$(document).ready(function () { $(document).ready(function () {
var error = '@Html.ValidationMessage("error")'; var error = '@Html.ValidationMessage("error")';
if ($(error).text() != '') { if ($(error).text() != '') {
parent.hg.msg(error); parent.hg.msg(error);
}; };
let InhouseNo = $("#hInhouseNo").val().trim(); let InhouseNo = $("#hInhouseNo").val().trim();
let SeqID = $("#hSeqID").val().trim(); let SeqID = $("#hSeqID").val().trim();
if (InhouseNo.length == 0 && SeqID.length == 0) { let Result = '@Model.StatusName';
$("#click").hide(); if (InhouseNo.length != 0 && SeqID.length != 0 && Result == 'A') {
}
else {
$("#click").show(); $("#click").show();
} }
}); });

7
AMESCoreStudio.Web/Views/FQC/FQC007B.cshtml

@ -18,6 +18,7 @@
<input type="hidden" asp-for="InhouseNo" value="@Model.InhouseNo" /> <input type="hidden" asp-for="InhouseNo" value="@Model.InhouseNo" />
<input type="hidden" asp-for="SeqID" value="@Model.SeqID" /> <input type="hidden" asp-for="SeqID" value="@Model.SeqID" />
<input type="hidden" asp-for="FqcID" value="@Model.FqcID" /> <input type="hidden" asp-for="FqcID" value="@Model.FqcID" />
<input type="hidden" id="Result" value="@Model.QaResult" />
<div class="layui-row"> <div class="layui-row">
<div class="layui-col-xs2" style="text-align:right"> <div class="layui-col-xs2" style="text-align:right">
<div class="layui-form-item"> <div class="layui-form-item">
@ -35,7 +36,7 @@
<div class="layui-inline" id="Special"> <div class="layui-inline" id="Special">
<label class="layui-form-label">特採單號:</label> <label class="layui-form-label">特採單號:</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input name="title" type="text" class="layui-input"> <input type="text" asp-for="SpecialPo" class="layui-input">
</div> </div>
</div> </div>
</div> </div>
@ -81,9 +82,9 @@
<input type="submit" value="保存" class="layui-btn" /> <input type="submit" value="保存" class="layui-btn" />
</div> </div>
</div> </div>
</form> </form>
</div> </div>
@section Scripts { @section Scripts {
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); @{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
await Html.RenderPartialAsync("_FileinputScriptsPartial"); } await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
@ -108,6 +109,8 @@
parent.hg.msg(error); parent.hg.msg(error);
} }
$("#Special").hide(); $("#Special").hide();
}); });
</script> </script>

26
AMESCoreStudio.Web/Views/Home/WindowReload.cshtml

@ -0,0 +1,26 @@

@{
Layout = "~/Views/Shared/_AMESLayout.cshtml";
}
@section Scripts {
<script type="text/javascript">
//关闭弹出层
layui.use('layer', function () {
var layer = layui.layer;
layer.alert('@ViewBag.Msg', {
title: '訊息',
skin: 'layui-layer-lan',
closeBtn: 0,
time: 0,
anim: 5 //动画类型
}, function () {
hg.close();
hg.base_reload();
});
});
</script>
}
Loading…
Cancel
Save