From e9ef6afe836784d7fbd3e3ca6ad813e86866a6a8 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 25 十二月 2024 17:52:27 +0800
Subject: [PATCH] 生成补料和生成超领

---
 Controllers/Wom/MesWorkProdController.cs |  146 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 102 insertions(+), 44 deletions(-)

diff --git a/Controllers/Wom/MesWorkProdController.cs b/Controllers/Wom/MesWorkProdController.cs
index 0c571b7..d10af04 100644
--- a/Controllers/Wom/MesWorkProdController.cs
+++ b/Controllers/Wom/MesWorkProdController.cs
@@ -1,31 +1,34 @@
 锘縰sing System.Dynamic;
 using Microsoft.AspNetCore.Mvc;
+using NewPdaSqlServer.Dto.service;
 using NewPdaSqlServer.entity;
 using NewPdaSqlServer.service.Wom;
 using NewPdaSqlServer.util;
 
 namespace NewPdaSqlServer.Controllers.Wom;
 
-[ApiController]
+/// <summary>
+/// 鐢熶骇鎶ュ伐鐩稿叧鎺ュ彛
+/// </summary>
 [Route("api/[controller]")]
+[ApiController]
 public class MesWorkProdController : ControllerBase
 {
-    private readonly MesWorkProdManager m = new();
+    private readonly MesWorkProdManager _manager = new();
 
-
-    /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/
+    #region 鍩虹CRUD
 
     /// <summary>
-    ///     鑾峰彇鎵�鏈�
+    /// 鑾峰彇鎵�鏈�
     /// </summary>
-    /// <returns></returns>
+    /// <returns>鎶ュ伐鍗曞垪琛�</returns>
     [HttpPost("GetList")]
     public ResponseResult GetList()
     {
         try
         {
             dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.GetList();
+            resultInfos.tbBillList = _manager.GetList();
             return new ResponseResult
             {
                 status = 0,
@@ -39,18 +42,17 @@
         }
     }
 
-
     /// <summary>
-    ///     鏍规嵁涓婚敭鑾峰彇
+    /// 鏍规嵁涓婚敭鑾峰彇
     /// </summary>
-    /// <returns></returns>
+    /// <returns>鎶ュ伐鍗曚俊鎭�</returns>
     [HttpPost("GetById")]
     public ResponseResult GetById(int id)
     {
         try
         {
             dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.GetById(id);
+            resultInfos.tbBillList = _manager.GetById(id);
             return new ResponseResult
             {
                 status = 0,
@@ -65,16 +67,16 @@
     }
 
     /// <summary>
-    ///     鏍规嵁涓婚敭鍒犻櫎
+    /// 鏍规嵁涓婚敭鍒犻櫎
     /// </summary>
-    /// <returns></returns>
+    /// <returns>鍒犻櫎缁撴灉</returns>
     [HttpPost("DeleteByIds")]
     public ResponseResult DeleteByIds([FromBody] object[] ids)
     {
         try
         {
             dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.DeleteByIds(ids);
+            resultInfos.tbBillList = _manager.DeleteByIds(ids);
             return new ResponseResult
             {
                 status = 0,
@@ -89,16 +91,16 @@
     }
 
     /// <summary>
-    ///     娣诲姞
+    /// 娣诲姞
     /// </summary>
-    /// <returns></returns>
+    /// <returns>娣诲姞缁撴灉</returns>
     [HttpPost("Insert")]
     public ResponseResult Add([FromBody] MesWorkProd data)
     {
         try
         {
             dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.Insert(data);
+            resultInfos.tbBillList = _manager.Insert(data);
             return new ResponseResult
             {
                 status = 0,
@@ -113,40 +115,16 @@
     }
 
     /// <summary>
-    ///     娣诲姞杩斿洖鑷
+    /// 淇敼
     /// </summary>
-    /// <returns></returns>
-    [HttpPost("InsertReturnIdentity")]
-    public ResponseResult InsertReturnIdentity([FromBody] MesWorkProd data)
-    {
-        try
-        {
-            dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.InsertReturnIdentity(data);
-            return new ResponseResult
-            {
-                status = 0,
-                message = "OK",
-                data = resultInfos
-            };
-        }
-        catch (Exception ex)
-        {
-            return ResponseResult.ResponseError(ex);
-        }
-    }
-
-    /// <summary>
-    ///     淇敼
-    /// </summary>
-    /// <returns></returns>
+    /// <returns>淇敼缁撴灉</returns>
     [HttpPost("Update")]
     public ResponseResult Update([FromBody] MesWorkProd data)
     {
         try
         {
             dynamic resultInfos = new ExpandoObject();
-            resultInfos.tbBillList = m.Update(data);
+            resultInfos.tbBillList = _manager.Update(data);
             return new ResponseResult
             {
                 status = 0,
@@ -159,4 +137,84 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+    #endregion
+
+    #region 鐢熶骇鎶ュ伐
+
+    /// <summary>
+    /// PDA鎵弿鐢熶骇鎶ュ伐
+    /// </summary>
+    /// <param name="request">鎶ュ伐璇锋眰鍙傛暟</param>
+    /// <returns>鎶ュ伐缁撴灉</returns>
+    /// <remarks>
+    /// 璇锋眰绀轰緥:
+    /// 
+    ///     POST /api/MesWorkProd/ScanWork
+    ///     {
+    ///         "staffNo": "ST001",
+    ///         "itemBarcode": "BC001",
+    ///         "userNo": "admin"
+    ///     }
+    /// </remarks>
+    /// <response code="200">鎵弿鎴愬姛</response>
+    /// <response code="400">鎵弿澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
+    [HttpPost("ScanWork")]
+    public ResponseResult ScanWork([FromBody] ScanWorkRequest request)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.result = _manager.ScanWorkAsync(request);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// PDA鎵弿鐢熶骇鎶ュ伐(甯︽暟閲�)
+    /// </summary>
+    /// <param name="request">鎶ュ伐璇锋眰鍙傛暟</param>
+    /// <returns>鎶ュ伐缁撴灉</returns>
+    /// <remarks>
+    /// 璇锋眰绀轰緥:
+    /// 
+    ///     POST /api/MesWorkProd/ScanWorkProd
+    ///     {
+    ///         "itemBarcode": "BC001",
+    ///         "quantity": 10,
+    ///         "userNo": "admin"
+    ///     }
+    /// </remarks>
+    /// <response code="200">鎵弿鎴愬姛</response>
+    /// <response code="400">鎵弿澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
+    [HttpPost("ScanWorkProd")]
+    public ResponseResult ScanWorkProd([FromBody] ScanWorkRequest request)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.success = _manager.ScanWorkProdAsync(request);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    #endregion
 }
\ No newline at end of file

--
Gitblit v1.9.3