Browse Source

1. 工單基本資料 燒雞溫度、軟體更改儲存值 PS (DB 工單系統:BI_OS欄位要加大)

2. 加入FQC相關Model controll
PTD
ray 3 years ago
parent
commit
740a0629cd
  1. 6
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 4
      AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml
  3. 124
      AMESCoreStudio.WebApi/Controllers/AMES/FqcResultMasterBlobController.cs
  4. 123
      AMESCoreStudio.WebApi/Controllers/AMES/MaterialFqcItemController.cs
  5. 126
      AMESCoreStudio.WebApi/Controllers/AMES/WipFqcItemController.cs
  6. 82
      AMESCoreStudio.WebApi/Models/AMES/FqcResultMasterBlob.cs
  7. 77
      AMESCoreStudio.WebApi/Models/AMES/MaterialFqcItem.cs
  8. 88
      AMESCoreStudio.WebApi/Models/AMES/WipFqcItem.cs
  9. 1
      AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs
  10. 17
      AMESCoreStudio.WebApi/Models/AMESContext.cs

6
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;

4
AMESCoreStudio.Web/Views/PCS/PCS001R.cshtml

@ -701,11 +701,11 @@
</div>
<label asp-for="wipSystem.BiTemperature" class="layui-form-label"></label>
<div class="layui-input-inline" style="width:150px;">
<select disabled asp-for="wipSystem.BiTemperature" asp-items="@ViewBag.GetWipBITemperatuerSelect" class=""></select>
<input asp-for="wipSystem.BiTemperature" class="layui-input" />
</div>
<label asp-for="wipSystem.BI_OS" class="layui-form-label"></label>
<div class="layui-input-inline" style="width:200px;">
<select disabled asp-for="wipSystem.BI_OS" asp-items="@ViewBag.GetWipBI_OSSelect" class=""></select>
<input asp-for="wipSystem.BI_OS" class="layui-input" />
</div>
</div>
</div>

124
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
{
/// <summary>
/// 檢驗結果上傳圖檔資料表
/// </summary>
[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<ActionResult<IEnumerable<FqcResultMasterBlob>>> GetFqcResultMasterBlobs()
{
return await _context.FqcResultMasterBlobs.ToListAsync();
}
// GET: api/FqcResultMasterBlob/5
[HttpGet("{id}")]
public async Task<ActionResult<FqcResultMasterBlob>> GetFqcResultMasterBlob(int id)
{
var fqcResultMasterBlob = await _context.FqcResultMasterBlobs.FindAsync(id);
if (fqcResultMasterBlob == null)
{
return NotFound();
}
return fqcResultMasterBlob;
}
/// <summary>
/// 更新 檢驗結果上傳圖檔資料表
/// </summary>
/// <param name="fqcResultMasterBlob"></param>
/// <returns></returns>
[HttpPut]
public async Task<ResultModel<FqcResultMasterBlob>> PutFqcResultMasterBlob(FqcResultMasterBlob fqcResultMasterBlob)
{
ResultModel<FqcResultMasterBlob> result = new ResultModel<FqcResultMasterBlob>();
_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;
}
/// <summary>
/// 新增 檢驗結果上傳圖檔資料表
/// </summary>
/// <param name="fqcResultMasterBlob"></param>
/// <returns></returns>
[HttpPost]
public async Task<ResultModel<FqcResultMasterBlob>> PostFqcResultMasterBlob(FqcResultMasterBlob fqcResultMasterBlob)
{
ResultModel<FqcResultMasterBlob> result = new ResultModel<FqcResultMasterBlob>();
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<ActionResult<FqcResultMasterBlob>> 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);
}
}
}

123
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
{
/// <summary>
/// 料號對應工項資料檔
/// </summary>
[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<ActionResult<IEnumerable<MaterialFqcItem>>> GetMaterialFqcItems()
{
return await _context.MaterialFqcItems.ToListAsync();
}
// GET: api/MaterialFqcItem/5
[HttpGet("{id}")]
public async Task<ActionResult<MaterialFqcItem>> GetMaterialFqcItem(int id)
{
var materialFqcItem = await _context.MaterialFqcItems.FindAsync(id);
if (materialFqcItem == null)
{
return NotFound();
}
return materialFqcItem;
}
/// <summary>
/// 更新料號對應工項資料檔
/// </summary>
/// <param name="materialFqcItem"></param>
/// <returns></returns>
[HttpPut]
public async Task<ResultModel<MaterialFqcItem>> PutMaterialFqcItem(MaterialFqcItem materialFqcItem)
{
ResultModel<MaterialFqcItem> result = new ResultModel<MaterialFqcItem>();
_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;
}
/// <summary>
/// 新增料號對應工項資料檔
/// </summary>
/// <param name="materialFqcItem"></param>
/// <returns></returns>
[HttpPost]
public async Task<ResultModel<MaterialFqcItem>> PostMaterialFqcItem(MaterialFqcItem materialFqcItem)
{
ResultModel<MaterialFqcItem> result = new ResultModel<MaterialFqcItem>();
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<ActionResult<MaterialFqcItem>> 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);
}
}
}

