注释和报错
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Tnb.WarehouseMgr
|
||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
//return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
|
||||
@@ -58,12 +58,12 @@ namespace Tnb.WarehouseMgr
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = PDAWmsEmptyOut;
|
||||
OverideFuncs.CreateAsync = WmsEmptyOut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task<dynamic> PDAWmsEmptyOut(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> WmsEmptyOut(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
try
|
||||
@@ -226,24 +226,26 @@ namespace Tnb.WarehouseMgr
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
try
|
||||
{
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString());
|
||||
var dic = new Dictionary<string, object>();
|
||||
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
|
||||
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;
|
||||
dic[nameof(WmsEmptyOutstockH.location_id)] = location.id;
|
||||
dic[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id;
|
||||
dic[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||
dic[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.qty)] = input.qty;
|
||||
dic[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.create_id)] = input.create_id;
|
||||
dic[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now;
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位",500);
|
||||
Dictionary<string, object> dic = new()
|
||||
{
|
||||
[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId(),
|
||||
[nameof(WmsEmptyOutstockH.org_id)] = input.org_id,
|
||||
[nameof(WmsEmptyOutstockH.location_id)] = location.id,
|
||||
[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id,
|
||||
[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult(),
|
||||
[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID,
|
||||
[nameof(WmsEmptyOutstockH.qty)] = input.qty,
|
||||
[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||
[nameof(WmsEmptyOutstockH.create_id)] = input.create_id,
|
||||
[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now
|
||||
};
|
||||
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
||||
{
|
||||
data = dic,
|
||||
};
|
||||
await PDAWmsEmptyOut(visualDevModelDataCrInput);
|
||||
await WmsEmptyOut(visualDevModelDataCrInput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -272,11 +272,11 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
var loc = await _db.Queryable<BasLocation>().FirstAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType.存储库位.ToString());
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.instock.carry_code);
|
||||
//如果数据不全,
|
||||
//如果数据不全或有误,
|
||||
if (carry.IsNull() || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1)
|
||||
{
|
||||
//报错, 提示数据不全。
|
||||
throw new AppFriendlyException("数据不全!", 500);
|
||||
//报错, 提示数据不全或有误。
|
||||
throw new AppFriendlyException("数据不全或有误!", 500);
|
||||
}
|
||||
// 生成入库申请数据,添加其他数据 主表
|
||||
instock.id = SnowflakeIdHelper.NextId();
|
||||
@@ -330,7 +330,7 @@ namespace Tnb.WarehouseMgr
|
||||
//入库取终点 //出库起点
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock?.warehouse_id!, Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == instock.location_id);
|
||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == instock.location_id);
|
||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
|
||||
|
||||
|
||||
|
||||
@@ -317,11 +317,11 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsOutstockD> outstockDs = input.outstockDs.Adapt<List<WmsOutstockD>>();
|
||||
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.outstock.location_code && it.is_type != EnumLocationType.存储库位.ToString());
|
||||
//如果数据不全,
|
||||
//如果数据不全或有误,
|
||||
if (location.IsNull() || outstockDs?.Count < 1)
|
||||
{
|
||||
//报错, 提示数据不全。
|
||||
throw new AppFriendlyException("数据不全!", 500);
|
||||
//报错, 提示数据不全或有误。
|
||||
throw new AppFriendlyException("数据不全或有误!", 500);
|
||||
}
|
||||
// 生成出库申请数据,添加其他数据 主表
|
||||
outstock.id = SnowflakeIdHelper.NextId();
|
||||
|
||||
@@ -106,24 +106,26 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id!;
|
||||
preTask.startlocation_code = sPoint?.location_code!;
|
||||
preTask.endlocation_id = ePoint?.location_id!;
|
||||
preTask.endlocation_code = ePoint?.location_code!;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carrys![i].id;
|
||||
preTask.carry_code = carrys![i].carry_code;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
||||
//生成预任务
|
||||
WmsPretaskH preTask = new()
|
||||
{
|
||||
org_id = _userManager.User.OrganizeId,
|
||||
startlocation_id = sPoint?.location_id!,
|
||||
startlocation_code = sPoint?.location_code!,
|
||||
endlocation_id = ePoint?.location_id!,
|
||||
endlocation_code = ePoint?.location_code!,
|
||||
start_floor = sPoint?.floor.ToString(),
|
||||
end_floor = ePoint?.floor.ToString(),
|
||||
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||
carry_id = carrys![i].id,
|
||||
carry_code = carrys![i].carry_code,
|
||||
area_id = sPoint?.area_id!,
|
||||
area_code = it.Key,
|
||||
require_id = input.data["ReturnIdentity"].ToString()
|
||||
};
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
@@ -139,39 +141,47 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!;
|
||||
preTaskUpInput.CarryId = carrys![i].id;
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
|
||||
//生成预任务上传输入
|
||||
GenPreTaskUpInput preTaskUpInput = new()
|
||||
{
|
||||
RquireId = input.data["ReturnIdentity"].ToString()!,
|
||||
CarryId = carrys![i].id,
|
||||
CarryStartLocationId = points.FirstOrDefault()!.location_id!,
|
||||
CarryStartLocationCode = points.FirstOrDefault()!.location_code!,
|
||||
LocationIds = points.Select(x => x.location_id).ToList()!
|
||||
};
|
||||
|
||||
//更新明细表
|
||||
WmsEmptyOutstockD wmsEmptyOutstockD = new();
|
||||
wmsEmptyOutstockD.id = SnowflakeIdHelper.NextId();
|
||||
wmsEmptyOutstockD.bill_id = preTaskUpInput.RquireId;
|
||||
wmsEmptyOutstockD.biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
wmsEmptyOutstockD.location_id = ePoint!.location_id!;
|
||||
wmsEmptyOutstockD.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
wmsEmptyOutstockD.carry_id = carrys[i].id;
|
||||
wmsEmptyOutstockD.carry_code = carrys[i].carry_code;
|
||||
wmsEmptyOutstockD.create_id = _userManager.UserId;
|
||||
wmsEmptyOutstockD.create_time = DateTime.Now;
|
||||
WmsEmptyOutstockD wmsEmptyOutstockD = new()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
bill_id = preTaskUpInput.RquireId,
|
||||
biz_type = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID,
|
||||
location_id = ePoint!.location_id!,
|
||||
status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID,
|
||||
carry_id = carrys[i].id,
|
||||
carry_code = carrys[i].carry_code,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
await _db.Insertable(wmsEmptyOutstockD)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
WmsHandleH handleH = new();
|
||||
handleH.org_id = _userManager.User.OrganizeId;
|
||||
handleH.startlocation_id = carrys?[i].location_id!;
|
||||
handleH.endlocation_id = ePoint!.location_id!;
|
||||
handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
|
||||
handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!;
|
||||
handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!;
|
||||
handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!;
|
||||
handleH.require_id = input.data["ReturnIdentity"].ToString();
|
||||
handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!;
|
||||
handleH.create_id = _userManager.UserId;
|
||||
handleH.create_time = DateTime.Now;
|
||||
//生成操作记录表
|
||||
WmsHandleH handleH = new()
|
||||
{
|
||||
org_id = _userManager.User.OrganizeId,
|
||||
startlocation_id = carrys?[i].location_id!,
|
||||
endlocation_id = ePoint!.location_id!,
|
||||
bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!,
|
||||
carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!,
|
||||
carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!,
|
||||
require_id = input.data["ReturnIdentity"].ToString(),
|
||||
require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
preTaskUpInput.PreTaskRecord = handleH;
|
||||
//根据空载具出库Id,回更单据状态
|
||||
await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
|
||||
@@ -180,26 +180,28 @@ namespace Tnb.WarehouseMgr
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id!;
|
||||
preTask.startlocation_code = sPoint?.location_code!;
|
||||
preTask.endlocation_id = ePoint?.location_id!;
|
||||
preTask.endlocation_code = ePoint?.location_code!;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = ko.biz_type;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = ko!.carry_id!;
|
||||
preTask.carry_code = ko!.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = ko.id;
|
||||
preTask.require_code = ko.bill_code;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
WmsPretaskH preTask = new()
|
||||
{
|
||||
org_id = _userManager.User.OrganizeId,
|
||||
startlocation_id = sPoint?.location_id!,
|
||||
startlocation_code = sPoint?.location_code!,
|
||||
endlocation_id = ePoint?.location_id!,
|
||||
endlocation_code = ePoint?.location_code!,
|
||||
start_floor = sPoint?.floor.ToString(),
|
||||
end_floor = ePoint?.floor.ToString(),
|
||||
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
||||
biz_type = ko.biz_type,
|
||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||
carry_id = ko!.carry_id!,
|
||||
carry_code = ko!.carry_code!,
|
||||
area_id = sPoint?.area_id!,
|
||||
area_code = it.Key,
|
||||
require_id = ko.id,
|
||||
require_code = ko.bill_code,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
return preTask;
|
||||
}).ToList();
|
||||
if (loc.is_sign == 0)
|
||||
|
||||
Reference in New Issue
Block a user