出库增加箱信息填写

This commit is contained in:
18942506660
2024-09-20 11:09:30 +08:00
parent 06fcd26b5b
commit 8c284d1823
13 changed files with 349 additions and 2 deletions

View File

@@ -1,9 +1,11 @@
using System;

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
@@ -207,5 +209,31 @@ namespace WMS.Web.Domain.Entitys
}
this.BillNo = "CK" + idStr;
}
/// <summary>
/// 修改箱信息
/// </summary>
/// <param name="boxDetailsId"></param>
/// <param name="boxLength"></param>
/// <param name="boxWide"></param>
/// <param name="boxHigh"></param>
/// <param name="boxWeight"></param>
/// <param name="userId"></param>
/// <returns></returns>
public Result EditBoxInfo(int boxDetailsId, decimal? boxLength, decimal? boxWide, decimal? boxHigh, decimal? boxWeight, int userId)
{
var boxDetail = this.Details.SelectMany(s => s.BoxsDetails).FirstOrDefault(f => f.Id == boxDetailsId);
if (boxDetail == null) return Result.ReFailure(ResultCodes.NoDateError);
if (boxDetail.BoxLength != boxLength || boxDetail.BoxWide != boxWide ||
boxDetail.BoxHigh != boxHigh || boxDetail.BoxWeight != boxWeight)
{
boxDetail.BoxLength = boxLength;
boxDetail.BoxWide = boxWide;
boxDetail.BoxHigh = boxHigh;
boxDetail.BoxWeight = boxWeight;
boxDetail.UpdateId = userId;
boxDetail.UpdateDate = DateTime.Now;
}
return Result.ReSuccess();
}
}
}

View File

@@ -49,5 +49,35 @@ namespace WMS.Web.Domain.Entitys
///</summary>
[Column("Qty")]
public decimal Qty { get; set; }
/// <summary>
/// 箱长
///</summary>
[Column("BoxLength")]
public decimal? BoxLength { get; set; } = null;
/// <summary>
/// 箱宽
///</summary>
[Column("BoxWide")]
public decimal? BoxWide { get; set; } = null;
/// <summary>
/// 箱高
///</summary>
[Column("BoxHigh")]
public decimal? BoxHigh { get; set; } = null;
/// <summary>
/// 箱重
///</summary>
[Column("BoxWeight")]
public decimal? BoxWeight { get; set; } = null;
/// <summary>
/// 修改人
/// </summary>
[Column("UpdateId")]
public int? UpdateId { get; set; }
/// <summary>
/// 修改时间
/// </summary>
[Column("UpdateDate")]
public DateTime? UpdateDate { get; set; } = null;
}
}

View File

@@ -19,6 +19,11 @@ namespace WMS.Web.Domain.IService
Task<Result> Save(SaveOutStockRequest dto, LoginInDto loginInfo);
// 同步金蝶
Task<Result> Sync(OperateRequest dto, LoginInDto loginInfo, bool isRepeatSync = true);
/// <summary>
/// 修改出库箱信息
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
Task<Result> EditBoxInfo(List<EditBoxInfoRequest> dto, LoginInDto loginInfo);
}
}

View File

@@ -359,5 +359,27 @@ namespace WMS.Web.Domain.Services
_logger.LogInformation($"同步金蝶成功");
return (Result.ReSuccess(), SyncStatus.Success, o_dto.Numbers.First());
}
/// <summary>
/// 修改出库箱信息
/// </summary>
/// <param name="dto"></param>
/// <param name="loginInfo"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<Result> EditBoxInfo(List<EditBoxInfoRequest> dto, LoginInDto loginInfo)
{
var ids = dto.Select(s => s.OutStockId).ToList();
var entityList = await _outStockRepositories.GetEntityList(ids);
foreach (var d in dto)
{
var entity = entityList.FirstOrDefault(f => f.Id == d.OutStockId);
if (entity == null) return Result.ReFailure(ResultCodes.NoDateError);
var res = entity.EditBoxInfo(d.OutStockBoxDetailsId, d.BoxLength, d.BoxWide, d.BoxHigh, d.BoxWeight, loginInfo.UserInfo.StaffId);
if (!res.IsSuccess) return res;
}
var isSuccess = await _outStockRepositories.EditEntityList(entityList);
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess();
}
}
}

View File

@@ -574,6 +574,12 @@ namespace WMS.Web.Domain.Services
OutStockTaskInfoDetailsResponse infoDetail = new OutStockTaskInfoDetailsResponse()
{
BoxBillNo = boxList.FirstOrDefault(f => f.Id == b.BoxId)?.BoxBillNo ?? "",
OutStockId= outStock.Id,
OutStockBoxDetailsId=b.Id,
BoxLength =b.BoxHigh,
BoxWide=b.BoxWide,
BoxHigh=b.BoxHigh,
BoxWeight=b.BoxWeight,
Qty = b.Qty,
SerialNumbers = string.Join(",", b.SerialNumbers),
SerialNumberList = b.SerialNumbers,
@@ -589,6 +595,10 @@ namespace WMS.Web.Domain.Services
};
response.Details.Add(infoDetail);
}
//排序和加序号值
response.Details = response.Details.OrderByDescending(s => s.Specifications)
.ThenByDescending(s => s.Method).ThenByDescending(s => s.Qty).ToList();
response.Details.ForEach(f => f.IndexNumber = response.Details.IndexOf(f) + 1);
return Result<OutStockTaskInfoResponse>.ReSuccess(response);
}