diff --git a/Controllers/AsrsStatusController.cs b/Controllers/AsrsStatusController.cs index b9f4685..2b01b64 100644 --- a/Controllers/AsrsStatusController.cs +++ b/Controllers/AsrsStatusController.cs @@ -35,6 +35,7 @@ namespace WMS_GIRAF_Interface.Controllers [FromQuery] string sku) { + return true; } } } diff --git a/Controllers/InputRequestController.cs b/Controllers/InputRequestController.cs index 7f0d246..56a479c 100644 --- a/Controllers/InputRequestController.cs +++ b/Controllers/InputRequestController.cs @@ -18,10 +18,11 @@ public class InputRequestController : ControllerBase { //TODO:获取入库任务,并生成到巷道的任务 + } /// - /// 删除入库请求 + /// 入库轮胎申请 /// /Input/ItemDropped /// /// 取消入库请求报文 diff --git a/Data/MichelinDbContext.cs b/Data/MichelinDbContext.cs index 1c05c7f..d84db75 100644 --- a/Data/MichelinDbContext.cs +++ b/Data/MichelinDbContext.cs @@ -13,6 +13,8 @@ public class MichelinDbContext : DbContext public DbSet DestinationId { get; set; } + public DbSet Manage_Main { get; set; } + protected override void OnModelCreating(ModelBuilder modelBuilder) { diff --git a/Entities/MANAGE_MAIN.cs b/Entities/MANAGE_MAIN.cs new file mode 100644 index 0000000..3d46fad --- /dev/null +++ b/Entities/MANAGE_MAIN.cs @@ -0,0 +1,117 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace WMS_GIRAF_Interface.Entities; + +[Table("MANAGE_MAIN")] +public class MANAGE_MAIN +{ + /// + /// 任务编号 + /// + [Column("MANAGE_ID")] + public int MANAGE_ID { get; set; } + /// + /// 终点 + /// + [Column("destinationId")] + public string DESTINATIONID { get; set; } + /// + /// 计划编号 + /// + [Column("PLAN_ID")] + public int PLAN_ID { get; set; } + /// + /// 需求号 + /// + [Column("requestNumber")] + public string requestNumber { get; set; } + /// + /// 任务类型编号 + /// + [Column("MANAGE_TYPE_CODE")] + public string MANAGE_TYPE_CODE { get; set; } + /// + /// 任务状态 + /// + [Column("MANAGE_STATUS")] + public string MANAGE_STATUS { get; set; } + /// + /// 托盘条码 + /// + [Column("STOCK_BARCODE")] + public string STOCK_BARCODE { get; set; } + + /// + /// 物料尺寸 + /// + [Column("CELL_MODEL")] + public string CELL_MODEL { get; set; } + /// + /// 开始位置 + /// + [Column("START_CELL_ID")] + public int START_CELL_ID { get; set; } + /// + /// 终止位置 + /// + [Column("END_CELL_ID")] + public int END_CELL_ID { get; set; } + /// + /// 操作者 + /// + [Column("MANAGE_OPERATOR")] + public string MANAGE_OPERATOR { get; set; } + /// + /// 开始时间 + /// + [Column("MANAGE_BEGIN_TIME")] + public string MANAGE_BEGIN_TIME { get; set; } + /// + /// 结束时间 + /// + [Column("MANAGE_END_TIME")] + public string MANAGE_END_TIME { get; set; } + /// + /// 任务等级 + /// + [Column("MANAGE_LEVEL")] + public string MANAGE_LEVEL { get; set; } + /// + /// 备注 + /// + [Column("MANAGE_REMARK")] + public string MANAGE_REMARK { get; set; } + /// + /// 机械有问题请求保持 + /// + [Column("keepRequestInMemoryEventIfMechanicalIssue")] + public bool keepRequestInMemoryEventIfMechanicalIssue { get; set; } + /// + /// 缺少产品持续叫料 + /// + [Column("keepRequestInMemoryEventIfLackOfProductIssue")] + public bool keepRequestInMemoryEventIfLackOfProductIssue { get; set; } + /// + /// 目标出库时间 + /// + [Column("TargetOutputDateInUtc")] + public DateTime? TargetOutputDateInUtc { get; set; } + /// + /// 批次号 + /// + [Column("LOTNUMBER")] + public string LOTNUMBER { get; set; } + ///// + /// 产品类型 + /// + [Column("POPULATIONNUMBER")] + public string POPULATIONNUMBER { get; set; } + + /// + /// 调用接口 + /// + [Column("INTERFACE")] + public string INTERFACE { get; set; } + +} \ No newline at end of file diff --git a/Entities/ProductInformation.cs b/Entities/ProductInformation.cs new file mode 100644 index 0000000..3b83e57 --- /dev/null +++ b/Entities/ProductInformation.cs @@ -0,0 +1,59 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace WMS_GIRAF_Interface.Entities; + +[Table("ProductInformation")] +public class ProductInformation +{ + [Column("BarCode")] + public string BarCode { get; set; } + + /// + /// 物料分类编号 + /// + [Column("LotNumber")] + public string LotNumber { get; set; } + /// + /// 物料分类父编号 + /// + [Column("PopulationNumber")] + public string PopulationNumber { get; set; } + + /// + /// 物料类型编号 + /// + [Column("SupportType")] + public List SupportType { get; set; } + + [Column("FabricationDateTimeInUtc")] + public DateTime FabricationDateTimeInUtc { get; set; } + + /// + /// 编码 + /// + [Column("DryDateTimeInUtc")] + public DateTime DryDateTimeInUtc { get; set; } + /// + /// 名称 + /// + [Column("OldDateTimeInUtc")] + public DateTime OldDateTimeInUtc { get; set; } + /// + /// 备注 + /// + [Column("HdvDateTimeInUtc")] + public DateTime HdvDateTimeInUtc { get; set; } + /// + /// 排序 + /// + [Column("IsPriority")] + public bool IsPriority { get; set; } + /// + /// 标记 + /// + [Column("IsBlocked")] + public bool IsBlocked { get; set; } + + +} \ No newline at end of file diff --git a/Repositories/Implement/ManageMainRepository.cs b/Repositories/Implement/ManageMainRepository.cs new file mode 100644 index 0000000..cbe6326 --- /dev/null +++ b/Repositories/Implement/ManageMainRepository.cs @@ -0,0 +1,102 @@ +using Microsoft.EntityFrameworkCore; +using WMS_GIRAF_Interface.Data; +using WMS_GIRAF_Interface.Entities; +using WMS_GIRAF_Interface.Repositories.Interface; + +namespace WMS_GIRAF_Interface.Repositories.Implement; + +public class ManageMainRepository: IManageMainRepository +{ + + private readonly MichelinDbContext _context; + private readonly ILogger _logger; + /// + /// 构造函数 + /// + /// + public ManageMainRepository(MichelinDbContext context, ILogger logger) + { + _context = context; + _logger = logger; + } + /// + /// 获取管理任务信息 + /// + /// 查询类型 + /// 筛选信息 + /// + public MANAGE_MAIN? GetManageMain(string type, string filterInfo) + { + MANAGE_MAIN? manageMain = type switch + { + "barcode" => _context.Manage_Main.FirstOrDefault(x => x.STOCK_BARCODE == filterInfo), + "requestNumber" => _context.Manage_Main.FirstOrDefault(x => x.requestNumber == filterInfo), + _ => _context.Manage_Main.FirstOrDefault(x => x.STOCK_BARCODE == filterInfo) + }; + + return manageMain; + } + + /// + /// 添加manageMain + /// + /// + /// + /// + public bool AddManageMain(MANAGE_MAIN manageMain, out int manageId) + { + try + { + manageId = 0; + if (manageMain == null) + { + + return false; + } + _context.Manage_Main.Add(manageMain); + _context.SaveChanges(); + _logger.LogInformation($"Catch Manage main info({manageMain.STOCK_BARCODE});"); + var managemain = _context.Manage_Main.Where(x => x.STOCK_BARCODE == manageMain.STOCK_BARCODE).AsNoTracking().FirstOrDefault(); + if (managemain != null) + { + manageId = managemain.MANAGE_ID; + } + return true; + } + catch (Exception e) + { + if (manageMain != null) _logger.LogError($"插入main数据出现问题:桶信息:{manageMain.STOCK_BARCODE};错误信息:{e.Message}"); + throw; + } + } + + public bool UpdateManageMain(MANAGE_MAIN manageMain) + { + if (manageMain == null || manageMain.MANAGE_ID == 0) + { + throw new ArgumentNullException(nameof(UpdateManageMain)); + } + _context.Manage_Main.Update(manageMain); + _logger.LogInformation($"Update Manage main info({manageMain.STOCK_BARCODE});"); + _context.SaveChanges(); + return true; + + } + + /// + /// 删除主任务 + /// + /// + /// + public void DeleteManageMain(MANAGE_MAIN manageMain) + { + if (manageMain == null) + { + throw new ArgumentNullException(nameof(manageMain)); + } + _context.Manage_Main.Remove(manageMain); + _logger.LogInformation($"Deleted Manage main info({manageMain.STOCK_BARCODE});"); + _context.SaveChanges(); + + } +} \ No newline at end of file diff --git a/Repositories/Interface/IManageMainRepository.cs b/Repositories/Interface/IManageMainRepository.cs new file mode 100644 index 0000000..8ad858b --- /dev/null +++ b/Repositories/Interface/IManageMainRepository.cs @@ -0,0 +1,8 @@ +using WMS_GIRAF_Interface.Entities; + +namespace WMS_GIRAF_Interface.Repositories.Interface; + +public interface IManageMainRepository +{ + public MANAGE_MAIN? GetManageMain(string type,string filterInfo); +} \ No newline at end of file diff --git a/TaskServices/ManageTaskService.cs b/TaskServices/ManageTaskService.cs new file mode 100644 index 0000000..30819db --- /dev/null +++ b/TaskServices/ManageTaskService.cs @@ -0,0 +1,33 @@ +using WMS_GIRAF_Interface.Data; +using WMS_GIRAF_Interface.Models; +using WMS_GIRAF_Interface.Repositories.Interface; + +namespace WMS_GIRAF_Interface.TaskServices; + +public class ManageTaskService(MichelinDbContext context,IManageMainRepository mangeMainRepository) +{ + private readonly MichelinDbContext _context = context; + private readonly IManageMainRepository _mangeMainRepository = mangeMainRepository; + + /// + /// 生成入库到line任务逻辑 + /// + /// + public bool CreateInputTaskFromGiraf( InputRequest.Product inputRequest,bool trans,bool IssendControl ,out string sResult) + { + bool bResult = true; + sResult = string.Empty; + //判断当前胎号是否有任务 + var manageMain = _mangeMainRepository.GetManageMain("barcode", inputRequest.identifier); + if (manageMain!=null) + { + + } + else + { + + } + + return bResult; + } +} \ No newline at end of file diff --git a/WMS_GIRAF_Interface.csproj b/WMS_GIRAF_Interface.csproj index b38c4c1..4089e89 100644 --- a/WMS_GIRAF_Interface.csproj +++ b/WMS_GIRAF_Interface.csproj @@ -16,8 +16,4 @@ - - - -