From 15316f51a5e129c2ebcf8dabff4ac30c1ee1dc32 Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期一, 17 三月 2025 19:22:23 +0800 Subject: [PATCH] 提料报表添加供应商过滤 --- WebAPI/Controllers/生产管理/质量汇报单/Sc_QualityReportBillController.cs | 191 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 178 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 dc96ce4..4b7b638 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" @@ -91,18 +91,26 @@ { 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 " + + ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID,a.HSourceID,s.HName HSourceName" + + ",a.HSourceBillNo,a.HSourceInterID,a.HSourceEntryID,a.HDatePlanQty,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName,a.HProcID,p.HName HProcName" + " from Sc_ICMOBillStatus_Tmp a " + " left join Gy_Material m on a.HMaterID=m.HItemID " + + " left join Gy_Department d on a.HDeptID=d.HItemID " + + " left join Gy_Unit u on m.HUnitID=u.HItemID " + + " left join Gy_Source s on a.HSourceID=s.HItemID " + + " left join Gy_Process p on a.HProcID = p.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 " + + ("select a.HInterID,a.HBillType,a.HICMOBillNo,a.HICMOInterID,a.HMaterID,a.HSourceID,s.HName HSourceName" + + ",m.HNumber HMaterNumber,m.HName HMaterName,m.HModel HMaterModel,a.HICMOEntryID,a.HDeptID,d.HName HDeptName,m.HUnitID,u.HName HUnitName,a.HProcID,p.HName HProcName " + " from Sc_ICMOBillStatus_Tmp a " + " left join Gy_Material m on a.HMaterID=m.HItemID " + + " left join Gy_Department d on a.HDeptID=d.HItemID " + + " left join Gy_Unit u on m.HUnitID=u.HItemID " + + " left join Gy_Source s on a.HSourceID=s.HItemID " + + " left join Gy_Process p on a.HProcID = p.HItemID " + " Where a.HInterID=" + HInterID + " and a.HBillType=" + HBillType, "Sc_ICMOBillStatus_Tmp"); } @@ -231,6 +239,7 @@ BillNew.HMaterID = mainList[0].HMaterID; BillNew.HSourceID = mainList[0].HSourceID; BillNew.HGroupID = mainList[0].HGroupID; + BillNew.HDeptID = mainList[0].HDeptID; BillNew.HCheckManID = mainList[0].HCheckManID; BillNew.HBadReasonID = mainList[0].HBadReasonID; BillNew.HBarCode = mainList[0].HBarCode; @@ -246,13 +255,13 @@ oCN.RunProc("Insert Into Sc_ICMOBillQualityStatus_Tmp " + " (HInterID,HBillNo,HDate,HICMOBillNo,HICMOInterID" + ",HProcExchBillNo,HProcExchInterID,HProcExchEntryID,HProcID,HMaterID" + - ",HSourceID,HGroupID,HCheckManID,HBadReasonID,HBarCode" + + ",HSourceID,HGroupID,HDeptID,HCheckManID,HBadReasonID,HBarCode" + ",HMaker,HMakeDate,HBillType,HReportType,HSourceBillNo" + ",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.HSourceID + "," + BillNew.HGroupID + "," + BillNew.HDeptID + "," + 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.HBadReasonHQty + ") "); @@ -631,7 +640,7 @@ #region 鎻愪氦淇濆瓨锛屽瓨涓诲瓙琛ㄥ強鏄庣粏琛� [Route("Sc_QualityReportBill/set_SaveBill")] [HttpGet] - public object set_SaveBill(long HInterID,string HBillNo, string HChecker) + public object set_SaveBill(long HInterID,string HBillNo, string HChecker,string HBillSubType) { try { @@ -663,11 +672,11 @@ ds = oCN.RunProcReturn(sql, "Sc_QualityReportBillSub"); if (ds.Tables[0].Rows.Count>0) { - oCN.RunProc("exec h_p_save_Sc_QualityReportBillSum " + HInterID + ""); + oCN.RunProc("exec h_p_save_Sc_QualityReportBillSum '" + HInterID + "','" + HBillSubType +"'"); } else { - oCN.RunProc("exec h_p_save_Sc_QualityReportBill " + HInterID + ""); + oCN.RunProc("exec h_p_save_Sc_QualityReportBill '" + HInterID + "','" + HBillSubType + "'"); } //鍒ゆ柇鏄惁鍏佽淇濆瓨锛屼笉鍏佽鍒欏洖婊� @@ -790,7 +799,7 @@ 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" + + ",HMaterID,HUnitID,HQty,HResult,HEmpID,HSourceID,HProcID,HBadReasonID,HBadReasonNumber,HBadPhenomenaID,HGroupID" + ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcExchInterID,HProcExchEntryID,HProcExchBillNo" + ",HBarCode,HReportType" + ",HAddr,HMaker,HMakeDate" + @@ -812,8 +821,10 @@ "','" + oSub.HResult + "'" + "," + oSub.HEmpID.ToString() + "" + "," + oSub.HSourceID.ToString() + "" + + "," + oSub.HProcID.ToString() + "" + "," + oSub.HBadReasonID.ToString() + "" + ",'" + oSub.HBadReasonNumber.ToString() + "'" + + "," + oSub.HBadPhenomenaID.ToString() + "" + ",'" + oSub.HGroupID.ToString() + "'" + "," + oSub.HICMOInterID.ToString() + "" + @@ -827,7 +838,7 @@ ",'" + 1 + "','" + oSub.HAddr + "'" + ",'" + msg4 + "'" + - ",'" + oSub.HMakeDate.ToShortDateString() + "'" + + ",GETDATE()" + ") "; oCN.RunProc(subSql); @@ -848,8 +859,6 @@ } } #endregion - - @@ -1942,5 +1951,161 @@ } #endregion + #region 鐢熶骇璐ㄩ噺姹囨姤鍗昣PDA 鏂板 + [Route("Sc_QualityReportBill/SaveSc_QualityReportBill_PDA")] + [HttpPost] + public object SaveSc_QualityReportBill_PDA([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(); + string s = ""; + try + { + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Sc_QualityReportBill_Edit", 1, false, msg4)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + DAL.ClsSc_QualityReportBill oBill = new DAL.ClsSc_QualityReportBill(); + List<Model.ClsSc_QualityReportBillMain> lsmain = new List<Model.ClsSc_QualityReportBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Sc_QualityReportBillMain(msg2); + foreach (Model.ClsSc_QualityReportBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (BillOld.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (BillOld.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = s + "锛屼笉鍏佽淇敼"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + + + //琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Model.ClsSc_QualityReportBillSub> ls = new List<Model.ClsSc_QualityReportBillSub>(); + ls = oListModels.getObjectByJson_Sc_QualityReportBillSub(msg3); + int i = 0; + foreach (Model.ClsSc_QualityReportBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + oBill.DetailColl.Add(oItemSub); + } + + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (refSav == "Add") + { + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1