From 7ff36a7bef22bade6d8a91dd6755f09556bf925b Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期一, 11 三月 2024 09:39:38 +0800
Subject: [PATCH] 基础资料自动生产编码,其他应收单增加子表保存与回显
---
WebAPI/ListModels.cs | 12 +++
DAL/应收管理/ClsYS_ReceiveOtherBill.cs | 51 ++++++++++++
Model/Model.csproj | 2
WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs | 46 ++++++++++-
WebAPI/Controllers/WebAPIController.cs | 50 ++++++++++++
Model/应收管理/ClsYS_ReceiveOtherBillSub.cs | 5 +
Pub_Class/CustomerCls/ClsPub.cs | 70 +++++++++++++++++
7 files changed, 228 insertions(+), 8 deletions(-)
diff --git "a/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs" "b/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
index 36e0d22..7d099b3 100644
--- "a/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
+++ "b/DAL/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBill.cs"
@@ -66,7 +66,31 @@
DeleteRelation(ref sReturn, lngBillKey);
//鍒犻櫎瀛愯〃
DeleteBillSub(lngBillKey);
-
+ //鎻掑叆瀛愯〃
+ omodel.HInterID = lngBillKey;
+ foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
+ {
+ string subSql = "insert into YS_ReceiveOtherBillSub" +
+ "" +
+ "" +
+ "" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HProjectMoneyID,HTypeSub,HMoney,HTaxRate,HSumMoney) " +
+ " values(" +
+ "" + omodel.HInterID.ToString() +
+ "," + oSub.HEntryID.ToString() +
+ "," + oSub.HSourceInterID +
+ "," + oSub.HSourceEntryID +
+ ",'" + oSub.HSourceBillNo +
+ "','" + oSub.HSourceBillType +
+ "','" + oSub.HProjectMoneyID +
+ "','" + oSub.HTypeSub +
+ "','" + oSub.HMoney +
+ "','" + oSub.HTaxRate +
+ "','" + oSub.HSumMoney +
+ "')";
+ oCn.RunProc(subSql);
+ }
sReturn = "淇敼鍗曟嵁鎴愬姛锛�";
oCn.Commit();
return true;
@@ -99,7 +123,30 @@
",'" + omodel.HAccDate.ToShortDateString() + "'," + omodel.HCusID.ToString() + "," + omodel.HCurID.ToString() + "," + omodel.HExRate.ToString() +
", '" + omodel.HDeptID.ToString() + "','" + omodel.HEmpID.ToString() + "','" + omodel.HProjectMoneyID.ToString() + "','" + omodel.HType+ "','"+ omodel.HMoney+ "','" + omodel.HTaxRate + "','" + omodel.HSumMoney + "','" + omodel.HExplanation + "','" + omodel.HInnerBillNo + "','" + omodel.HOrgID + "'" +
") ");
-
+ //鎻掑叆瀛愯〃
+ foreach (Model.ClsYS_ReceiveOtherBillSub oSub in DetailColl)
+ {
+ string subSql = "insert into YS_ReceiveOtherBillSub" +
+ "" +
+ "" +
+ "" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HProjectMoneyID,HTypeSub,HMoney,HTaxRate,HSumMoney) " +
+ " values(" +
+ "" + omodel.HInterID.ToString() +
+ "," + oSub.HEntryID.ToString() +
+ "," + oSub.HSourceInterID +
+ "," + oSub.HSourceEntryID +
+ ",'" + oSub.HSourceBillNo +
+ "','" + oSub.HSourceBillType +
+ "','" + oSub.HProjectMoneyID +
+ "','" + oSub.HTypeSub +
+ "','" + oSub.HMoney +
+ "','" + oSub.HTaxRate +
+ "','" + oSub.HSumMoney +
+ "')";
+ oCn.RunProc(subSql);
+ }
sReturn = "鏂板鍗曟嵁鎴愬姛锛�";
oCn.Commit();
return true;
diff --git a/Model/Model.csproj b/Model/Model.csproj
index 2dcbb71..055a172 100644
--- a/Model/Model.csproj
+++ b/Model/Model.csproj
@@ -461,6 +461,7 @@
<Compile Include="宸ヨ祫绠$悊\ClsPay_SubsidyChangeBillSub.cs" />
<Compile Include="宸ヨ祫绠$悊\ClsPay_SumBalBillMain .cs" />
<Compile Include="宸ヨ祫绠$悊\ClsPay_SumBalBillSub.cs" />
+ <Compile Include="搴旀敹绠$悊\ClsYS_ReceiveOtherBillSub.cs" />
<Compile Include="鎴愭湰绠$悊\ClsCB_ChangeMoneyBillMain.cs" />
<Compile Include="鎴愭湰绠$悊\ClsCB_ChangeMoneyBillSub.cs" />
<Compile Include="鎴愭湰绠$悊\ClsCB_EntrustMoneyCost_M.cs" />
@@ -1223,7 +1224,6 @@
<Compile Include="搴旀敹绠$悊\ClsYS_ReceiveBillMain.cs" />
<Compile Include="搴旀敹绠$悊\ClsYS_ReceiveBillSub.cs" />
<Compile Include="搴旀敹绠$悊\ClsYS_ReceiveOtherBillMain.cs" />
- <Compile Include="搴旀敹绠$悊\ClsYS_ReceiveOtherBillSub.cs" />
<Compile Include="搴旀敹绠$悊\ClsYS_ReceiveShouldBillMain.cs" />
<Compile Include="搴旀敹绠$悊\ClsYS_ReceiveShouldBillSub.cs" />
<Compile Include="璁″垝绠$悊\ClsGy_ICBomBillMain.cs" />
diff --git "a/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillSub.cs" "b/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillSub.cs"
index 838c827..f3cb8c6 100644
--- "a/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillSub.cs"
+++ "b/Model/\345\272\224\346\224\266\347\256\241\347\220\206/ClsYS_ReceiveOtherBillSub.cs"
@@ -8,5 +8,10 @@
{
public DateTime HEntryCloseDate;// datetime --行关闭 (默认为'') new
public string HRemark;// varchar(200) --备注
+ public Int64 HProjectMoneyID;// int //费用项目
+ public string HTypeSub;// varchar(20) --发票类型
+ public double HMoney;// dec(18,8) //单据金额
+ public double HTaxRate;// dec(18,8) //税率
+ public double HSumMoney;// dec(18,8) //总金额
}
}
diff --git a/Pub_Class/CustomerCls/ClsPub.cs b/Pub_Class/CustomerCls/ClsPub.cs
index d9636d8..f324392 100644
--- a/Pub_Class/CustomerCls/ClsPub.cs
+++ b/Pub_Class/CustomerCls/ClsPub.cs
@@ -897,6 +897,76 @@
}
+ //寰楀埌鏈�澶у熀纭�璧勬枡鐨勬祦姘村彿 HNumber
+ public static string CreateHNumber(string BillCode,string HName,string TableName, ref string sReturn, bool Add)
+ {
+
+ Int64 Glida;
+ Int32 CodeLen;
+ string sBillNumber = "";
+ char c = Convert.ToChar("0");
+ string sKjYear = DateTime.Today.Year.ToString();
+ string sPeriod = DateTime.Today.Month.ToString();
+ string sDay = DateTime.Today.Day.ToString();
+ //寰楀埌鍗曟嵁鍙疯〃 淇℃伅
+ ClsSqlHelper oCn = new ClsSqlHelper();
+ DataSet Ds = new DataSet();
+ DataSet Dss = new DataSet();
+ //绗竴娆℃煡璇㈡暟鎹槸鍚﹀瓨鍦� 涓嶅瓨鍦ㄥ氨娣诲姞
+ Ds = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+ //鎻掑叆鏂拌褰� 琛ㄥ悕,琛ㄥ悕绉�,褰撳墠id
+ if (Ds.Tables[0].Rows.Count == 0)
+ {
+
+ oCn.RunProc("insert into Gy_MaxNumber(BillType,BillName,IDNow) values('" + TableName.Trim() + "','" + HName.Trim() + "',1)");
+ }
+
+ //绗簩娆℃煡璇� 鏄煡璇㈡彃鍏ョ殑鏂版暟鎹�
+ Dss = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+ if (Dss.Tables[0].Rows.Count != 0)
+ {
+
+ Glida = ClsPub.isLong(Dss.Tables[0].Rows[0]["Glida"].ToString());
+ CodeLen = ClsPub.isInt(Dss.Tables[0].Rows[0]["CodeLen"].ToString());
+ }
+ else
+ {
+ return "";
+ }
+ string sStr;
+ switch (Glida)
+ {
+ case 0://绾祦姘村彿
+ Ds = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+ if (Ds.Tables[0].Rows.Count != 0)
+ {
+ sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["IDNow"].ToString()).Length);
+ sBillNumber = BillCode.Trim() + sStr + Ds.Tables[0].Rows[0]["IDNow"].ToString().Trim();
+ }
+
+ if (Add == true)
+ {
+ oCn.RunProc("update Gy_MaxNumber set IDNow=IDNow+1 where BillName='" + HName.Trim() + "'");
+ }
+ return sBillNumber;
+
+ case 1://鏍规嵁 YY骞�+MM鏈� 鏃� + 娴佹按鍙� 鐢熸垚鍗曟嵁鍙� 锛堟棩 閲囩敤浜� 浠撳簱鐨勫瓧娈碉級
+ return sBillNumber;
+ case 2: //鏍规嵁骞�+鏈�+鏃� 鐢熸垚鍗曟嵁鍙�
+ return sBillNumber;
+ case 3: //鏍规嵁 涔斾竴 锛圫 + 骞达紙23锛�+浜斾綅娴佹按鍙凤級瀹炰緥锛歋2300001
+ return sBillNumber;
+ case 4: //鏍规嵁 涔斾竴 宸ュ簭娴佽浆鍗″彿鏀规垚骞�+鏈�+鍥涗綅娴佹按鍙凤紙23050001锛�
+ return sBillNumber;
+ default:
+ return sBillNumber;
+
+ }
+ oCn.CnClose();
+ oCn.CnDispose();
+ oCn = null;
+ }
+
//鍒ゆ柇鏄惁瀛樺湪鏉冮檺,骞跺啓鍏ユ棩蹇�
public static bool Security_Log(string gnsy, int LogTF, bool Msg,string CurUserName)
{
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index b23cf09..a7b07b5 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -143,6 +143,56 @@
}
}
+ /// <summary>
+ /// 鑷姩鑾峰彇鍩虹璧勬枡 娴佹按鍙� 灏辨槸浠g爜
+ /// </summary>
+ /// <param name="HBillType"></param>
+ /// <returns></returns>
+ [Route("Web/GetMAXNumber")]
+ [HttpGet]
+ public object GetMAXNumber(string HBillType,string HName,string TableName)
+ {
+ try
+ {
+ string HNumber = "";
+ HNumber = DBUtility.ClsPub.CreateHNumber(HBillType,HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ //----------鍒涘缓铏氳〃------------------------
+ DataTable dt_Main = new DataTable("Json");
+ dt_Main.Columns.Add("HNumber", typeof(string));
+
+ //---------鍒涘缓鏂拌------------------------
+ DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌
+ dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑
+ dr_main["HNumber"] = DBUtility.ClsPub.isStrNull(HNumber);
+
+
+ if (HNumber == null)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触";
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛";
+ objjson.data = dt_Main;
+ return objjson;
+ }
+ }
+ catch (Exception e)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+
//[Route("Web/Get_MaxBillNoAndID")]
//[HttpGet]
diff --git a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
index 246eaae..358d185 100644
--- a/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
+++ b/WebAPI/Controllers/XSGL/YS_ReceiveOtherBillController.cs
@@ -25,6 +25,17 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
+ public class ClsYS_ReceiveOtherBillSubs
+ {
+
+ public Int64 HProjectMoneyIDSub;// int //璐圭敤椤圭洰
+ public string HTypeSub;// varchar(20) --鍙戠エ绫诲瀷
+ public double HMoneySub;// dec(18,8) //鍗曟嵁閲戦
+ public double HTaxRateSub;// dec(18,8) //绋庣巼
+ public double HSumMoneySub;// dec(18,8) //鎬婚噾棰�
+ }
+
+
#region 鍏朵粬搴旀敹鍗曞垪琛� 鏌ヨ
/// <summary>
/// 杩斿洖椤圭洰闃舵鍒楄〃
@@ -93,9 +104,10 @@
var _value = msg["msg"].ToString();
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString(); //琛ㄥご鏁版嵁
- string refSav = sArray[1].ToString(); //鎿嶄綔鏂瑰紡
- string msg4 = sArray[2].ToString(); //鐢ㄦ埛
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString(); //瀛愯〃
+ string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string msg4 = sArray[3].ToString();//鐢ㄦ埛鍚�
DBUtility.ClsPub.CurUserName = msg4;
@@ -187,6 +199,26 @@
}
oBill.omodel = oItem;
}
+ // 琛ㄤ綋鏁版嵁
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ List<Model.ClsYS_ReceiveOtherBillSub> ls = new List<Model.ClsYS_ReceiveOtherBillSub>();
+ ls = oListModels.getObjectByJson_YS_ReceiveOtherBillSub(msg3);
+ int i = 0;
+ foreach (Model.ClsYS_ReceiveOtherBillSub oItemSub in ls)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+
+
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+
+ oBill.DetailColl.Add(oItemSub);
+
+ }
//淇濆瓨
//淇濆瓨瀹屾瘯鍚庡鐞�
@@ -239,7 +271,11 @@
{
try
{
- ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList");
+ List<DataTable> tableList = new List<DataTable>();
+
+ ds = oCN.RunProcReturn("exec h_p_YS_ReceiveOtherBillMain_Edit " + HInterID, "h_p_YS_ReceiveOtherBillMain_Edit");
+ tableList.Add(ds.Tables[0]);
+ tableList.Add(ds.Tables[1]);
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
@@ -253,7 +289,7 @@
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = ds.Tables[0];
+ objJsonResult.data = tableList;
return objJsonResult;
}
}
diff --git a/WebAPI/ListModels.cs b/WebAPI/ListModels.cs
index 04b5e19..dabda0c 100644
--- a/WebAPI/ListModels.cs
+++ b/WebAPI/ListModels.cs
@@ -1175,6 +1175,18 @@
}
/// <summary>
+ /// 澶勭悊鏂板鍏朵粬搴旀敹鍗曞瓙琛ㄧ殑json
+ /// </summary>
+ /// <param name="jsonString"></param>
+ /// <returns></returns>
+ public List<Model.ClsYS_ReceiveOtherBillSub> getObjectByJson_YS_ReceiveOtherBillSub(string jsonString)
+ {
+ jsonString = "[" + jsonString.ToString() + "]";
+ List<Model.ClsYS_ReceiveOtherBillSub> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsYS_ReceiveOtherBillSub>>(jsonString);
+ return list;
+ }
+
+ /// <summary>
/// 澶勭悊鏂板鍏朵粬搴斾粯鍗曡〃鐨刯son
/// </summary>
/// <param name="jsonString"></param>
--
Gitblit v1.9.1