This commit is contained in:
2024-06-07 15:59:42 +08:00
3 changed files with 17 additions and 9 deletions

View File

@@ -470,7 +470,7 @@ namespace Tnb.ProductionMgr
minpacking = b.minpacking,
main_num = k.number_of_primary_unit,
deputy_num = k.number_of_auxiliary_unit,
third_equip_code = l.equip_code,
third_equip_code = f.code,
weight_name = l.label_point,
category_id = b.category_id,
as_location_id = f.as_location_id,

View File

@@ -61,11 +61,15 @@ namespace Tnb.ProductionMgr
[HttpPost]
public async Task<dynamic> GetWeight(string device, string jihao)
{
EqpDaq eqpDaq1 = await _repository.AsSugarClient().Queryable<EqpDaq>().Where(x => x.equip_code == device && x.label_name.Contains("允许称重")).FirstAsync();
EqpDaq eqpDaq1 = await _repository.AsSugarClient().Queryable<EqpDaq>().
LeftJoin<EqpEquipment>((x,y)=>x.equip_id==y.id).
Where((x,y) => y.code == device && x.label_name.Contains("允许称重")).FirstAsync();
if (eqpDaq1 == null)
{
throw Oops.Bah("未在数据采集中设置允许称重标签点");
}
device = eqpDaq1.equip_code;
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = device,

View File

@@ -40,13 +40,15 @@ namespace Tnb.ProductionMgr
private readonly IBillRullService _billRullService;
private readonly RedisData _redisData;
private readonly IWmsEmptyOutstockService _wmsEmptyOutstockService;
private readonly IWareHouseService _wareHouseService;
public TimeWorkService(
RedisData redisData,
ISqlSugarRepository<BasMaterial> repository,
IBillRullService billRullService,
IOrganizeService organizeService,
IWmsEmptyOutstockService wmsEmptyOutstockService
IWmsEmptyOutstockService wmsEmptyOutstockService,
IWareHouseService wareHouseService
)
{
_redisData = redisData;
@@ -55,6 +57,7 @@ namespace Tnb.ProductionMgr
_organizeService = organizeService;
_billRullService = billRullService;
_wmsEmptyOutstockService = wmsEmptyOutstockService;
_wareHouseService = wareHouseService;
}
[HttpGet]
@@ -225,7 +228,7 @@ namespace Tnb.ProductionMgr
List<String> eqpIds = equipments.Select(x => x.id).ToList();
List<EqpDaq> eqpDaqs = await _db.Queryable<EqpDaq>().Where(x => eqpIds.Contains(x.equip_id) && x.label_name.Contains("允许入空箱")).ToListAsync();
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
//BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
foreach (var equipment in equipments)
{
EqpDaq eqpDaq = eqpDaqs.FirstOrDefault(x => x.equip_id==equipment.id);
@@ -255,10 +258,11 @@ namespace Tnb.ProductionMgr
postData.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID;
postData.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
Log.Information($"【FixedPointDelivery】注塑定点配送,参数:{JsonConvert.SerializeObject(postData)}");
string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
Result result = await _wareHouseService.CommonCreatePretask(postData);
// string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
// string sendResult = HttpUtils.RequestPost($"http://localhost:9232/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
if(authResponse.code == 200 && authResponse.data.ObjToBool())
// AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
if(result.code == HttpStatusCode.OK)
{
msg += $"{equipment.name}注塑定点配送成功,";
Log.Information($"【FixedPointDelivery】{equipment.name}注塑定点配送成功");
@@ -266,8 +270,8 @@ namespace Tnb.ProductionMgr
}
else
{
msg += $"{equipment.name}注塑定点配送失败:{authResponse.msg},";
Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{authResponse.msg}");
msg += $"{equipment.name}注塑定点配送失败:{result.msg},";
Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{result.msg}");
}
}