From dbbcd506929afda0a85ae23bcb5f88c1dccef387 Mon Sep 17 00:00:00 2001
From: pzy <2829717936@qq.com>
Date: 星期一, 26 八月 2024 15:19:55 +0800
Subject: [PATCH] 11
---
WebAPI/Controllers/生产管理/质量汇报单/Sc_QualityReportBillController.cs | 364 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 351 insertions(+), 13 deletions(-)
diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
index a4a2d41..42b323e 100644
--- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
+++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\350\264\250\351\207\217\346\261\207\346\212\245\345\215\225/Sc_QualityReportBillController.cs"
@@ -87,12 +87,25 @@
}
else
{
- ds = oCN.RunProcReturn
- ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" +
- ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID " +
- " from Sc_ICMOBillStatus_Tmp a " +
- " left join Gy_Material m on a.HMaterID=m.HItemID " +
- " Where a.HInterID=" + HInterID + " and a.HBillType="+ HBillType, "Sc_ICMOBillStatus_Tmp");
+ if (HBillType == "3772")
+ {
+ ds = oCN.RunProcReturn
+ ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" +
+ ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID" +
+ ",a.HSourceBillNo,a.HSourceInterID,a.HSourceEntryID,a.HDatePlanQty " +
+ " from Sc_ICMOBillStatus_Tmp a " +
+ " left join Gy_Material m on a.HMaterID=m.HItemID " +
+ " Where a.HInterID=" + HInterID + " and a.HBillType=" + HBillType, "Sc_ICMOBillStatus_Tmp");
+ }
+ else {
+ ds = oCN.RunProcReturn
+ ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID" +
+ ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID " +
+ " from Sc_ICMOBillStatus_Tmp a " +
+ " left join Gy_Material m on a.HMaterID=m.HItemID " +
+ " Where a.HInterID=" + HInterID + " and a.HBillType=" + HBillType, "Sc_ICMOBillStatus_Tmp");
+ }
+
}
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
@@ -227,6 +240,7 @@
BillNew.HSourceBillNo = mainList[0].HICMOBillNo;
BillNew.HSourceInterID = mainList[0].HICMOInterID;
BillNew.HSourceBillType = mainList[0].HSourceBillType;
+ BillNew.HBadReasonHQty = mainList[0].HBadReasonHQty;
oCN.BeginTran();
//涓存椂琛�
oCN.RunProc("Insert Into Sc_ICMOBillQualityStatus_Tmp " +
@@ -234,13 +248,13 @@
",HProcExchBillNo,HProcExchInterID,HProcExchEntryID,HProcID,HMaterID" +
",HSourceID,HGroupID,HCheckManID,HBadReasonID,HBarCode" +
",HMaker,HMakeDate,HBillType,HReportType,HSourceBillNo" +
- ",HSourceInterID,HSourceBillType,HICMOEntryID,HSourceEntryID" +
+ ",HSourceInterID,HSourceBillType,HICMOEntryID,HSourceEntryID,HBadReasonHQty" +
") " +
" values(" + BillNew.HInterID + ",'" + BillNew.HBillNo + "','" + BillNew.HDate + "','" + BillNew.HICMOBillNo + "'," + BillNew.HICMOInterID +
",'" + BillNew.HProcExchBillNo + "'," + BillNew.HProcExchInterID + "," + BillNew.HProcExchEntryID + "," + BillNew.HProcID + "," + BillNew.HMaterID +
"," + BillNew.HSourceID + "," + BillNew.HGroupID + "," + BillNew.HCheckManID + "," + BillNew.HBadReasonID + ",'" + BillNew.HBarCode + "'" +
",'" + BillNew.HMaker + "','" + BillNew.HMakeDate + "','" + BillNew.HBillType + "','" + +BillNew.HReportType + "','" +BillNew.HSourceBillNo + "'" +
- "," + BillNew.HSourceInterID + ",'" + BillNew.HSourceBillType + "'," + BillNew.HICMOEntryID + "," + BillNew.HICMOEntryID +
+ "," + BillNew.HSourceInterID + ",'" + BillNew.HSourceBillType + "'," + BillNew.HICMOEntryID + "," + BillNew.HICMOEntryID + "," + BillNew.HBadReasonHQty +
") ");
sReturn = "鎵爜鎴愬姛锛�";
oCN.Commit();
@@ -617,7 +631,7 @@
#region 鎻愪氦淇濆瓨锛屽瓨涓诲瓙琛ㄥ強鏄庣粏琛�
[Route("Sc_QualityReportBill/set_SaveBill")]
[HttpGet]
- public object set_SaveBill(long HInterID,string HChecker)
+ public object set_SaveBill(long HInterID,string HBillNo, string HChecker)
{
try
{
@@ -625,7 +639,7 @@
bool bResult2 = false;
oCN.BeginTran();
//淇濆瓨鍓嶆帶鍒�=========================================
- ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + HInterID, "h_p_Sc_QualityReportBill_BeforeSaveCtrl");
+ ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBill_BeforeSaveCtrl " + HInterID+",'"+ HBillNo + "','',1", "h_p_Sc_QualityReportBill_BeforeSaveCtrl");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
@@ -644,8 +658,18 @@
return objJsonResult;
}
//=========================================================
- //淇濆瓨
- oCN.RunProc("exec h_p_save_Sc_QualityReportBill " + HInterID);
+ //淇濆瓨 鎵归噺淇濆瓨鍏堢湅瀛愯〃鏄惁鏈夋暟鎹�,鏈夋暟鎹氨杩� 瀛樺叆涓昏〃 鏄庣粏琛� 娌℃湁灏卞瓨鍌ㄤ富瀛愭槑缁嗚〃
+ string sql = "select * from Sc_QualityReportBillSub where HInterID = '" + HInterID + "'";
+ ds = oCN.RunProcReturn(sql, "Sc_QualityReportBillSub");
+ if (ds.Tables[0].Rows.Count>0)
+ {
+ oCN.RunProc("exec h_p_save_Sc_QualityReportBillSum " + HInterID + "");
+ }
+ else
+ {
+ oCN.RunProc("exec h_p_save_Sc_QualityReportBill " + HInterID + "");
+ }
+
//鍒ゆ柇鏄惁鍏佽淇濆瓨锛屼笉鍏佽鍒欏洖婊�
ds = oCN.RunProcReturn("exec h_p_JIT_ICMOBillQualityStatus_SaveCtrl", "h_p_JIT_ICMOBillQualityStatus_SaveCtrl");
if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
@@ -658,7 +682,7 @@
return objJsonResult;
}
//淇濆瓨鍚庢帶鍒�=========================================
- ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBill_AfterSaveCtrl " + HInterID, "h_p_Sc_QualityReportBill_AfterSaveCtrl");
+ ds = oCN.RunProcReturn("exec h_p_Sc_QualityReportBill_AfterSaveCtrl " + HInterID + ",'" + HBillNo + "',1", "h_p_Sc_QualityReportBill_AfterSaveCtrl");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
@@ -725,6 +749,101 @@
objJsonResult.count = 0;
objJsonResult.Message = "Exception锛�" + e.ToString();
objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 涓嶈壇閲囬泦鎵归噺姹囨姤 鏂板
+ [Route("Sc_QualityReportBill/SaveSc_QualityReportBillSub")]
+ [HttpPost]
+ public object SaveSc_QualityReportBillSub([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString(); //琛ㄥご鏁版嵁
+ string msg3 = sArray[1].ToString(); //瀛愯〃1鏁版嵁
+ string refSav = sArray[2].ToString(); //鎿嶄綔鏂瑰紡
+ string msg4 = sArray[3].ToString(); //鐢ㄦ埛
+
+ DBUtility.ClsPub.CurUserName = msg4;
+ ListModels oListModels = new ListModels();
+ try
+ {
+ DAL.ClsSc_QualityReportBill oBill = new DAL.ClsSc_QualityReportBill();
+ //琛ㄤ綋鏁版嵁
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+
+ List<Model.ClsSc_QualityReportBillSub> ls = new List<Model.ClsSc_QualityReportBillSub>();
+ ls = oListModels.getObjectByJson_Sc_QualityReportBillSub(msg3);
+ int i = 0;
+ foreach (Model.ClsSc_QualityReportBillSub oSub in ls)
+ {
+
+ i++;
+ oSub.HMakeDate = DateTime.Now;
+ oSub.HEntryID = i;
+ string subSql = "Insert into Sc_QualityReportBillSub " +
+ " (HInterID,HEntryID,HBillNo_bak,HRemark" +
+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" +
+ ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HBadReasonID,HBadReasonNumber,HGroupID" +
+ ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" +
+ ",HBarCode,HReportType" +
+ ",HAddr,HMaker,HMakeDate" +
+ ") values(" +
+ "" + oSub.HInterID.ToString() + "" +
+ "," + oSub.HEntryID.ToString() + "" +
+ ",'" + oSub.HBillNo_bak + "'" +
+ ",'" + oSub.HRemark + "'" +
+ "," + oSub.HSourceInterID.ToString() + "" +
+ "," + oSub.HSourceEntryID.ToString() + "" +
+ ",'" + oSub.HSourceBillNo + "'" +
+ ",'" + oSub.HSourceBillType + "'" +
+ "," + oSub.HRelationQty.ToString() + "" +
+ "," + oSub.HRelationMoney.ToString() +
+
+ "," + oSub.HMaterID.ToString() + "" +
+ "," + oSub.HUnitID.ToString() + "" +
+ ",'" + oSub.HQty.ToString() +
+ "','" + oSub.HResult + "'" +
+ "," + oSub.HEmpID.ToString() + "" +
+ "," + oSub.HSourceID.ToString() + "" +
+ "," + oSub.HBadReasonID.ToString() + "" +
+ ",'" + oSub.HBadReasonNumber.ToString() + "'" +
+ ",'" + oSub.HGroupID.ToString() + "'" +
+
+ "," + oSub.HICMOInterID.ToString() + "" +
+ "," + oSub.HICMOEntryID.ToString() + "" +
+ ",'" + oSub.HICMOBillNo + "'" +
+ "," + oSub.HProcExchInterID + "" +
+ "," + oSub.HProcExchEntryID + "" +
+ ",'" + oSub.HProcExchBillNo + "'" +
+ ",'" + oSub.HBadReasonNumber.ToString() + "'" +
+
+ ",'" + 1 +
+ "','" + oSub.HAddr + "'" +
+ ",'" + msg4 + "'" +
+ ",'" + oSub.HMakeDate.ToShortDateString() + "'" +
+ ") ";
+ oCN.RunProc(subSql);
+
+ }
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
return objJsonResult;
}
}
@@ -1599,5 +1718,224 @@
}
}
#endregion
+
+ #region 鐢熶骇璐ㄩ噺鏃ユ眹鎶ュ崟鍒楄〃 鏌ヨ
+ public class ReportWorkDemandPlanBill
+ {
+ public string HNumber;
+ public string HName;
+ public DateTime HBeginDate;
+ public DateTime HEndDate;
+ }
+ [Route("Sc_QualityReportBill/getSc_QualityReportBillDay")]
+ [HttpGet]
+ public object getSc_QualityReportBillDay(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ReportWorkDemandPlanBill Report = JsonConvert.DeserializeObject<ReportWorkDemandPlanBill>(sWhere);
+ ds = oCN.RunProcReturn($"exec h_p_Sc_StationOutBillMain '{Report.HBeginDate}','{Report.HEndDate}','{Report.HNumber}','{Report.HName}'", "h_p_Sc_StationOutBillMain");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐢熶骇璐ㄩ噺鏈堟眹鎶ュ崟鍒楄〃 鏌ヨ
+ public class ReportWorkDemandPlanBill1
+ {
+ public string HYear;
+ public string HWorkCenter;
+ public string HName;
+
+ }
+ [Route("Sc_QualityReportBill/getSc_QualityReportBillMonth")]
+ [HttpGet]
+ public object getSc_QualityReportBillMonth(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ ReportWorkDemandPlanBill1 Report = JsonConvert.DeserializeObject<ReportWorkDemandPlanBill1>(sWhere);
+ ds = oCN.RunProcReturn($"exec h_p_Sc_StationOutBillMonth '{Report.HYear}','{Report.HWorkCenter}','{Report.HName}'", "h_p_Sc_StationOutBillMonth");
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鐗╂枡鐢熶骇鑹巼缁熻(鏂帿灏�) 鏌ヨ
+
+ [Route("Sc_QualityReportBill/getSc_HMaterYieldStatistics")]
+ [HttpGet]
+ public object getSc_HMaterYieldStatistics(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Sc_HMater_Yield_Statistics_Query order by 鍗曟嵁鍙� desc", "h_v_Sc_HMater_Yield_Statistics_Query");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Sc_HMater_Yield_Statistics_Query where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鏃ユ湡 desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Sc_HMater_Yield_Statistics_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 浠诲姟鍗曢�氳繃鐜�(鏂帿灏�) 鏌ヨ
+
+ [Route("Sc_QualityReportBill/getSc_HICMMaterStatistics")]
+ [HttpGet]
+ public object getSc_HICMMaterStatistics(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_QualityReportBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Sc_HICMMater_Statistics_Query order by 鍗曟嵁鍙� desc", "h_v_Sc_HICMMater_Statistics_Query");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Sc_HICMMater_Statistics_Query where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鏃ユ湡 desc";
+ ds = oCN.RunProcReturn(sql, "h_v_Sc_HICMMater_Statistics_Query");
+ }
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1