Quellcode durchsuchen

Merge branch 'master' of http://123.60.180.165:4647/ZZYDOP/DOPCore

zhengly vor 3 Jahren
Ursprung
Commit
b91f9782cd
31 geänderte Dateien mit 401 neuen und 308 gelöschten Zeilen
  1. 11 0
      MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/PschedDto.cs
  2. 35 0
      MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/TechProcDto.cs
  3. 97 48
      MicroServices/Business/Business.Application/ResourceExamineManagement/ProductExamineAppService.cs
  4. 106 85
      MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs
  5. 74 149
      MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContext.cs
  6. 1 1
      MicroServices/Business/Business.Host/BusinessHostModule.cs
  7. 5 1
      MicroServices/Business/Bussiness.Model/MES/IC/ic_item_stockoccupy.cs
  8. 3 1
      MicroServices/Business/Bussiness.Model/SIM/sim_base.cs
  9. 3 1
      MicroServices/Business/Bussiness.Model/SIM/sim_issue_type.cs
  10. 3 1
      MicroServices/Business/Bussiness.Model/SIM/sim_plant.cs
  11. 3 1
      MicroServices/Business/Bussiness.Model/SIM/sim_user_relation.cs
  12. 3 1
      MicroServices/Business/Bussiness.Model/Sale/crm_seorderprog.cs
  13. 3 1
      MicroServices/Business/Bussiness.Model/Sale/crm_seorderreview.cs
  14. 3 1
      MicroServices/Business/Bussiness.Model/Sale/wms_prdprogress.cs
  15. 3 1
      MicroServices/Business/Bussiness.Model/Sale/wms_shipnotice.cs
  16. 3 1
      MicroServices/Business/Bussiness.Model/Sale/wms_shipnoticelist.cs
  17. 3 1
      MicroServices/Business/Bussiness.Model/Sale/wms_shipplan.cs
  18. 3 1
      MicroServices/Business/Bussiness.Model/Sale/wms_shipplanlist.cs
  19. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/crm_customer.cs
  20. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_code.cs
  21. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_code_pre.cs
  22. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_config.cs
  23. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_measure_unit.cs
  24. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_post.cs
  25. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_post_staff.cs
  26. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_schedule.cs
  27. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_shift.cs
  28. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_shift_invalid_time.cs
  29. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_shift_schedule.cs
  30. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_staff.cs
  31. 3 1
      MicroServices/Business/Bussiness.Model/SystemData/sys_upload.cs

+ 11 - 0
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/PschedDto.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using Volo.Abp.Application.Dtos;
 using System.ComponentModel.DataAnnotations;
 using Bussiness.Model.MES.IC;
+using Bussiness.Model.Production;
 
 namespace Business.ResourceExamineManagement.Dto
 {
@@ -25,6 +26,16 @@ namespace Business.ResourceExamineManagement.Dto
         /// 物料占用记录
         /// </summary>
         public List<ic_item_stockoccupy> sklist { get; set; }
+
+        /// <summary>
+        /// 采购申请
+        /// </summary>
+        public List<SRMPRDto> srm_pr_list { get; set; }
+
+        /// <summary>
+        /// 委外订单
+        /// </summary>
+        public List<mes_oorder> order_list { get; set; }
     }
 
     /// <summary>

+ 35 - 0
MicroServices/Business/Business.Application.Contracts/ResourceExamineManagement/Dto/TechProcDto.cs

@@ -0,0 +1,35 @@
+using Bussiness.Model.Tech;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Business.ResourceExamineManagement.Dto
+{
+    /// <summary>
+    /// 工艺路径处理Dto
+    /// </summary>
+    public class TechProcDto
+    {
+        /// <summary>
+        /// 工艺路径序号
+        /// </summary>
+        public int serialno { get; set; }
+
+        /// <summary>
+        /// 工艺路径
+        /// </summary>
+        public List<mes_tech_process> processes { get; set; }
+
+        /// <summary>
+        /// 工序详细情况
+        /// </summary>
+        public List<StartTimeDto> details { get; set; }
+
+        /// <summary>
+        /// 当前工序耗时
+        /// </summary>
+        public decimal sumTimes { get; set; }
+    }
+}

+ 97 - 48
MicroServices/Business/Business.Application/ResourceExamineManagement/ProductExamineAppService.cs

@@ -99,7 +99,7 @@ namespace Business.ResourceExamineManagement
             //1.3、获取当前工艺路径下的工序数据
             //FilterDefinition<mes_process> filter = Builders<mes_process>.Filter.In(s => s.Id, tech_Processes.Select(m => m.proc_id).ToList());
             //List<mes_process> process = await _mes_process.GetManyByIds(filter);
-            List<long> procIds = tech_Processes.Select(m => m.proc_id.Value).ToList();
+            List<long> procIds = tech_Processes.Select(m => m.proc_id.GetValueOrDefault()).ToList();
             List<mes_process> process = await _mes_process.GetManyByCondition(p => procIds.Contains(p.Id) && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted);
 
             //1.3、获取工艺工序关联工位信息
@@ -107,42 +107,72 @@ namespace Business.ResourceExamineManagement
             List<mes_tech_proc_workshop> tech_Proc_Workshops = await _mes_tech_proc_workshop.GetManyByCondition(p => techProcIds.Contains(p.tech_proc_id.Value) && p.tenant_id == param.tenantId && p.factory_id == param.factoryId && !p.IsDeleted);
             #endregion
 
-            //1、获取工艺路径下的第一层级工序
-            List<mes_tech_process> fistChilds = tech_Processes.Where(p => p.parentprocid == tech.Id).ToList();
-            if (fistChilds.Count == 0)
+            //1、获取工艺路径下的第一层级工序:目前只考虑第一层级
+            List<mes_tech_process> fistLevels = tech_Processes.Where(p => p.parentprocid == tech.Id).ToList();
+            if (fistLevels.Count == 0)
             {
                 throw new NotImplementedException("当前工艺路径没有配置工序,请调整!");
             }
