diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs
index 0ac82978..3c7b0f55 100644
--- a/AMESCoreStudio.Web/Controllers/FQCController.cs
+++ b/AMESCoreStudio.Web/Controllers/FQCController.cs
@@ -1,28 +1,23 @@
-using Microsoft.AspNetCore.Mvc;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
+using AMESCoreStudio.CommonTools.Result;
using AMESCoreStudio.Web.Models;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using AMESCoreStudio.WebApi;
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Mvc.Rendering;
+using AMESCoreStudio.WebApi.DTO.AMES;
+using AMESCoreStudio.WebApi.Enum;
using AMESCoreStudio.WebApi.Models.AMES;
using AMESCoreStudio.WebApi.Models.BAS;
-using AMESCoreStudio.Web.ViewModels;
-using AMESCoreStudio.Web.ViewModels.PCS;
-using AMESCoreStudio.WebApi.DTO.AMES;
-using System.Linq;
-using AMESCoreStudio.CommonTools.Result;
-using System;
-using System.IO;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Hosting;
-using System.ComponentModel.DataAnnotations;
using AspNetCore.Reporting;
-using System.Text.Encodings;
-using AMESCoreStudio.WebApi.Enum;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.StaticFiles;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
namespace AMESCoreStudio.Web.Controllers
{
@@ -843,11 +838,18 @@ namespace AMESCoreStudio.Web.Controllers
var result_WipFQC = await _fqcApi.GetWipFqcItemByWipNo(model.WipNo);
if (result_WipFQC.Count == 0)
{
- //工單無設定檢驗工項時 在抓料號綁定檢驗工項
- var result_MaterialFQC = await _fqcApi.GetMaterialFqcItemsByitemNo(model.ItemNo);
- if (result_MaterialFQC.Count != 0)
+ ////工單無設定檢驗工項時 在抓料號綁定檢驗工項
+ //var result_MaterialFQC = await _fqcApi.GetMaterialFqcItemsByitemNo(model.ItemNo);
+ //if (result_MaterialFQC.Count != 0)
+ //{
+ // model.qcItemDtos = result_QcItem.Data.Where(w => result_MaterialFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList();
+ //}
+
+ // 改抓FQC設定群組內綁定的料號取 FQC設定群組項目
+ var result_FqcItem = await _fqcApi.GetFqcItemByItemNo(model.ItemNo);
+ if (result_FqcItem.Count != 0)
{
- model.qcItemDtos = result_QcItem.Data.Where(w => result_MaterialFQC.Select(s => s.QcItemID).Contains(w.ItemID)).ToList();
+ model.qcItemDtos = result_QcItem.Data.Where(w => result_FqcItem.Select(s => s.QcItemId).Contains(w.ItemID)).ToList();
}
}
else
@@ -981,6 +983,19 @@ namespace AMESCoreStudio.Web.Controllers
return View(model);
}
+ ///
+ /// 確認是否可以開立FQC檢驗單
+ ///
+ /// 入庫單號碼
+ /// 序號
+ ///
+ [HttpPost]
+ public async Task CheckFqcIssue(string inhouseNo, int seqID = 0)
+ {
+ var result = await _fqcApi.CheckFqcIssue(inhouseNo, seqID);
+ return Json(new Result() { success = result.Success, msg = result.Msg, data = null });
+ }
+
[HttpPost]
public async Task FQC007AjaxJson(FqcDto model)
{
@@ -1393,6 +1408,11 @@ namespace AMESCoreStudio.Web.Controllers
{
await _fqcApi.PostSMS_CAR_FQC(JsonConvert.SerializeObject(fqcResultMaster));
}
+ // 執行判斷無序號工單檢驗完成
+ else if (model.QaResult == "P" && fqcItem.InspectionStatus == "D")
+ {
+ await _fqcApi.GetFqcExecuteWithoutWipNoComplete(fqcItem.WipNo);
+ }
if (!result.Success)
{
@@ -2280,6 +2300,289 @@ namespace AMESCoreStudio.Web.Controllers
}
#endregion
+ #region FQC013 檢驗項目群組名稱維護
+ public IActionResult FQC013()
+ {
+ return View();
+ }
+
+ //新增頁面
+ public IActionResult FQC013C()
+ {
+ return View();
+ }
+
+ //修改页面
+ [HttpGet]
+ public async Task FQC013U(int id)
+ {
+ var result = await _fqcApi.GetFqcItemGroups(id);
+ return View(result);
+ }
+
+ ///
+ /// 刪除
+ ///
+ ///
+ ///
+ public async Task FQC013D(int id)
+ {
+ var result = await _fqcApi.DeleteFqcItemGroup(id);
+ return Json(new Result() { success = result.Success, msg = result.Msg });
+ }
+
+ //頁面提交,id=0 添加,id>0 修改
+ [HttpPost]
+ public async Task FQC013Async(FqcItemGroup model)
+ {
+ IResultModel result;
+ // 判斷是否有重複的群組代號
+ var checkData = await _fqcApi.GetFqcItemGroupQuery(no: model.ItemGroupNo);
+ if (checkData.Data.Any(w => w.ItemGroupNo == model.ItemGroupNo))
+ {
+ // 新增 群組
+ if (model.FqcItemGroupId == 0)
+ {
+ ModelState.AddModelError("error", "已有建立相同的群組代號,請在確認");
+ return View("FQC013C", model);
+ }
+ // 修改 群組
+ else if (checkData.Data.Any(w => w.ItemGroupNo == model.ItemGroupNo && w.FqcItemGroupId != model.FqcItemGroupId))
+ {
+ ModelState.AddModelError("error", "已有建立相同的群組代號,請在確認");
+ return View("FQC013U", model);
+ }
+ }
+
+ if (ModelState.IsValid)
+ {
+ if (model.FqcItemGroupId == 0)
+ {
+ model.CreateUserID = GetLogInUserID();
+ result = await _fqcApi.PostFqcItemGroup(JsonConvert.SerializeObject(model));
+ }
+ else
+ {
+ model.UpdateUserID = GetLogInUserID();
+ result = await _fqcApi.PutFqcItemGroup(JsonConvert.SerializeObject(model));
+ }
+
+ if (result.Success)
+ {
+ var _msg = model.FqcItemGroupId == 0 ? "新增成功!" : "修改成功!";
+ return RedirectToAction("Refresh", "Home", new { msg = _msg });
+ }
+ else
+ {
+ ModelState.AddModelError("error", result.Msg);
+ }
+ }
+
+ if (model.FqcItemGroupId == 0)
+ {
+ return View("FQC013C", model);
+ }
+ return View("FQC013U", model);
+ }
+
+ ///
+ /// FQC檢驗項目群組名稱設定檔 By Query
+ ///
+ /// 群組代號
+ /// 群組名稱
+ /// 群組描述
+ /// 料號
+ /// 頁數
+ /// 筆數
+ ///
+ [HttpGet]
+ public async Task FQC013Query(string no,
+ string name,
+ string desc,
+ string itemNo,
+ int page = 0,
+ int limit = 10)
+ {
+ var result = await _fqcApi.GetFqcItemGroupQuery(no, name, desc, itemNo, page, limit);
+
+ if (result.Data.Count() != 0)
+ {
+ return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal });
+ }
+
+ return Json(new Table() { count = 0, data = null });
+ }
+
+ #region FQC013A FQC群組綁設定檢驗工項維護
+
+ public async Task FQC013A(int fqcItemGroupId = 0)
+ {
+ var result = await _fqcApi.GetFqcItemGroups(fqcItemGroupId);
+ if (result != null)
+ {
+ ViewBag.GroupNo = result.ItemGroupNo;
+ ViewBag.GroupName = result.ItemGroupName;
+ }
+ ViewBag.GroupId = fqcItemGroupId;
+ return View();
+ }
+
+ ///
+ /// 查詢 FQC檢驗群組綁定工項
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task FQC013A_Query(int fqcItemGroupId = 0, int page = 0, int limit = 1)
+ {
+ var result = await _fqcApi.GetQcItemQuery(0, 0, limit, fqcItemGroupId: fqcItemGroupId);
+ return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal });
+ }
+
+ [HttpPost]
+ public async Task FQC013A_Submit(string itemID, string groupID, int fqcItemGroupId)
+ {
+ // 取料號綁定檢驗工項
+ var result_FqcItem = await _fqcApi.GetFqcItemByFqcGroupId(fqcItemGroupId);
+ // 有勾選的ItemID
+ var checkItemID = itemID.Split(',').ToList();
+ // 有勾選的GroupID
+ var checkGroupID = groupID.Split(',').ToList();
+
+ // 取勾選有的 = 新增
+ var insertItemID = checkItemID.Except(result_FqcItem.Select(s => s.QcItemId.ToString()));
+ for (int i = 0; i < checkItemID.Count; i++)
+ {
+ if (insertItemID.Where(w => w == checkItemID[i]).Any())
+ {
+ FqcItem FqcItem = new FqcItem
+ {
+ GroupId = fqcItemGroupId,
+ QcItemId = Int32.Parse(checkItemID[i]),
+ QcGroupId = Int32.Parse(checkGroupID[i]),
+ CreateUserID = GetLogInUserID(),
+ CreateDate = DateTime.Now,
+ UpdateUserID = GetLogInUserID(),
+ UpdateDate = DateTime.Now
+ };
+ await _fqcApi.PostFqcItem(JsonConvert.SerializeObject(FqcItem));
+ }
+ }
+
+ // 取有料號綁定 = 需要刪除
+ var deteleItemID = result_FqcItem.Select(s => s.QcItemId.ToString()).Except(checkItemID);
+ foreach (var item in deteleItemID)
+ {
+ var FqcItemId = result_FqcItem.Where(w => w.QcItemId == Int32.Parse(item)).FirstOrDefault().FqcItemId;
+ await _fqcApi.DeleteFqcItem(FqcItemId);
+ }
+
+ return Json(new { code = 0, msg = "", success = true });
+ }
+
+ #endregion
+
+ #region FQC013B FQC群組綁定料號
+
+ public async Task FQC013B(int groupId = 0)
+ {
+ var result = await _fqcApi.GetFqcItemGroups(groupId);
+ if (result != null)
+ {
+ ViewBag.GroupNo = result.ItemGroupNo;
+ ViewBag.GroupName = result.ItemGroupName;
+ }
+ ViewBag.GroupId = groupId;
+ return View();
+ }
+
+ ///
+ /// 查詢 FQC檢驗群組綁定工項
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task FQC013B_Query(int groupId)
+ {
+ var result = await _fqcApi.GetFqcItemGroupMaterialByGroupId(groupId);
+ return Json(new Table() { code = 0, msg = "", data = result, count = result.Count() });
+ }
+
+ ///
+ /// 新增料號
+ ///
+ /// 群組ID
+ /// 料號
+ ///
+ [HttpPost]
+ public async Task FQC013B_addMaterial(int groupId, string materialNo)
+ {
+ var msg = string.Empty;
+ var result = await _fqcApi.GetMaterialItemByItemNO(materialNo);
+ if (result == null)
+ {
+ msg = $"在料號主檔找不到該筆料號【{materialNo}】";
+ return Json(new { code = 0, msg, success = false });
+ }
+ else
+ {
+ var check = await _fqcApi.GetFqcItemGroupMaterialByItemId(result.ItemID);
+ if (check.Any())
+ {
+ msg = $"該筆料號【{materialNo}】已有在群組綁定了,請在確認";
+ return Json(new { code = 0, msg, success = false });
+ }
+ }
+
+ var model = new FqcItemGroupMaterial
+ {
+ GroupId = groupId,
+ ItemId = result.ItemID,
+ CreateUserID = GetLogInUserID(),
+ CreateDate = DateTime.Now,
+ UpdateUserID = GetLogInUserID(),
+ UpdateDate = DateTime.Now
+ };
+
+ await _fqcApi.PostFqcItemGroupMaterial(JsonConvert.SerializeObject(model));
+ return Json(new { code = 0, msg = "綁定成功", success = true });
+ }
+
+ ///
+ /// FQC檢驗群組刪除綁定料號
+ ///
+ /// FQC檢驗群組ID
+ /// 料號ID
+ ///
+ [HttpPost]
+ public async Task FQC013B_Delete(int groupId, int itemId)
+ {
+ // 取料號綁定檢驗工項
+ var result = await _fqcApi.DeleteFqcItemGroupMaterial(groupId, itemId);
+ if (result == 1)
+ return Json(new { code = 0, msg = "", success = true });
+ else
+ return Json(new { code = 0, msg = "", success = false });
+ }
+
+ ///
+ /// 回傳PLM料號品名_AutoComplete
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task GetMeterialItemAutoComplete(string search)
+ {
+ var result = await _fqcApi.GetMeterialAutoComplete(search);
+ return Json(new { data = result });
+ }
+
+ #endregion
+
+ #endregion
+
///
/// 登入UserID
///
diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs
index 206ab056..8720867e 100644
--- a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs
+++ b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs
@@ -81,9 +81,10 @@ namespace AMESCoreStudio.Web
/// 比數
/// 料號
/// 工單號碼
+ /// FQC檢驗設定群組
///
[WebApiClient.Attributes.HttpGet("api/QcItem/QcItemQuery")]
- ITask> GetQcItemQuery(int groupID, int page, int limit, string itemNo = null, string wipNo = null);
+ ITask> GetQcItemQuery(int groupID, int page, int limit, string itemNo = null, string wipNo = null ,int fqcItemGroupId = 0) ;
///
/// 查詢檢驗項目維護 ID
@@ -462,6 +463,13 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpDelete("api/WipFqcItem/{id}")]
ITask> DeleteWipFqcItem(int id);
+ ///
+ /// FqcItem 查詢料號對應設定群組綁定檢驗工項
+ ///
+ /// 料號
+ [WebApiClient.Attributes.HttpGet("api/FqcItem/ByItemNo/{id}")]
+ ITask> GetFqcItemByItemNo(string id);
+
///
/// FQC抽驗過站
///
@@ -526,6 +534,22 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpDelete("api/FqcResultMasterBlob/ByFileName")]
ITask> DeleteFqcResultMasterBlob(int fqcId, string fileName);
+ ///
+ /// 執行判斷無序號工單檢驗完成
+ ///
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcResultMaster/ExecuteWithoutWipNoComplete/{id}")]
+ ITask GetFqcExecuteWithoutWipNoComplete(string id);
+
+ ///
+ /// 確認FQC抽驗時,箱號是否已經跑到FQC流程
+ ///
+ /// 入庫單號
+ /// 順序
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/CheckFqcIssue")]
+ ITask> CheckFqcIssue(string inhouseNo, int seqID);
+
#endregion
#region FQC008 FQC查詢
@@ -627,7 +651,7 @@ namespace AMESCoreStudio.Web
///
[WebApiClient.Attributes.HttpDelete("api/FqcInhouseMaster/{no}/{seq}")]
ITask> DeleteFqcInhouseMaster(string no, int seq);
-
+
///
/// 刪除FQC 表身
@@ -637,5 +661,124 @@ namespace AMESCoreStudio.Web
ITask> DeleteFqcInhouseDetail(string no, int seq);
#endregion
+
+ #region FQC013 檢驗項目群組相關維護
+ ///
+ /// FqcItem 新增檢驗項目群組綁定設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPost("api/FqcItem")]
+ ITask> PostFqcItem([FromBody, RawJsonContent] string model);
+
+ ///
+ /// FqcItem 更新檢驗項目群組綁定設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPut("api/FqcItem")]
+ ITask> PutFqcItem([FromBody, RawJsonContent] string model);
+
+ ///
+ /// FqcItem 刪除檢驗項目群組綁定設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpDelete("api/FqcItem/{id}")]
+ ITask> DeleteFqcItem(int id);
+
+ ///
+ /// FqcItem 查詢 ByFqcGroupId
+ ///
+ /// FqcGroupId
+ [WebApiClient.Attributes.HttpGet("api/FqcItem/ByFqcGroupId/{id}")]
+ ITask> GetFqcItemByFqcGroupId(int id);
+
+ ///
+ /// FqcItemGroup 查詢FQC檢驗項目群組名稱設定檔 By ID
+ ///
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcItemGroup/{id}")]
+ ITask GetFqcItemGroups(int id);
+
+ ///
+ /// FqcItemGroup 新增FQC檢驗項目群組名稱設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPost("api/FqcItemGroup")]
+ ITask> PostFqcItemGroup([FromBody, RawJsonContent] string model);
+
+ ///
+ /// FqcItemGroup 更新FQC檢驗項目群組名稱設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPut("api/FqcItemGroup")]
+ ITask> PutFqcItemGroup([FromBody, RawJsonContent] string model);
+
+ ///
+ /// FqcItemGroup 刪除FQC檢驗項目群組名稱設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpDelete("api/FqcItemGroup/{id}")]
+ ITask> DeleteFqcItemGroup(int id);
+
+ ///
+ /// FQC檢驗項目群組名稱設定檔 By Query
+ ///
+ /// 群組代號
+ /// 群組名稱
+ /// 群組描述
+ /// 料號
+ /// 頁數
+ /// 筆數
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcItemGroup/FqcItemGroupQuery")]
+ ITask> GetFqcItemGroupQuery(string no = null,
+ string name = null,
+ string desc = null,
+ string itemNo = null,
+ int page = 0,
+ int limit = 10);
+
+ ///
+ /// 新增 檢驗群組指定料號設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPost("api/FqcItemGroupMaterial")]
+ ITask> PostFqcItemGroupMaterial([FromBody, RawJsonContent] string model);
+
+ ///
+ /// 更新 檢驗群組指定料號設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpPut("api/FqcItemGroupMaterial")]
+ ITask> PutFqcItemGroupMaterial([FromBody, RawJsonContent] string model);
+
+ ///
+ /// FqcItemGroupMaterial 查詢檢驗群組指定料號設定檔 By GroupId
+ ///
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcItemGroupMaterial/ByGroupId/{id}")]
+ ITask> GetFqcItemGroupMaterialByGroupId(int id);
+
+ ///
+ /// FqcItemGroupMaterial 查詢檢驗群組指定料號設定檔 By ItemId
+ ///
+ ///
+ [WebApiClient.Attributes.HttpGet("api/FqcItemGroupMaterial/ByItemId/{id}")]
+ ITask> GetFqcItemGroupMaterialByItemId(int id);
+
+ ///
+ /// 刪除 檢驗群組指定料號設定檔
+ ///
+ ///
+ [WebApiClient.Attributes.HttpDelete("api/FqcItemGroupMaterial/{id}/{id1}")]
+ ITask DeleteFqcItemGroupMaterial(int id, int id1);
+
+ ///
+ /// 查詢料號_AutoComplete
+ ///
+ /// 料號
+ ///
+ [WebApiClient.Attributes.HttpGet("api/MaterialItem/AutoComplete/{id}")]
+ ITask> GetMeterialAutoComplete(string id);
+ #endregion
}
}
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC007V.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC007V.cshtml
index cb3bcae7..0877895e 100644
--- a/AMESCoreStudio.Web/Views/FQC/FQC007V.cshtml
+++ b/AMESCoreStudio.Web/Views/FQC/FQC007V.cshtml
@@ -59,11 +59,11 @@
title: '',
fixed: 'right',
templet: function (d) {
- if (d.statusNo.length === 0) {
- return '';
+ if (d.statusNo !== null) {
+ return '刪除';
}
else {
- return '删除';
+ return ''
}
}
}]
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml
index 2367f947..5247937c 100644
--- a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml
+++ b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml
@@ -7,27 +7,27 @@
/*.layui-table-main .layui-table-cell {*/
/*height: auto !important;*/
/*white-space: normal;
- }
+ }
- .layui-table img {
- max-width: 60px;
- max-height: 28px;
- }
+ .layui-table img {
+ max-width: 60px;
+ max-height: 28px;
+ }
- .layui-tree-main {
- cursor: pointer;
- padding-right: 10px;
- float: left;
- border-width: 1px;
- border-style: solid;
- border-color: #e6e6e6;
- margin: 10px 0;
- }
+ .layui-tree-main {
+ cursor: pointer;
+ padding-right: 10px;
+ float: left;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #e6e6e6;
+ margin: 10px 0;
+ }
- .layui-table-cell {
- height: auto;
- white-space: normal;
- }*/
+ .layui-table-cell {
+ height: auto;
+ white-space: normal;
+ }*/
@@ -254,7 +254,7 @@
}
else {
aa = '檢視\
- PDF Excel'
+ PDF Excel'
}
return aa;
}
@@ -273,14 +273,31 @@
//通过行tool编辑,lay-event="edit"
function edit(obj) {
- if (obj.data.inhouseNo) {
- hg.open('FQC抽驗作業', '/FQC/FQC007?inhouseNo=' + obj.data.inhouseNo + '&seqID=' + obj.data.seqID, '', '', true);
+ $.ajax({
+ url: "@Url.Action("CheckFqcIssue", "FQC")",
+ type: "POST",
+ data: { "inhouseNo": obj.data.inhouseNo, "seqID": obj.data.seqID },
+ success: function (result) {
+ if (result.success) {
+ if (obj.data.inhouseNo) {
+ hg.open('FQC抽驗作業', '/FQC/FQC007?inhouseNo=' + obj.data.inhouseNo + '&seqID=' + obj.data.seqID, '', '', true);
+
+ var tempwindow = window.open('_blank'); // 先打開頁面
+ tempwindow.location = 'https://sms.avalue.com.tw/SMS/SUP/SFIS_SMS001.aspx?MODEL_NO=' + obj.data.modelNo;
+ var tempwindow1 = window.open('_blank'); // 先打開頁面
+ tempwindow1.location = 'http://qazone.avalue.com.tw/qazone/sfislinktocfqr.aspx?QF=2&QA_PRDID=' + obj.data.itemNo;
+ }
+ }
+ else {
+ parent.hg.msg(result.msg);
+ }
+ },
+ error: function (result) {
+ alert(`開啟FQC失敗,請聯繫系統管理員`);
+ }
+ });
+
- var tempwindow = window.open('_blank'); // 先打開頁面
- tempwindow.location = 'https://sms.avalue.com.tw/SMS/SUP/SFIS_SMS001.aspx?MODEL_NO=' + obj.data.modelNo;
- var tempwindow1 = window.open('_blank'); // 先打開頁面
- tempwindow1.location = 'http://qazone.avalue.com.tw/qazone/sfislinktocfqr.aspx?QF=2&QA_PRDID=' + obj.data.itemNo;
- }
}
function PDF(obj) {
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC013.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC013.cshtml
new file mode 100644
index 00000000..236f7d1e
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/FQC/FQC013.cshtml
@@ -0,0 +1,154 @@
+@{
+ ViewData["Title"] = "FQC檢驗項目群組名稱維護";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+
+
+
+@section Scripts{
+
+}
\ No newline at end of file
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC013A.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC013A.cshtml
new file mode 100644
index 00000000..fe799e5b
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/FQC/FQC013A.cshtml
@@ -0,0 +1,153 @@
+@{
+ ViewData["Title"] = "FQC項目群組檢驗工項維護";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+
+
+
+
+
+
+@section Scripts {
+ @{
+ await Html.RenderPartialAsync("_ValidationScriptsPartial");
+ await Html.RenderPartialAsync("_FileinputScriptsPartial");
+ }
+
+
+}
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC013B.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC013B.cshtml
new file mode 100644
index 00000000..28f7cd7e
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/FQC/FQC013B.cshtml
@@ -0,0 +1,167 @@
+@{
+ ViewData["Title"] = "檢驗群組綁定料號";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+
+
+
+@section Scripts{
+
+}
\ No newline at end of file
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC013C.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC013C.cshtml
new file mode 100644
index 00000000..264ac8bb
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/FQC/FQC013C.cshtml
@@ -0,0 +1,70 @@
+@model AMESCoreStudio.WebApi.Models.AMES.FqcItemGroup
+
+
+@{ ViewData["Title"] = "FQC013C";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml"; }
+
+
+
+
+
+@section Scripts {
+ @{ await Html.RenderPartialAsync("_ValidationScriptsPartial");
+ await Html.RenderPartialAsync("_FileinputScriptsPartial"); }
+
+
+
+
+}
diff --git a/AMESCoreStudio.Web/Views/FQC/FQC013U.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC013U.cshtml
new file mode 100644
index 00000000..de7d594d
--- /dev/null
+++ b/AMESCoreStudio.Web/Views/FQC/FQC013U.cshtml
@@ -0,0 +1,75 @@
+@model AMESCoreStudio.WebApi.Models.AMES.FqcItemGroup
+
+
+@{
+ ViewData["Title"] = "FQC013U";
+ Layout = "~/Views/Shared/_AMESLayout.cshtml";
+}
+
+
+
+
+
+@section Scripts {
+ @{
+ await Html.RenderPartialAsync("_ValidationScriptsPartial");
+ await Html.RenderPartialAsync("_FileinputScriptsPartial");
+ }
+
+
+
+
+}
diff --git a/AMESCoreStudio.Web/Views/RPT/RPT004.cshtml b/AMESCoreStudio.Web/Views/RPT/RPT004.cshtml
index d611b71c..b50eb040 100644
--- a/AMESCoreStudio.Web/Views/RPT/RPT004.cshtml
+++ b/AMESCoreStudio.Web/Views/RPT/RPT004.cshtml
@@ -197,6 +197,24 @@
$(document).ready(function () {
getUnitLineList($("#unit").val());
+
+ var efficiency = @Model.efficiency;
+ // 無生產效率
+ if (efficiency == 0) {
+ $(".Col").css("background-color", "#919191");
+ }
+ // 小於90 紅色
+ else if (efficiency <= 90) {
+ $(".Col").css("background-color", "#ff0000");
+ }
+ // 90 ~ 93 橘色
+ else if (efficiency > 90 && efficiency <= 93) {
+ $(".Col").css("background-color", "#ffb900");
+ }
+ // 大於93 綠色
+ else if (efficiency > 93) {
+ $(".Col").css("background-color", "#7ebd36");
+ }
});
function getUnitLineList(data) {
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs
index ce1b3305..f53eaf92 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseDetailController.cs
@@ -1,16 +1,14 @@
-using System;
+using AMESCoreStudio.CommonTools.Result;
+using AMESCoreStudio.WebApi.DTO.AMES;
+using AMESCoreStudio.WebApi.Extensions;
+using AMESCoreStudio.WebApi.Models.AMES;
+using Dapper;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-using AMESCoreStudio.WebApi;
-using AMESCoreStudio.WebApi.Models.AMES;
-using AMESCoreStudio.CommonTools.Result;
-using AMESCoreStudio.WebApi.DTO.AMES;
-using Dapper;
-using AMESCoreStudio.WebApi.Extensions;
namespace AMESCoreStudio.WebApi.Controllers.AMES
{
@@ -72,32 +70,33 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{
ResultModel result = new ResultModel();
var fqcResultDto = new List();
- var FqcInhouseDetails = await _context.FqcInhouseDetails.Where(w => w.SerialNo == boxNo && w.InhouseNo == inhouseNo
- && w.SeqID == seqID).FirstOrDefaultAsync();
+ var querySql = @" SELECT DISTINCT SERIAL_NO AS BoxNo , BARCODE_NO AS BarcodeNo , EXTRA_BARCODE_NO AS ExtraBarcodeNo
+ FROM (
+ SELECT A.BARCODE_NO , A.EXTRA_BARCODE_NO , B.SERIAL_NO ,B.INHOUSE_NO
+ FROM JHAMES.BARCODE_INFO A , JHAMES.FQC_INHOUSE_DETAIL B
+ WHERE B.SERIAL_NO = A.BOX_NO
+ AND B.INHOUSE_NO = :InhouseNo
+ AND B.SEQ_ID = :SeqId
+ AND B.BARCODE_NO = '0'
+ UNION ALL
+ SELECT BARCODE_NO , EXTRA_BARCODE_NO , SERIAL_NO ,INHOUSE_NO
+ FROM JHAMES.FQC_INHOUSE_DETAIL
+ WHERE INHOUSE_NO = :InhouseNo
+ AND SEQ_ID = :SeqId
+ AND BARCODE_NO <> '0')
+ WHERE SERIAL_NO=:BoxNo ";
+
+ DynamicParameters p = new DynamicParameters();
+ p.Add("InhouseNo", inhouseNo);
+ p.Add("SeqId", seqID);
+ p.Add("BoxNo", boxNo);
+ fqcResultDto = _context.Database.DapperQuery(querySql, p).ToList();
// 取FQC_ID
- if (FqcInhouseDetails != null)
+ if (fqcResultDto.Any())
{
- var BarcodeInfo = new List();
- if (FqcInhouseDetails.SerialType == "B")
- BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BoxNo == FqcInhouseDetails.SerialNo).ToListAsync();
- else
- BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BarcodeNo == FqcInhouseDetails.SerialNo).ToListAsync();
-
- // 先塞入資料
- foreach (var item in BarcodeInfo)
- {
- fqcResultDto.Add(new FqcResultDto
- {
- BarcodeNo = item.BarcodeNo,
- ExtraBarcodeNo = item.ExtraBarcodeNo,
- BoxNo = item.BoxNo,
- StatusNo = ""
- });
- }
-
- var FqcResultMaster = await _context.FqcResultMasters.Where(w => w.InhouseNo == FqcInhouseDetails.InhouseNo
- && w.SeqID == FqcInhouseDetails.SeqID)
+ var FqcResultMaster = await _context.FqcResultMasters.Where(w => w.InhouseNo == inhouseNo
+ && w.SeqID == seqID)
.FirstOrDefaultAsync();
// 取抽驗結果
if (FqcResultMaster != null)
@@ -110,7 +109,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{
if (item.BarcodeNo == item2.BarcodeNo)
{
- item2.StatusNo = item.StatusNo;
+ item2.StatusNo = item.StatusNo == "P" ? "PASS" : "NG";
item2.NgReasonNo = item.NgReasonNo;
item2.NgReasonDesc = NgReasons.Where(w => w.NGReasonNo == item.NgReasonNo).FirstOrDefault() == null ? "" : NgReasons.Where(w => w.NGReasonNo == item.NgReasonNo).FirstOrDefault().NGReasonDesc;
item2.NgMemo = item.NgMemo;
@@ -145,54 +144,51 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{
ResultModel result = new ResultModel();
var fqcResultDto = new List();
- var FqcInhouseDetails = await _context.FqcInhouseDetails.Where(w => w.InhouseNo == inhouseNo
- && w.SeqID == seqID).ToListAsync();
+ var querySql = @" SELECT DISTINCT SERIAL_NO AS BoxNo , BARCODE_NO AS BarcodeNo , EXTRA_BARCODE_NO AS ExtraBarcodeNo
+ FROM (
+ SELECT A.BARCODE_NO , A.EXTRA_BARCODE_NO , B.SERIAL_NO ,B.INHOUSE_NO
+ FROM JHAMES.BARCODE_INFO A , JHAMES.FQC_INHOUSE_DETAIL B
+ WHERE B.SERIAL_NO = A.BOX_NO
+ AND B.INHOUSE_NO = :InhouseNo
+ AND B.SEQ_ID = :SeqId
+ AND B.BARCODE_NO = '0'
+ UNION ALL
+ SELECT BARCODE_NO , EXTRA_BARCODE_NO , SERIAL_NO ,INHOUSE_NO
+ FROM JHAMES.FQC_INHOUSE_DETAIL
+ WHERE INHOUSE_NO = :InhouseNo
+ AND SEQ_ID = :SeqId
+ AND BARCODE_NO <> '0') ";
+
+ DynamicParameters p = new DynamicParameters();
+ p.Add("InhouseNo", inhouseNo);
+ p.Add("SeqId", seqID);
+ fqcResultDto = _context.Database.DapperQuery(querySql, p).ToList();
// 取FQC_ID
- if (FqcInhouseDetails.Count != 0)
+ if (fqcResultDto.Any())
{
- foreach (var item in FqcInhouseDetails)
+ var FqcResultMaster = await _context.FqcResultMasters.Where(w => w.InhouseNo == inhouseNo
+ && w.SeqID == seqID)
+ .FirstOrDefaultAsync();
+ if (FqcResultMaster != null)
{
- var BarcodeInfo = new List();
- if (item.SerialType == "B")
- BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BoxNo == item.SerialNo).ToListAsync();
- else
- BarcodeInfo = await _context.BarcodeInfoes.Where(w => w.BarcodeNo == item.SerialNo).ToListAsync();
-
- // 先塞入資料
- foreach (var item1 in BarcodeInfo)
- {
- fqcResultDto.Add(new FqcResultDto
- {
- BarcodeNo = item1.BarcodeNo,
- ExtraBarcodeNo = item1.ExtraBarcodeNo,
- BoxNo = item1.BoxNo,
- StatusNo = ""
- });
- }
-
- var FqcResultMaster = await _context.FqcResultMasters.Where(w => w.InhouseNo == item.InhouseNo
- && w.SeqID == item.SeqID)
- .FirstOrDefaultAsync();
-
var NgReasons = await _context.NGReasons.ToListAsync();
-
- // 取抽驗結果
- if (FqcResultMaster != null)
+ var FqcResultDetail = await _context.FqcResultDetails.Where(w => w.FqcID == FqcResultMaster.FqcID).ToListAsync();
+ foreach (var item in fqcResultDto)
{
- var FqcResultDetail = await _context.FqcResultDetails.Where(w => w.FqcID == FqcResultMaster.FqcID).ToListAsync();
- foreach (var item1 in FqcResultDetail)
+ // 取抽驗結果
+ if (FqcResultMaster != null)
{
- foreach (var item2 in fqcResultDto)
+ foreach (var item1 in FqcResultDetail)
{
- if (item1.BarcodeNo == item2.BarcodeNo)
+ if (item1.BarcodeNo == item.BarcodeNo)
{
- item2.StatusNo = item1.StatusNo == "P" ? "PASS" : "NG";
- item2.NgReasonNo = item1.NgReasonNo;
- item2.NgReasonDesc = NgReasons.Where(w => w.NGReasonNo == item1.NgReasonNo).FirstOrDefault() == null ? "" : NgReasons.Where(w => w.NGReasonNo == item1.NgReasonNo).FirstOrDefault().NGReasonDesc;
- item2.NgMemo = item1.NgMemo;
- item2.IsSample = "Y";
- item2.CreateName = await new Helper(_context).GetUserName(item.CreateUserID);
+ item.StatusNo = item1.StatusNo == "P" ? "PASS" : "NG";
+ item.NgReasonNo = item1.NgReasonNo;
+ item.NgReasonDesc = NgReasons.Where(w => w.NGReasonNo == item1.NgReasonNo).FirstOrDefault() == null ? "" : NgReasons.Where(w => w.NGReasonNo == item1.NgReasonNo).FirstOrDefault().NGReasonDesc;
+ item.NgMemo = item1.NgMemo;
+ item.IsSample = "Y";
+ item.CreateName = await new Helper(_context).GetUserName(item1.CreateUserID);
continue;
}
}
@@ -222,7 +218,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
/// WIPID
///
[HttpGet("GetCheckFqcOnGoIng")]
- public async Task> GetCheckFqcOnGoIng(string boxNo , int wipId)
+ public async Task> GetCheckFqcOnGoIng(string boxNo, int wipId)
{
var querySql = @" SELECT * FROM JHAMES.FQC_INHOUSE_MASTER M
INNER JOIN JHAMES.FQC_INHOUSE_DETAIL D ON M.INHOUSE_NO = D.INHOUSE_NO AND M.SEQ_ID = D.SEQ_ID
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs
index e56034fa..404df3c0 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs
@@ -10,6 +10,8 @@ using AMESCoreStudio.WebApi.Models.AMES;
using AMESCoreStudio.WebApi.DTO.AMES;
using AMESCoreStudio.CommonTools.Result;
using AMESCoreStudio.WebApi.Enum;
+using AMESCoreStudio.WebApi.Extensions;
+using Dapper;
namespace AMESCoreStudio.WebApi.Controllers.AMES
{
@@ -222,7 +224,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{
resultQuery = resultQuery.Skip((page - 1) * limit).Take(limit).ToList();
}
-
result.Data = resultQuery;
// 判斷結束時間
@@ -369,6 +370,79 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return result;
}
+ ///
+ /// 確認FQC開立抽驗時,是否資料與流程都完成
+ ///
+ /// 入庫單號碼
+ /// 序號
+ ///
+ [HttpGet("CheckFqcIssue")]
+ public async Task> CheckFqcIssue(string inhouseNo, int seqid = 1)
+ {
+ ResultModel result = new ResultModel { Success = true };
+ var CheckFqcNextProcess = await GetCheckFqcNextProcess(inhouseNo , seqid);
+
+ if (CheckFqcNextProcess.Any())
+ {
+ result.Success = false;
+ result.Msg = "該筆入庫單尚有序號未跑完流程,請確認";
+ return result;
+ }
+
+ var CheckFqcDetailExist = await GetCheckFqcDetailExist(inhouseNo, seqid);
+ if (!CheckFqcDetailExist.Any())
+ {
+ result.Success = false;
+ result.Msg = "該筆入庫單未有箱號紀錄,請確認";
+ return result;
+ }
+
+ return result;
+ }
+
+ ///
+ /// 確認FQC抽驗時是否已經跑到FQC流程
+ ///
+ /// 入庫單號碼
+ /// 序號
+ /// 有資料:尚未跑完流程
+ private async Task> GetCheckFqcNextProcess(string inhouseNo, int seqid = 1)
+ {
+ var querySql = @" SELECT A.STATION_ID , A.WIP_ID , A.FLOW_RULE_ID , A.NEXT_STATION_ID FROM
+ (SELECT B.STATION_ID , B.WIP_ID , W.FLOW_RULE_ID , R.NEXT_STATION_ID FROM JHAMES.FQC_INHOUSE_DETAIL D
+ INNER JOIN JHAMES.BARCODE_INFO B ON D.SERIAL_NO = B.BOX_NO
+ INNER JOIN JHAMES.WIP_INFO W ON B.WIP_ID = W.WIP_ID
+ INNER JOIN JHAMES.RULES R ON R.FLOW_RULE_ID = W.FLOW_RULE_ID AND R.STATION_ID = B.STATION_ID
+ WHERE D.INHOUSE_NO = :InhouseNo AND D.SEQ_ID=:Seqid
+ GROUP BY B.STATION_ID , B.WIP_ID , W.FLOW_RULE_ID , R.NEXT_STATION_ID) A ,
+ JHAMES.STATIONS S WHERE S.STATION_ID=A.NEXT_STATION_ID AND S.TYPE_NO != 'F' ";
+
+ DynamicParameters p = new DynamicParameters();
+ p.Add("InhouseNo", inhouseNo);
+ p.Add("SeqId", seqid);
+ var result = await _context.Database.DapperQueryAsync(querySql, p);
+ return result.ToList();
+ }
+
+ ///
+ /// 確認FQC開立抽驗時,InhouseDetail是否有資料
+ ///
+ /// 入庫單號碼
+ /// 序號
+ /// 沒資料:Detail沒有資料
+ private async Task> GetCheckFqcDetailExist(string inhouseNo, int seqid = 1)
+ {
+ var querySql = @" SELECT * FROM JHAMES.FQC_INHOUSE_MASTER M
+ INNER JOIN JHAMES.FQC_INHOUSE_DETAIL D ON M.INHOUSE_NO = D.INHOUSE_NO AND M.SEQ_ID = D.SEQ_ID
+ INNER JOIN JHAMES.WIP_INFO W ON W.WIP_NO = M.WIP_NO AND W.WIP_TYPE != 'N'
+ WHERE D.INHOUSE_NO = :InhouseNo AND D.SEQ_ID=:Seqid ";
+ DynamicParameters p = new DynamicParameters();
+ p.Add("InhouseNo", inhouseNo);
+ p.Add("SeqId", seqid);
+ var result = await _context.Database.DapperQueryAsync(querySql, p);
+ return result.ToList();
+ }
+
///
/// 更新入庫單
///
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemController.cs
index 1b0d01fb..26865ac9 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemController.cs
@@ -7,11 +7,13 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi;
using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.CommonTools.Result;
+using AMESCoreStudio.WebApi.DTO.AMES;
namespace AMESCoreStudio.WebApi.Controllers.AMES
{
///
- /// FQC檢驗結果ID
+ /// FQC檢驗項目群組綁定設定檔
///
[Route("api/[controller]")]
[ApiController]
@@ -24,104 +26,134 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
_context = context;
}
- // GET: api/FqcItem
[HttpGet]
public async Task>> GetFqcItems()
{
return await _context.FqcItems.ToListAsync();
}
- // GET: api/FqcItem/5
[HttpGet("{id}")]
public async Task> GetFqcItem(int id)
{
var fqcItem = await _context.FqcItems.FindAsync(id);
-
- if (fqcItem == null)
- {
- return NotFound();
- }
-
return fqcItem;
}
- // PUT: api/FqcItem/5
- // To protect from overposting attacks, enable the specific properties you want to bind to, for
- // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
- [HttpPut("{id}")]
- public async Task PutFqcItem(int id, FqcItem fqcItem)
+ ///
+ /// FQC檢驗項目群組綁定設定檔 to GroupID(FQC檢驗群組)
+ ///
+ /// 料號
+ ///
+ [HttpGet("ByFqcGroupId/{id}")]
+ public async Task> GetFqcItemByFqcGroupId(int id)
{
- if (id != fqcItem.FqcID)
- {
- return BadRequest();
- }
+ IQueryable q = _context.FqcItems;
+ var result = await q.Where(p => p.GroupId == id).ToListAsync();
+ return result;
+ }
+
+ ///
+ /// 料號查詢FQC檢驗群組及綁定檢驗工項
+ ///
+ /// 料號
+ ///
+ [HttpGet("ByItemNo/{id}")]
+ public async Task>> GetFqcItemByItemNo(string id)
+ {
+ var itemID = 0;
+ var result = await _context.MaterialItems.Where(w => w.ItemNo == id).ToListAsync();
+ if (result.Count() != 0)
+ itemID = result.FirstOrDefault().ItemID;
+
+ var q = from q1 in _context.FqcItems
+ join q2 in _context.FqcItemGroupMaterials on q1.GroupId equals q2.GroupId where q2.ItemId == itemID
+ select q1;
+
+ return await q.ToListAsync();
+ }
+ ///
+ /// 更新檢驗項目群組綁定設定檔
+ ///
+ ///
+ ///
+ [HttpPut]
+ public async Task> PutFqcItem(FqcItem fqcItem)
+ {
+ ResultModel result = new ResultModel();
_context.Entry(fqcItem).State = EntityState.Modified;
+ _context.Entry(fqcItem).Property("CreateDate").IsModified = false;
+ _context.Entry(fqcItem).Property("CreateUserID").IsModified = false;
+ fqcItem.UpdateDate = DateTime.Now;
try
{
await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
}
- catch (DbUpdateConcurrencyException)
+ catch (Exception ex)
{
- if (!FqcItemExists(id))
- {
- return NotFound();
- }
- else
- {
- throw;
- }
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
}
-
- return NoContent();
+ return result;
}
- // POST: api/FqcItem
- // To protect from overposting attacks, enable the specific properties you want to bind to, for
- // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
+ ///
+ /// 新增檢驗項目群組綁定設定檔
+ ///
+ ///
+ ///
[HttpPost]
- public async Task> PostFqcItem(FqcItem fqcItem)
+ public async Task> PostFqcItem(FqcItem fqcItem)
{
+ ResultModel result = new ResultModel();
+ Helper helper = new Helper(_context);
+ fqcItem.FqcItemId = helper.GetIDKey("FQC_ITEM_ID").Result;
_context.FqcItems.Add(fqcItem);
try
{
await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
}
- catch (DbUpdateException)
+ catch (Exception ex)
{
- if (FqcItemExists(fqcItem.FqcID))
- {
- return Conflict();
- }
- else
- {
- throw;
- }
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
}
-
- return CreatedAtAction("GetFqcItem", new { id = fqcItem.FqcID }, fqcItem);
+ return result;
}
// DELETE: api/FqcItem/5
[HttpDelete("{id}")]
- public async Task> DeleteFqcItem(int id)
+ public async Task> DeleteFqcItem(int id)
{
+ ResultModel result = new ResultModel();
var fqcItem = await _context.FqcItems.FindAsync(id);
- if (fqcItem == null)
+
+ try
{
- return NotFound();
+ if (fqcItem == null)
+ {
+ result.Success = false;
+ result.Msg = "找不到要刪除資料";
+ }
+ else
+ {
+ _context.FqcItems.Remove(fqcItem);
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
}
-
- _context.FqcItems.Remove(fqcItem);
- await _context.SaveChangesAsync();
-
- return fqcItem;
- }
-
- private bool FqcItemExists(int id)
- {
- return _context.FqcItems.Any(e => e.FqcID == id);
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
}
}
}
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupController.cs
new file mode 100644
index 00000000..3b4f284d
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupController.cs
@@ -0,0 +1,196 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using AMESCoreStudio.WebApi;
+using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.CommonTools.Result;
+using System.Text.RegularExpressions;
+using Dapper;
+using AMESCoreStudio.WebApi.Extensions;
+using System.Data;
+
+namespace AMESCoreStudio.WebApi.Controllers.AMES
+{
+ ///
+ /// FQC檢驗項目群組名稱設定檔
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class FqcItemGroupController : ControllerBase
+ {
+ private readonly AMESContext _context;
+
+ public FqcItemGroupController(AMESContext context)
+ {
+ _context = context;
+ }
+
+ [HttpGet]
+ public async Task>> GetFqcItemGroups()
+ {
+ return await _context.FqcItemGroups.ToListAsync();
+ }
+
+ [HttpGet("{id}")]
+ public async Task> GetFqcItemGroup(int id)
+ {
+ var fqcItemGroup = await _context.FqcItemGroups.FindAsync(id);
+ return fqcItemGroup;
+ }
+
+ ///
+ /// FQC檢驗項目群組名稱設定檔 By Query
+ ///
+ /// 群組代號
+ /// 群組名稱
+ /// 群組描述
+ /// 料號
+ /// 頁數
+ /// 筆數
+ ///
+ [HttpGet("FqcItemGroupQuery")]
+ public async Task> GetFqcItemGroupQuery(string no, string name, string desc, string itemNo, int page = 0, int limit = 10)
+ {
+ ResultModel result = new ResultModel();
+
+ var query = @$" SELECT DISTINCT
+ G.FQC_ITEM_GROUP_ID AS fqcItemGroupId ,
+ G.ITEM_GROUP_NO AS itemGroupNo ,
+ G.ITEM_GROUP_NAME AS itemGroupName ,
+ G.ITEM_GROUP_DESC AS itemGroupDesc
+ FROM JHAMES.FQC_ITEM_GROUP G
+ LEFT JOIN JHAMES.FQC_ITEM_GROUP_MATERIAL GM ON G.FQC_ITEM_GROUP_ID = GM.GROUP_ID
+ LEFT JOIN JHAMES.MATERIAL_ITEM M ON GM.ITEM_ID = M.ITEM_ID
+ WHERE 1 = 1 ";
+
+ DynamicParameters p = new DynamicParameters();
+ if (!string.IsNullOrWhiteSpace(no))
+ {
+ query += " AND UPPER(G.ITEM_GROUP_NO) LIKE :No ";
+ p.Add("No", $"%{no.Trim().ToUpper()}%", DbType.String);
+ }
+
+ if (!string.IsNullOrWhiteSpace(name))
+ {
+ query += " AND G.ITEM_GROUP_NAME LIKE :Name ";
+ p.Add("Name", $"%{name.Trim().ToUpper()}%", DbType.String);
+ }
+
+ if (!string.IsNullOrWhiteSpace(desc))
+ {
+ query += " AND G.ITEM_GROUP_DESC LIKE :GroupDesc ";
+ p.Add("GroupDesc", $"%{desc.Trim().ToUpper()}%", DbType.String);
+ }
+
+ if (!string.IsNullOrWhiteSpace(itemNo))
+ {
+ query += " AND UPPER(M.ITEM_NO) LIKE :ItemNo ";
+ p.Add("ItemNo", $"%{itemNo.Trim().ToUpper()}%", DbType.String);
+ }
+
+ var q = await _context.Database.DapperQueryAsync(query, p);
+
+ // 紀錄筆數
+ result.DataTotal = q.Count();
+
+ // Table 頁數
+ if (page > 0)
+ {
+ q = q.Skip((page - 1) * limit).Take(limit);
+ }
+ result.Data = q;
+ return result;
+ }
+
+ ///
+ /// 更新FQC檢驗項目群組名稱設定檔
+ ///
+ ///
+ ///
+ [HttpPut]
+ public async Task> PutFqcItemGroup(FqcItemGroup fqcItemGroup)
+ {
+ ResultModel result = new ResultModel();
+ _context.Entry(fqcItemGroup).State = EntityState.Modified;
+ _context.Entry(fqcItemGroup).Property("CreateDate").IsModified = false;
+ _context.Entry(fqcItemGroup).Property("CreateUserID").IsModified = false;
+ fqcItemGroup.UpdateDate = DateTime.Now;
+
+ try
+ {
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
+ }
+
+ ///
+ /// 新增FQC檢驗項目群組名稱設定檔
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> PostFqcItemGroup(FqcItemGroup fqcItemGroup)
+ {
+ ResultModel result = new ResultModel();
+ Helper helper = new Helper(_context);
+ fqcItemGroup.FqcItemGroupId = helper.GetIDKey("FQC_ITEM_GROUP_ID").Result;
+ _context.FqcItemGroups.Add(fqcItemGroup);
+ try
+ {
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
+ }
+
+ [HttpDelete("{id}")]
+ public async Task> DeleteFqcItemGroup(int id)
+ {
+ ResultModel result = new ResultModel();
+ var fqcItemGroup = await _context.FqcItemGroups.FindAsync(id);
+ var fqcItem = await _context.FqcItems.Where(w => w.GroupId == id).ToListAsync();
+ var fqcItemGroupMaterial = await _context.FqcItemGroupMaterials
+ .Where(w => w.GroupId == id).ToListAsync();
+ try
+ {
+ if (fqcItemGroup == null)
+ {
+ result.Success = false;
+ result.Msg = "找不到要刪除資料";
+ }
+ else
+ {
+ _context.FqcItemGroups.Remove(fqcItemGroup);
+ _context.FqcItems.RemoveRange(fqcItem);
+ _context.FqcItemGroupMaterials.RemoveRange(fqcItemGroupMaterial);
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
+ }
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
+ }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupMaterialController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupMaterialController.cs
new file mode 100644
index 00000000..5e1412f7
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcItemGroupMaterialController.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using AMESCoreStudio.WebApi;
+using AMESCoreStudio.WebApi.Models.AMES;
+using AMESCoreStudio.CommonTools.Result;
+using System.Text.RegularExpressions;
+using Dapper;
+using AMESCoreStudio.WebApi.Extensions;
+
+namespace AMESCoreStudio.WebApi.Controllers.AMES
+{
+ ///
+ /// FQC檢驗項目群組指定料號設定檔
+ ///
+ [Route("api/[controller]")]
+ [ApiController]
+ public class FqcItemGroupMaterialController : ControllerBase
+ {
+ private readonly AMESContext _context;
+
+ public FqcItemGroupMaterialController(AMESContext context)
+ {
+ _context = context;
+ }
+
+ [HttpGet]
+ public async Task>> GetFqcItemGroupMaterials()
+ {
+ return await _context.FqcItemGroupMaterials.ToListAsync();
+ }
+
+ ///
+ /// By GroupId 查詢
+ ///
+ /// GroupId
+ ///
+ [HttpGet("ByGroupId/{id}")]
+ public async Task>> GetFqcItemGroupMaterialByGroupId(int id)
+ {
+ var query = @" SELECT
+ F.GROUP_ID AS groupId ,
+ M.ITEM_ID AS itemId ,
+ M.ITEM_NO AS itemNo ,
+ M.ITEM_DESC AS itemDesc ,
+ F.CREATE_USERID AS createUserID ,
+ F.CREATE_DATE AS createDate ,
+ F.UPDATE_USERID AS updateUserID ,
+ F.UPDATE_DATE AS updateDate
+ FROM JHAMES.FQC_ITEM_GROUP_MATERIAL F
+ INNER JOIN JHAMES.MATERIAL_ITEM M ON F.ITEM_ID = M.ITEM_ID
+ WHERE F.GROUP_ID = :GroupId";
+ DynamicParameters p = new DynamicParameters();
+ p.Add("GroupId", id);
+ var result = await _context.Database.DapperQueryAsync(query, p);
+ return result.ToList();
+ }
+
+ ///
+ /// By ItemId 查詢
+ ///
+ /// ItemId
+ ///
+ [HttpGet("ByItemId/{id}")]
+ public async Task>> GetFqcItemGroupMaterialByItemId(int id)
+ {
+ var query = @" SELECT
+ F.GROUP_ID AS groupId ,
+ M.ITEM_ID AS itemId ,
+ M.ITEM_NO AS itemNo ,
+ M.ITEM_DESC AS itemDesc ,
+ F.CREATE_USERID AS createUserID ,
+ F.CREATE_DATE AS createDate ,
+ F.UPDATE_USERID AS updateUserID ,
+ F.UPDATE_DATE AS updateDate
+ FROM JHAMES.FQC_ITEM_GROUP_MATERIAL F
+ INNER JOIN JHAMES.MATERIAL_ITEM M ON F.ITEM_ID = M.ITEM_ID
+ WHERE F.ITEM_ID = :ItemId";
+ DynamicParameters p = new DynamicParameters();
+ p.Add("ItemId", id);
+ var result = await _context.Database.DapperQueryAsync(query, p);
+ return result.ToList();
+ }
+
+ ///
+ /// 更新檢驗群組指定料號設定檔
+ ///
+ ///
+ ///
+ [HttpPut]
+ public async Task> PutFqcItemGroupMaterial(FqcItemGroupMaterial fqcItemGroupMaterial)
+ {
+ ResultModel result = new ResultModel();
+ _context.Entry(fqcItemGroupMaterial).State = EntityState.Modified;
+ _context.Entry(fqcItemGroupMaterial).Property("CreateDate").IsModified = false;
+ _context.Entry(fqcItemGroupMaterial).Property("CreateUserID").IsModified = false;
+ fqcItemGroupMaterial.UpdateDate = DateTime.Now;
+
+ try
+ {
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
+ }
+
+ ///
+ /// 新增檢驗群組指定料號設定檔
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task> PostFqcItemGroupMaterial(FqcItemGroupMaterial fqcItemGroupMaterial)
+ {
+ ResultModel result = new ResultModel();
+ _context.FqcItemGroupMaterials.Add(fqcItemGroupMaterial);
+ try
+ {
+ await _context.SaveChangesAsync();
+ result.Success = true;
+ result.Msg = "OK";
+ }
+ catch (Exception ex)
+ {
+ result.Success = false;
+ result.Msg = ex.InnerException.Message;
+ }
+ return result;
+ }
+
+ ///
+ /// 刪除 檢驗群組指定料號設定檔
+ ///
+ /// GroupId
+ /// itemId
+ ///
+ [HttpDelete("{id}/{id1}")]
+ public async Task> DeleteFqcItemGroupMaterial(int id, int id1)
+ {
+ var query = @" DELETE JHAMES.FQC_ITEM_GROUP_MATERIAL WHERE GROUP_ID =:id
+ AND ITEM_ID = :id1";
+ DynamicParameters p = new DynamicParameters();
+ p.Add("id", id);
+ p.Add("id1", id1);
+ var result = await _context.Database.DapperExecuteAsync(query, p);
+ return result;
+ }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterController.cs
index 361758cd..390b12be 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterController.cs
@@ -345,6 +345,39 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return result;
}
+ ///
+ /// 執行判斷無序號工單檢驗完成
+ ///
+ ///
+ ///
+ [HttpGet("ExecuteWithoutWipNoComplete/{id}")]
+ public async Task> ExecuteWithoutWipNoComplete(string id)
+ {
+ var query = @$" SELECT SUM(INHOUSE_QTY) , PLAN_QTY , WIP_NO FROM
+ (SELECT DISTINCT I.INHOUSE_QTY , I.INHOUSE_NO , I.SEQ_ID , W.PLAN_QTY, W.WIP_NO
+ FROM JHAMES.FQC_INHOUSE_MASTER I
+ INNER JOIN JHAMES.FQC_RESULT_MASTER F ON I.INHOUSE_NO = F.INHOUSE_NO AND I.SEQ_ID = F.SEQ_ID
+ INNER JOIN JHAMES.WIP_INFO W ON F.WIP_NO = W.WIP_NO
+ WHERE F.INSPECTION_STATUS = 'D'
+ AND I.STATUS = 'P'
+ AND I.WIP_NO=:WipNo) A
+ GROUP BY WIP_NO, PLAN_QTY
+ HAVING SUM(INHOUSE_QTY) = PLAN_QTY ";
+
+ DynamicParameters p = new DynamicParameters();
+ p.Add("WipNo", id.Trim().ToUpper(), DbType.String);
+ var q = await _context.Database.DapperQueryAsync(query, p);
+
+ if (q.Any())
+ {
+ query = @" UPDATE JHAMES.WIP_INFO SET STATUS_NO='E' WHERE WIP_NO=:WipNo ";
+ await _context.Database.DapperExecuteAsync(query, p);
+ return "該筆工單已執行結案";
+ }
+
+ return "該筆工單尚未全部抽驗完成";
+ }
+
///
/// 更新FQC檢驗單結果
///
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs
index 734bc238..4971d029 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialItemController.cs
@@ -68,7 +68,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task GetMaterialItemByItemNO(string id)
{
IQueryable q = _context.MaterialItems;
- var result = q.Where(p => p.ItemNo == id).FirstOrDefault();
+ var result = await q.Where(p => p.ItemNo == id).FirstOrDefaultAsync();
return result;
}
@@ -87,6 +87,18 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
return result;
}
+ ///
+ /// 關鍵字查詢
+ ///
+ /// 料號
+ ///
+ [HttpGet("AutoComplete/{id}")]
+ public async Task>> GetMeterialAutoComplete(string id)
+ {
+ var materialItems = await _context.MaterialItems.Where(w => w.ItemNo.ToUpper().Contains(id.ToUpper())).Take(20).ToListAsync();
+ return materialItems;
+ }
+
///
/// 新增料號基本資料檔
///
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/QcItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/QcItemController.cs
index d8501646..5572d9c1 100644
--- a/AMESCoreStudio.WebApi/Controllers/AMES/QcItemController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/AMES/QcItemController.cs
@@ -56,9 +56,10 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
/// 筆數
/// 料號
/// 工單號碼
+ /// FQC檢驗設定群組
///
[HttpGet("QcItemQuery")]
- public async Task> GetQcItemQuery(int groupID = 0, int page = 0, int limit = 10, string itemNo = null, string wipNo = null)
+ public async Task> GetQcItemQuery(int groupID = 0, int page = 0, int limit = 10, string itemNo = null, string wipNo = null, int fqcItemGroupId = 0)
{
IQueryable q = _context.QcItems;
ResultModel result = new ResultModel();
@@ -75,8 +76,6 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
q = q.Skip((page - 1) * limit).Take(limit);
}
- //var aa = System.Enum.IsDefined(typeof(EnumFQC.EnumQCItem_Type), "A") ? EnumFQC.GetDisplayName((EnumFQC.EnumQCItem_Type)System.Enum.Parse(typeof(EnumFQC.EnumQCItem_Type), "A")) : "";
-
result.Data = await q.Select(s => new QcItemDto
{
ItemID = s.ItemID,
@@ -91,31 +90,51 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
GroupNameEN = s.GetQcGroup.GroupNameCN ?? "",
ItemType = s.Type
}).ToListAsync();
+
// 先判斷工單是否有資料
- var wipFqcItem = await _context.WipFqcItems.Where(w => w.WipNo == wipNo).ToListAsync();
- if (wipFqcItem.Count != 0)
+ if (!string.IsNullOrWhiteSpace(wipNo))
{
- foreach (var item in result.Data)
+ var wipFqcItem = await _context.WipFqcItems.Where(w => w.WipNo == wipNo).ToListAsync();
+ if (wipFqcItem.Count != 0)
{
- if (wipFqcItem.Where(w => w.QcItemID == item.ItemID).Any())
- item.check = true;
+ foreach (var item in result.Data)
+ {
+ if (wipFqcItem.Where(w => w.QcItemID == item.ItemID).Any())
+ item.check = true;
+ }
}
}
- else
+
+ // 有輸入料號跟QCITEM 比對有資料打勾
+ if (!string.IsNullOrWhiteSpace(itemNo))
{
- // 有輸入料號跟QCITEM 比對有資料打勾
var itemID = _context.MaterialItems.Where(w => w.ItemNo == itemNo).FirstOrDefault();
if (itemID != null)
{
- var marterialFQCItems = _context.MaterialFqcItems.Where(w => w.ItemID == itemID.ItemID);
+ var q1 = from q2 in _context.FqcItems
+ join q3 in _context.FqcItemGroupMaterials on q2.GroupId equals q3.GroupId
+ where q3.ItemId == itemID.ItemID
+ select q2;
+
foreach (var item in result.Data)
{
- if (marterialFQCItems.Where(w => w.QcItemID == item.ItemID).Any())
+ if (q1.Where(w => w.QcItemId == item.ItemID).Any())
item.check = true;
}
}
}
+ // 有設定FQC檢驗項目群組
+ if (fqcItemGroupId != 0)
+ {
+ var fqcItem = await _context.FqcItems.Where(w => w.GroupId == fqcItemGroupId).ToListAsync();
+ foreach (var item in result.Data)
+ {
+ if (fqcItem.Where(w => w.QcItemId == item.ItemID).Any())
+ item.check = true;
+ }
+ }
+
result.Data.Select(s => s.ItemTypeName =
System.Enum.IsDefined(typeof(EnumFQC.EnumQCItem_Type), s.ItemType ?? "") ?
EnumFQC.GetDisplayName((EnumFQC.EnumQCItem_Type)System.Enum.Parse(typeof(EnumFQC.EnumQCItem_Type), s.ItemType)) : "")
diff --git a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs
index 4e9f8068..bc197247 100644
--- a/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs
+++ b/AMESCoreStudio.WebApi/Controllers/BLL/BarCodeCheckNewController.cs
@@ -2041,9 +2041,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
{
WipInfosController wipInfosController = new WipInfosController(_context);
var result = await wipInfosController.PutWipinfoToStatusNO(wipId, "E");
- // 呼叫CTO
- string getUrl = $"https://nportal.avalue.com.tw/avaluecto/ctoamesmodone.aspx?orderno={wipInfo.WipNO}";
- await MakeGetRequest(getUrl);
+ // 呼叫CTO
+ await WipEndCallCtoUrl(wipInfo.WipNO);
}
}
return "";
@@ -2569,6 +2568,18 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
}
}
+ ///
+ /// 工單完工時呼叫CTO
+ ///
+ /// 工單號碼
+ ///
+ private async Task WipEndCallCtoUrl(string WipNo)
+ {
+ // 呼叫CTO
+ string getUrl = $"https://nportal.avalue.com.tw/avaluecto/ctoamesmodone.aspx?orderno={WipNo}";
+ await MakeGetRequest(getUrl);
+ }
+
///
/// 執行Get Https網址
///
diff --git a/AMESCoreStudio.WebApi/DTO/AMES/FqcResultDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/FqcResultDto.cs
index b970b3a0..75da362d 100644
--- a/AMESCoreStudio.WebApi/DTO/AMES/FqcResultDto.cs
+++ b/AMESCoreStudio.WebApi/DTO/AMES/FqcResultDto.cs
@@ -63,7 +63,7 @@ namespace AMESCoreStudio.WebApi.DTO.AMES
///
[Display(Name = "狀態")]
[Column("STATUS_NO")]
- public string StatusNo { get; set; } = "P";
+ public string StatusNo { get; set; }
///
/// IsSample
diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcItem.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcItem.cs
index bc1b9e88..f3cd5815 100644
--- a/AMESCoreStudio.WebApi/Models/AMES/FqcItem.cs
+++ b/AMESCoreStudio.WebApi/Models/AMES/FqcItem.cs
@@ -2,51 +2,47 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using Microsoft.EntityFrameworkCore;
using System.Runtime.Serialization;
+using Microsoft.EntityFrameworkCore;
#nullable disable
namespace AMESCoreStudio.WebApi.Models.AMES
{
///
- /// FQC细目資料檔
+ /// FQC檢驗項目群組綁定設定檔
///
- [Keyless]
[Table("FQC_ITEM", Schema = "JHAMES")]
- [Index(nameof(FqcID), nameof(ItemID), Name = "FQC_ITEM_AK1", IsUnique = true)]
public partial class FqcItem
{
-
///
- /// FQC檢驗結果ID
+ /// ID
///
[Key]
[DataMember]
- [Display(Name = "FQC檢驗結果ID")]
- [Required(ErrorMessage = "{0},不能空白")]
- [Column("FQC_ID")]
- public int FqcID { get; set; }
+ [Column("FQC_ITEM_ID")]
+ public int FqcItemId { get; set; }
///
- /// 细目序號ID
+ /// FQC檢驗項目群組ID
+ ///
+ [DataMember]
+ [Column("GROUP_ID")]
+ public int GroupId { get; set; }
+
+ ///
+ /// 檢驗類別ID
///
- [Key]
[DataMember]
- [Display(Name = "细目序號ID")]
- [Required(ErrorMessage = "{0},不能空白")]
- [Column("ITEM_ID")]
- public int ItemID { get; set; }
+ [Column("QC_GROUP_ID")]
+ public int QcGroupId { get; set; }
///
- /// 细目内容
+ /// 檢驗項目ID
///
[DataMember]
- [Display(Name = "细目内容")]
- [Required(ErrorMessage = "{0},不能空白")]
- [Column("ITEM_CONTENT")]
- [StringLength(200)]
- public string ItemContent { get; set; }
+ [Column("QC_ITEM_ID")]
+ public int QcItemId { get; set; }
///
/// 建立UserID
diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroup.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroup.cs
new file mode 100644
index 00000000..c06a01b0
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroup.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Runtime.Serialization;
+using Microsoft.EntityFrameworkCore;
+
+#nullable disable
+
+namespace AMESCoreStudio.WebApi.Models.AMES
+{
+ ///
+ /// FQC檢驗項目群組名稱
+ ///
+ [Table("FQC_ITEM_GROUP", Schema = "JHAMES")]
+ public partial class FqcItemGroup
+ {
+ ///
+ /// ID
+ ///
+ [Key]
+ [DataMember]
+ [Column("FQC_ITEM_GROUP_ID")]
+ public int FqcItemGroupId { get; set; }
+
+ ///
+ /// 群組代號
+ ///
+ [DataMember]
+ [Required(ErrorMessage = "{0},不能空白")]
+ [Column("ITEM_GROUP_NO")]
+ [StringLength(60)]
+ [Display(Name = "群組代號")]
+ public string ItemGroupNo { get; set; }
+
+ ///
+ /// 群組名稱
+ ///
+ [DataMember]
+ [Required(ErrorMessage = "{0},不能空白")]
+ [Column("ITEM_GROUP_NAME")]
+ [StringLength(200)]
+ [Display(Name = "群組名稱")]
+ public string ItemGroupName { get; set; }
+
+ ///
+ /// 群組描敘
+ ///
+ [DataMember]
+ [Column("ITEM_GROUP_DESC")]
+ [StringLength(300)]
+ public string ItemGroupDesc { get; set; }
+
+ ///
+ /// 建立UserID
+ ///
+ [Column("CREATE_USERID")]
+ [Required]
+ [DataMember]
+ public int CreateUserID { get; set; } = 0;
+
+ ///
+ /// 建立日期
+ ///
+ [Required]
+ [Column("CREATE_DATE")]
+ [DataMember]
+ public DateTime CreateDate { get; set; } = DateTime.Now;
+
+ ///
+ /// 更新UserID
+ ///
+ [Column("UPDATE_USERID")]
+ [DataMember]
+ public int UpdateUserID { get; set; } = 0;
+
+ ///
+ /// 更新日期
+ ///
+ [Column("UPDATE_DATE")]
+ [DataMember]
+ public DateTime? UpdateDate { get; set; } = DateTime.Now;
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroupMaterial.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroupMaterial.cs
new file mode 100644
index 00000000..aae7e197
--- /dev/null
+++ b/AMESCoreStudio.WebApi/Models/AMES/FqcItemGroupMaterial.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Runtime.Serialization;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Identity.Client;
+
+#nullable disable
+
+namespace AMESCoreStudio.WebApi.Models.AMES
+{
+ ///
+ /// FQC檢驗項目群組指定料號設定檔
+ ///
+ [Keyless]
+ [Table("FQC_ITEM_GROUP_MATERIAL", Schema = "JHAMES")]
+ public partial class FqcItemGroupMaterial
+ {
+ ///
+ /// FQC檢驗項目群組ID
+ ///
+ [Column("GROUP_ID")]
+ [DataMember]
+ public int GroupId { get; set; }
+
+ ///
+ /// 料號ID
+ ///
+ [Column("ITEM_ID")]
+ [DataMember]
+ public int ItemId { get; set; }
+
+ ///
+ /// 建立UserID
+ ///
+ [Column("CREATE_USERID")]
+ [Required]
+ [DataMember]
+ public int CreateUserID { get; set; } = 0;
+
+ ///
+ /// 建立日期
+ ///
+ [Required]
+ [Column("CREATE_DATE")]
+ [DataMember]
+ public DateTime CreateDate { get; set; } = DateTime.Now;
+
+ ///
+ /// 更新UserID
+ ///
+ [Column("UPDATE_USERID")]
+ [DataMember]
+ public int UpdateUserID { get; set; } = 0;
+
+ ///
+ /// 更新日期
+ ///
+ [Column("UPDATE_DATE")]
+ [DataMember]
+ public DateTime? UpdateDate { get; set; } = DateTime.Now;
+
+ ///
+ /// 料號
+ ///
+ [NotMapped]
+ [DataMember]
+ public string ItemNo { get; set; }
+
+ ///
+ /// 料號描述
+ ///
+ [NotMapped]
+ [DataMember]
+ public string ItemDesc { get; set; }
+ }
+}
diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs
index 7807edb2..2dc23eb1 100644
--- a/AMESCoreStudio.WebApi/Models/AMESContext.cs
+++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs
@@ -117,7 +117,6 @@ namespace AMESCoreStudio.WebApi
modelBuilder.Entity().HasKey(c => new { c.InhouseNo, c.SeqID, c.SerialNo });
modelBuilder.Entity().HasKey(c => new { c.FqcID, c.BoxNo, c.BarcodeNo });
modelBuilder.Entity().HasKey(c => new { c.FqcID, c.BarcodeID });
- modelBuilder.Entity().HasKey(c => new { c.FqcID, c.ItemID });
modelBuilder.Entity().HasKey(e => new { e.FqcID, e.CreateDate });
modelBuilder.Entity().HasOne(r => r.Barcode).WithMany().HasForeignKey(r => r.BarcodeID).IsRequired();
modelBuilder.Entity().HasOne(r => r.Wip).WithMany().HasForeignKey(r => r.WipId).IsRequired();
@@ -156,6 +155,7 @@ namespace AMESCoreStudio.WebApi
modelBuilder.Entity().HasKey(c => new { c.NGClassNo, c.NGReasonNo });
modelBuilder.Entity().HasKey(c => new { c.Yrer, c.Month, c.QcRateType, c.ProductType });
modelBuilder.Entity().HasNoKey();
+ modelBuilder.Entity().HasKey(c => new { c.GroupId, c.ItemId });
}
///
@@ -654,11 +654,6 @@ namespace AMESCoreStudio.WebApi
///
public virtual DbSet FqcBarcodes { get; set; }
- ///
- /// FQC细目資料檔
- ///
- public virtual DbSet FqcItems { get; set; }
-
///
/// 抽驗批退資料檔
///
@@ -1001,6 +996,21 @@ namespace AMESCoreStudio.WebApi
///
public DbSet TestInfoes { get; set; }
+ ///
+ /// FQC檢驗項目群組綁定設定檔
+ ///
+ public virtual DbSet FqcItems { get; set; }
+
+ ///
+ /// FQC檢驗項目群組名稱
+ ///
+ public virtual DbSet FqcItemGroups { get; set; }
+
+ ///
+ /// FQC檢驗項目群組指定料號設定檔
+ ///
+ public virtual DbSet FqcItemGroupMaterials { get; set; }
+
///
/// 維修不良序號
///