From 45287b320a336177ae2398e8bd9d07dd7ed2718c Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期三, 24 四月 2024 14:09:52 +0800
Subject: [PATCH] 对色记录优化
---
WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs | 355 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 317 insertions(+), 38 deletions(-)
diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
index 08d65e6..134f9dc 100644
--- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs
@@ -1167,7 +1167,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,8 +1209,11 @@
//oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
//oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺
//oItemSub.HRelationMoney = 0; //鍏宠仈閲戦
- oBill.DetailColl.Add(oItemSub);
+ if (oItemSub.HMaterID != 0)
+ {
+ oBill.DetailColl.Add(oItemSub);
+ }
}
//淇濆瓨
//淇濆瓨瀹屾瘯鍚庡鐞�
@@ -1492,6 +1495,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
@@ -1623,6 +1638,7 @@
{
string ModRightNameCheck = "Xs_SeOrderBill_Close";
DBUtility.ClsPub.CurUserName = CurUserName;
+ string sql = "";
try
{
//妫�鏌ユ潈闄�
@@ -1689,6 +1705,18 @@
objJsonResult.data = null;
return objJsonResult;
}
+
+ //鍒ゆ柇鍗曟嵁鏄惁涓鸿嚜鍔ㄥ叧闂�
+ sql = "select * from Xs_SeOrderBillMain where HInterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain");
+ if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍗曟嵁涓鸿嚜鍔ㄥ叧闂紝涓嶈兘杩涜鎵嬪姩鍙嶅叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
}
}
else
@@ -1724,22 +1752,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 = "鍙嶅叧闂垚鍔�";
@@ -1752,6 +1776,195 @@
objJsonResult.count = 0;
objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍏抽棴澶辫触鎴栬�呭弽鍏抽棴澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 閿�鍞鍗� 琛屽叧闂�/琛屽弽鍏抽棴
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+ /// <param name="CurUserName">鍏抽棴浜�</param>
+ /// <returns></returns>
+ [Route("Xs_SeOrderBill/CloseRowXs_SeOrderBill")]
+ [HttpGet]
+ public object CloseRowXs_SeOrderBill(int HInterID,int HEntryID, int IsAudit, string CurUserName)
+ {
+ string ModRightNameCheck = "Xs_SeOrderBill_Close";
+ string SubBillName = "Xs_SeOrderBillSub"; //瀛愯〃琛ㄥ悕
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ DataSet ds = null;
+ try
+ {
+ //妫�鏌ユ潈闄�
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽叧闂け璐ワ紒鏃犳潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+ DAL.ClsXs_SeOrderBill oBill = new DAL.ClsXs_SeOrderBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HChecker.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
+ ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillSub");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璇ヨ鏁版嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (IsAudit == 0) //琛屽叧闂垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //琛屽弽鍏抽棴鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屾湭鍏抽棴!涓嶉渶瑕佸啀琛屽弽鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+ string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
+ if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽弽鍏抽棴澶辫触!琛屼负鑷姩鍏抽棴锛屼笉鑳借繘琛屾墜鍔ㄥ弽鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ //杩涜闇�瑕佽繘琛岀殑琛屽叧闂�/琛屽弽鍏抽棴鎿嶄綔
+ if (IsAudit == 0) //琛屽叧闂彁浜�
+ {
+ //琛屽叧闂彁浜�
+ if (oBill.CloseRow(lngBillKey,HEntryID,oBill.omodel.HBillNo,CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "琛屽叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ 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
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ oBill.oCn.RollBack();
return objJsonResult;
}
}
@@ -2028,29 +2241,7 @@
}
else
{
- string sql = "select * from Gy_UserCustomerRelation where HUserID = '" + CurUserID + "'";
- ds = oCN.RunProcReturn(sql, "Gy_UserCustomerRelation");
- if (ds == null || ds.Tables[0].Rows.Count == 0)
- {
- sWhere = " and 1 = 0";
- }
- else
- {
- sWhere = " and HCusID in (";
- for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- if (i < ds.Tables[0].Rows.Count - 1)
- {
- sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ",";
- }
- else
- {
- sWhere += ds.Tables[0].Rows[i]["HCusID"].ToString() + ")";
- }
- }
- }
-
- //sWhere = " and 1=1 ";
+ sWhere = " and HCusID in (select hcusid from Gy_UserCustomerRelation Where HUserID = '" + CurUserID + "' union all select 166351 hcusid)";
}
objJsonResult.code = "1";
@@ -2284,5 +2475,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