Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -50,7 +50,16 @@ namespace Tnb.BasicData
|
||||
|
||||
stopwatch.Stop();
|
||||
var elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||
ThirdResult thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||
ThirdResult thirdResult = new ThirdResult();
|
||||
try
|
||||
{
|
||||
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
thirdResult.Code = 500;
|
||||
thirdResult.msgResult = response;
|
||||
}
|
||||
if (thirdResult.Code == 200)
|
||||
{
|
||||
await db.Updateable<ThirdWebapiRecord>()
|
||||
|
||||
@@ -1723,16 +1723,17 @@ namespace Tnb.ProductionMgr
|
||||
// throw Oops.Bah("未找到对应产线");
|
||||
// }
|
||||
|
||||
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
|
||||
// report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
|
||||
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_SLDMJC_ID;
|
||||
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
|
||||
{
|
||||
[WmsWareHouseConst.XUELUGUAN1XIAN] = "ZZ-01-01",
|
||||
[WmsWareHouseConst.XUELUGUAN2XIAN] = "ZZ-01-02",
|
||||
[WmsWareHouseConst.XUELUGUAN1XIAN] = "ZZ-01-02",
|
||||
[WmsWareHouseConst.XUELUGUAN2XIAN] = "ZZ-02-02",
|
||||
};
|
||||
report.location_code = worklineWarehouseDic.GetOrDefault(prdMoTask.workline_id);
|
||||
if (string.IsNullOrEmpty(report.location_code))
|
||||
{
|
||||
report.location_code = "ZZ-01-01";
|
||||
report.location_code = "ZZ-01-02";
|
||||
}
|
||||
location = await db.Queryable<BasLocation>().SingleAsync(x=>x.location_code==report.location_code);
|
||||
if (location == null)
|
||||
|
||||
@@ -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($"输送线无空载具");
|
||||
@@ -461,7 +601,7 @@ namespace Tnb.ProductionMgr
|
||||
Stopwatch stopwatch = null;
|
||||
string response = "";
|
||||
var elapsedMilliseconds = 0l;
|
||||
ThirdResult thirdResult = null;
|
||||
ThirdResult thirdResult = new ThirdResult();
|
||||
foreach (var record in records)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
/// 暂存仓仓库ID
|
||||
/// </summary>
|
||||
public const string WAREHOUSE_ZCC_ID = "33780009364245";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 四楼待灭菌仓
|
||||
/// </summary>
|
||||
public const string WAREHOUSE_SLDMJC_ID = "35412479754517";
|
||||
/// <summary>
|
||||
/// 四楼解析库
|
||||
/// </summary>
|
||||
|
||||
@@ -2398,7 +2398,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>ids.Contains(x.table_id)).ToListAsync();
|
||||
string erpCreateId = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.create_id)?.user_id ?? "";
|
||||
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (wmsMaterialTransfer.org_id ?? WmsWareHouseConst.AdministratorOrgId));
|
||||
string nowStr = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||
@@ -2427,8 +2427,8 @@ namespace Tnb.WarehouseMgr
|
||||
["cbodytranstypecode"] = "4A-01",
|
||||
["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "",
|
||||
["cgeneralbid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "",
|
||||
["cgeneralbid"] = item.id,
|
||||
["cgeneralhid"] = item.bill_id,
|
||||
["cgeneralbid"] = item.erp_line_pk ?? "",
|
||||
["cgeneralhid"] = wmsMaterialTransfer.erp_pk ?? "",
|
||||
["cmaterialoid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
|
||||
["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialvid ?? "",
|
||||
["corpoid"] = erpOrg.corpoid,
|
||||
@@ -2454,7 +2454,7 @@ namespace Tnb.WarehouseMgr
|
||||
thirdWebapiRecord.name = "其它入库";
|
||||
thirdWebapiRecord.method = "POST";
|
||||
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN+"uapws/rest/generalin/save";
|
||||
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData);
|
||||
thirdWebapiRecord.create_time = DateTime.Now;
|
||||
|
||||
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||
|
||||
@@ -829,7 +829,6 @@ namespace Tnb.WarehouseMgr
|
||||
ids.Add(wmsMaterialTransfer.warehouse_instock);
|
||||
ids.Add(wmsMaterialTransferd.material_id);
|
||||
ids.Add(unitData.Id);
|
||||
|
||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>ids.Contains(x.table_id)).ToListAsync();
|
||||
|
||||
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (wmsMaterialTransfer.org_id ?? WmsWareHouseConst.AdministratorOrgId));
|
||||
@@ -837,13 +836,13 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||
string nowStr = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
erpRequestData.Add("billmaker",erpCreateId);
|
||||
erpRequestData.Add("cdptid","1001A1100000000JRLI1A100");// 先写死
|
||||
erpRequestData.Add("cdptvid","0001A11000000007GGO8");// 先写死
|
||||
erpRequestData.Add("corpoid",erpOrg.corpoid);
|
||||
erpRequestData.Add("corpvid",erpOrg.corpoid);
|
||||
erpRequestData.Add("cothercalbodyoid",erpOrg.cdptid);
|
||||
erpRequestData.Add("cothercalbodyoid",erpOrg.pk_org);
|
||||
erpRequestData.Add("cotherwhid",erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "");
|
||||
erpRequestData.Add("creationtime",nowStr);
|
||||
erpRequestData.Add("creator",erpCreateId);
|
||||
@@ -867,8 +866,8 @@ namespace Tnb.WarehouseMgr
|
||||
["corpoid"] = erpOrg.corpoid,
|
||||
["corpvid"] = erpOrg.corpvid,
|
||||
["crowno"] = (dList.FindIndex(x=>x.id==wmsMaterialTransferd.id)+1) * 10,
|
||||
["csourcebillbid"] = wmsMaterialTransferd.id,
|
||||
["csourcebillhid"] = wmsMaterialTransferd.bill_id,
|
||||
["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk ?? "",
|
||||
["csourcebillhid"] = wmsMaterialTransfer.erp_pk ?? "",
|
||||
["cunitid"] = erpExtendFields.Find(x=>x.table_id==unitData.Id)?.cunitid ?? "",
|
||||
["cvendorid"] = "",
|
||||
["cvendorvid"] = "",
|
||||
|
||||
Reference in New Issue
Block a user