BUG
This commit is contained in:
@@ -1985,7 +1985,6 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah("提报数量为正数");
|
||||
}
|
||||
|
||||
|
||||
report = input.Adapt<PrdReport>();
|
||||
report.id = SnowflakeIdHelper.NextId();
|
||||
report.org_id = WmsWareHouseConst.AdministratorOrgId;
|
||||
@@ -2379,21 +2378,27 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
if(db==null) db = _repository.AsSugarClient();
|
||||
if(report==null) report = await db.Queryable<PrdReport>().FirstAsync(it => it.id==input.report_id && !SqlFunc.IsNullOrEmpty(it.id));
|
||||
PrdMoTask? prdMoTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == report.mo_task_id && !SqlFunc.IsNullOrEmpty(x.id));
|
||||
if (db == null) db = _repository.AsSugarClient();
|
||||
if (report == null)
|
||||
report = await db.Queryable<PrdReport>()
|
||||
.FirstAsync(it => it.id == input.report_id && !SqlFunc.IsNullOrEmpty(it.id));
|
||||
PrdMoTask? prdMoTask = await db.Queryable<PrdMoTask>()
|
||||
.FirstAsync(x => x.id == report.mo_task_id && !SqlFunc.IsNullOrEmpty(x.id));
|
||||
EqpEquipment equip = await db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdMoTask.material_id);
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>().FirstAsync(x=>x.carry_code==report.material_box_code);
|
||||
BasLocation location = await db.Queryable<BasLocation>().FirstAsync(x=>x.location_code==report.location_code);
|
||||
BasMaterial basMaterial =
|
||||
await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdMoTask.material_id);
|
||||
WmsCarryH wmsCarryH = await db.Queryable<WmsCarryH>()
|
||||
.FirstAsync(x => x.carry_code == report.material_box_code);
|
||||
BasLocation location = await db.Queryable<BasLocation>()
|
||||
.FirstAsync(x => x.location_code == report.location_code);
|
||||
PrdMo prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||
|
||||
await db.Updateable<PrdReport>()
|
||||
.SetColumns(x => x.check_result == input.check_result)
|
||||
.Where(x => x.id == input.report_id)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
|
||||
|
||||
|
||||
BindCarryCodeInput bindCarryCodeInput = new BindCarryCodeInput();
|
||||
bindCarryCodeInput.carry_id = wmsCarryH.id;
|
||||
bindCarryCodeInput.barcode = report.barcode;
|
||||
@@ -2407,12 +2412,13 @@ namespace Tnb.ProductionMgr
|
||||
bindCarryCodeInput.create_id = _userManager?.UserId ?? WmsWareHouseConst.AdministratorUserId;
|
||||
|
||||
Log.Information($"载具绑定参数:${JsonConvert.SerializeObject(bindCarryCodeInput)}");
|
||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result1 = await _wmsCarryService.BindCarryMaterial(bindCarryCodeInput);
|
||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result1 =
|
||||
await _wmsCarryService.BindCarryMaterial(bindCarryCodeInput);
|
||||
if (result1.code != HttpStatusCode.OK)
|
||||
{
|
||||
throw Oops.Bah(result1.msg);
|
||||
}
|
||||
|
||||
|
||||
WmsPrdInstockInput wmsPrdInstockInput = new WmsPrdInstockInput();
|
||||
wmsPrdInstockInput.prd_bill_code = prdMo.mo_code;
|
||||
wmsPrdInstockInput.material_id = prdMoTask.material_id;
|
||||
@@ -2433,7 +2439,7 @@ namespace Tnb.ProductionMgr
|
||||
startlocation_id = location.id,
|
||||
carry_id = wmsCarryH.id,
|
||||
};
|
||||
|
||||
|
||||
if (prdMoTask.schedule_type == 1)
|
||||
{
|
||||
wmsPrdInstockInput.prdInstockCodes.Add(new WmsPrdInstockCodeInput()
|
||||
@@ -2462,10 +2468,11 @@ namespace Tnb.ProductionMgr
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Log.Information($"生产入库参数:${JsonConvert.SerializeObject(wmsPrdInstockInput)}");
|
||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsPrdInstockHService.PrdInstock(wmsPrdInstockInput, db);
|
||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 =
|
||||
await _wmsPrdInstockHService.PrdInstock(wmsPrdInstockInput, db);
|
||||
if (result2 != null)
|
||||
{
|
||||
Log.Information($"生产入库接口返回参数:${JsonConvert.SerializeObject(result2)}");
|
||||
@@ -2473,98 +2480,111 @@ namespace Tnb.ProductionMgr
|
||||
else
|
||||
{
|
||||
Log.Information($"生产入库接口返回参数为null");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (result2.code != HttpStatusCode.OK)
|
||||
{
|
||||
throw Oops.Bah(result2.msg !=null ? result2.msg : "生产入库接口报错");
|
||||
throw Oops.Bah(result2.msg != null ? result2.msg : "生产入库接口报错");
|
||||
}
|
||||
|
||||
//来源erp需要调接口
|
||||
if (prdMo.mo_source == "1")
|
||||
{
|
||||
List<DictionaryDataEntity> unitDatas = await db.Queryable<DictionaryTypeEntity>()
|
||||
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode==report.unit_id)
|
||||
.Select((x, y) => y)
|
||||
.ToListAsync();
|
||||
|
||||
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode == report.unit_id)
|
||||
.Select((x, y) => y)
|
||||
.ToListAsync();
|
||||
|
||||
List<string> erpExtendIds = new List<string>();
|
||||
erpExtendIds.Add(_userManager.UserId);
|
||||
erpExtendIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||
erpExtendIds.Add(report.material_id);
|
||||
// erpExtendIds.Add(report.unit_id);
|
||||
erpExtendIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||
erpExtendIds.AddRange(unitDatas.Select(x => x.Id).ToList());
|
||||
|
||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>erpExtendIds.Contains(x.table_id)).ToListAsync();
|
||||
string erpCreateId = erpExtendFields.Find(x=>x.table_id==_userManager.UserId)?.user_id ?? "";
|
||||
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>()
|
||||
.Where(x => erpExtendIds.Contains(x.table_id)).ToListAsync();
|
||||
string erpCreateId = erpExtendFields.Find(x => x.table_id == _userManager.UserId)?.user_id ?? "";
|
||||
ErpExtendField erpOrg =
|
||||
erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||
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>();
|
||||
erpRequestData.Add("auditer",erpCreateId);
|
||||
erpRequestData.Add("billmaker",erpCreateId);
|
||||
erpRequestData.Add("cdeptid","1001A1100000001JFOPQ");//部门先写死
|
||||
erpRequestData.Add("cdeptvid","0001A1100000000AOMIQ");//部门先写死
|
||||
erpRequestData.Add("taudittime",nowStr);
|
||||
erpRequestData.Add("creationtime",nowStr);
|
||||
erpRequestData.Add("creator",erpCreateId);
|
||||
erpRequestData.Add("dbilldate",nowStr);
|
||||
erpRequestData.Add("dmakedate",nowStr);
|
||||
erpRequestData.Add("pk_org",erpOrg.pk_org);
|
||||
erpRequestData.Add("pk_org_v",erpOrg.pk_org_v);
|
||||
erpRequestData.Add("vtrantypecode","55A4-01");
|
||||
erpRequestData.Add("vtrantypeid","0001A11000000002LVX8");
|
||||
erpRequestData.Add("vdef1",null);//todo 倒冲日期
|
||||
erpRequestData.Add("vdef2",null);
|
||||
erpRequestData.Add("report_id",report.id);
|
||||
|
||||
|
||||
erpRequestData.Add("auditer", erpCreateId);
|
||||
erpRequestData.Add("billmaker", erpCreateId);
|
||||
erpRequestData.Add("cdeptid", "1001A1100000001JFOPQ"); //部门先写死
|
||||
erpRequestData.Add("cdeptvid", "0001A1100000000AOMIQ"); //部门先写死
|
||||
erpRequestData.Add("taudittime", nowStr);
|
||||
erpRequestData.Add("creationtime", nowStr);
|
||||
erpRequestData.Add("creator", erpCreateId);
|
||||
erpRequestData.Add("dbilldate", nowStr);
|
||||
erpRequestData.Add("dmakedate", nowStr);
|
||||
erpRequestData.Add("pk_org", erpOrg.pk_org);
|
||||
erpRequestData.Add("pk_org_v", erpOrg.pk_org_v);
|
||||
erpRequestData.Add("vtrantypecode", "55A4-01");
|
||||
erpRequestData.Add("vtrantypeid", "0001A11000000002LVX8");
|
||||
erpRequestData.Add("vdef1", null); //todo 倒冲日期
|
||||
erpRequestData.Add("vdef2", null);
|
||||
erpRequestData.Add("report_id", report.id);
|
||||
|
||||
|
||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||
{
|
||||
["cbdeptid"] = "1001A1100000001JFOPQ",//部门先写死
|
||||
["cbdeptvid"] = "0001A1100000000AOMIQ",//部门先写死
|
||||
["cbmainmaterialid"] = erpExtendFields.Find(x=>x.table_id==report.material_id)?.cmaterialoid ?? "",
|
||||
["cbmainmaterialvid"] = erpExtendFields.Find(x=>x.table_id==report.material_id)?.cmaterialvid ?? "",
|
||||
["cbmaterialid"] = erpExtendFields.Find(x=>x.table_id==report.material_id)?.cmaterialvid ?? "",
|
||||
["cbmaterialvid"] = erpExtendFields.Find(x=>x.table_id==report.material_id)?.cmaterialvid ?? "",
|
||||
["cbdeptid"] = "1001A1100000001JFOPQ", //部门先写死
|
||||
["cbdeptvid"] = "0001A1100000000AOMIQ", //部门先写死
|
||||
["cbmainmaterialid"] =
|
||||
erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialoid ?? "",
|
||||
["cbmainmaterialvid"] =
|
||||
erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialvid ?? "",
|
||||
["cbmaterialid"] = erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialvid ??
|
||||
"",
|
||||
["cbmaterialvid"] = erpExtendFields.Find(x => x.table_id == report.material_id)?.cmaterialvid ??
|
||||
"",
|
||||
["cbmobid"] = prdMo.erp_line_pk,
|
||||
["cbmoid"] = prdMo.erp_mo_pk,
|
||||
// ["cbunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
|
||||
// ["cbastunitid"] = erpExtendFields.Find(x=>x.table_id==report.unit_id)?.cunitid ?? "",
|
||||
["cbunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x=>x.EnCode==report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cbastunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x=>x.EnCode==report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cbunitid"] = erpExtendFields.Find(x =>
|
||||
x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cbastunitid"] = erpExtendFields.Find(x =>
|
||||
x.table_id == (unitDatas.Find(x => x.EnCode == report.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["nbplanwrnum"] = report.reported_qty,
|
||||
["nbwrnum"] = report.reported_qty,
|
||||
["tbendtime"] = nowStr,
|
||||
["tbstarttime"] = prdMoTask.act_start_date!=null ? prdMoTask.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||
["tbstarttime"] = prdMoTask.act_start_date != null
|
||||
? prdMoTask.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
: "",
|
||||
["vbinbatchcode"] = report.batch,
|
||||
["vbmobillcode"] = prdMo.mo_code,
|
||||
["vbmorowno"] = prdMo.erp_lineno,
|
||||
["vbrowno"] = prdMo.erp_lineno,
|
||||
|
||||
|
||||
});
|
||||
erpRequestData.Add("AggWrDtl",erpRequestDataDetails);
|
||||
erpRequestData.Add("AggWrDtl", erpRequestDataDetails);
|
||||
requestData.Add(erpRequestData);
|
||||
|
||||
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
|
||||
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>()
|
||||
.FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL);
|
||||
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
||||
thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
||||
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||
thirdWebapiRecord.name = "生产报告";
|
||||
thirdWebapiRecord.method = "POST";
|
||||
thirdWebapiRecord.url = config.value+"uapws/rest/pwrnew/save";
|
||||
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN+"uapws/rest/pwrnew/save";
|
||||
// thirdWebapiRecord.url = config.value + "uapws/rest/pwrnew/save";
|
||||
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN+"uapws/rest/pwrnew/save";
|
||||
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||
thirdWebapiRecord.create_time = DateTime.Now;
|
||||
thirdWebapiRecord.remark = $"载具编号:{report?.material_box_code ?? ""}";
|
||||
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (prdMoTask.schedule_type == 2)
|
||||
{
|
||||
// Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
|
||||
@@ -2582,7 +2602,7 @@ namespace Tnb.ProductionMgr
|
||||
// {
|
||||
// throw Oops.Bah(x2ServerResult.Msg);
|
||||
// }
|
||||
|
||||
|
||||
// Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
|
||||
// {
|
||||
// ["DevName"] = "外包装箱码垛线",
|
||||
@@ -2601,6 +2621,20 @@ namespace Tnb.ProductionMgr
|
||||
// }
|
||||
}
|
||||
|
||||
// if (basMaterial.category_id.Contains("CGJCJ"))
|
||||
// {
|
||||
// EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||
// if (!string.IsNullOrEmpty(equipment.downmat_location_id))
|
||||
// {
|
||||
// BasLocation downmatLocation = await _db.Queryable<BasLocation>().SingleAsync(x=>x.id==equipment.downmat_location_id);
|
||||
// await _db.Updateable<WmsCarryH>()
|
||||
// .SetColumns(x => x.location_code == downmatLocation.location_code)
|
||||
// .SetColumns(x => x.location_id == downmatLocation.id)
|
||||
// .Where(x => x.carry_code == report.material_box_code)
|
||||
// .ExecuteCommandAsync();
|
||||
// }
|
||||
// }
|
||||
|
||||
if (basMaterial.category_id.Contains("ZSJ") || basMaterial.category_id.Contains("DGJCJ"))
|
||||
{
|
||||
EqpEquipment equipment = await _db.Queryable<EqpEquipment>().SingleAsync(x => x.id == prdMoTask.eqp_id);
|
||||
|
||||
Reference in New Issue
Block a user