diff --git a/AMESCoreStudio.Web/Controllers/FQCController.cs b/AMESCoreStudio.Web/Controllers/FQCController.cs index c290e4f5..cf301c63 100644 --- a/AMESCoreStudio.Web/Controllers/FQCController.cs +++ b/AMESCoreStudio.Web/Controllers/FQCController.cs @@ -570,19 +570,20 @@ namespace AMESCoreStudio.Web.Controllers return View(); } - //public async Task PCS030QueryAsync(string barcodeNo, string wipNo - // , string boxNo, string inhouseNo, string date_str, string date_end) - //{ - // return IResultModel(); - // //IResultModel result = await _pcsApi.GetWipSopQuery(itemNo: itemNo, unitNo: unitNo - // //, fileName: fileName, state: state, date_str: date_str, date_end: date_end); - // // - // //if (result.Data.Count() != 0) - // //{ - // // return Json(new Table() { code = 0, msg = "", data = result.Data, count = 0 }); - // //} - // //return Json(new Table() { count = 0, data = null }); - //} + public async Task FQC008QueryAsync(string barcodeNo, string wipNo + , string boxNo, string inhouseNo, string date_str, string date_end + , string status, int page = 1, int limit = 10) + { + IResultModel result = await _fqcApi.GetFqcInhouseMasterQuery(barcodeNo: barcodeNo, wipNo: wipNo + , boxNo: boxNo, inhouseNo: inhouseNo, date_str: date_str, date_end: date_end + , status: status , page: page, limit: 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 }); + } #endregion } } diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 4646f4be..6ec61f98 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -2325,7 +2325,7 @@ namespace AMESCoreStudio.Web.Controllers ReasonNo = NGNo, ProgramNo = "N/A", MachineNo = "N/A", - RuleStationId = model.RuleStation, + StationId = model.Station, WipId = model.WipID }; var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo)); @@ -2419,7 +2419,7 @@ namespace AMESCoreStudio.Web.Controllers ReasonNo = NGNo, ProgramNo = "N/A", MachineNo = "N/A", - RuleStationId = model.RuleStation, + StationId = model.Station, WipId = model.WipID }; var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo)); diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs index 583ef318..b79f7db3 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IFQC.cs @@ -268,8 +268,23 @@ namespace AMESCoreStudio.Web #endregion #region FQC008 FQC查詢 - //[WebApiClient.Attributes.HttpGet("api/StatusType/{id}")] - //ITask> GetStatusTypeQuery(int page = 1, int limit = 10); + /// + /// FQC查詢 + /// + /// 內部序號 + /// 工單號碼 + /// 外箱號碼 + /// 入庫單號碼 + /// 入庫時間起 + /// 入庫時間迄 + /// 抽驗結果 + /// 頁數 + /// 筆數 + /// + [WebApiClient.Attributes.HttpGet("api/FqcInhouseMaster/FqcInhouseMasterQuery")] + ITask> GetFqcInhouseMasterQuery(string barcodeNo = null, string wipNo = null + , string boxNo = null, string inhouseNo = null, string date_str = null, string date_end = null + , string status = null, int page = 1, int limit = 10); #endregion } diff --git a/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs b/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs deleted file mode 100644 index 32276df2..00000000 --- a/AMESCoreStudio.Web/ViewModels/FQC/FQC008ViewModel.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AMESCoreStudio.WebApi.Models.AMES; -using AMESCoreStudio.WebApi.Models.BAS; -using AMESCoreStudio.WebApi.DTO.AMES; - -namespace AMESCoreStudio.Web.ViewModels -{ - public class FQC008ViewModel - { - public NgInfo ngInfo { get; set; } - - public NgComponent ngComponent { get; set; } - - public RepairRecord repairRecord { get; set; } - - public NgRepair ngRepair { get; set; } - - } -} diff --git a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml index 49511d6f..f9b0c216 100644 --- a/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml +++ b/AMESCoreStudio.Web/Views/FQC/FQC008.cshtml @@ -130,33 +130,55 @@ var tableCols = [[ { - field: 'itemNo', + field: 'inhouseNo', width: 150, title: '入庫單號', sort: true }, { - field: 'unitName', + field: 'seqID', + title: '順序', + sort: true + }, + { + field: 'wipNo', title: '工單號碼', - width: 200, sort: true }, { - field: 'fileName', - title: '狀態', + field: 'itemNo', + title: '料號', sort: true }, { - field: 'right', - width: 80, - title: '操作', - align: 'center', - fixed: 'right', - templet: function (d) { - return '' - } - }] - ]; + field: 'createDate', + title: '入庫時間', + sort: true, + emplet: '
{{ layui.util.toDateString(d.createDate, "yyyy/MM/dd") }}
' + }, + { + field: 'serialNo', + title: '箱號', + sort: true + }, + { + field: 'statusName', + title: '檢驗狀態', + sort: true + } + //, + //{ + // field: 'right', + // width: 80, + // title: '操作', + // align: 'center', + // fixed: 'right', + // templet: function (d) { + // return '' + // } + //} + ]]; + //通过行tool编辑,lay-event="show" function show(obj) { layui.use('layer', function () { diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs index b629bebb..6c282e2f 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcInhouseMasterController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi.Models.AMES; +using AMESCoreStudio.WebApi.DTO.AMES; using AMESCoreStudio.CommonTools.Result; namespace AMESCoreStudio.WebApi.Controllers.AMES @@ -46,6 +47,90 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return fqcInhouseMaster; } + /// + /// FQC查詢 by Table + /// + /// 內部序號 + /// 工單號碼 + /// 外箱號碼 + /// 入庫單號碼 + /// 入庫時間起 + /// 入庫時間迄 + /// 抽驗結果 + /// 頁數 + /// 筆數 + /// + [HttpGet("FqcInhouseMasterQuery")] + public async Task> GetFqcInhouseMasterQuery(string barcodeNo, string wipNo, string boxNo + , string inhouseNo, string date_str, string date_end, string status, int page = 1, int limit = 10) + { + IQueryable q = from q1 in _context.FqcInhouseMasters + join q2 in _context.FqcInhouseDetails on new { q1.InhouseNo, q1.SeqID } equals new { q2.InhouseNo, q2.SeqID } + select new FqcInhouseMasterDto + { + InhouseNo = q1.InhouseNo, + SeqID = q1.SeqID, + WipNo = q1.WipNo, + ItemNo = q1.ItemNo, + ModelNo = q1.ModelNo, + SerialNo = q2.SerialNo, + StatusName = q1.Status, + ProTypeName = q1.ProType, + CreateDate = q1.CreateDate + }; + //q1.Status == "P" ? "允收" : q1.Status == "R" ? "批退" : "未驗收完成", + //IQueryable q1 = _context.FqcInhouseDetails; + if (!string.IsNullOrWhiteSpace(inhouseNo)) + q = q.Where(w => w.InhouseNo == inhouseNo); + + if (!string.IsNullOrWhiteSpace(wipNo)) + q = q.Where(w => w.WipNo == wipNo); + + if (!string.IsNullOrWhiteSpace(status)) + q = q.Where(w => w.StatusName == status); + + // 優先用內部序號取出包裝序號 + if (!string.IsNullOrWhiteSpace(barcodeNo)) + { + BarcodeInfoesController barcodeInfoesController = new BarcodeInfoesController(_context); + var q1 = await barcodeInfoesController.GetBarcodeInfoesByNo(barcodeNo); + if (q1.Value.Count() != 0) + { + boxNo = q1.Value.FirstOrDefault().BoxNo; + } + } + + if (!string.IsNullOrWhiteSpace(boxNo)) + { + q = q.Where(w => w.SerialNo == boxNo); + } + + if (DateTime.TryParse(date_str, out _)) + { + q = q.Where(w => w.CreateDate >= DateTime.Parse(date_str)); + } + + if (DateTime.TryParse(date_end, out _)) + { + q = q.Where(w => w.CreateDate <= DateTime.Parse(date_end)); + } + + ResultModel result = new ResultModel(); + + // 紀錄筆數 + result.DataTotal = q.Count(); + + // Table 頁數 + if (page > 0) + { + q = q.Skip((page - 1) * limit).Take(limit); + } + result.Data = await q.ToListAsync(); + result.Data = result.Data.Select(s => { s.StatusName = s.StatusName == "P" ? "允收" : s.StatusName == "R" ? "批退" : "未驗收完成"; return s; }) + .ToList(); + return result; + } + /// /// 更新入庫單 /// diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs index 40b01fcd..fc5cf426 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs @@ -43,7 +43,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { data.Barcode = _context.BarcodeInfoes.Find(data.BarcodeID); data.Wip = _context.WipInfos.Find(data.WipId); - data.Station = _context.Stationses.Find(data.RuleStationId); + //data.Station = _context.Stationses.Find(data.RuleStationId); //data.User = _context.UserInfoes.Find(data.OperatorID); //data.OperatorName = _context.UserInfoes.Find(data.OperatorID).UserName; } @@ -72,7 +72,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { data.Barcode = _context.BarcodeInfoes.Find(data.BarcodeID); data.Wip = _context.WipInfos.Find(data.WipId); - data.Station = _context.Stationses.Find(data.RuleStationId); + //data.Station = _context.Stationses.Find(data.RuleStationId); //data.User = _context.UserInfoes.Find(data.OperatorID); //data.OperatorName = _context.UserInfoes.Find(data.OperatorID).UserName; } @@ -116,7 +116,7 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES { data.Barcode = _context.BarcodeInfoes.Find(data.BarcodeID); data.Wip = _context.WipInfos.Find(data.WipId); - data.Station = _context.Stationses.Find(data.RuleStationId); + //data.Station = _context.Stationses.Find(data.RuleStationId); //data.User = _context.UserInfoes.Find(data.OperatorID); //data.OperatorName = _context.UserInfoes.Find(data.OperatorID).UserName; } diff --git a/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs b/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs new file mode 100644 index 00000000..2bf9c8f5 --- /dev/null +++ b/AMESCoreStudio.WebApi/DTO/AMES/FqcInhouseMasterDto.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using System.Runtime.Serialization; + + +#nullable disable + +namespace AMESCoreStudio.WebApi.DTO.AMES +{ + /// + /// 入庫單資料檔 Dto + /// + public partial class FqcInhouseMasterDto + { + /// + /// 入庫單號碼 + /// + [DataMember] + public string InhouseNo { get; set; } + + /// + /// 順序ID + /// + [Key] + [DataMember] + public int SeqID { get; set; } = 1; + + /// + /// 工單號碼 + /// + [DataMember] + [Display(Name = "工單號碼")] + public string WipNo { get; set; } + + /// + /// 料號 + /// + [DataMember] + [Display(Name = "料號")] + public string ItemNo { get; set; } + + /// + /// 品名/機種 + /// + [DataMember] + [Display(Name = "品名/機種")] + public string ModelNo { get; set; } + + /// + /// 箱號/條碼 + /// + [DataMember] + [Display(Name = "箱號/條碼")] + public string SerialNo { get; set; } + + /// + /// 抽驗狀態 P-PASS(允收);R-REJECT(批退); A-初始狀態 + /// + [DataMember] + [Display(Name = "抽驗狀態")] + + public string StatusName { get; set; } = "A"; + + /// + /// 產品類別 STANDARD(標準品),Order(訂單) + /// + [DataMember] + [Display(Name = "產品類別")] + + public string ProTypeName { get; set; } + + /// + /// 建立UserID + /// + [Column("CREATE_USERID")] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// + /// 建立日期 + /// + [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/NgInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs index 8f924254..88381382 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/NgInfo.cs @@ -122,12 +122,12 @@ namespace AMESCoreStudio.WebApi.Models.AMES public int BarcodeID { get; set; } /// - /// 流程站別ID + /// 作業站ID /// - [Column("RULE_STATION_ID")] - [Display(Name = "流程站別ID")] + [Column("STATION_ID")] + [Display(Name = "作業站ID")] [DataMember] - public int RuleStationId { get; set; } + public int StationId { get; set; } /// /// 工單ID diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 4c37ef17..d6fa5a47 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -90,7 +90,7 @@ namespace AMESCoreStudio.WebApi modelBuilder.Entity().HasOne(r => r.Barcode).WithMany().HasForeignKey(r => r.BarcodeID).IsRequired(); modelBuilder.Entity().HasOne(r => r.Wip).WithMany().HasForeignKey(r => r.WipId).IsRequired(); - modelBuilder.Entity().HasOne(r => r.Station).WithMany().HasForeignKey(r => r.RuleStationId).IsRequired(); + //modelBuilder.Entity().HasOne(r => r.Station).WithMany().HasForeignKey(r => r.RuleStationId).IsRequired(); //modelBuilder.Entity().HasOne(r => r.User).WithMany().HasForeignKey(r => r.OperatorID).IsRequired(); }