From 1caf2d9d3f6c2ee8d58d182078d0a8468f6dbfc4 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期六, 24 八月 2024 19:14:31 +0800
Subject: [PATCH] 物料接收

---
 MESApplication/bin/Debug/net8.0/MESApplication.pdb                      |    0 
 MESApplication/Controllers/Warehouse/MesInvItemOutCDetailsController.cs |   82 ++++++++++++++++
 MESApplication/bin/Debug/net8.0/MESApplication.exe                      |    0 
 MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs           |  138 +++++++++++++++++++++++++++
 MESApplication/bin/Debug/net8.0/MES.Service.pdb                         |    0 
 MESApplication/bin/Debug/net8.0/MESApplication.dll                      |    0 
 MES.Service/Dto/service/MaterialReceipt.cs                              |   15 +++
 MES.Service/bin/Debug/net8.0/MES.Service.dll                            |    0 
 MESApplication/bin/Debug/net8.0/MESApplication.xml                      |   20 ++++
 MESApplication/bin/Debug/net8.0/MES.Service.dll                         |    0 
 MES.Service/bin/Debug/net8.0/MES.Service.pdb                            |    0 
 11 files changed, 254 insertions(+), 1 deletions(-)

diff --git a/MES.Service/Dto/service/MaterialReceipt.cs b/MES.Service/Dto/service/MaterialReceipt.cs
new file mode 100644
index 0000000..680ada2
--- /dev/null
+++ b/MES.Service/Dto/service/MaterialReceipt.cs
@@ -0,0 +1,15 @@
+锘縰sing MES.Service.Modes;
+
+namespace MES.Service.Dto.service;
+
+public class MaterialReceipt
+{
+  
+
+  
+    public List<MesInvItemOutCDetails>? InvItemoutCDetails { get; set; }
+
+    public MesInvItemOuts? ItemOuts { get; set; }
+
+
+}
\ No newline at end of file
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.dll b/MES.Service/bin/Debug/net8.0/MES.Service.dll
index 63a7a02..30d58f8 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.dll
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MES.Service/bin/Debug/net8.0/MES.Service.pdb b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
index d9ad629..cce69d3 100644
--- a/MES.Service/bin/Debug/net8.0/MES.Service.pdb
+++ b/MES.Service/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs b/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
index 4d40c63..8015c77 100644
--- a/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
+++ b/MES.Service/service/Warehouse/MesInvItemOutCDetailsManager.cs
@@ -1,4 +1,5 @@
 锘縰sing MES.Service.DB;
+using MES.Service.Dto.service;
 using MES.Service.Modes;
 using SqlSugar;
 
@@ -38,7 +39,8 @@
         conModels.Add(new ConditionalModel
         {
             FieldName = typeof(MesInvItemOutCDetails).GetProperties()[0].Name,
-            ConditionalType = ConditionalType.Equal, FieldValue = "1"
+            ConditionalType = ConditionalType.Equal,
+            FieldValue = "1"
         }); //id=1
         var data7 = base.GetPageList(conModels, p, it => SqlFunc.GetRandom());
 
@@ -75,4 +77,138 @@
     }
 
     #endregion
