Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -1009,6 +1009,11 @@
|
||||
单据编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.Method">
|
||||
<summary>
|
||||
出库方式 1 按箱 2 按产品
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.Type">
|
||||
<summary>
|
||||
单据类型
|
||||
@@ -1074,7 +1079,7 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,WMS.Web.Domain.Entitys.OutStockTask)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,WMS.Web.Domain.Entitys.OutStockTask,System.Int32)">
|
||||
<summary>
|
||||
创建(需要在明细都生成后最后调用)
|
||||
</summary>
|
||||
|
||||
@@ -32,6 +32,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("BillNo")]
|
||||
public string BillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 出库方式 1 按箱 2 按产品
|
||||
/// </summary>
|
||||
[Column("Method")]
|
||||
public InventoryInOutMethod Method { get; set; } = InventoryInOutMethod.Box;
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
@@ -99,10 +104,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 创建(需要在明细都生成后最后调用)
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId, OutStockTask task)
|
||||
public void Create(int creatorId, OutStockTask task,int method)
|
||||
{
|
||||
this.TaskId = task.Id;
|
||||
this.Type = task.Type;
|
||||
this.Method = (InventoryInOutMethod)method;
|
||||
this.DeliveryOrgId = task.DeliveryOrgId;
|
||||
this.ReceiptCustomerId = task.ReceiptCustomerId;
|
||||
this.CreatorId = creatorId;
|
||||
|
||||
@@ -72,14 +72,16 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReFailure(ResultCodes.OutStockTaskRepeal);
|
||||
//上传的物料在任务单里没有找到不能出库
|
||||
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
|
||||
if (ex.Count() > 0)
|
||||
if (ex.Count() > 0 && dto.Method == 2)
|
||||
return Result.ReFailure(ResultCodes.OutStockMaterialError);
|
||||
//1.需要验证物料对应箱和序列号是否存在库存
|
||||
//如果是按箱出库从库存拿取数据
|
||||
if (dto.Method == 1)
|
||||
{
|
||||
var boxs = dto.Details.Select(s => s.BoxId).ToList();
|
||||
dto.Details.Clear();
|
||||
//获取箱子对应的所有库存
|
||||
var boxInventoryList = await _boxInventoryRepositories.GetList(dto.Details.Select(s => s.BoxId).ToList());
|
||||
var boxInventoryList = await _boxInventoryRepositories.GetList(boxs);
|
||||
//过滤掉不同仓库和不同组织的
|
||||
boxInventoryList = boxInventoryList.Where(w => w.StockCode == outStockTask.StockCode && w.OrgCode == outStockTask.OrgCode).ToList();
|
||||
//组装dto
|
||||
@@ -131,7 +133,7 @@ namespace WMS.Web.Domain.Services
|
||||
outd.SerialNumbers.AddRange(dtoDetails.SelectMany(s => s.SerialNumbers));
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask);
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask,dto.Method);
|
||||
|
||||
#region 组装库存dto
|
||||
List<BoxInventoryGenerateDto> inventoryList = new List<BoxInventoryGenerateDto>();
|
||||
@@ -173,8 +175,8 @@ namespace WMS.Web.Domain.Services
|
||||
Result res_Rollback = Result.ReSuccess();
|
||||
bool isSuccess = true;
|
||||
//修改库存
|
||||
var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
//var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
|
||||
//if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
if (res_Rollback.IsSuccess)
|
||||
{
|
||||
entity = await _outStockRepositories.Add(entity, false);
|
||||
@@ -190,11 +192,11 @@ namespace WMS.Web.Domain.Services
|
||||
var res_change = await _serialNumberService.OutStock(entity, loginInfo, false);
|
||||
if (!res_change.IsSuccess) res_Rollback = res_change;
|
||||
}
|
||||
if (res_Rollback.IsSuccess)
|
||||
{
|
||||
res_Inventory = await _inventoryInOutDetailsService.GenerateInOrOutDetails(generateList, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
}
|
||||
//if (res_Rollback.IsSuccess)
|
||||
//{
|
||||
// res_Inventory = await _inventoryInOutDetailsService.GenerateInOrOutDetails(generateList, false);
|
||||
// if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
//}
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction);
|
||||
if (!res_Rollback.IsSuccess) return res_Rollback;
|
||||
|
||||
Reference in New Issue
Block a user