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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Pub_Class;
using SQLHelper;
 
namespace PlanM
{
    public partial class Gy_DataIn_RoutingBill :BLL.Gy_DataInTmp
    {
        public Gy_DataIn_RoutingBill()
        {
            InitializeComponent();
        }
 
        public int HMaterNumberCol = 0;             //²úÆ·´úÂë
        public int HProcNoCol = 0;       //¹¤ÐòÐòºÅ
        public int HProcNameCol = 0;           //¹¤Ðò
        public int HWorkCenterNameCol = 0;        //¹¤×÷ÖÐÐÄ   
        public int HWorkQtyCol = 0;          //¼Ó¹¤ÊýÁ¿
        public int HBeginDayQtyCol = 6;     //¿ª¹¤¹ÌÌì
        public int HBeginFixQtyCol = 7;     //¿ª¹¤ÓàÁ¿ 
        public int HFixPriceCol = 8;        //¶¨¶î Ð¡Ê±¹¤×Ê
        public int HProcPriceCol = 9;       //¹¤¼Û
        public int HTechnologyParameterCol = 0;       //¹¤ÒÕ²ÎÊý
        public int HPicNumCol = 0;       //ͼֽ±àºÅ 
        public int HProcCheckNoteCol = 0;       //±¾¹¤ÐòÈ·ÈϼǼ
 
        public int HPicNumVerCol = 0;       //ͼºÅ°æ±¾
        public int HPicNumAssembleCol = 0;       //×ÜװͼºÅ
        public int HMaterTextureCol = 0;       //²ÄÖÊ
        public int HProductNumCol = 0;       //³ÉÆ·±àºÅ
        public int HVerNumCol = 0;       //°æ±¾
        public int HMouldNoCol = 0;       //Ä£¾ß±àºÅ
        public int HProcWorkNumCol = 0;        //³ÌÐòºÅ
        public int HPassRateCol = 0;        //Á¼ÂÊ
        //
        public const int HBeginRow = 2;         //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý
        // 
        public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
        DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
        DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
        DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
        public DAL.ClsGy_RoutingBill BillNew = new DAL.ClsGy_RoutingBill();
        DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
        long j = -1;
        int c = 0;
 
        public override bool OpenExcelData()
        {
            base.sSheetName = txtHSheetName.Text;
            return base.OpenExcelData();
        } 
 
