优化
This commit is contained in:
@@ -67,6 +67,14 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// <returns></returns>
|
||||
string GetMaterialBarCode(List<ErpMaterialDto> erpMaterials, int materialId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料的条码
|
||||
/// </summary>
|
||||
/// <param name="erpMaterials"></param>
|
||||
/// <param name="materialNumber"></param>
|
||||
/// <returns></returns>
|
||||
string GetMaterialBarCode(List<ErpMaterialDto> erpMaterials, string materialNumber);
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料基本单位id
|
||||
/// </summary>
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace WMS.Web.Domain.Services
|
||||
entity.Method = (InventoryInOutMethod)dto.Method;
|
||||
entity.OrgCode = dto.OrgCode;
|
||||
entity.StockCode = dto.StockCode;
|
||||
entity.SubStockId = dto.SubStockId;
|
||||
entity.SubStockCode = dto.SubStockCode;
|
||||
entity.Type = type;
|
||||
entity.Details = _mapper.Map<List<BackRecordDetails>>(dto.Details);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
@@ -102,57 +102,6 @@ namespace WMS.Web.Domain.Services
|
||||
if (!serialNumber_result.IsSuccess)
|
||||
return serialNumber_result;
|
||||
|
||||
//#region 需要改箱操作
|
||||
////获取目标箱和原箱信息
|
||||
//var current_box_about = dto.Details.GroupBy(x => new { x.BoxId }).Select(x => new { x.Key.BoxId }).ToList();
|
||||
//var current_sernub_box = dto.Details.GroupBy(x => x.SerialNumberBoxId).Select(x => x.Key).ToList();
|
||||
|
||||
////要改箱的数据集合
|
||||
//var ganenrateChangeBoxs = new List<SaveChangeBoxRecordRequest>();
|
||||
|
||||
////遍历组装:改箱dto的头部集合
|
||||
//foreach (var boxAbout in current_box_about)
|
||||
//{
|
||||
// foreach (var serBoxId in current_sernub_box)
|
||||
// {
|
||||
// if (boxAbout.BoxId != serBoxId)
|
||||
// {
|
||||
// var changeBox = new SaveChangeBoxRecordRequest();
|
||||
// changeBox.SrcBoxId = serBoxId;
|
||||
// changeBox.DestBoxId = boxAbout.BoxId;
|
||||
// changeBox.SubStockId = entity.SubStockId;
|
||||
// ganenrateChangeBoxs.Add(changeBox);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
////遍历组装明细:改箱dto的明细集合
|
||||
//foreach (var detItem in dto.Details)
|
||||
//{
|
||||
// ganenrateChangeBoxs.ForEach(x =>
|
||||
// {
|
||||
// if (x.SrcBoxId == detItem.SerialNumberBoxId && x.DestBoxId == detItem.BoxId)
|
||||
// {
|
||||
// var changeBoxRD = new SaveChangeBoxRecordDetailsRequest();
|
||||
// changeBoxRD.MaterialId = detItem.MaterialId;
|
||||
// changeBoxRD.Qty = detItem.Qty;
|
||||
// changeBoxRD.SerialNumbers = detItem.SerialNumbers;
|
||||
// x.Details.Add(changeBoxRD);
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
////改箱保存操作:这里不需要在改箱的操作-进行库存的变更(因为会有问题),下面会去更新库存的
|
||||
//var changeBoxSave_Result = await _changeMoveBoxService.ChangeBoxSave(ganenrateChangeBoxs, loginInfo, isTransaction,false);
|
||||
//if (!changeBoxSave_Result.IsSuccess)
|
||||
// return changeBoxSave_Result;
|
||||
//#endregion
|
||||
|
||||
////改箱保存操作--弃用
|
||||
//var changeBoxSave_Result = await _changeMoveBoxService.ChangeBox_BackRecord(entity, loginInfo, isTransaction);
|
||||
//if (!changeBoxSave_Result.IsSuccess)
|
||||
// return changeBoxSave_Result;
|
||||
|
||||
//保存成功后:变更库存
|
||||
var boxInventoryResult = await _boxInventoryService.GenerateBackBox(entity, isTransaction);
|
||||
if (!boxInventoryResult.IsSuccess)
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
_logger.LogInformation($"箱唛生成:{JsonConvert.SerializeObject(dto)} 操作人:{loginInfo.UserInfo.StaffId + loginInfo.UserInfo.Nickname}");
|
||||
//1.获取最新的箱唛信息
|
||||
//var entity_new = await _boxMarkRepositories.GetBy();
|
||||
var billNo_new = await _boxMarkRepositories.GetLastBillNo();
|
||||
|
||||
//2.dto映射实体
|
||||
@@ -66,8 +65,6 @@ namespace WMS.Web.Domain.Services
|
||||
//返回列表-对应刚刚生成的数据和编号集合
|
||||
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
|
||||
|
||||
|
||||
//var resultList = new List<BoxMarkQueryResponse>();
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
//处理-总数量
|
||||
@@ -76,29 +73,6 @@ namespace WMS.Web.Domain.Services
|
||||
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
|
||||
|
||||
});
|
||||
|
||||
//var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
|
||||
//foreach (var id in ids)
|
||||
//{
|
||||
|
||||
// var itemDetailId = 0;
|
||||
// foreach (var item in list)
|
||||
// {
|
||||
// if (id == item.Id)
|
||||
// {
|
||||
|
||||
// var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
|
||||
|
||||
// var newItem = item;
|
||||
// if (current == null)
|
||||
// newItem.Sort = 1;
|
||||
// else
|
||||
// newItem.Sort = current.Sort + 1;
|
||||
// resultList.Add(newItem);
|
||||
// itemDetailId = item.DetailId;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
return ResultList<BoxMarkQueryResponse>.ReSuccess(list);
|
||||
@@ -114,35 +88,12 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
|
||||
|
||||
//var resultList = new List<BoxMarkQueryResponse>();
|
||||
|
||||
if (list != null && list.Count != 0)
|
||||
{
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
|
||||
|
||||
});
|
||||
|
||||
//var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
|
||||
//foreach (var id in ids)
|
||||
//{
|
||||
// var itemDetailId = 0;
|
||||
// foreach (var item in list)
|
||||
// {
|
||||
// if (id == item.Id)
|
||||
// {
|
||||
// var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
|
||||
// var newItem = item;
|
||||
// if (current == null)
|
||||
// newItem.Sort = 1;
|
||||
// else
|
||||
// newItem.Sort = current.Sort + 1;
|
||||
// resultList.Add(newItem);
|
||||
// itemDetailId = item.DetailId;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
return (list, count);
|
||||
|
||||
@@ -183,6 +183,27 @@ namespace WMS.Web.Domain.Services.Public
|
||||
return mat.BarCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料的条码
|
||||
/// </summary>
|
||||
/// <param name="erpMaterials"></param>
|
||||
/// <param name="materialNumber"></param>
|
||||
/// <returns></returns>
|
||||
public string GetMaterialBarCode(List<ErpMaterialDto> erpMaterials, string materialNumber)
|
||||
{
|
||||
if (erpMaterials == null || erpMaterials.Count == 0)
|
||||
return "";
|
||||
var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault();
|
||||
if (mat == null)
|
||||
{
|
||||
var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult();
|
||||
if (!result.IsSuccess)
|
||||
return "";
|
||||
return result.Data == null ? "" : result.Data.BarCode;
|
||||
}
|
||||
return mat.BarCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料基本单位Id
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user