+
+
+    public MesInvItemOutCDetails GetOutList(WarehouseQuery query)
+    {
+
+
+
+        var mesInvItemBarcodes = Db.Queryable<MesInvItemBarcodes>()
+            .Where(s => s.ItemBarcode == query.barcode).Count();
+
+        if (mesInvItemBarcodes <= 0)
+        {
+            throw new Exception("鏉$爜涓嶅瓨鍦�");
+        }
+
+        var mesInvItemOutCDetails = Db.Queryable<MesInvItemOutCDetails>()
+            .Where(s => s.ItemBarcode == query.barcode && s.Receive == 0).Count();
+
+
+
+        if (mesInvItemOutCDetails <= 0)
+        {
+            throw new Exception("鏉$爜涓嶇鍚堟帴鏀舵潯浠�,璇锋鏌ワ紒");
+        }
+
+
+
+        var entity = Db.Queryable<MesInvItemOutCDetails, MesInvItemOuts, MesItems>((a, b, c) =>
+                  new JoinQueryInfos(JoinType.Left, a.ItemOutId == b.Id,
+                                    JoinType.Left, a.ItemNo == c.ItemNo))
+              .Where((a, b, c) => a.ItemBarcode == query.barcode)
+              .Select((a, b, c) => new MesInvItemOutCDetails
+              {
+                  PbillNo = b.ItemOutNo,
+                  WorkNo = a.WorkNo,
+                  ItemNo = a.ItemNo,
+                  ItemName = c.ItemName,
+                  Quantity = a.Quantity
+              }).First();
+
+        if (entity == null)
+        {
+            throw new Exception("鍑哄簱鏉$爜" + query.barcode + " 涓嶅瓨鍦紝璇风‘璁�!");
+        }
+
+
+        return entity;
+    }
+
+
+    public MaterialReceipt GetFormList(WarehouseQuery query)
+    {
+        var mesInvItemBarcodes = Db.Queryable<MesInvItemBarcodes>()
+            .Where(s => s.ItemBarcode == query.barcode).Count();
+
+        if (mesInvItemBarcodes <= 0)
+        {
+            throw new Exception("鏉$爜涓嶅瓨鍦�");
+        }
+
+        var mesInvItemOutCDetails = Db.Queryable<MesInvItemOutCDetails>()
+            .Where(s => s.ItemBarcode == query.barcode).First();
+
+        MaterialReceipt entity = new MaterialReceipt
+        {
+            InvItemoutCDetails = GetMesInvItemOutCDetails(mesInvItemOutCDetails.PbillNo),
+            ItemOuts = GetMesInvItemOuts(mesInvItemOutCDetails.PbillNo)
+
+        };
+
+        return entity;
+    }
+
+
+    public MesInvItemOutCDetails confirmReceipt(WarehouseQuery query)
+    {
+        if (string.IsNullOrWhiteSpace(query.barcode))
+        {
+            throw new Exception("璇锋壂鍑哄簱鏉$爜锛�");
+        }
+
+        if (string.IsNullOrWhiteSpace(query.billNo))
+        {
+            throw new Exception("鍑哄簱鍗曟嵁涓嶈兘涓虹┖锛�");
+        }
+
+
+
+
+        var barcodeInfo = GetBarcodeInfo(query.barcode);
+
+
+        if (barcodeInfo.Receive == 1)
+        {
+            throw new Exception("姝ゆ潯鐮佸凡缁忔帴鏀�,璇锋鏌ワ紒");
+        }
+
+
+        UseTransaction(db =>
+        {
+
+            var count = db.Updateable<MesInvItemOutCDetails>()
+             .SetColumns(s => s.Receive == 1)
+             .Where(s => s.ItemBarcode == barcodeInfo.ItemBarcode).ExecuteCommand();
+
+            return 1;
+        });
+
+        return barcodeInfo;
+    }
+
+
+
+    public List<MesInvItemOutCDetails> GetMesInvItemOutCDetails(string billno)
+    {
+        return Db.Queryable<MesInvItemOutCDetails>()
+            .Where(s => s.PbillNo == billno).ToList();
+    }
+
+    public MesInvItemOuts GetMesInvItemOuts(string billno)
+    {
+        return Db.Queryable<MesInvItemOuts>()
+            .Where(a => a.ItemOutNo == billno).Single();
+    }
+
+
+
+    private MesInvItemOutCDetails GetBarcodeInfo(string itemBarcode)
+    {
+        // Get barcode information
+        return Db.Queryable<MesInvItemOutCDetails>()
+            .First(b => b.ItemBarcode == itemBarcode);
+    }
+
 }
