Просмотр исходного кода

Merge branch 'dev' of http://123.60.180.165:4647/ZZYDOP/DOPCore into dev

Murphy 2 лет назад
Родитель
Сommit
7a71294b22

+ 6 - 0
MicroServices/Business/Business.Application.Contracts/ReplenishmentManagement/IReplenishmentAppService.cs

@@ -95,5 +95,11 @@ namespace Business.ReplenishmentManagement
         /// <param name="companyId">工厂id</param>
         /// <returns></returns>
         Task<string> ChangePriority(string weekplanid, string tenant_id, string factory_id, string company_id, string itemNumber, string qty, string instockdate, string priority);
+
+        /// <summary>
+        /// 生成交货单
+        /// </summary>
+        /// <returns></returns>
+        Task<string> CreateDeliverySchedule(string domain);
     }
 }

+ 18 - 0
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -6164,5 +6164,23 @@ namespace Business.Replenishment
                 }
             }
         }
+
+        /// <summary>
+        /// 生成交货单
+        /// </summary>
+        /// <param name="domain"></param>
+        /// <returns></returns>
+        public async Task<string> CreateDeliverySchedule(string domain)
+        {
+            string Msg = "OK|交货单生成成功";
+            //获取已发布的交货计划数据
+            //获取货源清单数据
+
+            
+
+
+
+            return Msg;
+        }
     }
 }

+ 17 - 4
MicroServices/Business/Business.Application/ResourceExamineManagement/ProductionScheduleAppService.cs

@@ -276,6 +276,15 @@ namespace Business.ResourceExamineManagement
             //正常工单
             var zcWorkOrds = workOrds.Where(p => string.IsNullOrEmpty(p.Typed)).ToList();
 
+            //先删除计划开工时间在当前日期之前且状态不为"w"的工单日计划
+            List<WorkOrdMaster> delWorks = workOrds.Where(p => p.OrdDate < scheTime && p.Status.ToUpper() != "W").ToList();
+            if (delWorks.Any())
+            {
+                _periodSequenceDet.Delete(p => delWorks.Select(m=>m.WorkOrd).Contains(p.WorkOrds));
+                _scheduleResultOpMaster.Delete(p => delWorks.Select(m => m.WorkOrd).Contains(p.WorkOrd));
+                _workOrdSetupTimeRecord.Delete(p=> delWorks.Select(m => m.WorkOrd).Contains(p.WorkOrd));
+            }
+
             //2、获取数据
             //获取工单工艺路径数据
             List<WorkOrdRouting> workOrdRoutings = _workOrdRouting.Select(p => workOrds.Select(m => m.WorkOrd).Contains(p.WorkOrd) && p.ParentOp == 0 && p.Domain == domain && p.Status != "C" && p.IsActive);
@@ -378,7 +387,7 @@ namespace Business.ResourceExamineManagement
                 //计算开始排产时间或者上次报工时间到当前时间点的预估产能
                 decimal sumTimes = 0m;
                 //工单没有报工记录
