修改业务回更方法

This commit is contained in:
2023-06-16 16:28:37 +08:00
parent 82856d3bd3
commit 32c3de6dac
11 changed files with 107 additions and 64 deletions

View File

@@ -124,7 +124,12 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null); //根据载具移出Id回更单据状态
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
} }
} }

View File

@@ -152,16 +152,20 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks,null); var isOk = await _wareHouseService.GenPreTask(preTasks,null);
if (isOk) if (isOk)
{ {
//不需要插入操作表 if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null)
/* var preTaskUpInput = new GenPreTaskUpInput(); {
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString(); //查询库位表
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; {
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; //载具加锁,增加库位信息
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.).ToString(),
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); }
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/
//所有库位加锁
var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() };
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
}
} }
} }

View File

@@ -142,7 +142,9 @@ namespace Tnb.WarehouseMgr
//根据空载具入库Id回更单据状态 //根据空载具入库Id回更单据状态
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
} }
} }

View File

@@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr namespace Tnb.WarehouseMgr
@@ -141,15 +142,13 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks,null); var isOk = await _wareHouseService.GenPreTask(preTasks,null);
if (isOk) if (isOk)
{ {
var preTaskUpInput = new GenPreTaskUpInput(); //所有载具加锁
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString(); var ids = carrys.Select(x => x.carry_id).ToList();
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; //所有库位加锁
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; var loc = carrys.Select(x => x.location_id).ToList();
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList(); await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => loc.Contains(it.id)).ExecuteCommandAsync();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null);
} }
} }
} }

View File

@@ -127,7 +127,12 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null); //根据载具移入Id回更单据状态
await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
} }
} }

View File

@@ -122,9 +122,15 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null); //根据载具移出Id回更单据状态
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
} }
} }

View File

@@ -151,16 +151,25 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks,null); var isOk = await _wareHouseService.GenPreTask(preTasks,null);
if (isOk) if (isOk)
{ {
//不需要插入操作表 f(input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null)
/* var preTaskUpInput = new GenPreTaskUpInput(); {
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString(); //查询库位表
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; {
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; //载具加锁,增加库位信息
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); {
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); carry_status = ((int)EnumCarryStatus.).ToString(),
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/ is_lock = 1,
location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(),
location_code = location.location_code
}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync();
}
//所有库位加锁
var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() };
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
}
} }
} }

View File

@@ -140,8 +140,9 @@ namespace Tnb.WarehouseMgr
preTaskUpInput.PreTaskRecord = handleH; preTaskUpInput.PreTaskRecord = handleH;
//根据空载具入库Id回更单据状态 //根据空载具入库Id回更单据状态
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null); it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1 });
} }
} }

View File

@@ -141,15 +141,13 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks,null); var isOk = await _wareHouseService.GenPreTask(preTasks,null);
if (isOk) if (isOk)
{ {
var preTaskUpInput = new GenPreTaskUpInput(); //所有载具加锁
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString(); var ids = carrys.Select(x => x.carry_id).ToList();
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; //所有库位加锁
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; var loc = carrys.Select(x => x.location_id).ToList();
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList(); await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => loc.Contains(it.id)).ExecuteCommandAsync();
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null);
} }
} }

View File

@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr namespace Tnb.WarehouseMgr
{ {
@@ -115,16 +116,22 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks, null); var isOk = await _wareHouseService.GenPreTask(preTasks, null);
if (isOk) if (isOk)
{ {
//不需要插入操作 //查询库位
/* var preTaskUpInput = new GenPreTaskUpInput(); var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString());
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString(); {
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; //载具加锁,增加库位信息
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; {
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); carry_status = ((int)EnumCarryStatus.).ToString(),
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); is_lock = 1,
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/ location_code = location.location_code
}).Where(it => it.id == input.data[nameof(WmsTransfer.carry_id)].ToString()).ExecuteCommandAsync();
}
//所有库位加锁
var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() };
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
} }
} }

View File

@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr namespace Tnb.WarehouseMgr
{ {
@@ -115,16 +116,22 @@ namespace Tnb.WarehouseMgr
var isOk = await _wareHouseService.GenPreTask(preTasks,null); var isOk = await _wareHouseService.GenPreTask(preTasks,null);
if (isOk) if (isOk)
{ {
//不需要插入操作 //查询库位
/* var preTaskUpInput = new GenPreTaskUpInput(); var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString());
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString(); {
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; //载具加锁,增加库位信息
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id; await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code; {
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList(); carry_status = ((int)EnumCarryStatus.).ToString(),
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>(); is_lock = 1,
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/ location_code = location.location_code
}).Where(it => it.id == input.data[nameof(WmsTransfer.carry_id)].ToString()).ExecuteCommandAsync();
}
//所有库位加锁
var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() };
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
} }
} }