\ No newline at end of file
diff --git a/MESApplication/Controllers/Warehouse/MesInvItemOutCDetailsController.cs b/MESApplication/Controllers/Warehouse/MesInvItemOutCDetailsController.cs
index 91c79f4..29aa814 100644
--- a/MESApplication/Controllers/Warehouse/MesInvItemOutCDetailsController.cs
+++ b/MESApplication/Controllers/Warehouse/MesInvItemOutCDetailsController.cs
@@ -1,4 +1,5 @@
 锘縰sing System.Dynamic;
+using MES.Service.Dto.service;
 using MES.Service.Modes;
 using MES.Service.service.Warehouse;
 using MES.Service.util;
@@ -12,6 +13,87 @@
 {
     private readonly MesInvItemOutCDetailsManager m = new();
 
+    /// <summary>
+    /// 鑾峰彇鐗╂枡鎺ユ敹淇℃伅
+    /// </summary>
+    /// <returns></returns>
+    [HttpPost("GetOutItemList")]
+
+    public ResponseResult GetOutItemList(WarehouseQuery query)
+    {
+
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.GetOutList(query);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+
+
+
+    }
+
+    /// <summary>
+    /// 鑾峰彇鏄庣粏鑿滃崟
+    /// </summary>
+    /// <param name="query"></param>
+    /// <returns></returns>
+
+    [HttpPost("GetFormList")]
+    public ResponseResult GetFormList(WarehouseQuery query)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.GetFormList(query);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 纭鎺ユ敹
+    /// </summary>
+    /// <param name="query"></param>
+    /// <returns></returns>
+    [HttpPost("ConfirmReceipt")]
+    public ResponseResult ConfirmReceipt(WarehouseQuery query)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.tbBillList = m.confirmReceipt(query);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
 
     /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/
 
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.dll b/MESApplication/bin/Debug/net8.0/MES.Service.dll
index 63a7a02..30d58f8 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.dll
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MES.Service.pdb b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
index d9ad629..cce69d3 100644
--- a/MESApplication/bin/Debug/net8.0/MES.Service.pdb
+++ b/MESApplication/bin/Debug/net8.0/MES.Service.pdb
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.dll b/MESApplication/bin/Debug/net8.0/MESApplication.dll
index 03e3c54..9845fbb 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.dll
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.dll
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.exe b/MESApplication/bin/Debug/net8.0/MESApplication.exe
index 4067afb..31bd773 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.exe
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.exe
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.pdb b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
index 0159b86..ce4d9f1 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.pdb
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.pdb
Binary files differ
diff --git a/MESApplication/bin/Debug/net8.0/MESApplication.xml b/MESApplication/bin/Debug/net8.0/MESApplication.xml
index f07d581..63b3c28 100644
--- a/MESApplication/bin/Debug/net8.0/MESApplication.xml
+++ b/MESApplication/bin/Debug/net8.0/MESApplication.xml
@@ -1049,6 +1049,26 @@
             </summary>
             <returns></returns>
         </member>
+        <member name="M:MESApplication.Controllers.Warehouse.MesInvItemOutCDetailsController.GetOutItemList(MES.Service.Dto.service.WarehouseQuery)">
+            <summary>
+            鑾峰彇鐗╂枡鎺ユ敹淇℃伅
+            </summary>
+            <returns></returns>
+        </member>
+        <member name="M:MESApplication.Controllers.Warehouse.MesInvItemOutCDetailsController.GetFormList(MES.Service.Dto.service.WarehouseQuery)">
+            <summary>
+            鑾峰彇鏄庣粏鑿滃崟
+            </summary>
+            <param name="query"></param>
+            <returns></returns>
+        </member>
+        <member name="M:MESApplication.Controllers.Warehouse.MesInvItemOutCDetailsController.ConfirmReceipt(MES.Service.Dto.service.WarehouseQuery)">
+            <summary>
+            纭鎺ユ敹
+            </summary>
+            <param name="query"></param>
+            <returns></returns>
+        </member>
         <member name="M:MESApplication.Controllers.Warehouse.MesInvItemOutCDetailsController.GetList">
             <summary>
                 鑾峰彇鎵�鏈�

--
Gitblit v1.9.3