@@ -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
+ |
+
+ }
+
+
+
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; }
+
}
}
|