chenhaozhe
2025-10-22 75a4453d1c141c6ac434d1bd13927dc71cc9fa37
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÁìÁÏ·¢»õ/Kf_StepFoldOutBillController.cs
@@ -8,6 +8,7 @@
using Newtonsoft.Json.Linq;
using Model;
using DBUtility;
using Newtonsoft.Json;
namespace WebAPI.Controllers.仓存管理.领料发货
{
@@ -78,6 +79,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCn.RunProcReturn("select * from h_v_IF_StepFoldOutBillList order by hmainid desc", "h_v_IF_StepFoldOutBillList");
@@ -88,13 +90,19 @@
                    string sql = sql1 + sWhere + " order by hmainid desc";
                    ds = oCn.RunProcReturn(sql, "h_v_IF_StepFoldOutBillList");
                }
                foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用
                {
                    Type dataType = col.DataType; //获取当前数据类型传入 è‡ªå®šä¹‰å˜é‡datadataType
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接         // å°†åˆ—名和数据类型信息拼接成一个JSON格式的字符串
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                //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];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性
                objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性
                return objJsonResult;
                //}
                //else
@@ -238,6 +246,17 @@
                string HCloseMan = mainList[0].HCloseMan;
                string HCloseDate = mainList[0].HCloseDate;
                long HCurID = mainList[0].HCurID;
                long HProjectID = mainList[0].HProjectID;        //-项目
        //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
        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_StepFoldOutBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_StepFoldOutBillList");
@@ -249,12 +268,12 @@
                       ,HSupID,HWHID,HSCWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID
                       ,HMaker,HMakeDate,HChecker,HUpDater
                       ,HDeleteMan,HCloseMan
                       ,HRemark,HExplanation,HInnerBillNo,HCurID)
                       ,HRemark,HExplanation,HInnerBillNo,HCurID,HProjectID)
                        values(" + HInterID + ",'" + HBillNo + "','" + HDate + "','" + 1250 + "','" +
                    1250 + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID +
                    "," + HWHID + "," + HSCWHID + "," + HEmpID + "," + HManagerID + "," + HSecManagerID +
                    "," + HKeeperID + "," + HDeptID + ",'" + HMaker + "','" + HMakeDate + "','" + HChecker + "','" + HUpDater + "','" + HDeleteMan + "','" + HCloseMan + "','"
                    + HRemark + "','" + HExplanation + "','" + HInnerBillNo + "'," + HCurID + "" + ")");
                    + HRemark + "','" + HExplanation + "','" + HInnerBillNo + "'," + HCurID + "," + HProjectID + "" + ")");
                }
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
@@ -282,7 +301,7 @@
                    String sql="update Kf_ICStockBillMain   set " +
                                    "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
                                 ",HSupID=" + HSupID + ",HWHID=" + HWHID + ",HSCWHID=" + HSCWHID + ", HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HSecManagerID = " + HSecManagerID
                                 + ",HKeeperID=" + HKeeperID + ",HDeptID=" + HDeptID + "  where HInterID=" + HInterID;
                                 + ",HKeeperID=" + HKeeperID + ",HDeptID=" + HDeptID + ",HProjectID=" + HProjectID + "  where HInterID=" + HInterID;
                    oCn.RunProc(sql);
                    //删除子表
@@ -392,6 +411,18 @@
        {
            try
            {
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                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;
                }
                oCn.BeginTran();
                oCn.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID);
                oCn.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID);
@@ -456,6 +487,20 @@
                ds = oCn.RunProcReturn("select * from Kf_ICStockBillMain where HInterID = " + int.Parse(HInterID), "Kf_ICStockBillMain");
                string HBillNo = "";
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                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;
                }
                oCn.BeginTran();//开始事务
                if (ds == null || ds.Tables[0].Rows.Count == 0)
@@ -470,8 +515,6 @@
                {
                    HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                }
                //Type 1 å®¡æ ¸  2  åå®¡æ ¸