From 0a6224c1f057e83ed90b75d0c71286c30d8e01ab Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期三, 13 十二月 2023 00:11:32 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CJGL/Cj_SingleStationController.cs | 34 WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs | 53 ++ WebAPI/Controllers/品质管理/质量报表/QC_QualityReportsController.cs | 461 ++++++++++++++++++++++++ WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs | 53 ++ WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs | 21 + WebAPI/Controllers/生产管理/生产报表/Sc_ProductReportController.cs | 119 ++++++ WebAPI/DLL/ClsSc_ICMOReportBill.cs | 220 +++++++++++ WebAPI/WebAPI.csproj | 2 WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs | 65 +++ WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs | 105 +++++ 10 files changed, 1,114 insertions(+), 19 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs index 79f48fe..5346ce3 100644 --- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs +++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs @@ -502,7 +502,7 @@ ,HSourceBillType,HMaterID,HSourceID,HEquipID,HUnitID,HQty ,HGroupID,HWorkerID,HScanDate,HBarCode,HBarCode_P,HSNNumber) values({HInterID1},'{HBillNo1}',{(i + 1)},0,0,'' -,'',{sub[i].HMaterID},0,0,0,{sub[i].HQty} +,'',{sub[i].HMaterID},0,0,0,1 ,0,0,getdate(),'{sub[i].HBarCode}','{omodel.HBarCode_P}','') "; oCN.RunProc(sq2); } @@ -939,7 +939,7 @@ #region 宸ュ簭鍗曞搧杩囩珯 鏌ヨ涓嶈壇璁板綍 [Route("Cj_SingleStation/BadRecordsList")] [HttpGet] - public object BadRecordsList(string HBarCode, string user) + public object BadRecordsList(string HProcExchInterID, string HProcExchEntryID, string user) { try { @@ -953,12 +953,12 @@ return objJsonResult; } - ds = oCN.RunProcReturn(@"select * from h_v_Gy_BadRecordsList where HProcExchBillNo='" + HBarCode + "'", "h_v_Gy_BadRecordsList"); + ds = oCN.RunProcReturn(@"exec h_p_Gy_BadRecordsList " + HProcExchInterID + "," + HProcExchEntryID, "h_p_Gy_BadRecordsList"); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = ""; - objJsonResult.data = ds.Tables[0]; + objJsonResult.data = ds; return objJsonResult; } catch (Exception e) @@ -1392,24 +1392,24 @@ if (HResult == "OK") { - ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub where HInterID=" + model.HInterID, "Sc_SourceLineRepairBillSub"); +// ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillSub where HInterID=" + model.HInterID, "Sc_SourceLineRepairBillSub"); - if (ds.Tables[0].Rows[0]["HRepairResult"].ToString() == "OK") - { +// if (ds.Tables[0].Rows[0]["HRepairResult"].ToString() == "OK") +// { - //鐢熶骇宸ュ簭鍑虹珯SN鏁版嵁 - ds = oCN.RunProcReturn("select top 1 HInterID,HBillNo from Sc_StationOutBillMain where HProcExchInterID=" + model.HProcExchInterID + " and HProcExchEntryID=" + model.HProcExchEntryID + " and HBadCount<>0 order by HInterID desc", "Sc_StationOutBillMain"); +// //鐢熶骇宸ュ簭鍑虹珯SN鏁版嵁 +// ds = oCN.RunProcReturn("select top 1 HInterID,HBillNo from Sc_StationOutBillMain where HProcExchInterID=" + model.HProcExchInterID + " and HProcExchEntryID=" + model.HProcExchEntryID + " and HBadCount<>0 order by HInterID desc", "Sc_StationOutBillMain"); - string HInterIDSN = ds.Tables[0].Rows[0]["HInterID"].ToString(); - string HBillNoSN = ds.Tables[0].Rows[0]["HBillNo"].ToString(); +// string HInterIDSN = ds.Tables[0].Rows[0]["HInterID"].ToString(); +// string HBillNoSN = ds.Tables[0].Rows[0]["HBillNo"].ToString(); - ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID=" + HInterIDSN, "Sc_StationOutBillSub_SN"); +// ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_SN where HInterID=" + HInterIDSN, "Sc_StationOutBillSub_SN"); - oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) -values({HInterIDSN}, '{HBillNoSN}', {ds.Tables[0].Rows.Count + 1}, '{model.HBarCode}', 1, GETDATE(), '', " + model.HProcExchInterID + "," + model.HProcExchEntryID + ", '" + model.HProcExchBillNo + "', '', 0, 0)"); - //鍙嶅啓宸ュ簭鍑虹珯鍗� 涓昏〃 涓嶈壇鏁伴噺 鍜� 鍚堟牸鏁伴噺 - oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterIDSN + "'"); - } +// oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) +//values({HInterIDSN}, '{HBillNoSN}', {ds.Tables[0].Rows.Count + 1}, '{model.HBarCode}', 1, GETDATE(), '', " + model.HProcExchInterID + "," + model.HProcExchEntryID + ", '" + model.HProcExchBillNo + "', '', 0, 0)"); +// //鍙嶅啓宸ュ簭鍑虹珯鍗� 涓昏〃 涓嶈壇鏁伴噺 鍜� 鍚堟牸鏁伴噺 +// oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterIDSN + "'"); +// } oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + model.HBarCode + "'"); } diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs index 21186e1..8626c73 100644 --- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs +++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs @@ -2060,6 +2060,27 @@ objJsonResult.data = null; return objJsonResult; } + //鍒犻櫎鍓嶅垽鏂湁娌℃湁鐢熸垚閲戣澏鍗曟嵁锛堢敓浜ф眹鎶ュ崟锛岀敓浜у叆搴撳崟锛� + ds = oCn.RunProcReturn($"exec h_p_Cj_StationOutBill_BeforeDelCtrl {HInterID}", "h_p_Cj_StationOutBill_BeforeDelCtrl"); + if (ds == null || ds.Tables[0].Rows.Count <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎鍑虹珯姹囨姤鍗曞彂鐢熷紓甯革紝娌℃湁浠讳綍杩斿洖璁板綍锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + if (ds.Tables[0].Rows[0]["HBackCount"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = ds.Tables[0].Rows[0]["HRemarkBack"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo)) { diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs index fb4bde5..dd0060f 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckPlanBillController.cs @@ -1,4 +1,5 @@ 锘縰sing DBUtility; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -73,6 +74,58 @@ } } + #region 璁惧鐐规璁板綍缁熻鍒嗘瀽 + /// <summary> + /// 杩斿洖璁惧鐐规璁板綍缁熻鍒嗘瀽 鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sb_EquipDotCheckReport/Statistics")] + [HttpGet] + public object Statistics(string DateYear, string HType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (DateYear == null || DateYear.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sb_EquipDotCheckBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipDotCheckBillReport"); + } + + //娣诲姞鍒楀悕 + 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 sql璇彞 diff --git a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs index d04c5ca..b9e9a21 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs @@ -87,6 +87,59 @@ } } + #region 璁惧淇濆吇璁板綍缁熻鍒嗘瀽 + /// <summary> + /// 杩斿洖璁惧淇濆吇璁板綍缁熻鍒嗘瀽 鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sb_EquipMaintainReport/Statistics")] + [HttpGet] + public object Statistics(string DateYear, string HType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (DateYear == null || DateYear.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sb_EquipMaintainBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipMaintainBillReport"); + } + + //娣诲姞鍒楀悕 + 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 sql璇彞 diff --git a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs index 1dd2ccb..0acc5cc 100644 --- a/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs +++ b/WebAPI/Controllers/SCGL/Sc_ICMOReportBillController.cs @@ -1103,5 +1103,70 @@ } #endregion + #region 鐢熶骇姹囨姤鍗曡幏鍙栨簮鍗曚骇閲忔眹鎶ュ崟涓存椂琛ㄤ俊鎭� + /// <summary> + /// 鐢熶骇姹囨姤鍗曡幏鍙栨簮鍗曚骇閲忔眹鎶ュ崟涓存椂琛ㄤ俊鎭� + /// </summary> + /// <returns></returns> + [Route("Sc_ICMOReportBill/GetProdReportBillList")] + [HttpGet] + public object GetProdReportBillList(string HInterID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浜ч噺姹囨姤鍗曞唴鐮佷负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + + string sql = "exec h_p_Sc_ICMOBillWorkQtyStatus_TmpList '" + HInterID + "'"; + ds = oCN.RunProcReturn(sql, "h_p_Sc_ICMOBillWorkQtyStatus_TmpList"); + } + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + //if (ds.Tables[0].Rows.Count != 0 || ds != null) + //{ + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds; + objJsonResult.list = columnNameList; + return objJsonResult; + //} + //else + //{ + //objJsonResult.code = "0"; + //objJsonResult.count = 0; + //objJsonResult.Message = "鏃犳暟鎹�"; + //objJsonResult.data = null; + //return objJsonResult; + //} + } + catch (Exception ex) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file diff --git a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs index 3a2f56c..18a4888 100644 --- a/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs +++ b/WebAPI/Controllers/Sb_CheckEqpRepairWorkBillController.cs @@ -77,6 +77,58 @@ } #endregion + #region 璁惧缁翠慨璁板綍缁熻鍒嗘瀽 + /// <summary> + /// 杩斿洖璁惧缁翠慨璁板綍缁熻鍒嗘瀽 鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sb_EquipRepairWorkReport/Statistics")] + [HttpGet] + public object Statistics(string DateYear, string HType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (DateYear == null || DateYear.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sb_EquipRepairWorkBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipRepairWorkBillReport"); + } + + //娣诲姞鍒楀悕 + 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 璁惧缁翠慨宸ュ崟鍒楄〃sql璇彞 public static DataSet Sb_EquipRepairWorkBill_s(string sWhere) { @@ -204,6 +256,59 @@ } #endregion + + #region 璁惧鏁呴殰璁板綍缁熻鍒嗘瀽 + /// <summary> + /// 杩斿洖璁惧鏁呴殰璁板綍缁熻鍒嗘瀽 鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sb_EquipConkBookReport/Statistics")] + [HttpGet] + public object Statistics_Conk(string DateYear, string HType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (DateYear == null || DateYear.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sb_EquipConkBookBillReport '" + DateYear + "','" + HType + "'", "h_p_Sb_EquipConkBookBillReport"); + } + + //娣诲姞鍒楀悕 + 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 璁惧鏁呴殰鐧昏鍗曞垪琛╯ql璇彞 public static DataSet Sb_EqpConkBookBillList_s(string sWhere) { diff --git "a/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_QualityReportsController.cs" "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_QualityReportsController.cs" new file mode 100644 index 0000000..d1ded94 --- /dev/null +++ "b/WebAPI/Controllers/\345\223\201\350\264\250\347\256\241\347\220\206/\350\264\250\351\207\217\346\212\245\350\241\250/QC_QualityReportsController.cs" @@ -0,0 +1,461 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Web.Http; +using WebAPI.DLL; +using WebAPI.Models; +using WebAPI.Service; +using Kingdee.BOS.WebApi.Client; + +namespace WebAPI.Controllers +{ + public class QC_QualityReportsController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 璐ㄩ噺妯″潡 鐩撮�氱巼鎶ヨ〃鏌ヨ + /// <summary> + /// 杩斿洖鐩撮�氱巼鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/FirstPassRate")] + [HttpGet] + public object FirstPassRate(string Year,string DeptName, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (Year == null || Year.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateReport '" + Year + "','" + DeptName + "'", "h_p_QC_FirstPassRateReport"); + } + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 鐢熶骇涓嶈壇鍘熷洜缁熻鍒嗘瀽鎶ヨ〃鏌ヨ + /// <summary> + /// 杩斿洖鐢熶骇涓嶈壇鍘熷洜缁熻鍒嗘瀽鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/ProdBadReason")] + [HttpGet] + public object ProdBadReason(string BeginDate, string EndDate, string DeptName,string ICMOBillNo, string SourceName, string DeptType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (BeginDate == null || BeginDate.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonByProcReport '" + BeginDate + "','" + EndDate + "','" + DeptName + "','" + ICMOBillNo + "','" + + SourceName + "','" + DeptType + "'", "h_p_Sc_BadReasonByProcReport"); + } + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 鐩撮�氱巼鍛ㄦ姤琛ㄦ煡璇� + /// <summary> + /// 杩斿洖鐩撮�氱巼鍛ㄦ姤琛ㄥ垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/FirstPassRateWeek")] + [HttpGet] + public object FirstPassRateWeek(string Year, string DeptName, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (Year == null || Year.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateWeekReport '" + Year + "','" + DeptName + "'", "h_p_QC_FirstPassRateWeekReport"); + } + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 涓嶈壇鍘熷洜鎬讳綋缁熻鍒嗘瀽鎶ヨ〃鏌ヨ + /// <summary> + /// 杩斿洖涓嶈壇鍘熷洜鎬讳綋缁熻鍒嗘瀽鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/ProdBadReason_Sum")] + [HttpGet] + public object ProdBadReason_Sum(string BeginDate, string EndDate, string DeptName, string ICMOBillNo, string SourceName, string DeptType, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + if (BeginDate == null || BeginDate.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sc_BadReasonByProcReport_Sum '" + BeginDate + "','" + EndDate + "','" + DeptName + "','" + ICMOBillNo + "','" + + SourceName + "','" + DeptType + "'", "h_p_Sc_BadReasonByProcReport_Sum"); + } + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 璐ㄩ噺棰勮鎶ヨ〃鏌ヨ + /// <summary> + /// 杩斿洖璐ㄩ噺棰勮鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/ProductQtyWarning")] + [HttpGet] + public object ProductQtyWarning(DateTime HBeginDate, DateTime HEndDate, string DeptName) + { + try + { + List<object> columnNameList = new List<object>(); + + if (HBeginDate == null || HBeginDate.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋椂闂�"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_QC_FirstPassRateICMOReport '" + HBeginDate + "','" + HEndDate + "','" + DeptName + "'", "h_p_QC_FirstPassRateICMOReport"); + } + + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 璐ㄩ噺杩芥函鎶ヨ〃鎶ヨ〃鏌ヨ(棣栦欢妫�楠�) + /// <summary> + /// 杩斿洖璐ㄩ噺杩芥函鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/QualityTraceability1")] + [HttpGet] + public object QualityTraceability1(string HICMOBillNo, string HType) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); + + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[2].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[2]; + 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 璐ㄩ噺妯″潡 璐ㄩ噺杩芥函鎶ヨ〃鎶ヨ〃鏌ヨ锛堝伐搴忔楠岋級 + /// <summary> + /// 杩斿洖璐ㄩ噺杩芥函鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/QualityTraceability2")] + [HttpGet] + public object QualityTraceability2(string HICMOBillNo, string HType) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); + + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[3].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[3]; + 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 璐ㄩ噺妯″潡 璐ㄩ噺杩芥函鎶ヨ〃鎶ヨ〃鏌ヨ锛堢敓浜ф眹鎶ワ級 + /// <summary> + /// 杩斿洖璐ㄩ噺杩芥函鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/QualityTraceability3")] + [HttpGet] + public object QualityTraceability3(string HICMOBillNo, string HType) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); + + + //娣诲姞鍒楀悕 + 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 璐ㄩ噺妯″潡 璐ㄩ噺杩芥函鎶ヨ〃鎶ヨ〃鏌ヨ锛堣川閲忔眹鎶ワ級 + /// <summary> + /// 杩斿洖璐ㄩ噺杩芥函鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("QC_Report/QualityTraceability4")] + [HttpGet] + public object QualityTraceability4(string HICMOBillNo, string HType) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Sc_QueryQualityByICMOBill '" + HType + "','" + HICMOBillNo + "'", "h_p_Sc_QueryQualityByICMOBill"); + + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[1].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[1]; + 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 + + } +} diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" new file mode 100644 index 0000000..0a15bb7 --- /dev/null +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\346\212\245\350\241\250/Sc_ProductReportController.cs" @@ -0,0 +1,119 @@ +锘縰sing Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Pub_Class; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.IO; +using System.Web.Http; +using WebAPI.DLL; +using WebAPI.Models; +using WebAPI.Service; +using Kingdee.BOS.WebApi.Client; + +namespace WebAPI.Controllers +{ + public class Sc_ProductReportController : ApiController + { + private json objJsonResult = new json(); + public DataSet ds = new DataSet(); + public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + + #region 鐢熶骇妯″潡 鐢熶骇璁㈠崟棰嗘枡鐘舵�佹姤琛ㄦ煡璇� + /// <summary> + /// 杩斿洖鐢熶骇璁㈠崟棰嗘枡鐘舵�佹姤琛ㄥ垪琛� + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_Report/ProdOrderPickingStatus")] + [HttpGet] + public object ProdOrderPickingStatus(DateTime HBeginDate, DateTime HEndDate, string HICMOBillNo, string HDeptName, string HMaterNumber, string HMaterName, string HMaterModel) + { + try + { + List<object> columnNameList = new List<object>(); + + if (HBeginDate == null || HBeginDate.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨寮�濮嬫椂闂�"; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sc_ICMOBillPlanList '" + HBeginDate + "','" + HEndDate + "','" + HICMOBillNo + "','" + HMaterNumber + "','" + HMaterName + "','" + HMaterModel + "','" + HDeptName + "'", "h_p_Sc_ICMOBillPlanList"); + } + + //娣诲姞鍒楀悕 + 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 鐢熶骇妯″潡 搴撳瓨搴撻緞鍒嗘瀽鎶ヨ〃鏌ヨ + /// <summary> + /// 杩斿洖搴撳瓨搴撻緞鍒嗘瀽鎶ヨ〃鍒楄〃 + ///鍙傛暟锛歴tring sql銆� + ///杩斿洖鍊硷細object銆� + /// </summary> + [Route("Sc_Report/InventoryAge")] + [HttpGet] + public object InventoryAge(string HWhName, string HLot, string HMaterNumber, string HMaterName) + { + try + { + List<object> columnNameList = new List<object>(); + + ds = oCN.RunProcReturn("exec h_p_Kf_StockQtyDateTimesReport '" + HWhName + "','" + HLot + "','" + HMaterNumber + "','" + HMaterName + "'", "h_p_Kf_StockQtyDateTimesReport"); + + //娣诲姞鍒楀悕 + 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 + + } +} diff --git a/WebAPI/DLL/ClsSc_ICMOReportBill.cs b/WebAPI/DLL/ClsSc_ICMOReportBill.cs index 476118b..2db1745 100644 --- a/WebAPI/DLL/ClsSc_ICMOReportBill.cs +++ b/WebAPI/DLL/ClsSc_ICMOReportBill.cs @@ -3,6 +3,9 @@ using System.Text; using System.Data; using DBUtility; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using WebAPI.Models; namespace WebAPI.DLL { @@ -11,6 +14,8 @@ public Models.ClsSc_ICMOReportBillMain omodel = new Models.ClsSc_ICMOReportBillMain(); public Models.ClsSc_ICMOReportBillSub oSub = new Models.ClsSc_ICMOReportBillSub(); public List<Models.ClsSc_ICMOReportBillSub> DetailColl = new List<Models.ClsSc_ICMOReportBillSub>(); + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); + private json objJsonResult = new json(); public ClsSc_ICMOReportBill() { @@ -171,7 +176,7 @@ { oCn.RunProc("Insert into Sc_ICMOReportBillSub " + " (HInterID,HEntryID,HMaterID,HMaterNumber" + - ",HQty,HUnitID,HUnitNumber,HTimes,HSourceID" + + ",HQty,HBadQty,HUnitID,HUnitNumber,HTimes,HSourceID" + ",HQtyMust,HWorkerID,HWorkerNumber,HBadCount,HWasterQty," + "HCloseMan,HCloseType,HRemark," + "HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + @@ -185,7 +190,7 @@ ",HWhID,HSPID,HBatChNo,HAuxPropID,HMTONo,HPlanMode,HERPInterID,HERPEntryID" + ") values(" + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + oSub.HMaterID.ToString() + ",'" + oSub.HMaterNumber + "'" + - "," + oSub.HQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + + "," + oSub.HQty.ToString() + "," + oSub.HBadQty.ToString() + "," + oSub.HUnitID.ToString() + ",'" + oSub.HUnitNumber + "'," + oSub.HTimes.ToString() + "," + oSub.HSourceID.ToString() + "," + oSub.HQtyMust.ToString() + "," + oSub.HWorkerID.ToString() + ",'" + oSub.HWorkerNumber + "'," + oSub.HBadCount.ToString() + "," + oSub.HWasterQty.ToString() + ",'" + oSub.HCloseMan + "'," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + "," + oSub.HSourceInterID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + @@ -331,6 +336,217 @@ oCn.BeginTran(); oCn.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString()); + DataSet ds,Ds; + ds = oCn.RunProcReturn("select * from Sc_ICMOReportBillMain where HInterID = " + lngBillKey, "Sc_ICMOReportBillMain"); + string HBillNo = ""; + + if (ds.Tables[0].Rows.Count > 0) + { + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + } + + Ds = oCn.RunProcReturn("exec h_p_Kf_GetICMOReportBill_ICMO_CLD_WorkQty " + lngBillKey.ToString() + ",'" + HBillNo + "'", "h_p_Kf_GetICMOReportBill_ICMO_CLD_WorkQty"); + + if (Ds == null || Ds.Tables[0].Rows.Count == 0 || Ds.Tables[1].Rows.Count == 0) + { + LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鑾峰彇json瀛愯〃淇℃伅澶辫触"); + oCn.RollBack(); + return false; + } + else + { + LogService.Write("鑾峰彇json瀛愯〃淇℃伅鎴愬姛"); + string sJson_ZYMESFLAG = ""; //鐢熶骇姹囨姤鍗曞悓姝ES鏍囪 + sJson_ZYMESFLAG = Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FHZYMESFLAG"]); + + string sJson_Main = "{\"Creator\":\"\",\"NeedUpDateFields\":[],\"NeedReturnFields\":[],\"IsDeleteEntry\":\"True\",\"SubSystemId\":\"\",\"IsVerifyBaseDataField\":\"false\"," + + "\"IsEntryBatchFill\":\"false\",\"ValidateFlag\":\"True\",\"NumberSearch\":\"True\",\"InterationFlags\":\"\"," + + "\"Model\": { \"FBILLNO\":\"" + HBillNo + "\"," + + //"\"FID\":\"" + oMain.HInterID.ToString() + "\"," + + "\"FBillType\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FBillType"]) + "\"}," + + //\"FDocumentStatus\":\"\", + "\"FDate\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FDate"]) + "\"," + + "\"FPRDORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["FPRDORGID"]) + "\"}," + + //\"FWorkshipIdH\":{\"FNumber\":\"\"}, + //\"FDescription\":\"\", + sJson_ZYMESFLAG + + "\"FEntity\": [ "; + string sJson_Entry = ""; + for (int i = 0; i < Ds.Tables[1].Rows.Count; i++) + { + if (sJson_Entry != "") + { + sJson_Entry = sJson_Entry + " , "; + } + string sJson_BatchNo = ""; + string sJson_StockPlace = ""; + string sJson_EntryCustom = ""; + if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HISBATCHMANAGE"]) == "1") //鏄惁鍚敤鎵规绠$悊 + { + sJson_BatchNo = " \"FLOT\": {\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\"}, \"FLOT_TEXT\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FLOT"]) + "\" , "; + } + else + { + sJson_BatchNo = ""; + } + //浠撲綅 + if (Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) == "") + { + sJson_StockPlace = ""; + } + else + { + sJson_StockPlace = Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKLOCID"]) + "\"}},"; + } + + //鑷畾涔夊瓧娈靛鐞� + if (oSystemParameter.omodel.WMS_CampanyName == "鍥涚淮灏�") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� 绌虹櫧涓洪�氱敤 + { + sJson_EntryCustom = "\"FBILLSTATUS\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBILLSTATUS"]) + "\"," + //鍗曟嵁鐘舵�� + "\"F_abcd_Datetime\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["F_abcd_Datetime"]) + "\","; //璁″垝寮�宸ユ棩鏈� + } + // + sJson_Entry = sJson_Entry + " {" + + //" \"FEntryID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["HEntryID"]) + "," + + " \"FSRCENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYID"]) + "," + + " \"FIsNew\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FIsNew"]) + "," + + " \"FMATERIALID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMATERIALID"]) + "\"}," + + " \"FPRODUCTTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPRODUCTTYPE"]) + "\"," + + " \"FREPORTTYPE\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREPORTTYPE"]) + "\"}," + + " \"FUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FUNITID"]) + "\"}," + + " \"FWORKSHIPID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FWORKSHOPID"]) + "\"}," + + //\"FShiftGroupId\":{\"FNumber\":\"\"}, + sJson_BatchNo + + //\"FDeptId\":{\"FNumber\":\"\"}, + sJson_StockPlace + + " \"FMTONO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMTONO"]) + "\"," + + " \"FCHECKPRODUCT\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCHECKPRODUCT"]) + "," + + " \"FISENTRUST\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISENTRUST"]) + "," + + " \"FSRCBILLTYPE\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLTYPE"]) + "\"," + + " \"FMOBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOBILLNO"]) + "\"," + + " \"FAUXPROPID\":{\"FAUXPROPID__FF100002\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FAUXPROPID"]) + "\"}}," + + //\"FHumanQty\":\"0\", + " \"FSRCBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCBILLNO"]) + "\"," + + //\"FMachineQty\":\"0\", + //\"FMaterialUnitID\":{\"FNumber\":\"\"}, + //\"FStartTime\":\"1900-01-01\", + //\"FEndTime\":\"1900-01-01\", + //\"FTimeUnitId\":\"\", + " \"FMOENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYSEQ"]) + "," + + //" \"FSTANDHOURUNITID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTANDHOURUNITID"]) + "\"," + + " \"FPROJECTNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FPROJECTNO"]) + "\"," + + " \"FSTDMANHOUR\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTDMANHOUR"]) + "," + + " \"FHRPREPARETIME\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FHRPREPARETIME"]) + "," + + //\"FHrWorkTime\":\"0\", + " \"FMACPREPARETIME\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMACPREPARETIME"]) + "," + + //\"FMacWorkTime\":\"0\", + //\"FDescriptionE\":\"\", + " \"FSRCINTERID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCINTERID"]) + "," + + " \"FSRCENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSRCENTRYSEQ"]) + "," + + " \"FMOID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOID"]) + "," + + " \"FMOENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOENTRYID"]) + "," + + " \"FBASEUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEUNITID"]) + "\"}," + + " \"FSTOCKINORGID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKINORGID"]) + "\"}," + + " \"FBOMID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBOMID"]) + "\"}," + + " \"FOWNERTYPEID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERTYPEID"]) + "\"," + + " \"FOWNERID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FOWNERID"]) + "\"}," + + " \"FSTOCKID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSTOCKID"]) + "\"}," + + " \"FCOSTRATE\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FCOSTRATE"]) + "," + + " \"FSNUNITID\":{\"FNumber\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FSNUNITID"]) + "\"}," + + //\"FSNQty\":\"0\", + //\"FProduceDate\":\"1900-01-01\", + //\"FExpiryDate\":\"1900-01-01\", + " \"FISBACKFLUSH\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FISBACKFLUSH"]) + "," + + " \"FMOMAINENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FMOMAINENTRYID"]) + "," + + " \"FQAIP\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQAIP"]) + "\"," + + " \"FREQSRC\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQSRC"]) + "\"," + + " \"FREQBILLNO\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLNO"]) + "\"," + + " \"FREQBILLID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQBILLID"]) + "," + + " \"FREQENTRYSEQ\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYSEQ"]) + "," + + " \"FREQENTRYID\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FREQENTRYID"]) + "," + + " \"FBASEQUAQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEQUAQTY"]) + "," + + " \"FQUAQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FQUAQTY"]) + "," + + " \"FBASEFINISHQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBASEFINISHQTY"]) + "," + + " \"FFINISHQTY\":" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FFINISHQTY"]) + "," + + sJson_EntryCustom + + + //\"FSerialSubEntity\":[{\"FDetailID\":\"0\", + //\"FQCMaterialId\":{\"FNUMBER\":\"\"}, + //\"FInspectResult\":\"\", + //\"FQcAuxPropId\":{\"FQCAUXPROPID__FF100002\":{\"FNumber\":\"\"}}, + //\"FQCQty\":\"0\", + //\"FSerialNo\":\"\", + //\"FSerialId\":{\"FNUMBER\":\"\"}, + //\"FQCStockInSelQty\":\"0\", + //\"FSerialNote\":\"\", + //\"FBaseQCQty\":\"0\", + //\"FBaseQCStockInSelQty\":\"0\"}] + + " \"FEntity_Link\": [{" + + " \"FEntity_Link_FFlowId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowId"]) + "\"," + + " \"FEntity_Link_FFlowLineId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FFlowLineId"]) + "\"," + + " \"FEntity_Link_FRuleId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FRuleId"]) + "\"," + + " \"FEntity_Link_FSTableName\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSTableName"]) + "\"," + + " \"FEntity_Link_FSBillId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSBillId"]) + "\"," + + " \"FEntity_Link_FSId\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FEntity_Link_FSId"]) + "\"" + + " } ]," + + " \"FBFLOWID\":{\"FID\":\"" + Pub_Class.ClsPub.isStrNull(Ds.Tables[1].Rows[i]["FBFLOWID"]) + "\"}}"; + } + string sJson_End = " ] }}"; + string sJson = sJson_Main + sJson_Entry + sJson_End; + + //浠庨厤缃枃浠惰幏鍙� CLOUD缃戝潃銆佽处濂椾俊鎭�佺櫥褰曠敤鎴枫�佺櫥褰曞瘑鐮� + if (!Pub_Class.ClsPub.GetCLOUDLoginInfo(ref Pub_Class.ClsPub.sExeReturnInfo)) + { + LogService.Write("鐢熶骇姹囨姤鍗曞鏍革紝鍚屾鑾峰彇鐧诲綍璐﹀彿瀵嗙爜澶辫触"); + + return false; + } + + var loginRet = InvokeHelper.Login(); + var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); + if (isSuccess == 0) + { + oCn.RollBack(); + return false; + } + else + { + LogService.Write("寮�濮嬭皟鐢ㄤ繚瀛樻柟娉�"); + string result = InvokeHelper.Save("PRD_MORPT", JsonConvert.SerializeObject(sJson));//淇濆瓨 + + if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + LogService.Write("鐢熶骇姹囨姤閿欒jsonRoot:" + sJson); + oCn.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞悓姝ラ噾铦朵簯澶辫触锛佸崟鍙�:{HBillNo.ToString()}" + result + sJson; + objJsonResult.data = null; + return false; + } + + //鎻愪氦瀹℃牳 + string result1 = string.Empty; + string result2 = string.Empty; + if (oSystemParameter.omodel.Sc_ICMOReportBill_AutoCheck == "Y") //绯荤粺鍙傛暟 鑷姩瀹℃牳 + { + result1 = InvokeHelper.Submit("PRD_MORPT", JsonConvert.SerializeObject(sJson));//鎻愪氦 + result2 = InvokeHelper.Audit("PRD_MORPT", JsonConvert.SerializeObject(sJson));//瀹℃牳 + + if (JObject.Parse(result1)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") + { + oCn.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = $"鐢熶骇姹囨姤鍗曞崟鍙凤細{HBillNo}锛屾彁浜ゅけ璐�" + result; + objJsonResult.data = null; + return false; + } + } + } + } + sReturn = "瀹℃牳鍗曟嵁鎴愬姛锛�"; oCn.Commit(); diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index d84a49d..1a57d83 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -499,6 +499,7 @@ <Compile Include="Controllers\鍝佽川绠$悊\瀹㈣瘔澶勭悊鍗昞Crm_CustomerAppealBillController.cs" /> <Compile Include="Controllers\鍝佽川绠$悊\宸℃鍗昞QC_PatrolProcCheckBillController.cs" /> <Compile Include="Controllers\鍝佽川绠$悊\宸ュ簭妫�楠屽崟\MES_ProcessCheckBill_PDAController.cs" /> + <Compile Include="Controllers\鍝佽川绠$悊\璐ㄩ噺鎶ヨ〃\QC_QualityReportsController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_COMMONCONTACTBillController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_CustLocationController.cs" /> <Compile Include="Controllers\鍩虹璧勬枡\鍩虹璧勬枡\Gy_DutyBillController.cs" /> @@ -605,6 +606,7 @@ <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_MESStopStepWorkBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鎶ュ伐鍙板伐搴廫Sc_QualityReportStepBillController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\鐢熶骇浠诲姟鍗昞Sc_ICMOBillController.cs" /> + <Compile Include="Controllers\鐢熶骇绠$悊\鐢熶骇鎶ヨ〃\Sc_ProductReportController.cs" /> <Compile Include="Controllers\鐢熶骇绠$悊\璐ㄩ噺姹囨姤鍗昞Sc_QualityReportBillController.cs" /> <Compile Include="Controllers\椤圭洰绠$悊\涓氱哗鎸囨爣\PM_YearEmployeeMoneyBillController.cs" /> <Compile Include="Controllers\椤圭洰绠$悊\宸ヤ綔浠诲姟\PM_WorkTaskBillController.cs" /> -- Gitblit v1.9.1