bug
This commit is contained in:
@@ -586,239 +586,251 @@ namespace Tnb.ProductionMgr
|
|||||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
{
|
{
|
||||||
Log.Information($"物料呼叫完成回更参数:{JsonConvert.SerializeObject(input)}");
|
Log.Information($"物料呼叫完成回更参数:{JsonConvert.SerializeObject(input)}");
|
||||||
if (input == null)
|
try
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(input));
|
if (input == null)
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(input.requireId))
|
|
||||||
{
|
|
||||||
throw Oops.Bah("来源id为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
var db = _repository.AsSugarClient();
|
|
||||||
PrdMoTask moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.requireId);
|
|
||||||
if (moTask == null)
|
|
||||||
{
|
|
||||||
throw Oops.Bah($"未找到来源id为{input.requireId}的生产任务单");
|
|
||||||
}
|
|
||||||
|
|
||||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
|
|
||||||
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
|
|
||||||
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
|
|
||||||
List<PrdFeedingH> insertFHList = new List<PrdFeedingH>();
|
|
||||||
List<PrdFeedingD> insertFDList = new List<PrdFeedingD>();
|
|
||||||
List<string> clearCarryIds = new List<string>();
|
|
||||||
string orgId = WmsWareHouseConst.AdministratorOrgId;
|
|
||||||
// string userId = moTask.worker_id;
|
|
||||||
string userId = WmsWareHouseConst.AdministratorUserId;
|
|
||||||
if (_userManager != null && !string.IsNullOrEmpty(_userManager.UserId))
|
|
||||||
{
|
|
||||||
userId = _userManager.UserId;
|
|
||||||
}
|
|
||||||
foreach(string carryId in input.carryIds)
|
|
||||||
{
|
|
||||||
clearCarryIds.Add(carryId);
|
|
||||||
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
|
|
||||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
|
||||||
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
|
|
||||||
{
|
{
|
||||||
code = code,
|
throw new ArgumentNullException(nameof(input));
|
||||||
station_id = moTask.workstation_id,
|
}
|
||||||
mo_task_id = moTask.id,
|
|
||||||
process_id = moTask.process_id,
|
if (string.IsNullOrEmpty(input.requireId))
|
||||||
equip_id = moTask.eqp_id,
|
{
|
||||||
workshop_id = workshop?.Id ?? "",
|
throw Oops.Bah("来源id为空");
|
||||||
carry_id = carry.id,
|
}
|
||||||
workline_id = moTask.workline_id,
|
|
||||||
carry_code = carry.carry_code,
|
var db = _repository.AsSugarClient();
|
||||||
mbom_process_id = moTask.mbom_process_id,
|
PrdMoTask moTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.requireId);
|
||||||
create_id = userId,
|
if (moTask == null)
|
||||||
create_time = DateTime.Now,
|
{
|
||||||
org_id = orgId
|
throw Oops.Bah($"未找到来源id为{input.requireId}的生产任务单");
|
||||||
};
|
}
|
||||||
insertHList.Add(prdMaterialReceiptH);
|
|
||||||
|
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
|
||||||
|
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
|
||||||
|
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
|
||||||
|
List<PrdFeedingH> insertFHList = new List<PrdFeedingH>();
|
||||||
|
List<PrdFeedingD> insertFDList = new List<PrdFeedingD>();
|
||||||
|
List<string> clearCarryIds = new List<string>();
|
||||||
|
string orgId = WmsWareHouseConst.AdministratorOrgId;
|
||||||
|
// string userId = moTask.worker_id;
|
||||||
|
string userId = WmsWareHouseConst.AdministratorUserId;
|
||||||
|
if (_userManager != null && !string.IsNullOrEmpty(_userManager.UserId))
|
||||||
|
{
|
||||||
|
userId = _userManager.UserId;
|
||||||
|
}
|
||||||
|
foreach(string carryId in input.carryIds)
|
||||||
|
{
|
||||||
|
clearCarryIds.Add(carryId);
|
||||||
|
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
|
||||||
|
string code = await _billRullService.GetBillNumber(CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
||||||
|
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||||
|
{
|
||||||
|
code = code,
|
||||||
|
station_id = moTask.workstation_id,
|
||||||
|
mo_task_id = moTask.id,
|
||||||
|
process_id = moTask.process_id,
|
||||||
|
equip_id = moTask.eqp_id,
|
||||||
|
workshop_id = workshop?.Id ?? "",
|
||||||
|
carry_id = carry.id,
|
||||||
|
workline_id = moTask.workline_id,
|
||||||
|
carry_code = carry.carry_code,
|
||||||
|
mbom_process_id = moTask.mbom_process_id,
|
||||||
|
create_id = userId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
org_id = orgId
|
||||||
|
};
|
||||||
|
insertHList.Add(prdMaterialReceiptH);
|
||||||
|
|
||||||
string feedCode = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
|
string feedCode = await _billRullService.GetBillNumber(CodeTemplateConst.FEEDING_CODE);
|
||||||
PrdFeedingH prdFeedingH = new PrdFeedingH()
|
PrdFeedingH prdFeedingH = new PrdFeedingH()
|
||||||
{
|
{
|
||||||
code = feedCode,
|
code = feedCode,
|
||||||
station_id = moTask.workstation_id,
|
station_id = moTask.workstation_id,
|
||||||
mo_task_id = moTask.id,
|
mo_task_id = moTask.id,
|
||||||
process_id = moTask.process_id,
|
process_id = moTask.process_id,
|
||||||
// equip_id = input.equip_id,
|
// equip_id = input.equip_id,
|
||||||
workshop_id = workshop?.Id,
|
workshop_id = workshop?.Id,
|
||||||
carry_id = carry.id,
|
carry_id = carry.id,
|
||||||
workline_id = moTask.workline_id,
|
workline_id = moTask.workline_id,
|
||||||
carry_code = carry.carry_code,
|
carry_code = carry.carry_code,
|
||||||
// remark = input.remark,
|
// remark = input.remark,
|
||||||
mbom_process_id = moTask.mbom_process_id,
|
mbom_process_id = moTask.mbom_process_id,
|
||||||
create_id = userId,
|
create_id = userId,
|
||||||
create_time = DateTime.Now,
|
create_time = DateTime.Now,
|
||||||
org_id = orgId
|
org_id = orgId
|
||||||
};
|
};
|
||||||
insertFHList.Add(prdFeedingH);
|
insertFHList.Add(prdFeedingH);
|
||||||
|
|
||||||
List<WmsCarryCode> carryCodes = new List<WmsCarryCode>();
|
List<WmsCarryCode> carryCodes = new List<WmsCarryCode>();
|
||||||
List<string> memberCarryIds = new List<string>();
|
List<string> memberCarryIds = new List<string>();
|
||||||
List<WmsCarryH> memberCarrys = new List<WmsCarryH>();
|
List<WmsCarryH> memberCarrys = new List<WmsCarryH>();
|
||||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID ||
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID ||
|
||||||
carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
||||||
{
|
|
||||||
carryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==carry.id).ToListAsync();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//CarryQueryOutput carryQueryOutput = await _wmsCarryQueryService.MESCarryQueryResult(new MESCarryQueryResultInput(){carry_code = carry.carry_code});
|
|
||||||
memberCarryIds = await db.Queryable<WmsCarryD>().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync();
|
|
||||||
if (memberCarryIds == null || memberCarryIds.IsEmpty())
|
|
||||||
{
|
{
|
||||||
throw Oops.Bah($"未找到载具编号{carry.carry_code}的子载具");
|
carryCodes = await db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==carry.id).ToListAsync();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
memberCarrys = await db.Queryable<WmsCarryH>().Where(x=>memberCarryIds.Contains(x.id)).ToListAsync();
|
|
||||||
carryCodes = await db.Queryable<WmsCarryCode>().Where(x=>memberCarryIds.Contains(x.carry_id)).ToListAsync();
|
|
||||||
clearCarryIds.AddRange(memberCarryIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (carryCodes != null && carryCodes.Count > 0)
|
|
||||||
{
|
|
||||||
Log.Information($"签收载具信息{JsonConvert.SerializeObject(carryCodes)}");
|
|
||||||
foreach (var item in carryCodes)
|
|
||||||
{
|
{
|
||||||
// 自动签收不校验
|
//CarryQueryOutput carryQueryOutput = await _wmsCarryQueryService.MESCarryQueryResult(new MESCarryQueryResultInput(){carry_code = carry.carry_code});
|
||||||
// PrdMaterialReceiptD existD = await db.Queryable<PrdMaterialReceiptD>()
|
memberCarryIds = await db.Queryable<WmsCarryD>().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync();
|
||||||
// .LeftJoin<PrdMaterialReceiptH>((x, y) => x.material_receipt_id == y.id)
|
if (memberCarryIds == null || memberCarryIds.IsEmpty())
|
||||||
// .Where((x, y) => x.carry_id == carry.id && y.mo_task_id == moTask.id && x.is_all_feeding == 0)
|
|
||||||
// .Select((x,y)=>x)
|
|
||||||
// .FirstAsync();
|
|
||||||
// if (existD != null)
|
|
||||||
// {
|
|
||||||
// throw new Exception($"{moTask.mo_task_code}任务单存在未投完的签收物料,物料签收子表id{existD.id}");
|
|
||||||
// }
|
|
||||||
PrdMaterialReceiptD detail = new PrdMaterialReceiptD
|
|
||||||
{
|
{
|
||||||
material_receipt_id = prdMaterialReceiptH.id,
|
throw Oops.Bah($"未找到载具编号{carry.carry_code}的子载具");
|
||||||
material_id = item.material_id,
|
}
|
||||||
num = item.codeqty,
|
|
||||||
batch = item.code_batch,
|
memberCarrys = await db.Queryable<WmsCarryH>().Where(x=>memberCarryIds.Contains(x.id)).ToListAsync();
|
||||||
unit_id = item.unit_id,
|
carryCodes = await db.Queryable<WmsCarryCode>().Where(x=>memberCarryIds.Contains(x.carry_id)).ToListAsync();
|
||||||
carry_id = carry.id,
|
clearCarryIds.AddRange(memberCarryIds);
|
||||||
barcode = item.barcode,
|
}
|
||||||
is_all_feeding = 1,
|
|
||||||
member_carry_id = item.carry_id,
|
if (carryCodes != null && carryCodes.Count > 0)
|
||||||
member_carry_code = memberCarrys.Find(x => x.id == item.carry_id)?.carry_code ?? "",
|
{
|
||||||
feeding_num = item.codeqty,
|
Log.Information($"签收载具信息{JsonConvert.SerializeObject(carryCodes)}");
|
||||||
supplier_id = item.supplier_id,
|
foreach (var item in carryCodes)
|
||||||
instock_time = item.instock_time,
|
|
||||||
check_conclusion = item.check_conclusion + "",
|
|
||||||
create_time = DateTime.Now,
|
|
||||||
};
|
|
||||||
|
|
||||||
insertDList.Add(detail);
|
|
||||||
|
|
||||||
decimal num = item.codeqty;
|
|
||||||
insertFDList.Add(new PrdFeedingD
|
|
||||||
{
|
{
|
||||||
feeding_id = prdFeedingH.id,
|
// 自动签收不校验
|
||||||
material_receipt_detail_id = detail?.id,
|
// PrdMaterialReceiptD existD = await db.Queryable<PrdMaterialReceiptD>()
|
||||||
material_id = item.material_id,
|
// .LeftJoin<PrdMaterialReceiptH>((x, y) => x.material_receipt_id == y.id)
|
||||||
num = num,
|
// .Where((x, y) => x.carry_id == carry.id && y.mo_task_id == moTask.id && x.is_all_feeding == 0)
|
||||||
batch = item.code_batch,
|
// .Select((x,y)=>x)
|
||||||
unit_id = item.unit_id,
|
// .FirstAsync();
|
||||||
carry_id = carry.id,
|
// if (existD != null)
|
||||||
status = "0",
|
// {
|
||||||
use_num = 0,
|
// throw new Exception($"{moTask.mo_task_code}任务单存在未投完的签收物料,物料签收子表id{existD.id}");
|
||||||
});
|
// }
|
||||||
|
PrdMaterialReceiptD detail = new PrdMaterialReceiptD
|
||||||
|
{
|
||||||
|
material_receipt_id = prdMaterialReceiptH.id,
|
||||||
|
material_id = item.material_id,
|
||||||
|
num = item.codeqty,
|
||||||
|
batch = item.code_batch,
|
||||||
|
unit_id = item.unit_id,
|
||||||
|
carry_id = carry.id,
|
||||||
|
barcode = item.barcode,
|
||||||
|
is_all_feeding = 1,
|
||||||
|
member_carry_id = item.carry_id,
|
||||||
|
member_carry_code = memberCarrys.Find(x => x.id == item.carry_id)?.carry_code ?? "",
|
||||||
|
feeding_num = item.codeqty,
|
||||||
|
supplier_id = item.supplier_id,
|
||||||
|
instock_time = item.instock_time,
|
||||||
|
check_conclusion = item.check_conclusion + "",
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
insertDList.Add(detail);
|
||||||
|
|
||||||
|
decimal num = item.codeqty;
|
||||||
|
insertFDList.Add(new PrdFeedingD
|
||||||
|
{
|
||||||
|
feeding_id = prdFeedingH.id,
|
||||||
|
material_receipt_detail_id = detail?.id,
|
||||||
|
material_id = item.material_id,
|
||||||
|
num = num,
|
||||||
|
batch = item.code_batch,
|
||||||
|
unit_id = item.unit_id,
|
||||||
|
carry_id = carry.id,
|
||||||
|
status = "0",
|
||||||
|
use_num = 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
|
||||||
|
{
|
||||||
|
carry_id = detail.member_carry_id
|
||||||
|
},db);
|
||||||
|
|
||||||
|
|
||||||
|
if (result.code != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
throw Oops.Bah(result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
||||||
{
|
{
|
||||||
}
|
Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
|
||||||
else
|
|
||||||
{
|
|
||||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
|
|
||||||
{
|
{
|
||||||
carry_id = detail.member_carry_id
|
carry_id = carry.id
|
||||||
},db);
|
},db);
|
||||||
|
|
||||||
|
|
||||||
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (result.code != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw Oops.Bah(result.msg);
|
throw Oops.Bah(result.msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
|
|
||||||
{
|
{
|
||||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
|
throw Oops.Bah($"{carry.carry_code}未找到物料明细");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (carry.carrystd_id==WmsWareHouseConst.CARRY_LXSTD_ID || carry.carrystd_id==WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||||
|
{
|
||||||
|
Result result2 = await _wmsCarryUnbindService.CarryUnbindWithoutTran(new CarryBindInput()
|
||||||
{
|
{
|
||||||
carry_id = carry.id
|
org = prdFeedingH.org_id,
|
||||||
|
create_id = prdFeedingH.create_id,
|
||||||
|
carry_id = prdMaterialReceiptH.carry_id,
|
||||||
|
carry_code = prdMaterialReceiptH.carry_code,
|
||||||
|
carrystd_id = carry.carrystd_id,
|
||||||
|
membercarry_code = "",
|
||||||
|
membercarry_id = "",
|
||||||
},db);
|
},db);
|
||||||
|
|
||||||
|
|
||||||
if (result.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
|
||||||
{
|
|
||||||
throw Oops.Bah(result.msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw Oops.Bah($"{carry.carry_code}未找到物料明细");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (carry.carrystd_id==WmsWareHouseConst.CARRY_LXSTD_ID || carry.carrystd_id==WmsWareHouseConst.CARRY_LJSTD_ID)
|
|
||||||
{
|
|
||||||
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result2 = await _wmsCarryUnbindService.CarryUnbindWithoutTran(new CarryBindInput()
|
|
||||||
{
|
|
||||||
org = prdFeedingH.org_id,
|
|
||||||
create_id = prdFeedingH.create_id,
|
|
||||||
carry_id = prdMaterialReceiptH.carry_id,
|
|
||||||
carry_code = prdMaterialReceiptH.carry_code,
|
|
||||||
carrystd_id = carry.carrystd_id,
|
|
||||||
membercarry_code = "",
|
|
||||||
membercarry_id = "",
|
|
||||||
},db);
|
|
||||||
|
|
||||||
if (result2.code != JNPF.Common.Enums.HttpStatusCode.OK)
|
if (result2.code != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw Oops.Bah(result2.msg);
|
throw Oops.Bah(result2.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Information($"清空载具信息:{JsonConvert.SerializeObject(clearCarryIds)}");
|
Log.Information($"清空载具信息:{JsonConvert.SerializeObject(clearCarryIds)}");
|
||||||
string carryStatus = ((int)EnumCarryStatus.空闲).ToString();
|
string carryStatus = ((int)EnumCarryStatus.空闲).ToString();
|
||||||
string isCheck = ((int)EnumCheckConclusion.待检).ToString();
|
string isCheck = ((int)EnumCheckConclusion.待检).ToString();
|
||||||
foreach(string carryId in clearCarryIds)
|
foreach(string carryId in clearCarryIds)
|
||||||
{
|
{
|
||||||
await db.Updateable<WmsCarryH>()
|
string sql = $"update wms_carry_h set carry_status='0',is_check='8' where id='{carryId}';";
|
||||||
.SetColumns(x => x.carry_status == carryStatus)
|
Log.Information($"自动签收更新载具sql:{sql}");
|
||||||
.SetColumns(x => x.is_check == isCheck)
|
await db.Ado.ExecuteCommandAsync(sql);
|
||||||
.Where(x => x.id==carryId)
|
Log.Information($"用SQL更新载具{carryId}状态为空闲{carryStatus},检验为{isCheck}成功");
|
||||||
.ExecuteCommandAsync();
|
await db.Updateable<WmsCarryH>()
|
||||||
Log.Information($"更新载具{carryId}状态为空闲{carryStatus},检验为{isCheck}成功");
|
.SetColumns(x => x.carry_status == carryStatus)
|
||||||
}
|
.SetColumns(x => x.is_check == isCheck)
|
||||||
|
.Where(x => x.id==carryId)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
Log.Information($"更新载具{carryId}状态为空闲{carryStatus},检验为{isCheck}成功");
|
||||||
|
}
|
||||||
|
|
||||||
if (insertHList.Count <= 0 || insertDList.Count <= 0)
|
if (insertHList.Count <= 0 || insertDList.Count <= 0)
|
||||||
{
|
{
|
||||||
throw Oops.Bah(ErrorCode.COM1000);
|
throw Oops.Bah(ErrorCode.COM1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
int row1 = await db.Insertable(insertHList).ExecuteCommandAsync();
|
||||||
|
int row2 = await db.Insertable(insertDList).ExecuteCommandAsync();
|
||||||
|
int row3 = await db.Insertable(insertFHList).ExecuteCommandAsync();
|
||||||
|
int row4 = await db.Insertable(insertFDList).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|
||||||
|
if (row1 <= 0 || row2 <= 0 || row3<=0 || row4<=0)
|
||||||
|
{
|
||||||
|
throw Oops.Bah(ErrorCode.COM1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
int row1 = await db.Insertable(insertHList).ExecuteCommandAsync();
|
|
||||||
int row2 = await db.Insertable(insertDList).ExecuteCommandAsync();
|
|
||||||
int row3 = await db.Insertable(insertFHList).ExecuteCommandAsync();
|
|
||||||
int row4 = await db.Insertable(insertFDList).ExecuteCommandAsync();
|
|
||||||
|
|
||||||
|
|
||||||
if (row1 <= 0 || row2 <= 0 || row3<=0 || row4<=0)
|
|
||||||
{
|
{
|
||||||
throw Oops.Bah(ErrorCode.COM1000);
|
Logger.Error("自动签收投料失败:"+e.Message,e);
|
||||||
|
throw Oops.Bah(e.Message,e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
@@ -332,7 +332,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
//VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true);
|
||||||
//await _runService.Create(templateEntity, visualDevModelCrInput);
|
//await _runService.Create(templateEntity, visualDevModelCrInput);
|
||||||
|
|
||||||
if (tranFlag) await db.Ado.BeginTranAsync();
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryUnbindWithoutTran】开始事务");
|
||||||
|
await db.Ado.BeginTranAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务");
|
||||||
|
}
|
||||||
int row = await db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
int row = await db.Deleteable<WmsCarryD>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
||||||
//isOk = row > 0;
|
//isOk = row > 0;
|
||||||
|
|
||||||
@@ -341,9 +349,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
// throw new Exception($"料架id{input.carry_id}载具解绑失败");
|
// throw new Exception($"料架id{input.carry_id}载具解绑失败");
|
||||||
//}
|
//}
|
||||||
Logger.LogInformation($"【CarryUnbindWithoutTran】料架{carry.carry_code}已解绑,解绑条数{row}");
|
Logger.LogInformation($"【CarryUnbindWithoutTran】料架{carry.carry_code}已解绑,解绑条数{row}");
|
||||||
|
|
||||||
|
|
||||||
if (tranFlag) await db.Ado.CommitTranAsync();
|
|
||||||
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryUnbindWithoutTran】提交事务");
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -357,7 +369,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.Message}");
|
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.Message}");
|
||||||
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.StackTrace}");
|
Logger.LogError($"【CarryUnbindWithoutTran】 {ex.StackTrace}");
|
||||||
if (tranFlag) await db.Ado.RollbackTranAsync();
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryUnbindWithoutTran】回滚事务");
|
||||||
|
await db.Ado.RollbackTranAsync();
|
||||||
|
}
|
||||||
throw Oops.Bah(ex.Message);
|
throw Oops.Bah(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,9 +407,21 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
WmsCarryH? carry = await db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
if (tranFlag) await db.Ado.BeginTranAsync();
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】开始事务");
|
||||||
|
await db.Ado.BeginTranAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】不使用事务");
|
||||||
|
}
|
||||||
int row = await db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
int row = await db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == input.carry_id).ExecuteCommandAsync();
|
||||||
if (tranFlag) await db.Ado.CommitTranAsync();
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】提交事务");
|
||||||
|
await db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
isOk = row > 0;
|
isOk = row > 0;
|
||||||
|
|
||||||
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】载具{carry.carry_code}已解绑,解绑条数{row}");
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】载具{carry.carry_code}已解绑,解绑条数{row}");
|
||||||
@@ -414,7 +442,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.Message}");
|
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.Message}");
|
||||||
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.StackTrace}");
|
Logger.LogError($"【CarryCodeUnbindWithoutTran】 {ex.StackTrace}");
|
||||||
if (tranFlag) await db.Ado.RollbackTranAsync();
|
if (tranFlag)
|
||||||
|
{
|
||||||
|
Logger.LogInformation($"【CarryCodeUnbindWithoutTran】回滚事务");
|
||||||
|
await db.Ado.RollbackTranAsync();
|
||||||
|
}
|
||||||
throw Oops.Bah(ex.Message);
|
throw Oops.Bah(ex.Message);
|
||||||
}
|
}
|
||||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
|
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功");
|
||||||
|
|||||||
Reference in New Issue
Block a user