yusijie
2023-12-29 d0d12fb5d0df58a0b9b3887f737551d17d5aeac8
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
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;
        }
 
 
        /// <summary>
        /// 不良原因根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_BadReasonBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_BadReasonDb(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 GetGy_BadReasonDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_IF_Edit_BadReasonList  where HItemID= " + HID + " ", "h_v_IF_Edit_BadReasonList");
            return dataSet;
        }
        
        /// <summary>
        /// 不良后果根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_BadResultBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_BadResultDb(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 GetGy_BadResultDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_BadResult  where HItemID= " + HID + " ", "h_v_Gy_BadResult");
            return dataSet;
        }
 
        /// <summary>
        /// 检测值根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_InspectValueBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_InspectValueDb(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 GetGy_InspectValueDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_InspectValue  where HItemID= " + HID + " ", "h_v_Gy_InspectValue");
            return dataSet;
        }
 
        /// <summary>
        /// 检验方法根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_InspectMethodBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_InspectMethodDb(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 GetGy_InspectMethodDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_InspectMethod  where HItemID= " + HID + " ", "h_v_Gy_InspectMethod");
            return dataSet;
        }
 
        /// <summary>
        /// 质量标准根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_QualityStdBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_QualityStdDb(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 GetGy_QualityStdDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_QualityStd  where HItemID= " + HID + " ", "h_v_Gy_QualityStd");
            return dataSet;
        }
 
        /// <summary>
        /// 检验仪器根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_InspectInstruMentBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_InspectInstruMentDb(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 GetGy_InspectInstruMentDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_InspectInstruMent  where HItemID= " + HID + " ", "h_v_Gy_InspectInstruMent");
            return dataSet;
        }
 
        /// <summary>
        /// 检验依据根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_InspectBasisBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_InspectBasisDb(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 GetGy_InspectBasisDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_InspectBasis  where HItemID= " + HID + " ", "h_v_Gy_InspectBasis");
            return dataSet;
        }
 
        /// <summary>
        /// 计量单位根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_UnitBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_UnitDb(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 GetGy_UnitDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_UnitList  where HItemID= " + HID + " ", "h_v_Edit_Gy_UnitList");
            return dataSet;
        }
 
        /// <summary>
        /// 货币设置根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_CurrencyBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_CurrencyDb(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 GetGy_CurrencyDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_CurrencyList  where HItemID= " + HID + " ", "h_v_Edit_Gy_CurrencyList");
            return dataSet;
        }
 
        /// <summary>
        /// 生产资源根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_SourceBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_SourceDb(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 GetGy_SourceDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_SourceList  where HItemID= " + HID + " ", "h_v_Edit_IF_SourceList");
            return dataSet;
        }
 
        /// <summary>
        /// 职员设置根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_EmployeeBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = GetGy_EmployeeDb(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 GetGy_EmployeeDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_EmployeeList  where HItemID= " + HID + " ", "h_v_Edit_IF_EmployeeList");
            return dataSet;
        }
 
 
        /// <summary>
        /// 物料设置根据id获取信息
        /// </summary>
        public static ApiResult<DataSet> GetGy_MaterialBillDetail(string HID)
        {
            if (string.IsNullOrEmpty(HID))
                return new ApiResult<DataSet> { code = -1, msg = "ID不能为空" };
            var dataSet = Gy_MaterialDb(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 Gy_MaterialDb(string HID)
        {
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_MaterialList  where HItemID= " + HID + " ", "h_v_Edit_Gy_MaterialList");
            return dataSet;
        }
 
    }
}