From 82dac540156cb29e58c86f7d7d840e3c7e548c15 Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期四, 14 八月 2025 19:55:41 +0800
Subject: [PATCH] 来料检,入库检,首检巡检。

---
 StandardInterface/MESApplication/Controllers/QC/RKJController.cs |  152 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 151 insertions(+), 1 deletions(-)

diff --git a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
index 3aea949..d6e231d 100644
--- a/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
+++ b/StandardInterface/MESApplication/Controllers/QC/RKJController.cs
@@ -87,7 +87,15 @@
     public ResponseResult setJYItem([FromBody] JObject data)
     {
         var itemNo = data["itemNo"].ToString();
-        var quantity = Convert.ToDecimal(data["quantity"].ToString());
+        var quantityStr = data["quantity"]?.ToString();
+        
+        // 澶勭悊quantity涓虹┖鎴栨棤鏁堢殑鎯呭喌
+        decimal quantity = 0;
+        if (!string.IsNullOrEmpty(quantityStr) && decimal.TryParse(quantityStr, out var parsedQuantity))
+        {
+            quantity = parsedQuantity;
+        }
+        
         try
         {
             dynamic resultInfos = new ExpandoObject();
@@ -364,4 +372,146 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+    /// <summary>
+    /// 鑾峰彇鏈夌嚎浣撶殑閮ㄩ棬鍒楄〃锛堢敓浜ц溅闂达級
+    /// </summary>
+    /// <returns>閮ㄩ棬鍒楄〃</returns>
+    [HttpPost("GetDepartmentsWithLines")]
+    public ResponseResult GetDepartmentsWithLines()
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new RKJService().GetDepartmentsWithLines();
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鏍规嵁閮ㄩ棬ID鑾峰彇璇ラ儴闂ㄤ笅鐨勭嚎浣撳垪琛�
+    /// </summary>
+    /// <param name="data">鍖呭惈departmentId鐨凧SON瀵硅薄</param>
+    /// <returns>绾夸綋鍒楄〃</returns>
+    [HttpPost("GetLinesByDepartment")]
+    public ResponseResult GetLinesByDepartment([FromBody] JObject data)
+    {
+        var departmentId = data["departmentId"]?.ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new RKJService().GetLinesByDepartment(departmentId);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 淇濆瓨閮ㄩ棬閫夋嫨
+    /// </summary>
+    /// <param name="data">鍖呭惈id銆乨epartmentId銆乨epartmentName鐨凧SON瀵硅薄</param>
+    /// <returns>淇濆瓨缁撴灉</returns>
+    [HttpPost("SaveDepartmentSelection")]
+    public ResponseResult SaveDepartmentSelection([FromBody] JObject data)
+    {
+        var id = Convert.ToDecimal(data["id"]?.ToString());
+        var departmentId = data["departmentId"]?.ToString();
+        var departmentName = data["departmentName"]?.ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new RKJService().SaveDepartmentSelection(id, departmentId, departmentName);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鎻愪氦妫�楠屽崟
+    /// </summary>
+    /// <param name="data">鍖呭惈id銆乽serNo鐨凧SON瀵硅薄</param>
+    /// <returns>鎻愪氦缁撴灉</returns>
+    [HttpPost("submitInspection")]
+    public ResponseResult SubmitInspection([FromBody] JObject data)
+    {
+        var id = Convert.ToDecimal(data["id"]?.ToString());
+        var userNo = data["userNo"]?.ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new RKJService().SubmitInspection(id, userNo);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    /// 鍒锋柊妫�楠岄」鐩� - 璋冪敤瀛樺偍杩囩▼
+    /// </summary>
+    /// <param name="data">鍖呭惈id銆乶o銆乽ser鐨凧SON瀵硅薄</param>
+    /// <returns>鍒锋柊缁撴灉</returns>
+    [HttpPost("genUpdate")]
+    public ResponseResult GenUpdate([FromBody] JObject data)
+    {
+        try
+        {
+            decimal? id = data["id"]?.ToObject<decimal>();
+            string? no = data["no"]?.ToString();
+            string? user = data["user"]?.ToString();
+
+            var (result, message) = new RKJService().GenUpdate(id, no, user);
+
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.result = result;
+            resultInfos.message = message;
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3