Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -11,6 +11,6 @@ namespace Tnb.BasicData.Interfaces
|
||||
/// <param name="id"></param>
|
||||
/// <param name="send_type">手动 自动</param>
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,8 @@ namespace Tnb.BasicData
|
||||
public async Task<string> Send(string 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]
|
||||
@@ -88,14 +89,14 @@ namespace Tnb.BasicData
|
||||
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;
|
||||
bool tranFlag = true;
|
||||
try
|
||||
{
|
||||
if (records == null || records.IsEmpty())
|
||||
return "";
|
||||
return new ThirdResult();
|
||||
|
||||
if (db == null)
|
||||
{
|
||||
@@ -272,9 +273,9 @@ namespace Tnb.BasicData
|
||||
Log.Error(e.Message,e);
|
||||
if(tranFlag) await db.Ado.RollbackTranAsync();
|
||||
}
|
||||
|
||||
|
||||
return thirdResult.Code == 200 ? "成功" : "失败";
|
||||
|
||||
return thirdResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,20 +37,20 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<List<PrdMoTask>> GetPrdMoTaskListByStationId(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 外包装根据工位id获取喷码数据
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input);
|
||||
// /// <summary>
|
||||
// /// 外包装根据工位id获取喷码数据
|
||||
// /// </summary>
|
||||
// /// <param name="dic"></param>
|
||||
// /// <returns></returns>
|
||||
// Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 外包装根据工位id获取贴标数据
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
|
||||
// /// <summary>
|
||||
// /// 外包装根据工位id获取贴标数据
|
||||
// /// </summary>
|
||||
// /// <param name="dic"></param>
|
||||
// /// <returns></returns>
|
||||
// Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input);
|
||||
|
||||
Task<string> PrdReport(PrdReportCrInput input);
|
||||
|
||||
|
||||
@@ -1606,8 +1606,8 @@ namespace Tnb.ProductionMgr
|
||||
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 code1 = $"(01){basMaterial.di ?? ""}*(11){DateTime.Now.ToString("yyMMdd")}*(17){DateTime.Now.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 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}*{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)
|
||||
{
|
||||
["DevName"] = "外包装箱码垛线",
|
||||
@@ -3921,90 +3921,90 @@ namespace Tnb.ProductionMgr
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input)
|
||||
{
|
||||
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
|
||||
{
|
||||
{ "station_id", input.station_id }
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
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())
|
||||
{
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_mark == 0)
|
||||
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 &&
|
||||
x.is_mark == null)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
{
|
||||
is_mark = 0,
|
||||
is_label = null,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
};
|
||||
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> GetMarkingInfoByStationId(MarkingLabelInput input)
|
||||
// {
|
||||
// PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
|
||||
// {
|
||||
// { "station_id", input.station_id }
|
||||
// });
|
||||
// if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
//
|
||||
// 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())
|
||||
// {
|
||||
// await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
// .SetColumns(x => x.is_mark == 0)
|
||||
// .Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 &&
|
||||
// x.is_mark == null)
|
||||
// .ExecuteCommandAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
// {
|
||||
// is_mark = 0,
|
||||
// is_label = null,
|
||||
// mo_task_code = prdMoTask.mo_task_code,
|
||||
// material_code = prdMoTask.material_code,
|
||||
// create_time = DateTime.Now,
|
||||
// };
|
||||
//
|
||||
// await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// 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;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 外包装根据工位id获取贴标数据
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input)
|
||||
{
|
||||
PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
|
||||
{
|
||||
{ "station_id", input.station_id }
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
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())
|
||||
{
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_label == 0)
|
||||
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
|
||||
x.is_mark == 0)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
{
|
||||
is_mark = null,
|
||||
is_label = 0,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
};
|
||||
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> GetLabelInfoByStationId(MarkingLabelInput input)
|
||||
// {
|
||||
// PrdMoTask prdMoTask = await GetPrdMoTaskInfoByStationId(new Dictionary<string, string>()
|
||||
// {
|
||||
// { "station_id", input.station_id }
|
||||
// });
|
||||
// if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
//
|
||||
// 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())
|
||||
// {
|
||||
// await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
// .SetColumns(x => x.is_label == 0)
|
||||
// .Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
|
||||
// x.is_mark == 0)
|
||||
// .ExecuteCommandAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
// {
|
||||
// is_mark = null,
|
||||
// is_label = 0,
|
||||
// mo_task_code = prdMoTask.mo_task_code,
|
||||
// material_code = prdMoTask.material_code,
|
||||
// create_time = DateTime.Now,
|
||||
// };
|
||||
//
|
||||
// await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// 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;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 获取喷码贴标信息
|
||||
@@ -4104,7 +4104,7 @@ namespace Tnb.ProductionMgr
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,5 +83,19 @@ public partial class WmsRawmatOutstockH : BaseEntity<string>
|
||||
/// 下发状态
|
||||
/// </summary>
|
||||
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";
|
||||
|
||||
}
|
||||
|
||||
@@ -2181,6 +2181,8 @@ namespace Tnb.WarehouseMgr
|
||||
await db.Deleteable<WmsRawmatOutstockD>().Where(r => r.bill_id == wmsRawmatOutstockHRep.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
OrganizeEntity dept = await db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==input.dept_code).FirstAsync();
|
||||
|
||||
WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH();
|
||||
string code = await _billRuleService.GetBillNumber("rawmatoutstock");
|
||||
@@ -2190,7 +2192,7 @@ namespace Tnb.WarehouseMgr
|
||||
wmsRawmatOutstockH.erp_bill_code = input.outstock_order;
|
||||
wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
|
||||
//wmsRawmatOutstockH.biller = input.biller;
|
||||
wmsRawmatOutstockH.department = input.dept_code;
|
||||
wmsRawmatOutstockH.department = dept?.Id ?? input.dept_code;
|
||||
wmsRawmatOutstockH.erp_pk = input.erp_pk;
|
||||
wmsRawmatOutstockH.issuance_status = "0";
|
||||
List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>();
|
||||
@@ -2311,6 +2313,8 @@ namespace Tnb.WarehouseMgr
|
||||
await db.Deleteable<WmsRawmatOutstockD>().Where(r => r.bill_id == wmsRawmatOutstockHRep.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
OrganizeEntity dept = await db.Queryable<OrganizeEntity>().Where(x=>x.EnCode==input.dept_code).FirstAsync();
|
||||
|
||||
WmsRawmatOutstockH wmsRawmatOutstockH = new WmsRawmatOutstockH();
|
||||
string code = await _billRuleService.GetBillNumber("rawmatoutstock");
|
||||
@@ -2320,7 +2324,7 @@ namespace Tnb.WarehouseMgr
|
||||
wmsRawmatOutstockH.erp_bill_code = input.outstock_order;
|
||||
wmsRawmatOutstockH.warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID;
|
||||
//wmsRawmatOutstockH.biller = input.biller;
|
||||
wmsRawmatOutstockH.department = input.dept_code;
|
||||
wmsRawmatOutstockH.department = dept?.Id ?? input.dept_code;
|
||||
wmsRawmatOutstockH.erp_pk = input.erp_pk;
|
||||
wmsRawmatOutstockH.issuance_status = "0";
|
||||
List<WmsRawmatOutstockD> wmsRawmatOutstockDs = new List<WmsRawmatOutstockD>();
|
||||
|
||||
@@ -488,10 +488,10 @@ namespace Tnb.WarehouseMgr
|
||||
//string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID;
|
||||
string erpCreateId = WmsWareHouseConst.ERPUSERID;
|
||||
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 inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock);
|
||||
string inwhcode = inWarehouse?.whcode ?? "";
|
||||
string outwhcode = outWarehouse?.whcode ?? "";
|
||||
// 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);
|
||||
// string inwhcode = inWarehouse?.whcode ?? "";
|
||||
// string outwhcode = outWarehouse?.whcode ?? "";
|
||||
|
||||
|
||||
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||
@@ -504,11 +504,11 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestData.Add("corpvid", erpOrg.corpoid);
|
||||
erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org);
|
||||
// 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("creator", erpCreateId);
|
||||
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("dmakedate", nowStr);
|
||||
erpRequestData.Add("ntotalnum", wmsMaterialSignDs.Sum(r => r.sign_qty));
|
||||
@@ -522,7 +522,7 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||
{
|
||||
["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 ?? "",
|
||||
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "",
|
||||
["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);
|
||||
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
|
||||
@@ -638,7 +642,11 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation("【WmsMaterialSignHService ModifyAsync】同步其它入库单到erp成功");
|
||||
|
||||
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;
|
||||
|
||||
@@ -1204,10 +1204,10 @@ namespace Tnb.WarehouseMgr
|
||||
// string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? WmsWareHouseConst.ERPUSERID;
|
||||
string erpCreateId = WmsWareHouseConst.ERPUSERID;
|
||||
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 inWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x => x.id == wmsMaterialTransfer.warehouse_instock);
|
||||
string inwhcode = inWarehouse?.whcode ?? "";
|
||||
string outwhcode = outWarehouse?.whcode ?? "";
|
||||
// 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);
|
||||
// string inwhcode = inWarehouse?.whcode ?? "";
|
||||
// string outwhcode = outWarehouse?.whcode ?? "";
|
||||
|
||||
|
||||
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||
@@ -1220,11 +1220,11 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestData.Add("corpvid", erpOrg.corpoid);
|
||||
erpRequestData.Add("cothercalbodyoid", erpOrg.pk_org);
|
||||
// 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("creator", erpCreateId);
|
||||
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("dmakedate", nowStr);
|
||||
erpRequestData.Add("ntotalnum", wmsCarryCodes.Sum(r => r.codeqty));
|
||||
@@ -1238,7 +1238,7 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||
{
|
||||
["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 ?? "",
|
||||
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == wmsMaterialTransferd.material_id)?.cmaterialvid ?? "",
|
||||
["corpoid"] = erpOrg.corpoid,
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace Tnb.WarehouseMgr
|
||||
.Where(r => r.carry_id == input.wmsDistaskH.carry_id)
|
||||
.Where(r => r.material_id == wmsRawmatOutstockD.material_id && r.code_batch == wmsRawmatOutstockD.batchno)
|
||||
.ToListAsync();
|
||||
List<string> supplierIds = wmsCarryCodes.Select(x => x.auxprop_gys).Distinct().ToList();
|
||||
|
||||
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<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||
.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)
|
||||
.ToListAsync();
|
||||
|
||||
@@ -107,11 +108,12 @@ namespace Tnb.WarehouseMgr
|
||||
.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>();
|
||||
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||
tableIds.AddRange(materialIds);
|
||||
tableIds.Add(supplierId);
|
||||
// tableIds.Add(supplierId);
|
||||
tableIds.AddRange(supplierIds);
|
||||
tableIds.Add(dept?.Id);
|
||||
tableIds.Add(tranTypeDataEntity?.Id);
|
||||
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>>();
|
||||
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||
erpRequestData.Add("billmaker", erpCreateId);
|
||||
erpRequestData.Add("ccostdomainoid", null);
|
||||
erpRequestData.Add("ccostdomainoid", wmsRawmatOutstockH.erp_org_costregion ?? "1001A1100000001MNB3H");
|
||||
erpRequestData.Add("cdrawcalbodyoid", erpOrg.pk_org);
|
||||
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("cdptvid", erpExtendFields.Find(x=>x.table_id==dept?.Id)?.cdptvid ?? "");
|
||||
erpRequestData.Add("cfanaceorgoid", erpOrg.corpoid);
|
||||
@@ -141,7 +144,6 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestData.Add("creationtime", nowStr);
|
||||
erpRequestData.Add("creator", erpCreateId);
|
||||
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("dmakedate", nowStr);
|
||||
erpRequestData.Add("fbillflag", 2);
|
||||
@@ -160,14 +162,15 @@ namespace Tnb.WarehouseMgr
|
||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||
{
|
||||
["cbodytranstypecode"] = wmsRawmatOutstockH.outstock_type,
|
||||
["cbodywarehouseid"] = wmsRawmatOutstockH.erp_outstock,
|
||||
["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,
|
||||
["corpvid"] = erpOrg.corpvid,
|
||||
["crowno"] = wmsRawmatOutstockD.lineno,
|
||||
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||
["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==item.auxprop_gys))?.supplier_id ?? "",
|
||||
["cvendorvid"] = erpExtendFields.Find((x=>x.table_id==item.auxprop_gys))?.supplier_vid ?? "",
|
||||
["dbizdate"] = wmsRawmatOutstockH.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
["nshouldnum"] = item.codeqty,
|
||||
["nnum"] = item.codeqty,
|
||||
@@ -186,10 +189,11 @@ namespace Tnb.WarehouseMgr
|
||||
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||
thirdWebapiRecord.name = "材料出库单(自制)";
|
||||
thirdWebapiRecord.method = "POST";
|
||||
thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
|
||||
// thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save";
|
||||
// thirdWebapiRecord.url = config.value + "uapws/rest/materialOut/self/save";
|
||||
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/materialOut/self/save";
|
||||
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||
thirdWebapiRecord.create_time = DateTime.Now;
|
||||
thirdWebapiRecord.remark = $"材料出库wms_rawmat_outstock_h:{wmsRawmatOutstockH.bill_code}";
|
||||
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||
|
||||
BasFactoryConfig callErp = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.CALLERP);
|
||||
|
||||
Reference in New Issue
Block a user