-            List<mes_tech_process> sortChilds = new List<mes_tech_process>();
-            //添加最后一个工序
-            var last = fistChilds.FirstOrDefault(p => p.nextprocid == null);
-            if (last == null)
+            //工艺预处理
+            List<TechProcDto> teches = TechProcPretreatment(fistLevels,param.packages);
+            decimal sumTimes = teches.OrderByDescending(p => p.sumTimes).First().sumTimes;
+            return sumTimes;
+        }
+
+        /// <summary>
+        /// 工序预处理,按照多分支生成多条单独的工艺路径
+        /// </summary>
+        /// <param name="proc">当前工序</param>
+        /// <param name="processes">工艺关联工序list</param>
+        /// <param name="packages">生产件数</param>
+        /// <returns></returns>
+        private List<TechProcDto> TechProcPretreatment(List<mes_tech_process> processes,int packages)
+        { 
+            //工艺路径预处理dto
+            List<TechProcDto> techProcDtos = new List<TechProcDto>();
+            TechProcDto dto;
+            //获取下一步工序id
+            List<long> nextProcIds = processes.Where(p=>p.nextprocid != null).Select(p => p.nextprocid.GetValueOrDefault()).ToList();
+            //获取起点工序
+            var startProcs = processes.Where(p => !nextProcIds.Contains(p.proc_id.GetValueOrDefault())).ToList();
+            //递归处理工序返回值
+            List<mes_tech_process> rtnList;
+            for (int i = 0; i < startProcs.Count; i++)
             {
-                throw new NotImplementedException("当前工艺路径没有配置最终工序,请调整!");
+                dto = new TechProcDto();
+                rtnList = new List<mes_tech_process>();
+                GetNextProc(startProcs[i], processes, rtnList);
+                dto.serialno = i + 1;
+                dto.processes = rtnList;
+                dto.details = CalcTakeTimeByLq(rtnList, packages);//通过Lq计算
+                //dto.details = CalcTakeTimeByLqt(rtnList, packages);//通过Lqt计算
+                dto.sumTimes = dto.details.Sum(p=>p.wait_time);
+                techProcDtos.Add(dto);
             }
-            sortChilds.Add(last);
-            //递归按工序先后顺序排序
-            SortProcess(fistChilds, last.proc_id.Value, sortChilds);
-            //总耗时(分钟)
-            //decimal sumTimes = CalcTakeTimeByLq(sortChilds, param.packages);//通过Lq计算
-            decimal sumTimes = CalcTakeTimeByLqt(sortChilds, param.packages);//通过Lqt计算
-            return sumTimes;
+            return techProcDtos;
         }
 
         /// <summary>
-        /// 递归:工序按照先后顺序排序-暂时不考虑两个分支合并到一个分支的情况
+        /// 递归:根据起始工序,获取后续工序
         /// </summary>
-        /// <param name="Processes"></param>
-        /// <param name="processId"></param>
-        /// <param name="sortProcesses"></param>
-        private void SortProcess(List<mes_tech_process> Processes, long processId, List<mes_tech_process> sortProcesses)
+        /// <param name="proc"></param>
+        /// <param name="processes"></param>
+        /// <param name="rtnList"></param>
+        private void GetNextProc(mes_tech_process proc, List<mes_tech_process> processes, List<mes_tech_process> rtnList)
         {
-            var curProcess = Processes.Where(p => p.nextprocid == processId).FirstOrDefault();
-            if (curProcess != null)
+            rtnList.Add(proc);
+            //下一工序id为null,终止
+            if (proc?.nextprocid == null)
+            {
+                return;
+            }
+            //获取下一个工序
+            var nextProc = processes.FirstOrDefault(p=>p.proc_id == proc.nextprocid);
+            if (nextProc == null) 
             {
-                sortProcesses.AddFirst(curProcess);
-                SortProcess(Processes, curProcess.proc_id.Value, sortProcesses);
+                return;
             }
+            GetNextProc(nextProc, processes, rtnList);
         }
 
         /// <summary>
@@ -151,9 +181,8 @@ namespace Business.ResourceExamineManagement
         /// <param name="Processes"></param>
         /// <param name="packages"></param>
         /// <returns></returns>
-        private decimal CalcTakeTimeByLq(List<mes_tech_process> Processes, int packages)
+        private List<StartTimeDto> CalcTakeTimeByLq(List<mes_tech_process> Processes, int packages)
         {
-            decimal sumTimes = 0.00m;//总耗时(分钟)
             //工序需要等待时间记录
             List<StartTimeDto> starts = new List<StartTimeDto>();
             StartTimeDto dto;
@@ -167,13 +196,12 @@ namespace Business.ResourceExamineManagement
                 }
                 else
                 {
-                    dto = CalcProcTakeTimeByLq(chd, chd.lq.Value, packages);
+                    dto = CalcProcTakeTimeByLq(chd, chd.lq.GetValueOrDefault(), packages);
                 }
-                sumTimes += dto.wait_time;
                 //添加记录
                 starts.Add(dto);
             }
-            return sumTimes;
+            return starts;
         }
 
         /// <summary>
@@ -188,23 +216,35 @@ namespace Business.ResourceExamineManagement
             //记录当前工序耗时
             StartTimeDto dto = new StartTimeDto();
             //添加耗时记录
-            dto.tech_id = proc.tech_id.Value;
-            dto.proc_id = proc.proc_id.Value;
+            dto.tech_id = proc.tech_id.GetValueOrDefault();
+            dto.proc_id = proc.proc_id.GetValueOrDefault();
             dto.nextproc_id = proc.nextprocid;
             if (proc.wctype == 1)//人工型:数量/uph(一小时生产数量)*60(小时转换为分钟)/wsinuse(工位数)
             {
-                dto.wait_time = quantity / proc.uph.Value * 60 / proc.wsinuse.Value;
-                dto.take_time = packages / proc.uph.Value * 60 / proc.wsinuse.Value;
+                if ( proc.uph.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序uph或wsinuse参数配置错误,请调整!");
+                }
+                dto.wait_time = quantity / proc.uph.GetValueOrDefault() * 60 / proc.wsinuse.GetValueOrDefault();
+                dto.take_time = packages / proc.uph.GetValueOrDefault() * 60 / proc.wsinuse.GetValueOrDefault();
             }
             else if (proc.wctype == 2)//流水线型:数量*ct(生产一件所需时间)/wsinuse(工位数)
             {
-                dto.wait_time = quantity * proc.ct.Value / proc.wsinuse.Value;
-                dto.take_time = packages * proc.ct.Value / proc.wsinuse.Value;
+                if (proc.ct.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序ct或wsinuse参数配置错误,请调整!");
+                }
+                dto.wait_time = quantity * proc.ct.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault();
+                dto.take_time = packages * proc.ct.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault();
             }
             else if (proc.wctype == 3)//设备型:向上取整(数量/一次可加工数量/wsinuse(工位数))*ct(老化一次所需时间)
             {
-                dto.wait_time = Math.Ceiling(quantity / proc.upe.Value / proc.wsinuse.Value) * proc.ct.Value;
-                dto.take_time = Math.Ceiling(packages / proc.upe.Value / proc.wsinuse.Value) * proc.ct.Value;
+                if (proc.upe.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0|| proc.ct.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序upe或ct或wsinuse参数配置错误,请调整!");
+                }
+                dto.wait_time = Math.Ceiling(quantity / proc.upe.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault()) * proc.ct.GetValueOrDefault();
+                dto.take_time = Math.Ceiling(packages / proc.upe.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault()) * proc.ct.GetValueOrDefault();
             }
             return dto;
         }
