From e19f8a13e2b35e6836ce46c17402c44327814a00 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期四, 18 十二月 2025 09:14:36 +0800
Subject: [PATCH] 产能排产漏更新
---
WebApi/GS.QC/Service/MesQaItemsDetect01Manager.cs | 166 ++++++++++++++++++++++++-------------------------------
1 files changed, 73 insertions(+), 93 deletions(-)
diff --git a/WebApi/GS.QC/Service/MesQaItemsDetect01Manager.cs b/WebApi/GS.QC/Service/MesQaItemsDetect01Manager.cs
index 4e9cdbc..17fd12a 100644
--- a/WebApi/GS.QC/Service/MesQaItemsDetect01Manager.cs
+++ b/WebApi/GS.QC/Service/MesQaItemsDetect01Manager.cs
@@ -1,6 +1,5 @@
锘縰sing System.Data;
using System.Data.SqlClient;
-using System.Dynamic;
using System.Text;
using Gs.Entity.QC;
using Gs.Toolbox;
@@ -9,23 +8,21 @@
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using System.Dynamic;
using static Gs.Toolbox.UtilityHelper;
-
namespace GS.QC.Service;
[ApiGroup(ApiGroupNames.QC)]
-public class MesQaItemsDetect01Manager : Repository<MesQaItemsDetect01>,
- IRomteService
+public class MesQaItemsDetect01Manager : Repository<MesQaItemsDetect01>,IRomteService
{
private readonly IHttpContextAccessor _http;
private readonly string _userCode, _userGuid, _orgFids;
-
public MesQaItemsDetect01Manager(IHttpContextAccessor httpContextAccessor)
{
_http = httpContextAccessor;
(_userCode, _userGuid, _orgFids) =
- GetUserGuidAndOrgGuid(_http);
+ UtilityHelper.GetUserGuidAndOrgGuid(_http);
}
#region CRUD
@@ -113,8 +110,7 @@
var dset = new DataSet();
try
{
- dset = DbHelperSQL.RunProcedure("[iqc_detect01_get]", parameters,
- "0");
+ dset = DbHelperSQL.RunProcedure("[iqc_detect01_get]", parameters, "0");
if (dset != null && dset.Tables.Count > 0 &&
dset.Tables[0].Rows.Count > 0)
{
@@ -149,17 +145,14 @@
dynamic m = new ExpandoObject();
m.list = new List<dynamic>();
m.list2 = new List<dynamic>();
- var sb = new StringBuilder();
- sb.Append(
- "select * from MES_QA_ITEMS_DETECT_DETAIL12 where parent_guid='" +
- guid + "' order by fstand asc");
- sb.Append(
- " select d13.*,d5.fcheck_item as fcheckItemd5,d5.ybsl from MES_QA_ITEMS_DETECT_DETAIL13 d13 left join[dbo].[MES_QA_ITEMS_DETECT_DETAIL5] d5 on d13.parent_guid = d5.guid");
+ System.Text.StringBuilder sb = new StringBuilder();
+ sb.Append("select * from MES_QA_ITEMS_DETECT_DETAIL12 where parent_guid='" + guid + "' order by fstand asc");
+ sb.Append(" select d13.*,d5.fcheck_item as fcheckItemd5,d5.ybsl from MES_QA_ITEMS_DETECT_DETAIL13 d13 left join[dbo].[MES_QA_ITEMS_DETECT_DETAIL5] d5 on d13.parent_guid = d5.guid");
sb.Append(" where d13.parent_guid = '" + guid + "'");
sb.Append(" order by d13.fcheck_item asc");
try
{
- var dset = new DataSet();
+ DataSet dset = new DataSet();
dset = DbHelperSQL.Query(sb.ToString());
var _tb = dset.Tables[0].TableToDynamicList();
m.list = _tb;
@@ -169,9 +162,8 @@
catch (Exception ex)
{
LogHelper.Debug(ToString(),
- "GetModel12 error锛�" + ex.Message);
+ "GetModel12 error锛�" + ex.Message);
}
-
if (m != null)
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
"璇诲彇鎴愬姛锛�");
@@ -190,7 +182,7 @@
[FromBody] MesQaItemsDetect01 model)
{
int? rtnInt = (int)ReturnCode.Default;
- var _sbMsg = "";
+ string _sbMsg = "";
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
using (var cmd = new SqlCommand("iqc_detect01_reload", conn))
@@ -215,14 +207,14 @@
foreach (var parameter in parameters)
cmd.Parameters.Add(parameter);
cmd.ExecuteNonQuery();
- _sbMsg = parameters[0].Value.ToString();
+ _sbMsg = (parameters[0].Value.ToString());
rtnInt = int.Parse(parameters[1].Value.ToString());
}
catch (Exception ex)
{
LogHelper.Debug(ToString(),
"chk_iqc_detect01_reload error锛�" + ex.Message);
- _sbMsg = "瀛樺偍杩囩▼鎵ц澶辫触锛�" + ex.Message;
+ _sbMsg = ("瀛樺偍杩囩▼鎵ц澶辫触锛�" + ex.Message);
}
finally
{
@@ -230,17 +222,17 @@
}
}
}
-
if (rtnInt > 0)
return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Success,
_sbMsg);
return ReturnDto<int>.QuickReturn(rtnInt, ReturnCode.Exception,
- _sbMsg);
+ _sbMsg);
+
}
/// <summary>
- /// 褰曞叆妫�楠岀粨鏋�
+ /// 褰曞叆妫�楠岀粨鏋�
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
@@ -267,7 +259,7 @@
new("@inEdtUserGuid", _userGuid),
new("@inOrderGuid1", inOrderGuid1),
new("@inOrderGuid5", inOrderGuid5),
- new("@inP1", inP1)
+ new("@inP1", inP1),
};
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
@@ -290,7 +282,6 @@
}
}
}
-
if (_outSum <= 0)
return ReturnDto<string>.QuickReturn(_outSum,
ReturnCode.Exception, _outMsg);
@@ -308,8 +299,10 @@
public ReturnDto<string> EditModel([FromBody] dynamic model)
{
Guid? guid = model.guid; //鍒拌揣鍗曚富閿�
- string fngDesc = model.fngDesc; //澶囨敞
- string ckId = model.ckId;
+ string fngDesc = model.fngDesc; //寮傚父鎻忚堪
+ string iqcRemark = model.iqcRemark;
+ string ckId=model.ckId;
+ string weight = model.weight;
var _outMsg = "";
var _outSum = -1;
using (var conn = new SqlConnection(DbHelperSQL.strConn))
@@ -325,10 +318,11 @@
new("@outMsg", SqlDbType.NVarChar, 300),
new("@outSum", SqlDbType.Int),
new("@inEdtUserGuid", _userGuid),
- new("@inOrderGuid",
- CheckGuid(guid) ? guid : DBNull.Value),
+ new("@inOrderGuid", UtilityHelper.CheckGuid(guid) ? guid: DBNull.Value),
new("@fngDesc", fngDesc),
- new("@ckId", ckId)
+ new("@ckId", ckId),
+ new("@weight", weight),
+ new("@iqcRemark", iqcRemark),
};
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
@@ -363,9 +357,8 @@
#region 鎻愪氦妫�楠�
-
/// <summary>
- /// 鎻愪氦妫�楠�
+ /// 鎻愪氦妫�楠�
/// </summary>
/// <param name="mode"></param>
/// <returns></returns>
@@ -386,14 +379,14 @@
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter[] parameters =
{
- new("@outMsg", SqlDbType.NVarChar, 300),
- new("@outSum", SqlDbType.Int),
- new("@inEdtUserGuid", _userGuid),
- new("@inOrderGuid", _guid),
- new("@inFieldValue", 1),
- new("@in1", ""),
- new("@in2", "")
- };
+ new("@outMsg", SqlDbType.NVarChar, 300),
+ new("@outSum", SqlDbType.Int),
+ new("@inEdtUserGuid", _userGuid),
+ new("@inOrderGuid", _guid),
+ new("@inFieldValue", 1),
+ new("@in1", ""),
+ new("@in2", "")
+ };
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
foreach (var parameter in parameters)
@@ -405,10 +398,8 @@
catch (Exception ex)
{
m.outMsg = ex.Message;
- LogHelper.Debug(ToString(),
- "chk_iqc_detect01_submit error锛�" + ex.Message);
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
- ex.Message);
+ LogHelper.Debug(this.ToString(), "chk_iqc_detect01_submit error锛�" + ex.Message);
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, ex.Message);
}
finally
{
@@ -416,19 +407,17 @@
}
}
}
-
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
}
/// <summary>
- /// 璐ㄩ噺锛屽鏍革紝鍙嶅鏍革紝椹冲洖
+ /// 璐ㄩ噺锛屽鏍革紝鍙嶅鏍革紝椹冲洖
/// </summary>
/// <param name="mode"></param>
/// <returns></returns>
[RequestMethod(RequestMethods.POST)]
- public ReturnDto<ExpandoObject> EditModelSubmitZhiLiang(
- [FromBody] dynamic mode)
+ public ReturnDto<ExpandoObject> EditModelSubmitZhiLiang([FromBody] dynamic mode)
{
string _guid = mode.guid;
string _inFieldValue = mode.inFieldValue;
@@ -445,14 +434,14 @@
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter[] parameters =
{
- new("@outMsg", SqlDbType.NVarChar, 300),
- new("@outSum", SqlDbType.Int),
- new("@inEdtUserGuid", _userGuid),
- new("@inOrderGuid", _guid),
- new("@inFieldValue", _inFieldValue),
- new("@in1", ""),
- new("@in2", "")
- };
+ new("@outMsg", SqlDbType.NVarChar, 300),
+ new("@outSum", SqlDbType.Int),
+ new("@inEdtUserGuid", _userGuid),
+ new("@inOrderGuid", _guid),
+ new("@inFieldValue",_inFieldValue),
+ new("@in1", ""),
+ new("@in2", "")
+ };
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
foreach (var parameter in parameters)
@@ -464,10 +453,8 @@
catch (Exception ex)
{
m.outMsg = ex.Message;
- LogHelper.Debug(ToString(),
- "iqc_detect01_zhiliang error锛�" + ex.Message);
- return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default,
- ex.Message);
+ LogHelper.Debug(this.ToString(), "iqc_detect01_zhiliang error锛�" + ex.Message);
+ return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, ex.Message);
}
finally
{
@@ -475,7 +462,6 @@
}
}
}
-
return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success, "鎿嶄綔鎴愬姛锛�");
}
@@ -492,52 +478,49 @@
public ReturnDto<List<dynamic>> GetYangLi([FromBody] dynamic model)
{
string guid = model.dt01Guid.ToString();
- var lst = new List<dynamic>();
+ List<dynamic> lst = new List<dynamic>();
SqlParameter[] parameters =
{
- new("@dt01Guid", guid)
+ new("@dt01Guid", guid),
};
var dset = new DataSet();
try
{
- dset = DbHelperSQL.RunProcedure("[iqc_detect01_13Lst]", parameters,
- "0");
+ dset = DbHelperSQL.RunProcedure("[iqc_detect01_13Lst]", parameters, "0");
if (dset != null && dset.Tables.Count > 0 &&
dset.Tables[0].Rows.Count > 0)
{
- var _tb = dset.Tables[1];
- var maxYl = int.Parse(dset.Tables[0].Rows[0][0].ToString());
+ DataTable _tb = dset.Tables[1];
+ int maxYl = int.Parse(dset.Tables[0].Rows[0][0].ToString());
//鍦ㄦ楠岄」鐩〃涓婏紝鏍规嵁鏍锋湰鏁拌嚜鍔ㄥ欢鐢虫牱鏈�1锛屾牱鏈�2锛屾牱鏈�3鈥︹��
- for (var i = 1; i <= maxYl; i++)
+ for (int i = 1; i <= maxYl; i++)
{
- _tb.Columns.Add("鏍锋湰" + i, typeof(decimal));
- _tb.Columns.Add("鏍锋湰" + i + "jg", typeof(string));
- }
-
- ;
- var _tb2 = dset.Tables[2];
+ _tb.Columns.Add("鏍锋湰" + i.ToString(), typeof(decimal));
+ _tb.Columns.Add("鏍锋湰" + i.ToString() + "jg", typeof(string));
+ };
+ DataTable _tb2 = dset.Tables[2];
//寰幆鏍锋湰缁撴灉琛ㄧ殑姣忎竴琛�
foreach (DataRow row in _tb.Rows)
+ {
//鐒跺悗寰幆妫�楠岄」鐩湰鐨勭涓�鍒�
- foreach (DataColumn col in _tb.Columns)
- if (col.ColumnName.StartsWith("鏍锋湰"))
+ foreach (DataColumn col in _tb.Columns)
{
- var _idx = col.ColumnName.Replace("鏍锋湰", "");
- //鎺掗櫎鏍锋湰鏁拌繖涓�鍒�
- if (!string.IsNullOrEmpty(_idx) && _idx != "鏁�")
+ if (col.ColumnName.ToString().StartsWith("鏍锋湰"))
{
- var _row = _tb2.Select(" parent_guid='" +
- row["guid"] +
- "' and fcheck_item='" +
- col.ColumnName.Trim() + "'");
- if (_row.Length > 0)
+ string _idx = col.ColumnName.ToString().Replace("鏍锋湰", "");
+ //鎺掗櫎鏍锋湰鏁拌繖涓�鍒�
+ if (!string.IsNullOrEmpty(_idx) && _idx != "鏁�")
{
- row[col.ColumnName] = _row[0]["fcheck_resu"];
- row[col.ColumnName + "jg"] = _row[0]["fstand"];
+ DataRow[] _row = _tb2.Select(" parent_guid='" + row["guid"].ToString() + "' and fcheck_item='" + col.ColumnName.ToString().Trim() + "'");
+ if (_row.Length > 0)
+ {
+ row[col.ColumnName] = _row[0]["fcheck_resu"];
+ row[col.ColumnName + "jg"] = _row[0]["fstand"];
+ }
}
}
}
-
+ }
lst = _tb.TableToDynamicList();
}
}
@@ -545,7 +528,6 @@
{
LogHelper.Debug(ToString(), ex.Message);
}
-
return ReturnDto<List<dynamic>>.QuickReturn(lst, ReturnCode.Success,
"璇诲彇鎴愬姛锛�");
}
@@ -580,11 +562,11 @@
new("@outSum", SqlDbType.Int),
new("@outGuid", SqlDbType.UniqueIdentifier),
new("@outNo", SqlDbType.NVarChar, 300),
- new("@outFstand", SqlDbType.NVarChar, 10),
+ new("@outFstand",SqlDbType.NVarChar, 10),
new("@dt05Guid", CheckGuid(guid) ? guid : DBNull.Value),
new("@fVal", fVal),
new("@fSeq", fSeq),
- new("@inEdtUserGuid", _userGuid)
+ new("@inEdtUserGuid", _userGuid),
};
parameters[0].Direction = ParameterDirection.Output;
parameters[1].Direction = ParameterDirection.Output;
@@ -613,11 +595,9 @@
}
}
}
-
//if (mObj.outSum <= 0)
// return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Exception, mObj.outMsg);
- return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success,
- mObj.outMsg);
+ return ReturnDto<dynamic>.QuickReturn(mObj, ReturnCode.Success, mObj.outMsg);
}
#endregion
--
Gitblit v1.9.3