From 2a18e22c236bc786db2e49fa222c080190a5f417 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 19 十一月 2024 15:19:10 +0800
Subject: [PATCH] 11

---
 entity/MessageCenter.cs                          |    2 
 Dto/service/Material.cs                          |   14 +++---
 Controllers/base/MessageCenterController.cs      |   19 ++++++++-
 service/Warehouse/MesInvItemInCDetailsManager.cs |   44 +++++++++++-----------
 4 files changed, 47 insertions(+), 32 deletions(-)

diff --git a/Controllers/base/MessageCenterController.cs b/Controllers/base/MessageCenterController.cs
index 8ee7542..90e8eb8 100644
--- a/Controllers/base/MessageCenterController.cs
+++ b/Controllers/base/MessageCenterController.cs
@@ -81,13 +81,28 @@
     [HttpPost("GetByPid")]
     public ResponseResult ResetUpdate([FromBody] JObject data)
     {
-        var pid = Convert.ToDecimal(data["pid"].ToString());
+        var pid =  data["pid"].ToString();
         try
         {
             dynamic resultInfos = new ExpandoObject();
+            
+            var parsedGuid = Guid.Empty;
+            if (string.IsNullOrEmpty(pid))
+            {
+                return new ResponseResult
+                {
+                    status = 0,
+                    message = "OK",
+                    data = resultInfos
+                };
+            }
+
+            bool isValid = Guid.TryParse(pid, out parsedGuid);
+            if (!isValid)
+                throw new ApplicationException("GUID杞崲閿欒");
 
             var messageCenter = m.GetById(pid);
-            var messageCenters = m.GetList(it => it.Pid == pid);
+            var messageCenters = m.GetList(it => it.Pid == parsedGuid);
             messageCenters.Add(messageCenter);
             resultInfos.tbBillList = messageCenters;
             return new ResponseResult
diff --git a/Dto/service/Material.cs b/Dto/service/Material.cs
index a6624e0..28f198b 100644
--- a/Dto/service/Material.cs
+++ b/Dto/service/Material.cs
@@ -6,15 +6,15 @@
     public string? FUintId { get; set; }
     public decimal? FActReceiveQty { get; set; }
     public string? FStockId { get; set; }
+
     public DateTime? FPreDeliveryDate { get; set; }
-    public Guid? F_MES_ENTRYID { get; set; }
-    public int? FSRCENTRYID { get; set; }
-    public Guid? FSRCENTRYGuid { get; set; }
+    public string? FsrcEntryId { get; set; }
 
     public string? FLot { get; set; }
 
-    public string? FMATERIALID { get; set; }
-    public string? FRMREALQTY { get; set; }
-    public string? FSTOCKID { get; set; }
-    public string? FUINT { get; set; }
+    public string? FRealQty { get; set; }
+
+    public string? FUnitID { get; set; }
+
+    public string? FMesEntryid { get; set; }
 }
\ No newline at end of file
diff --git a/entity/MessageCenter.cs b/entity/MessageCenter.cs
index aed92ec..3c4d239 100644
--- a/entity/MessageCenter.cs
+++ b/entity/MessageCenter.cs
@@ -87,7 +87,7 @@
         ///  
         ///</summary>
         [SugarColumn(ColumnName = "pid")]
-        public int? Pid { get; set; }
+        public Guid? Pid { get; set; }
 
         /// <summary>
         ///  
diff --git a/service/Warehouse/MesInvItemInCDetailsManager.cs b/service/Warehouse/MesInvItemInCDetailsManager.cs
index 108ba74..38c9d9a 100644
--- a/service/Warehouse/MesInvItemInCDetailsManager.cs
+++ b/service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -886,8 +886,12 @@
         }
 
         var ErpUrl = AppsettingsUtility.Settings.ProductionErpUrl;
+
+        var newGuid = Guid.NewGuid();
         var message = new MessageCenter
         {
+            Guid = newGuid,
+            //Pid = newGuid,
             TableName = tableName,
             Url = ErpUrl,
             Status = 1,
@@ -911,11 +915,10 @@
         var message = MesToErpParam(query);
 
         var executeReturnIdentity =
-            Db.Insertable(message).ExecuteReturnIdentity();
+            Db.Insertable(message).ExecuteCommand();
         if (executeReturnIdentity > 0)
         {
-            // message.Guid = executeReturnIdentity;
-            message.Pid = executeReturnIdentity;
+            message.Pid = message.Guid;
             return message;
         }
 
@@ -959,24 +962,20 @@
             MesInvItemArnDetail>(
             (g, c, d, a) => new JoinQueryInfos(
                 JoinType.Left,
-                g.ItemNo == c.ItemNo && g.Company == c.Company &&
-                g.Factory == c.Factory, JoinType.Inner,
+                g.ItemId == c.Id , JoinType.Inner,
                 d.Id == Convert.ToDecimal(c.ItemUnit),
-                JoinType.Inner,
-                a.Ebeln == g.WorkNo && a.WorkLine == g.EbelnLineNo
-                                    && g.CbillNo == a.CbillNo
+                JoinType.Inner, a.Ebeln == g.WorkNo && g.CbillNo == a.CbillNo
             )
         ).Where((g, c, d, a) => g.BillNo == billNo).Select<Material>(
             (g, c, d, a) => new Material
             {
-                // FstockId = g.DepotCode,
-                // FuintId = d.Fnumber,
-                // FsrcEntryId = a.Id,
-                // FmesEntryId = g.Id,
-                // FmaterialId = a.ItemNo,
-                // DepotSectionCode = g.DepotSectionCode,
-                // WorkNo = g.WorkNo,
-                // Frealqty = g.Quantity
+                FMaterialId = c.ItemNo,
+                FRealQty = g.Quantity.ToString(),
+                FStockId = g.DepotCode,
+                FLot = a.CbillNo,
+                FUnitID = d.Fnumber,
+                FsrcEntryId = a.Guid.ToString(),
+                FMesEntryid = g.Guid.ToString()
             }).ToList();
 
 
@@ -986,12 +985,13 @@
 
         var jsonEntries = materials.Select(d => new
         {
-            // FMaterialId = d.FmaterialId,
-            // FUintId = d.FuintId,
-            // FRealQty = d.Frealqty,
-            // FStockId = d.FstockId,
-            // FSRCENTRYID = d.FsrcEntryId.ToString(),
-            // F_MES_ENTRYID = d.FmesEntryId.ToString()
+            FMaterialId = d.FMaterialId,
+            FRealQty = d.FRealQty,
+            FStockId = d.FStockId,
+            FLot = d.FLot,
+            FUnitID = d.FUnitID,
+            FsrcEntryId = d.FsrcEntryId,
+            FMesEntryid = d.FMesEntryid
         }).ToList();
 
         var fdate = DateTime.Now.ToString("yyyy-MM-dd");

--
Gitblit v1.9.3