From 36d137d483b780251978c36147469712919221e8 Mon Sep 17 00:00:00 2001 From: yusijie <ysj@hz-kingdee.com> Date: 星期三, 30 十一月 2022 15:32:24 +0800 Subject: [PATCH] 销售订单 --- WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs | 243 ++++++++++++++++++++++++++++++++++ Model/销售管理/ClsXs_SeOrderBillSub.cs | 21 ++ WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs | 3 WebAPI/Controllers/WebAPIController.cs | 108 +++++++++++++++ Model/销售管理/ClsXs_SeOrderBillMain.cs | 22 +++ 5 files changed, 393 insertions(+), 4 deletions(-) diff --git "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs" "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs" index 785b0ae..c909007 100644 --- "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs" +++ "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillMain.cs" @@ -8,7 +8,7 @@ { public string HAddress;// varchar(200) --交货地点 public Int64 HSSID;// int --结算方式 (Gy_SettleStyle) - public Int64 HSellSID;// int --采购方式 (Gy_PoStockStyle) new + public Int64 HSellSID;// int --销售方式 (Gy_SellStyle) new public Int64 HCusID;// int --供应商 (Gy_Supplier) public Int64 HCurID;// int --币别 (Gy_Currency) public Single HExRate;// money --汇率 (选择完币别带出) @@ -20,5 +20,25 @@ public DateTime HSSDate;// datetime --结算日期 --addnew public string HChangeMan;// varchar(50) --变更人(不可编辑,灰色显示类似审核人) --addnew public DateTime HChangeDate;// datetime --变更日期(不可编辑,灰色显示) --addnew + + + public Int64 HInterID; + public long HYear; + public long HPeriod; + public string HBillType; + public string HBillSubType; + public DateTime HDate; + public string HBillNo; + public int HBillStatus; + public string HRemark; + public string HChecker; + public string HCheckDate; + public string HMaker; + public string HMakeDate; + public string HCloseMan; + public string HCloseDate; + public Int64 HERPInterID; + public string HERPBillType; + public Int64 HSALEORGID; } } diff --git "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs" "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs" index 58d6aad..d022b67 100644 --- "a/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs" +++ "b/Model/\351\224\200\345\224\256\347\256\241\347\220\206/ClsXs_SeOrderBillSub.cs" @@ -10,7 +10,7 @@ public string HRemark;// varchar(200) --备注 public Int64 HMaterID;// int --物料ID (Gy_Material) public Int64 HUnitID;// int --计量单位 (Gy_Unit) - public double HQty;// dec(18,8) --数量 + public double? HQty;// dec(18,8) --数量 public double HPrice;// dec(18,8) --原币单价 public double HMoney;// dec(18,8) --原币金额 public Single HTaxRate;// money --税率 @@ -23,5 +23,24 @@ public double HRelTaxPrice;// dec(18,8) --实际含税单价(不可编辑) --addnew public double HOutStockQty;// dec(18,8) --出库数量(不可编辑) --addnew public double HInvoiceQty;// dec(18,8) --开票数量(不可编辑) --addnew + + + public Int64 HInterID; + public Int64 HEntryID; + public Int64 HSourceInterID; + public Int64 HSourceEntryID; + public string HSourceBillNo; + public string HSourceBillType; + public double HRelationQty; + public Int64 HPropertyID; + public string HBatChNo; + public Int64 HAuxPropID; + public string HMTONo; + public Int64 HERPInterID; + public Int64 HERPEntryID; + public decimal HBackRelationQty; + public Int64 HWhID; + public Int64 HSPID; + } } diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs index 1b252df..f5e542c 100644 --- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs +++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs @@ -697,6 +697,7 @@ objJsonResult.list = columnNameList; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; objJsonResult.data = ds.Tables[0]; + return objJsonResult; } catch (Exception e) { @@ -704,8 +705,8 @@ objJsonResult.count = 0; objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString(); objJsonResult.data = null; + return objJsonResult; } - return objJsonResult; } #endregion } diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index 9c55f9f..6aa23c6 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -1345,6 +1345,114 @@ } /// <summary> + /// 鑾峰彇閿�鍞柟寮忓垪琛� + /// </summary> + /// <returns></returns> + [Route("Web/GetSellStyleList_Json")] + [HttpGet] + public object GetSellStyleList_Json(string SellStyle) + { + if (SellStyle != "") + { + sWhere = sWhere + " and ( HNumber like '%" + SellStyle + "%' or HName like '%" + SellStyle + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_SellStyle where HStopflag=0 Order by HItemID ", "Gy_SellStyle"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_SellStyle where HStopflag=0 and HEndFlag=1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_SellStyle"); + } + + 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> + [Route("Web/GetSettleStyleList_Json")] + [HttpGet] + public object GetSettleStyleList_Json(string SettleStyle) + { + if (SettleStyle != "") + { + sWhere = sWhere + " and ( HNumber like '%" + SettleStyle + "%' or HName like '%" + SettleStyle + "%' ) "; + } + try + { + SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName from Gy_SettleStyle where HStopflag=0 Order by HItemID ", "Gy_SettleStyle"); + } + else + { + string sql1 = "Select HItemID,HNumber ,HName from Gy_SettleStyle where HStopflag=0 and HEndFlag=1 "; + string sql = sql1 + sWhere; + ds = oCN.RunProcReturn(sql, "Gy_SettleStyle"); + } + + 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> diff --git a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs index 9507daf..dfbd03d 100644 --- a/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs +++ b/WebAPI/Controllers/XSGL/Xs_SeOrderBillController.cs @@ -1,4 +1,5 @@ -锘縰sing Newtonsoft.Json; +锘縰sing Model; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; @@ -156,6 +157,246 @@ } } + #region 閿�鍞鍗� 淇濆瓨/缂栬緫鍔熻兘 + [Route("Xs_SeOrder/SeOrderBillEdit")] + [HttpPost] + public object SeOrderBillEdit([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<ClsXs_SeOrderBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOrderBillMain>>(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 HCusID = mainList[0].HCusID;//瀹㈡埛 + 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 HSellSID = mainList[0].HSellSID;//閿�鍞柟寮� + long HSSID = mainList[0].HSSID;//缁撶畻鏂瑰紡 + DateTime HSSDate = mainList[0].HSSDate;//缁撶畻鏃ユ湡 + string HMaker = user;//鍒跺崟浜� + string HAddress = mainList[0].HAddress;//鍦板潃 + + List<ClsXs_SeOrderBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOrderBillMain>>(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; + int 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; + string HCloseMan = mainList2[0].HCloseMan == null ? "''" : mainList2[0].HCloseMan; + string HCloseDate = mainList2[0].HCloseDate == null ? "''" : mainList2[0].HCloseDate; + long HERPInterID = mainList2[0].HERPInterID == null ? 0 : mainList2[0].HERPInterID; + string HERPBillType = mainList2[0].HERPBillType == null ? "''" : mainList2[0].HERPBillType; + long HSALEORGID = mainList2[0].HSALEORGID == null ? 0 : mainList2[0].HSALEORGID; + + ds = oCN.RunProcReturn("select * from h_v_IF_SeOrderBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_SeOrderBillList"); + + if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板 + { + DataSet Ds; + Int64 NewHInterID = 1; + Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Xs_SeOrderBillMain", "Xs_SeOrderBillMain"); + 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 Xs_SeOrderBillMain + (HBillType,HInterID,HBillNo,HDate + ,HYear,HPeriod,HRemark,HMaker,HMakeDate + ,HEmpID,HCusID + ,HBillSubType,HAddress,HSSDate,HSSID,HSellSID,HCurID,HExRate, HManagerID,HDeptID + ,HExplanation,HCheckFlow,HBillStatus,HInnerBillNo + ,HICMOFlag,HChangeMan,HSALEORGID,HERPInterID,HERPBillType) + values(" + "1401," + HInterID + ",'" + HBillNo + "','" + HDate + "','" + + DateTime.Now.Year + "','" + DateTime.Now.Month + "','" + HRemark + "','" + HMaker + "','" + HMakeDate + + "'," + HEmpID + "," + HCusID + ",'" + HBillType + "','" + HAddress + "','" + HSSDate + + "'," + HSSID + "," + HSellSID + "," + HCurID + "," + HExRate + "," + HManagerID + "," + HDeptID + ",'" + "''" + "'," + "0," + HBillStatus + ",'" + "''" + "'," + + 0 + ",'" + "''" + "'," + "0," + HERPInterID + ",'" + HERPBillType + "')"); + } + else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) + { //淇敼 + oCN.RunProc("update Xs_SeOrderBillMain set " + + "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + ",HAddress='" + HAddress + "',HDeptID=" + HDeptID + + ",HCurID=" + HCurID + ",HExRate=" + HExRate + ",HManagerID=" + HManagerID + ",HSellSID=" + HSellSID + + ",HSSID=" + HSSID + ",HSSDate='" + HSSDate + "' where HInterID=" + HInterID); + + //鍒犻櫎瀛愯〃 + oCN.RunProc("delete from Xs_SeOrderBillSub 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<ClsXs_SeOrderBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOrderBillSub>>(msg3); + + List<ClsXs_SeOrderBillSub> DetailColl2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_SeOrderBillSub>>(msg3); + + long HSourceInterID = DetailColl2[0].HSourceInterID == null ? 0 : DetailColl2[0].HSourceInterID; + long HSourceEntryID = DetailColl2[0].HSourceEntryID == null ? 0 : DetailColl2[0].HSourceEntryID; + 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; + 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; + decimal HBackRelationQty = DetailColl2[0].HBackRelationQty == null ? 0 : DetailColl2[0].HBackRelationQty; + long HWhID = DetailColl2[0].HWhID == null ? 0 : DetailColl2[0].HWhID; + long HSPID = DetailColl2[0].HSPID == null ? 0 : DetailColl2[0].HSPID; + + int i = 0; + foreach (ClsXs_SeOrderBillSub 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 Xs_SeOrderBillSub", "Xs_SeOrderBillSub"); + 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 Xs_SeOrderBillSub + (HInterID,HENTRYID,HQty,HMaterID,HUnitID,HRemark + ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType + ,HRelationQty,HRelationMoney,HPrice,HTaxPrice,HMoney,HDiscountRate + ,HRelTaxPrice,HTaxRate,HTaxMoney,HlineTotal,HlineTotalBB,HDate,HOutStockQty,HInvoiceQty) + values({HInterID},{NewHEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)} + ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{HSourceInterID},{HSourceEntryID},{HSourceBillNo},{HSourceBillType},{HRelationQty},0,{oSub.HPrice},{oSub.HTaxPrice},{oSub.HMoney},{oSub.HDiscountRate},{oSub.HRelTaxPrice},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HlineTotal},{oSub.HlineTotalBB},getdate(),0,0)"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } + + #endregion + /// <summary> ///鍒犻櫎鍔熻兘 /// </summary> -- Gitblit v1.9.1