From a65e9ae75629e1d87d6f373f9bdcfac32ccf1fea Mon Sep 17 00:00:00 2001
From: xwt <2740516069@qq.com>
Date: 星期三, 17 九月 2025 13:14:16 +0800
Subject: [PATCH] SJ,XJ,RKJ
---
MES.Service/Modes/QsItemIpiReq.cs | 7 ++
MESApplication/Controllers/QC/SJController.cs | 55 +++++++++++++++++-
MES.Service/service/QC/SJService.cs | 99 ++++++++++++++++++++++++++++++++
MES.Service/Dto/service/SJPageResult.cs | 3 +
4 files changed, 159 insertions(+), 5 deletions(-)
diff --git a/MES.Service/Dto/service/SJPageResult.cs b/MES.Service/Dto/service/SJPageResult.cs
index 0064430..a34f99d 100644
--- a/MES.Service/Dto/service/SJPageResult.cs
+++ b/MES.Service/Dto/service/SJPageResult.cs
@@ -11,6 +11,9 @@
[SugarColumn(ColumnName = "BILL_NO")] //鐢ㄤ簬SqlSugar
public string? BillNo { get; set; }
+ [SugarColumn(ColumnName = "FSUBMIT")] //鐢ㄤ簬SqlSugar
+ public string? Fsubmit { get; set; }
+
[SugarColumn(ColumnName = "STATUS_DATE")] //鐢ㄤ簬SqlSugar
public DateTime? StatusDate { get; set; }
diff --git a/MES.Service/Modes/QsItemIpiReq.cs b/MES.Service/Modes/QsItemIpiReq.cs
index 0daac60..0a2dfd6 100644
--- a/MES.Service/Modes/QsItemIpiReq.cs
+++ b/MES.Service/Modes/QsItemIpiReq.cs
@@ -104,6 +104,13 @@
public decimal? Pbaid { get; set; }
/// <summary>
+ /// 瀹℃牳鐘舵��
+ /// </summary>
+ [Column("FSUBMIT")]
+ [SugarColumn(ColumnName = "FSUBMIT")] //鐢ㄤ簬SqlSugar
+ public decimal? Fsubmit { get; set; }
+
+ /// <summary>
/// 瀹℃牳鏃ユ湡
/// </summary>
[Column("STATUS_DATE")]
diff --git a/MES.Service/service/QC/SJService.cs b/MES.Service/service/QC/SJService.cs
index db188ef..9445acb 100644
--- a/MES.Service/service/QC/SJService.cs
+++ b/MES.Service/service/QC/SJService.cs
@@ -52,15 +52,46 @@
.WhereIF(
StringUtil.IsNotNullOrEmpty(queryObj.Result) &&
"鏈畬鎴�".Equals(queryObj.Result),
- a => a.Result == queryObj.Result)
+ a => SqlFunc.IsNull(a.Fsubmit, "0") != "1")
.WhereIF(
StringUtil.IsNotNullOrEmpty(queryObj.Result) &&
!"鏈畬鎴�".Equals(queryObj.Result),
- a => a.Result != "鏈畬鎴�")
+ a => a.Fsubmit == "1")
.OrderBy(a => a.BillNo, OrderByType.Desc)
.ToPageList(queryObj.PageIndex, queryObj.Limit);
return data;
+ }
+
+ //鑾峰彇鎵�鏈夋暟鎹垎椤碉紙鎼哄甫鎬绘暟锛�
+ public (List<SJPageResult> data, int totalCount) getPageWithTotal(SJPageResult queryObj)
+ {
+ var db = SqlSugarHelper.GetInstance();
+
+ string[]? lineNo = null;
+
+ if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser))
+ lineNo = _baseService.getUserLineNo(queryObj.StatusUser);
+
+ int totalCount = 0;
+ var data = db.Queryable<SJPageResult>()
+ .WhereIF(lineNo != null && lineNo.Length > 0,
+ a => lineNo.Contains(a.line))
+ .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id)
+ .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.BillNo),
+ a => a.BillNo == queryObj.BillNo)
+ .WhereIF(
+ StringUtil.IsNotNullOrEmpty(queryObj.Result) &&
+ "鏈畬鎴�".Equals(queryObj.Result),
+ a => SqlFunc.IsNull(a.Fsubmit, "0") != "1")
+ .WhereIF(
+ StringUtil.IsNotNullOrEmpty(queryObj.Result) &&
+ !"鏈畬鎴�".Equals(queryObj.Result),
+ a => a.Fsubmit == "1")
+ .OrderBy(a => a.BillNo, OrderByType.Desc)
+ .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+
+ return (data, totalCount);
}
@@ -455,4 +486,68 @@
return withOracle;
}
+
+ public int SJQaSubmit(string userNo, decimal id)
+ {
+ return SqlSugarHelper.UseTransactionWithOracle(db =>
+ {
+ var commit = 0;
+
+ // 鎻愪氦棣栨鍗�
+ var sql = "update QS_ITEM_IPI_REQ set FSUBMIT=1, FSUBMIT_BY=:userNo, FSUBMIT_DATE=SYSDATE where ID=:id";
+ var parameters = new List<SugarParameter>
+ {
+ new(":userNo", userNo),
+ new(":id", id)
+ };
+ commit += db.Ado.ExecuteCommand(sql, parameters);
+
+ // 璇诲彇棣栨鍗曪紝鍙栫粨鏋滀笌璁″垝缂栧彿
+ var req = db.Queryable<QsItemIpiReq>().Single(s => s.Id == id);
+ if (req != null)
+ {
+ // 閫氳繃 PBAID 鎵惧埌 WOMDAA 鑾峰彇璁″垝缂栧彿 DAA001
+ var wom = db.Queryable<Womdaa>().Single(s => s.Id == req.Pbaid);
+ if (wom != null && !string.IsNullOrWhiteSpace(wom.Daa001))
+ {
+ var resultText = req.IsPass == 1 ? "鍚堟牸" : "涓嶅悎鏍�";
+ // 鏇存柊 WOMDAA锛氶妫�鏍囪涓庣粨鏋�
+ commit += db.Updateable<Womdaa>()
+ .SetColumns(w => w.Daa025 == "1")
+ .SetColumns(w => w.Daa026 == resultText)
+ .Where(w => w.Daa001 == wom.Daa001)
+ .ExecuteCommand();
+ }
+ }
+
+ return commit;
+ });
+ }
+
+ public (int code, string message) GenUpdateSJ(decimal id, string no, string userNo)
+ {
+ var db = SqlSugarHelper.GetInstance();
+ // 杈撳嚭鍙傛暟
+ var poResult = new SugarParameter("PO_RESULT", null, System.Data.DbType.Int32, System.Data.ParameterDirection.Output, 4000);
+ var poText = new SugarParameter("PO_TEXT", null, System.Data.DbType.String, System.Data.ParameterDirection.Output, 4000);
+
+ // 杈撳叆鍙傛暟 + 杈撳嚭鍙傛暟
+ var parameters = new List<SugarParameter>
+ {
+ new("P_ID", id, System.Data.DbType.Decimal, System.Data.ParameterDirection.Input),
+ new("P_NO", no ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input),
+ new("P_USER", userNo ?? string.Empty, System.Data.DbType.String, System.Data.ParameterDirection.Input),
+ poResult,
+ poText
+ };
+
+ // 涓庢潵鏂欐涓�鑷寸殑璋冪敤椋庢牸
+ db.Ado.ExecuteCommand(
+ "BEGIN PRC_GEN_UPDATE_SJ(:P_ID, :P_NO, :P_USER, :PO_RESULT, :PO_TEXT); END;",
+ parameters.ToArray());
+
+ var code = Convert.ToInt32(poResult.Value?.ToString() ?? "0");
+ var message = poText.Value?.ToString() ?? "";
+ return (code, message);
+ }
}
\ No newline at end of file
diff --git a/MESApplication/Controllers/QC/SJController.cs b/MESApplication/Controllers/QC/SJController.cs
index 107d6b9..732a88b 100644
--- a/MESApplication/Controllers/QC/SJController.cs
+++ b/MESApplication/Controllers/QC/SJController.cs
@@ -41,14 +41,15 @@
try
{
dynamic resultInfos = new ExpandoObject();
- var tbBillList =
- new SJService().getPage(queryObj);
+ var service = new SJService();
+ var (tbBillList, totalCount) = service.getPageWithTotal(queryObj);
resultInfos.tbBillList = tbBillList;
return new ResponseResult
{
status = 0,
message = "OK",
- data = resultInfos
+ data = resultInfos,
+ TotalCount = totalCount
};
}
catch (Exception ex)
@@ -319,4 +320,52 @@
return ResponseResult.ResponseError(ex);
}
}
+
+ [HttpPost("SJQaSubmit")]
+ public ResponseResult SJQaSubmit([FromBody] JObject data)
+ {
+ var userNo = data["userNo"]?.ToString();
+ var id = Convert.ToDecimal(data["id"]?.ToString());
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new SJService().SJQaSubmit(userNo, id);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("GenUpdateSJ")]
+ public ResponseResult GenUpdateSJ([FromBody] JObject data)
+ {
+ var id = Convert.ToDecimal(data["id"]?.ToString());
+ var no = data["no"]?.ToString();
+ var userNo = data["userNo"]?.ToString();
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var service = new SJService();
+ var (code, msg) = service.GenUpdateSJ(id, no, userNo);
+ resultInfos.tbBillList = new { result = code, message = msg };
+ return new ResponseResult
+ {
+ status = code,
+ message = msg,
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3