|
|
@@ -648,13 +648,13 @@ namespace Business.ResourceExamineManagement
|
|
|
//}
|
|
|
////获取订单行数据
|
|
|
var sentrys = await _mysql_crm_seorderentry.GetListAsync(p => (p.progress == "1" || p.progress == "2") && p.company_id.ToString() == companyid && !p.IsDeleted);
|
|
|
- var seorders = _mysql_crm_seorder.GetListAsync(s => sentrys.Select(x => x.seorder_id.GetValueOrDefault()).Contains(s.Id) && s.company_id.ToString() == companyid).Result;
|
|
|
- string ids = string.Join(',', seorders.Select(x => x.Id));
|
|
|
- var rtn = await ReceiveResult(ids, 0, companyid);
|
|
|
- if (rtn == "ok")
|
|
|
- {
|
|
|
- rtn = await ReviewExamineResult(ids, 0);
|
|
|
- }
|
|
|
+ var seorders = _mysql_crm_seorder.GetListAsync(s => sentrys.Select(x => x.seorder_id.GetValueOrDefault()).Contains(s.Id) && s.company_id.ToString() == companyid).Result;
|
|
|
+ string ids = string.Join(',', seorders.Select(x => x.Id));
|
|
|
+ var rtn = await ReceiveResult(ids, 0, companyid);
|
|
|
+ if (rtn == "ok")
|
|
|
+ {
|
|
|
+ rtn = await ReviewExamineResult(ids, 0);
|
|
|
+ }
|
|
|
return rtn;
|
|
|
}
|
|
|
|
|
|
@@ -672,7 +672,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//{
|
|
|
// return "此账号已限制访问";
|
|
|
//}
|
|
|
- if (string.IsNullOrEmpty(ids))
|
|
|
+ if (string.IsNullOrEmpty(ids))
|
|
|
{
|
|
|
throw new NotImplementedException("请输入正确的订单号!");
|
|
|
}
|
|
|
@@ -730,7 +730,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//资源检查明细list
|
|
|
List<ExamineResult> examines = new List<ExamineResult>();
|
|
|
ExamineResult dtl;
|
|
|
-
|
|
|
+
|
|
|
//var oldwork = _mysql_mes_moentry.GetListAsync(m => sentrys.Select(s => s.Id).ToList().Contains(m.soentry_id.GetValueOrDefault())).Result;
|
|
|
//if (oldwork.Any())
|
|
|
//{
|
|
|
@@ -738,7 +738,7 @@ namespace Business.ResourceExamineManagement
|
|
|
// var workord = _workOrdMaster.Select(w=> oldwork.Select(m=>m.moentry_mono).ToList().Contains(w.WorkOrd)).ToList();
|
|
|
// if (workord.Any())
|
|
|
// {
|
|
|
-
|
|
|
+
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
@@ -853,7 +853,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//TODO:最早开始时间默认3天后(后期调整,因为要计算排产,计算产能这一类,才能得到开工时间)
|
|
|
dtl.earliest_times = dtl.kitting_times.AddDays(1);
|
|
|
//再评审状态改为确认
|
|
|
- item.progress = item.progress=="0"?"3": "2";
|
|
|
+ item.progress = item.progress == "0" ? "3" : "2";
|
|
|
//替代关系展开list
|
|
|
dtl.BomChildExamineList = getBomList;
|
|
|
//添加订单行开工信息
|
|
|
@@ -1067,7 +1067,7 @@ namespace Business.ResourceExamineManagement
|
|
|
plist.ForEach(o =>
|
|
|
{
|
|
|
o.bom_child_examine_id = bc_ex.Id; o.company_id = param.company_id; o.tenant_id = param.company_id;
|
|
|
- o.factory_id = param.factoryId;o.create_time = DateTime.Now;
|
|
|
+ o.factory_id = param.factoryId; o.create_time = DateTime.Now;
|
|
|
});
|
|
|
purchaseList.AddRange(plist);
|
|
|
}
|
|
|
@@ -1406,7 +1406,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
_businessDbContext.BulkUpdate(occupylist);
|
|
|
}
|
|
|
- await unitOfWork.CompleteAsync();
|
|
|
+ await unitOfWork.CompleteAsync();
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
@@ -1649,8 +1649,8 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
var detailNbrList = _purOrdDetail.Select(a => a.Domain == poaction.poMasterList[0].Domain && nbrs.Contains(a.PurOrd));
|
|
|
poaction.poDetailBatchList.ForEach(b => {
|
|
|
-
|
|
|
- var detail= detailNbrList.Where(d=>d.PurOrd==b.PurOrd && d.Line==b.Line).FirstOrDefault();
|
|
|
+
|
|
|
+ var detail = detailNbrList.Where(d => d.PurOrd == b.PurOrd && d.Line == b.Line).FirstOrDefault();
|
|
|
if (detail != null)
|
|
|
{
|
|
|
b.PurOrdDetailRecID = detail.RecID;
|
|
|
@@ -1658,7 +1658,7 @@ namespace Business.ResourceExamineManagement
|
|
|
});
|
|
|
_purOrdDetailBatch.Insert(poaction.poDetailBatchList);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
await unitOfWork.CompleteAsync();
|
|
|
}
|
|
|
@@ -2741,7 +2741,7 @@ namespace Business.ResourceExamineManagement
|
|
|
ReqLine = 1,
|
|
|
Typed = poType == 1 ? "" : "s",
|
|
|
Project = poType == 1 ? "" : "3",
|
|
|
- Drawing= refItem?.Drawing,
|
|
|
+ Drawing = refItem?.Drawing,
|
|
|
Status = ""
|
|
|
});
|
|
|
});
|
|
|
@@ -2753,11 +2753,11 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async Task<List<PurOrdDetailBatch>> GetPurOrdDetailBatches(List<PurOrdDetail> purOrdDetails,string domain,string company_id)
|
|
|
+ public async Task<List<PurOrdDetailBatch>> GetPurOrdDetailBatches(List<PurOrdDetail> purOrdDetails, string domain, string company_id)
|
|
|
{
|
|
|
List<PurOrdDetailBatch> purOrdDetailBatches = new List<PurOrdDetailBatch>();
|
|
|
- var icbomList = _mysql_ic_bom.GetListAsync(i => purOrdDetails.Select(p=>p.ItemNum).Contains(i.bom_number)).Result;
|
|
|
- var allBomlist = _mysql_b_bom_pretreatment.GetListAsync(b => icbomList.Select(c=>c.Id).Contains(b.sourceid)).Result;
|
|
|
+ var icbomList = _mysql_ic_bom.GetListAsync(i => purOrdDetails.Select(p => p.ItemNum).Contains(i.bom_number)).Result;
|
|
|
+ var allBomlist = _mysql_b_bom_pretreatment.GetListAsync(b => icbomList.Select(c => c.Id).Contains(b.sourceid)).Result;
|
|
|
var itemList = _itemMaster.Select(m => allBomlist.Select(b => b.item_number).ToList().Contains(m.ItemNum));
|
|
|
//生成当前计算bangid
|
|
|
long bangid = help.NextId();
|
|
|
@@ -2778,10 +2778,10 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
//物料库存表
|
|
|
List<mo_ic_item_stock> stocklist = new List<mo_ic_item_stock>();
|
|
|
- var bomitem = bomList.Where(b=>!string.IsNullOrEmpty(b.substitute_code)).ToList();
|
|
|
+ var bomitem = bomList.Where(b => !string.IsNullOrEmpty(b.substitute_code)).ToList();
|
|
|
var itemBomList = ObjectMapper.Map<b_bom_pretreatment, BomChildExamineDto>(bomitem.First());
|
|
|
var getBomList = ObjectMapper.Map<List<b_bom_pretreatment>, List<BomChildExamineDto>>(bomList);
|
|
|
- var icitemlist = _ic_item.GetListAsync(i => bomList.Select(b=>b.item_number).Contains(i.number)).Result;
|
|
|
+ var icitemlist = _ic_item.GetListAsync(i => bomList.Select(b => b.item_number).Contains(i.number)).Result;
|
|
|
var lista = _ic_item_stock.GetListAsync(p => p.factory_id == param.factoryId && p.bang_id == bangid && icitemlist.Select(i => i.mysql_id).Contains(p.icitem_id)).Result;
|
|
|
//物料库存
|
|
|
stocklist.AddRange(lista);
|
|
|
@@ -2816,13 +2816,13 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- batchs.Add(groupList.OrderBy(g=> g.substitute_all_num).First());
|
|
|
-
|
|
|
+ batchs.Add(groupList.OrderBy(g => g.substitute_all_num).First());
|
|
|
+
|
|
|
}
|
|
|
if (groupList.Count == subBomList.Count) break;
|
|
|
else subBomList.RemoveAll(groupList);
|
|
|
}
|
|
|
- batchs.AddRange(getBomList.Where(b => string.IsNullOrEmpty(b.substitute_code) && b.item_number!=a.ItemNum).ToList());
|
|
|
+ batchs.AddRange(getBomList.Where(b => string.IsNullOrEmpty(b.substitute_code) && b.item_number != a.ItemNum).ToList());
|
|
|
short num = 1;
|
|
|
foreach (var item in batchs)
|
|
|
{
|
|
|
@@ -3153,7 +3153,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
var maxQtyform = nbrDs.Max(x => x.QtyFrom);
|
|
|
var minQtyform = nbrDs.Min(x => x.QtyFrom);
|
|
|
if (minQtyform > 0)
|
|
|
@@ -3560,7 +3560,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
if (stateText != "")
|
|
|
{
|
|
|
- return "当前工单为【"+ stateText + "】,不允许进行在库检";
|
|
|
+ return "当前工单为【" + stateText + "】,不允许进行在库检";
|
|
|
}
|
|
|
List<mes_morder> morders = _mysql_mes_morder.GetListAsync(x => domain == x.factory_id.ToString() && x.morder_no == workord && (string.IsNullOrEmpty(x.morder_state) || x.morder_state == MorderEnum.Initial_state || x.morder_state == MorderEnum.Xd_state) && !x.IsDeleted).Result;
|
|
|
if (!morders.Any())
|
|
|
@@ -4097,7 +4097,7 @@ namespace Business.ResourceExamineManagement
|
|
|
if (routings.Any() && mo != null)
|
|
|
{
|
|
|
//最大生产数量
|
|
|
- var QtyComplete=routings.Max(r => r.QtyComplete);
|
|
|
+ var QtyComplete = routings.Max(r => r.QtyComplete);
|
|
|
//修改订单需求数为在制数量
|
|
|
mo.need_number = mo.need_number - QtyComplete;
|
|
|
work.OpQtyCompleted = QtyComplete;
|
|
|
@@ -4145,7 +4145,7 @@ namespace Business.ResourceExamineManagement
|
|
|
continue;
|
|
|
}
|
|
|
var sentry = sentrys.Find(s => s.Id == moentry.soentry_id);
|
|
|
-
|
|
|
+
|
|
|
//工单资源检查信息
|
|
|
ExamineResult dtl = new ExamineResult();
|
|
|
dtl.morder_id = item.Id;
|
|
|
@@ -4201,7 +4201,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//物料齐套时间
|
|
|
dtl.kitting_times = getBomList.Where(p => p.is_use && p.kitting_time != null).OrderByDescending(m => m.kitting_time).First().kitting_time.GetValueOrDefault();
|
|
|
//kitting_time=null为自制组件跳过数据未进行计算,kitting_state=0的数据未参与计算
|
|
|
- var qllist = getBomList.Where(x => x.use_qty == 0 && x.kitting_time != null && x.needCount != 0 && x.erp_cls!=4 && x.level != 1 && x.kitting_state != 0).ToList();
|
|
|
+ var qllist = getBomList.Where(x => x.use_qty == 0 && x.kitting_time != null && x.needCount != 0 && x.erp_cls != 4 && x.level != 1 && x.kitting_state != 0).ToList();
|
|
|
var work = workOrds.Find(x => x.WorkOrd == item.morder_no);
|
|
|
if (qllist.Any())
|
|
|
{
|
|
|
@@ -4209,7 +4209,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- qllist = getBomList.Where(x => x.use_qty > 0 && x.kitting_time != null && x.needCount != 0 && x.erp_cls != 4 && x.level ==2 && x.kitting_state==1).ToList();
|
|
|
+ qllist = getBomList.Where(x => x.use_qty > 0 && x.kitting_time != null && x.needCount != 0 && x.erp_cls != 4 && x.level == 2 && x.kitting_state == 1).ToList();
|
|
|
if (qllist.Any())
|
|
|
{
|
|
|
//按比例计算成品齐套个数
|
|
|
@@ -4218,7 +4218,7 @@ namespace Business.ResourceExamineManagement
|
|
|
else
|
|
|
{
|
|
|
work.LocationStock = 0;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
//替代关系展开list
|
|
|
dtl.BomChildExamineList = getBomList;
|
|
|
@@ -4472,7 +4472,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
var workOrdRoutings = _workOrdRouting.Select(a => mo_Mes_Morders.Select(p => p.morder_no).Contains(a.WorkOrd) && a.Domain == param.factoryId.ToString() && a.IsActive).ToList();
|
|
|
//清理工单物料明细
|
|
|
- var delWorkOrddetails = _workOrdDetail.Select(x => workOrds.Select(c => c.RecID).Contains((int)x.WorkOrdMasterRecID) && x.Domain == param.factoryId.ToString());
|
|
|
+ var workOrdDetails = _workOrdDetail.Select(x => workOrds.Select(c => c.RecID).Contains((int)x.WorkOrdMasterRecID) && x.Domain == param.factoryId.ToString());
|
|
|
//资源检查结果
|
|
|
PschedDto rtn = new PschedDto();
|
|
|
//资源检查明细list
|
|
|
@@ -4501,45 +4501,33 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
List<mo_ic_bom> boms = _ic_bom.GetListAsync(p => mo_Mes_Morders.Select(m => m.bom_number).Contains(p.bom_number) && p.factory_id == param.factoryId && p.company_id == param.company_id && !p.IsDeleted).Result.ToList();
|
|
|
|
|
|
+ //List<mo_ic_item> Items = _ic_item.GetListAsync(p => mo_Mes_Morders.Select(m => m.bom_number).Contains(p.number) && !p.IsDeleted).Result;
|
|
|
//删除同步Mysql后旧数据
|
|
|
await DeleteMySqlOldData(sentrys);
|
|
|
//物料信息
|
|
|
- List<mo_ic_item> icitemlist = new List<mo_ic_item>();
|
|
|
+ List<mo_ic_item> icitemlist = _ic_item.GetListAsync(p => (mo_Mes_Morders.Select(m => m.bom_number).Contains(p.number) || workOrdDetails.Select(w => w.ItemNum).Contains(p.number)) && !p.IsDeleted).Result;
|
|
|
+ //new List<mo_ic_item>();
|
|
|
|
|
|
//物料库存表
|
|
|
List<mo_ic_item_stock> stocklist = new List<mo_ic_item_stock>();
|
|
|
//物料占用记录
|
|
|
List<mo_ic_item_stockoccupy> sklist = new List<mo_ic_item_stockoccupy>();
|
|
|
//工单物料信息组成bom清单
|
|
|
- List<b_bom_pretreatment> pretreatments = new List<b_bom_pretreatment>();
|
|
|
- workOrds.ForEach(x => {
|
|
|
- b_bom_pretreatment bomChildExamineDto = new b_bom_pretreatment();
|
|
|
- //bomChildExamineDto.fid = "";
|
|
|
- //bomChildExamineDto.bom_child_id = "";
|
|
|
- //bomChildExamineDto.bom_id = "";
|
|
|
- //bomChildExamineDto.bom_number = "";
|
|
|
- //bomChildExamineDto.qty = "";
|
|
|
- //bomChildExamineDto.erp_cls = "";
|
|
|
- //bomChildExamineDto.sourceid = "";
|
|
|
- //bomChildExamineDto.company_id = "";
|
|
|
- //bomChildExamineDto.Scrap = "";
|
|
|
- //bomChildExamineDto.item_id = "";
|
|
|
- //bomChildExamineDto.item_name = "";
|
|
|
- //bomChildExamineDto.item_number = "";
|
|
|
- //bomChildExamineDto.level = "";
|
|
|
- //bomChildExamineDto.model = "";
|
|
|
- //bomChildExamineDto.unit = "";
|
|
|
- //bomChildExamineDto.num = "";
|
|
|
- //bomChildExamineDto.parent_id = "";
|
|
|
- //bomChildExamineDto.type = "";
|
|
|
- //bomChildExamineDto.version = "";
|
|
|
- //bomChildExamineDto.wastage = "";
|
|
|
- //bomChildExamineDto.PurLT = "";
|
|
|
- //bomChildExamineDto.clean_leadtime = "";
|
|
|
- //bomChildExamineDto.factory_id = "";
|
|
|
- pretreatments.Add(bomChildExamineDto);
|
|
|
+ var pretreatments = _mysql_b_bom_pretreatment.GetListAsync(s => mo_Mes_Morders.Select(c => c.Id).ToList().Contains(s.sourceid)).Result;
|
|
|
+ int autoCreates = 0;
|
|
|
+ mo_Mes_Morders.ForEach(p =>
|
|
|
+ {
|
|
|
+ if (!pretreatments.Where(s => s.sourceid == p.Id).Any())
|
|
|
+ {
|
|
|
+ autoCreates++;
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
+ if (autoCreates>0)
|
|
|
+ {
|
|
|
+ AutoCreateBomFromOrderDetail(boms, icitemlist, mo_Mes_Morders, workOrdDetails);
|
|
|
+ pretreatments = _mysql_b_bom_pretreatment.GetListAsync(s => boms.Select(c => c.mysql_id).ToList().Contains(s.sourceid)).Result;
|
|
|
+ }
|
|
|
+
|
|
|
await AsyncItemStockFromWMS(pretreatments);
|
|
|
//数据库快照-同步mysql库数据到mongoDB中
|
|
|
await DbSnapShot(param.company_id, param.factoryId, bangid, pretreatments);
|
|
|
@@ -4679,6 +4667,88 @@ namespace Business.ResourceExamineManagement
|
|
|
return rtn;
|
|
|
}
|
|
|
|
|
|
+ public void AutoCreateBomFromOrderDetail(List<mo_ic_bom> boms, List<mo_ic_item> icitemlist, List<mes_morder> mo_Mes_Morders,List<WorkOrdDetail> workOrdDetails)
|
|
|
+ {
|
|
|
+ List<BomChildExamineDto> bomChildExamineDtos = new List<BomChildExamineDto>();
|
|
|
+ List<b_bom_pretreatment> deleteList = new List<b_bom_pretreatment>();
|
|
|
+ List<b_bom_pretreatment> addList = new List<b_bom_pretreatment>();
|
|
|
+ var pretreatment = _mysql_b_bom_pretreatment.GetListAsync(s => mo_Mes_Morders.Select(c => c.Id).ToList().Contains(s.sourceid)).Result;
|
|
|
+ if (pretreatment.Any())
|
|
|
+ {
|
|
|
+ //版本不同则重新生成
|
|
|
+ deleteList.AddRange(pretreatment);
|
|
|
+ }
|
|
|
+ mo_Mes_Morders.ForEach(x => {
|
|
|
+ var curicbom = boms.Where(p => p.bom_number == x.product_code).FirstOrDefault();
|
|
|
+ var curicitem = icitemlist.Where(p => p.number == x.product_code).FirstOrDefault();
|
|
|
+ var fid= help.NextId();
|
|
|
+ BomChildExamineDto bomChildExamineDto = new BomChildExamineDto();
|
|
|
+ bomChildExamineDto.id = help.NextId();
|
|
|
+ bomChildExamineDto.fid = fid;
|
|
|
+ bomChildExamineDto.bom_child_id = null;
|
|
|
+ bomChildExamineDto.bom_id = curicbom == null ? null : curicbom.mysql_id;
|
|
|
+ bomChildExamineDto.bom_number = x.product_code;
|
|
|
+ bomChildExamineDto.qty = 1;
|
|
|
+ bomChildExamineDto.erp_cls = curicitem == null ? 4 : curicitem.erp_cls.GetValueOrDefault();
|
|
|
+ bomChildExamineDto.item_id = curicitem == null ? 0 : curicitem.Id;
|
|
|
+ bomChildExamineDto.item_name = curicitem == null ? "" : curicitem.name;
|
|
|
+ bomChildExamineDto.item_number = x.product_code;
|
|
|
+ bomChildExamineDto.level = 1;
|
|
|
+ bomChildExamineDto.model = curicitem == null ? "" : curicitem.model;
|
|
|
+ bomChildExamineDto.unit = curicitem == null ? "" : curicitem.unit;
|
|
|
+ bomChildExamineDto.num = "1";
|
|
|
+ bomChildExamineDto.parent_id = 0;
|
|
|
+ bomChildExamineDto.type = 0;
|
|
|
+ bomChildExamineDto.PurLT = curicitem == null ? 0 : curicitem.PurLT;
|
|
|
+ bomChildExamineDto.clean_leadtime = curicitem == null ? 0 : curicitem.clean_leadtime;
|
|
|
+
|
|
|
+ workOrdDetails.ForEach(d => {
|
|
|
+ var curicbom = boms.Where(p => p.bom_number == d.ItemNum).FirstOrDefault();
|
|
|
+ var curicitem = icitemlist.Where(p => p.number == d.ItemNum).FirstOrDefault();
|
|
|
+ BomChildExamineDto bomChildExamineDto = new BomChildExamineDto();
|
|
|
+ bomChildExamineDto.id = help.NextId();
|
|
|
+ bomChildExamineDto.fid = help.NextId();
|
|
|
+ bomChildExamineDto.bom_child_id = null;
|
|
|
+ bomChildExamineDto.bom_id = null;
|
|
|
+ bomChildExamineDto.bom_number = "";
|
|
|
+ bomChildExamineDto.qty = d.FrozenBOMQty;
|
|
|
+ bomChildExamineDto.erp_cls = curicitem == null ? 4 : curicitem.erp_cls.GetValueOrDefault();
|
|
|
+ bomChildExamineDto.item_id = curicitem == null ? 0 : curicitem.Id;
|
|
|
+ bomChildExamineDto.item_name = curicitem == null ? "" : curicitem.name;
|
|
|
+ bomChildExamineDto.item_number = d.ItemNum;
|
|
|
+ bomChildExamineDto.level = 2;
|
|
|
+ bomChildExamineDto.model = curicitem == null ? "" : curicitem.model;
|
|
|
+ bomChildExamineDto.unit = curicitem == null ? "" : curicitem.unit;
|
|
|
+ bomChildExamineDto.num = "1."+d.Line;
|
|
|
+ bomChildExamineDto.parent_id = fid;
|
|
|
+ bomChildExamineDto.type = 0;
|
|
|
+ bomChildExamineDto.PurLT = curicitem == null ? 0 : curicitem.PurLT;
|
|
|
+ bomChildExamineDto.clean_leadtime = curicitem == null ? 0 : curicitem.clean_leadtime;
|
|
|
+ bomChildExamineDtos.Add(bomChildExamineDto);
|
|
|
+ });
|
|
|
+
|
|
|
+ bomChildExamineDtos.Add(bomChildExamineDto);
|
|
|
+
|
|
|
+ var list = ObjectMapper.Map<List<BomChildExamineDto>, List<b_bom_pretreatment>>(bomChildExamineDtos);
|
|
|
+ list.ForEach(s =>
|
|
|
+ {
|
|
|
+ s.sourceid = x.Id;
|
|
|
+ s.company_id = param.company_id;
|
|
|
+ s.tenant_id = param.org_id;
|
|
|
+ s.factory_id = param.factoryId;
|
|
|
+ });
|
|
|
+ addList.AddRange(list);
|
|
|
+ });
|
|
|
+ if (deleteList.Any())
|
|
|
+ {
|
|
|
+ _businessDbContext.BulkDelete(deleteList);
|
|
|
+ }
|
|
|
+ if (addList.Any())
|
|
|
+ {
|
|
|
+ _businessDbContext.BulkInsert(addList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//public void DetailDataInitialization(List<mo_ic_bom> boms, long bangid, List<mo_ic_item> icitemlist, List<mo_ic_item_stock> stocklist, List<b_bom_pretreatment> pretreatments, List<mo_ic_item_stockoccupy> sklist, bool writeNum = false)
|
|
|
//{
|
|
|
// List<long> itemIds = pretreatments.Select(p => p.item_id.GetValueOrDefault()).Distinct().ToList();
|
|
|
@@ -4789,7 +4859,10 @@ namespace Business.ResourceExamineManagement
|
|
|
public void DataInitialization(List<mo_ic_bom> boms, long bangid, List<mo_ic_item> icitemlist, List<mo_ic_item_stock> stocklist, List<b_bom_pretreatment> pretreatments, List<mo_ic_item_stockoccupy> sklist, bool writeNum = false)
|
|
|
{
|
|
|
List<long> itemIds = pretreatments.Select(p => p.item_id.GetValueOrDefault()).Distinct().ToList();
|
|
|
- icitemlist.AddRange(_ic_item.GetListAsync(p => itemIds.Contains(p.mysql_id) && !p.IsDeleted).Result);
|
|
|
+ if (!icitemlist.Any())
|
|
|
+ {
|
|
|
+ icitemlist.AddRange(_ic_item.GetListAsync(p => itemIds.Contains(p.mysql_id) && !p.IsDeleted).Result);
|
|
|
+ }
|
|
|
#region 1、数据准备
|
|
|
//产线明细
|
|
|
prodLines = _prodLineDetail.Select(p => p.Domain == param.factoryId.ToString()).ToList();
|
|
|
@@ -4862,7 +4935,7 @@ namespace Business.ResourceExamineManagement
|
|
|
_CalcBomViewAppService.holidays = holidays;
|
|
|
|
|
|
_CalcBomViewAppService.mordersList = mo_Mes_Morders;//工单
|
|
|
- _CalcBomViewAppService.moentriesList = mo_Mes_Moentry;//工单子表
|
|
|
+ _CalcBomViewAppService.moentriesList = mo_Mes_Moentry;//工单子表
|
|
|
_CalcBomViewAppService.mooccupyAllList = mes_mooccupyList;//工单占用表
|
|
|
|
|
|
_CalcBomViewAppService.srm_Po_Lists = poDetailList; //采购明细
|