Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -2605,11 +2605,6 @@
|
||||
单据编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.OutStockQueryInfoResponse.Status">
|
||||
<summary>
|
||||
单据状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.OutStock.OutStockQueryInfoResponse.Type">
|
||||
<summary>
|
||||
单据类型
|
||||
|
||||
@@ -706,11 +706,6 @@
|
||||
来源单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.Status">
|
||||
<summary>
|
||||
单据状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.Type">
|
||||
<summary>
|
||||
单据类型
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
public class OpsBoxRequest
|
||||
{
|
||||
public OpsBoxRequest() { }
|
||||
public OpsBoxRequest(DateTime strartTime,DateTime endTime) {
|
||||
this.StrartTime = strartTime;
|
||||
this.EndTime = endTime;
|
||||
}
|
||||
public DateTime StrartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
public string BoxBillNo { get; set; }
|
||||
|
||||
@@ -18,10 +18,6 @@ namespace WMS.Web.Core.Dto.OutStock
|
||||
/// </summary>
|
||||
public string BillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 单据状态
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
@@ -36,11 +36,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("SourceBillNo")]
|
||||
public string SourceBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 单据状态
|
||||
/// </summary>
|
||||
[Column("Status")]
|
||||
public OutStockStatus Status { get; set; } = OutStockStatus.Wait;
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
|
||||
@@ -14,9 +14,18 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
Task<Box> Get(int id);
|
||||
Task<Box> GetByNo(string billNo);
|
||||
//根据箱号搜索 用来比对确定是否箱号信息是否存在
|
||||
Task<List<string>> GetByNos(List<string> billNos);
|
||||
//根据箱号查询明细信息
|
||||
Task<List<BoxResponse>> GetBox(List<string> billNos);
|
||||
//批量修改
|
||||
Task<bool> EditEntityList(List<Box> entitys, bool isTransaction = true);
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddRange(List<Box> entitys, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
CreateMap<Box, BoxResponse>();
|
||||
CreateMap<BoxDetails, BoxDetailResponse>();
|
||||
|
||||
CreateMap<OpsBoxResponse, Box>();
|
||||
CreateMap<OpsBoxDetailsResponse, BoxDetails>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
@@ -13,7 +16,7 @@ namespace WMS.Web.Domain.Services
|
||||
/// <summary>
|
||||
/// 箱服务信息
|
||||
/// </summary>
|
||||
public class BoxService: IBoxService
|
||||
public class BoxService : IBoxService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ILoginService _loginService;
|
||||
@@ -31,9 +34,23 @@ namespace WMS.Web.Domain.Services
|
||||
_opsService = opsService;
|
||||
}
|
||||
|
||||
public Task<Result> Sync()
|
||||
public async Task<Result> Sync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
OpsBoxRequest request = new OpsBoxRequest(DateTime.Now.AddYears(-1), DateTime.Now);
|
||||
var list = await _opsService.GetBox(request);
|
||||
var nos = list.Select(s => s.BoxBillNo).ToList();
|
||||
var old_nos=await _boxRepositories.GetByNos(nos);
|
||||
foreach(var s in old_nos)
|
||||
{
|
||||
//数据库里已经存在箱信息 移除
|
||||
var box = list.FirstOrDefault(f => f.BoxBillNo.Equals(s));
|
||||
list.Remove(box);
|
||||
}
|
||||
var boxs = _mapper.Map<List<Box>>(list);
|
||||
//批量添加
|
||||
await _boxRepositories.AddRange(boxs,true);
|
||||
//需要添加序列号记录表
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,5 +107,35 @@ namespace WMS.Web.Repositories
|
||||
|
||||
return entity.Clone();
|
||||
}
|
||||
//根据箱号搜索 用来比对确定是否箱号信息是否存在
|
||||
public async Task<List<string>> GetByNos(List<string> billNos)
|
||||
{
|
||||
return await _context.Box
|
||||
.Where(w => billNos.Contains(w.BoxBillNo)).Select(s=>s.BoxBillNo).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> AddRange(List<Box> entitys, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
if (entitys != null && entitys.Count != 0)
|
||||
{
|
||||
await _context.Box.AddRangeAsync(entitys);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,6 @@ namespace WMS.Web.Repositories
|
||||
#region dto组装
|
||||
Id = s.order.Id,
|
||||
BillNo = s.order.BillNo,
|
||||
Status = s.order.Status.GetRemark(),
|
||||
Type = s.order.Type.GetRemark(),
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
|
||||
CreateTime = s.order.CreateTime.DateToStringSeconds(),
|
||||
|
||||
Reference in New Issue
Block a user