This commit is contained in:
2024-09-25 11:47:55 +08:00
9 changed files with 159 additions and 128 deletions

View File

@@ -11,6 +11,6 @@ namespace Tnb.BasicData.Interfaces
/// <param name="id"></param> /// <param name="id"></param>
/// <param name="send_type">手动 自动</param> /// <param name="send_type">手动 自动</param>
/// <returns></returns> /// <returns></returns>
Task<string> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null); Task<ThirdResult> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null);
} }
} }

View File

@@ -44,7 +44,8 @@ namespace Tnb.BasicData
public async Task<string> Send(string id) public async Task<string> Send(string id)
{ {
ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id); ThirdWebapiRecord record = await _repository.GetSingleAsync(x=>x.id==id);
return await Send(Arrays.AsList(record), "手动"); ThirdResult thirdResult = await Send(Arrays.AsList(record), "手动");
return thirdResult.msgResult;
} }
[HttpGet] [HttpGet]
@@ -88,14 +89,14 @@ namespace Tnb.BasicData
return "失败"; return "失败";
} }
public async Task<string> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null) public async Task<ThirdResult> Send(List<ThirdWebapiRecord> records, string send_type,ISqlSugarClient db=null)
{ {
ThirdResult thirdResult = null; ThirdResult thirdResult = null;
bool tranFlag = true; bool tranFlag = true;
try try
{ {
if (records == null || records.IsEmpty()) if (records == null || records.IsEmpty())
return ""; return new ThirdResult();
if (db == null) if (db == null)
{ {
@@ -274,7 +275,7 @@ namespace Tnb.BasicData
} }
return thirdResult.Code == 200 ? "成功" : "失败"; return thirdResult;
} }
} }

View File

@@ -37,20 +37,20 @@ namespace Tnb.ProductionMgr.Interfaces
/// <returns></returns> /// <returns></returns>
Task<List<PrdMoTask>> GetPrdMoTaskListByStationId(Dictionary<string, string> dic); Task<List<PrdMoTask>> GetPrdMoTaskListByStationId(Dictionary<string, string> dic);
/// <summary> // /// <summary>
/// 外包装根据工位id获取喷码数据 // /// 外包装根据工位id获取喷码数据
/// </summary> // /// </summary>
/// <param name="dic"></param> // /// <param name="dic"></param>
/// <returns></returns> // /// <returns></returns>
Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input); // Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input);
/// <summary> // /// <summary>
/// 外包装根据工位id获取贴标数据 // /// 外包装根据工位id获取贴标数据
/// </summary> // /// </summary>
/// <param name="dic"></param> // /// <param name="dic"></param>
/// <returns></returns> // /// <returns></returns>
Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input); // Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
Task<string> PrdReport(PrdReportCrInput input); Task<string> PrdReport(PrdReportCrInput input);

View File