126
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
{
/// <summary>
/// 工單對應工項資料檔
/// </summary>
[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<ActionResult<IEnumerable<WipFqcItem>>> GetWipFqcItems()
{
return await _context.WipFqcItems.ToListAsync();
}
// GET: api/WipFqcItem/5
[HttpGet("{id}")]
public async Task<ActionResult<WipFqcItem>> GetWipFqcItem(int id)
{
var wipFqcItem = await _context.WipFqcItems.FindAsync(id);
if (wipFqcItem == null)
{
return NotFound();
}
return wipFqcItem;
}
/// <summary>
/// 更新工單對應工項資料檔
/// </summary>
/// <param name="wipFqcItem"></param>
/// <returns></returns>
[HttpPut]
public async Task<ResultModel<WipFqcItem>> PutWipFqcItem(WipFqcItem wipFqcItem)
{
ResultModel<WipFqcItem> result = new ResultModel<WipFqcItem>();
_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;
}
/// <summary>
/// 新增工單對應工項資料檔
/// </summary>
/// <param name="wipFqcItem"></param>
/// <returns></returns>
[HttpPost]
public async Task<ResultModel<WipFqcItem>> PostWipFqcItem(WipFqcItem wipFqcItem)
{
ResultModel<WipFqcItem> result = new ResultModel<WipFqcItem>();
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<ActionResult<WipFqcItem>> 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);
}
}
}

82
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
{
/// <summary>
/// 檢驗結果上傳圖檔資料表
/// </summary>
[Table("FQC_RESULT_MASTER_BLOB", Schema = "JHAMES")]
public partial class FqcResultMasterBlob
{
/// <summary>
/// 檢驗結果ID
/// </summary>
[Key]
[Column("FQC_ID")]
[DataMember]
public int FqcID { get; set; }
/// <summary>
/// 圖檔名稱
/// </summary>
[Required]
[Column("IMAGE_NAME")]
[StringLength(50)]
[DataMember]
public string ImageName { get; set; }
/// <summary>
/// IMAGE_BLOB
/// </summary>
[Column("IMAGE_BLOB", TypeName = "BLOB")]
[DataMember]
public byte[] ImageBlob { get; set; }
/// <summary>
/// FILEPATH
/// </summary>
[Required]
[Column("FILEPATH")]
[StringLength(100)]
[DataMember]
public string Filepath { get; set; }
/// <summary>
/// 建立UserID
/// </summary>
[Column("CREATE_USERID")]
[Required]
[DataMember]
public int CreateUserID { get; set; } = 0;
/// <summary>
/// 建立日期
/// </summary>
[Required]
[Column("CREATE_DATE")]
[DataMember]
[Key]
public DateTime CreateDate { get; set; } = DateTime.Now;
/// <summary>
/// 更新UserID
/// </summary>
[Column("UPDATE_USERID")]
[DataMember]
public int UpdateUserID { get; set; } = 0;
/// <summary>
/// 更新日期
/// </summary>
[Column("UPDATE_DATE")]
[DataMember]
public DateTime UpdateDate { get; set; } = DateTime.Now;
}
}

77
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
{
/// <summary>
/// 料號對應工項資料檔
/// </summary>
[Table("MATERIAL_FQC_ITEM")]
public partial class MaterialFqcItem
{
/// <summary>
/// 料號工項ID
/// </summary>
[DataMember]
[Key]
[Column("MATERIAL_FQCITEM_ID")]
public int MaterialFqcitemID { get; set; }
/// <summary>
/// 料號ID
/// </summary>
[DataMember]
[Column("ITEM_ID")]
public int ItemID { get; set; }
/// <summary>
/// 檢驗類別ID
/// </summary>
[DataMember]
[Column("QC_GROUP_ID")]
public int QcGroupID { get; set; }
/// <summary>
/// 檢驗項目ID
/// </summary>
[DataMember]
[Column("QC_ITEM_ID")]
public int QcItemID { get; set; }
/// <summary>
/// 建立UserID
/// </summary>
[Column("CREATE_USERID")]
[Required]
[DataMember]
public int CreateUserID { get; set; } = 0;
/// <summary>
/// 建立日期
/// </summary>
[Required]
[Column("CREATE_DATE")]
[DataMember]
public DateTime CreateDate { get; set; } = DateTime.Now;
/// <summary>
/// 更新UserID
/// </summary>
[Column("UPDATE_USERID")]
[DataMember]
public int UpdateUserID { get; set; } = 0;
/// <summary>
/// 更新日期
/// </summary>
[Column("UPDATE_DATE")]
[DataMember]
public DateTime UpdateDate { get; set; } = DateTime.Now;
}
}

