diff --git a/.vs/WZC2/v17/.wsuo b/.vs/WZC2/v17/.wsuo
index 78d4fb1e6..5a177d4c3 100644
Binary files a/.vs/WZC2/v17/.wsuo and b/.vs/WZC2/v17/.wsuo differ
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs
index 7b9b122ee..46e7f3af1 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtl.cs
@@ -8,7 +8,7 @@ public class CallMtl : Entity
/// 序号
///
[Key]
- public string mesout_callmtl_id { get; set; }
+ public long ID { get; set; }
///
/// 物料
///
@@ -33,7 +33,7 @@ public class CallMtl : Entity
public override object[] GetKeys()
{
- return new object[] { mesout_callmtl_id };
+ return new object[] { ID };
}
}
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs
index d48c9e68e..4664c7398 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/CallMtl/CallMtlManager.cs
@@ -20,8 +20,8 @@ public class CallMtlManager : DomainService, ICallMtlManager
}
public virtual async Task UpdateProcesseErrordListAsync(List entities)
{
- var ids = entities.Select(p => p.mesout_callmtl_id);
- var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false);
+ var ids = entities.Select(p => p.ID);
+ var plans = await _repository.GetListAsync(p => ids.Contains(p.ID)).ConfigureAwait(false);
plans.ForEach(p =>
{
p.Yl1 = 2;
@@ -31,8 +31,8 @@ public class CallMtlManager : DomainService, ICallMtlManager
}
public virtual async Task UpdateProcessedListAsync(List entities)
{
- var ids = entities.Select(p => p.mesout_callmtl_id);
- var plans = await _repository.GetListAsync(p => ids.Contains(p.mesout_callmtl_id)).ConfigureAwait(false);
+ var ids = entities.Select(p => p.ID);
+ var plans = await _repository.GetListAsync(p => ids.Contains(p.ID)).ConfigureAwait(false);
plans.ForEach(p =>
{
p.Yl1 = 1;
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs
index 9a28e7a47..4764666e3 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/CallMtl/CallMtlDbContextModelCreatingExtensions.cs
@@ -15,7 +15,8 @@ public static class CallMtlDbContextModelCreatingExtensions
b.ConfigureByConvention();
//Properties
- b.Property(q => q.mesout_callmtl_id).HasMaxLength(20);
+ // b.Property(q => q.ID).HasMaxLength(20);
+ b.Property(q => q.ID);
b.Property(q => q.mesout_callmtl_erpno).HasMaxLength(20);
b.Property(q => q.mesout_callmtl_loc).HasMaxLength(10);
b.Property(q => q.mesout_callmtl_num).HasPrecision(10, 2);
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
index a4498b3d5..87243b791 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Client/WebApi.cs
@@ -1,5 +1,3 @@
-
-
//----------------------
//
// Generated using the NSwag toolchain v14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
@@ -72,7 +70,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
///
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task GetMacStaticAsync()
+ public virtual System.Threading.Tasks.Task GetMacStaticAsync()
{
return GetMacStaticAsync(System.Threading.CancellationToken.None);
}
@@ -83,7 +81,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
///
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task GetMacStaticAsync(System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetMacStaticAsync(System.Threading.CancellationToken cancellationToken)
{
var client_ = _httpClient;
var disposeClient_ = false;
@@ -98,8 +96,8 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
var urlBuilder_ = new System.Text.StringBuilder();
if (!string.IsNullOrEmpty(_baseUrl)) urlBuilder_.Append(_baseUrl);
// Operation Path: "CargoState/GetMacStatic"
- urlBuilder_.Append("CargoState/GetMacStatic");
-
+ urlBuilder_.Append("api/CargoState/GetMacStatic");
+ //urlBuilder_.Append("CargoState/GetMacStatic");
PrepareRequest(client_, request_, urlBuilder_);
var url_ = urlBuilder_.ToString();
@@ -125,7 +123,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -214,7 +212,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
/// Success
/// A server side error occurred.
- public virtual System.Threading.Tasks.Task> GetCargoStaticAsync(string areaID)
+ public virtual System.Threading.Tasks.Task GetCargoStaticAsync(string areaID)
{
return GetCargoStaticAsync(areaID, System.Threading.CancellationToken.None);
}
@@ -222,7 +220,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// Success
/// A server side error occurred.
- public virtual async System.Threading.Tasks.Task> GetCargoStaticAsync(string areaID, System.Threading.CancellationToken cancellationToken)
+ public virtual async System.Threading.Tasks.Task GetCargoStaticAsync(string areaID, System.Threading.CancellationToken cancellationToken)
{
var client_ = _httpClient;
var disposeClient_ = false;
@@ -269,7 +267,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -536,6 +534,7 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
}
+
public partial class ResponCargoItem1
{
///
@@ -572,6 +571,45 @@ namespace Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent.Incoming
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
+ public partial class ResponCargos
+ {
+ [Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int Code { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int Value { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Msg { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("datalist", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public System.Collections.Generic.ICollection Datalist { get; set; }
+
+ }
+
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
+ public partial class ResultJson
+ {
+ [Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int Code { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public int Value { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Result { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Msg { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("valuestr", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Valuestr { get; set; }
+
+ }
+
+
+
[System.CodeDom.Compiler.GeneratedCode("NSwag", "14.0.7.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))")]
public partial class ApiException : System.Exception
{
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
index 302e865ea..afa36a95d 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingRequestReader.cs
@@ -76,7 +76,7 @@ public class InjectionMoldingRequestReader : IReader
Stopwatch sw = Stopwatch.StartNew();
Client client = new Client(_options.Value.AutoRemote.IpAddress, _httpClientFactory.CreateClient());//调用客户记录
var flag = await client.GetMacStaticAsync().ConfigureAwait(false);
- if (flag != 1)
+ if (flag.Code != 200)
{
// 记录错误日志并返回空列表
_logger.LogInformation($"读取到摄像头信息为不可用{DateTime.Now},请检查摄像头");
@@ -94,7 +94,15 @@ public class InjectionMoldingRequestReader : IReader
{
foreach (var itm in ids)//遍历区域查找所有货物
{
- var idsList = await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
+
+
+ var obj= await client.GetCargoStaticAsync(itm).ConfigureAwait(false);
+ var idsList = obj.Datalist;
+ if (idsList == null)
+ {
+ _logger.LogInformation($"没有设置指定区域无数据");
+ return new List();
+ }
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs
index bc6238dd0..264266b09 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/Incoming/InjectionMoldingTaskIncomingBackgroundWorker.cs
@@ -58,7 +58,7 @@ public class InjectionMoldingTaskIncomingBackgroundWorker : AsyncPeriodicBackgro
return;
}
}
-
+
Logger.LogInformation($"注塑任务");//缴库
var reader = workerContext.ServiceProvider.GetService();
await reader.ReadAsync().ConfigureAwait(false);
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json
index d4aaa87d0..a1a28cc4a 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.InjectionMoldingTaskAgent/appsettings.json
@@ -1,8 +1,8 @@
{
"ConnectionStrings": {
- "Default": "Server=10.164.113.32,1818\\SHDB;Database=Wms_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false",
- "DataExchange": "Server=10.164.113.32,1818\\SHDB;Database=Wms_DataExchange_Main_Dy_ShangHai;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false",
- "MES": "Server=10.164.113.32,1818\\SHDB;Database=MES_SH;uid=ShWmsUser;pwd=Faty@Wms_20230413#SH;TrustServerCertificate=True;Encrypt=false"
+ "Default": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_Main_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false",
+ "DataExchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_DataExchange_CC;uid=ccwin-in;pwd=Microsoft@2022;TrustServerCertificate=True;Encrypt=false",
+ "MES": "Server=10.164.233.7;Database=MES_JY;uid=sa;pwd=Asdf1234$;TrustServerCertificate=True;Encrypt=false"
},
"AuthServer": {
@@ -27,10 +27,10 @@
"Inventory": {
- "BaseUrl": "http://localhost:59095/"
+ "BaseUrl": "http://dev.ccwin-in.com:60082/"
},
"Job": {
- "BaseUrl": "http://localhost:59095/"
+ "BaseUrl": "http://dev.ccwin-in.com:60085/"
},
"Label": {
"BaseUrl": "http://dev.ccwin-in.com:60082/"
@@ -39,10 +39,10 @@
"BaseUrl": "http://dev.ccwin-in.com:60082/"
},
"Store": {
- "BaseUrl": "http://localhost:59095/"
+ "BaseUrl": "http://dev.ccwin-in.com:60085/"
},
"BaseData": {
- "BaseUrl": "http://localhost:59094/"
+ "BaseUrl": "http://dev.ccwin-in.com:60084/"
}
@@ -67,7 +67,7 @@
"InjectionMoldingTaskOptions": {
"AutoRemote": {
- "IpAddress": "http://10.164.227.103:30000/",
+ "IpAddress": "http://dev.ccwin-in.com:60084/",
"UserName": "",
"Password": "",
"Token": "",
@@ -78,14 +78,14 @@
"IncomingOptions": {
"Active": true,
- "PeriodSeconds": 10,
+ "PeriodSeconds": 5,
"BatchSize": 10,
"MaxCount": 100,
"RetryTimes": 3
},
"OutgoingOptions": {
"Active": true,
- "PeriodSeconds": 10,
+ "PeriodSeconds": 5,
"BatchSize": 10,
"MaxCount": 100,
"RetryTimes": 3
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs
index 7bc6dd95a..1d70736d3 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/CallMtlReader.cs
@@ -86,8 +86,8 @@ public class CallMtlReader : IReader
DataType = EnumIncomingDataType.CallMtl.ToString(),
DataAction = EnumExchangeDataAction.Add,
SourceSystem = EnumSystemType.MES.ToString(),
- SourceDataId = CallMtl.mesout_callmtl_id.ToString(),
- SourceDataGroupCode = CallMtl.mesout_callmtl_id,
+ SourceDataId = CallMtl.ID.ToString(),
+ SourceDataGroupCode = CallMtl.ID.ToString(),
SourceDataDetailCode = CallMtl.mesout_callmtl_erpno,
SourceDataContent = JsonSerializer.Serialize(CallMtl),
WriteTime = DateTime.Now,
diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs
index 8f02b2b60..8ea019ee8 100644
--- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs
+++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Fawtyg.MesAgent/Incoming/MesOutConverter.cs
@@ -105,7 +105,7 @@ public class MesOutConverter : IIncomingConverter
//}
//else
//{
- wmsProductReceiptNoteDetail.Lot = ""; //排序批次
+ wmsProductReceiptNoteDetail.Lot = ""; //排序批次
wmsProductReceiptNoteDetail.PackingCode = "";//箱标签
wmsProductReceiptNoteDetail.Status = EnumInventoryStatus.OK;
wmsProductReceiptNoteDetail.WarehouseCode = "T9";
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs
index 82750ac6a..5712ab4a2 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/AssembleIssueJobsController.cs
@@ -175,9 +175,9 @@ public class AssembleIssueJobsController : AbpController
// return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
//}
- if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
+ if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.ClaimsUserId != CurrentUser.Id.ToString())
{
- return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
+ return new NotFoundObjectResult($"任务正在被 {jobDto.ClaimsUserName} 处理");
}
return jobDto;
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs
index cf7f0d047..582f7ab95 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/CoatingIssueJobsController.cs
@@ -175,9 +175,9 @@ public class CoatingIssueJobsController : AbpController
// return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
//}
- if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
+ if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.ClaimsUserId != CurrentUser.Id.ToString())
{
- return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
+ return new NotFoundObjectResult($"任务正在被 {jobDto.ClaimsUserName} 处理");
}
return jobDto;
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs
index 59ab445ea..e154c8f72 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/InjectionIssueJobsController.cs
@@ -175,9 +175,9 @@ public class InjectionIssueJobsController : AbpController
// return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
//}
- if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
+ if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.ClaimsUserId != CurrentUser.Id.ToString())
{
- return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
+ return new NotFoundObjectResult($"任务正在被 {jobDto.ClaimsUserName} 处理");
}
return jobDto;
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs
index 799e9e24b..52fe17b01 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/KittingIssueJobsController.cs
@@ -175,9 +175,9 @@ public class KittingIssueJobsController : AbpController
// return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
//}
- if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
+ if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.ClaimsUserId != CurrentUser.Id.ToString())
{
- return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
+ return new NotFoundObjectResult($"任务正在被 {jobDto.ClaimsUserName} 处理");
}
return jobDto;
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs
index 66cbe7fae..f9642b25b 100644
--- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/IssueJobs/SparePartIssueJobsController.cs
@@ -52,10 +52,10 @@ public class SparePartIssueJobsController : AbpController
{
status.Add((int)EnumJobStatus.Open);
}
- else if (jobStatus == "Wait")
- {
- status.Add((int)EnumJobStatus.Wait);
- }
+ //else if (jobStatus == "Wait")
+ //{
+ // status.Add((int)EnumJobStatus.Wait);
+ //}
else
{
status.Add((int)EnumJobStatus.Done);
@@ -174,9 +174,9 @@ public class SparePartIssueJobsController : AbpController
return new NotFoundObjectResult($"任务属于工作组 {jobDto.WorkGroupCode}");
}
- if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.AcceptUserId != CurrentUser.Id)
+ if (jobDto.JobStatus == EnumJobStatus.Doing && jobDto.ClaimsUserId != CurrentUser.Id.ToString())
{
- return new NotFoundObjectResult($"任务正在被 {jobDto.AcceptUserName} 处理");
+ return new NotFoundObjectResult($"任务正在被 {jobDto.ClaimsUserName} 处理");
}
return jobDto;
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs
index 1401e6a5b..b6694229a 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/Class1.cs
@@ -15,7 +15,7 @@ public class ResponseJson
// 错误码:
public int Code { set; get; } = 0;
// 返回值 其具体含义由调用接口确定
- public string Value { set; get; } = "";
+ public int Value { set; get; } =0;
// 错误消息
public string Msg { set; get; } = "";
}
@@ -35,3 +35,23 @@ public class ResponCargoItem
[Display(Name = "货位状态")]
public int Flag { set; get; } = 0;
}
+public class ResponCargos : ResponseJson
+{
+ //货位状态列表
+ public List Datalist { set; get; }
+
+}
+public class ResultJson
+{
+ // 错误码:
+ public int Code { set; get; } = 0;
+ // 返回值 其具体含义由调用接口确定
+ public int Value { set; get; } = 0;
+ // 错误消息
+ public string Result { set; get; } = "";
+
+ public string Msg { set; get; } = "";
+
+ public string Valuestr { set; get; }
+}
+
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
index ea7be1738..500bc1ec7 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/ProductionLineItems/ProductionLineItemAppService.cs
@@ -126,9 +126,9 @@ public class ProductionLineItemAppService :
public virtual async Task GetByProductLineCodeAndItemCodeAsync(string productLineCode,
string itemCode)
{
- var entityList = await _repository
- .FindAsync(p => p.ProdLineCode == productLineCode && p.ItemCode == itemCode).ConfigureAwait(false);
- return ObjectMapper.Map(entityList);
+ var entity = await _repository
+ .FirstOrDefaultAsync(p => p.ProdLineCode == productLineCode && p.ItemCode == itemCode).ConfigureAwait(false);
+ return ObjectMapper.Map(entity);
}
[HttpPost("get-by-productlinecode-and-itemcode-and-erplocationcode-async")]
public virtual async Task> GetByProductLineCodeAndItemCodeAndErpLocationCodeAsync(List locationType, string erpLocationCodes,string itemCode)
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs
index e5fea514f..60ee8ab81 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/test/TestAppService.cs
@@ -40,9 +40,12 @@ public class TestService:ApplicationService
/// 生命周期操作
///
[HttpPost("GetMacStatic")]
- public async Task GetMacStatic()
+ public async Task GetMacStatic()
{
- return 1;
+
+
+
+ return new ResultJson() { Code = 200, Msg = "SUCESS", Value = 1 , Valuestr = "", Result = ""};
}
@@ -51,7 +54,7 @@ public class TestService:ApplicationService
///
/// 异步开始生命周期操作不能堵塞
///
- public async Task> GetCargoStatic(string AreaID)
+ public async Task GetCargoStatic(string AreaID)
{
List result = new List();
@@ -63,7 +66,14 @@ public class TestService:ApplicationService
result = result.Where(p => p.AreaID == AreaID).ToList();
- return result;
+
+ var t = new ResponCargos();
+ t.Code = 200;
+ t.Msg = "Success";
+ t.Datalist = result;
+
+
+ return t;
}
//[HttpPost("SyncIssueJobStereo")]
@@ -82,8 +92,18 @@ public class TestService:ApplicationService
//}
+ [HttpPost("GetCargoStatic1")]
+ ///
+ /// 异步开始生命周期操作不能堵塞
+ ///
+ public async Task GetCargoStatic1(ResponCargos p_cas)
+ {
+
+
+ return p_cas;
+ }
@@ -93,7 +113,9 @@ public class TestService:ApplicationService
- }
+
+
+}
///
/// 发给立体库主表
///
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Commons/CommonHelper.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Commons/CommonHelper.cs
index ade4d7ddb..5b709e4d7 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Commons/CommonHelper.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain.Shared/Commons/CommonHelper.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
@@ -36,5 +37,42 @@ public sealed class CommonHelper
return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}
+}
+///
+/// Expression动态拼接+泛型缓存
+///
+///
+///
+public class ExpressionGenericMapper//Mapper`2
+{
+ private static Func _FUNC = null;
+ static ExpressionGenericMapper()
+ {
+ ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p");
+ List memberBindingList = new List();
+ foreach (var item in typeof(TOut).GetProperties())
+ {
+ MemberExpression property = Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name));
+ MemberBinding memberBinding = Expression.Bind(item, property);
+ memberBindingList.Add(memberBinding);
+ }
+ foreach (var item in typeof(TOut).GetFields())
+ {
+ MemberExpression property = Expression.Field(parameterExpression, typeof(TIn).GetField(item.Name));
+ MemberBinding memberBinding = Expression.Bind(item, property);
+ memberBindingList.Add(memberBinding);
+ }
+ MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray());
+ Expression> lambda = Expression.Lambda>(memberInitExpression, new ParameterExpression[]
+ {
+ parameterExpression
+ });
+ _FUNC = lambda.Compile();//拼装是一次性的
+ }
+ public static TOut Trans(TIn t)
+ {
+ return _FUNC(t);
+ }
}
+
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ItemGuideBooks/ItemGuideBook.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ItemGuideBooks/ItemGuideBook.cs
index ea057f90c..68bf9624e 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ItemGuideBooks/ItemGuideBook.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/ItemGuideBooks/ItemGuideBook.cs
@@ -13,19 +13,16 @@ public class ItemGuideBook : SfsBaseDataAggregateRootBase
///
/// 物品名称
///
- [IgnoreUpdate]
public string Name { get; set; }
///
/// 物品描述1
///
- [IgnoreUpdate]
public string Desc1 { get; set; }
///
/// 物品描述2
///
- [IgnoreUpdate]
public string Desc2 { get; set; }
///
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs
index bd72af6e8..e47c930ec 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/SplitPackings/SplitPackingRecManager.cs
@@ -25,9 +25,9 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
public async Task BatchInsertAsync(List input)
{
+ #region 校验
foreach (SplitPackingRec item in input)
{
- #region 校验
if (item.OprType == OprTypeEnum.SplitBox || item.OprType == OprTypeEnum.MergeBox) //拆箱或合箱
{
if (item.FromPackingCode == item.ToPackingCode)
@@ -42,18 +42,26 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
throw new UserFriendlyException("操作类型不是拆箱或合箱状态,源箱码和目标箱码必须相同!");
}
}
- #endregion
}
-
+ #endregion
+ //缓存数据
var query = await _repository.GetQueryableAsync().ConfigureAwait(false);
+ var fromPackCodeLst = input.Select(itm => itm.FromPackingCode).ToList();
+ var toPackCodeLst = input.Select(itm => itm.ToPackingCode).ToList();
+ var historyLst = await query.Where(itm => fromPackCodeLst.Contains(itm.ToPackingCode) && (itm.OprType == OprTypeEnum.SplitBox || itm.OprType == OprTypeEnum.MergeBox)).ToListAsync().ConfigureAwait(false); //取顶级箱码时用到
+ var hisLst2 = await query.Where(itm => fromPackCodeLst.Contains(itm.FromPackingCode)).ToListAsync().ConfigureAwait(false);
+ Dictionary hisLst3 = await query.Where(itm => toPackCodeLst.Contains(itm.FromPackingCode) && itm.OprType == OprTypeEnum.Other).ToDictionaryAsync(itm => itm.FromPackingCode, it2 => it2).ConfigureAwait(false);
+
+ //遍历、批量插入
+ List operLst = new List();
foreach (SplitPackingRec item in input)
{
if (item.OprType == OprTypeEnum.SplitBox || item.OprType == OprTypeEnum.MergeBox)
{
//设置顶级箱码
- item.FromTopPackingCode = CalcuTopPackingCode(query, item.FromPackingCode);
- item.ToTopPackingCode = CalcuTopPackingCode(query, item.FromPackingCode); //ToPackingCode
+ item.FromTopPackingCode = CalcuTopPackingCode(input, historyLst, item);
+ item.ToTopPackingCode = CalcuTopPackingCode(input, historyLst, item);
if (item.FromTopPackingCode.IsNullOrEmpty())
{
item.FromTopPackingCode = item.FromPackingCode;
@@ -63,14 +71,12 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
item.ToTopPackingCode = item.FromTopPackingCode;
}
//设置六个单据号
- SetBillNumber(query, item);
+ SetBillNumber(hisLst2, item);
//拆箱时,如果目标箱不存在,插入目标箱(两个箱码相同)
- string toPackCode = item.ToPackingCode;
- var toHis = await query.Where(itm => itm.FromPackingCode == toPackCode && itm.ToPackingCode == toPackCode).OrderBy(itm => itm.CreationTime).FirstOrDefaultAsync().ConfigureAwait(false);
- if (toHis == null)
+ if (hisLst3.ContainsKey(item.ToPackingCode) == false)
{
-
- SplitPackingRec newObj = CommonHelper.CloneObj(item);
+ //SplitPackingRec newObj = CommonHelper.CloneObj(item);
+ SplitPackingRec newObj = ExpressionGenericMapper.Trans(item);
newObj.SetId(GuidGenerator.Create());
newObj.OprType = OprTypeEnum.Other;
newObj.FromPackingCode = newObj.ToPackingCode; //克隆赋值
@@ -79,11 +85,20 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
newObj.FromUom = newObj.ToUom;
newObj.FromQty = newObj.ToQty;
newObj.FromLot = newObj.ToLot;
- var res = await _repository.InsertAsync(newObj, false).ConfigureAwait(false);
+ //var res = await _repository.InsertAsync(newObj, false).ConfigureAwait(false);
+ operLst.Add(newObj);
}
- SplitPackingRec newEntity = CommonHelper.CloneObj(item);
+ //var toHis = await query.Where(itm => itm.FromPackingCode == toPackCode && itm.ToPackingCode == toPackCode).OrderBy(itm => itm.CreationTime).FirstOrDefaultAsync().ConfigureAwait(false);
+ //if (toHis == null)
+ //{
+ //}
+ //SplitPackingRec newEntity = CommonHelper.CloneObj(item);
+ SplitPackingRec newEntity = ExpressionGenericMapper.Trans(item);
+
newEntity.SetId(GuidGenerator.Create());
- var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false);
+ // var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false);
+ operLst.Add(newEntity);
+
}
else
{
@@ -95,11 +110,14 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
{
item.ToTopPackingCode = item.FromPackingCode;// ToPackingCode;
}
- SplitPackingRec newEntity = CommonHelper.CloneObj(item);
+ //SplitPackingRec newEntity = CommonHelper.CloneObj(item);
+ SplitPackingRec newEntity = ExpressionGenericMapper.Trans(item);
newEntity.SetId(GuidGenerator.Create());
- var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false);
+ //var ret = await _repository.InsertAsync(newEntity, false).ConfigureAwait(false);
+ operLst.Add(newEntity);
}
} //foreach
+ await _repository.InsertManyAsync(operLst).ConfigureAwait(false);
return true;
}
@@ -203,48 +221,71 @@ public class SplitPackingRecManager : DomainService, ISplitPackingRecManager
}
///
- /// 取顶级箱码
+ /// 取顶级箱码:
///
- /// 箱码历史
- /// 箱码,from to时都传入from
+ /// 本次操作要插入的拆箱记录列表,位于内存中
+ /// 数据库中的历史数据:拆箱或合箱、to箱码=内存中的from箱码
+ /// 内存中当前记录
///
- private static string CalcuTopPackingCode(IQueryable historyQuery, string packingCode)
+ private static string CalcuTopPackingCode(List memoryInput, List historyLst, SplitPackingRec curRecord)
{
- var qry = historyQuery.Where(itm => itm.OprType == OprTypeEnum.SplitBox || itm.OprType == OprTypeEnum.MergeBox);
- string ret = null;
- SplitPackingRec? firstObj = null;
- string toCode = packingCode;
+ //根据当前记录在内存列表中递归取得最上级拆箱记录:1-2 2-3 3-4 根据3-4能取到1-2
+ SplitPackingRec priorMemoryRecord = curRecord;
while (1 == 1)
{
- firstObj = qry.FirstOrDefault(itm => itm.ToPackingCode == toCode);
- if (firstObj == null)
+ var obj = memoryInput.FirstOrDefault(itm => itm.ToPackingCode == priorMemoryRecord.FromPackingCode);
+ if (obj != null)
{
- ret = toCode;
- break;
+ priorMemoryRecord = obj;
}
else
{
- toCode = firstObj.FromPackingCode;
+ break;
}
}
- return ret;
- //var historyRec = historyQuery.Where(itm => itm.FromPackingCode == packingCode).OrderBy(itm => itm.CreationTime).FirstOrDefault();
- //if (historyRec != null)
- //{
- // return historyRec.FromTopPackingCode;
- //}
- //else
+ /*
+ 算法:根据当前记录的from箱码在数据库中取上级拆箱记录,并返回顶级箱码
+ 前提:只查找拆箱、合箱记录
+ 1-1
+ 2-2
+ 1-2 查询to箱码=1的(没有,顶级箱码=from箱码)
+ 3-3
+ 2-3 查询 to箱码=2的(找到1-2记录,取顶级箱码字段)
+ 4-4
+ 3-4 查询to箱码=3的(找到2-3记录,取顶级箱码字段)
+ 5-5
+ 3-5 查询to箱码=3的(找到2-3记录,取顶级箱码字段)
+ */
+ var hisObj = historyLst.FirstOrDefault(itm => itm.ToPackingCode == priorMemoryRecord.FromPackingCode);
+ if (hisObj != null)
+ {
+ return hisObj.FromTopPackingCode;
+ }
+ else
+ {
+ return priorMemoryRecord.FromPackingCode;
+ }
+ //var qry = historyLst.Where(itm => itm.OprType == OprTypeEnum.SplitBox || itm.OprType == OprTypeEnum.MergeBox);
+ //string ret = null;
+ //SplitPackingRec? firstObj = null;
+ //string toCode = priorRecord.FromPackingCode;
+ //while (1 == 1)
//{
- // historyRec = historyQuery.Where(itm => itm.ToPackingCode == packingCode).OrderBy(itm => itm.CreationTime).FirstOrDefault();
- // if (historyRec != null)
+ // firstObj = qry.FirstOrDefault(itm => itm.ToPackingCode == toCode);
+ // if (firstObj == null)
+ // {
+ // ret = toCode;
+ // break;
+ // }
+ // else
// {
- // return historyRec.ToTopPackingCode;
+ // toCode = firstObj.FromPackingCode;
// }
//}
- //return null;
+ //return ret;
}
- private static void SetBillNumber(IQueryable historyQuery, SplitPackingRec obj)
+ private static void SetBillNumber(List historyQuery, SplitPackingRec obj)
{
var historyRec = historyQuery.Where(itm => itm.FromPackingCode == obj.FromPackingCode).OrderBy(itm => itm.CreationTime).FirstOrDefault();
if (historyRec != null)
diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType.cs
index 6518de328..f16e5e746 100644
--- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType.cs
+++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Domain.Shared/Enums/Store/EnumIssueRequestType.cs
@@ -41,8 +41,8 @@ public enum EnumIssueRequestType
ExcelImport=5,
///
- /// 注塑计划
+ /// 涂装上线计划
///
- [Display(Name = "EXCEL导入")]
+ [Display(Name = "涂装上线计划")]
InjectionPlan = 6,
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs
index d28b17034..0f474b9c2 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/ScrapNoteEventHandler.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using DocumentFormat.OpenXml.Vml.Spreadsheet;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
@@ -40,31 +41,32 @@ public class ScrapNoteEventHandler
private async Task AddTransactionsAsync(List scrapNotes)
{
+ var isScrapLocation = await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false); //如果WMS管理报废库,生成报废库存转移(从HOLD库先转移到线边)
var holdLocation = await LocationAclService.GetFirstByTypeAsync(EnumLocationType.HOLD).ConfigureAwait(false); //隔离库位
var transferLogs = new List();
- var transactions = new List();
- //如果WMS管理报废库,生成报废库存转移(从HOLD库先转移到线边)
- if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false))
+ var transactions = new List();//更新库存的事务
+ var emptyTransactions = new List();//不更新库存的事务
+ foreach (var scrapNote in scrapNotes)
{
- foreach (var scrapNote in scrapNotes)
+ if (isScrapLocation && scrapNote.Worker == "MES")//管理隔离库并且是mes接口来的从隔离库直接报废(但是要先移到线边)
+ {
+ transferLogs.AddRange(BuildTransferLogs(scrapNote, holdLocation));
+ emptyTransactions.AddRange(BuildTransactions(scrapNote));
+ }
+ else
{
-
- if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableScrapLocation).ConfigureAwait(false))
- {
- transferLogs.AddRange(BuildTransferLogs(scrapNote, holdLocation));
- }
transactions.AddRange(BuildTransactions(scrapNote));
}
+
+ }
+ if (transferLogs.Count > 0)
+ {
//报废是库存世界变动是隔离库数量-1,但是增加了一个移库日志从Hold到线边,库存事务是三个,Hold库-1(移库),线边+1(移库),线边-1(报废)
- await TransferLogAppService.AddManyWithTransferAsync(transferLogs, transactions).ConfigureAwait(false);
- await TransactionAppService.AddManyEmptyAsync(transactions).ConfigureAwait(false);
+ await TransferLogAppService.AddManyWithTransferAsync(transferLogs, emptyTransactions).ConfigureAwait(false);
+ await TransactionAppService.AddManyEmptyAsync(emptyTransactions).ConfigureAwait(false);
}
- else
+ if (transactions.Count > 0)
{
- foreach (var scrapNote in scrapNotes)
- {
- transactions.AddRange(BuildTransactions(scrapNote));
- }
await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false);
}
}
@@ -72,7 +74,7 @@ public class ScrapNoteEventHandler
private List BuildTransferLogs(ScrapNote scrapNote, LocationDTO holdLocation)
{
var transferLogs = new List();
-
+
foreach (var detail in scrapNote.Details.Where(detail => detail.Qty != 0))
{
var transferLog = ObjectMapper.Map(detail);