1
yangle
2024-05-17 8b0f16ffc339afa580534c935131b5095537e5a2
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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
using DAL;
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Windows.Forms;
using WebAPI;
using WebAPI.Models;
using WebAPI.Service;
 
namespace WebAPI.Controllers
{
    public class MouldController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public DataSet ds = new DataSet();
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
 
        #region 器具扫码模块调用方法
 
        #region 器具扫码模块  扫描器具条码调用方法
        /// <summary>
        /// 扫描器具条码
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/Get_CheckTypeByMouldBarCode_Json")]
        [HttpGet]
        public object Get_CheckTypeByMouldBarCode_Json(string sBarCode, Int64 HInterID, string HBillType, string HBillNo, string HMaker, Int64 HWhID, Int64 HSPID, Int64 HSCWhID, Int64 HSCSPID, bool HRedBlueFlag, string HSourceBillNo, string HSourceBillType, Int64 HStockOrgID)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_AddMouldBarCode_New '" + sBarCode + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HSCWhID.ToString() + "," + HSCSPID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HRedBlueFlag + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_WMS_AddMouldBarCode_New");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "将器具信息写入器具出入库临时表失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "扫描器具条码失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
        #region 器具扫码模块  获取器具列表信息处理方法
        /// <summary>
        /// 获取器具列表信息
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/GetMouldBillEntryTmpList_Json")]
        [HttpGet]
        public object GetMouldBillEntryTmpList_Json(Int64 HInterID, string HBillNo, string HBillType)
        {
            try
            {
                ds = oCn.RunProcReturn("exec h_p_WMS_MouldBillEntryTmpList " + HInterID.ToString() + ",'" + HBillType + "'", "h_p_WMS_MouldBillEntryTmpList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有返回任何记录!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    List<object> columnNameList = new List<object>();
                    //添加列名
                    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 = 1;
                    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 器具扫码模块    删除功能按钮调用  删除器具列表选中行临时表记录
 
        /// <summary>
        /// 删除器具列表选中行临时表记录
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/set_DelMouldStockBillMain_Temp_Json")]
        [HttpGet]
        public object set_DelPonderationBillMain_Temp_BarCode_Json(Int64 HInterID, string HBillType, string HBarCode)
        {
            try
            {
                oCn.RunProc("Delete from Sc_MouldStockBillMain_Temp where HInterID=" + HInterID.ToString() + " and HBillType='" + HBillType + "' and HBarCode='" + HBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除器具列表记录失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
        #endregion
 
 
        #region 器具提交生单处理方法
 
        #region 模具领用出库单     上传生单
 
        /// <summary>
        /// 模具领用出库单新增上传
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/set_SaveMouldProdOutBill_Json")]
        [HttpPost]
        public object set_SaveMouldProdOutBill_Json([FromBody] JObject oMain)
        {
            BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            DAL.ClsSc_MouldProdOutBill BillNew = new DAL.ClsSc_MouldProdOutBill();
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                string sMainStr = "[" + msg1.ToString() + "]";
                List<Model.ClsSc_MouldProdOutBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdOutBillMain>>(sMainStr);
 
                //单据号是否重复
                if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号重复!不允许保存!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //固定赋值=================================
                BillNew.omodel.HYear = sYear;
                BillNew.omodel.HPeriod = sPeriod;
                BillNew.omodel.HBillType = "3802";
                BillNew.omodel.HInterID = mainList[0].HInterID;
                BillNew.omodel.HBillNo = mainList[0].HBillNo;
                BillNew.omodel.HDate = mainList[0].HDate;
                BillNew.omodel.HRemark = mainList[0].HRemark;
                BillNew.omodel.HMaker = mainList[0].HMaker;
                BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID;
                DBUtility.ClsPub.CurUserName = mainList[0].HMaker;
                //====================================================
                BillNew.omodel.HSupID = mainList[0].HSupID;
                BillNew.omodel.HSupTypeID = mainList[0].HSupTypeID;
                BillNew.omodel.HEmpID = mainList[0].HEmpID;
                BillNew.omodel.HManagerID = mainList[0].HManagerID;
                BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID;
                BillNew.omodel.HKeeperID = mainList[0].HKeeperID;
                BillNew.omodel.HDeptID = mainList[0].HDeptID;
                BillNew.omodel.HWHID = mainList[0].HWHID;
                BillNew.omodel.HSCWHID = mainList[0].HSCWHID;
                BillNew.omodel.HExplanation = mainList[0].HExplanation;
                BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo;
                BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag;
                //子表赋值
                ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有扫码信息,请先扫描条码,确认无误后再提交!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                    {
                        Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub();
                        //固定赋值========================================
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]);
                        oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]);
                        oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]);
                        oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]);
                        oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]);
                        //=============================
                        oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]);
                        oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]);
                        oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]);
                        oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]);
                        oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]);
                        oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]);
                        oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]);
                        oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]);
                        oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]);
                        oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]);
                        oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]);
                        oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]);
                        oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]);
                        oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]);
                        oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]);
                        oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]);
                        oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]);
                        oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]);
                        oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]);
                        oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]);
                        oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]);
                        oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                        oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]);
                        oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]);
                        oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]);
                        oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]);
                        oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]);
                        oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]);
                        oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]);
                        oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]);
                        oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]);
                        oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]);
                        oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]);
                        oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]);
                        BillNew.DetailColl.Add(oSub);
                    }
                }
                //保存
                bool bResult;
                bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
 
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "模具领用出库单上传失败!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
        #region 模具领用退库单     上传生单
 
        /// <summary>
        /// 模具领用退库单新增上传
        /// </summary>
        /// <returns></returns>
        [Route("MouldController/set_SaveMouldProdBackBill_Json")]
        [HttpPost]
        public object set_SaveMouldProdBackBill_Json([FromBody] JObject oMain)
        {
            BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            DAL.ClsSc_MouldProdBackBill BillNew = new DAL.ClsSc_MouldProdBackBill();
            var _value = oMain["oMain"].ToString();
            string msg1 = _value.ToString();
            try
            {
                string sMainStr = "[" + msg1.ToString() + "]";
                List<Model.ClsSc_MouldProdBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsSc_MouldProdBackBillMain>>(sMainStr);
 
                //单据号是否重复
                if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, mainList[0].HBillNo, BillStatus, mainList[0].HInterID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据号重复!不允许保存!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断会计期是否合理
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(mainList[0].HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //固定赋值=================================
                BillNew.omodel.HYear = sYear;
                BillNew.omodel.HPeriod = sPeriod;
                BillNew.omodel.HBillType = "3803";
                BillNew.omodel.HInterID = mainList[0].HInterID;
                BillNew.omodel.HBillNo = mainList[0].HBillNo;
                BillNew.omodel.HDate = mainList[0].HDate;
                BillNew.omodel.HRemark = mainList[0].HRemark;
                BillNew.omodel.HMaker = mainList[0].HMaker;
                BillNew.omodel.HSTOCKORGID = mainList[0].HSTOCKORGID;
                DBUtility.ClsPub.CurUserName = mainList[0].HMaker;
                //====================================================
                BillNew.omodel.HSupID = mainList[0].HSupID;
                BillNew.omodel.HSupTypeID = mainList[0].HSupTypeID;
                BillNew.omodel.HEmpID = mainList[0].HEmpID;
                BillNew.omodel.HManagerID = mainList[0].HManagerID;
                BillNew.omodel.HSecManagerID = mainList[0].HSecManagerID;
                BillNew.omodel.HKeeperID = mainList[0].HKeeperID;
                BillNew.omodel.HDeptID = mainList[0].HDeptID;
                BillNew.omodel.HWHID = mainList[0].HWHID;
                BillNew.omodel.HSCWHID = mainList[0].HSCWHID;
                BillNew.omodel.HExplanation = mainList[0].HExplanation;
                BillNew.omodel.HInnerBillNo = mainList[0].HInnerBillNo;
                BillNew.omodel.HRedBlueFlag = mainList[0].HRedBlueFlag;
                //子表赋值
                ds = oCn.RunProcReturn("exec h_p_Sc_GetMouldStockBill_Temp " + BillNew.omodel.HInterID.ToString() + ",'" + BillNew.omodel.HBillType + "'", "h_p_Sc_GetMouldStockBill_Temp");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有扫码信息,请先扫描条码,确认无误后再提交!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                    {
                        Model.ClsSc_MouldStockBillSub oSub = new Model.ClsSc_MouldStockBillSub();
                        //固定赋值========================================
                        oSub.HEntryID = i + 1;
                        oSub.HRemark = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HRemark"]);
                        oSub.HSourceInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]);
                        oSub.HSourceEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]);
                        oSub.HSourceBillType = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillType"]);
                        oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]);
                        oSub.HRelationQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationQty"]);
                        oSub.HRelationMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HRelationMoney"]);
                        //=============================
                        oSub.HMaterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]);
                        oSub.HPropertyID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HAuxPropID"]);
                        oSub.HSecUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSecUnitID"]);
                        oSub.HSecUnitRate = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HSecUnitRate"]);
                        oSub.HUnitID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HUnitID"]);
                        oSub.HBatchNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]);
                        oSub.HQtyMust = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyMust"]);
                        oSub.HQtyRel = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQtyRel"]);
                        oSub.HQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HQty"]);
                        oSub.HPrice = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HPrice"]);
                        oSub.HMoney = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HMoney"]);
                        oSub.HDesignLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HDesignLife"]);
                        oSub.HLeaveLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HLeaveLife"]);
                        oSub.HUseLife = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLife"]);
                        oSub.HUseLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HUseLifeQty"]);
                        oSub.HNewLifeQty = DBUtility.ClsPub.isDoule(ds.Tables[0].Rows[i]["HNewLifeQty"]);
                        oSub.HWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]);
                        oSub.HSCWHID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCWHID"]);
                        oSub.HSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPID"]);
                        oSub.HSCSPID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSCSPID"]);
                        oSub.HSPGroupID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSPGroupID"]);
                        oSub.HBarCode = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBarCode"]);
                        oSub.HCorrespondentTypeID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentTypeID"]);
                        oSub.HCorrespondentID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HCorrespondentID"]);
                        oSub.HPOOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderInterID"]);
                        oSub.HPOOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HPOOrderEntryID"]);
                        oSub.HPOOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HPOOrderBillNo"]);
                        oSub.HSeOrderInterID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderInterID"]);
                        oSub.HSeOrderEntryID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSeOrderEntryID"]);
                        oSub.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSeOrderBillNo"]);
                        oSub.HStockOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HStockOrgID"]);
                        oSub.HOWNERID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOWNERID"]);
                        oSub.HOtherOrgID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HOtherOrgID"]);
                        oSub.HOWNERTYPEID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HOWNERTYPEID"]);
                        BillNew.DetailColl.Add(oSub);
                    }
                }
                //保存
                bool bResult;
                bResult = BillNew.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
 
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;  //成功!
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "模具领用退库单上传失败!" + e.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
 
        #endregion
 
 
 
        #endregion
 
 
 
 
 
 
 
 
 
 
    }
}