From 6521b98cc87540dc2618e333ed87f8cef1e991e9 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 15:54:51 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WmsOutStockService.cs | 2 +- .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 95856a78..3b3fa05a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -133,7 +133,7 @@ namespace Tnb.WarehouseMgr List carryIds = new(); var mapKeys = new List { "tablefield120", "details" }; //tablefield120 出库物料明细 - if (input.data.Keys.Where(k => mapKeys.Contains(k)).Any()) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull() + if (input.data.Keys.Any(k => mapKeys.Contains(k))) //input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull() { List outStockDList = new(); if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index a340f849..35225662 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -62,23 +62,28 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - + WmsInstockH? instock = null; var purchaseDs = await PurchaseAndSaleUpdate(input); + List instockDs = new(); if (purchaseDs?.Count > 0) { - var instock = input.Adapt(); + instock = input.Adapt(); instock.id = SnowflakeIdHelper.NextId(); instock.create_id = _userManager.UserId; instock.create_time = DateTime.Now; instock.org_id = _userManager.User.OrganizeId; await _db.Insertable(instock).ExecuteCommandAsync(); - var instockD = purchaseDs.Adapt(); - instockD.create_id = _userManager.UserId; - instockD.create_time = DateTime.Now; - instockD.org_id = _userManager.User.OrganizeId; - await _db.Insertable(instockD).ExecuteCommandAsync(); + instockDs = purchaseDs.Adapt>(); + instockDs.ForEach(instockD => + { + instockD.create_id = _userManager.UserId; + instockD.create_time = DateTime.Now; + instockD.org_id = _userManager.User.OrganizeId; + }); + await _db.Insertable(instockDs).ExecuteCommandAsync(); } + //通知Mes接口 await _db.Ado.CommitTranAsync(); } From 189b31f4a6957782d924ee957cbd924399e53982 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Wed, 8 Nov 2023 15:54:52 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 122 ++++++++++-------- QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs | 22 ++++ QcMgr/Tnb.QcMgr/QcCheckPlanService.cs | 99 ++++++++++++++ 3 files changed, 190 insertions(+), 53 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 12879acb..c1278d4b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -25,62 +25,74 @@ namespace Tnb.ProductionMgr //获取注塑装箱状态 private void GetZSPackStatus(object state) { - string[] strs = new string[1] { "TY4C-ZHUSU1" }; - string sign = "agvMode"; - foreach (string s in strs) + try { - Dictionary dic = _redisData.HGetAll(s).Result; - foreach (KeyValuePair kv in dic) + string[] strs = new string[1] { "TY4C-ZHUSU1" }; + string sign = "agvMode"; + foreach (string s in strs) { - if (!kv.Key.Contains(sign)) + Dictionary dic = _redisData.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { - continue; - } - - JObject? res = JsonConvert.DeserializeObject(kv.Value); - if (res != null && res["Value"] != null) - { - if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求)) + if (!kv.Key.Contains(sign)) { - InstockInput instockInput = new() + continue; + } + JObject? res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求)) { - equip_code = res["TagName"]!.ToString() - }; - _ = _prdInstockService.InstockTypeOne(instockInput); + InstockInput instockInput = new() + { + equip_code = res["DevName"]!.ToString(), + label_code = res["TagName"]!.ToString() + }; + _prdInstockService.InstockTypeOne(instockInput); + } } } } } + catch (Exception) + { + } } //获取挤出装箱状态 private void GetJCPackStatus(object state) { - string[] strs = new string[1] { "TY4C-SHUSONG-JC" }; - string sign = "AGVFullCall"; - foreach (string s in strs) + try { - Dictionary dic = _redisData.HGetAll(s).Result; - foreach (KeyValuePair kv in dic) + string[] strs = new string[1] { "TY4C-SHUSONG-JC" }; + string sign = "AGVFullCall"; + foreach (string s in strs) { - if (!kv.Key.Contains(sign)) + Dictionary dic = _redisData.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { - continue; - } - - JObject? res = JsonConvert.DeserializeObject(kv.Value); - if (res != null && res["Value"] != null) - { - if (res.Value("Value")) + if (!kv.Key.Contains(sign)) { - InstockInput instockInput = new() + continue; + } + JObject? res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (res.Value("Value")) { - equip_code = res["TagName"]!.ToString() - }; - _ = _prdInstockService.InstockTypeOne(instockInput); + InstockInput instockInput = new() + { + equip_code = res["DevName"]!.ToString(), + label_code = res["TagName"]!.ToString() + }; + _prdInstockService.InstockTypeOne(instockInput); + } } } } } + catch (Exception) + { + } } //获取限位状态 private void GetLimitStatus(object state) @@ -90,29 +102,33 @@ namespace Tnb.ProductionMgr Console.WriteLine($"获取挤出装箱状态"); string data = _redisData.GetHash("TY4C-SHUSONG-JC", "AGVFullCall").Result; Console.WriteLine(data);*/ - /* - string[] strs = new string[1] { "TY4C-WAIBAO" }; - string sign = "AGVCall"; - foreach (string s in strs) + try { - Dictionary dic = _redisData.HGetAll(s).Result; - foreach (KeyValuePair kv in dic) + string[] strs = new string[1] { "TY4C-WAIBAO" }; + string sign = "AGVCall"; + foreach (string s in strs) { - if (!kv.Key.Contains(sign)) + Dictionary dic = _redisData.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { - continue; - } - - JObject? res = JsonConvert.DeserializeObject(kv.Value); - if (res != null && res["Value"] != null) - { - if (res.Value("Value")) + if (!kv.Key.Contains(sign)) { - // + continue; + } + JObject? res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (res.Value("Value")) + { + // + } } } } - }*/ + } + catch (Exception) + { + } } public void Dispose() { @@ -122,9 +138,9 @@ namespace Tnb.ProductionMgr } public Task StartAsync(CancellationToken cancellationToken) { - // ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); - // JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); - // limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); + ZSpacktimer = new Timer(GetZSPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); + JCpacktimer = new Timer(GetJCPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); + limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs index ff4126df..1ac31664 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs @@ -45,4 +45,26 @@ namespace Tnb.QcMgr.Entities /// public int? pronum { get; set; } } + + + public class CreateTaskEntity + { + /// + /// 物料方案编号 + /// + public List materialids { get; set; } + /// + /// 触发条件 + /// + public EnumTriggerEvent? triggerevent { get; set; } + + public string maintableid { get; set; } + } + public class TaskEntity + { + public List materialids { get; set; } + public QcCheckPlanH qcCheckPlanH { get; set; } + public string maintableid { get; set; } + + } } diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs index 9fafc113..df243bda 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs @@ -286,6 +286,105 @@ namespace Tnb.QcMgr } } + + [HttpPost] + public async Task CreateWmsTask(CreateTaskEntity entity) + { + ISugarQueryable Query = _repository.AsSugarClient().Queryable + ((a, b) => new object[] { + JoinType.Inner,a.id== b.mainid, + }); + GetQuery(Query, entity); + List list = await Query.ToListAsync(); + List taskEntities = new List(); + foreach (QcCheckPlanH data in list) + { + if (entity.materialids.Count>0) + { + if (_repository.AsSugarClient().Queryable().Where(p => p.planid == data.id).Any()) + { + var Materials= _repository.AsSugarClient().Queryable().Where(p => p.planid == data.id).Select(p=>p.materialid).ToList(); + var Intersect = entity.materialids.Intersect(Materials).ToList(); + if (Intersect.Count > 0) + { + taskEntities.Add(new TaskEntity { maintableid=entity.maintableid, materialids = Intersect!, qcCheckPlanH = data }); + } + } + } + } + if (taskEntities.Count > 0) + { + await SaveTask(taskEntities); + } + } + + private void GetQuery(ISugarQueryable Query, CreateTaskEntity entity) + { + List DictionaryData = _repository.AsSugarClient().Queryable + ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, }) + .Where((a, b) => b.FullName == "质检类型选择").ToList(); + QcTriggerEvent TriggerEvent = new(); + EnumTriggerEvent? enumTriggerEvent = entity.triggerevent; + RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent); + string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id; + TriggerEvent = _repository.AsSugarClient().Queryable().Where(p => p.type == type && p.name == remark.CheckContent).First(); + Query = Query.Where((a, b) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id)); + } + + private async Task SaveTask(List taskEntities) + { + DictionaryDataEntity DictionaryData = _repository.AsSugarClient().Queryable + ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, }) + .Where((a, b) => b.FullName == "质检状态" && a.FullName == "待执行").First(); + foreach (var entity in taskEntities) + { + List plands = await _repository.AsSugarClient().Queryable().Where(p =>p.mainid== entity.qcCheckPlanH.id).ToListAsync(); + + foreach (string s in entity.materialids) + { + DateTime time = DateTime.Now; + QcCheckExecH qcCheckExecH = new() + { + id = SnowflakeIdHelper.NextId(), + checktype = entity.qcCheckPlanH.checktype, + status = DictionaryData.Id, + tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"), + materialid = s, + create_id = _userManager.UserId, + create_time = time, + extras= entity.maintableid + }; + List ExecDs = new(); + foreach (var pland in plands) + { + QcCheckExecD QcCheckExecD = new() + { + mainid = qcCheckExecH.id, + extype = pland.extype, + excontent = pland.excontent, + check = pland.check, + errorcause = pland.errorcause, + errorlevel = pland.errorlevel, + remark = pland.remark, + attachment = pland.attachment, + isexec = pland.isexec, + custom = pland.custom, + typeid = pland.typeid, + itemid = pland.itemid, + create_id = _userManager.UserId, + create_time = time + }; + ExecDs.Add(QcCheckExecD); + } + _ = await _repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync(); + } + + } + } + + + /// /// 根据计划生成任务 /// From 5504703f3a6950b028688daa82a53c0b08c1a628 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Wed, 8 Nov 2023 15:58:39 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs index 1041014a..2a093936 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs @@ -32,5 +32,7 @@ namespace Tnb.QcMgr.Interfaces /// public Task CreateTask(TriggerPlanEntity entity); + public Task CreateWmsTask(CreateTaskEntity entity); + } } From 2619a011af8fe0d8099744ae14d14411bec6daa7 Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Wed, 8 Nov 2023 16:19:30 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E8=B4=A8=E6=A3=80=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QcMgr/Tnb.QcMgr/QcCheckPlanService.cs | 6 +++++- QcMgr/Tnb.QcMgr/QcCheckTaskService.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs index df243bda..283da28c 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs @@ -286,7 +286,11 @@ namespace Tnb.QcMgr } } - + /// + /// WMS出库入库检 + /// + /// + /// [HttpPost] public async Task CreateWmsTask(CreateTaskEntity entity) { diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index 34a86548..4e196ed9 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -44,7 +44,7 @@ namespace Tnb.QcMgr { { "ok", "合格" }, { "no", "不合格" }, - { "barelyok", "让步合格" }, + { "barelyOk", "让步合格" }, { "await", "待检" }, { "temporarily", "暂控" } }; From 7980e342c02a291c4f5af7b5bbaffbdba1acceb6 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:24:47 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=96=B0=E5=A2=9EMes=E6=A3=80=E9=AA=8C?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=EF=BC=8C=E5=9B=9E=E8=B0=83=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/MesCheckdCallbackUpInput.cs | 23 ++++++++++++++++++ .../InOutCheckStatusUpdateEntity.cs | 19 +++++++++++++++ .../Entity/WmsInstockH.cs | 7 +++++- .../Entity/WmsOutstockH.cs | 7 +++++- .../Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj | 1 + .../WmsPurchaseAndSaleCommonService.cs | 5 ++++ .../Tnb.WarehouseMgr/WmsPurchaseService.cs | 24 +++++++++++++++++-- .../Tnb.WarehouseMgr/WmsSaleService.cs | 12 ++++++++++ 8 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs new file mode 100644 index 00000000..c0675af0 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MesCheckdCallbackUpInput.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + /// + /// Mes检验后回传输入参数 + /// + public class MesCheckdCallbackUpinput + { + /// + /// 主表Id + /// + public string maintableid { get; set; } + /// + /// 检验结论 + /// + public int check_conclusion { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs new file mode 100644 index 00000000..c69f364c --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Entity.Constraints +{ + /// + /// 修改出入库检验状态 + /// + public interface InOutCheckStatusUpdateEntity + { + /// + /// 检验状态 + /// + public int? check_conclusion { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs index 97516e77..44e6c1c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 入库申请主表 /// [SugarTable("wms_instock_h")] -public partial class WmsInstockH : BaseEntity +public partial class WmsInstockH : BaseEntity, InOutCheckStatusUpdateEntity { public WmsInstockH() { @@ -212,4 +213,8 @@ public partial class WmsInstockH : BaseEntity /// 采购单号 /// public string purchase_code { get; set; } + /// + /// 检验结论 + /// + public int? check_conclusion { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs index 6416d598..18b25742 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using Tnb.WarehouseMgr.Entities.Entity.Constraints; namespace Tnb.WarehouseMgr.Entities; @@ -8,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// 出库申请主表 /// [SugarTable("wms_outstock_h")] -public partial class WmsOutstockH : BaseEntity +public partial class WmsOutstockH : BaseEntity, InOutCheckStatusUpdateEntity { public WmsOutstockH() { @@ -170,4 +171,8 @@ public partial class WmsOutstockH : BaseEntity /// 载具Id /// public string carry_id { get; set; } + /// + /// 检验结论 + /// + public int? check_conclusion { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj index 7d6b065d..238adaa3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj +++ b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj @@ -14,6 +14,7 @@ + diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index 7e6db845..ab4e11cd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -118,5 +118,10 @@ namespace Tnb.WarehouseMgr return await _db.Updateable().SetColumns(it => it.audit_status == (int)input.auditType).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync(); } + protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new() + { + return await _db.Updateable().SetColumns(it => it.check_conclusion == input.check_conclusion).Where(it => it.id == input.maintableid).ExecuteCommandHasChangeAsync(); + } + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index 35225662..c00e83ae 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -18,6 +18,9 @@ using NPOI.OpenXmlFormats.Dml.Diagram; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Utils; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Interfaces; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; @@ -34,11 +37,13 @@ namespace Tnb.WarehouseMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager) + private readonly IQcCheckPlanService _qcCheckPlanService; + public WmsPurchaseService(ISqlSugarRepository repo, IUserManager userManager, IQcCheckPlanService qcCheckPlanService) : base(repo, userManager) { _db = repo.AsSugarClient(); _userManager = userManager; + _qcCheckPlanService = qcCheckPlanService; } private async Task xxx(VisualDevModelDataCrInput input) @@ -84,7 +89,11 @@ namespace Tnb.WarehouseMgr await _db.Insertable(instockDs).ExecuteCommandAsync(); } //通知Mes接口 - + CreateTaskEntity ctEntity = new(); + ctEntity.maintableid = instock.id; + ctEntity.materialids = instockDs.Select(x => x.material_id).ToList(); + ctEntity.triggerevent = EnumTriggerEvent.入厂检按物料编号; + _ = _qcCheckPlanService.CreateWmsTask(ctEntity); await _db.Ado.CommitTranAsync(); } catch (Exception ex) @@ -119,5 +128,16 @@ namespace Tnb.WarehouseMgr { return await Audit(input); } + /// + /// mes 检验完后通知wms(采购) 回调接口 + /// + /// + /// + /// + [HttpPost] + public async Task MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input) + { + return await UpdateChackStatus(input); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs index 47b614c5..1605a513 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs @@ -72,5 +72,17 @@ namespace Tnb.WarehouseMgr return await Audit(input); } + /// + /// mes 检验完后通知wms(销售) 回调接口 + /// + /// + /// + /// + [HttpPost] + public async Task MesCheckdSaleCallback(MesCheckdCallbackUpinput input) + { + return await UpdateChackStatus(input); + } + } } From e808092ad818e33c47566ae62b4da188aff9bd1c Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:36:42 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=EF=BC=8C=E9=94=80=E5=94=AE=E5=8F=91=E8=B4=A7=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constraints/InOutCheckStatusUpdateEntity.cs | 4 ++++ .../IWmsPurchaseService.cs | 17 +++++++++++++++++ .../IWmsSaleService.cs | 17 +++++++++++++++++ .../WmsPurchaseAndSaleCommonService.cs | 5 ++++- WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs | 2 +- 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs index c69f364c..a6e7ca67 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs @@ -15,5 +15,9 @@ namespace Tnb.WarehouseMgr.Entities.Entity.Constraints /// 检验状态 /// public int? check_conclusion { get; set; } + /// + /// 是否检验 + /// + public int? is_check { get;} } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs new file mode 100644 index 00000000..b28063ac --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPurchaseService.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; + +namespace Tnb.WarehouseMgr.Interfaces +{ + /// + /// 采购收货 + /// + public interface IWmsPurchaseService + { + Task MesCheckdPurchaseCallback(MesCheckdCallbackUpinput input); + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs new file mode 100644 index 00000000..ad4a89fc --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSaleService.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; + +namespace Tnb.WarehouseMgr.Interfaces +{ + /// + /// 销售发货 + /// + public interface IWmsSaleService + { + Task MesCheckdSaleCallback(MesCheckdCallbackUpinput input); + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index ab4e11cd..af848234 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using JNPF.Common.Contracts; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Extension; using JNPF.FriendlyException; using SqlSugar; using Tnb.BasicData.Entities; @@ -15,6 +16,7 @@ using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity.Constraints; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -120,7 +122,8 @@ namespace Tnb.WarehouseMgr protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new() { - return await _db.Updateable().SetColumns(it => it.check_conclusion == input.check_conclusion).Where(it => it.id == input.maintableid).ExecuteCommandHasChangeAsync(); + var isOk = await _db.Updateable().SetColumns(it => it.check_conclusion == input.check_conclusion).Where(it => it.id == input.maintableid).ExecuteCommandHasChangeAsync(); + return isOk; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs index 1605a513..bfd0f88a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSaleService.cs @@ -19,7 +19,7 @@ namespace Tnb.WarehouseMgr /// /// 销售发货 /// - public class WmsSaleService : WmsPurchaseAndSaleCommonService + public class WmsSaleService : WmsPurchaseAndSaleCommonService, IWmsSaleService { private readonly IWmsOutStockService _wmsOutStockService; From 60ff5d69bb11c2d944c3afb3f1de2b870eef3e14 Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:38:50 +0800 Subject: [PATCH 07/10] +1 --- WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs index c00e83ae..70a14f5f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseService.cs @@ -33,7 +33,7 @@ namespace Tnb.WarehouseMgr /// 采购收货 /// [OverideVisualDev(ModuleConsts.MODULE_WMSPURCHASE_ID)] - public class WmsPurchaseService : WmsPurchaseAndSaleCommonService + public class WmsPurchaseService : WmsPurchaseAndSaleCommonService, IWmsPurchaseService { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; From b6129ee8077e6e66ba371282527d55cea93b6e33 Mon Sep 17 00:00:00 2001 From: hlb <894797954@qq.com> Date: Wed, 8 Nov 2023 16:41:33 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A9=BA=E8=BD=BD?= =?UTF-8?q?=E5=85=B7=E5=87=BA=E5=BA=93=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index 3f81c037..ba4fcd7d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -208,6 +208,9 @@ namespace Tnb.WarehouseMgr } } } + else { + throw new AppFriendlyException("没有匹配的空载具可以出库", 500); + } await _db.Ado.CommitTranAsync(); } From e9b33e1bd62c67db898b2df7029546675ed43dcf Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:47:58 +0800 Subject: [PATCH 09/10] +1 --- .../Constraints/InOutCheckStatusUpdateEntity.cs | 2 +- .../WmsPurchaseAndSaleCommonService.cs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs index a6e7ca67..cd5ab147 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs @@ -18,6 +18,6 @@ namespace Tnb.WarehouseMgr.Entities.Entity.Constraints /// /// 是否检验 /// - public int? is_check { get;} + public int? is_check { get; get; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs index af848234..1ced5f17 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPurchaseAndSaleCommonService.cs @@ -122,7 +122,21 @@ namespace Tnb.WarehouseMgr protected async Task UpdateChackStatus(MesCheckdCallbackUpinput input) where TEntity : BaseEntity, InOutCheckStatusUpdateEntity, new() { - var isOk = await _db.Updateable().SetColumns(it => it.check_conclusion == input.check_conclusion).Where(it => it.id == input.maintableid).ExecuteCommandHasChangeAsync(); + var stock = await _db.Queryable().SingleAsync(it => it.id == input.maintableid); + stock.check_conclusion = input.check_conclusion; + stock.is_check = 1; + var isOk = await _db.Updateable(stock).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync(); + var preTask = await _db.Queryable().FirstAsync(it => it.require_id == input.maintableid); + if (preTask != null) + { + var carry = await _db.Queryable().SingleAsync(it => it.id == preTask.carry_id); + if (carry != null) + { + carry.check_conclusion = input.check_conclusion; + carry.is_check = 1; + isOk = await _db.Updateable(carry).UpdateColumns(it => new { it.check_conclusion, it.is_check }).ExecuteCommandHasChangeAsync(); + } + } return isOk; } From 6bb3db57aa68821d7c5e172508e586012b855e1d Mon Sep 17 00:00:00 2001 From: "yang.lee" Date: Wed, 8 Nov 2023 16:48:15 +0800 Subject: [PATCH 10/10] +1 --- .../Entity/Constraints/InOutCheckStatusUpdateEntity.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs index cd5ab147..c5a3935b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/InOutCheckStatusUpdateEntity.cs @@ -18,6 +18,6 @@ namespace Tnb.WarehouseMgr.Entities.Entity.Constraints /// /// 是否检验 /// - public int? is_check { get; get; } + public int? is_check { get; set; } } }