From c2b8d20496542254930431e8e6a2954826a95910 Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期三, 26 十一月 2025 18:44:52 +0800
Subject: [PATCH] 查看所有图片、查看所有不良描述、首检提交时防呆(是否上传图片,是否检验完成等)

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

diff --git a/StandardPda/MESApplication/Controllers/QC/SJController.cs b/StandardPda/MESApplication/Controllers/QC/SJController.cs
new file mode 100644
index 0000000..33fa226
--- /dev/null
+++ b/StandardPda/MESApplication/Controllers/QC/SJController.cs
@@ -0,0 +1,673 @@
+锘匡豢using 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;
+
+[Route("api/[controller]")]
+[ApiController]
+public class SJController : ControllerBase
+{
+    [HttpPost("GetMaxBillNo")]
+    public ResponseResult GetMaxBillNo()
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().getMaxBillNo();
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    [HttpPost("GetPage")]
+    public ResponseResult GetPage([FromBody] SJPageResult queryObj)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var (item, totalCount) = new SJService().getPage(queryObj);
+            resultInfos.tbBillList = item;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos,
+                TotalCount = totalCount
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    //SetQSItems
+    [HttpPost("SetQSItems")]
+    public ResponseResult SetQSItems([FromBody] JObject data)
+    {
+        var itemNo = data["itemNo"].ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.SetQSItems(itemNo);
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    [HttpPost("Save")]
+    public ResponseResult Save([FromBody] QsItem item)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.Save(item);
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //SaveItem
+    [HttpPost("SaveItem")]
+    public ResponseResult SaveItem([FromBody] QsItem item)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.SaveItem(item);
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //getQSItems
+    [HttpPost("getQSItems")]
+    public ResponseResult getQSItems([FromBody] JObject data)
+    {
+        var pid = data["pid"]?.ToString();
+        var id = data["id"]?.ToString();
+
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.getQSItems(Convert.ToDecimal(pid),
+                Convert.ToDecimal(id));
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    [HttpPost("SetQSItemDetail")]
+    public ResponseResult SetQSItemDetail([FromBody] QsItemIpiItemDetail detail)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.SetQSItemDetail(detail);
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    [HttpPost("getQSItemDetail")]
+    public ResponseResult getQSItemDetail([FromBody] JObject data)
+    {
+        var pid = data["pid"]?.ToString();
+        var gid = data["gid"]?.ToString();
+
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.getQSItemDetail(Convert.ToDecimal(pid),
+                Convert.ToDecimal(gid));
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+
+    [HttpPost("UpdateQSItemDetail")]
+    public ResponseResult UpdateQSItemDetail(
+        [FromBody] QsItemIpiItemDetail detail)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService();
+            var detail021 = tbBillList.UpdateQSItemDetail(detail);
+            resultInfos.tbBillList = detail021;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //saveRemarksGid
+    [HttpPost("saveRemarksGid")]
+    public ResponseResult saveRemarksGid([FromBody] QsItem rkjDto)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().saveRemarksGid(rkjDto);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //saveRemarksPid
+    [HttpPost("saveRemarksPid")]
+    public ResponseResult saveRemarksPid([FromBody] QsItem rkjDto)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().saveRemarksPid(rkjDto);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //saveRemarksById
+    [HttpPost("saveRemarksById")]
+    public ResponseResult saveRemarksById([FromBody] QsItem rkjDto)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().saveRemarksById(rkjDto);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //removeSJ
+    [HttpPost("removeSJ")]
+    public ResponseResult removeSJ([FromBody] JObject data)
+    {
+        var id = data["id"]?.ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().removeXJ(Convert.ToDecimal(id));
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    //IqcQaSubmit
+    [HttpPost("SJQaSubmit")]
+    public ResponseResult SJQaSubmit(LLJDto rkjDto)
+    {
+        try
+        {
+            OracleSQLHelper SQLHelper = new();
+
+            //------------------ SN鎵爜鏍¢獙 ------------------
+            var sql1 =
+                @"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 += "銆�" + dataTable1.Rows[i]["SCAN_ITEM"].ToString() + "銆�";
+            }
+
+            if (!string.IsNullOrEmpty(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 = ""
+                };
+            }
+
+            //------------------ 涓嶅悎鏍煎浘鐗囨槸鍚︿笂浼犳牎楠� ------------------
+            var sql2 =
+                @"select A.id, A.PROJ_NAME, B.id as id2
+              from QS_ITEM_IPI_ITEM A
+              left join MES_QS_IMAGE B on 777 || A.ID = B.FID
+              where A.PID = '" + rkjDto.gid + @"' 
+                and B.id is null 
+                and IS_PASS = 0";
+
+            var dt2 = SQLHelper.ExecuteQuery(sql2);
+            if (dt2.Rows.Count > 0)
+            {
+                string err = "";
+                for (int i = 0; i < dt2.Rows.Count; i++)
+                {
+                    err += "銆�" + dt2.Rows[i]["PROJ_NAME"].ToString() + "銆�";
+                }
+
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = err + "涓嶅悎鏍煎浘鐗囨湭涓婁紶锛�",
+                    data = ""
+                };
+            }
+
+            //------------------ 蹇呭~椤瑰浘鐗囨槸鍚︿笂浼犳牎楠� ------------------
+            var sql3 =
+                @"select A.id, A.PROJ_NAME, B.id as id2
+              from QS_ITEM_IPI_ITEM A
+              left join MES_QS_IMAGE B on 777 || A.ID = B.FID
+              where A.PID = '" + rkjDto.gid + @"'
+                and B.id is null
+                and UP_FILE = 1";
+
+            var dt3 = SQLHelper.ExecuteQuery(sql3);
+            if (dt3.Rows.Count > 0)
+            {
+                string err = "";
+                for (int i = 0; i < dt3.Rows.Count; i++)
+                {
+                    err += "銆�" + dt3.Rows[i]["PROJ_NAME"].ToString() + "銆�";
+                }
+
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = err + "蹇呭~椤瑰浘鐗囨湭涓婁紶锛�",
+                    data = ""
+                };
+            }
+
+            //------------------ 鏂板鏍¢獙锛氭鏌ユ槸鍚﹀瓨鍦ㄦ湭瀹屾垚锛圛S_PASS is null锛� ------------------
+            var sqlPass =
+                @"select ID, PROJ_NAME 
+              from QS_ITEM_IPI_ITEM
+              where PID = '" + rkjDto.gid + @"'
+                and IS_PASS is null";
+
+            var dtPass = SQLHelper.ExecuteQuery(sqlPass);
+            if (dtPass.Rows.Count > 0)
+            {
+                string err = "";
+                for (int i = 0; i < dtPass.Rows.Count; i++)
+                {
+                    err += "銆�" + dtPass.Rows[i]["PROJ_NAME"].ToString() + "銆�";
+                }
+
+                return new ResponseResult
+                {
+                    status = 1,
+                    message = err + "椤圭洰鏈畬鎴愶紝涓嶅厑璁告彁浜ゆ楠岋紒",
+                    data = ""
+                };
+            }
+
+            //------------------ 涓讳笟鍔¢�昏緫锛氭彁浜� ------------------
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new SJService().SJQaSubmit(rkjDto);
+            resultInfos.tbBillList = tbBillList;
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            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);
+        }
+    }
+
+    /// <summary>
+    ///     鑾峰彇棣栨鍗曟墍鏈変笉鑹弿杩�
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("getQSBlmsItem")]
+    public ResponseResult getQSBlmsItem([FromBody] JObject data)
+    {
+        var id = data["id"]?.ToString();
+
+        try
+        {
+            var tbBillList = new SJService().getBlmsItem(id);
+
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = tbBillList
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.3