88
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
{
/// <summary>
/// 工單對應工項資料檔
/// </summary>
[Table("WIP_FQC_ITEM")]
public partial class WipFqcItem
{
/// <summary>
/// 工單工項ID
/// </summary>
[Key]
[Column("WIP_FQCITEM_ID")]
[DataMember]
public int WipFqcitemID { get; set; }
/// <summary>
/// 工單號碼
/// </summary>
[DataMember]
[Required]
[Column("WIP_NO")]
[StringLength(30)]
public string WipNo { get; set; }
/// <summary>
/// 料號
/// </summary>
[DataMember]
[Required]
[Column("ITEM_NO")]
[StringLength(20)]
public string ItemNo { get; set; }
/// <summary>
/// 檢驗類別ID
/// </summary>
[DataMember]
[Column("QC_GROUP_ID")]
public int QcGroupID { get; set; }
/// <summary>
/// 檢驗項目ID
/// </summary>
[DataMember]
[Column("QC_ITEM_ID")]
public int QcItemID { get; set; }
/// <summary>
/// 建立UserID
/// </summary>
[Column("CREATE_USERID")]
[Required]
[DataMember]
public int CreateUserID { get; set; } = 0;
/// <summary>
/// 建立日期
/// </summary>
[Required]
[Column("CREATE_DATE")]
[DataMember]
public DateTime CreateDate { get; set; } = DateTime.Now;
/// <summary>
/// 更新UserID
/// </summary>
[Column("UPDATE_USERID")]
[DataMember]
public int UpdateUserID { get; set; } = 0;
/// <summary>
/// 更新日期
/// </summary>
[Column("UPDATE_DATE")]
[DataMember]
public DateTime? UpdateDate { get; set; } = DateTime.Now;
}
}

1
AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs

@ -91,7 +91,6 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// 燒機軟體
/// </summary>
[Column("BI_OS")]
[StringLength(20)]
[DataMember]
[Display(Name = " 燒機軟體")]
public string BI_OS { get; set; }

17
AMESCoreStudio.WebApi/Models/AMESContext.cs

@ -87,7 +87,7 @@ namespace AMESCoreStudio.WebApi
modelBuilder.Entity<FqcResultDetail>().HasKey(c => new { c.FqcID, c.BoxNo ,c.BarcodeNo });
modelBuilder.Entity<FqcBarcode>().HasKey(c => new { c.FqcID, c.BarcodeID });
modelBuilder.Entity<FqcItem>().HasKey(c => new { c.FqcID, c.ItemID });
modelBuilder.Entity<FqcResultMasterBlob>().HasKey(e => new { e.FqcID, e.CreateDate });
modelBuilder.Entity<NgInfo>().HasOne(r => r.Barcode).WithMany().HasForeignKey(r => r.BarcodeID).IsRequired();
modelBuilder.Entity<NgInfo>().HasOne(r => r.Wip).WithMany().HasForeignKey(r => r.WipId).IsRequired();
modelBuilder.Entity<NgInfo>().HasOne(r => r.Station).WithMany().HasForeignKey(r => r.StationId).IsRequired();
@ -776,6 +776,21 @@ namespace AMESCoreStudio.WebApi
/// </summary>
public virtual DbSet<WipReturn> WipReturns { get; set; }
/// <summary>
/// 料號對應工項資料檔
/// </summary>
public virtual DbSet<MaterialFqcItem> MaterialFqcItems { get; set; }
/// <summary>
/// 工單對應工項資料檔
/// </summary>
public virtual DbSet<WipFqcItem> WipFqcItems { get; set; }
/// <summary>
/// 檢驗結果上傳圖檔資料表
/// </summary>
public virtual DbSet<FqcResultMasterBlob> FqcResultMasterBlobs { get; set; }
}
}

Loading…
Cancel
Save