From 2923b57174c59c6b07e3ac7502c41fa60e32ae33 Mon Sep 17 00:00:00 2001
From: 如洲 陈 <1278080563@qq.com>
Date: 星期五, 09 五月 2025 17:49:20 +0800
Subject: [PATCH] 入库、首检、巡检

---
 MES.Service/Dto/service/XJDto.cs              |    1 
 MESApplication/Controllers/QC/XJController.cs |   25 ++++++++
 MES.Service/service/QC/XJService.cs           |   20 ++++++
 MESApplication/Controllers/QC/SJController.cs |   25 ++++++++
 MES.Service/service/QC/SJService.cs           |   18 +++++
 MES.Service/Modes/QsQaItemXj.cs               |    6 ++
 MES.Service/service/QC/RKJService.cs          |   79 ++++++++++++++------------
 MES.Service/Dto/service/QsItem.cs             |    2 
 8 files changed, 133 insertions(+), 43 deletions(-)

diff --git a/MES.Service/Dto/service/QsItem.cs b/MES.Service/Dto/service/QsItem.cs
index 4afa827..83f35bd 100644
--- a/MES.Service/Dto/service/QsItem.cs
+++ b/MES.Service/Dto/service/QsItem.cs
@@ -20,6 +20,8 @@
     //澶囨敞
     public string? Remarks { get; set; }
 
+    public string? Comments { get; set; }
+
     public string? StatusUser { get; set; }
 
     public SJPageResult? Result { get; set; }
diff --git a/MES.Service/Dto/service/XJDto.cs b/MES.Service/Dto/service/XJDto.cs
index f36a69b..b2b3ec0 100644
--- a/MES.Service/Dto/service/XJDto.cs
+++ b/MES.Service/Dto/service/XJDto.cs
@@ -18,6 +18,7 @@
     //澶囨敞
     public string? Remarks { get; set; }
 
+    public string? Comments { get; set; }
     //==========================================
     //宸℃涓诲瓙琛ㄩ渶瑕佺殑鏁版嵁
     public QsQaItemXj? from { get; set; }
diff --git a/MES.Service/Modes/QsQaItemXj.cs b/MES.Service/Modes/QsQaItemXj.cs
index 28c435a..9170977 100644
--- a/MES.Service/Modes/QsQaItemXj.cs
+++ b/MES.Service/Modes/QsQaItemXj.cs
@@ -119,6 +119,12 @@
     public string? Remarks { get; set; }
 
     /// <summary>
+    ///     澶囨敞
+    /// </summary>
+    [SugarColumn(ColumnName = "COMMENTS")]
+    public string? Comments { get; set; }
+
+    /// <summary>
     ///     鐗╂枡ID
     /// </summary>
     [SugarColumn(ColumnName = "ITEM_ID")]
diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs
index 4bda309..815f2a2 100644
--- a/MES.Service/service/QC/RKJService.cs
+++ b/MES.Service/service/QC/RKJService.cs
@@ -455,43 +455,48 @@
         var db = SqlSugarHelper.GetInstance();
 
         return db
