diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs
index 830f91326..a766181d0 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Inventories/BalanceController.cs
@@ -492,21 +492,36 @@ public class BalanceController : AbpController
///
///
///
+ ///
///
[HttpPost("get-recommend-balance")]
- public async Task> GetRecommendBalance(string itemCode,string productLine)
+ public async Task> GetRecommendBalance(string itemCode,string productLine,bool isPackingCode)
{
var productionLineItemDto = await _productionLineItemAppService.GetByProductLineCodeAndItemCodeAsync(productLine, itemCode).ConfigureAwait(false);
+ var locationList = new List();
+ if (productionLineItemDto.RawLocationCodeListJson != null&&
+ productionLineItemDto.RawLocationCodeListJson.Length > 0)
+ {
+ var temp=JsonSerializer.Deserialize>(productionLineItemDto.RawLocationCodeListJson);
+ locationList.AddRange(temp);
+ }
+
+ if (productionLineItemDto.ProductLocationCodeListJson != null &&
+ productionLineItemDto.ProductLocationCodeListJson.Length > 0)
+ {
+ var temp = JsonSerializer.Deserialize>(productionLineItemDto.ProductLocationCodeListJson);
+ locationList.AddRange(temp);
+ }
+
//获取可用库存
var input = new RecommendBalanceRequestInput
{
ItemCode = itemCode,
Qty = decimal.MaxValue,
Statuses = new EditableList { EnumInventoryStatus.OK },
- Locations =
- JsonSerializer.Deserialize>(productionLineItemDto.RawLocationCodeListJson),
- IsPackingCode = true
+ Locations = locationList,
+ IsPackingCode = isPackingCode
};
var usableList = await _balanceAppService.GetUsableListAsync(input).ConfigureAwait(false);
diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
index 1f93d1907..d2aebc5ea 100644
--- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
+++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/ExpectOuts/ExpectOutAppService.cs
@@ -64,7 +64,7 @@ public class ExpectOutAppService
if (expectOut != null)
{
expectOut.Qty -= qty;
- if (expectOut.Qty == 0)
+ if (expectOut.Qty <= 0)
{
await _repository.DeleteAsync(expectOut).ConfigureAwait(false);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs
index 42c4c5ab1..3bf54a1b9 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/IssueJobs/KittingIssueJobs/IKittingIssueJobAppService.cs
@@ -20,4 +20,11 @@ public interface IKittingIssueJobAppService
Task ExecuteDetailAsync(Guid masterId,Guid detailId, KittingIssueJobDetailDTO issueJobDetailDto);
Task CompleteAsync(Guid id);
+
+ ///
+ /// 请求点了完成,任务全部都完成
+ ///
+ ///
+ ///
+ Task CompleteByRequestNumberAsync(string requestNumber);
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
index 782d22947..c349fbe50 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/KittingIssueJobs/KittingIssueJobAppService.cs
@@ -99,13 +99,14 @@ public class KittingIssueJobAppService
[HttpPost("invalid")]
public override async Task CancelAsync(Guid id)
{
- var injectionJob = await _repository.GetAsync(id).ConfigureAwait(false);
- if (injectionJob == null)
+ var kittingJob = await _repository.GetAsync(id).ConfigureAwait(false);
+ if (kittingJob == null)
{
throw new UserFriendlyException($"未找到ID为 {id} 的任务");
}
-
- await _kittingIssueJobManager.CancelAsync(injectionJob).ConfigureAwait(false);
+ await _expectOutAppService.RemoveByNumberAsync(kittingJob.Number).ConfigureAwait(false);
+ kittingJob.JobStatus = EnumJobStatus.Cancelled;
+ await _repository.UpdateAsync(kittingJob).ConfigureAwait(false);
}
[HttpPost("cancel-by-request/{requestNumber}")]
@@ -210,173 +211,52 @@ public class KittingIssueJobAppService
{
await UpdateRequestAndjobStatusDoneAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false);
}
+ else
+ {
+ await RemoveExpectOutAsync(kittingIssueJob, issueJobDetailDto, issueJobDetailDto.HandledToQty).ConfigureAwait(false);
+ }
}
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
}
- [HttpPost("CompleteAsync/{id}")]
+ ///
+ /// 完成任务
+ ///
+ ///
+ ///
+ [HttpPost("Complete/{id}")]
public async Task CompleteAsync(Guid id)
{
- var kittingIssueJob=await _repository.FindAsync(id).ConfigureAwait(false);
+ var kittingIssueJob = await _repository.FindAsync(id).ConfigureAwait(false);
kittingIssueJob.JobStatus = EnumJobStatus.Done;
- await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number,
- kittingIssueJob.Details.First().ItemCode,
- kittingIssueJob.Details.First().HandledToLocationCode, kittingIssueJob.Details.First().HandledToPackingCode,
- kittingIssueJob.Details.First().Status, kittingIssueJob.Details.First().HandledToLot,
- kittingIssueJob.Details.First().HandledToQty).ConfigureAwait(false);
-
await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
+ await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber).ConfigureAwait(false);
await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
}
- #region 私有
-
- ///
- /// 创建补料记录实体
- ///
- ///
- ///
- private async Task BuildKittingIssueNoteAsync(KittingIssueJobDTO kittingIssueJobDto)
- {
- var kittingIssueNoteCreateInput =
- ObjectMapper.Map(kittingIssueJobDto);
- kittingIssueNoteCreateInput.JobNumber = kittingIssueJobDto.Number;
-
- await Task.CompletedTask.ConfigureAwait(false);
-
- return kittingIssueNoteCreateInput;
- }
-
- ///
- /// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值
- ///
- ///
- ///
- private async Task CheckMinRowAndSetStatusAsync(KittingIssueJobEditInput input)
- {
- var jobDetailInputdetail = input.Details.FirstOrDefault();
-
- var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
- .ConfigureAwait(false);
-
- if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode != 1)
- {
- input.JobStatus = EnumJobStatus.Wait;
- }
- else if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode == 1)
- {
- jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate;
- jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode;
- jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate;
- jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea;
- jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode;
- jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode;
- jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup;
- jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot;
- jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode;
- jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate;
- jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty;
- jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch;
- jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode;
-
- jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate;
- jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode;
- jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate;
- jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot;
- jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode;
- jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate;
- jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty;
- jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch;
- jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.TransferLibFromWarehouseCode;
- jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.TransferLibFromLocationArea;
- jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.TransferLibFromLocationCode;
- jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.TransferLibFromLocationErpCode;
- jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.TransferLibFromLocationGroup;
- }
- }
-
///
- /// 判断是不是在立体库
+ /// 请求点了完成,任务全部都完成
///
- ///
+ ///
///
- private async Task CheckDimensionalStorehouseAsync(KittingIssueJobEditInput input)
+ [HttpPost("complete-by-request/{requestNumber}")]
+ public async Task CompleteByRequestNumberAsync(string requestNumber)
{
- var jobDetailInputdetail = input.Details.FirstOrDefault();
-
- var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
- .ConfigureAwait(false);
-
- if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
- {
- input.JobStatus = EnumJobStatus.Wait;
- }
- }
-
- ///
- /// 判断是不是在立体库
- ///
- ///
- ///
- private async Task CheckDimensionalStorehouseAsync(KittingIssueJobDTO kittingIssueJobDto)
- {
- var jobDetailInputdetail = kittingIssueJobDto.Details.FirstOrDefault();
-
- var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
- .ConfigureAwait(false);
-
- if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
- {
- //TODO 立体库
- var ret = await SyncIssueJobStereoAsync(new List { kittingIssueJobDto }, loctionDto.Code).ConfigureAwait(false);
- if (ret.Code != "1")
- {
- throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}");
- }
- }
-
-
- }
+ var kittingIssueJobs = await _repository.GetListAsync(p=>p.KittingRequestNumber==requestNumber).ConfigureAwait(false);
- ///
- /// 修改当前任务状态 和 该任务的请求状态
- ///
- ///
- ///
- ///
- ///
- private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob,
- KittingIssueJobDetailDTO kittingIssueJobDetailDto,decimal handledToQty)
- {
- if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None
- or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中
+ foreach (var kittingIssueJob in kittingIssueJobs)
{
- throw new UserFriendlyException(
- $"任务状态错误:编号为【{kittingIssueJob.Number}】的任务状态为【{kittingIssueJob.JobStatus.GetDisplayName()}】");
+ kittingIssueJob.JobStatus = EnumJobStatus.Done;
+ await _repository.UpdateAsync(kittingIssueJob).ConfigureAwait(false);
+ await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
}
-
- kittingIssueJob.JobStatus = EnumJobStatus.Done;
-
- await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number,
- kittingIssueJobDetailDto.ItemCode,
- kittingIssueJobDetailDto.HandledToLocationCode, kittingIssueJobDetailDto.HandledToPackingCode,
- kittingIssueJobDetailDto.Status, kittingIssueJobDetailDto.HandledToLot,
- handledToQty).ConfigureAwait(false);
-
- //await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
-
- await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber)
- .ConfigureAwait(false);
-
- await Task.CompletedTask.ConfigureAwait(false);
}
-
-
+ #region 立库
///
/// 立体库同步
@@ -386,7 +266,7 @@ public class KittingIssueJobAppService
///
[HttpPost("sync-issue-job-stereo")]
- public async Task SyncIssueJobStereoAsync(List input,string p_loc)
+ public async Task SyncIssueJobStereoAsync(List input, string p_loc)
{
ReusltObject ret = new ReusltObject();
ret.Code = "1";
@@ -415,7 +295,7 @@ public class KittingIssueJobAppService
var httpclient = _httpClientFactory.CreateClient();
#if DEBUG
- string json= System.Text.Json.JsonSerializer.Serialize(main);
+ string json = System.Text.Json.JsonSerializer.Serialize(main);
_options.Value.Address = "http://localhost:59094/";//测试地址
_options.Value.Token = "";//测试token
_options.Value.UserName = "";//测试用户名
@@ -425,7 +305,7 @@ public class KittingIssueJobAppService
if (!string.IsNullOrEmpty(_options.Value.Token))
{
var token = _options.Value.Token;
- httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",token );
+ httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
}
if (!string.IsNullOrEmpty(_options.Value.UserName) && !string.IsNullOrEmpty(_options.Value.Password))
{
@@ -437,13 +317,14 @@ public class KittingIssueJobAppService
IssueJobToRestoClient client = new IssueJobToRestoClient(_options.Value.Address, httpclient);
ret = await client.SyncIssueJobStereoAsync(main).ConfigureAwait(false);
}
- catch(Exception ex) {
+ catch (Exception ex)
+ {
ret = new ReusltObject();
ret.Code = "2";
- ret.Message=ex.Message;
+ ret.Message = ex.Message;
ret.OperateTime = DateTime.Now.ToString("yyyy-MM-dd");
}
-
+
return ret;
}
@@ -453,7 +334,7 @@ public class KittingIssueJobAppService
{
#if DEBUG
- var json= System.Text.Json.JsonSerializer.Serialize(input);
+ var json = System.Text.Json.JsonSerializer.Serialize(input);
#endif
List errors = new List();
var ret = new ReusltObject()
@@ -480,7 +361,7 @@ public class KittingIssueJobAppService
foreach (var itm in dtos)
{
var first = jobs.FirstOrDefault(p => p.JobNumber == itm.Number);
- var itmDetails= itm.Details.ToList();
+ var itmDetails = itm.Details.ToList();
List details = new List();
foreach (var detail in first.Details)
{
@@ -493,7 +374,7 @@ public class KittingIssueJobAppService
dto.RecommendToQty = detail.Qty;
dto.HandledFromQty = detail.Qty;
dto.HandledToQty = detail.Qty;
- dto.Status =entity.Status;
+ dto.Status = entity.Status;
details.Add(dto);
}
itm.Details = details;
@@ -527,5 +408,157 @@ public class KittingIssueJobAppService
}
return ret;
}
+
+ #endregion
+
+ #region 私有
+
+ ///
+ /// 创建补料记录实体
+ ///
+ ///
+ ///
+ private async Task BuildKittingIssueNoteAsync(KittingIssueJobDTO kittingIssueJobDto)
+ {
+ var kittingIssueNoteCreateInput =
+ ObjectMapper.Map(kittingIssueJobDto);
+ kittingIssueNoteCreateInput.JobNumber = kittingIssueJobDto.Number;
+
+ await Task.CompletedTask.ConfigureAwait(false);
+
+ return kittingIssueNoteCreateInput;
+ }
+
+ ///
+ /// 判断是不是在最底层 如果不是则把状态变更为等待 并把库移推荐的From和To赋值
+ ///
+ ///
+ ///
+ private async Task CheckMinRowAndSetStatusAsync(KittingIssueJobEditInput input)
+ {
+ var jobDetailInputdetail = input.Details.FirstOrDefault();
+
+ var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
+ .ConfigureAwait(false);
+
+ if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode != 1)
+ {
+ input.JobStatus = EnumJobStatus.Wait;
+ }
+ else if (loctionDto.Type == EnumLocationType.RAW && loctionDto.RowCode == 1)
+ {
+ jobDetailInputdetail.TransferLibFromArriveDate = jobDetailInputdetail.RecommendFromArriveDate;
+ jobDetailInputdetail.TransferLibFromContainerCode = jobDetailInputdetail.RecommendFromContainerCode;
+ jobDetailInputdetail.TransferLibFromExpireDate = jobDetailInputdetail.RecommendFromExpireDate;
+ jobDetailInputdetail.TransferLibFromLocationArea = jobDetailInputdetail.RecommendFromLocationArea;
+ jobDetailInputdetail.TransferLibFromLocationCode = jobDetailInputdetail.RecommendFromLocationCode;
+ jobDetailInputdetail.TransferLibFromLocationErpCode = jobDetailInputdetail.RecommendFromLocationErpCode;
+ jobDetailInputdetail.TransferLibFromLocationGroup = jobDetailInputdetail.RecommendFromLocationGroup;
+ jobDetailInputdetail.TransferLibFromLot = jobDetailInputdetail.RecommendFromLot;
+ jobDetailInputdetail.TransferLibFromPackingCode = jobDetailInputdetail.RecommendFromPackingCode;
+ jobDetailInputdetail.TransferLibFromProduceDate = jobDetailInputdetail.RecommendFromProduceDate;
+ jobDetailInputdetail.TransferLibFromQty = jobDetailInputdetail.RecommendFromQty;
+ jobDetailInputdetail.TransferLibFromSupplierBatch = jobDetailInputdetail.RecommendFromSupplierBatch;
+ jobDetailInputdetail.TransferLibFromWarehouseCode = jobDetailInputdetail.RecommendFromWarehouseCode;
+
+ jobDetailInputdetail.TransferLibToArriveDate = jobDetailInputdetail.RecommendToArriveDate;
+ jobDetailInputdetail.TransferLibToContainerCode = jobDetailInputdetail.RecommendToContainerCode;
+ jobDetailInputdetail.TransferLibToExpireDate = jobDetailInputdetail.RecommendToExpireDate;
+ jobDetailInputdetail.TransferLibToLot = jobDetailInputdetail.RecommendToLot;
+ jobDetailInputdetail.TransferLibToPackingCode = jobDetailInputdetail.RecommendToPackingCode;
+ jobDetailInputdetail.TransferLibToProduceDate = jobDetailInputdetail.RecommendToProduceDate;
+ jobDetailInputdetail.TransferLibToQty = jobDetailInputdetail.RecommendToQty;
+ jobDetailInputdetail.TransferLibToSupplierBatch = jobDetailInputdetail.RecommendToSupplierBatch;
+ jobDetailInputdetail.TransferLibToWarehouseCode = jobDetailInputdetail.TransferLibFromWarehouseCode;
+ jobDetailInputdetail.TransferLibToLocationArea = jobDetailInputdetail.TransferLibFromLocationArea;
+ jobDetailInputdetail.TransferLibToLocationCode = jobDetailInputdetail.TransferLibFromLocationCode;
+ jobDetailInputdetail.TransferLibToLocationErpCode = jobDetailInputdetail.TransferLibFromLocationErpCode;
+ jobDetailInputdetail.TransferLibToLocationGroup = jobDetailInputdetail.TransferLibFromLocationGroup;
+ }
+ }
+
+ ///
+ /// 判断是不是在立体库
+ ///
+ ///
+ ///
+ private async Task CheckDimensionalStorehouseAsync(KittingIssueJobEditInput input)
+ {
+ var jobDetailInputdetail = input.Details.FirstOrDefault();
+
+ var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
+ .ConfigureAwait(false);
+
+ if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
+ {
+ input.JobStatus = EnumJobStatus.Wait;
+ }
+ }
+
+ ///
+ /// 判断是不是在立体库
+ ///
+ ///
+ ///
+ private async Task CheckDimensionalStorehouseAsync(KittingIssueJobDTO kittingIssueJobDto)
+ {
+ var jobDetailInputdetail = kittingIssueJobDto.Details.FirstOrDefault();
+
+ var loctionDto = await _locationAppService.GetByCodeAsync(jobDetailInputdetail.RecommendFromLocationCode)
+ .ConfigureAwait(false);
+
+ if (loctionDto.Type == EnumLocationType.DimensionalStorehouse)
+ {
+ //TODO 立体库
+ var ret = await SyncIssueJobStereoAsync(new List { kittingIssueJobDto }, loctionDto.Code).ConfigureAwait(false);
+ if (ret.Code != "1")
+ {
+ throw new UserFriendlyException($"调用立体库不成功!原因:{ret.Message}");
+ }
+ }
+
+
+ }
+
+ ///
+ /// 修改当前任务状态 和 该任务的请求状态
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ private async Task UpdateRequestAndjobStatusDoneAsync(KittingIssueJob kittingIssueJob,
+ KittingIssueJobDetailDTO kittingIssueJobDetailDto,decimal handledToQty)
+ {
+ if (kittingIssueJob.JobStatus is EnumJobStatus.Closed or EnumJobStatus.Cancelled or EnumJobStatus.None
+ or EnumJobStatus.Done) //需要考虑下 多次提交的问题 所以不判断 进行中
+ {
+ throw new UserFriendlyException(
+ $"任务状态错误:编号为【{kittingIssueJob.Number}】的任务状态为【{kittingIssueJob.JobStatus.GetDisplayName()}】");
+ }
+
+ kittingIssueJob.JobStatus = EnumJobStatus.Done;
+
+ await RemoveExpectOutAsync(kittingIssueJob, kittingIssueJobDetailDto, handledToQty).ConfigureAwait(false);
+
+ //await _expectOutAppService.RemoveByNumberAsync(kittingIssueJob.Number).ConfigureAwait(false);
+
+ await KittingIssueRequestAppService.UpdateStatusCompletedAsync(kittingIssueJob.KittingRequestNumber)
+ .ConfigureAwait(false);
+
+ await Task.CompletedTask.ConfigureAwait(false);
+ }
+
+ private async Task RemoveExpectOutAsync(KittingIssueJob kittingIssueJob, KittingIssueJobDetailDTO kittingIssueJobDetailDto,
+ decimal handledToQty)
+ {
+ await _expectOutAppService.RemoveByNumberAndInventoryAsync(kittingIssueJob.Number,
+ kittingIssueJobDetailDto.ItemCode,
+ kittingIssueJobDetailDto.HandledToLocationCode, kittingIssueJobDetailDto.HandledToPackingCode,
+ kittingIssueJobDetailDto.Status, kittingIssueJobDetailDto.HandledToLot,
+ handledToQty).ConfigureAwait(false);
+ }
+
#endregion
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs
index 39b83cadf..feb76e76e 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/IssuelRequests/KittingIssueRequests/KittingIssueRequestAppService.cs
@@ -74,15 +74,16 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase CancelAsync(Guid id)
{
- var request=await _repository.GetAsync(id).ConfigureAwait(false);
+ var request = await _repository.GetAsync(id).ConfigureAwait(false);
- var list=await _kittingIssueJobAppService.GetByRequestNumberAsync(request.Number).ConfigureAwait(false);
+ var list = await _kittingIssueJobAppService.GetByRequestNumberAsync(request.Number).ConfigureAwait(false);
if (list.Any())
{
foreach (var kittingIssueJobDto in list)
@@ -159,44 +160,55 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase(request);
}
[HttpPost("UpdateStatusCompleted")]
public async Task UpdateStatusCompletedAsync(string number)
{
- var kittingIssueRequest=await _repository.FindAsync(p=>p.Number== number).ConfigureAwait(false);
+ var kittingIssueRequest = await _repository.FindAsync(p => p.Number == number).ConfigureAwait(false);
- await UpdateKittingIssueRequestDetailQtyAsync(kittingIssueRequest,new EditableList()).ConfigureAwait(false);
+ await UpdateKittingIssueRequestDetailQtyAsync(kittingIssueRequest, new EditableList())
+ .ConfigureAwait(false);
- var kittingIssueJobDtos=await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number).ConfigureAwait(false);
+ var kittingIssueJobDtos = await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number)
+ .ConfigureAwait(false);
if (kittingIssueJobDtos.Any(p =>
p.JobStatus == EnumJobStatus.Open || p.JobStatus == EnumJobStatus.Doing ||
- p.JobStatus == EnumJobStatus.Partial) )
+ p.JobStatus == EnumJobStatus.Partial))
{
return;
}
- else
- {
- bool flag = true;
- foreach (var detail in kittingIssueRequest.Details)
- {
- if (detail.Qty >= detail.IssuedQty)
- {
- flag = false;
- return;
- }
- }
+ var flag = true;
- if (flag)
+ foreach (var detail in kittingIssueRequest.Details)
+ {
+ if (detail.Qty >= detail.IssuedQty)
{
- CheckStatus(EnumRequestStatus.Completed, kittingIssueRequest.RequestStatus);
- kittingIssueRequest.RequestStatus = EnumRequestStatus.Completed;
- await _repository.UpdateAsync(kittingIssueRequest).ConfigureAwait(false);
+ flag = false;
+ return;
}
}
+
+ if (flag)
+ {
+ CheckStatus(EnumRequestStatus.Completed, kittingIssueRequest.RequestStatus);
+ kittingIssueRequest.RequestStatus = EnumRequestStatus.Completed;
+ await _repository.UpdateAsync(kittingIssueRequest).ConfigureAwait(false);
+ }
}
///
@@ -209,7 +221,8 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase addKittingIssueJobDtos)
{
//原有任务
- var existKittingIssueJobDtos = await _kittingIssueJobAppService.GetByRequestNumberAsync(kittingIssueRequest.Number)
+ var existKittingIssueJobDtos = await _kittingIssueJobAppService
+ .GetByRequestNumberAsync(kittingIssueRequest.Number)
.ConfigureAwait(false);
//新增的任务和已有的任务总和
@@ -248,9 +261,10 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase IsHasNewJobAsync(string requestNumber,List jobNumber)
+ public async Task IsHasNewJobAsync(string requestNumber, List jobNumber)
{
- var joblIssueJobDtos=await _kittingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false);
+ var joblIssueJobDtos =
+ await _kittingIssueJobAppService.GetByRequestNumberAsync(requestNumber).ConfigureAwait(false);
if (joblIssueJobDtos != null && joblIssueJobDtos.Any())
{
var jobNumberList = joblIssueJobDtos.Select(p => p.Number);
@@ -259,19 +273,35 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase result+="【"+p+"】");
+ difference.ForEach(p => result += "【" + p + "】");
result += "的任务";
return result;
}
- else
- {
- return "无任务生成,请检查库存";
- }
+
+ return "无任务生成,请检查库存";
+ }
+
+ return "无任务生成,请检查库存";
+ }
+
+ public override async Task CompleteAsync(Guid id)
+ {
+ var kittingIssueRequest = await _repository.GetAsync(id).ConfigureAwait(false);
+ if (kittingIssueRequest.RequestStatus == EnumRequestStatus.Handling ||
+ kittingIssueRequest.RequestStatus == EnumRequestStatus.Partial ||
+ kittingIssueRequest.RequestStatus == EnumRequestStatus.New)
+ {
+ kittingIssueRequest.RequestStatus = EnumRequestStatus.Completed;
}
else
{
- return "无任务生成,请检查库存";
+ throw new UserFriendlyException($"【{kittingIssueRequest.RequestStatus.GetDisplayName()}】状态不允许完成");
}
+
+ await _kittingIssueJobAppService.CompleteByRequestNumberAsync(kittingIssueRequest.Number).ConfigureAwait(false);
+
+ return ObjectMapper.Map(await _repository.UpdateAsync(kittingIssueRequest)
+ .ConfigureAwait(false));
}
#region 校验
@@ -297,32 +327,32 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase
{
- EnumRequestStatus.Agreed, EnumRequestStatus.Partial,
+ EnumRequestStatus.Agreed, EnumRequestStatus.Partial
};
break;
case EnumRequestStatus.Completed:
validSourceStatuses = new List
{
- EnumRequestStatus.Handling, EnumRequestStatus.Partial,
+ EnumRequestStatus.Handling, EnumRequestStatus.Partial
};
break;
case EnumRequestStatus.Cancelled:
validSourceStatuses = new List
{
- EnumRequestStatus.New, EnumRequestStatus.Reviewing, EnumRequestStatus.Agreed,
+ EnumRequestStatus.New, EnumRequestStatus.Reviewing, EnumRequestStatus.Agreed
};
break;
case EnumRequestStatus.Abort:
validSourceStatuses = new List
{
- EnumRequestStatus.Handling, EnumRequestStatus.Partial,
+ EnumRequestStatus.Handling, EnumRequestStatus.Partial
};
break;
case EnumRequestStatus.Partial:
{
validSourceStatuses = new List
{
- EnumRequestStatus.Handling, EnumRequestStatus.Partial,
+ EnumRequestStatus.Handling, EnumRequestStatus.Partial
};
break;
}
@@ -354,7 +384,8 @@ public class KittingIssueRequestAppService : SfsStoreRequestAppServiceBase