From 612b2285b823072809d811d456787432a3234fc3 Mon Sep 17 00:00:00 2001
From: zyf <1071160500@qq.com>
Date: 星期五, 21 十一月 2025 15:04:19 +0800
Subject: [PATCH] 首检巡检功能优化

---
 MESApplication/Controllers/QC/XJController.cs |  124 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 118 insertions(+), 6 deletions(-)

diff --git a/MESApplication/Controllers/QC/XJController.cs b/MESApplication/Controllers/QC/XJController.cs
index 3e39f48..591a3e9 100644
--- a/MESApplication/Controllers/QC/XJController.cs
+++ b/MESApplication/Controllers/QC/XJController.cs
@@ -60,13 +60,14 @@
 
     //getLine
     [HttpPost("getLineAll")]
-    public ResponseResult getLineAll()
+    public ResponseResult getLineAll([FromBody] JObject data)
     {
         try
         {
+            string UserNo = data["userNo"]?.ToString();
             dynamic resultInfos = new ExpandoObject();
             var tbBillList =
-                new XJService().getLineAll();
+                new XJService().getLineAll(UserNo);
             resultInfos.tbBillList = tbBillList;
             return new ResponseResult
             {
@@ -88,13 +89,13 @@
     [HttpPost("getDaa001")]
     public ResponseResult getDaa001([FromBody] JObject data)
     {
-        var daa020 = data["daa020"].ToString();
-        var item = data["item"].ToString();
+        //var daa020 = data["daa020"].ToString();
+        //var item = data["item"].ToString();
         try
         {
             dynamic resultInfos = new ExpandoObject();
             var tbBillList =
-                new XJService().getDaa001(daa020, item);
+                new XJService().getDaa001(data);
             resultInfos.tbBillList = tbBillList;
             return new ResponseResult
             {
@@ -165,11 +166,12 @@
     public ResponseResult setJYItem([FromBody] JObject data)
     {
         var itemNo = data["itemNo"].ToString();
+        var planName = data["planName"].ToString();
         try
         {
             dynamic resultInfos = new ExpandoObject();
             var tbBillList =
-                new XJService().setJYItem(itemNo);
+                new XJService().setJYItem(itemNo, planName);
             resultInfos.tbBillList = tbBillList;
             return new ResponseResult
             {
@@ -194,6 +196,30 @@
             var tbBillList =
                 new XJService().save(xjDto);
             resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    [HttpPost("SavePlan")]
+    public ResponseResult SavePlan([FromBody] JObject data)
+    {
+        decimal pid = Convert.ToDecimal(data["pid"]);
+        string planName = data["planName"].ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var XJ = new XJService();
+            decimal res = XJ.SavePlan(pid, planName);
+            resultInfos.res = res;
             return new ResponseResult
             {
                 status = 0,
@@ -487,4 +513,90 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+    /// <summary>
+    /// 鑾峰彇琛屼笉鑹師鍥�
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("GetReason")]
+    public ResponseResult GetReason([FromBody] JObject data)
+    {
+        string billNo = data["billNo"].ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new XJService();
+            var reasons = tbBillList.GetReason(billNo);
+            resultInfos.tbBillList = reasons;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = reasons
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+    
+
+    [HttpPost("CreateNew")]
+    public ResponseResult CreateNew([FromBody] JObject data)
+    {
+        var daaNo = data["daaNo"]?.ToString();
+        var userNo = data["statusUser"]?.ToString();
+        var planName = data["planName"]?.ToString();
+
+        try
+        {
+            var service = new XJService();
+            var (res, msg, billNo) = service.CreateNew(daaNo, userNo, planName);
+
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.res = res;
+            resultInfos.msg = msg;
+            resultInfos.billNo = billNo;// 杩斿洖鍒板墠绔�
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    [HttpPost("GetItemProj")]
+    public ResponseResult GetItemProj([FromBody] JObject data)
+    {
+        var itemNo = data["itemNo"]?.ToString();
+
+        try
+        {
+            var service = new XJService();
+            var qaPlans = service.GetItemProj(itemNo);
+
+            dynamic resultInfos = new ExpandoObject();
+            resultInfos.qaPlans = qaPlans;  // 杩斿洖鍒板墠绔�
+
+            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