@@ -215,10 +255,8 @@ namespace Business.ResourceExamineManagement
         /// <param name="Processes"></param>
         /// <param name="packages"></param>
         /// <returns></returns>
-        private decimal CalcTakeTimeByLqt(List<mes_tech_process> Processes, int packages)
+        private List<StartTimeDto> CalcTakeTimeByLqt(List<mes_tech_process> Processes, int packages)
         {
-            //总耗时
-            decimal sumTimes = 0;
             //工序需要等待时间记录
             List<StartTimeDto> starts = new List<StartTimeDto>();
             StartTimeDto dto;
@@ -226,8 +264,8 @@ namespace Business.ResourceExamineManagement
             {
                 dto = new StartTimeDto();
                 //添加耗时记录
-                dto.tech_id = chd.tech_id.Value;
-                dto.proc_id = chd.proc_id.Value;
+                dto.tech_id = chd.tech_id.GetValueOrDefault();
+                dto.proc_id = chd.proc_id.GetValueOrDefault();
                 dto.nextproc_id = chd.nextprocid;
 
                 //计算当前工序生产耗时
@@ -240,11 +278,10 @@ namespace Business.ResourceExamineManagement
                 {
                     dto.wait_time = chd.lqt.Value;
                 }
-                sumTimes += dto.wait_time;
                 //添加记录
                 starts.Add(dto);
             }
-            return sumTimes;
+            return starts;
         }
 
         /// <summary>
@@ -260,15 +297,27 @@ namespace Business.ResourceExamineManagement
 
             if (proc.wctype == 1)//人工型:数量/uph(一小时生产数量)*60(小时转换为分钟)/wsinuse(工位数)
             {
-                takeTiem = packages / proc.uph.Value * 60 / proc.wsinuse.Value;
+                if (proc.uph.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序uph或wsinuse参数配置错误,请调整!");
+                }
+                takeTiem = packages / proc.uph.GetValueOrDefault() * 60 / proc.wsinuse.GetValueOrDefault();
             }
             else if (proc.wctype == 2)//流水线型:数量*ct(生产一件所需时间)/wsinuse(工位数)
             {
-                takeTiem = packages * proc.ct.Value / proc.wsinuse.Value;
+                if (proc.ct.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序ct或wsinuse参数配置错误,请调整!");
+                }
+                takeTiem = packages * proc.ct.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault();
             }
             else if (proc.wctype == 3)//设备型:向上取整(数量/一次可加工数量/wsinuse(工位数))*ct(老化一次所需时间)
             {
-                takeTiem = Math.Ceiling(packages / proc.upe.Value / proc.wsinuse.Value) * proc.ct.Value;
+                if (proc.upe.GetValueOrDefault() == 0 || proc.wsinuse.GetValueOrDefault() == 0 || proc.ct.GetValueOrDefault() == 0)
+                {
+                    throw new NotImplementedException("当前工序upe或ct或wsinuse参数配置错误,请调整!");
+                }
+                takeTiem = Math.Ceiling(packages / proc.upe.GetValueOrDefault() / proc.wsinuse.GetValueOrDefault()) * proc.ct.GetValueOrDefault();
             }
             return takeTiem;
         }

+ 106 - 85
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -211,6 +211,10 @@ namespace Business.ResourceExamineManagement
         private List<ic_item_pur> supplierList;
 
         private List<ic_plan> planList;
+
+        private List<SRMPRDto> SRMPRDtoList = new List<SRMPRDto>();
+
+        private List<mes_oorder> orderList = new List<mes_oorder>();
         #endregion
 
         #region 构造函数
@@ -413,6 +417,8 @@ namespace Business.ResourceExamineManagement
             }
             //订单行资源检查明细list
             rtn.examines = examines;
+            rtn.srm_pr_list = SRMPRDtoList;
+            rtn.order_list = orderList;
             rtn.sklist = sklist;
             return JsonConvert.SerializeObject(rtn);
         }
