bip调拨入库单类型修改;产成品入库生产入库子表数据
This commit is contained in:
@@ -379,56 +379,10 @@ namespace Tnb.BasicData
|
|||||||
Log.Error($"产成品入库同步BIP后,更新生产入库记录失败,请求数据为空:{record.request_data}");
|
Log.Error($"产成品入库同步BIP后,更新生产入库记录失败,请求数据为空:{record.request_data}");
|
||||||
foreach (var reqData in requestDatas)
|
foreach (var reqData in requestDatas)
|
||||||
{
|
{
|
||||||
var report_id = reqData["report_id"].ToString();
|
|
||||||
var prd_instock_h_id = reqData["prd_instock_h_id"].ToString();
|
var prd_instock_h_id = reqData["prd_instock_h_id"].ToString();
|
||||||
if (string.IsNullOrEmpty(report_id))
|
|
||||||
{
|
|
||||||
Log.Error($"请求记录id{record.id},生产提报记录id为空");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
PrdReport prdReport = await db.Queryable<PrdReport>().SingleAsync(r => r.id == report_id);
|
|
||||||
|
|
||||||
#region 修改生成入库记录主表数据为已同步bip
|
#region 修改生成入库记录主表数据为已同步bip
|
||||||
var wmsPrdInstockD = await db.Queryable<WmsPrdInstockD>().SingleAsync(r => r.prd_report_id == report_id);
|
|
||||||
if(wmsPrdInstockD==null)
|
|
||||||
{
|
|
||||||
Log.Error($"请求记录id{record.id},提报记录id{report_id}未找到对应的wms_prd_instock_d表中记录");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
WmsPrdInstockH wmsPrdInstockH = await db.Queryable<WmsPrdInstockH>().SingleAsync(r => r.id == wmsPrdInstockD.prd_instock_id);
|
|
||||||
|
|
||||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
|
|
||||||
|
|
||||||
if(prdMoTask==null)
|
|
||||||
{
|
|
||||||
Log.Error($"请求记录id{record.id},生产任务id{prdReport.mo_task_id}未找到对应的生产任务信息数据");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.Updateable<PrdInstockH>().SetColumns(r => r.is_sync_bip == 1).Where(r => r.id == prd_instock_h_id).ExecuteCommandAsync();
|
await db.Updateable<PrdInstockH>().SetColumns(r => r.is_sync_bip == 1).Where(r => r.id == prd_instock_h_id).ExecuteCommandAsync();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生成入库记录子表数据
|
|
||||||
List<WmsPrdInstockCode> allInstockDetails = await db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instockD_id == wmsPrdInstockD.id).OrderBy(x => x.id).ToListAsync();
|
|
||||||
if (allInstockDetails == null)
|
|
||||||
continue;
|
|
||||||
foreach(var _detail in allInstockDetails)
|
|
||||||
{
|
|
||||||
PrdInstockD prdInstockD = new PrdInstockD();
|
|
||||||
prdInstockD.id = SnowflakeIdHelper.NextId();
|
|
||||||
prdInstockD.instock_id = prd_instock_h_id;
|
|
||||||
prdInstockD.material_id = wmsPrdInstockH.material_id;
|
|
||||||
prdInstockD.material_code= wmsPrdInstockH.material_code;
|
|
||||||
prdInstockD.unit_id = _detail.unit_id;
|
|
||||||
prdInstockD.quantity = _detail.pqty.HasValue ? Convert.ToInt32(_detail.pqty) : 0;
|
|
||||||
prdInstockD.code_batch= _detail.code_batch;
|
|
||||||
prdInstockD.barcode=prdReport.barcode;
|
|
||||||
prdInstockD.report_id = report_id;
|
|
||||||
prdInstockD.mo_task_code = prdMoTask?.mo_task_code;
|
|
||||||
await db.Insertable(prdInstockD).ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
|||||||
/// 灭菌入库
|
/// 灭菌入库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string MATERIALTRANSFER_SterilizationInstock_CODE = "SterilizationInstock";
|
public const string MATERIALTRANSFER_SterilizationInstock_CODE = "SterilizationInstock";
|
||||||
|
/// <summary>
|
||||||
|
/// 调拨静置成品入库
|
||||||
|
/// </summary>
|
||||||
|
public const string MATERIALTRANSFER_Transferstanding_CODE = "Transferstanding";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出入库单据状态TypeID
|
/// 出入库单据状态TypeID
|
||||||
|
|||||||
@@ -977,18 +977,21 @@ namespace Tnb.WarehouseMgr
|
|||||||
// 灭菌入库
|
// 灭菌入库
|
||||||
else if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_MJC_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_CP_ID)
|
else if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_MJC_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_CP_ID)
|
||||||
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_SterilizationInstock_CODE;
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_SterilizationInstock_CODE;
|
||||||
|
//调拨静置成品入库
|
||||||
|
else if (warehouse_outstock.id == WmsWareHouseConst.WAREHOUSE_JXK_ID && warehouse_instock.id == WmsWareHouseConst.WAREHOUSE_CP_ID)
|
||||||
|
transfer_type = WmsWareHouseConst.MATERIALTRANSFER_Transferstanding_CODE;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
//var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
||||||
//{
|
//{
|
||||||
// material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
// code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
//}).Distinct();
|
//}).Distinct();
|
||||||
//if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
//if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
||||||
//{
|
//{
|
||||||
// _LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
||||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -384,42 +384,30 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
await _db.Insertable(prdInstockH).ExecuteCommandAsync();
|
await _db.Insertable(prdInstockH).ExecuteCommandAsync();
|
||||||
|
|
||||||
//prdInstockH = await _db.Queryable<PrdInstockH>().Where(r => r.mo_task_id == prdReport.mo_task_id).FirstAsync();
|
#region 生成入库记录子表数据
|
||||||
//if (prdInstockH != null)
|
List<WmsPrdInstockCode> wmsPrdInstockCodes = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instockD_id == wmsPrdInstockD.id).OrderBy(x => x.id).ToListAsync();
|
||||||
//{
|
|
||||||
// prdInstockH.bill_type = instock.type;
|
|
||||||
// prdInstockH.warehouse_id = wmsPrdInstockD.warehouse_id;
|
|
||||||
// prdInstockH.carry_code = wmsPrdInstockD.carry_id;
|
|
||||||
// prdInstockH.location_code = wmsPrdInstockD.startlocation_id;
|
|
||||||
// prdInstockH.create_id = prdReport?.create_id ?? wmsPrdInstockD.create_id;
|
|
||||||
// prdInstockH.org_id = instock.org_id;
|
|
||||||
// prdInstockH.station_id = prdMoTask?.workstation_id;
|
|
||||||
// prdInstockH.workline_id = prdMoTask?.workline_id;
|
|
||||||
// prdInstockH.mo_task_id = prdReport?.mo_task_id;
|
|
||||||
// prdInstockH.code = instock.bill_code;
|
|
||||||
// prdInstockH.is_sync_bip = 0;
|
|
||||||
// await _db.Updateable(prdInstockH).ExecuteCommandAsync();
|
|
||||||
// Logger.LogInformation($"【WmsPrdInstockHService ModifyAsync】更新生产入库记录,id:{prdInstockH.id}");
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// prdInstockH.id = SnowflakeIdHelper.NextId();
|
|
||||||
// prdInstockH.bill_type = instock.type;
|
|
||||||
// prdInstockH.warehouse_id = wmsPrdInstockD.warehouse_id;
|
|
||||||
// prdInstockH.carry_code = wmsPrdInstockD.carry_id;
|
|
||||||
// prdInstockH.location_code = wmsPrdInstockD.startlocation_id;
|
|
||||||
// prdInstockH.create_id = prdReport?.create_id ?? wmsPrdInstockD.create_id;
|
|
||||||
// prdInstockH.org_id = instock.org_id;
|
|
||||||
// prdInstockH.station_id = prdMoTask?.workstation_id;
|
|
||||||
// prdInstockH.workline_id = prdMoTask?.workline_id;
|
|
||||||
// prdInstockH.mo_task_id = prdReport?.mo_task_id;
|
|
||||||
// prdInstockH.code = instock.bill_code;
|
|
||||||
// prdInstockH.is_sync_bip = 0;
|
|
||||||
|
|
||||||
// await _db.Insertable(prdInstockH).ExecuteCommandAsync();
|
|
||||||
// Logger.LogInformation($"【WmsPrdInstockHService ModifyAsync】新增生产入库记录,id:{prdInstockH.id}");
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
if (wmsPrdInstockCodes != null)
|
||||||
|
{
|
||||||
|
var prdInstockDs = new List<PrdInstockD>();
|
||||||
|
foreach (var _detail in wmsPrdInstockCodes)
|
||||||
|
{
|
||||||
|
PrdInstockD prdInstockD = new PrdInstockD();
|
||||||
|
prdInstockD.id = SnowflakeIdHelper.NextId();
|
||||||
|
prdInstockD.instock_id = prdInstockH.id;
|
||||||
|
prdInstockD.material_id = instock.material_id;
|
||||||
|
prdInstockD.material_code = instock.material_code;
|
||||||
|
prdInstockD.unit_id = _detail.unit_id;
|
||||||
|
prdInstockD.quantity = _detail.pqty.HasValue ? Convert.ToInt32(_detail.pqty) : 0;
|
||||||
|
prdInstockD.code_batch = _detail.code_batch;
|
||||||
|
prdInstockD.barcode = prdReport.barcode;
|
||||||
|
prdInstockD.report_id = prdReport.id;
|
||||||
|
prdInstockD.mo_task_code = prdMoTask?.mo_task_code;
|
||||||
|
prdInstockDs.Add(prdInstockD);
|
||||||
|
}
|
||||||
|
await _db.Insertable(prdInstockDs).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
//来源erp才产成品入库
|
//来源erp才产成品入库
|
||||||
if (prdMo.mo_source != "1")
|
if (prdMo.mo_source != "1")
|
||||||
|
|||||||
Reference in New Issue
Block a user