@@ -1606,8 +1606,8 @@ namespace Tnb.ProductionMgr
BasMbom basMbom = await _db.Queryable<BasMbom>().SingleAsync(x => x.id == item.bom_id); BasMbom basMbom = await _db.Queryable<BasMbom>().SingleAsync(x => x.id == item.bom_id);
//string code = $"(01){basMaterial.di ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}"; //string code = $"(01){basMaterial.di ?? ""}(11){DateTime.Now.ToString("yyMMdd")}(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
string code1 = $"(01){basMaterial.di ?? ""}*(11){DateTime.Now.ToString("yyMMdd")}*(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}"; string code1 = $"(01){basMaterial.di ?? ""}*(11){item.act_start_date.Value.ToString("yyMMdd")}*(17){item.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}";
string code2 = $"{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}"; string code2 = $"{basMaterial.material_specification}*{batch}*{item.act_start_date.Value.ToString("yyyyMMdd")}*{item.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.container_no}";
Dictionary<string, string> dicCommand1 = new(StringComparer.OrdinalIgnoreCase) Dictionary<string, string> dicCommand1 = new(StringComparer.OrdinalIgnoreCase)
{ {
["DevName"] = "外包装箱码垛线", ["DevName"] = "外包装箱码垛线",
@@ -3921,90 +3921,90 @@ namespace Tnb.ProductionMgr
/// </summary> /// </summary>
/// <param name="dic"></param> /// <param name="dic"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] // [HttpPost]
public async Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input) // public async Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input)
{ // {
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>() // PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
{ // {
{ "station_id", input.station_id } // { "station_id", input.station_id }
}); // });
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单"); // if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
//
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x => // if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark==null).AnyAsync()) // x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark==null).AnyAsync())
{ // {
await _db.Updateable<PrdOutPackMarkLabel>() // await _db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.is_mark == 0) // .SetColumns(x => x.is_mark == 0)
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && // .Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 &&
x.is_mark == null) // x.is_mark == null)
.ExecuteCommandAsync(); // .ExecuteCommandAsync();
} // }
else // else
{ // {
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel() // PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{ // {
is_mark = 0, // is_mark = 0,
is_label = null, // is_label = null,
mo_task_code = prdMoTask.mo_task_code, // mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code, // material_code = prdMoTask.material_code,
create_time = DateTime.Now, // create_time = DateTime.Now,
}; // };
//
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync(); // await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
} // }
//
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id); // PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id); // BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
//
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}"; // string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
//
return code; // return code;
} // }
/// <summary> /// <summary>
/// 外包装根据工位id获取贴标数据 /// 外包装根据工位id获取贴标数据
/// </summary> /// </summary>
/// <param name="dic"></param> /// <param name="dic"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] // [HttpPost]
public async Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input) // public async Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input)
{ // {
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>() // PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
{ // {
{ "station_id", input.station_id } // { "station_id", input.station_id }
}); // });
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单"); // if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
//
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x => // if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync()) // x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync())
{ // {
await _db.Updateable<PrdOutPackMarkLabel>() // await _db.Updateable<PrdOutPackMarkLabel>()
.SetColumns(x => x.is_label == 0) // .SetColumns(x => x.is_label == 0)
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && // .Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
x.is_mark == 0) // x.is_mark == 0)
.ExecuteCommandAsync(); // .ExecuteCommandAsync();
} // }
else // else
{ // {
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel() // PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
{ // {
is_mark = null, // is_mark = null,
is_label = 0, // is_label = 0,
mo_task_code = prdMoTask.mo_task_code, // mo_task_code = prdMoTask.mo_task_code,
material_code = prdMoTask.material_code, // material_code = prdMoTask.material_code,
create_time = DateTime.Now, // create_time = DateTime.Now,
}; // };
//
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync(); // await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
} // }
//
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id); // PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id); // BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
//
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}"; // string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
//
return code; // return code;
} // }
/// <summary> /// <summary>
/// 获取喷码贴标信息 /// 获取喷码贴标信息
@@ -4104,7 +4104,7 @@ namespace Tnb.ProductionMgr
batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}"; batch = $"{organizeEntity.EnCode.Substring(organizeEntity.EnCode.Length - 2, 2)}{DateTime.Now.ToString("yyMMdd")}";
} }
string code = $"(01){basMaterial.di ?? ""}*(11){DateTime.Now.ToString("yyMMdd")}*(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}#{basMaterial.material_specification}*{batch}*{DateTime.Now.ToString("yyyyMMdd")}*{DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.material_standard}"; string code = $"(01){basMaterial.di ?? ""}*(11){prdMoTask.act_start_date.Value.ToString("yyMMdd")}*(17){prdMoTask.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}*(10){batch}#{basMaterial.material_specification}*{batch}*{prdMoTask.act_start_date.Value.ToString("yyyyMMdd")}*{prdMoTask.first_start_date.Value.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyyyMMdd")}*{basMaterial.material_standard}";
return code; return code;
} }
} }

View File

@@ -84,4 +84,18 @@ public partial class WmsRawmatOutstockH : BaseEntity<string>
/// </summary> /// </summary>
public string? issuance_status { get; set; } public string? issuance_status { get; set; }
/// <summary>
/// erp领出仓库
/// </summary>
public string? erp_outstock { get; set; }
/// <summary>
/// erp领用仓库
/// </summary>
public string? erp_instock { get; set; }
/// <summary>
/// erp成本域
/// </summary>
public string? erp_org_costregion { get; set; } = "1001A1100000001MNB3H";
} }

