From 5c6fc4e6d45641b5c32087777457c09078828850 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 01 十二月 2022 15:47:29 +0800
Subject: [PATCH] 采购订单
---
Model/采购管理/ClsCg_POOrderBillSub.cs | 15 ++
WebAPI/Controllers/WebAPIController.cs | 56 +++++++
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs | 319 +++++++++++++++++++++++++++++++++++++++++++++
Model/采购管理/ClsCg_POOrderBillMain.cs | 21 ++
4 files changed, 407 insertions(+), 4 deletions(-)
diff --git "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs" "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
index 5cee8c3..19c3d92 100644
--- "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
+++ "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillMain.cs"
@@ -17,6 +17,25 @@
public Int64 HDeptID;// int --部门 (Gy_Employee)
public string HExplanation;// varchar(200) --摘要
public string HInnerBillNo;// varchar(50) --内部单据号
- public DateTime HSSDate;
+ public DateTime HSSDate; //结算日期
+ public string HRemark; //备注
+
+
+ public Int64 HInterID;
+ public Int64 HYear;
+ public Int64 HPeriod;
+ public string HBillType;
+ public string HBillSubType;
+ public DateTime HDate;
+ public string HBillNo;
+ public Int64 HBillStatus;
+ public string HChecker;
+ public string HCheckDate;
+ public string HMaker;
+ public string HMakeDate;
+ public Int64 HERPInterID;
+ public string HERPBillType;
+ public Int64 HPURCHASEORGID;
+
}
}
diff --git "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs" "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
index 853fb4d..ad0ee62 100644
--- "a/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
+++ "b/Model/\351\207\207\350\264\255\347\256\241\347\220\206/ClsCg_POOrderBillSub.cs"
@@ -30,5 +30,20 @@
public string HSourceInterID;
public string HSourceEntryID;
public string HSourceQty;
+
+
+ public Int64 HInterID;
+ public Int64 HEntryID;
+ public string HSourceBillNo;
+ public string HSourceBillType;
+ public double HRelationQty;
+ public double HBackRelationQty;
+ public Int64 HPropertyID;
+ public string HBatChNo;
+ public Int64 HAuxPropID;
+ public string HMTONo;
+ public Int64 HERPInterID;
+ public Int64 HERPEntryID;
+
}
}
diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index 3f88755..dcc0ab2 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing Model;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
@@ -659,7 +660,321 @@
}
}
- //
+ #region 閲囪喘璁㈠崟 淇濆瓨/缂栬緫鍔熻兘
+ [Route("Cg_POOrderBill/POOrderBillEdit")]
+ [HttpPost]
+ public object POOrderBillEdit([FromBody] JObject sMainSub)
+ {
+ try
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain(msg1);
+ if (objJsonResult.code == "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍗曟嵁淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ public json AddBillMain(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
+ string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
+ int OperationType = int.Parse(sArray[2].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+ string user = sArray[3].ToString();
+ string msg_allVal = sArray[4].ToString(); //涓昏〃+瀛愯〃鎵�鏈夋暟鎹�
+
+ try
+ {
+ msg2 = "[" + msg2.ToString() + "]";
+ List<ClsCg_POOrderBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
+
+ long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+ string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+ long HPRDORGID = mainList[0].HPRDORGID;//缁勭粐
+ DateTime HDate = mainList[0].HDate;//鏃ユ湡
+ string HRemark = mainList[0].HRemark;//澶囨敞
+ long HSupID = mainList[0].HSupID;//渚涘簲鍟�
+ long HEmpID = mainList[0].HEmpID;//涓氬姟鍛�
+ long HDeptID = mainList[0].HDeptID;//閮ㄩ棬
+ long HCurID = mainList[0].HCurID;//甯佸埆
+ Single HExRate = mainList[0].HExRate;//姹囩巼
+ long HManagerID = mainList[0].HManagerID;//涓荤
+ long HPSStyleID = mainList[0].HPSStyleID;//閲囪喘鏂瑰紡
+ long HSSID = mainList[0].HSSID;//缁撶畻鏂瑰紡
+ DateTime HSSDate = mainList[0].HSSDate;//缁撶畻鏃ユ湡
+ string HMaker = user;//鍒跺崟浜�
+ string HAddress = mainList[0].HAddress;//鍦板潃
+ string HExplanation = mainList[0].HExplanation;//鎽樿
+ string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙�
+
+ List<ClsCg_POOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillMain>>(msg2);
+ DateTime dt = DateTime.Now;
+
+ long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
+ long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
+ string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
+ string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
+ long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
+ string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
+ string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
+ string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
+ long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID;
+ string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType;
+ long HPURCHASEORGID = mainList2[0].HPURCHASEORGID == null ? 0 : mainList2[0].HPURCHASEORGID;
+
+ ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+ DataSet Ds;
+ Int64 NewHInterID = 1;
+ Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Cg_POOrderBillMain", "Cg_POOrderBillMain");
+ if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
+ {
+ NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
+ NewHInterID += 1;
+ }
+ //涓昏〃
+ oCN.RunProc(@"Insert Into Cg_POOrderBillMain
+ (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
+ ,HAddress,HSSID,HSSDate,HPSStyleID,HSupID,HCurID
+ ,HExRate,HEmpID,HManagerID,HDeptID,HExplanation,HRemark,HInnerBillNo
+ ,HChecker,HCheckDate,HMaker,HMakeDate
+ ,HERPInterID,HERPBillType,HPURCHASEORGID)
+ values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1102 + "','" +
+ HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress +
+ "'," + HSSID + ",'" + HSSDate + "'," + HPSStyleID + "," + HSupID + "," + HCurID +
+ "," + HExRate + "," + HEmpID + "," + HManagerID + "," + HDeptID + ",'" + HExplanation + "','" + HRemark + "','" + HInnerBillNo + "','" + HChecker + "','" + HCheckDate + "','" + HMaker + "','" +
+ HMakeDate + "'," + HERPInterID + ",'" + HERPBillType + "'," + HPURCHASEORGID + ")");
+ }
+ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
+ { //淇敼
+ oCN.RunProc("update Cg_POOrderBillMain set " +
+ "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" +
+ ",HSSID=" + HSSID + ",HPSStyleID=" + HPSStyleID + ",HSupID=" + HSupID + ",HCurID=" + HCurID
+ + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID
+ + ",HAddress='" + HAddress + "',HSSDate='" + HSSDate + "' where HInterID=" + HInterID);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Cg_POOrderBillSub where HInterID='" + HInterID + "'");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSub(msg3, HInterID, OperationType);
+
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ public json AddBillSub(string msg3, long HInterID, int OperationType)
+ {
+ List<ClsCg_POOrderBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillSub>>(msg3);
+
+ List<ClsCg_POOrderBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POOrderBillSub>>(msg3);
+
+
+ string HSourceBillNo = DetailColl2[0].HSourceBillNo == null ? "''" : DetailColl2[0].HSourceBillNo;
+ string HSourceBillType = DetailColl2[0].HSourceBillType == null ? "''" : DetailColl2[0].HSourceBillType;
+ double HRelationQty = DetailColl2[0].HRelationQty == null ? 0 : DetailColl2[0].HRelationQty;
+ double HBackRelationQty = DetailColl2[0].HBackRelationQty == null ? 0 : DetailColl2[0].HBackRelationQty;
+ long HPropertyID = DetailColl2[0].HPropertyID == null ? 0 : DetailColl2[0].HPropertyID;
+ string HBatChNo = DetailColl2[0].HBatChNo == null ? "''" : DetailColl2[0].HBatChNo;
+ long HAuxPropID = DetailColl2[0].HAuxPropID == null ? 0 : DetailColl2[0].HAuxPropID;
+ string HMTONo = DetailColl2[0].HMTONo == null ? "''" : DetailColl2[0].HMTONo;
+ long HERPInterID = DetailColl2[0].HERPInterID == null ? 0 : DetailColl2[0].HERPInterID;
+ long HERPEntryID = DetailColl2[0].HERPEntryID == null ? 0 : DetailColl2[0].HERPEntryID;
+
+ string HSeOrderBillNo = DetailColl2[0].HSeOrderBillNo == null ? "''" : DetailColl2[0].HSeOrderBillNo;
+ string HRemark = DetailColl2[0].HRemark == null ? "''" : DetailColl2[0].HRemark;
+ string HSourceInterID = DetailColl2[0].HSourceInterID == null ? "''" : DetailColl2[0].HSourceInterID;
+ string HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? "''" : DetailColl2[0].HSourceEntryID;
+
+
+ int i = 0;
+ foreach (ClsCg_POOrderBillSub oSub in DetailColl)
+ {
+ i++;
+ if (oSub.HQty <= 0 || oSub.HQty == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (oSub.HMaterID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝鐗╂枡涓嶈兘涓虹┖";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //if (oSub.HSourceID == 0)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "绗�" + i + "琛岋紝鐢熶骇璧勬簮涓嶈兘涓虹┖";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ if (oSub.HUnitID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝璁¢噺鍗曚綅涓嶈兘涓虹┖";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DataSet Cs;
+ Int64 NewHEntryID = 1;
+ Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Cg_POOrderBillSub", "Cg_POOrderBillSub");
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+ {
+ NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+ NewHEntryID += 1;
+ }
+
+ oCN.RunProc($@"Insert into Cg_POOrderBillSub
+ (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice,HTaxPrice,HDiscountRate,HRelTaxPrice
+ ,HMoney,HTaxRate,HTaxMoney,HLineTotal,HlineTotalBB,HDate,HInStockQty,HInvoiceQty,HSeOrderBillNo,HSeOrderInterID
+ ,HSeOrderEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo
+ ,HSourceBillType,HRelationQty,HBackRelationQty,HPropertyID,HBatChNo,HAuxPropID,HMTONo
+ ,HERPInterID,HERPEntryID)
+ values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)}
+ ,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},'{oSub.HDate}',{oSub.HInStockQty},{oSub.HInvoiceQty},{HSeOrderBillNo},{oSub.HSeOrderInterID},{oSub.HSeOrderEntryID},'{HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},{HBackRelationQty},{HPropertyID},{HBatChNo},
+ {HAuxPropID},{HMTONo},{HERPInterID},{HERPEntryID})");
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ #endregion
+ /// <summary>
+ ///鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("Cg_POOrderBill/DeltetCg_POOrderBill")]
+ [HttpGet]
+ public object DeltetCg_POOrderBill(string HInterID)
+ {
+ try
+ {
+ oCN.BeginTran();
+ oCN.RunProc("Delete From Cg_POOrderBillMain where HInterID = " + HInterID);
+ oCN.RunProc("Delete From Cg_POOrderBillSub where HInterID = " + HInterID);
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Cg_POOrderBill/cx")]
+ [HttpGet]
+ public object cx(long HInterID)
+ {
+ try
+ {
+
+ ds = oCN.RunProcReturn("select * from h_v_IF_POOrderBillList where hmainid =" + HInterID, "h_v_IF_POOrderBillList");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "false锛�";
+ 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;
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index bf201ac..d5525cd 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -955,7 +955,7 @@
//sWhere = " Where HStopFlag=0 and HEndFlag=1 and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
if (Supplier != "")
{
- sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + Supplier + "%' ) ";
+ sWhere = sWhere + " and ( HNumber like '%" + Supplier + "%' or HName like '%" + Supplier + "%' or HUSEORGID like '%" + HOrgID + "%' ) ";
}
try
{
@@ -1453,6 +1453,60 @@
}
/// <summary>
+ /// 鑾峰彇閲囪喘鏂瑰紡鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ [Route("Web/GetPoStockStyleList_Json")]
+ [HttpGet]
+ public object GetPoStockStyleList_Json(string PoStockStyle)
+ {
+ if (PoStockStyle != "")
+ {
+ sWhere = sWhere + " and ( HNumber like '%" + PoStockStyle + "%' or HName like '%" + PoStockStyle + "%' ) ";
+ }
+ try
+ {
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_PoStockStyle where HStopflag=0 Order by HItemID ", "Gy_PoStockStyle");
+ }
+ else
+ {
+ string sql1 = "Select HItemID,HNumber ,HName from Gy_PoStockStyle where HStopflag=0 and HEndFlag=1 ";
+ string sql = sql1 + sWhere;
+ ds = oCN.RunProcReturn(sql, "Gy_PoStockStyle");
+ }
+
+ if (ds == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + DBUtility.ClsPub.sErrInfo;
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = ds.Tables[0];
+ return objjson;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + ex.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+
+ /// <summary>
/// 鑾峰彇瀹㈡埛鍒楄〃
/// </summary>
/// <returns></returns>
--
Gitblit v1.9.1