diff --git a/AMESCoreStudio.Web/Controllers/PCSController.cs b/AMESCoreStudio.Web/Controllers/PCSController.cs index 0415a7c3..2259cf92 100644 --- a/AMESCoreStudio.Web/Controllers/PCSController.cs +++ b/AMESCoreStudio.Web/Controllers/PCSController.cs @@ -759,7 +759,8 @@ namespace AMESCoreStudio.Web.Controllers .Select(s => new SelectListItem { Text = EnumPCS.GetDisplayName(s).ToString(), - Value = s.ToString() + Value = EnumPCS.GetDisplayName(s).ToString() + //Value = s.ToString() }).ToList(); ViewBag.GetWipBITemperatuerSelect = q; @@ -780,7 +781,8 @@ namespace AMESCoreStudio.Web.Controllers .Select(s => new SelectListItem { Text = EnumPCS.GetDisplayName(s).ToString(), - Value = s.ToString() + Value = EnumPCS.GetDisplayName(s).ToString() + //Value = s.ToString() }).ToList(); ViewBag.GetWipBI_OSSelect = q; diff --git a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml index f66c16df..f9035aae 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml @@ -701,11 +701,11 @@
- +
- +
diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterBlobController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterBlobController.cs new file mode 100644 index 00000000..0dc53a6e --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterBlobController.cs @@ -0,0 +1,124 @@ +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 FqcResultMasterBlobController : ControllerBase + { + private readonly AMESContext _context; + + public FqcResultMasterBlobController(AMESContext context) + { + _context = context; + } + + // GET: api/FqcResultMasterBlob + [HttpGet] + public async Task>> GetFqcResultMasterBlobs() + { + return await _context.FqcResultMasterBlobs.ToListAsync(); + } + + // GET: api/FqcResultMasterBlob/5 + [HttpGet("{id}")] + public async Task> GetFqcResultMasterBlob(int id) + { + var fqcResultMasterBlob = await _context.FqcResultMasterBlobs.FindAsync(id); + + if (fqcResultMasterBlob == null) + { + return NotFound(); + } + + return fqcResultMasterBlob; + } + + /// + /// 更新 檢驗結果上傳圖檔資料表 + /// + /// + /// + [HttpPut] + public async Task> PutFqcResultMasterBlob(FqcResultMasterBlob fqcResultMasterBlob) + { + ResultModel result = new ResultModel(); + _context.Entry(fqcResultMasterBlob).State = EntityState.Modified; + fqcResultMasterBlob.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> PostFqcResultMasterBlob(FqcResultMasterBlob fqcResultMasterBlob) + { + ResultModel result = new ResultModel(); + fqcResultMasterBlob.CreateDate = DateTime.Now; + fqcResultMasterBlob.UpdateDate = DateTime.Now; + + _context.FqcResultMasterBlobs.Add(fqcResultMasterBlob); + 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/FqcResultMasterBlob/5 + [HttpDelete("{id}")] + public async Task> DeleteFqcResultMasterBlob(int id) + { + var fqcResultMasterBlob = await _context.FqcResultMasterBlobs.FindAsync(id); + if (fqcResultMasterBlob == null) + { + return NotFound(); + } + + _context.FqcResultMasterBlobs.Remove(fqcResultMasterBlob); + await _context.SaveChangesAsync(); + + return fqcResultMasterBlob; + } + + private bool FqcResultMasterBlobExists(int id) + { + return _context.FqcResultMasterBlobs.Any(e => e.FqcID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/MaterialFqcItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialFqcItemController.cs new file mode 100644 index 00000000..5714249b --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/MaterialFqcItemController.cs @@ -0,0 +1,123 @@ +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 MaterialFqcItemController : ControllerBase + { + private readonly AMESContext _context; + + public MaterialFqcItemController(AMESContext context) + { + _context = context; + } + + // GET: api/MaterialFqcItem + [HttpGet] + public async Task>> GetMaterialFqcItems() + { + return await _context.MaterialFqcItems.ToListAsync(); + } + + // GET: api/MaterialFqcItem/5 + [HttpGet("{id}")] + public async Task> GetMaterialFqcItem(int id) + { + var materialFqcItem = await _context.MaterialFqcItems.FindAsync(id); + + if (materialFqcItem == null) + { + return NotFound(); + } + + return materialFqcItem; + } + + /// + /// 更新料號對應工項資料檔 + /// + /// + /// + [HttpPut] + public async Task> PutMaterialFqcItem(MaterialFqcItem materialFqcItem) + { + ResultModel result = new ResultModel(); + _context.Entry(materialFqcItem).State = EntityState.Modified; + materialFqcItem.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> PostMaterialFqcItem(MaterialFqcItem materialFqcItem) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + materialFqcItem.MaterialFqcitemID = helper.GetIDKey("MATERIAL_FQCITEM_ID").Result; + _context.MaterialFqcItems.Add(materialFqcItem); + 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/MaterialFqcItem/5 + [HttpDelete("{id}")] + public async Task> DeleteMaterialFqcItem(int id) + { + var materialFqcItem = await _context.MaterialFqcItems.FindAsync(id); + if (materialFqcItem == null) + { + return NotFound(); + } + + _context.MaterialFqcItems.Remove(materialFqcItem); + await _context.SaveChangesAsync(); + + return materialFqcItem; + } + + private bool MaterialFqcItemExists(int id) + { + return _context.MaterialFqcItems.Any(e => e.MaterialFqcitemID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipFqcItemController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipFqcItemController.cs new file mode 100644 index 00000000..7631b067 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipFqcItemController.cs @@ -0,0 +1,126 @@ +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 WipFqcItemController : ControllerBase + { + private readonly AMESContext _context; + + public WipFqcItemController(AMESContext context) + { + _context = context; + } + + // GET: api/WipFqcItem + [HttpGet] + public async Task>> GetWipFqcItems() + { + return await _context.WipFqcItems.ToListAsync(); + } + + // GET: api/WipFqcItem/5 + [HttpGet("{id}")] + public async Task> GetWipFqcItem(int id) + { + var wipFqcItem = await _context.WipFqcItems.FindAsync(id); + + if (wipFqcItem == null) + { + return NotFound(); + } + + return wipFqcItem; + } + + /// + /// 更新工單對應工項資料檔 + /// + /// + /// + [HttpPut] + public async Task> PutWipFqcItem(WipFqcItem wipFqcItem) + { + ResultModel result = new ResultModel(); + _context.Entry(wipFqcItem).State = EntityState.Modified; + wipFqcItem.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> PostWipFqcItem(WipFqcItem wipFqcItem) + { + ResultModel result = new ResultModel(); + Helper helper = new Helper(_context); + wipFqcItem.WipFqcitemID = helper.GetIDKey("WIP_FQCITEM_ID").Result; + wipFqcItem.CreateDate = DateTime.Now; + wipFqcItem.UpdateDate = DateTime.Now; + _context.WipFqcItems.Add(wipFqcItem); + + 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/WipFqcItem/5 + [HttpDelete("{id}")] + public async Task> DeleteWipFqcItem(int id) + { + var wipFqcItem = await _context.WipFqcItems.FindAsync(id); + if (wipFqcItem == null) + { + return NotFound(); + } + + _context.WipFqcItems.Remove(wipFqcItem); + await _context.SaveChangesAsync(); + + return wipFqcItem; + } + + private bool WipFqcItemExists(int id) + { + return _context.WipFqcItems.Any(e => e.WipFqcitemID == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Models/AMES/FqcResultMasterBlob.cs b/AMESCoreStudio.WebApi/Models/AMES/FqcResultMasterBlob.cs new file mode 100644 index 00000000..6fc8765e --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/FqcResultMasterBlob.cs @@ -0,0 +1,82 @@ +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("FQC_RESULT_MASTER_BLOB", Schema = "JHAMES")] + public partial class FqcResultMasterBlob + { + /// + /// 檢驗結果ID + /// + [Key] + [Column("FQC_ID")] + [DataMember] + public int FqcID { get; set; } + + /// + /// 圖檔名稱 + /// + [Required] + [Column("IMAGE_NAME")] + [StringLength(50)] + [DataMember] + public string ImageName { get; set; } + + /// + /// IMAGE_BLOB + /// + [Column("IMAGE_BLOB", TypeName = "BLOB")] + [DataMember] + public byte[] ImageBlob { get; set; } + + /// + /// FILEPATH + /// + [Required] + [Column("FILEPATH")] + [StringLength(100)] + [DataMember] + public string Filepath { get; set; } + + /// + /// 建立UserID + /// + [Column("CREATE_USERID")] + [Required] + [DataMember] + public int CreateUserID { get; set; } = 0; + + /// + /// 建立日期 + /// + [Required] + [Column("CREATE_DATE")] + [DataMember] + [Key] + 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/MaterialFqcItem.cs b/AMESCoreStudio.WebApi/Models/AMES/MaterialFqcItem.cs new file mode 100644 index 00000000..593fdd28 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/MaterialFqcItem.cs @@ -0,0 +1,77 @@ +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("MATERIAL_FQC_ITEM")] + public partial class MaterialFqcItem + { + /// + /// 料號工項ID + /// + [DataMember] + [Key] + [Column("MATERIAL_FQCITEM_ID")] + public int MaterialFqcitemID { get; set; } + + /// + /// 料號ID + /// + [DataMember] + [Column("ITEM_ID")] + public int ItemID { get; set; } + + /// + /// 檢驗類別ID + /// + [DataMember] + [Column("QC_GROUP_ID")] + public int QcGroupID { get; set; } + + /// + /// 檢驗項目ID + /// + [DataMember] + [Column("QC_ITEM_ID")] + public int QcItemID { 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/WipFqcItem.cs b/AMESCoreStudio.WebApi/Models/AMES/WipFqcItem.cs new file mode 100644 index 00000000..a29cb433 --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/WipFqcItem.cs @@ -0,0 +1,88 @@ +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("WIP_FQC_ITEM")] + public partial class WipFqcItem + { + /// + /// 工單工項ID + /// + [Key] + [Column("WIP_FQCITEM_ID")] + [DataMember] + public int WipFqcitemID { get; set; } + + /// + /// 工單號碼 + /// + [DataMember] + [Required] + [Column("WIP_NO")] + [StringLength(30)] + public string WipNo { get; set; } + + /// + /// 料號 + /// + [DataMember] + [Required] + [Column("ITEM_NO")] + [StringLength(20)] + public string ItemNo { get; set; } + + /// + /// 檢驗類別ID + /// + [DataMember] + [Column("QC_GROUP_ID")] + public int QcGroupID { get; set; } + + /// + /// 檢驗項目ID + /// + [DataMember] + [Column("QC_ITEM_ID")] + public int QcItemID { 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/WipSystem.cs b/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs index fc82da9f..93d3a40e 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs @@ -91,7 +91,6 @@ namespace AMESCoreStudio.WebApi.Models.AMES /// 燒機軟體 /// [Column("BI_OS")] - [StringLength(20)] [DataMember] [Display(Name = " 燒機軟體")] public string BI_OS { get; set; } diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 67404a7e..9f2f1bf9 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -87,7 +87,7 @@ namespace AMESCoreStudio.WebApi 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(); modelBuilder.Entity().HasOne(r => r.Station).WithMany().HasForeignKey(r => r.StationId).IsRequired(); @@ -776,6 +776,21 @@ namespace AMESCoreStudio.WebApi /// public virtual DbSet WipReturns { get; set; } + /// + /// 料號對應工項資料檔 + /// + public virtual DbSet MaterialFqcItems { get; set; } + + /// + /// 工單對應工項資料檔 + /// + public virtual DbSet WipFqcItems { get; set; } + + /// + /// 檢驗結果上傳圖檔資料表 + /// + public virtual DbSet FqcResultMasterBlobs { get; set; } + } }