From 4ca8ab6ae136d3a99211240aab3867a7962ab9ef Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 05 八月 2024 15:03:52 +0800
Subject: [PATCH] 采购订单多级审核添加
---
WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs | 160 ++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 122 insertions(+), 38 deletions(-)
diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
index 7a44c8f..bfeb542 100644
--- a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs
@@ -76,6 +76,7 @@
{
try
{
+ List<object> columnNameList = new List<object>(); //瀹氫箟澹版槑鍙橀噺 锛屾妸閫氳繃 new List<object>()鍒涘缓鐨� 瀹炰緥锛岃祴鍊肩粰鍙橀噺
//鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user))
{
@@ -86,6 +87,7 @@
return objJsonResult;
}
+ //if(sWhere=="" || sWhere==null)
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList order by hmainid desc", "h_v_IF_POInStockBillList");
@@ -96,13 +98,19 @@
string sql = sql1 + sWhere + " order by 鏃ユ湡 desc,hmainid desc";
ds = oCN.RunProcReturn(sql, "h_v_IF_POInStockBillList");
}
-
+ foreach (DataColumn col in ds.Tables[0].Columns)//閬嶅巻ds涓涓�涓〃锛圱ables[0]锛夌殑鎵�鏈夊垪锛圕olumns锛夋瘡娆″惊鐜腑锛宑ol鍙橀噺浼氭寔鏈夊綋鍓嶅垪鐨勫紩鐢�
+ {
+ Type dataType = col.DataType; //鑾峰彇褰撳墠鏁版嵁绫诲瀷浼犲叆 鑷畾涔夊彉閲廳atadataType
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //瀛楃涓叉嫾鎺� // 灏嗗垪鍚嶅拰鏁版嵁绫诲瀷淇℃伅鎷兼帴鎴愪竴涓狫SON鏍煎紡鐨勫瓧绗︿覆
+ 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.Tables[0];
+ objJsonResult.data = ds.Tables[0];//浠g爜灏嗙涓�涓狣ataTable锛堢储寮曚负0锛夎祴鍊肩粰objJsonResult鐨刣ata灞炴��
+ objJsonResult.list = columnNameList;//灏哻olumnNameList璧嬪�肩粰objJsonResult鐨刲ist灞炴��
return objJsonResult;
//}
//else
@@ -192,6 +200,18 @@
//==================================================================================
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ 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;
+ }
+
+
//鍏堝垹闄� 閲戣澏鏁版嵁
objJsonResult = DeleteKingDee(HInterID);
if (objJsonResult.code == "0")
@@ -199,30 +219,38 @@
oCN.BeginTran(); //寮�濮嬩簨鍔�
//鏌ヨ鏁版嵁
- ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain a inner join Cg_POInStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '" + HInterID + "'", "Kf_ICStockBillMain");
- //鎵ц瀛樺偍杩囩▼杩涜鍙嶅啓
- dss = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain");
- var sReturn = "";
- if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0)
- {
- sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = sReturn;
- objJsonResult.data = null;
- return objJsonResult;
- }
- if (ds.Tables[0].Rows.Count == 1)
- {
- oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
- oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
- }
- else
- {
- oCN.RunProc($"delete Cg_POInStockBillSub where HInterID={ HInterID}and HEntryID={HsupId}");
- }
+ ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain a inner join Cg_POInStockBillSub b on a.HInterID=b.HInterID where a.HInterID= '" + HInterID + "'", "Cg_POInStockBillMain");
-
+ //鏀舵枡閫氱煡鍗曞垹闄ゅ洖濉噰璐鍗曞叧鑱旀暟閲�
+ oCN.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + HInterID);
+
+ ////鎵ц瀛樺偍杩囩▼杩涜鍙嶅啓 璇ヨ涔熸槸 鏀舵枡閫氱煡鍗� 鍙嶅啓 閲囪喘璁㈠崟
+ // dss = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain");
+ var sReturn = "";
+
+ oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
+ oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
+
+ //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBacker"]) != 0)
+ //{
+ // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = sReturn;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ //if (ds.Tables[0].Rows.Count == 1)
+ //{
+ // oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID);
+ // oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID);
+ //}
+ //else
+ //{
+ // oCN.RunProc($"delete Cg_POInStockBillSub where HInterID={ HInterID}and HEntryID={HsupId}");
+ //}
+
+
oCN.Commit();
@@ -483,6 +511,18 @@
string HSUPPLYADDRESS = mainList2[0].HSUPPLYADDRESS == null ? "''" : mainList2[0].HSUPPLYADDRESS;
long HPROVIDERCONTACTID = mainList2[0].HPROVIDERCONTACTID == null ? 0 : mainList2[0].HPROVIDERCONTACTID;
+
+
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.Message = s;
+ return objJsonResult;
+ }
+
ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList");
if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板
{
@@ -528,6 +568,26 @@
}
else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
{ //淇敼
+ DataSet dss;
+ dss = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList");
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (dss.Tables[0].Rows[0]["瀹℃牳浜�"].ToString() != "" && dss.Tables[0].Rows[0]["瀹℃牳浜�"] != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (dss.Tables[0].Rows[0]["鐘舵��"].ToString() !="鍒涘缓")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
string sql= $@"update Cg_POInStockBillMain set " +
"HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" +
",HSupID=" + HSupID + ",HCurID=" + HCurID
@@ -679,19 +739,19 @@
NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
NewHEntryID += 1;
}
- //鍙嶅啓閲囪喘鍏ュ簱鍗�
+ //鍙嶅啓閲囪喘璁㈠崟鍗� 涓婇潰鏂规硶涓篃鏈夊弽鍐� 姝よ 璺� 杩斿洖缁撴灉 缁欐敞閿�
string sReturn = "";
- ds = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Cg_POOrderBillMain");
- if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
- {
- sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = sReturn;
- objJsonResult.data = null;
- return objJsonResult;
- }
-
+ //ds = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Cg_POOrderBillMain");
+ //if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ //{
+ // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = sReturn;
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
oCN.RunProc($@"Insert into Cg_POInStockBillSub
(HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice
,HMoney,HTaxRate,HTaxMoney,HWHID,HSPID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HPOOrderInterID
@@ -703,7 +763,7 @@
,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX
,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID)
values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
- ,{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
+ ,{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HWHID},{oSub.HSPID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},'{HPOOrderBillNo}',{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE},
{HSUPPLYLOT},{HREQTRACENO},{HBOMID},{HSTOCKUNITID},{HBASEUNITID},{HSTOCKSTATUSID},'{HKEEPERTYPEID}',{HPROJECTNO},{HCHECKINCOMING},{oSub.HTaxPrice},{HDISCOUNTRATE},{HPRICECOEFFICIENT},{HPRICEUNITID},{HPRICELISTENTRY},{HSAMPLEDAMAGEQTY},{HSAMPLEDAMAGEBASEQTY},{HPAYORGID},{HSETTLEORGID},{HSETTLECURRID},{HSETTLEMODEID},{HEXCHANGETYPEID},{HPAYCONDITONID},{oSub.HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},{oSub.HSecUnitID})");
}
@@ -931,6 +991,18 @@
}
//==================================================================================
+
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ 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_Cg_POInStockBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
{
@@ -971,6 +1043,18 @@
}
//=========================================================
+
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ 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_Cg_POInStockBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
{
--
Gitblit v1.9.1