yangle
2022-05-20 4f02ca1181a5a9c1d3207114c15bc6a72fd63971
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÌõÂë³öÈë¿â¼Ç¼/Kf_ICStockInOutBillController.cs
@@ -61,24 +61,25 @@
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = ds.Tables[0].Rows.Count;
                    objJsonResult.Message = "获取资源绑定数据成功!";
                    objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //序列化DataSet中的时间格式,然后再反序列化回来
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "暂无资源绑定!";
                    objJsonResult.data = null;
                    objJsonResult.list = columnNameList;
                    return objJsonResult;
                }
                //if (ds.Tables[0].Rows.Count > 0)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = ds.Tables[0].Rows.Count;
                objJsonResult.Message = "获取资源绑定数据成功!";
                objJsonResult.data = JsonConvert.DeserializeObject<DataTable>(JsonConvert.SerializeObject(ds.Tables[0], new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }));  //序列化DataSet中的时间格式,然后再反序列化回来
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
                //{
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "暂无资源绑定!";
                //    objJsonResult.data = null;
                //    objJsonResult.list = columnNameList;
                //    return objJsonResult;
                //}
            }
            catch (Exception e)
            {
@@ -92,5 +93,114 @@
            return objJsonResult;
        }
        #endregion
        #region æ¡ç å‡ºå…¥åº“缓存
        #region æ¡ç å‡ºå…¥åº“缓存列表
        [Route("Kf_ICStockInOutBill/GetPonderationBillMain_Temp")]
        [HttpGet]
        public object GetPonderationBillMain_Temp(string sWhere,string user)
        {
            try
            {
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_BarCodeBillList", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet ds = new DataSet();
                string sql1 = string.Format(@"select * from h_v_KF_PonderationBillMain_Temp2 where 1=1 ");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds= oCN.RunProcReturn(sql1 + "order by HInterID desc", "h_v_KF_PonderationBillMain_Temp2");
                }
                else
                {
                    ds = oCN.RunProcReturn(sql1 + sWhere + "order by HInterID desc", "h_v_KF_PonderationBillMain_Temp2");
                }
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "查询数据异常,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "返回记录成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.Message.ToString();
                objJsonResult.data = null;
            }
            return objJsonResult;
        }
        #endregion
        #region æ¡ç å‡ºå…¥åº“缓存删除
        [Route("Kf_ICStockInOutBill/DelectPonderationBillMain_TempByID")]
        [HttpGet]
        public object DelectPonderationBillMain_TempByID(string HInterID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log_second("Gy_BarCodeBillList_Delete", 1, false, user))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "无删除权限!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string s = "";
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据ID为空!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DataSet ds = new DataSet();
            DataSet ds1 = new DataSet();
            ds = oCN.RunProcReturn("select * from KF_PonderationBillMain_Temp where HInterID="+ HInterID, "KF_PonderationBillMain_Temp");
            if (ds.Tables[0].Rows.Count!=0)
            {
                oCN.BeginTran();
                oCN.RunProc("delete from KF_PonderationBillMain_Temp where HInterID=" + HInterID);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功";
                objJsonResult.data = null;
                oCN.Commit();
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据未找到";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
    }
}