|
|
@@ -1,18 +1,12 @@
|
|
|
-using Business.Core.Attributes;
|
|
|
-using Business.Core.Configuration;
|
|
|
-using Business.Core.Utilities;
|
|
|
-using Business.Core.Web;
|
|
|
+using Business.Core.Utilities;
|
|
|
using Business.Domain;
|
|
|
using Business.EntityFrameworkCore;
|
|
|
using Business.EntityFrameworkCore.SqlRepositories;
|
|
|
using Business.ResourceExamineManagement;
|
|
|
using Business.SystemJob;
|
|
|
-using MongoDB.Driver;
|
|
|
using NLog;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Configuration;
|
|
|
-using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
using Volo.Abp.Application.Services;
|
|
|
using Volo.Abp.Domain.Repositories;
|
|
|
@@ -26,31 +20,26 @@ namespace Business.SystemJobManagement
|
|
|
/// 物料bom
|
|
|
/// </summary>
|
|
|
private IRepository<ic_bom, long> _mysql_ic_bom;
|
|
|
- private readonly IRepository<mo_ic_bom, long> _ic_bom;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料bom子表
|
|
|
/// </summary>
|
|
|
private IRepository<ic_bom_child, long> _mysql_ic_bom_child;
|
|
|
- private readonly IRepository<mo_ic_bom_child, long> _ic_bom_child;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料
|
|
|
/// </summary>
|
|
|
private IRepository<ic_item, long> _mysql_ic_item;
|
|
|
- private readonly IRepository<mo_ic_item, long> _ic_item;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 供应商
|
|
|
/// </summary>
|
|
|
private IRepository<srm_supplier, long> _mysql_srm_supplier;
|
|
|
- private readonly IRepository<mo_srm_supplier, long> _srm_supplier;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料采购报价单
|
|
|
/// </summary>
|
|
|
private IRepository<srm_purchase, long> _mysql_srm_purchase;
|
|
|
- private readonly IRepository<mo_srm_purchase, long> _srm_purchase;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料采购报价单
|
|
|
@@ -81,19 +70,16 @@ namespace Business.SystemJobManagement
|
|
|
/// <summary>
|
|
|
/// 替代群组
|
|
|
/// </summary>
|
|
|
- private readonly IRepository<mo_ic_substitute, long> _ic_substitute;
|
|
|
private IRepository<ic_substitute, long> _mysql_ic_substitute;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料替代多群组
|
|
|
/// </summary>
|
|
|
- private readonly IRepository<mo_ic_substitute_group, long> _ic_substitute_group;
|
|
|
private IRepository<ic_substitute_group, long> _mysql_ic_substitute_group;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料替代多群组明细
|
|
|
/// </summary>
|
|
|
- private readonly IRepository<mo_ic_substitute_group_detail, long> _ic_substitute_group_detail;
|
|
|
private IRepository<ic_substitute_group_detail, long> _mysql_ic_substitute_group_detail;
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -115,87 +101,10 @@ namespace Business.SystemJobManagement
|
|
|
private IRepository<mes_tech_process, long> _mysql_mes_tech_process;
|
|
|
|
|
|
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<WorkOrdMaster> _workOrdMaster;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单物料明细
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<WorkOrdDetail> _workOrdDetail;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工单工艺路线明细
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<WorkOrdRouting> _workOrdRouting;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 库存主数据
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<InvMaster> _invMaster;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 生产线明细
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<ProdLineDetail> _prodLineDetail;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 生产周期明细
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<PeriodSequenceDet> _periodSequenceDet;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 排产结果明细
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<ScheduleResultOpMaster> _scheduleResultOpMaster;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工作日历数据
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<ShopCalendarWorkCtr> _shopCalendarWorkCtr;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 产线休息时间记录表
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<QualityLineWorkDetail> _qualityLineWorkDetail;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 节假日记录表
|
|
|
- /// </summary>
|
|
|
- private ISqlRepository<HolidayMaster> _holidayMaster;
|
|
|
-
|
|
|
-
|
|
|
- private readonly ICurrentTenant _currentTenant;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 工作日历数据
|
|
|
- /// </summary>
|
|
|
- private List<ShopCalendarWorkCtr> calendars;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 产线休息记录数据
|
|
|
- /// </summary>
|
|
|
- private List<QualityLineWorkDetail> qualityLines;
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 节假日记录数据
|
|
|
- /// </summary>
|
|
|
- private List<HolidayMaster> holidays;
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 生产排产
|
|
|
/// </summary>
|
|
|
private readonly ProductionScheduleAppService _productionScheduleAppService;
|
|
|
- private readonly IRepository<mo_srm_pr_main, long> _srm_pr_main;
|
|
|
- private IRepository<srm_pr_main, long> _mysql_srm_pr_main;
|
|
|
- private readonly IRepository<mo_srm_po_main, long> _srm_po_main;
|
|
|
- private IRepository<srm_po_main, long> _mysql_srm_po_main;
|
|
|
- private readonly IRepository<mo_srm_po_list, long> _srm_po_list;
|
|
|
- private IRepository<srm_po_list, long> _mysql_srm_po_list;
|
|
|
-
|
|
|
- private IRepository<b_mo_order, long> _mysql_b_mo_order;
|
|
|
|
|
|
public SystemJobAppService(
|
|
|
IRepository<ic_bom, long> mysql_ic_bom,
|
|
|
@@ -217,36 +126,10 @@ namespace Business.SystemJobManagement
|
|
|
ISqlRepository<ConsigneeAddressMaster> consigneeAddressMaster,
|
|
|
ISqlRepository<ItemMaster> itemMaster,
|
|
|
ISqlRepository<ProductStructureMaster> productStructureMaster,
|
|
|
- ISqlRepository<WorkOrdMaster> workOrdMaster,
|
|
|
- ISqlRepository<WorkOrdDetail> workOrdDetail,
|
|
|
- ISqlRepository<WorkOrdRouting> workOrdRouting,
|
|
|
- ISqlRepository<ProdLineDetail> prodLineDetail,
|
|
|
- ISqlRepository<PeriodSequenceDet> periodSequenceDet,
|
|
|
- ISqlRepository<ScheduleResultOpMaster> scheduleResultOpMaster,
|
|
|
- ISqlRepository<InvMaster> invMaster,
|
|
|
- ISqlRepository<ShopCalendarWorkCtr> shopCalendarWorkCtr,
|
|
|
- ISqlRepository<QualityLineWorkDetail> qualityLineWorkDetail,
|
|
|
- ISqlRepository<HolidayMaster> holidayMaster,
|
|
|
- ICurrentTenant currentTenant,
|
|
|
- IRepository<mo_ic_bom,long> ic_bom,
|
|
|
- IRepository<mo_ic_bom_child,long> ic_bom_child,
|
|
|
- IRepository<mo_ic_item, long> ic_item,
|
|
|
- IRepository<mo_ic_substitute, long> ic_substitute,
|
|
|
- IRepository<mo_ic_substitute_group, long> ic_substitute_group,
|
|
|
- IRepository<mo_ic_substitute_group_detail, long> ic_substitute_group_detail,
|
|
|
- IRepository<mo_srm_supplier, long> srm_supplier,
|
|
|
IRepository<mo_mes_technique, long> mes_technique,
|
|
|
IRepository<mo_mes_process, long> mes_process,
|
|
|
IRepository<mo_mes_tech_process, long> mes_tech_process,
|
|
|
- IRepository<mo_srm_purchase, long> srm_purchase,
|
|
|
ProductionScheduleAppService productionScheduleAppService,
|
|
|
- IRepository<b_mo_order, long> mysql_b_mo_order,
|
|
|
- IRepository<mo_srm_pr_main, long> srm_pr_main,
|
|
|
- IRepository<srm_pr_main, long> mysql_srm_pr_main,
|
|
|
- IRepository<mo_srm_po_list, long> srm_po_list,
|
|
|
- IRepository<srm_po_list, long> mysql_srm_po_list,
|
|
|
- IRepository<mo_srm_po_main, long> srm_po_main,
|
|
|
- IRepository<srm_po_main, long> mysql_srm_po_main,
|
|
|
BusinessDbContext businessDbContext
|
|
|
)
|
|
|
{
|
|
|
@@ -269,37 +152,11 @@ namespace Business.SystemJobManagement
|
|
|
_consigneeAddressMaster = consigneeAddressMaster;
|
|
|
_itemMaster = itemMaster;
|
|
|
_productStructureMaster = productStructureMaster;
|
|
|
- _ic_bom = ic_bom;
|
|
|
- _ic_bom_child = ic_bom_child;
|
|
|
- _ic_item = ic_item;
|
|
|
- _ic_substitute = ic_substitute;
|
|
|
- _ic_substitute_group = ic_substitute_group;
|
|
|
- _ic_substitute_group_detail = ic_substitute_group_detail;
|
|
|
- _srm_supplier = srm_supplier;
|
|
|
_mes_technique = mes_technique;
|
|
|
_mes_process = mes_process;
|
|
|
_mes_tech_process = mes_tech_process;
|
|
|
- _srm_purchase = srm_purchase;
|
|
|
_businessDbContext = businessDbContext;
|
|
|
_itemMaster = itemMaster;
|
|
|
- _workOrdMaster = workOrdMaster;
|
|
|
- _workOrdDetail = workOrdDetail;
|
|
|
- _workOrdRouting = workOrdRouting;
|
|
|
- _prodLineDetail = prodLineDetail;
|
|
|
- _periodSequenceDet = periodSequenceDet;
|
|
|
- _scheduleResultOpMaster = scheduleResultOpMaster;
|
|
|
- _invMaster = invMaster;
|
|
|
- _shopCalendarWorkCtr = shopCalendarWorkCtr;
|
|
|
- _qualityLineWorkDetail = qualityLineWorkDetail;
|
|
|
- _holidayMaster = holidayMaster;
|
|
|
- _currentTenant = currentTenant;
|
|
|
- _mysql_b_mo_order = mysql_b_mo_order;
|
|
|
- _mysql_srm_po_list = mysql_srm_po_list;
|
|
|
- _srm_po_list = srm_po_list;
|
|
|
- _mysql_srm_po_main = mysql_srm_po_main;
|
|
|
- _srm_po_main = srm_po_main;
|
|
|
- _mysql_srm_pr_main = mysql_srm_pr_main;
|
|
|
- _srm_pr_main = srm_pr_main;
|
|
|
_productionScheduleAppService = productionScheduleAppService;
|
|
|
}
|
|
|
|
|
|
@@ -339,176 +196,92 @@ namespace Business.SystemJobManagement
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- //var srm_purchase1 = _mysql_srm_pr_main.GetListAsync().Result;
|
|
|
- //if (srm_purchase1.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await MongoHelper<mo_srm_pr_main>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
- // var mosrm_purchase = ObjectMapper.Map<List<srm_pr_main>, List<mo_srm_pr_main>>(srm_purchase1);
|
|
|
- // mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // await MongoHelper<mo_srm_pr_main>.InsertManyAsync(mosrm_purchase);
|
|
|
- //}
|
|
|
-
|
|
|
- //var srm_purchase2 = _mysql_srm_po_main.GetListAsync().Result;
|
|
|
- //if (srm_purchase2.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await MongoHelper<mo_srm_po_main>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
- // var mosrm_purchase = ObjectMapper.Map<List<srm_po_main>, List<mo_srm_po_main>>(srm_purchase2);
|
|
|
- // mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // await MongoHelper<mo_srm_po_main>.InsertManyAsync(mosrm_purchase);
|
|
|
- //}
|
|
|
-
|
|
|
- //var srm_purchase3 = _mysql_srm_po_list.GetListAsync().Result;
|
|
|
- //if (srm_purchase3.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await MongoHelper<mo_srm_po_list>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
- // var mosrm_purchase = ObjectMapper.Map<List<srm_po_list>, List<mo_srm_po_list>>(srm_purchase3);
|
|
|
- // mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // await MongoHelper<mo_srm_po_list>.InsertManyAsync(mosrm_purchase);
|
|
|
- //}
|
|
|
//物料采购报价单
|
|
|
- //List<srm_purchase> srm_purchases = _mysql_srm_purchase.GetListAsync().Result;
|
|
|
- //if (srm_purchases.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _srm_purchase.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var mosrm_purchase = ObjectMapper.Map<List<srm_purchase>, List<mo_srm_purchase>>(srm_purchases);
|
|
|
- // mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //_srm_purchase.InsertManyAsync(mosrm_purchase);
|
|
|
- // await MongoHelper<mo_srm_purchase>.InsertManyAsync(mosrm_purchase);
|
|
|
- //}
|
|
|
+ List<srm_purchase> srm_purchases = _mysql_srm_purchase.GetListAsync().Result;
|
|
|
+ if (srm_purchases.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_srm_purchase>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var mosrm_purchase = ObjectMapper.Map<List<srm_purchase>, List<mo_srm_purchase>>(srm_purchases);
|
|
|
+ mosrm_purchase.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_srm_purchase>.InsertManyAsync(mosrm_purchase);
|
|
|
+ }
|
|
|
//同步物料BOM明细数据
|
|
|
- //var icbom_childs = _mysql_ic_bom_child.GetListAsync().Result;
|
|
|
- //if (icbom_childs.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // //await _ic_bom_child.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // await MongoHelper<mo_ic_bom_child>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
- // var moIcbom_childs = ObjectMapper.Map<List<ic_bom_child>, List<mo_ic_bom_child>>(icbom_childs);
|
|
|
- // moIcbom_childs.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_bom_child.InsertManyAsync(moIcbom_childs);
|
|
|
- // await MongoHelper<mo_ic_bom_child>.InsertManyAsync(moIcbom_childs);
|
|
|
- //}
|
|
|
-
|
|
|
- ////同步物料Bom数据
|
|
|
- //var icBoms = _mysql_ic_bom.GetListAsync().Result;
|
|
|
- //if (icBoms.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _ic_bom.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moIcBoms = ObjectMapper.Map<List<ic_bom>, List<mo_ic_bom>>(icBoms);
|
|
|
- // moIcBoms.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_bom.InsertManyAsync(moIcBoms);
|
|
|
- // await MongoHelper<mo_ic_bom>.InsertManyAsync(moIcBoms);
|
|
|
- //}
|
|
|
+ var icbom_childs = _mysql_ic_bom_child.GetListAsync().Result;
|
|
|
+ if (icbom_childs.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_bom_child>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moIcbom_childs = ObjectMapper.Map<List<ic_bom_child>, List<mo_ic_bom_child>>(icbom_childs);
|
|
|
+ moIcbom_childs.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_bom_child>.InsertManyAsync(moIcbom_childs);
|
|
|
+ }
|
|
|
+
|
|
|
+ //同步物料Bom数据
|
|
|
+ var icBoms = _mysql_ic_bom.GetListAsync().Result;
|
|
|
+ if (icBoms.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_bom>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moIcBoms = ObjectMapper.Map<List<ic_bom>, List<mo_ic_bom>>(icBoms);
|
|
|
+ moIcBoms.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_bom>.InsertManyAsync(moIcBoms);
|
|
|
+ }
|
|
|
|
|
|
//同步物料数据
|
|
|
- //var icItems = _mysql_ic_item.GetListAsync().Result;
|
|
|
- //if (icItems.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await MongoHelper<mo_ic_item>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
- // var moIcItems = ObjectMapper.Map<List<ic_item>, List<mo_ic_item>>(icItems);
|
|
|
- // moIcItems.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_item.InsertManyAsync(moIcItems);
|
|
|
- // await MongoHelper<mo_ic_item>.InsertManyAsync(moIcItems);
|
|
|
- //}
|
|
|
+ var icItems = _mysql_ic_item.GetListAsync().Result;
|
|
|
+ if (icItems.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_item>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moIcItems = ObjectMapper.Map<List<ic_item>, List<mo_ic_item>>(icItems);
|
|
|
+ moIcItems.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_item>.InsertManyAsync(moIcItems);
|
|
|
+ }
|
|
|
|
|
|
//同步替代群组数据
|
|
|
- //var subtitutes = _mysql_ic_substitute.GetListAsync().Result;
|
|
|
- //if (subtitutes.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _ic_substitute.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moSubtitutes = ObjectMapper.Map<List<ic_substitute>, List<mo_ic_substitute>>(subtitutes);
|
|
|
- // moSubtitutes.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_substitute.InsertManyAsync(moSubtitutes);
|
|
|
- // await MongoHelper<mo_ic_substitute>.InsertManyAsync(moSubtitutes);
|
|
|
- //}
|
|
|
+ var subtitutes = _mysql_ic_substitute.GetListAsync().Result;
|
|
|
+ if (subtitutes.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_substitute>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moSubtitutes = ObjectMapper.Map<List<ic_substitute>, List<mo_ic_substitute>>(subtitutes);
|
|
|
+ moSubtitutes.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_substitute>.InsertManyAsync(moSubtitutes);
|
|
|
+ }
|
|
|
|
|
|
//同步物料替代多群组数据
|
|
|
- //var subAlls = _mysql_ic_substitute_group.GetListAsync().Result;
|
|
|
- //if (subAlls.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _ic_substitute_group.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moSubAlls = ObjectMapper.Map<List<ic_substitute_group>, List<mo_ic_substitute_group>>(subAlls);
|
|
|
- // moSubAlls.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_substitute_group.InsertManyAsync(moSubAlls);
|
|
|
- // await MongoHelper<mo_ic_substitute_group>.InsertManyAsync(moSubAlls);
|
|
|
- //}
|
|
|
+ var subAlls = _mysql_ic_substitute_group.GetListAsync().Result;
|
|
|
+ if (subAlls.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_substitute_group>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moSubAlls = ObjectMapper.Map<List<ic_substitute_group>, List<mo_ic_substitute_group>>(subAlls);
|
|
|
+ moSubAlls.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_substitute_group>.InsertManyAsync(moSubAlls);
|
|
|
+ }
|
|
|
|
|
|
//同步物料替代多群组明细数据
|
|
|
- //var subAllDtls = _mysql_ic_substitute_group_detail.GetListAsync().Result;
|
|
|
- //if (subAllDtls.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _ic_substitute_group_detail.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moSubAllDtls = ObjectMapper.Map<List<ic_substitute_group_detail>, List<mo_ic_substitute_group_detail>>(subAllDtls);
|
|
|
- // moSubAllDtls.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_ic_substitute_group_detail.InsertManyAsync(moSubAllDtls);
|
|
|
- // await MongoHelper<mo_ic_substitute_group_detail>.InsertManyAsync(moSubAllDtls);
|
|
|
- //}
|
|
|
+ var subAllDtls = _mysql_ic_substitute_group_detail.GetListAsync().Result;
|
|
|
+ if (subAllDtls.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_ic_substitute_group_detail>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moSubAllDtls = ObjectMapper.Map<List<ic_substitute_group_detail>, List<mo_ic_substitute_group_detail>>(subAllDtls);
|
|
|
+ moSubAllDtls.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_ic_substitute_group_detail>.InsertManyAsync(moSubAllDtls);
|
|
|
+ }
|
|
|
|
|
|
//同步供应商数据
|
|
|
- //var suppliers = _mysql_srm_supplier.GetListAsync().Result;
|
|
|
- //if (suppliers.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _srm_supplier.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moSuppliers = ObjectMapper.Map<List<srm_supplier>, List<mo_srm_supplier>>(suppliers);
|
|
|
- // moSuppliers.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_srm_supplier.InsertManyAsync(moSuppliers);
|
|
|
- // await MongoHelper<mo_srm_supplier>.InsertManyAsync(moSuppliers);
|
|
|
- //}
|
|
|
-
|
|
|
- //同步工艺路径数据
|
|
|
- //var techs = _mysql_mes_technique.GetListAsync().Result;
|
|
|
- //if (techs.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _mes_technique.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moTechs = ObjectMapper.Map<List<mes_technique>, List<mo_mes_technique>>(techs);
|
|
|
- // moTechs.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_mes_technique.InsertManyAsync(moTechs);
|
|
|
- // await MongoHelper<mo_mes_technique>.InsertManyAsync(moTechs);
|
|
|
- //}
|
|
|
-
|
|
|
- //同步工序数据
|
|
|
- //var processes = _mysql_mes_process.GetListAsync().Result;
|
|
|
- //if (processes.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _mes_process.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moProcesses = ObjectMapper.Map<List<mes_process>, List<mo_mes_process>>(processes);
|
|
|
- // moProcesses.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_mes_process.InsertManyAsync(moProcesses);
|
|
|
- // await MongoHelper<mo_mes_process>.InsertManyAsync(moProcesses);
|
|
|
- //}
|
|
|
-
|
|
|
- //同步工艺关联工序数据
|
|
|
- //var tech_procs = _mysql_mes_tech_process.GetListAsync().Result;
|
|
|
- //if (tech_procs.Count > 0)
|
|
|
- //{
|
|
|
- // //先清空表数据
|
|
|
- // await _mes_tech_process.DeleteAsync(p => p.mysql_id != -1);
|
|
|
- // var moTech_procs = ObjectMapper.Map<List<mes_tech_process>, List<mo_mes_tech_process>>(tech_procs);
|
|
|
- // moTech_procs.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
- // //插入数据
|
|
|
- // //_mes_tech_process.InsertManyAsync(moTech_procs);
|
|
|
- // await MongoHelper<mo_mes_tech_process>.InsertManyAsync(moTech_procs);
|
|
|
- //}
|
|
|
+ var suppliers = _mysql_srm_supplier.GetListAsync().Result;
|
|
|
+ if (suppliers.Count > 0)
|
|
|
+ {
|
|
|
+ //先清空表数据
|
|
|
+ await MongoHelper<mo_srm_supplier>.DeleteManyAsync(p => p.mysql_id != -1);
|
|
|
+ var moSuppliers = ObjectMapper.Map<List<srm_supplier>, List<mo_srm_supplier>>(suppliers);
|
|
|
+ moSuppliers.ForEach(s => s.GenerateNewId(help.NextId()));
|
|
|
+ await MongoHelper<mo_srm_supplier>.InsertManyAsync(moSuppliers);
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|