diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml index a29440fc..25d628ba 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml @@ -35,6 +35,18 @@ + + + 入库任务单-接口 + + + + + 列表 + + + + 登录接口 @@ -72,12 +84,49 @@ - + 保存 + + + 系统配置 + + + + + 获取系统类型所需要下拉列表 + + + + + + 盘点单 + + + + + 列表 + + + + + + + 保存 + + + + + + + 同步金蝶 + + + + diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index 71d0b786..5a4d5452 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -225,6 +225,26 @@ 目标仓位ID + + + 所有枚举信息 + + + + + 出库单类型 + + + + + 移库单类型 + + + + + 盘点结果类型 + + ERP:单据查询-dto @@ -895,9 +915,9 @@ 盘点单列表 - + - 明细编号 + 单据头Id diff --git a/src/WMS.Web.Domain/Entitys/InstockTask.cs b/src/WMS.Web.Domain/Entitys/InstockTask.cs index 966f68a5..f432fb66 100644 --- a/src/WMS.Web.Domain/Entitys/InstockTask.cs +++ b/src/WMS.Web.Domain/Entitys/InstockTask.cs @@ -51,5 +51,30 @@ namespace WMS.Web.Domain.Entitys /// [NotMapped] public List Details = new List(); + + + /// + /// 创建订单号 + /// + /// + public void MakeBillNo(int newId) + { + //生成订单号 + var length = newId.ToString().Length; + if (length >= 8) + { + this.BillNo = $"RKRW{newId.ToString()}"; + } + else + { + var needLength = 8 - length; + var needStr = ""; + for (int i = 0; i < needLength; i++) + { + needStr += "0"; + } + this.BillNo = "RKRW" + needStr + newId.ToString(); + } + } } } diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs index 3b3a6184..37f5eabd 100644 --- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs +++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs @@ -1,5 +1,6 @@ using AutoMapper; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; using System; using System.Collections.Generic; using System.Linq; @@ -8,6 +9,7 @@ using System.Threading.Tasks; using WMS.Web.Core; using WMS.Web.Core.Dto; using WMS.Web.Core.Internal.Results; +using WMS.Web.Domain.Entitys; using WMS.Web.Domain.Infrastructure; using WMS.Web.Repositories.Configuration; @@ -16,7 +18,7 @@ namespace WMS.Web.Repositories /// /// 入库任务表-仓储 /// - public class InStockTaskRepositories: IInStockTaskRepositories + public class InStockTaskRepositories : IInStockTaskRepositories { private readonly IMapper _mapper; private readonly IServiceProvider _serviceProvider; @@ -55,27 +57,94 @@ namespace WMS.Web.Repositories DetailsId = s.detail.Id, BillNo = s.order.BillNo, Type = s.order.Type.GetRemark(), - Status=s.order.Status.GetRemark(), + Status = s.order.Status.GetRemark(), SourceBillNo = s.detail.SourceBillNo, Supplier = "", Org = "", MaterialName = "", MaterialNumber = "", Specifications = "", - FactoryPrice=s.detail.FactoryPrice, + FactoryPrice = s.detail.FactoryPrice, Stock = "", AccruedQty = s.detail.AccruedQty, ReceiveQty = s.detail.ReceiveQty, RealityQty = s.detail.RealityQty, Receiver = "", - ReceiveTime=s.order.ReceiveTime, - Operator="", - OperateTime=s.order.OperateTime, + ReceiveTime = s.order.ReceiveTime, + Operator = "", + OperateTime = s.order.OperateTime, CreateTime = s.detail.CreateTime, }).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); response.Data = list; return response; } + + /// + /// 批量添加 + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + if (entitys != null && entitys.Count != 0) + { + await _context.InStockTask.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + foreach (var item in entitys) + { + if (string.IsNullOrEmpty(item.BillNo)) + //自动生成单据编号 + item.MakeBillNo(item.Id); + } + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + catch + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + } + + /// + /// 添加 + /// + /// + /// + public async Task Add(InStockTask entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + try + { + //创建单据编号 + entity.MakeBillNo(entity.Id); + await _context.InStockTask.AddAsync(entity); + var res = await _context.SaveChangesAsync(); + if (_transaction != null) + _transaction.Commit(); + return entity; + } + catch + { + if (_transaction != null) + _transaction.Rollback(); + return null; + } + + } } }