yusijie
2026-04-07 fc54037c44b84e9782f06f3bedf37ae97b93d97e
WebAPI/Controllers/ÎïÁ÷¹ÜÀí/³öÔ˵¥/WLYayBillController.cs
@@ -79,6 +79,62 @@
        }
        #endregion
        #region å‡ºè¿å• åˆ†é¡µåˆ—表2
        [Route("WLYayBillController/page")]
        [HttpGet]
        public json page(string sWhere, string user, int page, int size, string Type)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //列表进入时判断权限,选源单进入不判断权限
                if (!DBUtility.ClsPub.Security_Log("WLYayBill_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_WL_YayBill " + page + "," + size + ",'','" + Type + "'", "h_p_WL_YayBill");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_WL_YayBill " + page + "," + size + ",'" + sWhere + "','" + Type + "'", "h_p_WL_YayBill");
                }
                //添加列名
                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列对象的列名
                }
                objJsonResult.code = "0";
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "成功!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询列表信息失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å‡ºè¿å• æ ¹æ®æºå•传物料列表
        [Route("WLYayBillController/GetMesByOrginBill")]
        [HttpGet]
@@ -577,7 +633,7 @@
                    var HName = ds.Tables[0].Rows[0]["HName"].ToString();
                    var HIDCard = ds.Tables[0].Rows[0]["HIDCard"].ToString();
                    oCN.BeginTran();
                    oCN.RunProc("update WL_YayBillMain set HDriverID='" + HcheckID + "', DriverHName='" + HName + "', DriverHIDCard='" + HIDCard + "' where HInterID=" + HInterID);
                    oCN.RunProc("update WL_YayBillMain set HDriverID='" + HcheckID + "', DriverHName='" + HName + "', DriverHIDCard='" + HIDCard + "',HDate_AllocationDriver=getdate() where HInterID=" + HInterID);
                    oCN.Commit();
                    objJsonResult.code = "1";
@@ -816,9 +872,118 @@
        }
        #endregion
        #region å‡ºè¿å• èŽ·å–å­è¡¨æ•°æ®
        [Route("WLYayBillController/GetList")]
        [HttpGet]
        public object GetList(string hmainid_hsubid, string user)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("WLYayBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = $"select * from h_v_Gy_MaterialPackingRelation where hmainid_hsubid in (" + hmainid_hsubid + ")";
                // æ‰§è¡ŒæŸ¥è¯¢
                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBillMain");
                //添加列名
                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列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å‡ºè¿å• èŽ·å–æ‰¿è¿åˆåŒæ•°æ®
        [Route("WLYayBillController/initDataForSelectContractTransportBill")]
        [HttpGet]
        public object initDataForSelectContractTransportBill(int hmainid)
        {
            try
            {
                string sql = "exec WL_YayBill_initDataForSelectContractTransportBill " + hmainid;
                // æ‰§è¡ŒæŸ¥è¯¢
                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBill_initDataForSelectContractTransportBill");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å‡ºè¿å• æ ¹æ® æ‰¿è¿å•†id、运输路线名称、车型id、运输方式 èŽ·å– æ‰¿è¿åˆåŒæ•°æ®
        [Route("WLYayBillController/getSelectContractTransportBillEntryData")]
        [HttpGet]
        public object getSelectContractTransportBillEntryData(int Cg_ContractTransportBillInterID,int HSupID, string HTransportLineName, int HCarTypeID, string HTransportTyep)
        {
            try
            {
                string sql = "exec WL_YayBill_getSelectContractTransportBillEntryData " + Cg_ContractTransportBillInterID + "," + HSupID + ",'" + HTransportLineName + "'," + HCarTypeID + ",'" + HTransportTyep + "'";
                // æ‰§è¡ŒæŸ¥è¯¢
                DataSet ds = oCN.RunProcReturn(sql, "WL_YayBill_getSelectContractTransportBillEntryData");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + ex.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}