llj
2025-10-31 54fd66c4912f6f104c4100730da9fbaba726b66f
九零报表控制器
1个文件已修改
1个文件已添加
126 ■■■■■ 已修改文件
WebAPI/Controllers/基础资料/基础资料/Gy_PlanImplementation_ReportController.cs 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_PlanImplementation_ReportController.cs
New file
@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web.Http;
using WebAPI.DLL;
using WebAPI.Models;
using WebAPI.Service;
using Kingdee.BOS.WebApi.Client;
using System.Linq;
namespace WebAPI.Controllers.基础资料.基础资料
{
    public class Gy_PlanImplementation_ReportController : ApiController
    {
        private json objJsonResult = new json();
        public DataSet ds = new DataSet();
        public SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        // GET: Gy_PlanImplementation_Report
        [Route("Gy_PlanImplementation_ReportController/PlanStatusReport")]
        [HttpGet]
        public object PlanStatusReport(string sWhere, string HBeginDate, string HEndDate)
        {
            List<object> columnNameList = new List<object>();
            try
            {
                // éªŒè¯æ—¥æœŸ
                if (!DateTime.TryParse(HBeginDate, out DateTime beginDate) || !DateTime.TryParse(HEndDate, out DateTime endDate))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "日期格式不正确";
                    return objJsonResult;
                }
                if(sWhere!=null)
                ds = oCN.RunProcReturn($"select * from PlanImplementationStatus where æ—¥æœŸ<='{HEndDate}' and æ—¥æœŸ>='{HBeginDate}' and {sWhere}", "PlanImplementationStatus");
                else
                    ds = oCN.RunProcReturn($"select * from PlanImplementationStatus where æ—¥æœŸ<='{HEndDate}' and æ—¥æœŸ>='{HBeginDate}'", "PlanImplementationStatus");
                // æ·»åŠ åˆ—å
                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));
                }
                objJsonResult.code = "1";
                objJsonResult.count = ds.Tables[0].Rows.Count;
                objJsonResult.Message = "Success!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        [Route("Gy_PlanImplementation_ReportController/OperationBillReport")]
        [HttpGet]
        public object OperationBillReport(string HEquipmentNumber, string HBeginDate, string HEndDate)
        {
            List<object> columnNameList = new List<object>();
            try
            {
                // éªŒè¯æ—¥æœŸ
                if (!DateTime.TryParse(HBeginDate, out DateTime beginDate) || !DateTime.TryParse(HEndDate, out DateTime endDate))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "日期格式不正确";
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn($"exec h_p_OperationBill '{HBeginDate}','{HEndDate}',''{HEquipmentNumber}", "h_p_OperationBill");
                // æ·»åŠ åˆ—å
                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));
                }
                objJsonResult.code = "1";
                objJsonResult.count = ds.Tables[0].Rows.Count;
                objJsonResult.Message = "Success!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}
WebAPI/WebAPI.csproj
@@ -642,6 +642,7 @@
    <Compile Include="Controllers\基础资料\基础资料\Gy_PaymentConditionListBillController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_DisposeWayController.cs" />
    <Compile Include="Controllers\华远datamapping\Gy_PNLInfoController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_PlanImplementation_ReportController.cs" />
    <Compile Include="Controllers\基础资料\基础资料\Gy_PNLInfoTypeLevelController.cs" />
    <Compile Include="Controllers\项目管理\工程项目\PM_ProjectBill_WorkController.cs" />
    <Compile Include="DLL\ClsSc_MESStopRestoreWorkBill.cs" />
@@ -1239,6 +1240,7 @@
    <Folder Include="Views\Gy_Operator\" />
    <Folder Include="Views\Gy_PackType\" />
    <Folder Include="Views\Gy_PaymentConditionListBill\" />
    <Folder Include="Views\Gy_PlanImplementation_Report\" />
    <Folder Include="Views\Gy_PNLInfoTypeLevel\" />
    <Folder Include="Views\Gy_RateType\" />
    <Folder Include="Views\Gy_RecConditionBill\" />