注塑定点配送修改
This commit is contained in:
@@ -247,6 +247,132 @@ namespace Tnb.ProductionMgr
|
||||
return msg;
|
||||
}
|
||||
|
||||
// [HttpGet]
|
||||
// [AllowAnonymous]
|
||||
// public async Task<string> FixedPointDelivery()
|
||||
// {
|
||||
// string state = await _redisData.TryGetValueByKeyField<string>("YTCS", "State");
|
||||
// if ("OK" != state)
|
||||
// {
|
||||
// Log.Error($"TCS没开机");
|
||||
// return "YTCS没开机";
|
||||
// }
|
||||
// string stateHxja = await _redisData.TryGetValueByKeyField<string>("hxjA", "State");
|
||||
// string stateHxjc = await _redisData.TryGetValueByKeyField<string>("hxjC", "State");
|
||||
// List<String> hxjList = new List<string>();
|
||||
// if ("OK" == stateHxja)
|
||||
// {
|
||||
// hxjList.Add("hxjA");
|
||||
// }
|
||||
// if ("OK" == stateHxjc)
|
||||
// {
|
||||
// hxjList.Add("hxjC");
|
||||
// }
|
||||
//
|
||||
// if (hxjList.IsEmpty())
|
||||
// {
|
||||
// Log.Error($"hxjA,hxjC不正常");
|
||||
// return "hxjA,hxjC不正常";
|
||||
// }
|
||||
// string msg = "";
|
||||
// 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();
|
||||
//
|
||||
// int? cs01Count = await _redisData.TryGetValueByKeyField<int?>("YTCS", "EmptyNo_CS01");
|
||||
// int? cs03Count = await _redisData.TryGetValueByKeyField<int?>("YTCS", "EmptyNo_CS03");
|
||||
//
|
||||
// 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.FirstOrDefault(x => x.equip_id==equipment.id);
|
||||
// if (eqpDaq == null)
|
||||
// {
|
||||
// Log.Error($"{equipment.name}没配置允许入空箱");
|
||||
// continue;
|
||||
// }
|
||||
// if (!hxjList.Contains(eqpDaq.equip_code))
|
||||
// {
|
||||
// Log.Error($"{eqpDaq.equip_code}状态不正常");
|
||||
// continue;
|
||||
// }
|
||||
// if (string.IsNullOrEmpty(equipment.upmat_location_id))
|
||||
// {
|
||||
// Log.Error($"{equipment.name}未配置上料库位");
|
||||
// continue;
|
||||
// }
|
||||
// if (await _db.Queryable<WmsPretaskH>().AnyAsync(x =>
|
||||
// x.endlocation_id == equipment.upmat_location_id &&
|
||||
// x.biz_type == WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID &&
|
||||
// (x.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID
|
||||
// || x.status == WmsWareHouseConst.PRETASK_BILL_STATUS_YXF_ID
|
||||
// || x.status == WmsWareHouseConst.PRETASK_BILL_STATUS_START_ID
|
||||
// )
|
||||
// ))
|
||||
// {
|
||||
// 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");
|
||||
// Log.Information($"机台号{eqpDaq.equip_code},标签名{eqpDaq.label_name}redis的值为{value.ToString()}");
|
||||
//
|
||||
// if (value==true && !valueFlag)
|
||||
// {
|
||||
// bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "AllowAgvEmptyOut_CS01");
|
||||
// bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "AllowAgvEmptyOut_CS03");
|
||||
// string startLocationCode = cs01==true ? "ZSSSXCTU01" : cs03==true ? "ZSSSXCTU02" : "";
|
||||
// if (cs01==true && cs03==true)
|
||||
// {
|
||||
// string last_fixed_point_delivery = _redisData.Exists("last_fixed_point_delivery") ? _redisData.Get<string>("last_fixed_point_delivery") : "";
|
||||
// if (string.IsNullOrEmpty(last_fixed_point_delivery))
|
||||
// {
|
||||
// startLocationCode = "ZSSSXCTU01";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// startLocationCode = "ZSSSXCTU01ZSSSXCTU02".Replace(last_fixed_point_delivery, "");
|
||||
// }
|
||||
// }
|
||||
// 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)}");
|
||||
// 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(result.code == HttpStatusCode.OK)
|
||||
// {
|
||||
// msg += $"{equipment.name}注塑定点配送成功,";
|
||||
// Log.Information($"【FixedPointDelivery】{equipment.name}注塑定点配送成功");
|
||||
// _redisData.Set($"{eqpDaq.equip_code}_{eqpDaq.label_name}_flag", true, TimeSpan.FromMinutes(20));
|
||||
// _redisData.Set($"last_fixed_point_delivery", startLocationCode);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// msg += $"{equipment.name}注塑定点配送失败:{result.msg},";
|
||||
// Log.Error($"【FixedPointDelivery】{equipment.name}注塑定点配送失败:{result.msg}");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return msg;
|
||||
// }
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<string> FixedPointDelivery()
|
||||
@@ -280,8 +406,8 @@ namespace Tnb.ProductionMgr
|
||||
.Where((x, y) => x.code == "ZSJ")
|
||||
.Select((x, y) => y).ToListAsync();
|
||||
|
||||
int? cs01Count = await _redisData.TryGetValueByKeyField<int?>("YTCS", "EmptyNo_CS01");
|
||||
int? cs03Count = await _redisData.TryGetValueByKeyField<int?>("YTCS", "EmptyNo_CS03");
|
||||
int cs01Count = await _redisData.TryGetValueByKeyField<int>("YTCS", "EmptyNo_CS01");
|
||||
int cs03Count = await _redisData.TryGetValueByKeyField<int>("YTCS", "EmptyNo_CS03");
|
||||
|
||||
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();
|
||||
@@ -324,8 +450,9 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
bool? cs01 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "AllowAgvEmptyOut_CS01");
|
||||
bool? cs03 = await _redisData.TryGetValueByKeyField<bool?>("YTCS", "AllowAgvEmptyOut_CS03");
|
||||
string startLocationCode = cs01==true ? "ZSSSXCTU01" : cs03==true ? "ZSSSXCTU02" : "";
|
||||
if (cs01==true && cs03==true)
|
||||
string startLocationCode = "";
|
||||
|
||||
if (cs01==true && cs03==true && cs01Count>0 && cs03Count>0)
|
||||
{
|
||||
string last_fixed_point_delivery = _redisData.Exists("last_fixed_point_delivery") ? _redisData.Get<string>("last_fixed_point_delivery") : "";
|
||||
if (string.IsNullOrEmpty(last_fixed_point_delivery))
|
||||
@@ -337,6 +464,19 @@ namespace Tnb.ProductionMgr
|
||||
startLocationCode = "ZSSSXCTU01ZSSSXCTU02".Replace(last_fixed_point_delivery, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cs01==true && cs01Count > 0)
|
||||
{
|
||||
startLocationCode = "ZSSSXCTU01";
|
||||
cs01Count--;
|
||||
}else if (cs03==true && cs03Count > 0)
|
||||
{
|
||||
startLocationCode = "ZSSSXCTU02";
|
||||
cs03Count--;
|
||||
}
|
||||
}
|
||||
|
||||
if (startLocationCode.IsEmpty())
|
||||
{
|
||||
Log.Error($"输送线无空载具");
|
||||
|
||||
Reference in New Issue
Block a user