|
|
@@ -390,25 +390,6 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
public async Task<string> ReceiveResult(ResourceCheckInputDto input)
|
|
|
{
|
|
|
- //TagMaster tagMaster=new TagMaster();
|
|
|
- //tagMaster.Domain = "1000";
|
|
|
- //tagMaster.Nbr = "20230505002"+DateTime.Now.Second.ToString();
|
|
|
- //tagMaster.Type = "Q";
|
|
|
- //tagMaster.Print = false;
|
|
|
- //tagMaster.Void= false;
|
|
|
- //tagMaster.Posted= false;
|
|
|
- //tagMaster.BusinessID = 0;
|
|
|
- //tagMaster.CreateUser = "admin";
|
|
|
- //tagMaster.UpdateUser = "admin";
|
|
|
- //tagMaster.CreateTime = DateTime.Now;
|
|
|
- //tagMaster.UpdateTime= DateTime.Now;
|
|
|
- //tagMaster.IsActive= true;
|
|
|
- //tagMaster.IsConfirm= true;
|
|
|
- //tagMaster.IsChanged= true;
|
|
|
- //tagMaster.InvTitle = "线边库存核查";
|
|
|
- //await _tagMasterRepository.Insert(tagMaster);
|
|
|
- //var test= _tagMasterRepository.SelectDataBaseBySql("Select * from TagMaster Where Nbr='202305050029'", "TagMaster");
|
|
|
- //return JsonConvert.SerializeObject(test);
|
|
|
//资源检查入参全局变量赋值
|
|
|
param.sorderId = input.sorderId;
|
|
|
param.tenantId = input.tenantId;
|
|
|
@@ -421,26 +402,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//资源检查明细list
|
|
|
List<ExamineResult> examines = new List<ExamineResult>();
|
|
|
ExamineResult dtl;
|
|
|
- /*if (input.sorderId == 123)
|
|
|
- {
|
|
|
- Random rd = new Random();
|
|
|
-
|
|
|
- List<ic_item_stock> itemstocklist = new List<ic_item_stock>();
|
|
|
- var iclist = _mysql_ic_item.GetListAsync(s => s.tenant_id == 101).Result;
|
|
|
- iclist.ForEach(s => {
|
|
|
- ic_item_stock stock = new ic_item_stock();
|
|
|
- stock.GenerateNewId(help.NextId());
|
|
|
- stock.icitem_id = s.Id;
|
|
|
- stock.icitem_name = s.name;
|
|
|
- stock.sqty = rd.Next(0, 300);
|
|
|
- stock.tenant_id = s.tenant_id;
|
|
|
- stock.factory_id = s.factory_id;
|
|
|
- itemstocklist.Add(stock);
|
|
|
- });
|
|
|
- await _businessDbContext.ic_item_stock.BulkInsertAsync(itemstocklist, options => options.InsertKeepIdentity = true);
|
|
|
- return "ok";
|
|
|
- }*/
|
|
|
-
|
|
|
+
|
|
|
//生成当前计算bangid
|
|
|
long bangid = help.NextId();
|
|
|
//获取订单数据
|
|
|
@@ -461,19 +423,9 @@ namespace Business.ResourceExamineManagement
|
|
|
await DbSnapShot(input.tenantId, input.factoryId, bangid);
|
|
|
|
|
|
//通过订单行的产品代码获取物料BOM数据
|
|
|
- //FilterDefinition<ic_bom> filter = Builders<ic_bom>.Filter.In(s => s.bom_number, sentrys.Select(m => m.bom_number).ToList());
|
|
|
- //List<ic_bom> boms = _ic_bom.GetManyByIds(filter).Result.Where(p => p.factory_id == input.factoryId && p.tenant_id == input.tenantId && !p.IsDeleted).ToList();
|
|
|
List<mo_ic_bom> boms = _ic_bom.Find(p => sentrys.Select(m => m.item_number).Contains(p.item_number) && p.factory_id == input.factoryId && p.tenant_id == input.tenantId && !p.IsDeleted).Result.ToList();
|
|
|
- ////物料bom
|
|
|
- //List<mo_ic_bom> bomlist = new List<mo_ic_bom>();
|
|
|
- ////物料bom明细
|
|
|
- //List<mo_ic_bom_child> bomchildlist = new List<mo_ic_bom_child>();
|
|
|
//物料信息
|
|
|
List<mo_ic_item> icitemlist = new List<mo_ic_item>();
|
|
|
- //替代关系
|
|
|
- //List<mo_ic_substitute> sublist = new List<mo_ic_substitute>();
|
|
|
- //List<mo_ic_substitute_group> suballlist = new List<mo_ic_substitute_group>();
|
|
|
- //List<mo_ic_substitute_group_detail> subdtllist = new List<mo_ic_substitute_group_detail>();
|
|
|
//物料库存表
|
|
|
List<mo_ic_item_stock> stocklist = new List<mo_ic_item_stock>();
|
|
|
//物料占用记录
|
|
|
@@ -502,8 +454,6 @@ namespace Business.ResourceExamineManagement
|
|
|
dtl.bill_no = sorder.bill_no;
|
|
|
dtl.sentry_id = item.Id;
|
|
|
dtl.entry_seq = item.entry_seq;
|
|
|
- //TODO:最早开始时间默认3天后(后期调整)
|
|
|
- dtl.earliest_times = DateTime.Now.Date.AddDays(3);
|
|
|
dtl.need_qty = item.qty.GetValueOrDefault();
|
|
|
dtl.need_time = item.plan_date;
|
|
|
//获取当前物料bom数据
|
|
|
@@ -551,10 +501,10 @@ namespace Business.ResourceExamineManagement
|
|
|
await _mes_mooccupy.InsertMany(_CalcBomViewAppService.mooccupyAllInsertList);
|
|
|
rtn.mooccupyAllList = _CalcBomViewAppService.mooccupyAllInsertList;
|
|
|
}
|
|
|
- if (_CalcBomViewAppService.moentriesList.Any())
|
|
|
+ if (_CalcBomViewAppService.moentriesInsertList.Any())
|
|
|
{
|
|
|
- await _mes_moentry.InsertMany(_CalcBomViewAppService.moentriesList);
|
|
|
- var mesmoentrys = ObjectMapper.Map<List<mo_mes_moentry>, List<mes_moentry>>(_CalcBomViewAppService.moentriesList);
|
|
|
+ await _mes_moentry.InsertMany(_CalcBomViewAppService.moentriesInsertList);
|
|
|
+ var mesmoentrys = ObjectMapper.Map<List<mo_mes_moentry>, List<mes_moentry>>(_CalcBomViewAppService.moentriesInsertList);
|
|
|
_businessDbContext.BulkInsert(mesmoentrys);
|
|
|
}
|
|
|
if (_CalcBomViewAppService.orderList.Any())
|
|
|
@@ -784,7 +734,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
List<long> sentryids = soentry_id.Select(p => p.Id).ToList();
|
|
|
//删除工单相关表数据
|
|
|
- var mes_moentry = _mysql_mes_moentry.GetListAsync(x => sentryids.Contains(x.soentry_id.Value)).Result;
|
|
|
+ /*var mes_moentry = _mysql_mes_moentry.GetListAsync(x => sentryids.Contains(x.soentry_id.Value)).Result;
|
|
|
|
|
|
var mes_morder = _mysql_mes_morder.GetListAsync(x => mes_moentry.Select(p => p.moentry_moid).ToList().Contains(x.Id)).Result;
|
|
|
if (mes_moentry.Count > 0)
|
|
|
@@ -794,27 +744,22 @@ namespace Business.ResourceExamineManagement
|
|
|
if (mes_morder.Count > 0)
|
|
|
{
|
|
|
await _mysql_mes_morder.DeleteManyAsync(mes_morder);
|
|
|
- }
|
|
|
+ }*/
|
|
|
var mysql_mes_mooccupy = _mysql_mes_mooccupy.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.moo_id_billid.Value)).Result;
|
|
|
if (mysql_mes_mooccupy.Count > 0)
|
|
|
{
|
|
|
await _mysql_mes_mooccupy.DeleteManyAsync(mysql_mes_mooccupy);
|
|
|
}
|
|
|
- var mysql_mes_ooder = _mysql_mes_oorder.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.sentry_id.GetValueOrDefault())).Result;
|
|
|
- if (mysql_mes_ooder.Count > 0)
|
|
|
- {
|
|
|
- await _mysql_mes_oorder.DeleteManyAsync(mysql_mes_ooder);
|
|
|
- }
|
|
|
var srm_pr_main = _mysql_srm_pr_main.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.sentry_id.GetValueOrDefault())).Result;
|
|
|
if (srm_pr_main.Count > 0)
|
|
|
{
|
|
|
await _mysql_srm_pr_main.DeleteManyAsync(srm_pr_main);
|
|
|
}
|
|
|
- var mes_oorders = _mysql_mes_oorder.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.sentry_id.GetValueOrDefault())).Result;
|
|
|
+ /*var mes_oorders = _mysql_mes_oorder.GetListAsync(x => soentry_id.Select(p => p.Id).Contains(x.sentry_id.GetValueOrDefault())).Result;
|
|
|
if (mes_oorders.Count > 0)
|
|
|
{
|
|
|
await _mysql_mes_oorder.DeleteManyAsync(mes_oorders);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -2290,6 +2235,7 @@ namespace Business.ResourceExamineManagement
|
|
|
//主工单
|
|
|
List<mo_mes_morder> mo_Mes_Morders = _mes_morder.GetManyByCondition(x => boms.Select(p => p.bom_number).Contains(x.bom_number) && (x.morder_state != MorderEnum.Accomplish_state || x.morder_state != MorderEnum.Close_state
|
|
|
&& x.morder_icitem_type != MorderEnum.XgwyMorder) && !x.IsDeleted && x.tenant_id == param.tenantId && x.bang_id == bangid).Result;
|
|
|
+ List<mo_mes_moentry> mo_Mes_Moentry = _mes_moentry.GetManyByCondition(x => mo_Mes_Morders.Select(p => p.id).Contains(x.moentry_moid.GetValueOrDefault())).Result;
|
|
|
//工单占用表
|
|
|
List<mo_mes_mooccupy> mes_mooccupyList = _mes_mooccupy.GetManyByCondition(x => x.moo_state == 1 && !x.IsDeleted && x.tenant_id == param.tenantId
|
|
|
&& boms.Select(p => p.item_number).Contains(x.fitem_number) && x.bang_id == bangid).Result;
|
|
|
@@ -2320,6 +2266,7 @@ namespace Business.ResourceExamineManagement
|
|
|
_CalcBomViewAppService.process = process;//工序
|
|
|
_CalcBomViewAppService.tech_Proc_Workshops = tech_Proc_Workshops;//工艺工序关联工位
|
|
|
_CalcBomViewAppService.mordersList = mo_Mes_Morders;//工单
|
|
|
+ _CalcBomViewAppService.moentriesList = mo_Mes_Moentry;//工单子表
|
|
|
_CalcBomViewAppService.mooccupyAllList = mes_mooccupyList;//工单占用表
|
|
|
_CalcBomViewAppService.seorder = sorder;//销售订单
|
|
|
_CalcBomViewAppService.srm_Po_Lists = poDetailList; //采购明细
|