diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index c68dfc94..359c77ce 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -1941,7 +1941,7 @@ namespace AMESCoreStudio.Web.Controllers UnitNo = wipinfo.GetFactoryUnit.UnitCode + "[" + wipinfo.GetFactoryUnit.UnitName + "]", Line = wipinfo.GetLineInfo.LineDesc, ECN = wipinfo.GetWipAtt.ECN, - ECO = wipinfo.GetWipAtt.EAN, + EAN = wipinfo.GetWipAtt.EAN, CustomerItemNo = wipinfo.CustomerItemNO, CreateDate = wipinfo.CreateDate.ToString(), Remarks = wipinfo.Remarks, @@ -1950,7 +1950,7 @@ namespace AMESCoreStudio.Web.Controllers } } - // 條碼紀錄 + // 生產歷程 foreach (var barcodestation in result_barcodestation.OrderBy(o => o.CreateDate)) { result.BarCodeLogs.Add(new BarCodeLog @@ -1963,7 +1963,7 @@ namespace AMESCoreStudio.Web.Controllers }); } - // 條碼組件 + // 組件清單 var barcodeitems = await _pcsApi.GetBarcodeItemByBarCodeID(result_barcodeinfo.BarcodeID); foreach (var barcodeitem in barcodeitems.OrderBy(o => o.CreateDate)) { @@ -1976,6 +1976,18 @@ namespace AMESCoreStudio.Web.Controllers }); } + // 治具清單 + var barcodeoutfits = await _pcsApi.GetBarcodeOutfitByBarcodeNo(model.BarCodeNo); + foreach (var barcodeoutfit in barcodeoutfits.OrderBy(o => o.CreateDate)) + { + result.Outfits.Add(new Outfit + { + Station = barcodeoutfit.GetStation.StationName, + OutfitNo = barcodeoutfit.OutfitNo, + InputDate = barcodeoutfit.CreateDate.ToString() + }); + } + // 組件變更 var barcodeitemchanges = await _pcsApi.GetBarcodeItemChangesByBarCodeID(result_barcodeinfo.BarcodeID); foreach (var barcodeitemchange in barcodeitemchanges.OrderBy(o => o.CreateDate)) diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 2e7f08bc..d7002b13 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -861,7 +861,15 @@ namespace AMESCoreStudio.Web #endregion - + #region BarcodeOutfit 內部序號對應的治具序號明細 + /// + /// 查詢 By BarcodeNo + /// + /// 生產序號 + /// + [WebApiClient.Attributes.HttpGet("api/BarcodeOutfit/ByBarcodeNo/{id}")] + ITask> GetBarcodeOutfitByBarcodeNo(string id); + #endregion } } diff --git a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs index 4397ccf8..c0ce5eeb 100644 --- a/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs +++ b/AMESCoreStudio.Web/ViewModels/PCS/PCS009RViewModel.cs @@ -17,6 +17,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS BarCodeChanges = new List(); BarCodeKPs = new List(); KPChanges = new List(); + Outfits = new List(); } /// @@ -55,20 +56,25 @@ namespace AMESCoreStudio.Web.ViewModels.PCS /// - /// 工單資料 + /// 工單歷程 /// public List WinInfos { get; set; } /// - /// 條碼紀錄 + /// 生產歷程 /// public List BarCodeLogs { get; set; } /// - /// 條碼組件 + /// 組件清單 /// public List BarCodeKPs { get; set; } + /// + /// 治具清單 + /// + public List Outfits { get; set; } + /// /// 條碼變更 /// @@ -111,9 +117,9 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public string ECN { get; set; } /// - /// ECO + /// EAN /// - public string ECO { get; set; } + public string EAN { get; set; } /// /// 建置日期 @@ -137,7 +143,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS } /// - /// 條碼紀錄 + /// 生產歷程 /// public class BarCodeLog { @@ -173,7 +179,7 @@ namespace AMESCoreStudio.Web.ViewModels.PCS } /// - /// 條碼組件 + /// 組件清單 /// public class BarCodeKP { @@ -203,6 +209,32 @@ namespace AMESCoreStudio.Web.ViewModels.PCS public string InputDate { get; set; } } + /// + /// 治具清單 + /// + public class Outfit + { + /// + /// 編號 + /// + public string No { get; set; } + + /// + /// 站别 + /// + public string Station { get; set; } + + /// + /// 治具代碼 + /// + public string OutfitNo { get; set; } + + /// + /// 過站日期 + /// + public string InputDate { get; set; } + } + /// /// 條碼變更 /// diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml index 9c834416..c12fdd2b 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009.cshtml @@ -26,8 +26,8 @@ margin: 10px 0; } - .layui-table th{ - text-align:center; + .layui-table th { + text-align: center; } @@ -40,53 +40,46 @@
-
-
-
- -
- -
+
+
+ +
+
-
-
- -
- -
+
+ +
+
-
-
- -
- -
+
+ +
+
-
-
- -
- -
+
+ +
+
-
+
+
+
+
- + @**@
-
-
diff --git a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml index 501c62b5..dd61aabf 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS009R.cshtml @@ -84,7 +84,7 @@
- 工單資料 + 工單歷程
@@ -104,10 +104,9 @@ @index.ItemNo @@ -129,6 +128,12 @@ + +
- 94/96/97BOM版本: + BOM版本: -
@index.ECN + EAN: + + @index.EAN +
@@ -164,7 +169,7 @@
- 條碼紀錄 + 生產歷程
@@ -182,7 +187,7 @@ 使用者 @@ -212,7 +217,7 @@
- 條碼組件 + 組件清單
- 過站名稱 + 過站時間
@@ -227,7 +232,7 @@ 組件料號 @@ -252,6 +257,42 @@
- 投產日期 + 過站時間
+
+
+ 治具清單 +
+ + + + + + + + + + @foreach (var index in Model.Outfits) + { + + + + + + } + +
+ 站別名稱 + + 設備編號 + + 過站時間 +
+ @index.Station + + @index.OutfitNo + + @index.InputDate +
+
條碼變更 @@ -264,7 +305,7 @@
- 組件收集 + 備料
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeOutfitController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeOutfitController.cs new file mode 100644 index 00000000..8ce85b80 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/BarcodeOutfitController.cs @@ -0,0 +1,134 @@ +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; + +namespace AMESCoreStudio.WebApi.Controllers.AMES +{ + /// + /// 內部序號對應的治具序號明細 + /// + [Route("api/[controller]")] + [ApiController] + public class BarcodeOutfitController : ControllerBase + { + private readonly AMESContext _context; + + public BarcodeOutfitController(AMESContext context) + { + _context = context; + } + + // GET: api/BarcodeOutfit + [HttpGet] + public async Task>> GetBarcodeOutfits() + { + return await _context.BarcodeOutfits.ToListAsync(); + } + + // GET: api/BarcodeOutfit/5 + [HttpGet("{id}")] + public async Task> GetBarcodeOutfit(string id) + { + var barcodeOutfit = await _context.BarcodeOutfits.FindAsync(id); + + if (barcodeOutfit == null) + { + return NotFound(); + } + + return barcodeOutfit; + } + + /// + /// 查詢 By BarcodeNo + /// + /// 條碼料號 + /// + [HttpGet("ByBarcodeNo/{id}")] + public async Task>> GetBarcodeOutfitByBarcodeNo(string id) + { + var barcodeOutfit = await _context.BarcodeOutfits.Where(w => w.BarcodeNo == id).ToListAsync(); + + return barcodeOutfit; + } + + /// + /// 更新內部序號對應的治具序號明細 + /// + /// + /// + [HttpPut] + public async Task> PutBarcodeOutfit(BarcodeOutfit barcodeOutfit) + { + ResultModel result = new ResultModel(); + _context.Entry(barcodeOutfit).State = EntityState.Modified; + barcodeOutfit.UpdateDate = DateTime.Now; + barcodeOutfit.UpdateUserID = 0; + + 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> PostBarcodeOutfit(BarcodeOutfit barcodeOutfit) + { + ResultModel result = new ResultModel(); + _context.BarcodeOutfits.Add(barcodeOutfit); + try + { + await _context.SaveChangesAsync(); + result.Success = true; + result.Msg = "OK"; + } + catch (Exception ex) + { + result.Success = false; + result.Msg = ex.InnerException.Message; + } + return result; + } + + // DELETE: api/BarcodeOutfit/5 + [HttpDelete("{id}")] + public async Task> DeleteBarcodeOutfit(string id) + { + var barcodeOutfit = await _context.BarcodeOutfits.FindAsync(id); + if (barcodeOutfit == null) + { + return NotFound(); + } + + _context.BarcodeOutfits.Remove(barcodeOutfit); + await _context.SaveChangesAsync(); + + return barcodeOutfit; + } + + private bool BarcodeOutfitExists(string id) + { + return _context.BarcodeOutfits.Any(e => e.BarcodeNo == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/BarcodeOutfit.cs b/AMESCoreStudio.WebApi/Models/AMES/BarcodeOutfit.cs new file mode 100644 index 00000000..79027127 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/BarcodeOutfit.cs @@ -0,0 +1,91 @@ +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.Models.AMES +{ + /// + /// 內部序號對應的治具序號明細 + /// + [Table("BARCODE_OUTFIT", Schema = "JHAMES")] + public partial class BarcodeOutfit + { + /// + /// 生產序號 + /// + [Key] + [Column("BARCODE_NO")] + [StringLength(20)] + [DataMember] + public string BarcodeNo { get; set; } + + /// + /// 工單號碼 + /// + [Key] + [Column("WIP_NO")] + [StringLength(30)] + [DataMember] + public string WipNo { get; set; } + + /// + /// 設備編號 + /// + [Key] + [Column("OUTFIT_NO")] + [StringLength(12)] + [DataMember] + public string OutfitNo { get; set; } + + /// + /// 站別 + /// + [Column("STATION_ID")] + [DataMember] + public int StationID { 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; + + + /// + /// 工作站基本資料 + /// + [ForeignKey("StationID")] + [DataMember] + public virtual BAS.Stations GetStation { get; set; } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index fc168b7f..9188ffdb 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -43,6 +43,7 @@ namespace AMESCoreStudio.WebApi modelBuilder.Entity().HasKey(c => new { c.WipID, c.MaterialSopID }); modelBuilder.Entity().HasKey(c => new { c.WipID, c.BarcodeID }); modelBuilder.Entity().HasKey(c => new { c.BarcodeID ,c.WipID, c.RuleStationID ,c.RuleStatus ,c.InputDate }); + modelBuilder.Entity().HasKey(c => new { c.BarcodeNo, c.WipNo, c.OutfitNo}); modelBuilder.Entity().HasKey(c => new { c.WipNO, c.RuleStationID, c.KeyNo }); modelBuilder.Entity().HasKey(c => new { c.WipNO, c.StartNO, c.EndNO }); @@ -705,6 +706,11 @@ namespace AMESCoreStudio.WebApi /// public DbSet CalendarTables { get; set; } + /// + /// 內部序號對應的治具序號明細 + /// + public virtual DbSet BarcodeOutfits { get; set; } + } }