合并
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -70,7 +70,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
["DevName"] = device,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = eqpDaq1.label_point,
|
||||
["TagName"] = eqpDaq1.label_name,
|
||||
["Value"] = "true",
|
||||
};
|
||||
Log.Information($"确认称重参数:{JsonConvert.SerializeObject(dicCommand)}");
|
||||
@@ -82,12 +82,12 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah("未在数据采集中设置当前重量标签点");
|
||||
}
|
||||
|
||||
bool flag = await _redisData.HashExist(device, eqpDaq2.label_point);
|
||||
bool flag = await _redisData.HashExist(device, eqpDaq2.label_name);
|
||||
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);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
["DevName"] = device,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = eqpDaq3.label_point,
|
||||
["TagName"] = eqpDaq3.label_name,
|
||||
["Value"] = "true",
|
||||
};
|
||||
Log.Information($"称重完成参数:{JsonConvert.SerializeObject(dicCommand2)}");
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Tnb.ProductionMgr
|
||||
public class TimeWorkService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly RedisData _redisData;
|
||||
@@ -50,6 +51,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
_redisData = redisData;
|
||||
_repository = repository;
|
||||
_db = repository.AsSugarClient();
|
||||
_organizeService = organizeService;
|
||||
_billRullService = billRullService;
|
||||
_wmsEmptyOutstockService = wmsEmptyOutstockService;
|
||||
@@ -216,50 +218,59 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<string> FixedPointDelivery()
|
||||
{
|
||||
string msg = "";
|
||||
bool? value = await _redisData.TryGetValueByKeyField<bool?>("hxjC", "A2允许入空箱");
|
||||
bool valueFlag = _redisData.Get<bool>("hxjC_A2允许入空箱_flag");
|
||||
if (value==true && !valueFlag)
|
||||
List<EqpEquipment> equipments = await _db.Queryable<EqpEquipType>()
|
||||
.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)
|
||||
{
|
||||
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
|
||||
bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS03");
|
||||
string startLocationCode = cs01==false ? "ZSSSXCTU01" : cs03==false ? "ZSSSXCTU02" : "";
|
||||
if (startLocationCode.IsEmpty())
|
||||
EqpDaq eqpDaq = eqpDaqs.First(x => x.equip_id == equipment.id);
|
||||
if (eqpDaq == null)
|
||||
{
|
||||
Log.Error($"输送线无空载具");
|
||||
return "输送线无空载具";
|
||||
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");
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
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)
|
||||
if (value==true && !valueFlag)
|
||||
{
|
||||
Log.Error($"未找到设备编号为TYZS001的设备");
|
||||
return "未找到设备编号为TYZS001的设备";
|
||||
|
||||
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS01");
|
||||
bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "CallCtuEmptyIn_CS03");
|
||||
string startLocationCode = cs01==false ? "ZSSSXCTU01" : cs03==false ? "ZSSSXCTU02" : "";
|
||||
if (startLocationCode.IsEmpty())
|
||||
{
|
||||
Log.Error($"输送线无空载具");
|
||||
return "输送线无空载具";
|
||||
}
|
||||
|
||||
BasLocation startLocation = await _db.Queryable<BasLocation>().Where(x=>x.location_code==startLocationCode).FirstAsync();
|
||||
CommonCreatePretaskInput postData = new CommonCreatePretaskInput();
|
||||
postData.startlocation_id = startLocation.id;
|
||||
postData.endlocation_id = equipment.upmat_location_id;
|
||||
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);
|
||||
// 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())
|
||||
{
|
||||
msg += $"{equipment.name}注塑定点配送成功,";
|
||||
Log.Information($"【FixedPointDelivery】{equipment.name}注塑定点配送成功");
|
||||
_redisData.Set($"{eqpDaq.equip_code}_{eqpDaq.label_name}_flag", true, TimeSpan.FromMinutes(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
msg += $"{equipment.name}注塑定点配送失败:{authResponse.msg},";
|
||||
Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{authResponse.msg}");
|
||||
}
|
||||
|
||||
}
|
||||
CommonCreatePretaskInput postData = new CommonCreatePretaskInput();
|
||||
postData.startlocation_id = startLocation.id;
|
||||
postData.endlocation_id = equipment.as_location_id;
|
||||
postData.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID;
|
||||
postData.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
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($"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())
|
||||
{
|
||||
msg = "注塑定点配送成功";
|
||||
Log.Information("【FixedPointDelivery】注塑定点配送成功");
|
||||
_redisData.Set("hxjC_A2允许入空箱_flag", true, TimeSpan.FromMinutes(20));
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"注塑定点配送失败:{authResponse.msg}";
|
||||
Log.Error($"【FixedPointDelivery】注塑定点配送失败:{authResponse.msg}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return msg;
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user