From 1aa300a065eafa6bbaba064d434eb4fff317ebf2 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 16 Mar 2022 00:18:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9EPLM=E6=96=99=E8=99=9F?= =?UTF-8?q?=E8=B3=87=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs | 22 ++- .../AMES/PlmMeterialInfoeController.cs | 126 ++++++++++++++++++ .../Controllers/AMES/WipBarcodeController.cs | 14 ++ .../Models/AMES/PlmMeterialInfo.cs | 97 ++++++++++++++ .../Models/AMES/WipSystem.cs | 2 + AMESCoreStudio.WebApi/Models/AMESContext.cs | 24 ++-- 6 files changed, 267 insertions(+), 18 deletions(-) create mode 100644 AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs create mode 100644 AMESCoreStudio.WebApi/Models/AMES/PlmMeterialInfo.cs diff --git a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs index 422b8db5..62ef1e53 100644 --- a/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs +++ b/AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs @@ -824,6 +824,16 @@ namespace AMESCoreStudio.Web #endregion + #region QRS010 + + /// + /// 良率查詢QRS010 + /// + /// + [WebApiClient.Attributes.HttpGet("api/WipClass/GetYieldData4QRS010")] + ITask> GetYieldData4QRS010(string unitNo, string lineID, string stationID, string wipNo, string itemNo, string mfgTypeNo, string dateStart, string dateEnd, int page, int limit); + + #endregion #region WipKp 工單KP資訊資料檔 /// @@ -849,7 +859,6 @@ namespace AMESCoreStudio.Web ITask> PutWipKpByStatus([FromBody, RawJsonContent] string model); #endregion - #region RuleStation 流程站別資料維護 /// /// 查詢工單號碼 對應 RuleStation @@ -871,15 +880,14 @@ namespace AMESCoreStudio.Web ITask> GetBarcodeOutfitByBarcodeNo(string id); #endregion - #region QRS010 - + #region PlmMeterialInfoe PLM轉入料號說明 /// - /// 良率查詢QRS010 + /// 查詢PLM轉入料號說明 /// + /// PLM料號 /// - [WebApiClient.Attributes.HttpGet("api/WipClass/GetYieldData4QRS010")] - ITask> GetYieldData4QRS010(string unitNo, string lineID, string stationID, string wipNo, string itemNo, string mfgTypeNo, string dateStart, string dateEnd, int page, int limit); - + [WebApiClient.Attributes.HttpGet("api/PlmMeterialInfoe/{id}")] + ITask GetPlmMeterialInfo(string id); #endregion } diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.cs new file mode 100644 index 00000000..dc9bf334 --- /dev/null +++ b/AMESCoreStudio.WebApi/Controllers/AMES/PlmMeterialInfoeController.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 +{ + /// + /// PLM轉入料號說明 + /// + [Route("api/[controller]")] + [ApiController] + public class PlmMeterialInfoeController : ControllerBase + { + private readonly AMESContext _context; + + public PlmMeterialInfoeController(AMESContext context) + { + _context = context; + } + + // GET: api/PlmMeterialInfoe + [HttpGet] + public async Task>> GetPlmMeterialInfos() + { + return await _context.PlmMeterialInfos.ToListAsync(); + } + + /// + /// + /// + /// PLM料號 + /// + [HttpGet("{id}")] + public async Task> GetPlmMeterialInfo(string id) + { + var plmMeterialInfo = await _context.PlmMeterialInfos.FindAsync(id); + return plmMeterialInfo; + } + + // PUT: api/PlmMeterialInfoe/5 + // To protect from overposting attacks, enable the specific properties you want to bind to, for + // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. + [HttpPut("{id}")] + public async Task PutPlmMeterialInfo(string id, PlmMeterialInfo plmMeterialInfo) + { + if (id != plmMeterialInfo.MeterialNo) + { + return BadRequest(); + } + + _context.Entry(plmMeterialInfo).State = EntityState.Modified; + + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!PlmMeterialInfoExists(id)) + { + return NotFound(); + } + else + { + throw; + } + } + + return NoContent(); + } + + // POST: api/PlmMeterialInfoe + // To protect from overposting attacks, enable the specific properties you want to bind to, for + // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. + [HttpPost] + public async Task> PostPlmMeterialInfo(PlmMeterialInfo plmMeterialInfo) + { + _context.PlmMeterialInfos.Add(plmMeterialInfo); + try + { + await _context.SaveChangesAsync(); + } + catch (DbUpdateException) + { + if (PlmMeterialInfoExists(plmMeterialInfo.MeterialNo)) + { + return Conflict(); + } + else + { + throw; + } + } + + return CreatedAtAction("GetPlmMeterialInfo", new { id = plmMeterialInfo.MeterialNo }, plmMeterialInfo); + } + + // DELETE: api/PlmMeterialInfoe/5 + [HttpDelete("{id}")] + public async Task> DeletePlmMeterialInfo(string id) + { + var plmMeterialInfo = await _context.PlmMeterialInfos.FindAsync(id); + if (plmMeterialInfo == null) + { + return NotFound(); + } + + _context.PlmMeterialInfos.Remove(plmMeterialInfo); + await _context.SaveChangesAsync(); + + return plmMeterialInfo; + } + + private bool PlmMeterialInfoExists(string id) + { + return _context.PlmMeterialInfos.Any(e => e.MeterialNo == id); + } + } +} diff --git a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs index b3ce0e1f..9dfb4724 100644 --- a/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs +++ b/AMESCoreStudio.WebApi/Controllers/AMES/WipBarcodeController.cs @@ -67,6 +67,20 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES return WipBarcodes; } + /// + /// 查詢工單資料Barcode By 條碼前置碼 + /// + /// 工單號碼 + /// + // GET: api/WipBarcode/4 + [HttpGet("BarcodeNo/{id}")] + public async Task>> GetWipBarcodeBarcodeNo(string id) + { + IQueryable q = _context.WipBarcodes.Where(p => p.StartNO.StartsWith(id)); + var WipBarcodes = await q.ToListAsync(); + return WipBarcodes; + } + /// /// 新增工單資料-條碼Barcode /// diff --git a/AMESCoreStudio.WebApi/Models/AMES/PlmMeterialInfo.cs b/AMESCoreStudio.WebApi/Models/AMES/PlmMeterialInfo.cs new file mode 100644 index 00000000..56d9ff4c --- /dev/null +++ b/AMESCoreStudio.WebApi/Models/AMES/PlmMeterialInfo.cs @@ -0,0 +1,97 @@ +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 +{ + /// + /// PLM轉入料號說明 + /// + [Table("PLM_METERIAL_INFO", Schema = "JHAMES")] + public partial class PlmMeterialInfo + { + /// + /// 物料 + /// + [Key] + [Column("METERIALNO")] + [StringLength(18)] + [Required] + [DataMember] + public string MeterialNo { get; set; } + + /// + /// 物料描述 + /// + [Required] + [DataMember] + [Column("METERIAL_DESC")] + [StringLength(100)] + public string MeterialDesc { get; set; } + + /// + /// 機種系列 + /// + [Required] + [DataMember] + [Column("MODELNAME")] + [StringLength(18)] + public string ModelName { get; set; } + + /// + /// 生產備忘錄 + /// + [Column("PRODUCTION_MEMO")] + [StringLength(500)] + [DataMember] + public string ProductionMemo { get; set; } + + /// + /// 狀態 + /// + [Required] + [DataMember] + [Column("STATUS")] + [StringLength(1)] + public string Status { get; set; } + + /// + /// EAN + /// + [Column("EAN")] + [StringLength(20)] + [DataMember] + public string EAN { get; set; } + + /// + /// 長文 + /// + [DataMember] + [Column("LONG_TEXT")] + [StringLength(500)] + public string LongText { get; set; } + + /// + /// 建立日期 + /// + [Required] + [Column("CREATE_DATE")] + [DataMember] + public DateTime CreateDate { get; set; } = DateTime.Now; + + + /// + /// 更新日期 + /// + [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 bf1a089c..e47a34aa 100644 --- a/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs +++ b/AMESCoreStudio.WebApi/Models/AMES/WipSystem.cs @@ -287,5 +287,7 @@ namespace AMESCoreStudio.WebApi.Models.AMES [Column("UPDATE_DATE", TypeName = "DATE")] [DataMember] public DateTime UpdateDate { get; set; } = System.DateTime.Now; + + } } diff --git a/AMESCoreStudio.WebApi/Models/AMESContext.cs b/AMESCoreStudio.WebApi/Models/AMESContext.cs index 696c9995..84b14b15 100644 --- a/AMESCoreStudio.WebApi/Models/AMESContext.cs +++ b/AMESCoreStudio.WebApi/Models/AMESContext.cs @@ -714,7 +714,7 @@ namespace AMESCoreStudio.WebApi /// /// 治具區域資料檔 /// - //public virtual DbSet OutfitAreaInfoes { get; set; } + public virtual DbSet OutfitAreaInfoes { get; set; } /// /// 設備種類資料檔 @@ -724,21 +724,21 @@ namespace AMESCoreStudio.WebApi /// /// 層別資料檔 /// - // public virtual DbSet OutfitLevelInfoes { get; set; } + public virtual DbSet OutfitLevelInfoes { get; set; } /// /// 位置資料檔 /// - //public virtual DbSet OutfitSiteInfoes { get; set; } + public virtual DbSet OutfitSiteInfoes { get; set; } - /// - /// 設備規格資料檔 - /// + ///// + ///// 設備規格資料檔 + ///// public virtual DbSet OutfitVarityInfoes { get; set; } - /// - /// 廠商資料檔 - /// + ///// + ///// 廠商資料檔 + ///// public virtual DbSet OutfitVendorInfoes { get; set; } /// @@ -746,8 +746,10 @@ namespace AMESCoreStudio.WebApi /// public virtual DbSet OutfitInfoes { get; set; } - - + /// + /// PLM轉入料號說明 + /// + public virtual DbSet PlmMeterialInfos { get; set; } } }