This commit is contained in:
tongfei
2024-03-27 10:12:54 +08:00
22 changed files with 729 additions and 21 deletions

View File

@@ -0,0 +1,85 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
{
/// <summary>
/// 老ops序列码
/// </summary>
[Serializable]
[Table("t_wms_serialnumbers_ops")]
public class SerialNumbers_Ops : EntityBase
{
/// <summary>
/// 主键 订单编号
/// </summary>
[Column("Id")]
public override int Id { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Column("SerialNumber")]
public string SerialNumber { get; set; }
/// <summary>
/// 物料编码
/// </summary>
[Column("MaterialNumber")]
public string MaterialNumber { get; set; }
/// <summary>
/// wms箱ID
/// </summary>
[Column("BoxId")]
public int BoxId { get; set; }
/// <summary>
/// 对应老OPS的箱ID
/// </summary>
[Column("OpsBoxId")]
public int OpsBoxId { get; set; }
/// <summary>
/// 创建人(老ops过来)
/// </summary>
[Column("Creator")]
public string Creator { get; set; }
/// <summary>
/// 创建时间(老ops过来)
/// </summary>
[Column("CreateTime")]
public DateTime CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 完成装箱时间
/// </summary>
[Column("CompleteCartonTime")]
public DateTime? CompleteCartonTime { get; set; }
/// <summary>
/// 出库单对应销售订单号
/// </summary>
[Column("SalBillNo")]
public string SalBillNo { get; set; }
/// <summary>
/// 出库时间
/// </summary>
[Column("OutStockTime")]
public DateTime? OutStockTime { get; set; }
/// <summary>
/// 采购单号
///</summary>
[Column("PurchaseBillNo")]
public string PurchaseBillNo { get; set; }
/// <summary>
/// 入库时间
/// </summary>
[Column("InStockTime")]
public DateTime? InStockTime { get; set; }
/// <summary>
/// 收货客户
///</summary>
[Column("CustomerId")]
public int CustomerId { get; set; } = 0;
}
}

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.Erp.OutStock;
using WMS.Web.Core.Dto.Login;
using WMS.Web.Core.Dto.OutStockTask;
using WMS.Web.Core.Internal.Results;
namespace WMS.Web.Domain.IService.Public
@@ -56,5 +57,11 @@ namespace WMS.Web.Domain.IService.Public
/// <param name="begin"></param>
/// <returns></returns>
Task<Result> Sync(List<string> billNos = null,DateTime? begin=null);
/// <summary>
/// 查询出库任务单详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<Result<OutStockTaskInfoResponse>> GetInfo(int id, LoginInDto loginInfo);
}
}

View File

@@ -15,7 +15,7 @@ namespace WMS.Web.Domain.Infrastructure
//编辑
Task<OutStock> Edit(OutStock entity, bool isTransaction = true);
//根据任务单Id搜索
Task<OutStock> GetByTaskId(int taskId);
Task<List<OutStock>> GetByTaskId(int taskId);
// 获取列表
Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto, int companyId = 0);
/// 查询实体集合

View File

@@ -21,7 +21,7 @@ namespace WMS.Web.Domain.Infrastructure
/// <returns></returns>
Task<bool> AddRange(List<SerialNumbers> entitys, bool isTransaction = true);
//根据序列号模糊搜索信息
Task<MaterialResponse> GetSerialNumber(string serialNumber, string orgCode);
Task<MaterialResponse> GetSerialNumber(string serialNumber, string orgCode, bool IsOps = false);
//根据序列号搜索信息
Task<SerialNumbersResponse> Get(string serialNumber);
/// 查询实体集合

View File

@@ -0,0 +1,16 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Mappers
{
public class SerialNumbersMapper : Profile
{
public SerialNumbersMapper()
{
CreateMap<SerialNumbers_Ops, SerialNumbers>().ReverseMap();
}
}
}

View File

@@ -17,6 +17,11 @@ namespace WMS.Web.Domain.Mappers
CreateMap<SubscribeNotification, SubscribeNotification>();
CreateMap<SaveSubscribeNotificationRequest, SubscribeNotification>();
CreateMap<EditSubscribeNotificationRequest, SubscribeNotification>();
CreateMap<SubscribeNotification, SubscribeNotificationInfoResponse>()
.ForMember(x => x.Emails, ops => ops.MapFrom(x => string.Join(",", x.Emails)))
.ForMember(x => x.Telephones, ops => ops.MapFrom(x => string.Join(",", x.Telephones)));
}
}
}

View File

