duhe
2025-06-03 067596ed46c962ce38d90a3ed33e9c55f184225c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Data.SqlClient;
using System.Web.Http;
using WebAPI.Models;
using Newtonsoft.Json;
 
namespace WebAPI.Controllers.生产管理
{
    //设备状态分布Controller
    public class Sc_HEquipStateDistributionController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
 
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
 
 
        #region 设备分布 设备绑定的生产资源上正在生产的工单 
 
        [Route("Sc_HEquipStateDistribution/Sc_HEquipStateDistribution_Souce")]
        [HttpGet]
        public object Sc_HEquipStateDistribution_Souce(string HDeptID, string user, int OrganizationID)
        {
            try
            {
                string sql1 = string.Format("exec h_p_sc_HDeptSouceMOList {0},{1}", HDeptID, OrganizationID);
 
                ds = oCN.RunProcReturn(sql1, "h_p_sc_HDeptSouceMOList");
 
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
 
        #region 设备状态分步下推设备点检参数表
        [Route("Sc_HEquipStateDistribution/Get_EquipICMOTechParamList_Json")]
        [HttpGet]
        public object Get_EquipICMOTechParamList_Json(string sWhere, string user)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
 
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
 
                string HEquipID = dic["HEquipID"].ToString();
                string HICMOInterID = dic["HICMOInterID"].ToString();
                string HICMOEntryID = dic["HICMOEntryID"].ToString();
 
                ds = oCN.RunProcReturn("exec h_p_Sc_HEquipStateDistribution_TechParam '" + HEquipID + "','" + HICMOInterID + "','"+ HICMOEntryID + "'", "h_p_Sc_HEquipStateDistribution_TechParam");
 
                //添加列名
                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 e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
 
        #region 设备状态分步 产线+部门 查询 下方四个图表数据
        [Route("Sc_HEquipStateDistribution/Get_EquipStateDistribution_FourReport")]
        [HttpGet]
        public object Get_EquipStateDistribution_FourReport(string sWhere, string user)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
 
                Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere);
 
                string HDeptID = dic["HDeptID"].ToString();
                string HSourceID = dic["HSourceID"].ToString();
 
                ds = oCN.RunProcReturn("exec h_p_Sc_FourStateDistributionReport '" + HDeptID + "','" + HSourceID + "'", "h_p_Sc_FourStateDistributionReport");
 
                //添加列名
                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;
                objJsonResult.list = columnNameList;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}