1
wtt
2 天以前 7141e956ca8488f6feb082828cd60653382b6c89
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂëÉú³É/KF_BarCodeStatusChangeBillController.cs
@@ -27,6 +27,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select * from h_v_KF_BarCodeStatusChangeBillList order by HMainID asc", "h_v_KF_BarCodeStatusChangeBillList");
@@ -37,11 +38,18 @@
                    string sql = sql1 + sWhere + " order by HMainID asc";
                    ds = oCN.RunProcReturn(sql, "h_v_KF_BarCodeStatusChangeBillList");
                }
                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列对象的列名
                }
                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;
            }
            catch (Exception e)
@@ -157,7 +165,15 @@
                DateTime dt = DateTime.Now;
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                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_POOrderBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_POOrderBillList");
@@ -186,12 +202,11 @@
                    oCN.RunProc("update KF_BarCodeStatusChangeBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + ",HBillStatus=" + HBillStatus +
                                ",HEmpID=" + HEmpID + ",HDeptID=" + HDeptID + " where HInterID=" + HInterID);
                    //删除子表
                    oCN.RunProc("delete from KF_BarCodeStatusChangeBillSub where HInterID='" + HInterID + "'");
                }
                //保存子表
                objJsonResult = AddBillSub(msg3, HInterID, OperationType);
                objJsonResult = AddBillSub(msg3, HInterID, OperationType, HMaker);
                if (objJsonResult.code == "0")
                {
@@ -218,7 +233,7 @@
            }
        }
        public json AddBillSub(string msg3, long HInterID, int OperationType)
        public json AddBillSub(string msg3, long HInterID, int OperationType,string user)
        {
            List<ClsKF_BarCodeStatusChangeBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsKF_BarCodeStatusChangeBillSub>>(msg3);
@@ -243,6 +258,8 @@
               ,HRelationMoney,HBarCode,HBarCodeStatus_Old,HBarCodeStatus_New,HAuxPropID_Old,HAuxPropID_New,HMTONo_Old,HMTONo_New) 
                 values({HInterID},{NewHEntryID},'{oSub.HBillNo_bak}','{oSub.HRemark}',{oSub.HSourceInterID}
                ,{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney},'{oSub.HBarCode}','{oSub.HBarCodeStatus_Old}','{oSub.HBarCodeStatus_New}','{oSub.HAuxPropID_Old}','{oSub.HAuxPropID_New}','{oSub.HMTONo_Old}','{oSub.HMTONo_New}')");
                    oCN.RunProc("update Gy_BarCodeBill  set " +
                               "HBarCodeStatus='" + oSub.HBarCodeStatus_New + "', HStatusMan='" + user + "'," + " HStatusDate=getdate()" + " where HBarCode='" + oSub.HBarCode+"'");
            }
            objJsonResult.code = "1";
@@ -260,6 +277,17 @@
        {
            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_BarCodeStatusChangeBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From KF_BarCodeStatusChangeBillSub where HInterID = " + HInterID);