@@ -5,9 +5,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.Erp.Customer;
using WMS.Web.Core.Dto.Erp.Org;
using WMS.Web.Core.Dto.Erp.OutStock;
using WMS.Web.Core.Dto.Login;
using WMS.Web.Core.Dto.OutStockTask;
using WMS.Web.Core.Help;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Entitys;
@@ -16,6 +21,7 @@ using WMS.Web.Domain.IService;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Services.Public;
using WMS.Web.Domain.Values;
using WMS.Web.Domain.Values.Single;
namespace WMS.Web.Domain.Services
{
@@ -32,10 +38,13 @@ namespace WMS.Web.Domain.Services
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
private readonly IErpOpsSyncDateRepositories _erpOpsSyncDateRepositories;
private readonly RedisClientService _redisClientService;
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
private readonly ISingleDataService _singleDataService;
public OutStockTaskService(IMapper mapper, IErpService erpService, ILoginService loginService,
IBasicsRepositories transactionRepositories,
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories, IErpOpsSyncDateRepositories erpOpsSyncDateRepositories,
RedisClientService redisClientService)
RedisClientService redisClientService, IErpBasicDataExtendService erpBasicDataExtendService,
ISingleDataService singleDataService)
{
_mapper = mapper;
_erpService = erpService;
@@ -45,6 +54,8 @@ namespace WMS.Web.Domain.Services
_outStockTaskRepositories = outStockTaskRepositories;
_erpOpsSyncDateRepositories = erpOpsSyncDateRepositories;
_redisClientService = redisClientService;
_erpBasicDataExtendService = erpBasicDataExtendService;
_singleDataService = singleDataService;
}
/// <summary>
@@ -435,6 +446,70 @@ namespace WMS.Web.Domain.Services
return Result.ReSuccess();
}
/// <summary>
/// 获取出库任务单详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<Result<OutStockTaskInfoResponse>> GetInfo(int id, LoginInDto loginInfo)
{
var entity = await _outStockTaskRepositories.Get(id);
if (entity == null)
return Result<OutStockTaskInfoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
//获取任务单对应出库信息
var outStockList = await _outStockRepositories.GetByTaskId(id);
//取组织
var org_result = await _erpService.BillQueryForOrg();
List<ErpOrgDto> orgs = new List<ErpOrgDto>();
if (org_result.IsSuccess)
orgs = org_result.Data.ToList();
//取客户
var customer_result = await _erpService.BillQueryForCustomer();
List<ErpCustomerDto> customers = new List<ErpCustomerDto>();
if (customer_result.IsSuccess)
customers = customer_result.Data.ToList();
var materials_result = await _erpService.BillQueryForMaterial();
List<ErpMaterialDto> materials = new List<ErpMaterialDto>();
if (materials_result.IsSuccess)
materials = materials_result.Data.ToList();
OutStockTaskInfoResponse response = new OutStockTaskInfoResponse()
{
Id = entity.Id,
BillNo = entity.BillNo,
SourceBillNo = string.Join(",", entity.Details.SelectMany(s => s.ErpDetails).Select(s => s.SourceBillNo)),
CreateTime = entity.CreateTime.DateToStringSeconds(),
Status = entity.Status.GetRemark(),
Type = entity.Type.GetRemark(),
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, entity.DeliveryOrgId),
ReceiptCustomer = entity.Type == OutStockType.Sal
? _erpBasicDataExtendService.GetCustomerName(customers, entity.ReceiptCustomerId)
: _erpBasicDataExtendService.GetOrgName(orgs, entity.DeliveryOrgId),
};
var details = outStockList.SelectMany(s => s.Details).ToList();
var boxDetails = outStockList.SelectMany(s => s.Details).SelectMany(s => s.BoxsDetails).ToList();
foreach (var b in boxDetails)
{
var detail = details.FirstOrDefault(f => f.Id == b.DetailId);
var outStock = outStockList.FirstOrDefault(f => f.Id == detail.Fid);
OutStockTaskInfoDetailsResponse infoDetail = new OutStockTaskInfoDetailsResponse()
{
BoxBillNo = b.BoxId.ToString(),
Qty = b.Qty,
SerialNumbers = string.Join(",", b.SerialNumbers),
Method = outStock.Method.GetRemark(),
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, loginInfo.UserInfo.CompanyId, outStock.CreatorId),
CreateTime = outStock.CreateTime.DateToStringSeconds(),
MaterialNumber = detail.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, detail.MaterialNumber),
AccruedQty = entity.Details.FirstOrDefault(f => f.MaterialNumber == detail.MaterialNumber)?.AccruedQty ?? 0
};
}
return Result<OutStockTaskInfoResponse>.ReSuccess(response);
}
}
}