From 1442ce6fc7e370c4a9cfeb356ca198ea78e9bcd1 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期日, 30 六月 2024 16:04:59 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs | 262 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 240 insertions(+), 22 deletions(-) diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs index f81653f..ffa19b0 100644 --- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs +++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs @@ -87,12 +87,12 @@ if (sWhere == null || sWhere.Equals("")) { - ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc", "h_v_IF_SeOrderBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList order by hmainid desc,hsubid asc", "h_v_IF_SeOrderBillList"); } else { string sql1 = "select * from h_v_IF_SeOrderBillList where 1 = 1 "; - string sql = sql1 + sWhere+ " order by hmainid desc"; + string sql = sql1 + sWhere+ " order by hmainid desc,hsubid asc"; ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList"); } @@ -442,7 +442,7 @@ { try { - //LogService.Write("閿�鍞鍗曞悓姝�,淇濆瓨鏂规硶鎵ц瀹屾垚寮傚父锛�" + sMainSub.ToString()); + LogService.Write("閿�鍞鍗曞悓姝ワ細" + sMainSub.ToString()); var model = sMainSub["model"].ToString(); var entry = sMainSub["model"]["HENTRY"].ToString(); @@ -456,6 +456,21 @@ oCN.RunProc(sql); sql = $"delete Xs_SeOrderBillSub where HinterID = {mainList[0].HInterID}"; oCN.RunProc(sql); + + LogService.Write("閿�鍞鍗曞悓姝ワ細" + @"Insert Into Xs_SeOrderBillMain + (HInterID, HYear, HPeriod, HBillType, HBillSubType, HDate + , HBillNo, HBillStatus + , HAddress, HSSID, HSSDate, HCusID, HCurID, HExRate + , HEmpID, HManagerID, HDeptID, HExplanation, HRemark, HInnerBillNo + , HChecker, HCheckDate, HMaker, HMakeDate, HCloseMan, HCloseDate + , HERPInterID, HERPBillType, HSALEORGID, HSALEGROUPID, HRECEIVEID, HSETTLEID + , HCHARGEID, HHEADLOCID, HRECCONTACTID, HCORRESPONDORGID, HBUSINESSTYPE) + values(" + mainList[0].HInterID + ", " + DateTime.Now.Year + ", " + DateTime.Now.Month + ", '" + 1401 + "', '" + + mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "','" + mainList[0].HBillStatus + "','" + mainList[0].HAddress + "'," + mainList[0].HSSID + + ",'" + mainList[0].HSSDate + "'," + mainList[0].HCusID + "," + mainList[0].HCurID + "," + mainList[0].HExRate + "," + mainList[0].HEmpID + "," + mainList[0].HManagerID + "," + mainList[0].HDeptID + ",'" + mainList[0].HExplanation + "','" + mainList[0].HRemark + "','" + + mainList[0].HInnerBillNo + "','" + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HMaker + "','" + mainList[0].HMakeDate + "','" + + mainList[0].HCloseMan + "','" + mainList[0].HCloseDate + "'," + mainList[0].HERPInterID + ",'" + + mainList[0].HERPBillType + "'," + mainList[0].HSALEORGID + "," + mainList[0].HSALEGROUPID + "," + mainList[0].HRECEIVEID + "," + mainList[0].HSETTLEID + "," + mainList[0].HCHARGEID + "," + mainList[0].HHEADLOCID + "," + mainList[0].HRECCONTACTID + "," + mainList[0].HCORRESPONDORGID + ",'" + mainList[0].HBUSINESSTYPE + "'" + ")"); //涓昏〃 oCN.RunProc(@"Insert Into Xs_SeOrderBillMain (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate @@ -1167,7 +1182,7 @@ } UserName = oItem.HMaker; //鍒跺崟浜� oItem.HBillType = "1401"; - oItem.HBillSubType = "1401"; + //oItem.HBillSubType = "1401"; oItem.HSALEORGID = oItem.HOrgID; oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); @@ -1209,9 +1224,23 @@ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 //oItemSub.HRelationMoney = 0; //鍏宠仈閲戦 - oBill.DetailColl.Add(oItemSub); + if (oItemSub.HMaterID != 0) + { + oBill.DetailColl.Add(oItemSub); + } } + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //淇濆瓨 //淇濆瓨瀹屾瘯鍚庡鐞� bool bResult; @@ -1265,7 +1294,7 @@ try { - ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID, "h_v_IF_SeOrderBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid =" + HInterID + " order by hsubid asc", "h_v_IF_SeOrderBillList"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -1362,10 +1391,36 @@ } //================================================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + oCN.BeginTran(); oCN.RunProc("delete from Xs_SeOrderBillMain where HInterID = " + HInterID); oCN.RunProc("delete from Xs_SeOrderBillSub where HInterID='" + HInterID + "'"); + + + //鍐欏叆鏃ュ織 + string Operation = "鍒犻櫎"; + string ComputerName = System.Net.Dns.GetHostName(); //璁惧鍚嶇О + string WorkList = Operation + "鍗曟嵁锛屽崟鎹彿锛�" + BillOld.omodel.HBillNo; + string MvarReportTitle = BillOld.MvarReportTitle; //妯″潡 + string SystemName = "LMES-" + MvarReportTitle + "妯″潡"; + string IPAddress = ""; + //string IPAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].ToString(); //IP鍦板潃 + //string IPAddress = System.Web.HttpContext.Current.Request.UserHostAddress; + + oCN.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + user + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','" + Operation + "')" + ); + //鍒犻櫎鍚庢帶鍒�================================================================================== string sql2 = "exec h_p_Xs_SeOrderBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; @@ -1492,6 +1547,18 @@ objJsonResult.data = null; return objJsonResult; } + + foreach(Model.ClsXs_SeOrderBillSub oSub in oBill.DetailColl) + { + if (oSub.HCloseMan != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓瓨鍦ㄨ鍏抽棴鐨勮褰�!鍙嶅鏍稿け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + } } } else @@ -1539,6 +1606,17 @@ } //================================================================================== + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } + //瀹℃牳鎻愪氦 if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_SeOrderBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { @@ -1578,6 +1656,17 @@ return objJsonResult; } //========================================================= + + //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗 + string s = ""; + int sYear = 0; + int sPeriod = 0; + DateTime HDate = DateTime.Now; + if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) + { + objJsonResult.Message = s; + return objJsonResult; + } //鍙嶅鏍告彁浜bandonCheck if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_SeOrderBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) @@ -1717,9 +1806,40 @@ //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣� if (IsAudit == 0) //鍏抽棴鎻愪氦 { + oBill.oCn.BeginTran(); //鍏抽棴鎻愪氦 if (oBill.CloseBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { + //鍏抽棴鍚庢帶鍒�========================================= + string sql_afterClose = "exec h_p_Xs_SeOrderBill_AfterCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; + DataSet ds_afterClose = oBill.oCn.RunProcReturn(sql_afterClose, "h_p_Xs_SeOrderBill_AfterCloseCtrl"); + if (ds_afterClose == null || ds_afterClose.Tables[0].Rows.Count <= 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛屽師鍥狅細鍏抽棴鍚庢帶鍒堕敊璇紝璇疯仈绯荤綉缁滅鐞嗕汉鍛橈紒"; + objJsonResult.data = null; + oBill.oCn.RollBack(); + + return objJsonResult; + } + else + { + if (ds_afterClose.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触锛屽師鍥狅細" + ds_afterClose.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + oBill.oCn.RollBack(); + + return objJsonResult; + } + } + //========================================= + + oBill.oCn.Commit(); + objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鍏抽棴鎴愬姛"; @@ -1728,6 +1848,8 @@ } else { + oBill.oCn.RollBack(); + objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; @@ -1737,22 +1859,18 @@ } if (IsAudit == 1) //鍙嶅叧闂彁浜� { - oBill.oCn.BeginTran(); + ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); + if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + return objJsonResult; + } //鍙嶅叧闂彁浜� if (oBill.CancelClose(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) { - ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); - if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); - objJsonResult.data = null; - oBill.oCn.RollBack(); - return objJsonResult; - } - - oBill.oCn.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鍙嶅叧闂垚鍔�"; @@ -1765,7 +1883,6 @@ objJsonResult.count = 0; objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; - oBill.oCn.RollBack(); return objJsonResult; } } @@ -1908,7 +2025,7 @@ if (IsAudit == 0) //琛屽叧闂彁浜� { //琛屽叧闂彁浜� - if (oBill.CloseRow(lngBillKey,HEntryID,oBill.omodel.HBillNo,CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) + if (oBill.CloseRow(lngBillKey,HEntryID,oBill.omodel.HBillNo,CurUserName, "h_p_Xs_SeOrderBill_AfterEntryCloseCtrl", ref DBUtility.ClsPub.sExeReturnInfo) == true) { objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1927,13 +2044,25 @@ } if (IsAudit == 1) //琛屽弽鍏抽棴鎻愪氦 { + oBill.oCn.BeginTran(); //琛屽弽鍏抽棴鎻愪氦 if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) { + ds = oCN.RunProcReturn("exec h_p_Kf_CheckSeOrderBill_CrediControl " + oBill.omodel.HInterID, "h_p_Kf_CheckSeOrderBill_CrediControl"); + if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + oBill.oCn.RollBack(); + return objJsonResult; + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "鍙嶅叧闂垚鍔�"; objJsonResult.data = null; + oBill.oCn.Commit(); return objJsonResult; } else @@ -1942,6 +2071,7 @@ objJsonResult.count = 0; objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; + oBill.oCn.RollBack(); return objJsonResult; } } @@ -2218,7 +2348,7 @@ } else { - sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "') "; + sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "' union all select 166351 hcusid)"; } objJsonResult.code = "1"; @@ -2452,5 +2582,93 @@ } } #endregion + + #region 閿�鍞鍗� 鏍规嵁鑱屽憳鑾峰彇閮ㄩ棬銆佷富绠� + [Route("Xs_SeOrderBill/getEmpInfoByHEmpID")] + [HttpGet] + public object getEmpInfoByHEmpID(long HEmpID) + { + try + { + string sql = "select a.HItemID HEmpID,a.HName HEmpName,ISNULL(a.HDeptID,0) HDeptID,b.HName HDeptName,ISNULL(b.HEmpID,0) HManagerID,c.HName HManagerName " + + " from Gy_Employee as a " + + " left join Gy_Department as b on a.HDeptID = b.HItemID " + + " left join Gy_Employee as c on b.HEmpID = c.HItemID " + + " where a.HItemID = " + HEmpID; + ds = oCN.RunProcReturn(sql, "Gy_Employee"); + + + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌璇ヨ亴鍛樹俊鎭紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 閿�鍞鍗� 鑾峰彇鎺掑簭鍚庣殑鏁版嵁 + [Route("Xs_SeOrderBill/sortList")] + [HttpGet] + public object sortList(string sWhere, string user) + { + try + { + //鍒ゆ柇鏌ヨ鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Xs_SeOrderBillQuery", 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_IF_SeOrderBillList order by hmainid desc", "h_v_IF_SeOrderBillList"); + } + else + { + string sql1 = "select * from h_v_IF_SeOrderBillList where 1 = 1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "h_v_IF_SeOrderBillList"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + 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