View File

@@ -2182,6 +2182,8 @@ namespace Tnb.WarehouseMgr
} }
} }
OrganizeEntity dept = await db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==input.dept_code).FirstAsync();
WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH(); WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH();
string code = await _billRuleService.GetBillNumber("rawmatoutstock"); string code = await _billRuleService.GetBillNumber("rawmatoutstock");
wmsRawmatOutstockH.bill_code = code; wmsRawmatOutstockH.bill_code = code;
@@ -2190,7 +2192,7 @@ namespace Tnb.WarehouseMgr
wmsRawmatOutstockH.erp_bill_code = input.outstock_order; wmsRawmatOutstockH.erp_bill_code = input.outstock_order;
wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID; wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
//wmsRawmatOutstockH.biller = input.biller; //wmsRawmatOutstockH.biller = input.biller;
wmsRawmatOutstockH.department = input.dept_code; wmsRawmatOutstockH.department = dept?.Id ?? input.dept_code;
wmsRawmatOutstockH.erp_pk = input.erp_pk; wmsRawmatOutstockH.erp_pk = input.erp_pk;
wmsRawmatOutstockH.issuance_status = "0"; wmsRawmatOutstockH.issuance_status = "0";
List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>(); List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>();
@@ -2312,6 +2314,8 @@ namespace Tnb.WarehouseMgr
} }
} }
OrganizeEntity dept = await db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==input.dept_code).FirstAsync();
WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH(); WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH();
string code = await _billRuleService.GetBillNumber("rawmatoutstock"); string code = await _billRuleService.GetBillNumber("rawmatoutstock");
wmsRawmatOutstockH.bill_code = code; wmsRawmatOutstockH.bill_code = code;
@@ -2320,7 +2324,7 @@ namespace Tnb.WarehouseMgr
wmsRawmatOutstockH.erp_bill_code = input.outstock_order; wmsRawmatOutstockH.erp_bill_code = input.outstock_order;
wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID; wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
//wmsRawmatOutstockH.biller = input.biller; //wmsRawmatOutstockH.biller = input.biller;
wmsRawmatOutstockH.department = input.dept_code; wmsRawmatOutstockH.department = dept?.Id ?? input.dept_code;
wmsRawmatOutstockH.erp_pk = input.erp_pk; wmsRawmatOutstockH.erp_pk = input.erp_pk;
wmsRawmatOutstockH.issuance_status = "0"; wmsRawmatOutstockH.issuance_status = "0";
List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>(); List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>();

View File

