称重,注塑定点配送修改
This commit is contained in:
@@ -70,7 +70,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
["DevName"] = device,
|
["DevName"] = device,
|
||||||
["token"] = _eleCtlCfg.token,
|
["token"] = _eleCtlCfg.token,
|
||||||
["TagName"] = eqpDaq1.label_point,
|
["TagName"] = eqpDaq1.label_name,
|
||||||
["Value"] = "true",
|
["Value"] = "true",
|
||||||
};
|
};
|
||||||
Log.Information($"确认称重参数:{JsonConvert.SerializeObject(dicCommand)}");
|
Log.Information($"确认称重参数:{JsonConvert.SerializeObject(dicCommand)}");
|
||||||
@@ -82,12 +82,12 @@ namespace Tnb.ProductionMgr
|
|||||||
throw Oops.Bah("未在数据采集中设置当前重量标签点");
|
throw Oops.Bah("未在数据采集中设置当前重量标签点");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flag = await _redisData.HashExist(device, eqpDaq2.label_point);
|
bool flag = await _redisData.HashExist(device, eqpDaq2.label_name);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
throw Oops.Bah("没有找到" + device + "----" + eqpDaq2.label_point + "的数据");
|
throw Oops.Bah("没有找到" + device + "----" + eqpDaq2.label_name + "的数据");
|
||||||
}
|
}
|
||||||
string data = await _redisData.GetHash(device, eqpDaq2.label_point);
|
string data = await _redisData.GetHash(device, eqpDaq2.label_name);
|
||||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
["DevName"] = device,
|
["DevName"] = device,
|
||||||
["token"] = _eleCtlCfg.token,
|
["token"] = _eleCtlCfg.token,
|
||||||
["TagName"] = eqpDaq3.label_point,
|
["TagName"] = eqpDaq3.label_name,
|
||||||
["Value"] = "true",
|
["Value"] = "true",
|
||||||
};
|
};
|
||||||
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand2)}");
|
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand2)}");
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public class TimeWorkService : IDynamicApiController, ITransient
|
public class TimeWorkService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IOrganizeService _organizeService;
|
private readonly IOrganizeService _organizeService;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
private readonly RedisData _redisData;
|
private readonly RedisData _redisData;
|
||||||
@@ -50,6 +51,7 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
_redisData = redisData;
|
_redisData = redisData;
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
_organizeService = organizeService;
|
_organizeService = organizeService;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
_wmsEmptyOutstockService = wmsEmptyOutstockService;
|
_wmsEmptyOutstockService = wmsEmptyOutstockService;
|
||||||
@@ -216,8 +218,25 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<string> FixedPointDelivery()
|
public async Task<string> FixedPointDelivery()
|
||||||
{
|
{
|
||||||
string msg = "";
|
string msg = "";
|
||||||
bool? value = await _redisData.TryGetValueByKeyField<bool?>("hxjC", "A2允许入空箱");
|
List<EqpEquipment> equipments = await _db.Queryable<EqpEquipType>()
|
||||||
bool valueFlag = _redisData.Get<bool>("hxjC_A2允许入空箱_flag");
|
.InnerJoin<EqpEquipment>((x, y) => x.id == y.equip_type_id)
|
||||||
|
.Where((x, y) => x.code == "ZSJ")
|
||||||
|
.Select((x, y) => y).ToListAsync();
|
||||||
|
|
||||||
|
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);
|
||||||
|
foreach (var equipment in equipments)
|
||||||
|
{
|
||||||
|
EqpDaq eqpDaq = eqpDaqs.First(x => x.equip_id == equipment.id);
|
||||||
|
if (eqpDaq == null)
|
||||||
|
{
|
||||||
|
Log.Error($"{equipment.name}没配置允许入空箱");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
bool? value = await _redisData.TryGetValueByKeyField<bool?>(eqpDaq.equip_code, eqpDaq.label_name);
|
||||||
|
bool valueFlag = _redisData.Get<bool>($"{eqpDaq.equip_code}_{eqpDaq.label_name}_flag");
|
||||||
|
|
||||||
if (value==true && !valueFlag)
|
if (value==true && !valueFlag)
|
||||||
{
|
{
|
||||||
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
|
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
|
||||||
@@ -229,38 +248,30 @@ namespace Tnb.ProductionMgr
|
|||||||
return "输送线无空载具";
|
return "输送线无空载具";
|
||||||
}
|
}
|
||||||
|
|
||||||
var db = _repository.AsSugarClient();
|
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(x=>x.location_code==startLocationCode).FirstAsync();
|
||||||
BasLocation startLocation = await db.Queryable<BasLocation>().Where(x=>x.location_code==startLocationCode).FirstAsync();
|
|
||||||
EqpEquipment equipment = await db.Queryable<EqpEquipment>().Where(x=>x.code=="TYZS001").FirstAsync();
|
|
||||||
if (equipment == null)
|
|
||||||
{
|
|
||||||
Log.Error($"未找到设备编号为TYZS001的设备");
|
|
||||||
return "未找到设备编号为TYZS001的设备";
|
|
||||||
|
|
||||||
}
|
|
||||||
CommonCreatePretaskInput postData = new CommonCreatePretaskInput();
|
CommonCreatePretaskInput postData = new CommonCreatePretaskInput();
|
||||||
postData.startlocation_id = startLocation.id;
|
postData.startlocation_id = startLocation.id;
|
||||||
postData.endlocation_id = equipment.as_location_id;
|
postData.endlocation_id = equipment.upmat_location_id;
|
||||||
postData.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID;
|
postData.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID;
|
||||||
postData.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
postData.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||||
Log.Information($"【FixedPointDelivery】注塑定点配送,参数:{JsonConvert.SerializeObject(postData)}");
|
Log.Information($"【FixedPointDelivery】注塑定点配送,参数:{JsonConvert.SerializeObject(postData)}");
|
||||||
BasFactoryConfig config = await db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DOMAIN);
|
|
||||||
string sendResult = HttpUtils.RequestPost($"{config.value}/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
|
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);
|
// string sendResult = HttpUtils.RequestPost($"http://localhost:9232/api/wms/ware-house/common-create-pretask", JsonConvert.SerializeObject(postData), null);
|
||||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
if(authResponse.code == 200 && authResponse.data.ObjToBool())
|
if(authResponse.code == 200 && authResponse.data.ObjToBool())
|
||||||
{
|
{
|
||||||
msg = "注塑定点配送成功";
|
msg += $"{equipment.name}注塑定点配送成功,";
|
||||||
Log.Information("【FixedPointDelivery】注塑定点配送成功");
|
Log.Information($"【FixedPointDelivery】{equipment.name}注塑定点配送成功");
|
||||||
_redisData.Set("hxjC_A2允许入空箱_flag", true, TimeSpan.FromMinutes(20));
|
_redisData.Set($"{eqpDaq.equip_code}_{eqpDaq.label_name}_flag", true, TimeSpan.FromMinutes(20));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = $"注塑定点配送失败:{authResponse.msg}";
|
msg += $"{equipment.name}注塑定点配送失败:{authResponse.msg},";
|
||||||
Log.Error($"【FixedPointDelivery】注塑定点配送失败:{authResponse.msg}");
|
Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{authResponse.msg}");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user