wyb
2021-05-20 b0c660e2b4054a450ac1b7d07edf07cfd40f9099
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using WebAPI.Models;
 
namespace WebAPI.Service
{
    public class LuBaoSevice
    {
 
        /// <summary>
        /// 工序汇报扫码方法 
        /// </summary>
        public static ApiResult<DataSet> GetHbarCodeDetail(string sBillBarCode)
        {
            if (string.IsNullOrEmpty(sBillBarCode))
                return new ApiResult<DataSet> { code = -1, msg = "条码不能为空" };
            sBillBarCode = sBillBarCode.CompareTo("#") > 0 ? sBillBarCode.Split(Convert.ToChar("#"))[0] : sBillBarCode;
            var dataSet = GetBarCodeDb(sBillBarCode);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在派工单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetBarCodeDb(string billBarCode)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where HBillType='3712' and  单据号= '" + billBarCode + "'", "h_v_Sc_ProcessSendWorkList");
            return dataSet;
        }
 
        /// <summary>
        /// 委外工序汇报扫码方法 
        /// </summary>
        public static ApiResult<DataSet> WWGetHbarCodeDetail(string sBillBarCode)
        {
            if (string.IsNullOrEmpty(sBillBarCode))
                return new ApiResult<DataSet> { code = -1, msg = "条码不能为空" };
            sBillBarCode = sBillBarCode.CompareTo("#") > 0 ? sBillBarCode.Split(Convert.ToChar("#"))[0] : sBillBarCode;
            var dataSet = WWGetBarCodeDb(sBillBarCode);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在委外派工单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet WWGetBarCodeDb(string billBarCode)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList  where HBillType='3740' and 单据号= '" + billBarCode + "'", "h_v_WW_EntrustProcSendWorkBillList");
            return dataSet;
        }
 
        /// <summary>
        /// PDA汇报单回车方法 
        /// </summary>
        public static ApiResult<DataSet> GetProcDetail(string sBillNo, string sProcNo)
        {
            if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo))
                return new ApiResult<DataSet> { code = -1, msg = "条码和流转卡不能为空" };
            var dataSet = GetProcDb(sBillNo, sProcNo);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "流水号或流转卡号为空" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetProcDb(string sBillNo, string sProcNo)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList  where HBillType='3712' and  单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_Sc_ProcessSendWorkList");
            return dataSet;
        }
 
        /// <summary>
        /// PDA委外汇报单回车方法 
        /// </summary>
        public static ApiResult<DataSet> WWGetProcDetail(string sBillNo, string sProcNo)
        {
            if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo))
                return new ApiResult<DataSet> { code = -1, msg = "条码和流转卡不能为空" };
            var dataSet = WWGetProcDb(sBillNo, sProcNo);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "流水号或流转卡号为空" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet WWGetProcDb(string sBillNo, string sProcNo)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList  where HBillType='3740' and  单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_WW_EntrustProcSendWorkBillList");
            return dataSet;
        }
 
 
        /// <summary>
        /// 检验方案根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetCheckProjectDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetProjectDb(HID);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在检验单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetProjectDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_Edit_QCCheckProjectList  where hmainid= " + HID +" ", "h_v_Gy_Edit_QCCheckProjectList");
            return dataSet;
        }
 
 
        /// <summary>
        /// 来料检验根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetPOStockInCheckBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetPOStockInDb(HID);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在来料检验单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetPOStockInDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_POStockInCheckBillList  where hmainid= " + HID + " ", "h_v_QC_Edit_POStockInCheckBillList");
            return dataSet;
        }
 
 
        /// <summary>
        /// 首料检验根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetQC_FirstPieceCheckBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetFirstPieceCheckDb(HID);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在首料检验单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetFirstPieceCheckDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_FirstPieceCheckBillList  where hmainid= " + HID + " ", "h_v_QC_Edit_FirstPieceCheckBillList");
            return dataSet;
        }
 
        /// <summary>
        /// 巡检单根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetQC_PatrolProcCheckBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetPatrolProcCheckDb(HID);
            if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
                return new ApiResult<DataSet> { code = -1, msg = "不存在巡检单号" };
            return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet };
        }
 
        public static DataSet GetPatrolProcCheckDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_PatrolProcCheckBillList  where hmainid= " + HID + " ", "h_v_QC_Edit_PatrolProcCheckBillList");
            return dataSet;
        }
 
    }
}