-                if (curOp.Last == null)
+                if (curOp.Last == null && item.Status.ToUpper() == "W")
                 {
                     if (curRecord == null)
                     {
@@ -835,7 +844,7 @@ namespace Business.ResourceExamineManagement
                         //计算开始排产时间或者上次报工时间到当前时间点的预估产能
                         decimal sumWorkTimes = 0m;
                         //工单没有报工记录
-                        if (curOp.Last == null)
+                        if (curOp.Last == null && item.Status.ToUpper() == "W")
                         {
                             if (curRecord == null)
                             {
@@ -4215,7 +4224,7 @@ namespace Business.ResourceExamineManagement
 
             //计算上次报工到当前时间点的预估生产数量,如果没有报工记录,则计算产线准备时间完成到当前时间点的预估生产数量
             decimal planQty = 0m;
-            if (routing.Last == null && restTime < 0)
+            if (routing.Last == null && restTime < 0 && workOrd.Status.ToUpper() == "W")
             {
                 //工序没有报工,使用产线准备完成之后到当前时间点剩余时长计算预估生产数量
                 planQty = Math.Floor(Math.Abs(restTime) * rate);
@@ -4540,6 +4549,10 @@ namespace Business.ResourceExamineManagement
             {
                 var curLine = lines.FirstOrDefault(p => p.Line == curRecord.Line);
                 if (curLine != null) {
+                    //产线工作日历:当前产线的工作日历 + 默认工作日历
+                    var curCalendars = calendars.Where(p => p.ProdLine == curLine.Line || string.IsNullOrEmpty(p.ProdLine)).ToList();
+                    var curQtyDtls = qualityLines.Where(p => p.ProdLine == curLine.Line).ToList();
+                    scheTime = CalcActStartTime(curLine.Line, scheTime, curCalendars, curQtyDtls);
                     startDto.RecID = curLine.RecID;
                     startDto.Line = curLine.Line;
                     startDto.StartTime = scheTime;
@@ -4636,7 +4649,7 @@ namespace Business.ResourceExamineManagement
 
             //计算上次报工到当前时间点的预估生产数量,如果没有报工记录,则计算产线准备时间完成到当前时间点的预估生产数量
             decimal planQty = 0m;
-            if (routing.Last == null && restTime < 0)
+            if (routing.Last == null && restTime < 0 && workOrd.Status.ToUpper() == "W")
             {
                 //工序没有报工,使用产线准备完成之后到当前时间点剩余时长计算预估生产数量
                 planQty = Math.Floor(Math.Abs(restTime) * rate);

+ 161 - 0
MicroServices/Business/Business.Domain/StructuredDB/MES/IC/srm_polist_ds.cs

@@ -0,0 +1,161 @@
+using Business.Core.Attributes;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Business.Domain
+{
+    /// <summary>
+    /// 交货单表
+    /// </summary>
+    [Comment("交货单表")]
+    public class srm_polist_ds
+    {
+        /// <summary>
+        /// 主键
+        /// </summary>
+        [Comment("主键")]
+        [Key]
+        public long Id { get; set; }
+
+        /// <summary>
+        /// 工厂编码
+        /// </summary>
+        [Comment("工厂编码")]
+        public string domain { get; set; }
+
+        /// <summary>
+        /// 交货计划id
+        /// </summary>
+        [Comment("交货计划id")]
+        public long icdsid { get; set; }
+
+        /// <summary>
+        /// 交货单号
+        /// </summary>
+        [Comment("交货单号")]
+        public string dsnum { get; set; }
+
+        /// <summary>
+        /// 状态:N-初始,P-已发布,C-关闭
+        /// </summary>
+        [Comment("状态")]
+        public string status { get; set; }
+
+        /// <summary>
+        /// 物料编码
+        /// </summary>
+        [Comment("物料编码")]
+        public string itemnum { get; set; }
+
+        /// <summary>
+        /// 单位
+        /// </summary>
+        [Comment("单位")]
+        public string um { get; set; }
+
+        /// <summary>
+        /// 采购组
+        /// </summary>
+        [Comment("采购组")]
+        public string purgroup { get; set; }
+
+        /// <summary>
+        /// 供应商编码
+        /// </summary>
+        [Comment("供应商编码")]
+        public string suppliercode { get; set; }
+
+        /// <summary>
+        /// 供应商
+        /// </summary>
+        [Comment("供应商")]
+        public string supplier { get; set; }
+
+        /// <summary>
+        /// 发布日期
+        /// </summary>
+        [Comment("发布日期")]
+        public DateTime? submitdate { get; set; }
+
+        /// <summary>
+        /// 交货日期
+        /// </summary>
+        [Comment("交货日期")]
+        public DateTime? requestdate { get; set; }
+
+        /// <summary>
+        /// 需求日期
+        /// </summary>
+        [Comment("需求日期")]
+        public DateTime? needdate { get; set; }
+
+        /// <summary>
+        /// 采购单号
+        /// </summary>
+        [Comment("采购单号")]
+        public string ponumber { get; set; }
+
+        /// <summary>
+        /// 采购单行号
+        /// </summary>
+        [Comment("采购单行号")]
+        public int poline { get; set; }
+
+
+        /// <summary>
+        /// 需求数量
+        /// </summary>
+        [Comment("需求数量")]
+        public decimal schedqty { get; set; }
+
+        /// <summary>
+        /// 最近交货日期
+        /// </summary>
+        [Comment("最近交货日期")]
+        public DateTime? lastsentdate { get; set; }
+
+        /// <summary>
+        /// 最近交货数量
+        /// </summary>
+        [Comment("最近交货数量")]
+        public decimal lastsentqty { get; set; }
+
+        /// <summary>
+        /// 已交货数量
+        /// </summary>
+        [Comment("已交货数量")]
+        public decimal sentqty { get; set; }
+
+        /// <summary>
+        /// 剩余采购数量
+        /// </summary>
+        [Comment("剩余采购数量")]
+        public decimal restqty { get; set; }
+
+        /// <summary>
+        /// 创建人
+        /// </summary>
+        [Comment("创建人")]
+        public string createuser { get; set; }
+
+        /// <summary>
+        /// 修改人
+        /// </summary>
+        [Comment("修改人")]
+        public string updateuser { get; set; }
+
+        /// <summary>
+        /// 创建时间
+        /// </summary>
+        [Comment("创建时间")]
+        public DateTime? createtime { get; set; }
+
+        /// <summary>
+        /// 修改时间
+        /// </summary>
+        [Comment("修改时间")]
+        public DateTime? updatetime { get; set; }
+    }
+}

+ 5 - 0
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/DOP/BusinessDbContext.cs

@@ -33,6 +33,11 @@ namespace Business.EntityFrameworkCore
 
         public DbSet<GetNbr> GetNbr { get; set; }
 
+        /// <summary>
+        /// ½»»õµ¥
+        /// </summary>
+        public DbSet<srm_polist_ds> srm_polist_ds { get; set; }
+
         #endregion
         #region MES
         public DbSet<mes_producedailyplan> mes_Producedailyplans { get; set; }

+ 12 - 0
MicroServices/Business/Business.HttpApi/Controllers/ReplenishmentController.cs

@@ -165,5 +165,17 @@ namespace Business.Controllers
         {
             return _ReplenishmentAppService.DeleteWeekPlan( weekplanid,productorder,factory_id);
         }
+
+        /// <summary>
+        /// 生成交货计划
+        /// </summary>
+        /// <param name="domain"></param>
+        /// <returns></returns>
+        [HttpGet]
+        [Route("CreateDeliverySchedule")]
+        public Task<string> CreateDeliverySchedule(string domain)
+        {
+            return _ReplenishmentAppService.CreateDeliverySchedule(domain);
+        }
     }
 }