chenhaozhe
2025-11-04 c864d6da7e40046d7d4f9a45f007f7b3dcd5cf78
WebAPI/Controllers/Æ·ÖʹÜÀí/ÖÊÁ¿Ô¶ÈÄ¿±êµ¥/QC_MonthTarGetBillController.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -81,6 +82,62 @@
        #endregion
        #region è´¨é‡æœˆåº¦ç›®æ ‡å• åˆ†é¡µåˆ—表
        [Route("QC_MonthTarGetBill/getQC_MonthTarGetBillListPage")]
        [HttpGet]
        public json getQC_MonthTarGetBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断权限
                if (!DBUtility.ClsPub.Security_Log("QC_MonthTarGetBill_Query", 3, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "您没有该模块权限,请与管理员联系!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                sWhere = sWhere.Replace("'", "''");
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_QC_MonthTarGetBillMainList " + page + "," + size + ",''", "h_p_QC_MonthTarGetBillMainList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_QC_MonthTarGetBillMainList " + page + "," + size + ",'" + sWhere + "'", "h_p_QC_MonthTarGetBillMainList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        #region è´¨é‡æœˆåº¦ç›®æ ‡å• ä¿å­˜/编辑
        /// <summary>
        /// é¡¹ç›®éªŒæ”¶å•
@@ -94,9 +151,11 @@
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string refSav = sArray[1].ToString();//操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string user = sArray[2].ToString();//用户名
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString(); //子表
            string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 å¤åˆ¶
            string user = sArray[3].ToString();//用户名
            string UserName = "";
            string s = "";
@@ -171,13 +230,7 @@
                    }
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "7523";
                    oItem.HBillSubType = "7523";
                    //oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
                    //oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
                    oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
                    oItem.HBillSubType = "7523";
                    if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
                    {
@@ -189,6 +242,29 @@
                    }
                    oBill.omodel = oItem;
                }
                // è¡¨ä½“数据
                //按 },{来拆分数组 //去掉【和】
                msg3 = msg3.Substring(1, msg3.Length - 2);
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                string jsonString1 = "[" + msg3.ToString() + "]";
               List<ClsQC_MonthTarGetBillSub> ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsQC_MonthTarGetBillSub>>(jsonString1);
                int i = 0;
                foreach (Model.ClsQC_MonthTarGetBillSub oItemSub in ls)
                {
                    i++;
                    oItemSub.HEntryID = i;
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    oBill.DetailColl.Add(oItemSub);
                }
                //保存
                //保存完毕后处理
                bool bResult;
@@ -257,6 +333,7 @@
                }
                oCN.BeginTran();
                oCN.RunProc("Delete From QC_MonthTarGetBillMain where HInterID = " + HInterID);
                oCN.RunProc("Delete From QC_MonthTarGetBillSub where HInterID = " + HInterID);
                oCN.Commit();
                objJsonResult.code = "1";
@@ -277,12 +354,7 @@
        }
        #endregion
        #region æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•(加载表用)
        /// <summary>
        /// æ ¹æ®åŸºç¡€èµ„æ–™ID æŸ¥æ‰¾è®°å½•
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        #region è´¨é‡æœˆåº¦ç›®æ ‡å•  ç¼–辑回显
        [Route("QC_MonthTarGetBill/cx")]
        [HttpGet]
        public object cx(long HInterID)
@@ -290,7 +362,7 @@
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_QC_MonthTarGetBillList where hmainid =" + HInterID, "h_v_QC_MonthTarGetBillList");
                ds = oCN.RunProcReturn("select * from h_v_QC_MonthTarGetBill_Edit where hmainid =" + HInterID, "h_v_QC_MonthTarGetBill_Edit");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";