移箱支持多个
This commit is contained in:
@@ -109,19 +109,24 @@ namespace WMS.Web.Domain.Services
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> MoveBoxSave(SaveMoveBoxRecordRequest dto, bool IsUp, LoginInDto loginInfo)
|
||||
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = new MoveBoxRecord();
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, dto.BoxId, dto.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
List<MoveBoxRecord> entityList = new List<MoveBoxRecord>();
|
||||
foreach (var d in dto)
|
||||
{
|
||||
var entity = new MoveBoxRecord();
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entityList.Add(entity);
|
||||
}
|
||||
//需要填写规格型号
|
||||
//需要修改库存
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
entity = await _moveBoxRecordRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
var res_change = await _serialNumberService.MoveBox(entity, loginInfo, false);
|
||||
isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, true);
|
||||
if (!isSuccess) isRollback = true;
|
||||
var res_change = await _serialNumberService.MoveBox(entityList, loginInfo, false);
|
||||
if (!res_change.IsSuccess) isRollback = true;
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
|
||||
@@ -133,14 +133,14 @@ namespace WMS.Web.Domain.Services
|
||||
foreach (var item in billNos)
|
||||
{
|
||||
var e = erp_list.FirstOrDefault(f => f.SourceBillNo == item);
|
||||
var dto = new OutStockTask();
|
||||
dto.Create((OutStockType)e.Type, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime);
|
||||
var entity = new OutStockTask();
|
||||
entity.Create((OutStockType)e.Type, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime);
|
||||
|
||||
//找到当前对应来源单据编号的集合数据
|
||||
var current_erp_details = erp_list.Where(x => x.SourceBillNo == item).ToList();
|
||||
//给到dto的实体明细中
|
||||
dto.Details = _mapper.Map<List<OutStockTaskDetails>>(current_erp_details);
|
||||
add_entitys.Add(dto);
|
||||
entity.Details = _mapper.Map<List<OutStockTaskDetails>>(current_erp_details);
|
||||
add_entitys.Add(entity);
|
||||
}
|
||||
//3.1提交新增
|
||||
isSuccess = await _outStockTaskRepositories.AddRange(add_entitys, isTransaction);
|
||||
|
||||
@@ -104,15 +104,16 @@ namespace WMS.Web.Domain.Services
|
||||
/// <summary>
|
||||
/// 移箱
|
||||
/// </summary>
|
||||
/// <param name="moveBoxRecord"></param>
|
||||
/// <param name="moveBoxRecords"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> MoveBox(MoveBoxRecord moveBoxRecord, LoginInDto loginInfo, bool isTransaction = true)
|
||||
public async Task<Result> MoveBox(List<MoveBoxRecord> moveBoxRecords, LoginInDto loginInfo, bool isTransaction = true)
|
||||
{
|
||||
//获取序列号信息
|
||||
var entityList = await _serialNumbersRepositories.GetEntityListByBoxId(moveBoxRecord.BoxId);
|
||||
var box = await _boxRepositories.Get(moveBoxRecord.BoxId);
|
||||
var boxids = moveBoxRecords.Select(s => s.BoxId).ToList();
|
||||
var entityList = await _serialNumbersRepositories.GetEntityListByBoxIds(boxids);
|
||||
var boxList = await _boxRepositories.GetEntityList(boxids);
|
||||
var userName = _singleDataService.GetSingleData(SingleAction.Staffs, loginInfo.UserInfo.CompanyId, loginInfo.UserInfo.StaffId);
|
||||
|
||||
IDbContextTransaction _transaction = null;
|
||||
@@ -123,8 +124,10 @@ namespace WMS.Web.Domain.Services
|
||||
List<SerialNumberOperate> sList = new List<SerialNumberOperate>();
|
||||
foreach (var entity in entityList)
|
||||
{
|
||||
var box = boxList.FirstOrDefault(f => f.Id == entity.BoxId);
|
||||
var moveBoxRecord = moveBoxRecords.FirstOrDefault(f => f.BoxId == entity.BoxId);
|
||||
//修改序列号和箱绑定关系
|
||||
entity.Bind(moveBoxRecord.BoxId);
|
||||
//entity.Bind(moveBoxRecord.BoxId);
|
||||
|
||||
//记录序列号操作日志
|
||||
SerialNumberOperate op = new SerialNumberOperate()
|
||||
@@ -201,7 +204,7 @@ namespace WMS.Web.Domain.Services
|
||||
OperateTime = DateTime.Now,
|
||||
OperateType = OutStockTypeConvert(outStock.Type),
|
||||
OperateUser = userName,
|
||||
Remark = "来源单号:" + string.Join(",",outstockDetail.SourceBillNos) + "\r\n" + "出库单号:" + outStock.BillNo
|
||||
Remark = "来源单号:" + string.Join(",", outstockDetail.SourceBillNos) + "\r\n" + "出库单号:" + outStock.BillNo
|
||||
};
|
||||
if (outStock.Type == OutStockType.Sal)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user