From 09afa6099b919a3a33cf4e1796dc5f6e66b4993b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 21 二月 2025 01:27:38 +0800 Subject: [PATCH] 雅达-新增打印标签和接收报告相关类和接口 --- Tiger.IBusiness.WMS/Transaction/IPrintSemiProdLabel.cs | 23 +++ Tiger.Api/Language.db | 0 Tiger.Model.Net/Tiger.Model.Net.csproj | 2 Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs | 138 +++++++++++++++++++++++ Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDoc.cs | 92 +++++++++++++++ Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDocLine.cs | 97 ++++++++++++++++ Tiger.Business.WMS/Transaction/In_SemiProd.cs | 2 Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs | 5 8 files changed, 358 insertions(+), 1 deletions(-) diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db index afc0c85..fae6579 100644 --- a/Tiger.Api/Language.db +++ b/Tiger.Api/Language.db Binary files differ diff --git a/Tiger.Business.WMS/Transaction/In_SemiProd.cs b/Tiger.Business.WMS/Transaction/In_SemiProd.cs index 88742fa..df193a0 100644 --- a/Tiger.Business.WMS/Transaction/In_SemiProd.cs +++ b/Tiger.Business.WMS/Transaction/In_SemiProd.cs @@ -257,7 +257,7 @@ if (!RcvRptInput.ErpProdInBths.Any(q => q.IS_HANDLED == "N")) { action.IsSuccessed = false; - action.LocaleMsg = Biz.L($"娌℃湁瑕佸叆搴撶殑浜у搧鏁版嵁锛岃鎵弿鍖呰瀹屾垚鐨勭浜岀淮鐮侀噸鏂扮敓鎴愬叆搴撳崟鎹紒"); + action.LocaleMsg = Biz.L($"娌℃湁瑕佸叆搴撶殑浜у搧鏁版嵁锛岃鎵弿宸ュ崟閲嶆柊鐢熸垚鍏ュ簱鍗曟嵁锛�"); return action; } if (RcvRptInput.RcvRptDocBases.IsNullOrEmpty() || RcvRptInput.RcvRptDocBases.Count == 0) diff --git a/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs b/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs new file mode 100644 index 0000000..ff8fd30 --- /dev/null +++ b/Tiger.Business.WMS/Transaction/PrintSemiProdLabel.cs @@ -0,0 +1,138 @@ +锘縰sing Rhea.Common; +using Microsoft.AspNetCore.Http; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tiger.Model; +using Apache.NMS; +using System.Drawing.Drawing2D; +using Tiger.Model.Sharetronic.Shelf; +using Tiger.IBusiness; +using Tiger.Model.MES.Yada; +using Apache.NMS.ActiveMQ.Commands; +using System.Diagnostics; + +namespace Tiger.Business.WMS.Transaction +{ + /// <summary> + /// 鍗婃垚鍝佹墦鍗版爣绛句簨鍔� + /// </summary> + public class PrintSemiProdLabel : WMSTransactionBase, IPrintSemiProdLabel + { + public IPrintSemiProdLabel Init(string id, string userCode, string apiHost, string orgCode) + { + TransID = id; + UserCode = userCode; + ApiHost = apiHost; + OrgCode = orgCode; + Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]"); + return this; + } + + #region Propertys & Variables + public string UserCode { get; set; } + public long UserId { get; set; } + public string OrgCode { get; set; } + public List<V_WMS_ITEM> Vitem { get; set; } = new(); + + #endregion + + #region Functions + /// <summary> + /// 鎵弿鍏ュ彛 + /// </summary> + public async Task<ApiAction<ScanOutput>> Scan(BaseInput input) + { + var action = new ApiAction<ScanOutput>(new ScanOutput()); + try + { + if (input.SN.IsNullOrEmpty()) + { + action.IsSuccessed = false; + action.LocaleMsg = Biz.L("WMS.PrintSemiProdLabel.ScanItem.SnEmptyFailure"); + return SetOutPutMqttMsg(action, input.Locale); + } + var DocLines = Biz.DataSource["YadaU9C"].Client.Ado.SqlQuery<mes_RcvRptDocLine>($"select * from mes_RcvRptDocLine where DocNo = '{input.SN}'"); + + var temps = new List<TemplateInput>(); + foreach (var item in DocLines) + { + var temp = new TemplateInput + { + custCode="", + itemCode= item.ItemCode, + itemDesc= item.ItemDescription, + sapItemCode= "", + WoBatch = item.LotCode, + batchQty= item.PackQty, + qrCode="", + }; + temps.Add(temp); + } + + //var y = Biz.Db.Storageable(DocLines, UserCode) + // .WhereColumns(t => new { t.ItemCode, t.LotCode }) + // .ToStorage(); + //y.AsInsertable.ExecuteCommand(); + //y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); + + action.Data.Data = temps; + action.LocaleMsg = Biz.L("WMS.PrintSemiProdLabel.Scan.ScanSuccessed"); + } + catch (Exception ex) + { + //action.CatchExceptionWithLog(ex, $"鎵弿[{input.SN}]寮傚父"); + action.CatchExceptionWithLog(ex, Biz.L("WMS.RePrint.Scan.ScanException", input.SN)); + } + return SetOutPutMqttMsg(action, input.Locale); + } + + public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input) + { + var action = new ApiAction<ScanOutput>(new ScanOutput()); + try + { + List<WMS_ITEM> items = new List<WMS_ITEM>(); + List<WMS_ITEM_HIS> itemhiss = new List<WMS_ITEM_HIS>(); + List<WMS_ITEM_PKG> itemPkgs = new List<WMS_ITEM_PKG>(); + List<WMS_ITEM_EXT> itemExts = new List<WMS_ITEM_EXT>(); + var rePrints = (input.Data ?? "").JsonToObject<PrintSemiProdLabelEntity>() ?? new PrintSemiProdLabelEntity(); + if (!rePrints.SnList.Any() || rePrints.SnList.Any(q => q.Qty <= 0)) + { + action.IsSuccessed = false; + //action.LocaleMsg = Biz.L("鏁伴噺涓嶈兘灏忎簬绛変簬闆讹紝璇烽噸鏂扮‘璁ゆ潯鐮乕{0}]鐨勬暟閲�"); + action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ReComfirmQty", input.SN); + return action; + } + else + { + + action.Data.Data = rePrints; + action.LocaleMsg = Biz.L("鍗婃垚鍝佹墦鍗版爣绛炬垚鍔�"); + } + } + catch (Exception ex) + { + action.CatchExceptionWithLog(ex, Biz.L("鍗婃垚鍝佹墦鍗版爣绛惧け璐�")); + } + return action; + } + + #endregion + + public override bool Close(bool needSaveHistoryLog = false) + { + needSaveHistoryLog = true; + //淇濆瓨鎿嶄綔鏃ュ織 + + this.IsFinished = true; + return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished; + } + + }//endClass +} diff --git a/Tiger.IBusiness.WMS/Transaction/IPrintSemiProdLabel.cs b/Tiger.IBusiness.WMS/Transaction/IPrintSemiProdLabel.cs new file mode 100644 index 0000000..3e37c12 --- /dev/null +++ b/Tiger.IBusiness.WMS/Transaction/IPrintSemiProdLabel.cs @@ -0,0 +1,23 @@ +锘縰sing Rhea.Common; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Policy; +using System.Text; +using System.Threading.Tasks; +using Tiger.Model; +using Tiger.Model.Sharetronic.Shelf; + +namespace Tiger.IBusiness +{ + public interface IPrintSemiProdLabel : IWMSTransaction + { + public IPrintSemiProdLabel Init(string id, string userCode, string apiHost, string orgCode); + public Task<ApiAction<ScanOutput>> Scan(BaseInput input); + public Task<ApiAction<ScanOutput>> ScanItem(BaseInput input); + + + public bool Close(bool needSaveHistoryLog = false); + } +} diff --git a/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDoc.cs b/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDoc.cs new file mode 100644 index 0000000..4f019d8 --- /dev/null +++ b/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDoc.cs @@ -0,0 +1,92 @@ +using System; +using SqlSugar; +using System.Linq; +using System.ComponentModel; +using System.Collections.Generic; +using Tiger.Model; + +namespace Tiger.Model.MES.Yada +{ + /// <summary> + /// 实体:mes_RcvRptDoc + /// </summary> + [Serializable] + [SugarTable("mes_RcvRptDoc")] + public class mes_RcvRptDoc : iViewEntity + { + #region 构造函数 + /// <summary> + /// 实体:mes_RcvRptDoc + /// </summary> + public mes_RcvRptDoc() {} + #endregion + + #region 公共属性 + /// <summary> + /// + /// </summary> + public long ID { get; set; } + /// <summary> + /// + /// </summary> + public string Org { get; set; } + /// <summary> + /// + /// </summary> + public string Remark { get; set; } + /// <summary> + /// + /// </summary> + public string DocNo { get; set; } + /// <summary> + /// + /// </summary> + public DateTime DocDate { get; set; } + /// <summary> + /// + /// </summary> + public int DocState { get; set; } + + /// <summary> + /// + /// </summary> + public string CreatedBy { get; set; } + /// <summary> + /// + /// </summary> + public DateTime CreatedOn { get; set; } + /// <summary> + /// + /// </summary> + public string ModifiedBy { get; set; } + /// <summary> + /// + /// </summary> + public DateTime ModifiedOn { get; set; } + #endregion + + #region 虚拟属性 + /*例子 + [SugarColumn(IsIgnore = true)] + public string FieldName { get; set; } + */ + #endregion + + #region 枚举变量 + /*例子 + public enum FieldNames + { + [Description("枚举描述0")] + Enum0, + [Description("枚举描述1")] + Enum1, + } + */ + #endregion + + #region 公共方法 + + #endregion + + }//endClass +} \ No newline at end of file diff --git a/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDocLine.cs b/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDocLine.cs new file mode 100644 index 0000000..b01e5f4 --- /dev/null +++ b/Tiger.Model.Net/Entitys/MES/YadaU9/mes_RcvRptDocLine.cs @@ -0,0 +1,97 @@ +using System; +using SqlSugar; +using System.Linq; +using System.ComponentModel; +using System.Collections.Generic; +using Tiger.Model; + +namespace Tiger.Model.MES.Yada +{ + /// <summary> + /// 实体:mes_RcvRptDocLineLine + /// </summary> + [Serializable] + [SugarTable("mes_RcvRptDocLine")] + public class mes_RcvRptDocLine : iViewEntity + { + #region 构造函数 + /// <summary> + /// 实体:mes_RcvRptDocLine + /// </summary> + public mes_RcvRptDocLine() {} + #endregion + + #region 公共属性 + /// <summary> + /// + /// </summary> + public long ID { get; set; } + /// <summary> + /// + /// </summary> + public string RcvRptDoc { get; set; } + /// <summary> + /// + /// </summary> + public string DocNo { get; set; } + /// <summary> + /// + /// </summary> + public string Mo { get; set; } + /// <summary> + /// + /// </summary> + public string ItemCode { get; set; } + /// <summary> + /// + /// </summary> + public string ItemName { get; set; } + + /// <summary> + /// + /// </summary> + public string ItemDescription { get; set; } + /// <summary> + /// + /// </summary> + public int PackQty { get; set; } + /// <summary> + /// + /// </summary> + public string RcvQtyByWhUOM { get; set; } + /// <summary> + /// 工单号 + /// </summary> + public string LotCode { get; set; } + + /// <summary> + /// + /// </summary> + public string StoreUOM { get; set; } + #endregion + + #region 虚拟属性 + /*例子 + [SugarColumn(IsIgnore = true)] + public string FieldName { get; set; } + */ + #endregion + + #region 枚举变量 + /*例子 + public enum FieldNames + { + [Description("枚举描述0")] + Enum0, + [Description("枚举描述1")] + Enum1, + } + */ + #endregion + + #region 公共方法 + + #endregion + + }//endClass +} \ No newline at end of file diff --git a/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs b/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs index 162a5cb..17fa3c4 100644 --- a/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs +++ b/Tiger.Model.Net/Entitys/WMS/Api/Input_Entitys.cs @@ -74,6 +74,11 @@ public List<RePrintLabelEntity> SnList { get; set; }=new List<RePrintLabelEntity>(); } + public class PrintSemiProdLabelEntity: RePrintLabelBase + { + + } + public class RePrintLabelEntity { public string ID { get; set; } diff --git a/Tiger.Model.Net/Tiger.Model.Net.csproj b/Tiger.Model.Net/Tiger.Model.Net.csproj index 43f63ba..ea8fad6 100644 --- a/Tiger.Model.Net/Tiger.Model.Net.csproj +++ b/Tiger.Model.Net/Tiger.Model.Net.csproj @@ -89,6 +89,8 @@ <Compile Include="Entitys\MES\YadaU9\mes_Bin.cs" /> <Compile Include="Entitys\MES\YadaU9\mes_MaterialBarCode.cs" /> <Compile Include="Entitys\MES\YadaU9\mes_MaterialBarCodeByBin.cs" /> + <Compile Include="Entitys\MES\YadaU9\mes_RcvRptDocLine.cs" /> + <Compile Include="Entitys\MES\YadaU9\mes_RcvRptDoc.cs" /> <Compile Include="Entitys\MES\YadaU9\mes_Wh.cs" /> <Compile Include="Entitys\MES\YadaU9\mes_WhLotCodeQtyInfo.cs" /> <Compile Include="Entitys\MQTTEntity.cs" /> -- Gitblit v1.9.3