        /// <summary>
        ///  ³õʼ»¯½çÃæ
        /// </summary>
        public override void initData()
        {
            base.initData();
            base.sSheetName = txtHSheetName.Text ; 
            base.ModRightName = "Gy_DataIn_RoutingBill";
            base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck;
            base.ModRightNameClose = base.ModRightName + base.ModRightNameClose;
            base.ModRightNameDelete = base.ModRightName + base.ModRightNameDelete;
            base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit;
            base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney;
            base.ModRightNameQty = base.ModRightName + base.ModRightNameQty;
            base.ModCaption = "¹¤ÒÕ·Ïßµ¼Èë";
            this.Text = base.ModCaption;
            lblCaption.Text = base.ModCaption;
            //
            DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear);
            DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod);
            //
        }
        //µ¼Èë
        public override void Sub_DataIn()
        {
            string hnumber = "";
            string HBillNo = "";
            //
            HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain);
            HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÐòÐòºÅ", grdMain);
            HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain);
            HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ÖÐÐÄ", grdMain);
            HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¼Ó¹¤ÊýÁ¿", grdMain);
            HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("ͼֽ±àºÅ", grdMain);
            HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÒÕ²ÎÊý", grdMain);
            HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("±¾¹¤ÐòÈ·ÈϼǼ", grdMain);
            HPicNumVerCol = DBUtility.Gy_BaseFun.Fun_GetCol("ͼºÅ°æ±¾", grdMain);
            HPicNumAssembleCol = DBUtility.Gy_BaseFun.Fun_GetCol("×ÜװͼºÅ", grdMain);
            HMaterTextureCol = DBUtility.Gy_BaseFun.Fun_GetCol("²ÄÖÊ", grdMain);
            HProductNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("³ÉÆ·±àºÅ", grdMain);
            HVerNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("°æ±¾", grdMain);
            HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("Ä£¾ß±àºÅ", grdMain);
            HProcWorkNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("³ÌÐòºÅ", grdMain);
            HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¿ª¹¤ÓàÁ¿", grdMain);
            HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¿ª¹¤¹ÌÌì", grdMain);
            HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("Сʱ¹¤×Ê", grdMain);
            HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("µ¥¸ö¹¤¼Û", grdMain);
            HPassRateCol = DBUtility.Gy_BaseFun.Fun_GetCol("Á¼ÂÊ", grdMain);
 
            //ûÓÐÕÒµ½ÁÐ
            if (HMaterNumberCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾²úÆ·´úÂë¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProcNameCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤Ðò¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HWorkCenterNameCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤×÷ÖÐÐÄ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HWorkQtyCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¼Ó¹¤ÊýÁ¿¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HBeginFixQtyCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¿ª¹¤ÓàÁ¿¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HBeginDayQtyCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¿ª¹¤¹ÌÌì¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HFixPriceCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾Ð¡Ê±¹¤×Ê¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProcPriceCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾µ¥¸ö¹¤¼Û¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProcNoCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤ÐòÐòºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HTechnologyParameterCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤ÒÕ²ÎÊý¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HPicNumCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾Í¼Ö½±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProcCheckNoteCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾±¾¹¤ÐòÈ·ÈϼǼ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HPicNumVerCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾Í¼ºÅ°æ±¾¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HPicNumAssembleCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾×ÜװͼºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HMaterTextureCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾²ÄÖÊ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProductNumCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾³ÉÆ·±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HVerNumCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾°æ±¾¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HMouldNoCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾Ä£¾ß±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HProcWorkNumCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾³ÌÐòºÅ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            if (HPassRateCol == -1)
            {
                MessageBox.Show("ûÓÐÕÒµ½¡¾Á¼ÂÊ¡¿µÄ±êÌâ", "Ìáʾ");
                return;
            }
            //
            if (!Checkdata())
            {
                return;
            }
            if (grdMain.Rows.Count > 0)
            { 
                hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
                HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                BillNew.omodel.HStandard = false;
                BillNew.omodel.HMainTimeUnit = "Сʱ";
                BillNew.omodel.HYear = 2011;
                BillNew.omodel.HPeriod = 1;
                BillNew.omodel.HBillNo = HBillNo;
                BillNew.omodel.HDate = DateTime.Today.Date;
                BillNew.omodel.HPicNumVer = "";
                BillNew.omodel.HPicNumAssemble = "";
                BillNew.omodel.HMaterTexture = "";
                BillNew.omodel.HProductNum = "";
                BillNew.omodel.HVerNum = "";
                BillNew.DetailColl.Clear();
            } 
            for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
            {
                BillNew.omodel.HPicNumVer = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumVerCol].Value);
                BillNew.omodel.HPicNumAssemble = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumAssembleCol].Value);
                BillNew.omodel.HMaterTexture = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterTextureCol].Value);
                BillNew.omodel.HProductNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProductNumCol].Value);
                BillNew.omodel.HVerNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HVerNumCol].Value);
                string sHNumber = ""; 
                if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value) != "" )
                {
                    //
                    sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                    //ÉóºË´úÂëÊÇ·ñºÏÀí
                    if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    {
                        MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
                        return;
                    }
 
                    if (hnumber == DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value))
                    {
                        //µÃµ½ÎïÁÏÄÚÂë
                        if (oMaterHlp.GetInfoByNumber(sHNumber))
                        {
                            if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                            {
                                BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                            }
 
                        }
                        else
                        {
                            BillNew.omodel.HMaterID = 0;
                            MessageBox.Show("µÚ" + i.ToString() + "ÐÐ," + sHNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
                            return;
                        }
                        j++;
                        //дÈëÀà
                        WriteClass(i);
 
                    }
                    else
                    {
                        DataSet Ds;
                        ClsCN oCn=new ClsCN();
                        bool b = false;
                        // ÅжÏÊÇ·ñ´æÔÚ¹¤ÒÕ·Ïß
                        Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                        if (checkadd.Checked == true)
                        {
                            //if (Ds.Tables[0].Rows.Count == 0)//×·¼Ó
                            //{
                                //ÐÂÔöǰ ÏÈɾ³ýÔ­À´¹¤ÒÕ
                                BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                                b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                                if (b == false) return;
                                c++;
                                BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                            //}
                            //else
                            //{
 
                            //}
                        }
                        else
                        {
                            BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                            b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                            if (b == false) return;
                            c++;
                            BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                        }
 
 
                        BillNew.DetailColl.Clear();
                        hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                        sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                        
                        //ÉóºË´úÂëÊÇ·ñºÏÀí
                        if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                        {
                            MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
                            return;
                        }
                        //µÃµ½ÎïÁÏÄÚÂë
                        if (oMaterHlp.GetInfoByNumber(sHNumber))
                        {
                            if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
                            {
                                BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
                                BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
                                BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
                                BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
                            }
 
                        }
                        else
                        {
                            BillNew.omodel.HMaterID = 0;
                            MessageBox.Show("µÚ" + i.ToString() + "ÐÐ," + sHNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
                            return;
                        }
                        j = 0;
                        HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
                        BillNew.omodel.HBillNo = HBillNo;
                        //дÈëÀà
                        WriteClass(i);
                    }
                }
                else
                {
                    MessageBox.Show("µÚ" + i.ToString() + "ÐÐ,ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
                    return;
                }
            }
            //×îºóÒ»¸öÎïÁÏ´¦Àí
            if (BillNew.DetailColl.Count > 0)
            {
                DataSet Ds;
                ClsCN oCn = new ClsCN();
                bool b = false;
                //Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                //if (Ds.Tables[0].Rows.Count == 0)
                //{
                    BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                    b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                    if (b == false) return;
                    c++;
                    BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
                //}
                MessageBox.Show("µ¼ÈëÍê±Ï:¹²"+c.ToString()+"¸ö¹¤ÒÕ·Ïß");
                grdMain.DataSource = null;
            }
            c = 0;
        }
 
        //дÈëÀ࠴ӿؼþ
        private bool WriteClass(int row)
        {
            string sHNumber = "";
            string sHNamePoc = ""; 
            string sHNumberCen = "";
            Single sWorkQty = 0;
            Single sBeginDayQty = 0;
            Single sBeginFixQty = 0;
            Single sHPassRate = 0;
            //long HItemID = 0; 
            //
            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMaterNumberCol].Value); 
            sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HWorkCenterNameCol].Value);
            sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcNameCol].Value);
 
            sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HWorkQtyCol].Value);
            sBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginDayQtyCol].Value);
            sBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginFixQtyCol].Value);
            sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HPassRateCol].Value);
            //ÅжÏÊÇ·ñÔÊÐí ±£´æ
 
            Model.ClsGy_RoutingBillSub oSub=new Model.ClsGy_RoutingBillSub();
 
            //µÃµ½¹¤ÐòÄÚÂë
            if (oProcHlp.GetInfoByName(sHNamePoc))
            {
                oSub.HProcID = oProcHlp.omodel.HItemID;
            }
 
            //µÃµ½³µ¼äÄÚÂë
            if (oCenHlp.GetInfoByName(sHNumberCen))
            {
                oSub.HCenterID = oCenHlp.omodel.HItemID;
            }
            //дÈëÐÅÏ¢
            oSub.HEntryID = j;
 
            oSub.HProcNo = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[HProcNoCol].Value);
            oSub.HUnitTime = 1;
            oSub.HWorkQty = sWorkQty;
            oSub.HPassRate = sHPassRate;
            oSub.HRemark = "";
            oSub.HTimeUnit = "Сʱ";
            oSub.HReadyTime = 0;
            oSub.HQueueTime = 0;
            oSub.HMoveTime = 0;
            //
            
            //
            oSub.HCloseMan = "";
            oSub.HCloseType = false;
            oSub.HSourceInterID = 0;
            oSub.HSourceEntryID = 0;
            oSub.HSourceBillType = "";
            oSub.HSourceBillNo ="";
            oSub.HRelationQty = 0;
            oSub.HRelationMoney = 0;
 
            oSub.HFixPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HFixPriceCol].Value);
            oSub.HProcPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HProcPriceCol].Value);
            oSub.HBadPrice = 0;
            oSub.HWasterPrice = 0;
            oSub.HStdFlag = false;
            oSub.HBeginDayQty = sBeginDayQty;
            oSub.HBeginFixQty = sBeginFixQty;
            oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HTechnologyParameterCol].Value);
            oSub.HPicNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPicNumCol].Value);
            oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcCheckNoteCol].Value);
            oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMouldNoCol].Value);
            oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcWorkNumCol].Value);
            BillNew.DetailColl.Add(oSub);
            return true;
        }
 
        //¼ì²éÎïÁÏ
        private bool Checkdata()
        {
            bool b=false;
            string sErrMsg = "";
            string sMsg = "";
            for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
            {
                string sHNumber = "";
                string sHNamePoc = ""; 
                string sHNumberCen = "";
                Single sWorkQty = 0;
                Single sHPassRate = 0;
 
                //
                sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkCenterNameCol].Value);
                sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNameCol].Value);
                sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HWorkQtyCol].Value);
                sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
                if (sHNumber != "" )
                {
                    // 
                    int index = i + 1;
                    //¼Ó¹¤ÊýÁ¿²»ÄÜСÓÚµÈÓÚÁã
                    if (sWorkQty <= 0)
                    {
                        MessageBox.Show("µÚ" + index + "Ðмӹ¤ÊýÁ¿²»ÄÜСÓÚµÈÓÚÁ㣡", "Ìáʾ");
                        return false;
                    }
                    //Á¼Âʲ»ÄÜСÓÚµÈÓÚÁã
                    if (sHPassRate <= 0)
                    {
                        MessageBox.Show("µÚ" + index + "ÐÐÁ¼Âʲ»ÄÜСÓÚµÈÓÚÁ㣡", "Ìáʾ");
                        return false;
                    }
                    //ÉóºË´úÂëÊÇ·ñºÏÀí
                    if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    {
                        MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
                        return false;
                    }
                    //µÃµ½ÎïÁÏÄÚÂë
                    int j = i + HBeginRow;
                    if (!oMaterHlp.GetInfoByNumber(sHNumber))
                    {
                        sMsg = "[" + sHNumber + "]ÎïÁϲ»´æÔÚ";
                        if (sErrMsg.Contains(sMsg)==false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumber + "]ÎïÁϲ»´æÔÚ\r\n" ;
                        }
                        b = true;
                    }
                    //µÃµ½¹¤ÐòÄÚÂë
                    if (!oProcHlp.GetInfoByName(sHNamePoc))
                    {
                        sMsg = "[" + sHNamePoc + "]¹¤Ðò²»´æÔÚ";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNamePoc + "]¹¤Ðò²»´æÔÚ\r\n";
                        }
                        b = true;
                    }
 
                    //µÃµ½¹¤×÷ÖÐÐÄÄÚÂë
                    if (!oCenHlp.GetInfoByName(sHNumberCen))
                    {
                        sMsg = "[" + sHNumberCen + "]¹¤×÷ÖÐÐIJ»´æÔÚ";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumberCen + "]¹¤×÷ÖÐÐIJ»´æÔÚ\r\n";
                        }
                        b = true;
 
                    }
 
                }               
            }
            if (b == true)
            {
                Pub_Control.ErrMsgBox oMsgbox = new Pub_Control.ErrMsgBox();
                oMsgbox.txtHErrMsg.Text = sErrMsg;
                oMsgbox.ShowDialog();
                return false;
            }
            else
            {
                return true;
            }
 
        }
 
    }
}