修复bug

This commit is contained in:
18942506660
2023-12-29 09:35:58 +08:00
parent e9d17dcae7
commit 6c7dfa8ef9

View File

@@ -65,8 +65,10 @@ namespace WMS.Web.Domain.Services
public async Task<Result> ChangeBoxSave(List<SaveChangeBoxRecordRequest> dto, LoginInDto loginInfo, bool isTransaction = false, bool IsInventory = true, bool IsPDA = false)
{
_logger.LogInformation($"改箱:{JsonConvert.SerializeObject(dto)} 操作人:{loginInfo.UserInfo.StaffId}");
bool isAddBox = false;
if (IsPDA)
{
//处理目标箱不在系统的情况,需要先增加箱信息
var d = dto.First();
if (d.DestBoxId == 0)
{
@@ -75,6 +77,7 @@ namespace WMS.Web.Domain.Services
if (!res.IsSuccess) return res;
dBox = await _boxRepositories.GetByNo(d.DestBoxBillNo);
dto.First().DestBoxId = dBox.Id;
isAddBox = true;
}
}
//1.有原箱时 需要判断 物料对应的序列号是否存在
@@ -136,14 +139,17 @@ namespace WMS.Web.Domain.Services
res = srcBox.Out(l);
if (!res.IsSuccess) return res;
}
//目标箱移入
res = destBox.In(l);
if (!res.IsSuccess) return res;
if (srcBox != null)
boxList.Add(srcBox);
//目标箱移入
if (!isAddBox)
{
res = destBox.In(l);
if (!res.IsSuccess) return res;
if (destBox != null)
boxList.Add(destBox);
}
}
List<ChangeBoxRecord> list = new List<ChangeBoxRecord>();
var subIds = dto.Select(s => s.SubStockId).ToList();
@@ -213,6 +219,20 @@ namespace WMS.Web.Domain.Services
//增加一个空箱子
List<OpsBoxResponse> list = new List<OpsBoxResponse>();
OpsBoxResponse response = new OpsBoxResponse() { BoxBillNo = dto.DestBoxBillNo };
foreach (var d in dto.Details)
{
List<OpsSerialNumbersResponse> s = new List<OpsSerialNumbersResponse>();
foreach (var sd in d.SerialNumbers)
{
s.Add(new OpsSerialNumbersResponse() { SerialNumber = sd });
}
OpsBoxDetailsResponse dr = new OpsBoxDetailsResponse()
{
MaterialId = d.MaterialId,
Qty = d.Qty,
SerialNumbers = s
};
}
list.Add(response);
return await _boxService.Sync(list);
}