@@ -708,12 +714,12 @@ namespace Business.ResourceExamineManagement
             foreach (var item in returnlist)
             {
                 //最顶级、虚拟件
-                if (item.level == 1 || item.erp_cls == 4 || !childidList.Contains(item.bom_child_id.GetValueOrDefault()))
+                if (item.level == 1 || item.erp_cls == 4 || childidList.Contains(item.bom_child_id.GetValueOrDefault()))
                 {
                     continue;
                 }
                 //有替代关系
-                if (item.haveicsubs == 1)
+                if (item.haveicsubs != 1)
                 {
                     continue;
                 }
@@ -872,7 +878,7 @@ namespace Business.ResourceExamineManagement
         {
             //第一级
             returnlist = returnlist.OrderBy(s => s.num).ToList();
-            var childList = returnlist.Where(s => s.parent_id == returnlist[0].id && s.type == 0).ToList();
+            var childList = returnlist.Where(s => s.parent_id == returnlist[0].id && s.type == 0).OrderBy(s => s.num).ToList();
 
             var planList = GetICPlan(returnlist.Select(p => p.item_id).ToList(), bangid, param.factoryId);//plan列表
 
@@ -962,7 +968,7 @@ namespace Business.ResourceExamineManagement
         {
             foreach (var item in childList)
             {
-                var cilList = returnlist.Where(s => s.parent_id == item.id && s.type == 0).ToList();
+                var cilList = returnlist.Where(s => s.parent_id == item.id && s.type == 0).OrderBy(k => k.num).ToList();
 
                 if (item.haveicsubs == 1)
                 {
@@ -979,6 +985,7 @@ namespace Business.ResourceExamineManagement
                     ic_item_stockoccupy itemStockoccupyDto = new ic_item_stockoccupy();
                     itemStockoccupyDto.bang_id = bangid;
                     itemStockoccupyDto.icitem_id = item.item_id;
+                    itemStockoccupyDto.item_no = item.num;
                     item.kitting_time = DateTime.Now;
                     if (cilList.Count() > 0)
                     {
@@ -986,68 +993,58 @@ namespace Business.ResourceExamineManagement
                         item.kitting_time = cilList.Max(s => s.kitting_time);
                     }
 
-                    if (item.lack_qty > 0)
+                    if (parent.stock_state == 0)
                     {
-                        //如果缺料,占用库存,然后走采购或自制
-                        itemStockoccupyDto.quantity = item.sqty;
-                        item.use_qty = item.sqty;
-                        sklist.Add(itemStockoccupyDto);
-                        if (item.erp_cls == 1)
+                        if (item.lack_qty > 0)
                         {
-                            //走自制
-                            //var minute = ProductiveExamine(item.bom_number, "1.0", item.lack_qty.GetInt());
-                            ProdExamineParamDto prodExamine = new ProdExamineParamDto()
+                            //如果缺料,占用库存,然后走采购或自制
+                            if (item.sqty > 0)
                             {
-                                bom_number = item.bom_number,
-                                version = item.version,
-                                packages = item.lack_qty.GetInt(),
-                                tenantId = param.tenantId,
-                                factoryId = param.factoryId
-
-                            };
-                            var minute = _productExamineAppService.ProductiveExamine(prodExamine);
-                            //var ProductiveDate = ProductiveExamine(BomNumber, (int)(Quantity.Value));
-                            //系统建议完工日期为 开工日期+产能检查时间=完工日期
-                            var Day = minute.Result / (60 * 10); //返回的分钟除以十个小时得出工作天数;
-                            item.kitting_time = item.kitting_time.Value.AddDays((double)Day);
-                        }
-                        else if (item.erp_cls == 2)
-                        {
-                            //采购申请
-                            var SRMPRDto = CreateSRMPR(item, input.tenantId, input.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
-                            item.kitting_time = SRMPRDto.lastStartTmie;
-                        }
-                        else if (item.erp_cls == 3)
-                        {
-
-                            if (item.erp_cls == 3)
+                                itemStockoccupyDto.quantity = item.sqty;
+                                sklist.Add(itemStockoccupyDto);
+                            }
+                            item.use_qty = item.sqty;
+                            if (item.erp_cls == 1)
                             {
-                                //1.先生成委外工单。
-                                CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
-                                //2.再根据委外工单需要检查库存材料,然后提供给第三方组装(委外生产)。
-                                //3.如果委外工单的物料库存不够,先生成物料采购申请单,再生成物料的采购订单,到货后再走委外流程。
-                                /*foreach (var cl in cilList)
+                                //走自制
+                                //var minute = ProductiveExamine(item.bom_number, "1.0", item.lack_qty.GetInt());
+                                ProdExamineParamDto prodExamine = new ProdExamineParamDto()
                                 {
-                                    if (cl.stock_state == 0 || cl.stock_state == 2)
-                                    {
-                                        //采购申请
-                                        var SRMPRDto = CreateSRMPR(item, input.tenantId, input.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
-                                        item.kitting_time = SRMPRDto.lastStartTmie;
-                                    }
-                                }*/
-                                //4.再生成委外的采购申请单。
+                                    bom_number = item.bom_number,
+                                    version = item.version,
+                                    packages = (int)item.lack_qty,
+                                    tenantId = param.tenantId,
+                                    factoryId = param.factoryId
+
+                                };
+                                var minute = _productExamineAppService.ProductiveExamine(prodExamine);
+                                //var ProductiveDate = ProductiveExamine(BomNumber, (int)(Quantity.Value));
+                                //系统建议完工日期为 开工日期+产能检查时间=完工日期
+                                var Day = minute.Result / (60 * 10); //返回的分钟除以十个小时得出工作天数;
+                                item.kitting_time = item.kitting_time.Value.AddDays((double)Day);
+                            }
+                            else if (item.erp_cls == 3)
+                            {
+                                //采购申请
+                                var SRMPRDto = CreateSRMPR(item, input.tenantId, input.factoryId, bangid, item.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
+                                item.kitting_time = SRMPRDto.lastStartTmie;
+                                SRMPRDtoList.Add(SRMPRDto);
+                            }
+                            else if (item.erp_cls == 2)
+                            {
+                                //1.先生成委外工单。
+                                var mesorder = CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
+                                item.kitting_time = mesorder.ooentry_etime;
+                                orderList.Add(mesorder);
                             }
                         }
-                    }
-                    else
-                    {
-                        item.use_qty = 0;
-                        if (parent.stock_state == 1)
+                        else
                         {
                             //如果父级缺料,则本级等于父级缺料*本级使用数量
                             item.use_qty = parent.lack_qty * item.qty;
                             itemStockoccupyDto.quantity = item.use_qty;
                             sklist.Add(itemStockoccupyDto);
+
                         }
                     }
                     item.is_use = true;
@@ -1215,6 +1212,7 @@ namespace Business.ResourceExamineManagement
                 ic_item_stockoccupy itemStockoccupyDto = new ic_item_stockoccupy();
                 itemStockoccupyDto.bang_id = bangid;
                 itemStockoccupyDto.icitem_id = slt.item_id;
+                itemStockoccupyDto.item_no = slt.num;
                 slt.is_use = true;
                 if (slt.lack_qty > 0)
                 {
@@ -1227,9 +1225,9 @@ namespace Business.ResourceExamineManagement
                         //var minute = ProductiveExamine(item.bom_number, "1.0", item.lack_qty.GetInt());
                         ProdExamineParamDto prodExamine = new ProdExamineParamDto()
                         {
-                            bom_number = item.bom_number,
-                            version = item.version,
-                            packages = item.lack_qty.GetInt(),
+                            bom_number = slt.bom_number,
+                            version = slt.version,
+                            packages = (int)slt.lack_qty,
                             tenantId = param.tenantId,
                             factoryId = param.factoryId
 
@@ -1244,19 +1242,19 @@ namespace Business.ResourceExamineManagement
                             CalcStrategy(slt, returnlist, bangid, sklist);
                         }*/
                     }
-                    else if (slt.erp_cls == 2 || slt.erp_cls == 3)
-                    {   /*//生成采购订单
-                        //slt.purchase_qty = slt.lack_qty;
-                        var leadTimeList = GetLeadTime(new List<long> { slt.item_id }, input.tenantId, input.factoryId);//提前期列表
-                        var supplierList = GetSupplier(new List<BomChildExamineDto> { slt }, input.tenantId, input.factoryId);//供应商列表
-                        var planList = GetICPlan(new List<BomChildExamineDto> { slt }, input.tenantId, input.factoryId);//plan列表
-
-                        slt.kitting_time = CreateSRMPR(slt, input.tenantId, input.factoryId, bangid, slt.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
-                        if (item.erp_cls == 3)
-                        {
-                            //生成委外工单
-                            CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
-                        }*/
+                    else if (slt.erp_cls == 3)
+                    {
+                        //采购申请
+                        var SRMPRDto = CreateSRMPR(slt, input.tenantId, input.factoryId, bangid, slt.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
+                        item.kitting_time = SRMPRDto.lastStartTmie;
+                        SRMPRDtoList.Add(SRMPRDto);
+                    }
+                    else if (slt.erp_cls == 2)
+                    {
+                        //1.先生成委外工单。
+                        var mesorder = CreateMesOOder(slt, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
+                        slt.kitting_time = mesorder.ooentry_etime;
+                        orderList.Add(mesorder);
                     }
                 }
                 else
@@ -1338,6 +1336,7 @@ namespace Business.ResourceExamineManagement
                         itemStockoccupyDto.bang_id = bangid;
                         itemStockoccupyDto.icitem_id = zy.item_id;
                         itemStockoccupyDto.quantity = use_p_num * zy.qty; ;
+                        itemStockoccupyDto.item_no = zy.num;
                         sklist.Add(itemStockoccupyDto);
                     }
                     idx++;
@@ -1364,20 +1363,36 @@ namespace Business.ResourceExamineManagement
                     var num = parent_lack * sct.qty - itemSockoccupy.Sum(m => m.quantity);
                     if (sct.erp_cls == 1)
                     {
-                        //自制
-                        //GenerateMorder()
+                        //走自制
+                        //var minute = ProductiveExamine(item.bom_number, "1.0", item.lack_qty.GetInt());
+                        ProdExamineParamDto prodExamine = new ProdExamineParamDto()
+                        {
+                            bom_number = sct.bom_number,
+                            version = sct.version,
+                            packages = (int)sct.lack_qty,
+                            tenantId = param.tenantId,
+                            factoryId = param.factoryId
+
+                        };
+                        var minute = _productExamineAppService.ProductiveExamine(prodExamine);
+                        //var ProductiveDate = ProductiveExamine(BomNumber, (int)(Quantity.Value));
+                        //系统建议完工日期为 开工日期+产能检查时间=完工日期
+                        var Day = minute.Result / (60 * 10); //返回的分钟除以十个小时得出工作天数;
+                        sct.kitting_time = sct.kitting_time.Value.AddDays((double)Day);
                     }
-                    else if (sct.erp_cls == 2 || sct.erp_cls == 3)
+                    else if (sct.erp_cls == 3)
                     {
-                        /*var leadTimeList = GetLeadTime(new List<long> { sct.item_id }, input.tenantId, input.factoryId);//提前期列表
-                        var supplierList = GetSupplier(new List<BomChildExamineDto> { sct }, input.tenantId, input.factoryId);//供应商列表
-                        var planList = GetICPlan(new List<BomChildExamineDto> { sct }, input.tenantId, input.factoryId);//plan列表
-                        sct.kitting_time = CreateSRMPR(sct, input.tenantId, input.factoryId, bangid, sct.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
-                        if (item.erp_cls == 3)
-                        {
-                            //生成委外工单
-                            CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
-                        }*/
+                        //采购申请
+                        var SRMPRDto = CreateSRMPR(sct, input.tenantId, input.factoryId, bangid, sct.erp_cls, leadTimeList, supplierList, planList, plan_date.Value);
+                        sct.kitting_time = SRMPRDto.lastStartTmie;
+                        SRMPRDtoList.Add(SRMPRDto);
+                    }
+                    else if (sct.erp_cls == 2)
+                    {
+                        //1.先生成委外工单。
+                        var mesorder = CreateMesOOder(sct, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
+                        sct.kitting_time = mesorder.ooentry_etime;
+                        orderList.Add(mesorder);
                     }
                 }
             }
@@ -1561,6 +1576,7 @@ namespace Business.ResourceExamineManagement
             {
                 //判断缺料数量
                 item.lack_qty = parent.lack_qty * item.qty - item.sqty;
+                item.lack_qty = item.lack_qty < 0 ? 0 : item.lack_qty;
                 //判断状态
                 item.stock_state = item.lack_qty > 0 ? 0 : 1;
             }
@@ -2023,14 +2039,19 @@ namespace Business.ResourceExamineManagement
         /// <param name="orderType">2委外采购申请单,3采购申请单</param>
         private SRMPRDto CreateSRMPR(BomChildExamineDto returnlist, long tenantId, long factoryid, long bangId, int orderType, List<ICItemLeadTimeDto> iCItemLeadTimes, List<ic_item_pur> supplierList, List<ic_plan> planList, DateTime deliveryDate)
         {
+            SRMPRDto sRMPR = new SRMPRDto();
+            srm_pr_main srm_Pr = new srm_pr_main();
             var leadTime = iCItemLeadTimes.Find(x => x.item_id == returnlist.item_id);
             var supplier = supplierList.Find(x => x.icitem_id == returnlist.item_id);//默认取第一个供应商
             var plan = planList.Find(x => x.icitem_id == returnlist.item_id);
             if (leadTime == null || supplier == null || plan == null)
             {
-                throw new NotImplementedException("未找到物料ic_factory_details或ic_item_pur或ic_plan信息!");
+                sRMPR.srm_Pr_Main = null;
+                sRMPR.lastStartTmie = deliveryDate.AddDays(7 * -1);//减去提前期
+                return sRMPR;
+                //throw new NotImplementedException("未找到物料ic_factory_details或ic_item_pur或ic_plan信息!");
             }
-            srm_pr_main srm_Pr = new srm_pr_main();
+            
             srm_Pr.GenerateNewId();
             srm_Pr.pr_billno = getOrderNum("PR");//pr单号
             srm_Pr.pr_mono = "";//关联工单号
@@ -2066,7 +2087,7 @@ namespace Business.ResourceExamineManagement
             srm_Pr.bang_id = bangId;
             //_srm_pr_main.InsertOne(srm_Pr);
             decimal? totalLeadTime = leadTime.transportation_leadtime + leadTime.stock_leadtime + leadTime.production_leadtime + leadTime.order_leadtime;
-            SRMPRDto sRMPR = new SRMPRDto();
+            
             sRMPR.srm_Pr_Main = srm_Pr;
             sRMPR.lastStartTmie = deliveryDate.AddDays((double)totalLeadTime * -1);//减去提前期
             return sRMPR;

+ 74 - 149
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContext.cs

@@ -2,7 +2,9 @@ using Business.Model;
 using Business.Models;
 using Bussiness.Model.MES.IC;
 using Bussiness.Model.Production;
+using Bussiness.Model.ProductionProcess;
 using Bussiness.Model.Sale;
+using Bussiness.Model.SIM;
 using Bussiness.Model.SRM;
 using Bussiness.Model.SystemData;
 using Bussiness.Model.Tech;
@@ -23,185 +25,108 @@ namespace Business.EntityFrameworkCore
 
         public DbSet<PrintTemplate> PrintTemplate { get; set; }
 
-        public DbSet<ic_bom> ic_Bom { get; set; }
-
-        public DbSet<wms_prdprogress> wms_Prdprogresses { get; set; }
-
-        /// <summary>
-        /// 销售订单
-        /// </summary>
-        public DbSet<crm_seorder> crm_seorder { get; set; }
-        /// <summary>
-        /// 销售订单子表
-        /// </summary>
-        public DbSet<crm_seorderentry> crm_seorderentry { get; set; }
-        #region 工单
-        /// <summary>
-        /// 在制工单占用记录表
-        /// </summary>
-        public DbSet<mes_mooccupy> mes_mooccupy { get; set; }
-        /// <summary>
-        /// 工单主表
-        /// </summary>
-        public DbSet<mes_morder> mes_morder { get; set; }
-        /// <summary>
-        /// 工单子表
-        /// </summary>
-        public DbSet<mes_moentry> mes_moentry { get; set; }
-        #endregion
-        #region 物料
-        /// <summary>
-        /// 物料详情
-        /// </summary>
-        public DbSet<ic_item> ic_Item { get; set; }
-
-        /// <summary>
-        /// 物料BOM
-        /// </summary>
+        #region MES/IC
         public DbSet<ic_bom> ic_bom { get; set; }
-
-        /// <summary>
-        /// 物料BOM明细
-        /// </summary>
         public DbSet<ic_bom_child> ic_bom_child { get; set; }
-
-        /// <summary>
-        /// 物料质检
-        /// </summary>
         public DbSet<ic_check> ic_check { get; set; }
-
-        /// <summary>
-        /// 工厂物料明细表
-        /// </summary>
         public DbSet<ic_factory_details> ic_factory_details { get; set; }
-
-        /// <summary>
-        /// 物料IE信息
-        /// </summary>
+        public DbSet<ic_item> ic_item { get; set; }
         public DbSet<ic_item_ie> ic_item_ie { get; set; }
-
-        /// <summary>
-        /// 物料库存明细表
-        /// </summary>
         public DbSet<ic_item_inventory> ic_item_inventory { get; set; }
-
-        /// <summary>
-        /// 物料采购报价单
-        /// </summary>
         public DbSet<ic_item_pur> ic_item_pur { get; set; }
-
-        /// <summary>
-        /// 物料库存表
-        /// </summary>
         public DbSet<ic_item_stock> ic_item_stock { get; set; }
-
-        /// <summary>
-        /// 物料计量表
-        /// </summary>
+        public DbSet<ic_item_stockoccupy> ic_item_stockoccupy { get; set; }
         public DbSet<ic_metering_unit> ic_metering_unit { get; set; }
-
-        /// <summary>
-        /// 物料采购计划表
-        /// </summary>
         public DbSet<ic_plan> ic_plan { get; set; }
-
-        /// <summary>
-        /// 替代群组
-        /// </summary>
         public DbSet<ic_substitute> ic_substitute { get; set; }
-
-        /// <summary>
-        /// 物料替代多群组
-        /// </summary>
         public DbSet<ic_substitute_all> ic_substitute_all { get; set; }
-
-        /// <summary>
-        /// 物料替代多群组明细
-        /// </summary>
         public DbSet<ic_substitute_all_dtl> ic_substitute_all_dtl { get; set; }
         #endregion
 
-        #region 工艺路径
+        #region Production
+        public DbSet<mes_moentry> mes_moentry { get; set; }
+        public DbSet<mes_mooccupy> mes_mooccupy { get; set; }
+        public DbSet<mes_morder> mes_morder { get; set; }
+        public DbSet<mes_morder_loss_time> mes_morder_loss_time { get; set; }
+        public DbSet<mes_oorder> mes_oorder { get; set; }
+        public DbSet<mes_schedule_occupy> mes_schedule_occupy { get; set; }
+        public DbSet<mes_stockoccupy> mes_stockoccupy { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 工序
-        /// </summary>
-        public DbSet<mes_process> mes_process { get; set; }
+        #region ProductionProcess
+        public DbSet<mes_loss_time_record> mes_loss_time_record { get; set; }
+        public DbSet<mes_meaction> mes_meaction { get; set; }
+        public DbSet<mes_mebycard> mes_mebycard { get; set; }
+        public DbSet<mes_merecheck> mes_merecheck { get; set; }
+        public DbSet<mes_mereport> mes_mereport { get; set; }
+        public DbSet<mes_prd_sendmat> mes_prd_sendmat { get; set; }
+        public DbSet<mes_prd_sendmat_list> mes_prd_sendmat_list { get; set; }
+        public DbSet<mes_prdlog> mes_prdlog { get; set; }
+        public DbSet<mes_product_work_time> mes_product_work_time { get; set; }
+        public DbSet<mes_stock_enter> mes_stock_enter { get; set; }
+        public DbSet<mes_stock_out> mes_stock_out { get; set; }
+        public DbSet<mes_swipe_card> mes_swipe_card { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 治具表
-        /// </summary>
-        public DbSet<mes_tech_proc_accessory> mes_tech_proc_accessory { get; set; }
+        #region Sale
+        public DbSet<crm_seorder> crm_seorder { get; set; }
+        public DbSet<crm_seorderentry> crm_seorderentry { get; set; }
+        public DbSet<crm_seorderprog> crm_seorderprog { get; set; }
+        public DbSet<crm_seorderreview> crm_seorderreview { get; set; }
+        public DbSet<wms_prdprogress> wms_prdprogress { get; set; }
+        public DbSet<wms_shipnotice> wms_shipnotice { get; set; }
+        public DbSet<wms_shipnoticelist> wms_shipnoticelist { get; set; }
+        public DbSet<wms_shipplan> wms_shipplan { get; set; }
+        public DbSet<wms_shipplanlist> wms_shipplanlist { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 工序作业指导书表
-        /// </summary>
-        public DbSet<mes_tech_proc_document> mes_tech_proc_document { get; set; }
+        #region SIM
+        public DbSet<sim_base> sim_base { get; set; }
+        public DbSet<sim_issue_type> sim_issue_type { get; set; }
+        public DbSet<sim_plant> sim_plant { get; set; }
+        public DbSet<sim_user_relation> sim_user_relation { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 工序关联设备表
-        /// </summary>
-        public DbSet<mes_tech_proc_equipment> mes_tech_proc_equipment { get; set; }
+        #region SRM
+        public DbSet<srm_po_list> srm_po_list { get; set; }
+        public DbSet<srm_po_main> srm_po_main { get; set; }
+        public DbSet<srm_po_occupy> srm_po_occupy { get; set; }
+        public DbSet<srm_pr_main> srm_pr_main { get; set; }
+        public DbSet<srm_purchase> srm_purchase { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 发料到工序表
-        /// </summary>
-        public DbSet<mes_tech_proc_icitem> mes_tech_proc_icitem { get; set; }
+        #region SystemData
+        public DbSet<crm_customer> crm_customer { get; set; }
+        public DbSet<srm_supplier> srm_supplier { get; set; }
+        public DbSet<sys_code> sys_code { get; set; }
+        public DbSet<sys_code_pre> sys_code_pre { get; set; }
+        public DbSet<sys_config> sys_config { get; set; }
+        public DbSet<sys_measure_unit> sys_measure_unit { get; set; }
+        public DbSet<sys_post> sys_post { get; set; }
+        public DbSet<sys_post_staff> sys_post_staff { get; set; }
+        public DbSet<sys_schedule> sys_schedule { get; set; }
+        public DbSet<sys_shift> sys_shift { get; set; }
+        public DbSet<sys_shift_invalid_time> sys_shift_invalid_time { get; set; }
+        public DbSet<sys_shift_schedule> sys_shift_schedule { get; set; }
+        public DbSet<sys_staff> sys_staff { get; set; }
+        public DbSet<sys_upload> sys_upload { get; set; }
+        #endregion
 
-        /// <summary>
-        /// 工艺路径关联工位表
-        /// </summary>
+        #region Tech
+        public DbSet<mes_process> mes_process { get; set; }
+        public DbSet<mes_tech_proc_accessory> mes_tech_proc_accessory { get; set; }
+        public DbSet<mes_tech_proc_document> mes_tech_proc_document { get; set; }
+        public DbSet<mes_tech_proc_equipment> mes_tech_proc_equipment { get; set; }
+        public DbSet<mes_tech_proc_icitem> mes_tech_proc_icitem { get; set; }
         public DbSet<mes_tech_proc_workshop> mes_tech_proc_workshop { get; set; }
-
-        /// <summary>
-        /// 工序工位员工信息表
-        /// </summary>
         public DbSet<mes_tech_proc_workshop_staff> mes_tech_proc_workshop_staff { get; set; }
-
-        /// <summary>
-        /// 工艺关联工序表
-        /// </summary>
         public DbSet<mes_tech_process> mes_tech_process { get; set; }
-
-        /// <summary>
-        /// 工艺路径表
-        /// </summary>
         public DbSet<mes_technique> mes_technique { get; set; }
-
-        /// <summary>
-        /// 工作日历
-        /// </summary>
         public DbSet<mes_work_calendar> mes_work_calendar { get; set; }
-
-        /// <summary>
-        /// 工作日历明细表
-        /// </summary>
         public DbSet<mes_work_calendar_list> mes_work_calendar_list { get; set; }
-
-        /// <summary>
-        /// 工位表
-        /// </summary>
         public DbSet<mes_workshop> mes_workshop { get; set; }
-
-        /// <summary>
-        /// 工位关联线边仓表
-        /// </summary>
         public DbSet<mes_workshop_shelf> mes_workshop_shelf { get; set; }
         #endregion
-
-        #region SRM
-        public DbSet<srm_pr_main> srm_pr_main { get; set; }
-        public DbSet<mes_oorder> mes_oorder { get; set; }
-        public DbSet<srm_po_main> srm_po_main { get; set; }
-        public DbSet<srm_po_list> srm_po_list { get; set; }
-
-        public DbSet<srm_po_occupy> srm_po_occupy { get; set; }
-
-        /// <summary>
-        /// 供应商
-        /// </summary>
-        public DbSet<srm_supplier> srm_supplier { get; set; }
-        #endregion
         //Code generation...
         public BusinessDbContext(DbContextOptions<BusinessDbContext> options)
             : base(options)

+ 1 - 1
MicroServices/Business/Business.Host/BusinessHostModule.cs

@@ -316,7 +316,7 @@ namespace Business
                 DashboardTitle = "任务调度中心"
             });
 
-            RecurringJob.AddOrUpdate<IHangFireJobService>(a=>a.SyncDataMySQLData(),CronType.Day(0,0,1));
+            RecurringJob.AddOrUpdate<IHangFireJobService>(a=>a.SyncDataMySQLData(),CronType.Day(0,0,1),TimeZoneInfo.Local);
             AsyncHelper.RunSync(async () =>
             {
                 using (var scope = context.ServiceProvider.CreateScope())

+ 5 - 1
MicroServices/Business/Bussiness.Model/MES/IC/ic_item_stockoccupy.cs

@@ -50,6 +50,10 @@ namespace Bussiness.Model.MES.IC
         [Comment("占用数量")]
         public decimal quantity { get; set; }
 
-
+        /// <summary>
+        /// 项次号
+        /// </summary>
+        [Comment("项次号")]
+        public string item_no { get; set; }
     }
 }

+ 3 - 1
MicroServices/Business/Bussiness.Model/SIM/sim_base.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SIM
     /// sim基本表
     /// </summary>
     [Comment("sim基本表")]
+    [CollectionName("dopbase", "sim_base")]
     public class sim_base:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SIM/sim_issue_type.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SIM
     /// sim事项类别表
     /// </summary>
     [Comment("上升时间")]
+    [CollectionName("dopbase", "sim_issue_type")]
     public class sim_issue_type: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SIM/sim_plant.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SIM
     /// sim事项表
     /// </summary>
     [Comment("sim事项表")]
+    [CollectionName("dopbase", "sim_plant")]
     public class sim_plant:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SIM/sim_user_relation.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SIM
     /// sim用户关联表
     /// </summary>
     [Comment("sim用户关联表")]
+    [CollectionName("dopbase", "sim_user_relation")]
     public class sim_user_relation: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/crm_seorderprog.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     ///销售订单进度表
     /// </summary>
     [Comment("销售订单进度表")]
+    [CollectionName("dopbase", "crm_seorderprog")]
     public class crm_seorderprog : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/crm_seorderreview.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     ///销售订单评审表
     /// </summary>
     [Comment("销售订单评审表")]
+    [CollectionName("dopbase", "crm_seorderreview")]
     public class crm_seorderreview : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/wms_prdprogress.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     ///进度字典
     /// </summary>
     [Comment("进度字典表")]
+    [CollectionName("dopbase", "wms_prdprogress")]
     public class wms_prdprogress: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/wms_shipnotice.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     /// 发运通知单
     /// </summary>
     [Comment("发运通知单")]
+    [CollectionName("dopbase", "wms_shipnotice")]
     public class wms_shipnotice : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/wms_shipnoticelist.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     /// 发运通知单详情清单
     /// </summary>
     [Comment("发运通知单详情清单")]
+    [CollectionName("dopbase", "wms_shipnoticelist")]
     public class wms_shipnoticelist : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/wms_shipplan.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     /// 发货计划表
     /// </summary>
     [Comment("发货计划表")]
+    [CollectionName("dopbase", "wms_shipplan")]
     public class wms_shipplan : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/Sale/wms_shipplanlist.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.Sale
     /// 发货计划详情清单
     /// </summary>
     [Comment("发货计划详情清单")]
+    [CollectionName("dopbase", "wms_shipplanlist")]
     public class wms_shipplanlist : BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/crm_customer.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 客户
     /// </summary>
     [Comment("客户")]
+    [CollectionName("dopbase", "crm_customer")]
     public class crm_customer:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_code.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -11,6 +12,7 @@ namespace Bussiness.Model.SystemData
     /// 系统编码表
     /// </summary>
     [Comment("系统编码表")]
+    [CollectionName("dopbase", "sys_code")]
     public class sys_code:Entity<long>
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_code_pre.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -10,6 +11,7 @@ namespace Bussiness.Model.SystemData
     /// 系统编码前置表
     /// </summary>
     [Comment("系统编码前置表")]
+    [CollectionName("dopbase", "sys_code_pre")]
     public class sys_code_pre:Entity<long>
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_config.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -10,6 +11,7 @@ namespace Bussiness.Model.SystemData
     /// 系统配置表
     /// </summary>
     [Comment("系统配置表")]
+    [CollectionName("dopbase", "sys_config")]
     public class sys_config:Entity<long>
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_measure_unit.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -10,6 +11,7 @@ namespace Bussiness.Model.SystemData
     /// 计量单位信息表
     /// </summary>
     [Comment("计量单位信息表")]
+    [CollectionName("dopbase", "sys_measure_unit")]
     public class sys_measure_unit:Entity<long>
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_post.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 岗位表
     /// </summary>
     [Comment("岗位表")]
+    [CollectionName("dopbase", "sys_post")]
     public class sys_post: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_post_staff.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 员工岗位关联表
     /// </summary>
     [Comment("员工岗位关联表")]
+    [CollectionName("dopbase", "sys_post_staff")]
     public class sys_post_staff: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_schedule.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 班次表
     /// </summary>
     [Comment("班次表")]
+    [CollectionName("dopbase", "sys_schedule")]
     public class sys_schedule: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_shift.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 班制表
     /// </summary>
     [Comment("班制表")]
+    [CollectionName("dopbase", "sys_shift")]
     public class sys_shift: BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_shift_invalid_time.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 班次无效时间表
     /// </summary>
     [Comment("班次无效时间表")]
+    [CollectionName("dopbase", "sys_shift_invalid_time")]
     public class sys_shift_invalid_time:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_shift_schedule.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 班制班次关联表
     /// </summary>
     [Comment("班制班次关联表")]
+    [CollectionName("dopbase", "sys_shift_schedule")]
     public class sys_shift_schedule:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_staff.cs

@@ -1,4 +1,5 @@
-using Business.Model;
+using Business.Core.Attributes;
+using Business.Model;
 using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 员工表
     /// </summary>
     [Comment("员工表")]
+    [CollectionName("dopbase", "sys_staff")]
     public class sys_staff:BaseEntity
     {
         ///// <summary>

+ 3 - 1
MicroServices/Business/Bussiness.Model/SystemData/sys_upload.cs

@@ -1,4 +1,5 @@
-using Microsoft.EntityFrameworkCore;
+using Business.Core.Attributes;
+using Microsoft.EntityFrameworkCore;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
 using Volo.Abp.Domain.Entities;
@@ -9,6 +10,7 @@ namespace Bussiness.Model.SystemData
     /// 文件上传表
     /// </summary>
     [Comment("文件上传表")]
+    [CollectionName("dopbase", "sys_upload")]
     public class sys_upload:Entity<long>
     {
         ///// <summary>