Browse Source

盘点修改

dev_DY_CC
lvzb 1 year ago
parent
commit
97ae822c77
  1. 8
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  2. 1
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJob.cs
  3. 3
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDetail.cs
  4. 48
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs
  5. 9
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteManager.cs

8
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs

@ -4,6 +4,7 @@ using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using NetTopologySuite.Geometries;
using Omu.ValueInjecter;
using Volo.Abp;
@ -382,10 +383,15 @@ public class BomManager : DomainService, IBomManager
public virtual async Task<List<Bom>> GetAllItemByCode(string productCode,Guid id)
{
List<Bom> boms = new List<Bom>();
var lst = await _repository.GetListAsync(p => p.Product == productCode).ConfigureAwait(false);
var lst = await
(await _repository.GetDbSetAsync().ConfigureAwait(false))
.Where(p => p.Product == productCode)
.AsNoTracking()
.ToListAsync().ConfigureAwait(false);
foreach (var bom in lst)
{
bom.Remark = id.ToString();
bom.SetId(GuidGenerator.Create());
boms.Add(bom);
var results= await GetAllItemByCode(bom.Component,bom.Id).ConfigureAwait(false);
boms.AddRange(results);

1
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJob.cs

@ -71,7 +71,6 @@ public class CountJob : SfsJobAggregateRootBase<CountJobDetail>
/// <summary>
/// 任务明细
/// </summary>
[IgnoreUpdate]
public override List<CountJobDetail> Details { get; set; } = new List<CountJobDetail>();
/// <summary>
/// 任务从表明细(记录每次扫得明细)

3
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobDetail.cs

@ -1,11 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using Org.BouncyCastle.Crypto.Prng.Drbg;
using Win_in.Sfs.Shared.Domain;
namespace Win_in.Sfs.Wms.Store.Domain;
public class CountJobDetail : SfsJobDetailEntityBase, IHasCountResult, IHasInventoryQty
{
/// <summary>
/// 盘点计划单号
/// </summary>

48
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/CountJobs/CountJobManager.cs

@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Users;
@ -39,7 +40,7 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
/// <exception cref="UserFriendlyException"></exception>
public virtual async Task<List<CountJob>> ResetStatusByNumberAsync(List<string> numbers)
{
var joblist = await _repository.GetListAsync(r => numbers.Contains(r.Number)).ConfigureAwait(false);
var joblist = await _repository.GetListAsync(r => numbers.Contains(r.Number), true).ConfigureAwait(false);
var planNumbers = joblist.Select(r => r.CountPlanNumber).Distinct();
if (planNumbers.Count() > 1)
{
@ -53,12 +54,57 @@ public class CountJobManager : SfsJobManagerBase<CountJob, CountJobDetail>, ICou
throw new UserFriendlyException($"任务号 【{job.Number}】生成的记录【{note.Number}】已经进行了调整,无法重盘");
}
job.JobStatus = EnumJobStatus.Open;
var details = job.Details.Where(r => r.InventoryStage == job.InventoryStage && r.InventoryQty != 0).ToList();
List<CountJobDetail> newDetails = new List<CountJobDetail>();
foreach (var detail in details)
{
var newDetail= BuildCountJob(detail);
newDetails.Add(newDetail);
}
job.InventoryStage++;
job.AddDetails(newDetails);
}
await _repository.UpdateManyAsync(joblist).ConfigureAwait(false);
await LocalEventBus.PublishAsync(new SfsSubmittedEntityEventData<List<CountJob>>(joblist), false).ConfigureAwait(false);
return joblist;
}
private CountJobDetail BuildCountJob(CountJobDetail job)
{
CountJobDetail newDetail = new CountJobDetail();
newDetail.SetIdAndNumber(GuidGenerator, job.Id, job.Number);
newDetail.CountPlanNumber = job.CountPlanNumber;
newDetail.CountLabel = GuidGenerator.Create().ToString();
newDetail.InventoryQty = job.InventoryQty;
newDetail.InventoryStage = job.InventoryStage+1;
newDetail.Uom = job.Uom;
newDetail.InventoryLocationCode = job.InventoryLocationCode;
newDetail.CountQty = 0;
newDetail.CountTime = job.CountTime;
newDetail.CountOperator = job.CountOperator;
newDetail.CountDescription = job.CountDescription;
newDetail.ItemName = job.ItemName;
newDetail.ItemDesc1 = job.ItemDesc1;
newDetail.ItemDesc2 = job.ItemDesc2;
newDetail.ItemCode = job.ItemCode;
newDetail.StdPackQty = job.StdPackQty;
newDetail.Status = job.Status;
newDetail.ContainerCode = job.ContainerCode;
newDetail.PackingCode = job.PackingCode;
newDetail.Lot = job.Lot; ;
newDetail.SupplierBatch = job.SupplierBatch;
newDetail.ArriveDate = job.ArriveDate;
newDetail.ProduceDate = job.ProduceDate;
newDetail.ExpireDate = job.ExpireDate;
newDetail.LocationCode = job.LocationCode;
newDetail.LocationArea = job.LocationArea;
newDetail.LocationGroup = job.LocationGroup;
newDetail.LocationErpCode = job.LocationErpCode;
newDetail.WarehouseCode = job.WarehouseCode;
return newDetail;
}
/// <summary>
/// 执行任务

9
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/CountNotes/CountNoteManager.cs

@ -58,13 +58,16 @@ public class CountNoteManager : SfsStoreManagerBase<CountNote, CountNoteDetail>,
List<CountNote> deleteItems = new List<CountNote>();
foreach (var entity in entities)
{
var deleteentity=await Repository.GetAsync(r=>r.CountJobNumber== entity.CountJobNumber).ConfigureAwait(false);
deleteItems.Add(deleteentity);
var deleteentity=await Repository.FindAsync(r=>r.CountJobNumber== entity.CountJobNumber).ConfigureAwait(false);
if(deleteentity!=null) deleteItems.Add(deleteentity);
entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(typeof(CountNote).Name, entity.ActiveDate).ConfigureAwait(false));
}
//先删除之前得记录
await Repository.DeleteManyAsync(deleteItems).ConfigureAwait(false);
if (deleteItems.Count >0)
{
await Repository.DeleteManyAsync(deleteItems).ConfigureAwait(false);
}
await Repository.InsertManyAsync(entities).ConfigureAwait(false);
await PublishCreatedAsync(entities).ConfigureAwait(false);
return entities;

Loading…
Cancel
Save