@@ -488,10 +488,10 @@ namespace Tnb.WarehouseMgr
//string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID; //string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID;
string erpCreateId = WmsWareHouseConst.ERPUSERID; string erpCreateId = WmsWareHouseConst.ERPUSERID;
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync(); List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync();
BasWarehouse outWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_outstock); // BasWarehouse outWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_outstock);
BasWarehouse inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock); // BasWarehouse inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock);
string inwhcode = inWarehouse?.whcode ?? ""; // string inwhcode = inWarehouse?.whcode ?? "";
string outwhcode = outWarehouse?.whcode ?? ""; // string outwhcode = outWarehouse?.whcode ?? "";
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>(); List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
@@ -504,11 +504,11 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("corpvid", erpOrg.corpoid); erpRequestData.Add("corpvid", erpOrg.corpoid);
erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org); erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org);
// erpRequestData.Add("cotherwhid", erpExtendFields.Find(x => x.table_id == wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? ""); // erpRequestData.Add("cotherwhid", erpExtendFields.Find(x => x.table_id == wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "");
erpRequestData.Add("cotherwhid", erpWarehouserelaHs.Find(x => x.wms_warehousecode == inwhcode)?.erp_warehouseid ?? ""); erpRequestData.Add("cotherwhid", erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_instock)?.erp_warehouseid ?? "");
erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId); erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("ctrantypeid", "0001H11000000000D31X"); erpRequestData.Add("ctrantypeid", "0001H11000000000D31X");
erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x => x.wms_warehousecode == outwhcode)?.erp_warehouseid ?? ""); erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_outstock)?.erp_warehouseid ?? "");
erpRequestData.Add("dbilldate", nowStr); erpRequestData.Add("dbilldate", nowStr);
erpRequestData.Add("dmakedate", nowStr); erpRequestData.Add("dmakedate", nowStr);
erpRequestData.Add("ntotalnum", wmsMaterialSignDs.Sum(r => r.sign_qty)); erpRequestData.Add("ntotalnum", wmsMaterialSignDs.Sum(r => r.sign_qty));
@@ -522,7 +522,7 @@ namespace Tnb.WarehouseMgr
erpRequestDataDetails.Add(new Dictionary<string, object>() erpRequestDataDetails.Add(new Dictionary<string, object>()
{ {
["cbodytranstypecode"] = "4I-02", ["cbodytranstypecode"] = "4I-02",
["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.wms_warehousecode == outwhcode)?.erp_warehouseid ?? "", ["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_outstock)?.erp_warehouseid ?? "",
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialoid ?? "", ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialoid ?? "",
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "", ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "",
["corpoid"] = erpOrg.corpoid, ["corpoid"] = erpOrg.corpoid,
@@ -562,7 +562,11 @@ namespace Tnb.WarehouseMgr
BasFactoryConfig callErp2 = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP); BasFactoryConfig callErp2 = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);
if(callErp2.value=="1"){ if(callErp2.value=="1"){
await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db); ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord }, "自动", _db);
if (thirdResult.Code!=200)
{
throw Oops.Bah(thirdResult.msgResult);
}
} }
if (wmsMaterialTransfer.type == WmsWareHouseConst.MATERIALTRANSFER_JZGLRK_CODE if (wmsMaterialTransfer.type == WmsWareHouseConst.MATERIALTRANSFER_JZGLRK_CODE
@@ -638,7 +642,11 @@ namespace Tnb.WarehouseMgr
Logger.LogInformation("【WmsMaterialSignHService ModifyAsync】同步其它入库单到erp成功"); Logger.LogInformation("【WmsMaterialSignHService ModifyAsync】同步其它入库单到erp成功");
if(callErp2.value=="1"){ if(callErp2.value=="1"){
await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord2 }, "自动", _db); ThirdResult thirdResult = await _thirdApiRecordService.Send(new List<ThirdWebapiRecord> { thirdWebapiRecord2 }, "自动", _db);
if (thirdResult.Code!=200)
{
throw Oops.Bah(thirdResult.msgResult);
}
} }
} }
break; break;

View File