-            .Queryable<QsItemOqcReq, Womdaa, MesItems, MesInvItemIns, Womdab,
-                MesInvTransaction, RKJDaa001>(
-                (a, da, b, c, d, ca, m) => new JoinQueryInfos(
-                    JoinType.Left, da.Daa001 == a.BillNo,
-                    JoinType.Left, a.ItemId == b.Id,
-                    JoinType.Left, a.BillNo == c.BillNo,
-                    JoinType.Left, c.CbillNo == d.Dab001,
-                    JoinType.Left,
-                    c.TransctionNo == ca.TransactionNo.ToString() &&
-                    c.Company == ca.Company && c.Factory == ca.Factory,
-                    JoinType.Left, c.Id == m.ItemInId && a.ItemNo == m.ItemNo
-                ))
-            .Select((a, da, b, c, d, ca, m) => new QsItemOqcReq
-            {
-                BillNo = a.BillNo,
-                Remarks = a.Remarks,
-                Id = a.Id,
-                CreateDate = a.CreateDate,
-                CreateBy = a.CreateBy,
-                FcheckResu = a.FcheckResu,
-                ItemNo = a.ItemNo,
-                FcheckBy = a.FcheckBy,
-                FcheckDate = a.FcheckDate,
-                ReleaseNo = a.ReleaseNo,
-                // 娣诲姞鍏朵粬瀛楁
-                // 濡傛灉鍦� QsItemOqcReq 涓畾涔変簡棰濆瀛楁锛屽垯闇�瑕佸皢瀹冧滑璧嬪��
-                // 渚嬪:
-                ItemName = b.ItemName,
-                ItemModel = b.ItemModel,
-                TaskNo = c.TaskNo,
-                CbillNo = c.CbillNo,
-                Dab001 = d.Dab001,
-                Daa015 = da.Daa015,
-                LineNo = c.LineNo,
-                Quantity = m.Quantity
-            }).OrderBy(a => a.CreateDate, OrderByType.Desc)
-            .ToPageList(queryObj.PageIndex, queryObj.Limit);
+            .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa, MesInvTransaction, RKJDaa001, MesLine>(
+                 (a, b, c, da, ca, m, l) => new JoinQueryInfos(
+                     JoinType.Left, a.ItemNo == b.Id.ToString(),
+                     JoinType.Left, a.BillNo == c.BillNo,
+                     JoinType.Left, da.Daa001 == c.RbillNo,
+                     JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString()
+                                   && c.Company == ca.Company
+                                   && c.Factory == ca.Factory,
+                     JoinType.Left, m.ItemInId == c.Id,
+                     JoinType.Left, l.LineNo == da.Daa015
+                 ))
+             //.WhereIF(!"PL017".Equals(queryObj.createUser),
+             //    (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015))
+             .WhereIF(!string.IsNullOrEmpty(queryObj.id), (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id)
+             .WhereIF(
+                 StringUtil.IsNotNullOrEmpty(queryObj.result) && "鏈畬鎴�".Equals(queryObj.result),
+                 (a, b, c, da, ca, m, l) => a.FcheckResu == null)
+             .WhereIF(
+                 StringUtil.IsNotNullOrEmpty(queryObj.result) && !"鏈畬鎴�".Equals(queryObj.result),
+                 (a, b, c, da, ca, m, l) => a.FcheckResu != null)
+             .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq
+             {
+                 BillNo = a.BillNo,
+                 Remarks = a.Remarks,
+                 Id = a.Id,
+                 CreateDate = a.CreateDate,
+                 CreateBy = a.CreateBy,
+                 FcheckResu = a.FcheckResu,
+                 ItemNo = b.ItemNo,
+                 FcheckBy = a.FcheckBy,
+                 FcheckDate = a.FcheckDate,
+                 ReleaseNo = a.ReleaseNo,
+                 ItemName = b.ItemName,
+                 ItemModel = b.ItemModel,
+                 TaskNo = c.RbillNo,
+                 //CbillNo = c.CbillNo,  
+                 //LineNo = da.Daa015,
+                 LineNo = l.LineName,
+                 Quantity = m.Quantity
+             })
+             .OrderBy(a => a.CreateDate, OrderByType.Desc)
+             .ToPageList(queryObj.PageIndex, queryObj.Limit);
     }
 
     //鍒犻櫎涓昏〃骞朵笖杩炵骇鍒犻櫎瀛愯〃鍜屽瓩琛�
diff --git a/MES.Service/service/QC/SJService.cs b/MES.Service/service/QC/SJService.cs
index 0f0f20a..9362b8f 100644
--- a/MES.Service/service/QC/SJService.cs
+++ b/MES.Service/service/QC/SJService.cs
@@ -17,7 +17,7 @@
     {
         var db = SqlSugarHelper.GetInstance();
         var date = DateTime.Now.ToString("yyyy-MM-dd");
-        var sql ="select max(BILL_NO) from QS_ITEM_IPI_REQ where to_char(CREATE_TIME,'yyyy-mm-dd') = '" + date + "'";
+        var sql = "select max(BILL_NO) from QS_ITEM_IPI_REQ where to_char(CREATE_TIME,'yyyy-mm-dd') = '" + date + "'";
 
         var maxBillNo = db.Ado.SqlQuerySingle<string>(sql);
 
@@ -57,6 +57,7 @@
                 StringUtil.IsNotNullOrEmpty(queryObj.Result) &&
                 !"鏈畬鎴�".Equals(queryObj.Result),
                 a => a.Result != "鏈畬鎴�")
+            .WhereIF(queryObj.Comments != null, a => a.Comments == queryObj.Comments)
             .OrderBy(a => a.BillNo, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit);
 
@@ -222,7 +223,7 @@
 
         item.Items = getQSItems(qsItemIpiReq.Id, null);
         var sjPageResult = new SJPageResult
-            { Id = item.From.Id, Limit = 1, PageIndex = 1 };
+        { Id = item.From.Id, Limit = 1, PageIndex = 1 };
         item.Result = getPage(sjPageResult)[0];
 
         return item;
