生产投料解绑载具物料

This commit is contained in:
2024-06-24 11:55:44 +08:00
parent a5eb93809d
commit 7358039095
2 changed files with 58 additions and 48 deletions

View File

@@ -16,6 +16,8 @@ using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Entities.Dto;
using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.ProductionMgr
{
@@ -31,6 +33,7 @@ namespace Tnb.ProductionMgr
private readonly IPrdMoTaskService _prdMoTaskService;
private readonly IBillRullService _billRullService;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IWmsCarryBindService _wmsCarryBindService;
// private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
@@ -41,6 +44,7 @@ namespace Tnb.ProductionMgr
IPrdMoTaskService prdMoTaskService,
// WmsSignForDeliveryService wmsSignForDeliveryService,
IDictionaryDataService dictionaryDataService,
IWmsCarryBindService wmsCarryBindService,
IUserManager userManager
)
{
@@ -50,6 +54,7 @@ namespace Tnb.ProductionMgr
// _wmsSignForDeliveryService = _wmsSignForDeliveryService;
_dictionaryDataService = dictionaryDataService;
_billRullService = billRullService;
_wmsCarryBindService = wmsCarryBindService;
}
@@ -452,6 +457,10 @@ namespace Tnb.ProductionMgr
_ = await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
_ = await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
_wmsCarryBindService.CarryCodeUnbind(new CarryCodeUnbindInput()
{
carry_id = carry.id
});
});

View File

@@ -1950,6 +1950,55 @@ namespace Tnb.ProductionMgr
// }
// }
// }
if (prdMoTask.schedule_type == 2)
{
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = dic[prdMoTask.workline_id],
["token"] = _eleCtlCfg.token,
["TagName"] = "WBZX_x1_ok",
["Value"] = "true",
};
Log.Information($"提拔确认完成参数:{JsonConvert.SerializeObject(dicCommand2)}");
string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2);
Log.Information($"提拔确认完成参数成返回结果:{responseresult}");
X2ServerResult x2ServerResult = JsonConvert.DeserializeObject<X2ServerResult>(responseresult);
if (x2ServerResult.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult.Msg);
}
}
if (prdMoTask.schedule_type == 1)
{
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable<EqpDaq>().
LeftJoin<EqpEquipment>((x,y)=>x.equip_id==y.id).
Where((x,y) => y.code == equipment.code && x.label_name.Contains("称重完成")).FirstAsync();
if (eqpDaq3 == null)
{
throw Oops.Bah("未在数据采集中设置称重完成标签点");
}
Dictionary<string, string> dicCommand3 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = eqpDaq3.equip_code,
["token"] = _eleCtlCfg.token,
["TagName"] = eqpDaq3.label_name,
["Value"] = "true",
};
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand3)}");
string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand3,false);
Log.Information($"{eqpDaq3.equip_code},{eqpDaq3.label_name}称重完成返回结果:{responseresult}");
X2ServerResult x2ServerResult = JsonConvert.DeserializeObject<X2ServerResult>(responseresult);
if (x2ServerResult.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult.Msg);
}
}
// Dictionary<string, object> header = new()
@@ -2028,54 +2077,6 @@ namespace Tnb.ProductionMgr
{
throw Oops.Bah(result2.msg !=null ? result2.msg : "生产入库接口报错");
}
if (prdMoTask.schedule_type == 2)
{
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = dic[prdMoTask.workline_id],
["token"] = _eleCtlCfg.token,
["TagName"] = "WBZX_x1_ok",
["Value"] = "true",
};
Log.Information($"提拔确认完成参数:{JsonConvert.SerializeObject(dicCommand2)}");
string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2);
Log.Information($"提拔确认完成参数成返回结果:{responseresult}");
X2ServerResult x2ServerResult = JsonConvert.DeserializeObject<X2ServerResult>(responseresult);
if (x2ServerResult.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult.Msg);
}
}
if (prdMoTask.schedule_type == 1)
{
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
EqpDaq eqpDaq3 = await _repository.AsSugarClient().Queryable<EqpDaq>().
LeftJoin<EqpEquipment>((x,y)=>x.equip_id==y.id).
Where((x,y) => y.code == equipment.code && x.label_name.Contains("称重完成")).FirstAsync();
if (eqpDaq3 == null)
{
throw Oops.Bah("未在数据采集中设置称重完成标签点");
}
Dictionary<string, string> dicCommand3 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = eqpDaq3.equip_code,
["token"] = _eleCtlCfg.token,
["TagName"] = eqpDaq3.label_name,
["Value"] = "true",
};
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand3)}");
string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand3,false);
Log.Information($"{eqpDaq3.equip_code},{eqpDaq3.label_name}称重完成返回结果:{responseresult}");
X2ServerResult x2ServerResult = JsonConvert.DeserializeObject<X2ServerResult>(responseresult);
if (x2ServerResult.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult.Msg);
}
}
await _db.Ado.CommitTranAsync();