@@ -1204,10 +1204,10 @@ namespace Tnb.WarehouseMgr
// string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID; // string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID;
string erpCreateId = WmsWareHouseConst.ERPUSERID; string erpCreateId = WmsWareHouseConst.ERPUSERID;
List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync(); List<WmsErpWarehouserelaH> erpWarehouserelaHs = await _db.Queryable<WmsErpWarehouserelaH>().Where(x => x.id != null).ToListAsync();
BasWarehouse outWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_outstock); // BasWarehouse outWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_outstock);
BasWarehouse inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock); // BasWarehouse inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock);
string inwhcode = inWarehouse?.whcode ?? ""; // string inwhcode = inWarehouse?.whcode ?? "";
string outwhcode = outWarehouse?.whcode ?? ""; // string outwhcode = outWarehouse?.whcode ?? "";
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>(); List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
@@ -1220,11 +1220,11 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("corpvid", erpOrg.corpoid); erpRequestData.Add("corpvid", erpOrg.corpoid);
erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org); erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org);
// erpRequestData.Add("cotherwhid", erpExtendFields.Find(x => x.table_id == wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? ""); // erpRequestData.Add("cotherwhid", erpExtendFields.Find(x => x.table_id == wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "");
erpRequestData.Add("cotherwhid", erpWarehouserelaHs.Find(x => x.wms_warehousecode == inwhcode)?.erp_warehouseid ?? ""); erpRequestData.Add("cotherwhid", erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_instock)?.erp_warehouseid ?? "");
erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId); erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("ctrantypeid", "0001H11000000000D31X"); erpRequestData.Add("ctrantypeid", "0001H11000000000D31X");
erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x => x.wms_warehousecode == outwhcode)?.erp_warehouseid ?? ""); erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_outstock)?.erp_warehouseid ?? "");
erpRequestData.Add("dbilldate", nowStr); erpRequestData.Add("dbilldate", nowStr);
erpRequestData.Add("dmakedate", nowStr); erpRequestData.Add("dmakedate", nowStr);
erpRequestData.Add("ntotalnum", wmsCarryCodes.Sum(r => r.codeqty)); erpRequestData.Add("ntotalnum", wmsCarryCodes.Sum(r => r.codeqty));
@@ -1238,7 +1238,7 @@ namespace Tnb.WarehouseMgr
erpRequestDataDetails.Add(new Dictionary<string, object>() erpRequestDataDetails.Add(new Dictionary<string, object>()
{ {
["cbodytranstypecode"] = "4I-02", ["cbodytranstypecode"] = "4I-02",
["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.wms_warehousecode == outwhcode)?.erp_warehouseid ?? "", ["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.erp_warehousecode == wmsMaterialTransfer.erp_warehouse_outstock)?.erp_warehouseid ?? "",
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialoid ?? "", ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialoid ?? "",
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "", ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "",
["corpoid"] = erpOrg.corpoid, ["corpoid"] = erpOrg.corpoid,

View File

@@ -89,6 +89,7 @@ namespace Tnb.WarehouseMgr
.Where(r => r.carry_id == input.wmsDistaskH.carry_id) .Where(r => r.carry_id == input.wmsDistaskH.carry_id)
.Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno) .Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
.ToListAsync(); .ToListAsync();
List<string> supplierIds = wmsCarryCodes.Select(x => x.auxprop_gys).Distinct().ToList();
decimal qty = wmsCarryCodes.Sum(r => r.codeqty); decimal qty = wmsCarryCodes.Sum(r => r.codeqty);
@@ -96,7 +97,7 @@ namespace Tnb.WarehouseMgr
List<string> materialIds = wmsCarryCodes.Select(x => x.material_id).ToList(); List<string> materialIds = wmsCarryCodes.Select(x => x.material_id).ToList();
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>() List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId) .LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode)) .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && (unitCodes.Contains(y.EnCode) || unitCodes.Contains(y.Id)))
.Select((x, y) => y) .Select((x, y) => y)
.ToListAsync(); .ToListAsync();
@@ -107,11 +108,12 @@ namespace Tnb.WarehouseMgr
.FirstAsync(); .FirstAsync();
OrganizeEntity dept = await _db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==wmsRawmatOutstockH.department).FirstAsync(); OrganizeEntity dept = await _db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==wmsRawmatOutstockH.department).FirstAsync();
string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID; // string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID;
List<string> tableIds = new List<string>(); List<string> tableIds = new List<string>();
tableIds.Add(WmsWareHouseConst.AdministratorOrgId); tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
tableIds.AddRange(materialIds); tableIds.AddRange(materialIds);
tableIds.Add(supplierId); // tableIds.Add(supplierId);
tableIds.AddRange(supplierIds);
tableIds.Add(dept?.Id); tableIds.Add(dept?.Id);
tableIds.Add(tranTypeDataEntity?.Id); tableIds.Add(tranTypeDataEntity?.Id);
tableIds.AddRange(unitDatas.Select(x => x.Id).ToList()); tableIds.AddRange(unitDatas.Select(x => x.Id).ToList());
@@ -128,10 +130,11 @@ namespace Tnb.WarehouseMgr
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>(); List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
Dictionary<string, object> erpRequestData = new Dictionary<string, object>(); Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
erpRequestData.Add("billmaker", erpCreateId); erpRequestData.Add("billmaker", erpCreateId);
erpRequestData.Add("ccostdomainoid", null); erpRequestData.Add("ccostdomainoid", wmsRawmatOutstockH.erp_org_costregion ?? "1001A1100000001MNB3H");
erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org); erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v); erpRequestData.Add("cdrawcalbodyvid", erpOrg.pk_org_v);
// erpRequestData.Add("cdrawwarehouseid", null); erpRequestData.Add("cdrawwarehouseid", wmsRawmatOutstockH.erp_instock);
erpRequestData.Add("cwarehouseid", wmsRawmatOutstockH.erp_outstock);
erpRequestData.Add("cdptid", erpExtendFields.Find(x=>x.table_id==dept?.Id)?.cdptid ?? ""); erpRequestData.Add("cdptid", erpExtendFields.Find(x=>x.table_id==dept?.Id)?.cdptid ?? "");
erpRequestData.Add("cdptvid", erpExtendFields.Find(x=>x.table_id==dept?.Id)?.cdptvid ?? ""); erpRequestData.Add("cdptvid", erpExtendFields.Find(x=>x.table_id==dept?.Id)?.cdptvid ?? "");
erpRequestData.Add("cfanaceorgoid", erpOrg.corpoid); erpRequestData.Add("cfanaceorgoid", erpOrg.corpoid);
@@ -141,7 +144,6 @@ namespace Tnb.WarehouseMgr
erpRequestData.Add("creationtime", nowStr); erpRequestData.Add("creationtime", nowStr);
erpRequestData.Add("creator", erpCreateId); erpRequestData.Add("creator", erpCreateId);
erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x=>x.table_id==tranTypeDataEntity?.Id)?.transaction_type_id ?? "");//先写死 erpRequestData.Add("ctrantypeid", erpExtendFields.Find(x=>x.table_id==tranTypeDataEntity?.Id)?.transaction_type_id ?? "");//先写死
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatOutstockH.warehouse_id)?.erp_warehouseid ?? "");
erpRequestData.Add("dbilldate", wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")); erpRequestData.Add("dbilldate", wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"));
erpRequestData.Add("dmakedate", nowStr); erpRequestData.Add("dmakedate", nowStr);
erpRequestData.Add("fbillflag", 2); erpRequestData.Add("fbillflag", 2);
@@ -160,14 +162,15 @@ namespace Tnb.WarehouseMgr
erpRequestDataDetails.Add(new Dictionary<string, object>() erpRequestDataDetails.Add(new Dictionary<string, object>()
{ {
["cbodytranstypecode"] = wmsRawmatOutstockH.outstock_type, ["cbodytranstypecode"] = wmsRawmatOutstockH.outstock_type,
["cbodywarehouseid"] = wmsRawmatOutstockH.erp_outstock,
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "", ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "", ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
["corpoid"] = erpOrg.corpoid, ["corpoid"] = erpOrg.corpoid,
["corpvid"] = erpOrg.corpvid, ["corpvid"] = erpOrg.corpvid,
["crowno"] = wmsRawmatOutstockD.lineno, ["crowno"] = wmsRawmatOutstockD.lineno,
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "", ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id || x.Id==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "", ["cvendorid"] = erpExtendFields.Find((x=>x.table_id==item.auxprop_gys))?.supplier_id ?? "",
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "", ["cvendorvid"] = erpExtendFields.Find((x=>x.table_id==item.auxprop_gys))?.supplier_vid ?? "",
["dbizdate"] = wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"), ["dbizdate"] = wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
["nshouldnum"] = item.codeqty, ["nshouldnum"] = item.codeqty,
["nnum"] = item.codeqty, ["nnum"] = item.codeqty,
@@ -186,10 +189,11 @@ namespace Tnb.WarehouseMgr
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP; thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
thirdWebapiRecord.name = "材料出库单(自制)"; thirdWebapiRecord.name = "材料出库单(自制)";
thirdWebapiRecord.method = "POST"; thirdWebapiRecord.method = "POST";
thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save"; // thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save"; thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/materialOut/self/save";
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData); thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
thirdWebapiRecord.create_time = DateTime.Now; thirdWebapiRecord.create_time = DateTime.Now;
thirdWebapiRecord.remark = $"材料出库wms_rawmat_outstock_h:{wmsRawmatOutstockH.bill_code}";
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync(); await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP); BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);