@@ -409,6 +410,19 @@
         });
     }
 
+    //涓昏〃淇敼澶囨敞瀛楁1
+    public int saveCommentGid(QsItem dto)
+    {
+        return SqlSugarHelper.UseTransactionWithOracle(db =>
+        {
+            return db.Updateable<QsItemIpiReq>()
+                .SetColumns(it =>
+                    it.Comments == dto.Comments) //SetColumns鏄彲浠ュ彔鍔犵殑 鍐�2涓氨2涓瓧娈佃祴鍊�
+                .Where(it => it.Id == dto.gid)
+                .ExecuteCommand();
+        });
+    }
+
     //瀛愯〃淇敼澶囨敞瀛楁
     public int saveRemarksPid(QsItem dto)
     {
diff --git a/MES.Service/service/QC/XJService.cs b/MES.Service/service/QC/XJService.cs
index cc2ff82..411d623 100644
--- a/MES.Service/service/QC/XJService.cs
+++ b/MES.Service/service/QC/XJService.cs
@@ -61,7 +61,8 @@
                              a.Daa018 != "瀹屽伐")
             .GroupBy((a, b) => new
             {
-                b.LineNo, b.LineName
+                b.LineNo,
+                b.LineName
             })
             .Select((a, b) => new MesLine
             {
@@ -137,6 +138,7 @@
                 !"鏈畬鎴�".Equals(queryObj.result),
                 (s, a, c, b) => s.FcheckResu != null)
             .WhereIF(id > 0, (s, a, c, b) => s.Id == id)
+            //.WhereIF(queryObj.Comments != null, (s, a, c, b) => s.Comments == queryObj.Comments)
             .Select((s, a, c, b) => new QsQaItemXj
             {
                 Daa020 = c.LineNo,
@@ -151,7 +153,8 @@
                 ItemModel = b.ItemModel,
                 FcheckBy = s.FcheckBy,
                 FcheckResu = s.FcheckResu,
-                Remarks = s.Remarks
+                Remarks = s.Remarks,
+                Comments = s.Comments
             }).OrderBy(s => s.CreateDate, OrderByType.Desc)
             .ToPageList(queryObj.PageIndex, queryObj.Limit);
     }
@@ -503,6 +506,19 @@
         });
     }
 
+
+    public int saveCommentGid(XJDto dto)
+    {
+        return SqlSugarHelper.UseTransactionWithOracle(db =>
+        {
+            return db.Updateable<QsQaItemXj>()
+                .SetColumns(it =>
+                    it.Comments == dto.Comments) //SetColumns鏄彲浠ュ彔鍔犵殑 鍐�2涓氨2涓瓧娈佃祴鍊�
+                .Where(it => it.Id == dto.gid)
+                .ExecuteCommand();
+        });
+    }
+
     //瀛愯〃淇敼澶囨敞瀛楁
     public int saveRemarksPid(XJDto dto)
     {
diff --git a/MESApplication/Controllers/QC/SJController.cs b/MESApplication/Controllers/QC/SJController.cs
index 996c35d..ecef1f0 100644
--- a/MESApplication/Controllers/QC/SJController.cs
+++ b/MESApplication/Controllers/QC/SJController.cs
@@ -65,7 +65,7 @@
         var itemNo = data["itemId"].ToString();
         try
         {
-            
+
             dynamic resultInfos = new ExpandoObject();
             var tbBillList = new SJService();
             var detail021 = tbBillList.SetQSItems(itemNo);
@@ -275,6 +275,29 @@
         }
     }
 
+    //saveCommentGid
+    [HttpPost("saveCommentGid")]
+    public ResponseResult saveCommentGid([FromBody] QsItem rkjDto)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new SJService().saveCommentGid(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)
diff --git a/MESApplication/Controllers/QC/XJController.cs b/MESApplication/Controllers/QC/XJController.cs
index 71847ce..6554635 100644
--- a/MESApplication/Controllers/QC/XJController.cs
+++ b/MESApplication/Controllers/QC/XJController.cs
@@ -168,7 +168,7 @@
         var itemId = Convert.ToDecimal(data["itemId"].ToString());
         try
         {
-            
+
             dynamic resultInfos = new ExpandoObject();
             var tbBillList =
                 new XJService().setJYItem(itemId);
@@ -399,6 +399,29 @@
         }
     }
 
+
+    //saveCommentGid
+    [HttpPost("saveCommentGid")]
+    public ResponseResult saveCommentGid([FromBody] XJDto rkjDto)
+    {
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new XJService().saveCommentGid(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] XJDto rkjDto)

--
Gitblit v1.9.3