From 5fa361102a4ffb184c311034f08fa2f21ce6e34e Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期一, 10 十一月 2025 21:43:48 +0800
Subject: [PATCH] 首检代码提交

---
 StandardPda/MESApplication/Controllers/QC/SJController.cs |  217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 216 insertions(+), 1 deletions(-)

diff --git a/StandardPda/MESApplication/Controllers/QC/SJController.cs b/StandardPda/MESApplication/Controllers/QC/SJController.cs
index d970890..9ca90c1 100644
--- a/StandardPda/MESApplication/Controllers/QC/SJController.cs
+++ b/StandardPda/MESApplication/Controllers/QC/SJController.cs
@@ -1,10 +1,14 @@
-锘縰sing System.Dynamic;
+锘縰sing MES.Service.DB;
 using MES.Service.Dto.service;
 using MES.Service.Modes;
 using MES.Service.service.QC;
 using MES.Service.util;
 using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
+using System.Collections.Generic;
+using System.Data;
+using System.Dynamic;
 
 namespace MESApplication.Controllers.QC;
 
@@ -326,6 +330,35 @@
     {
         try
         {
+            OracleSQLHelper SQLHelper = new();
+            var sql1 =
+                string.Format(
+                    @"select SCAN_ITEM from ZMZ_TEST.MES_SJ_SCAN_ITEM_CK where mid='" + rkjDto.gid + "' and sn_no is null");
+            var dataTable1 = SQLHelper.ExecuteQuery(sql1);
+            string msg = "";
+            for (var i = 0; i < dataTable1.Rows.Count; i++)
+            {
+                msg = msg + "銆�"+dataTable1.Rows[i]["SCAN_ITEM"].ToString()+"銆�";
+            }
+            if (msg != null && msg != "")
+            {
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = msg+"鏈繘琛孲N鎵爜纭!",
+                    data = ""
+                };
+            }
+            var msg1 = new SJService().YzxImgVerify(rkjDto.gid.ToString());
+            if (msg1[0]=="1")
+            {
+                return new ResponseResult
+                {
+                    status = int.Parse(msg1[0]),
+                    message = msg1[1],
+                    data = ""
+                };
+            }
             dynamic resultInfos = new ExpandoObject();
             var tbBillList =
                 new SJService().SJQaSubmit(rkjDto);
@@ -342,4 +375,186 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+    /// <summary>
+    ///     鑾峰彇涓�鑷存�ф牳瀵归」鐩�
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("getYzxItem")]
+    public ResponseResult getYzxItem([FromBody] JObject data)
+    {
+        var id = data["id"]?.ToString();
+        try
+        {
+            var tbBillList = new SJService().getYzxBDlist(id);
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = tbBillList
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     淇濆瓨涓�鑷存�ф牳瀵归」鐩�
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("saveYzxItem")]
+    public ResponseResult saveYzxItem([FromBody] JObject data)
+    {
+        var id = data["id"]?.ToString();
+        var dataDt = data["data"]?.ToString();
+        var dt = JsonConvert.DeserializeObject<DataTable>(dataDt);
+        try
+        {
+            if (!dt.Columns.Contains("id"))
+            {
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = "璇峰厛閫夋嫨鏁版嵁鍐嶄繚瀛橈紒",
+                    data = "璇峰厛閫夋嫨鏁版嵁鍐嶄繚瀛橈紒"
+                };
+            }
+            new SJService().saveYzxBDlist(id, dt);
+            var msg = new SJService().YzxImgVerify(id);
+
+            return new ResponseResult
+            {
+                status = int.Parse(msg[0]),
+                message = msg[1],
+                data = ""
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+    /// <summary>
+    /// 鎵爜椤圭洰鑾峰彇
+    /// </summary>
+    /// <param name="mid"></param>
+    /// <returns></returns>
+    [HttpPost("GetList")]
+    public ResponseResult GetList([FromBody] JObject data)
+    {
+        var mid = data["mid"];
+        var db = SqlSugarHelper.GetInstance();
+        var list = db.Queryable<MES_SJ_SCAN_ITEM_CK>()
+            .Where(x => x.MID == (long)mid)
+            .Select(x => new {
+                id = x.ID,
+                scanItem = x.SCAN_ITEM,
+                snNo = x.SN_NO
+            })
+            .ToList();
+
+        return new ResponseResult
+        {
+            status = int.Parse("0"),
+            message = "0",
+            data = list
+        };
+     
+    }
+    /// <summary>
+    /// 鎵爜椤圭洰淇濆瓨
+    /// </summary>
+    /// <param name="dto"></param>
+    /// <returns></returns>
+    [HttpPost("SaveSn")]
+    public ResponseResult SaveSn([FromBody] ScanItemSaveDto dto)
+    {
+        var db = SqlSugarHelper.GetInstance();
+        foreach (var item in dto.Items)
+        {
+            db.Updateable<MES_SJ_SCAN_ITEM_CK>()
+                .SetColumns(x => x.SN_NO == item.SnNo)
+                .Where(x => x.ID == item.Id)
+                .ExecuteCommand();
+        }
+        return new ResponseResult
+        {
+            status = int.Parse("0"),
+            message = "ok",
+            data = ""
+        };
+      
+    }
+
+    public class ScanItemSaveDto
+    {
+        public decimal Mid { get; set; }
+        public List<ScanItemDto> Items { get; set; }
+    }
+
+    public class ScanItemDto
+    {
+        public decimal Id { get; set; }
+        public string SnNo { get; set; }
+    }
+
+    /// <summary>
+    ///     鑾峰彇鎵�鏈夋楠屽憳淇℃伅
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("getAllInspectors")]
+    public ResponseResult getAllInspectors([FromBody] JObject data)
+    {
+        try
+        {
+            var tbBillList = new SJService().getAllInspectors();
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = tbBillList
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+
+
+    [HttpPost("SaveCheckBy")]
+    public ResponseResult SaveCheckBy([FromBody] JObject data)
+    {
+        try
+        {
+            var NewStaffName = data["NewStaffName"].ToString();
+            var userID = data["userID"].ToString();
+            var releaseNo = data["releaseNo"].ToString();
+            var NewStaffUserID = data["NewStaffUserID"].ToString();
+
+            var msg =
+                new SJService().SaveCheckBy(NewStaffUserID, userID, releaseNo);
+
+
+            return new ResponseResult
+            {
+                status = int.Parse(msg[0]),
+                message = msg[1],
+                data = msg[1]
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3