Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -53,13 +53,13 @@ namespace WMS.Web.Api.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// 保存(出库)
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("Save")]
|
||||
public async Task<Result> Save(List<SaveOutStockRequest> dto)
|
||||
public async Task<Result> Save(SaveOutStockRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.OutStockController.Save(System.Collections.Generic.List{WMS.Web.Core.Dto.OutStock.SaveOutStockRequest})">
|
||||
<member name="M:WMS.Web.Api.Controllers.OutStockController.Save(WMS.Web.Core.Dto.OutStock.SaveOutStockRequest)">
|
||||
<summary>
|
||||
保存
|
||||
</summary>
|
||||
|
||||
@@ -570,6 +570,11 @@
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.OutStock.ErpOutStockSaveDto">
|
||||
<summary>
|
||||
出库单同步金蝶
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.Purchase.ErpPurchaseInStockResultDto">
|
||||
<summary>
|
||||
erp-采购入库-返回数据源
|
||||
@@ -2305,42 +2310,17 @@
|
||||
出库单保存
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.SourceBillNo">
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.TaskId">
|
||||
<summary>
|
||||
来源单号
|
||||
出库任务单Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.SaleBillNo">
|
||||
<summary>
|
||||
销售订单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.DeliveryOrgId">
|
||||
<summary>
|
||||
发货组织
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.ReceiptCustomerId">
|
||||
<summary>
|
||||
收货客户
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.MaterialId">
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockDetailsRequest.MaterialId">
|
||||
<summary>
|
||||
物料Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.SubStockId">
|
||||
<summary>
|
||||
仓位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockRequest.Qty">
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.SaveOutStockDetailsRequest.Qty">
|
||||
<summary>
|
||||
出库数量
|
||||
</summary>
|
||||
@@ -2505,11 +2485,6 @@
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.UnitId">
|
||||
<summary>
|
||||
单位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
|
||||
@@ -655,6 +655,11 @@
|
||||
主键 订单编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.TaskId">
|
||||
<summary>
|
||||
任务单ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.BillNo">
|
||||
<summary>
|
||||
单据编号
|
||||
@@ -690,7 +695,7 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.OutStock.Create(System.Int32,System.Int32,WMS.Web.Domain.Values.OrderType)">
|
||||
<summary>
|
||||
创建
|
||||
</summary>
|
||||
@@ -924,11 +929,6 @@
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.UnitId">
|
||||
<summary>
|
||||
单位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
@@ -1001,11 +1001,6 @@
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStockDetails.UnitId">
|
||||
<summary>
|
||||
单位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStockDetails.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
@@ -1988,7 +1983,7 @@
|
||||
出库服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockService.Save(System.Collections.Generic.List{WMS.Web.Core.Dto.OutStock.SaveOutStockRequest},WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<member name="M:WMS.Web.Domain.Services.OutStockService.Save(WMS.Web.Core.Dto.OutStock.SaveOutStockRequest,WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<summary>
|
||||
出库单
|
||||
</summary>
|
||||
|
||||
13
src/WMS.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs
Normal file
13
src/WMS.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Erp.OutStock
|
||||
{
|
||||
/// <summary>
|
||||
/// 出库单同步金蝶
|
||||
/// </summary>
|
||||
public class ErpOutStockSaveDto
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -11,40 +11,21 @@ namespace WMS.Web.Core.Dto.OutStock
|
||||
public class SaveOutStockRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 来源单号
|
||||
/// 出库任务单Id
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "来源单号不能为空")]
|
||||
public string SourceBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 销售订单号
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "销售订单号不能为空")]
|
||||
public string SaleBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 发货组织
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "发货组织不能为空")]
|
||||
public int DeliveryOrgId { get; set; }
|
||||
/// <summary>
|
||||
/// 收货客户
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "收货客户不能为空")]
|
||||
public int ReceiptCustomerId { get; set; }
|
||||
[Required(ErrorMessage = "出库单不能为空")]
|
||||
public int TaskId { get; set; }
|
||||
public List<SaveOutStockDetailsRequest> Details { get; set; } = new List<SaveOutStockDetailsRequest>();
|
||||
|
||||
}
|
||||
public class SaveOutStockDetailsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "仓库不能为空")]
|
||||
public int StockId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓位ID
|
||||
///</summary>
|
||||
public int? SubStockId { get; set; }
|
||||
/// <summary>
|
||||
/// 出库数量
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "出库数量不能为空")]
|
||||
|
||||
@@ -21,11 +21,6 @@ namespace WMS.Web.Core.Dto.TakeStock
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "单位不能为空")]
|
||||
public int UnitId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "仓库不能为空")]
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("Id")]
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 任务单ID
|
||||
/// </summary>
|
||||
[Column("TaskId")]
|
||||
public int TaskId { get; set; }
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
[Column("BillNo")]
|
||||
@@ -59,12 +64,15 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
public void Create(int creatorId,int taskId, OrderType type)
|
||||
{
|
||||
this.TaskId = taskId;
|
||||
this.Type = type;
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成单据号
|
||||
/// </summary>
|
||||
|
||||
@@ -51,11 +51,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
[Column("UnitId")]
|
||||
public int UnitId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
[Column("StockId")]
|
||||
|
||||
@@ -36,11 +36,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
[Column("UnitId")]
|
||||
public int UnitId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
[Column("StockId")]
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace WMS.Web.Domain.IService
|
||||
public interface IOutStockService
|
||||
{
|
||||
//出库单保存
|
||||
Task<Result> Save(List<SaveOutStockRequest> dto, LoginInDto loginInfo);
|
||||
Task<Result> Save(SaveOutStockRequest dto, LoginInDto loginInfo);
|
||||
// 同步金蝶
|
||||
Task<Result> Sync(OperateRequest dto);
|
||||
//出库任务作废
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
// 新增
|
||||
Task<OutStock> Add(OutStock entity, bool isTransaction = true);
|
||||
//编辑
|
||||
Task<OutStock> Edit(OutStock entity, bool isTransaction = true);
|
||||
//根据任务单Id搜索
|
||||
Task<OutStock> GetByTaskId(int taskId);
|
||||
// 获取列表
|
||||
Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto);
|
||||
/// 查询实体集合
|
||||
|
||||
@@ -20,5 +20,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
|
||||
/// 删除实体集合
|
||||
Task<bool> DeleteEntityList(List<int> ids, bool isTransaction = true);
|
||||
//获取实体
|
||||
Task<OutStockTask> Get(int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@ namespace WMS.Web.Domain.Mappers
|
||||
public OutStockMapper()
|
||||
{
|
||||
CreateMap<SaveOutStockRequest, OutStockDetails>();
|
||||
|
||||
CreateMap<OutStockTaskDetails, OutStockDetails>()
|
||||
.ForMember(x => x.Id, ops => ops.Ignore())
|
||||
.ForMember(x => x.Fid, ops => ops.Ignore())
|
||||
.ForMember(x => x.Qty, ops => ops.Ignore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,11 +44,23 @@ namespace WMS.Web.Domain.Services
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Save(List<SaveOutStockRequest> dto, LoginInDto loginInfo)
|
||||
public async Task<Result> Save(SaveOutStockRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var outStockTask = await _outStockTaskRepositories.Get(dto.TaskId);
|
||||
//OutStock entity = await _outStockRepositories.GetByTaskId(dto.TaskId);
|
||||
|
||||
OutStock entity = new OutStock();
|
||||
entity.Details = _mapper.Map<List<OutStockDetails>>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
entity.Create(loginInfo.UserInfo.StaffId, outStockTask.Id, outStockTask.Type);
|
||||
foreach (var d in dto.Details)
|
||||
{
|
||||
//任务单明细
|
||||
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||
if (tDetail == null) continue;
|
||||
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||
|
||||
outd.Qty = outd.Qty + d.Qty;
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
@@ -58,6 +70,7 @@ namespace WMS.Web.Domain.Services
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
entity = await _outStockRepositories.Add(entity, false);
|
||||
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
//提交事务
|
||||
|
||||
@@ -106,14 +106,14 @@ namespace WMS.Web.Domain.Services
|
||||
FOwnerid = stock.OrgId.ToString(),
|
||||
FKeeperId = stock.OrgId.ToString(),
|
||||
MaterialId = entity.MaterialId.ToString(),
|
||||
UnitId = entity.UnitId.ToString(),
|
||||
UnitId = "",//物料带出来
|
||||
StockId = stock.Id.ToString(),
|
||||
SubStockId = subStock.Id.ToString(),
|
||||
BeforeQty = entity.BeforeQty,
|
||||
AfterQty = entity.AfterQty,
|
||||
FinalQty = entity.FinalQty,
|
||||
Fnote = ""
|
||||
});
|
||||
}) ;
|
||||
ErpTakeStockSaveDto dto = new ErpTakeStockSaveDto()
|
||||
{
|
||||
BillNo = entity.BillNo,
|
||||
@@ -149,14 +149,14 @@ namespace WMS.Web.Domain.Services
|
||||
FOwnerid = stock.OrgId.ToString(),
|
||||
FKeeperId = stock.OrgId.ToString(),
|
||||
MaterialId = entity.MaterialId.ToString(),
|
||||
UnitId = entity.UnitId.ToString(),
|
||||
UnitId = "", //物料带出来
|
||||
StockId = stock.Id.ToString(),
|
||||
SubStockId = subStock.Id.ToString(),
|
||||
BeforeQty = entity.BeforeQty,
|
||||
AfterQty = entity.AfterQty,
|
||||
FinalQty = entity.FinalQty,
|
||||
Fnote = ""
|
||||
});
|
||||
}) ;
|
||||
ErpTakeStockSaveDto dto = new ErpTakeStockSaveDto()
|
||||
{
|
||||
BillNo = entity.BillNo,
|
||||
|
||||
@@ -185,5 +185,53 @@ namespace WMS.Web.Repositories
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OutStock> Edit(OutStock entity, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
var res = await _context.OutStock
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (res == null) return null;
|
||||
|
||||
_mapper.Map(entity, res);
|
||||
_mapper.ToMapList(entity.Details, res.Details);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据任务单Id获取
|
||||
/// </summary>
|
||||
/// <param name="taskId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OutStock> GetByTaskId(int taskId)
|
||||
{
|
||||
var res = await _context.OutStock
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => taskId == f.TaskId);
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,20 @@ namespace WMS.Web.Repositories
|
||||
return true;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据Id获取实体
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OutStockTask> Get(int id)
|
||||
{
|
||||
var res = await _context.OutStockTask
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => id == f.Id);
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单据头id获取数据
|
||||
/// </summary>
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace WMS.Web.Repositories
|
||||
#region dto组装
|
||||
Id = s.Id,
|
||||
BillNo = s.BillNo,
|
||||
Unit = _singleDataService.GetSingleData(SingleAction.Units, _loginRepositories.CompanyId, s.UnitId),
|
||||
Unit = "",//物料带出来
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockId),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId),
|
||||
BeforeQty = s.BeforeQty,
|
||||
|
||||
Reference in New Issue
Block a user