22
jingh
2021-08-07 bcc095f215ec7abd6dd33ea9e822e2c7eddda601
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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BaseSet;
using System.Threading;
using SQLHelper;
using DBUtility;
using gregn6Lib;
 
namespace APSM
{
    public partial class Sc_SeOrderAutoSortBill_RG : Form
    {
        public Sc_SeOrderAutoSortBill_RG()
        {
            InitializeComponent();
        }
        //¶¨ÒåÁÐ
        int HFixCol = 26;
 
        int selectcol = 0;
        int HWhIDCol = 0;
        int HWhNameCol = 0;
        int HWhName_SelCol = 0;
        int HModelCol = 0;
        int HPCQtyCol = 0; //¿ÉÅÅÊýÁ¿
        int HAreaIDCol = 0;
        int HAreaNameCol = 0;
        int HRoutingIDCol = 0;
        int HRoutingNameCol = 0;
        int HDiameter1Col = 0;
        int HDiameter2Col = 0;
        int HDiameter3Col = 0;
        int HBillingIDCol = 0;
        int HBillingNameCol = 0;
        int HFormulaIDCol = 0;
        int HFormulaNameCol = 0;
 
        int HMaterIDCol = 0;
        int HUnitIDCol = 0;
        int HSeOrderInterIDCol = 0;
        int HSeOrderEntryIDCol = 0;
        int HSeOrderBillNoCol = 0;
        //
        int HICMOInterIDCol = 0;
        //int HSeOrderTypeCol = 0;
        //int HICMOMakerCol = 0;
        //int HCheckDateCol = 0;
        //int HPackTypeCol = 0;
        //int HICMOBillNoCol = 0;
        //int HCusNameCol = 0;
        //int HBatchNoCol = 0;
        //int HStockNameCol = 0;
        //int HMaterTypeCol = 0;
        //int HMaterModelCol = 0;
        //int HSeOrderQtyCol = 0;
        //int HSeOrderWeightCol = 0;
        //int HsecAreaNameCol = 0;
        //int HsecBillingNoCol = 0;
        //int HsecFormulaNameCol = 0;
        //int HsecNoCol = 0;
 
        //
        public string ModName = "3749";
        public string ModCaption = "Éú²úÅŲú";
        //
        public  DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public string sAllowCol;
        //
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        DAL.ClsSc_WorkBillAutoSortBill oMain = new DAL.ClsSc_WorkBillAutoSortBill();
        BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar();
        DAL.ClsSc_ICMOSortBill oMainPC = new DAL.ClsSc_ICMOSortBill(); 
        //
        bool bEdit = false;
 
        //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ
        private bool IsSelectCell(int iRow,int iCol)
        {
            return false;
            //return BLL.Sc_SeOrderAutoSortBill_RGFun.IsSelectCell(grdSourceBill, iRow, iCol);
        }
        //ÁÐÊÇ·ñÔÊÐí±à¼­
        private bool IsAllowEdit(int iRow, int iCol)
        {
            return false;
            //return BLL.Sc_SeOrderAutoSortBill_RGFun.IsAllowEdit(grdSourceBill,FixCols, iRow, iCol);
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            //³õʼ»¯
            initGrid();
            Display_SeOrder();
            Display_ICMO();
        }
 
        //³õʼ»¯Íø¸ñ
        private void initGrid()
        {
            DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeOrder, this.Name + "grdSourceBill");
            DBUtility.Xt_BaseBillFun.initGridList(grdSource_ICMO, this.Name + "grdMain");
            DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeSub, this.Name + "grdSource");
            grdSource_SeOrder.ReadOnly = false;
        }
 
        private void Display_SeOrder()//¶ÁÈ¡ÏúÊÛ¶©µ¥
        {
            ClsCN SubCn = new ClsCN();
            DataSet DSet;
            //ÏÔʾ±¨±íÍ· ±êÌâ
 
            //¹ýÂËÌõ¼þDlg
            string sDlgWhere = "";
            sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + txtHBillNo.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + "," + DBUtility.ClsPub.isLong(txtHCusID.Tag).ToString();
            sDlgWhere = sDlgWhere + ",'" + txtHModel.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + txtHBatchNo.Text.Trim() + "'";
 
            if (sDlgWhere.Trim().Length > 0)
            {
                sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1);
            }
            //
            DSet = SubCn.RunProcReturn("exec h_p_Sc_SeOrderAutoSortBill_SourceBill_K3 " + sDlgWhere, "h_p_Sc_SeOrderAutoSortBill_SourceBill_K3");
            //Éú³ÉÊ×ÐбêÌâ
            if (DSet == null)
            {
                MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo);
                return;
            }
            //
            grdSource_SeOrder.DataSource = DSet.Tables[0].DefaultView;
            //ÉèÖúϼÆÁÐ
            string sTotalCol = "";
            sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
            string[] sT;
            sT = sTotalCol.Split(Convert.ToChar(","));
            //oSumGrid.BuildTotalCols(sT);
            //  
            DBUtility.Xt_BaseBillFun.DisplayGrid(grdSource_SeOrder, this.Name + "grdSource_SeOrder", "ÊÇ", 0);
            //
            DBUtility.Xt_BaseBillFun.GetGrid(grdSource_SeOrder, this.Name + "grdSource_SeOrder");
            //Total();
 
            HPCQtyCol = Fun_GetCol_SourceBill("¿ÉÅžíÊý");
            selectcol = Fun_GetCol_SourceBill("Ñ¡Ôñ");
            HModelCol = Fun_GetCol_SourceBill("ëÁÏԭʼ¹æ¸ñ");
            HMaterIDCol = Fun_GetCol_SourceBill("HMaterID");
            HUnitIDCol = Fun_GetCol_SourceBill("HUnitID");
            HSeOrderInterIDCol = Fun_GetCol_SourceBill("HSeOrderInterID");
            HSeOrderEntryIDCol = Fun_GetCol_SourceBill("HSeOrderEntryID");
            HSeOrderBillNoCol = Fun_GetCol_SourceBill("HSeOrderBillNo"); 
            //
            HAreaIDCol = Fun_GetCol_SourceBill("HAreaID");
            HAreaNameCol = Fun_GetCol_SourceBill("Ñ¡²úµØ");
            HRoutingIDCol = Fun_GetCol_SourceBill("HRoutingID");
            HRoutingNameCol = Fun_GetCol_SourceBill("Ñ¡¹¤ÒÕ´úÂë");
            HDiameter1Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶1");
            HDiameter2Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶2");
            HDiameter3Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶3");
            HWhIDCol = Fun_GetCol_SourceBill("HWhID");
            HWhNameCol = Fun_GetCol_SourceBill("²ÄÁϲֿâ");
            HWhName_SelCol = Fun_GetCol_SourceBill("Ñ¡²ÄÁϲֿâ");
            HBillingIDCol = Fun_GetCol_SourceBill("HBillingID");
            HBillingNameCol = Fun_GetCol_SourceBill("Ñ¡Çò»¯Â¯ºÅ");
            HFormulaIDCol = Fun_GetCol_SourceBill("HFormulaID");
            HFormulaNameCol = Fun_GetCol_SourceBill("Ñ¡Åä·½ºÅ");
            //
            HFixCol = HAreaIDCol;
        }
 
        private void Display_SeSub()
        {
            ClsCN SubCn = new ClsCN();
            DataSet DSet;
            //ÏÔʾ±¨±íÍ· ±êÌâ
 
            //¹ýÂËÌõ¼þDlg
            string sDlgWhere = "";
 
            if (sDlgWhere.Trim().Length > 0)
            {
                sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1);
            }
            //
            DSet = SubCn.RunProcReturn("exec h_p_K3_SeOrderAutoSortBill_Main " + sDlgWhere, "h_p_K3_SeOrderAutoSortBill_Main");
            //Éú³ÉÊ×ÐбêÌâ
            if (DSet == null)
            {
                MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo);
                return;
            }
            //
            grdSource_ICMO.DataSource = DSet.Tables[0].DefaultView;
            //ÉèÖúϼÆÁÐ
            string sTotalCol = "";
            sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
            string[] sT;
            sT = sTotalCol.Split(Convert.ToChar(","));
            //oSumGrid.BuildTotalCols(sT);
            //  
            DBUtility.Xt_BaseBillFun.DisplayGrid(grdSource_ICMO, this.Name + "grdMain", "ÊÇ", 0);
            //
            DBUtility.Xt_BaseBillFun.GetGrid(grdSource_ICMO, this.Name + "grdMain");
            //Total();
        }
 
        private void Display_ICMO()
        {
            ClsCN SubCn = new ClsCN();
            DataSet DSet;
            //¹ýÂËÌõ¼þDlg
            string sDlgWhere = "";
            sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + txtHBillNo.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + "," + DBUtility.ClsPub.isLong(txtHCusID.Tag).ToString();
            sDlgWhere = sDlgWhere + ",'" + txtHModel.Text.Trim() + "'";
            sDlgWhere = sDlgWhere + ",'" + txtHBatchNo.Text.Trim() + "'";
 
            if (sDlgWhere.Trim().Length > 0)
            {
                sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1);
            }
            //
            DSet = SubCn.RunProcReturn("exec h_p_Sc_SeOrderAutoSortBill_ICMO_K3 " + sDlgWhere, "h_p_Sc_SeOrderAutoSortBill_ICMO_K3");
            //Éú³ÉÊ×ÐбêÌâ
            if (DSet == null)
            {
                MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo);
                return;
            }
            //
            grdSource_ICMO.DataSource = DSet.Tables[0].DefaultView;
            //ÉèÖúϼÆÁÐ
            string sTotalCol = "";
            sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
            string[] sT;
            sT = sTotalCol.Split(Convert.ToChar(","));
            //oSumGrid.BuildTotalCols(sT);
            //  
            DBUtility.Xt_BaseBillFun.DisplayGrid(grdSource_ICMO, this.Name + "grdSource_ICMO", "ÊÇ", 0);
            //
            DBUtility.Xt_BaseBillFun.GetGrid(grdSource_ICMO, this.Name + "grdSource_ICMO");
            //Total();
            HICMOInterIDCol = Fun_GetCol_Main("HInterID");
            //
        }
 
        //½»»õÆÚ ³¬ÆÚʱ ±äÉ«
        private void AddColor()
        {
            //BLL.Sc_SeOrderAutoSortBill_RGFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols);
        }
        //±£´æ
        private void SaveBill()
        {
            SQLHelper.ClsCNK3 oK3Cn = new SQLHelper.ClsCNK3();
            ClsCN SubCn = new ClsCN();
            DataSet DSet;
            DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3();
            //for (int i = 0; i <= grdSource_SeOrder.RowCount - 1; i++)
            //{
            //    if (DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[i].Cells[selectcol].Value) == "¡Ì")
            //    {
 
            //    }
            //}
            
            //±£´æµ±Ç°Ñ¡ÔñÐÐ
            if (grdSource_SeOrder.CurrentRow == null)
            {
                return;
            }
            //»ñÈ¡µ¥¾ÝºÅ
            DataSet Ds = oK3Cn.RunProcReturn("exec HX_GetICBillNo 1,85 " , "t_billcodeby");
            string sICMOBillno = Ds.Tables[0].Rows[0][0].ToString().Trim();
            int HCurRow = grdSource_SeOrder.CurrentRow.Index;
            BillNew = new DAL.ClsSc_ICMOBill_K3();
            BillNew.omodel.HYear = 2011;
            BillNew.omodel.HPeriod = 1;
            BillNew.omodel.HBillNo = sICMOBillno;  //ÔÚ¸³ÖµÀàǰ¾Í´¦ÀíºÃ×Ö·û´®ºÍÊý×Ö
            BillNew.omodel.HDate = DateTime.Today;
            BillNew.omodel.HPlanBeginDate = DateTime.Today;
            BillNew.omodel.HPlanEndDate = DateTime.Today;
            BillNew.omodel.HBeginDate = DateTime.Today;
            BillNew.omodel.HEndDate = DateTime.Today;
            BillNew.omodel.HEmpID =0;
            BillNew.omodel.HEmpNumber = "";
            BillNew.omodel.HDeptID = 278 ;
            BillNew.omodel.HDeptNumber = "";
            BillNew.omodel.HCenterID = 0;
            BillNew.omodel.HCenterNumber = "";
            BillNew.omodel.HCusID = 0;
            BillNew.omodel.HCusNumber = "";
            BillNew.omodel.HMaterID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HMaterIDCol].Value);
            BillNew.omodel.HMaterNumber = "";
            BillNew.omodel.HUnitID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HUnitIDCol].Value);
            BillNew.omodel.HUnitNumber = "";
            BillNew.omodel.HBomID = 0;
            BillNew.omodel.HBomNumber = "";
            BillNew.omodel.HRoutingInterID =0;
            BillNew.omodel.HPlanQty = DBUtility.ClsPub.isDoule(grdSource_SeOrder.Rows[HCurRow].Cells[HPCQtyCol].Value);
            BillNew.omodel.HReadyQty =0;
            BillNew.omodel.HLevNum = 0;
            BillNew.omodel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderInterIDCol].Value);
            BillNew.omodel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderEntryIDCol].Value);
            BillNew.omodel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderBillNoCol].Value);
            BillNew.omodel.HRemark = "";
            BillNew.omodel.HDiameter1 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter1Col].Value);
            BillNew.omodel.HDiameter2 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter2Col].Value);
            BillNew.omodel.HDiameter3 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter3Col].Value);
            BillNew.omodel.HWhID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HWhIDCol].Value);
            BillNew.omodel.HBillingID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HBillingIDCol].Value);
            BillNew.omodel.HFormulaID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HFormulaIDCol].Value);
            BillNew.omodel.HAreaID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HAreaIDCol].Value);
            BillNew.omodel.HRoutingID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HRoutingIDCol].Value);
            //
            bool bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
            if (bResult == true)
            {
                MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!µ¥¾ÝºÅ:" + sICMOBillno, "Ìáʾ");
                 
            }
            else
            {
                MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + ClsPub.sExeReturnInfo, "Ìáʾ"); 
            }
        }
 
 
 
 
 
        //±£´æµ¥ÐÐ
        private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List<ClsGridValues> oClsGridVaules)
        {
 
        }
 
        //±£´æÇ°  ¼ì²é
        private bool AllowSave()
        {
 
            return true;
        }
        
        
        //ÊÇ·ñÊǺÏÀíÐÐ
        private bool AllowRow()
        {
            if (grdSource_SeOrder.CurrentRow == null)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
 
 
        //¼ÓÔØ Ñ¡Ô´µ¥
        private void sx_Click(object sender, EventArgs e)
        {
            DAL.Cls_S_K3_SeOrderBillList oSeOrderBillList = new DAL.Cls_S_K3_SeOrderBillList();
            string sWhere = "";
            if (oSeOrderBillList.Refresh(sWhere))  //Ñ¡ÔñÔ­µ¥
            {
                FillSelectData(oSeOrderBillList.oBillSelectColl);
            }
        }
 
        //¼ÓÔØ Ô­µ¥µ½±¾µØ
        private void FillSelectData(List<DBUtility.BillSelect> oList)
        {
        }
 
        //¸ù¾ÝTABLEдÈë½çÃæ
        private void Sub_WriteInForm(DataTable oTable, int i)
        {
        }
 
 
        //±£´æÁпí
        private void bclk_Click(object sender, EventArgs e)
        {
            //±£´æÁпí
            DBUtility.ClsPub.SaveGridView(grdSource_SeSub, this.Name + "grdSource_SeSub", DBUtility.ClsPub.AppPath);
            DBUtility.ClsPub.SaveGridView(grdSource_SeOrder, this.Name + "grdSource_SeOrder", DBUtility.ClsPub.AppPath);
            DBUtility.ClsPub.SaveGridView(grdSource_ICMO, this.Name + "grdSource_ICMO", DBUtility.ClsPub.AppPath);
        }
        //ĬÈÏÁпí
        private void mrlk_Click(object sender, EventArgs e)
        {
            DBUtility.ClsPub.DefaultGridView(grdSource_SeSub);
            DBUtility.ClsPub.DefaultGridView(grdSource_SeOrder);
            DBUtility.ClsPub.DefaultGridView(grdSource_ICMO);
        }
 
 
        //Í˳ö°´Å¥
        private void tc_Click(object sender, EventArgs e)
        {
            this.Close();
        }
 
 
        //±£´æ°´Å¥ 
        private void bc_Click(object sender, EventArgs e)
        {
            SaveBill();
        }
 
 
        //ÄÜÁ¦°´Å¥ 
        private void nl_Click(object sender, EventArgs e)
        {
            //ÄÜÁ¦ÉèÖÃ
            //Gy_WorkTimes oFrm = new Gy_WorkTimes();
            //oFrm.ShowDialog();
        }
 
        private void Sc_SeOrderAutoSortBill_RG_Load(object sender, EventArgs e)
        {
            this.Text = ModCaption;
            this.lblCaption.Text = ModCaption;
        }
 
        const int sHWhNameCol = 33;
        //°ïÖúº¯Êý
        private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit)
        {
            DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();
            //DAL.ClsK3_DrawingDire_View oDrawingDire = new DAL.ClsK3_DrawingDire_View();
            DAL.ClsK3_FormulaName_View oFormulaName = new DAL.ClsK3_FormulaName_View();
            DAL.ClsK3_OrderType_View oOrderType = new DAL.ClsK3_OrderType_View();
            DAL.ClsK3_PackType_View oPackType = new DAL.ClsK3_PackType_View();
            DAL.ClsK3_Place_View oPlace = new DAL.ClsK3_Place_View();
            DAL.ClsK3_ProcessFlow_View oProcessFlow = new DAL.ClsK3_ProcessFlow_View();
            DAL.ClsK3_Specifications_View oSpecifications = new DAL.ClsK3_Specifications_View();
            DAL.ClsK3_SpheroidizingNumber_View oSpheroidizingNumber = new DAL.ClsK3_SpheroidizingNumber_View();
            //if (!grdStatus)
            //{
            //    return;
            //}
            //if (oSumGrid.FindAllowEditCol(sCol))
            //{
            //oSumGrid.EditStatus = true;
            //}
            //else
            //{
            //    return;
            //}
            switch (sKeyCode)
            {
                case 118:          //F7
                    {
                        switch (sCol)
                        {
                            case sHWhNameCol:
                                //oWh.WherePart = "";
                                //if (oWh.RefreshView())
                                //{
                                //    grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = oWh.oModel.HItemID.ToString();
                                //    grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = oWh.oModel.HName;
                                //}
                                //else
                                //{
                                //    grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = 0;
                                //    grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = "";
                                //}
                                break; 
                            default:
                                break;
                        }
                        if (sCol == HWhName_SelCol)
                        {
                            if (oWh.RefreshView())
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = oWh.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = oWh.oModel.HName;
                                grdSource_SeOrder.Rows[sRow].Cells[HWhName_SelCol].Value = oWh.oModel.HName;
                            }
                            else
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = "";
                                grdSource_SeOrder.Rows[sRow].Cells[HWhName_SelCol].Value = "";
                            }
                        }
                        if (sCol == HAreaNameCol)
                        {
                            oPlace.WherePart = "";
                            if (oPlace.RefreshView())
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HAreaIDCol].Value = oPlace.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HAreaNameCol].Value = oPlace.oModel.HName;
                            }
                            else
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HAreaIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HAreaNameCol].Value = "";
                            }
                        }
                        if (sCol == HFormulaNameCol)
                        {
                            oFormulaName.WherePart = "";
                            if (oFormulaName.RefreshView())
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HFormulaIDCol].Value = oFormulaName.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HFormulaNameCol].Value = oFormulaName.oModel.HName;
                            }
                            else
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HFormulaIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HFormulaNameCol].Value = "";
                            }
                        }
                        if (sCol == HBillingNameCol)
                        {
                            oSpheroidizingNumber.WherePart = "";
                            if (oSpheroidizingNumber.RefreshView())
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HBillingIDCol].Value = oSpheroidizingNumber.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HBillingNameCol].Value = oSpheroidizingNumber.oModel.HName;
                            }
                            else
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HBillingIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HBillingNameCol].Value = "";
                            }
                        }
                        if (sCol == HRoutingNameCol)
                        {
                            oProcessFlow.WherePart = "";
                            if (oProcessFlow.RefreshView())
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = oProcessFlow.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HRoutingNameCol].Value = oProcessFlow.oModel.HName;
                            }
                            else
                            {
                                grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HRoutingNameCol].Value = "";
                            }
                        }
                        if (sCol == HDiameter1Col)
                        {
                            oSpecifications.WherePart = "";
                            if (oSpecifications.RefreshView())
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HName;
                            }
                            else
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = "";
                            }
                        }
                        if (sCol == HDiameter2Col)
                        {
                            oSpecifications.WherePart = "";
                            if (oSpecifications.RefreshView())
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter2Col].Value = oSpecifications.oModel.HName;
                            }
                            else
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter2Col].Value = "";
                            }
                        }
                        if (sCol == HDiameter3Col)
                        {
                            oSpecifications.WherePart = "";
                            if (oSpecifications.RefreshView())
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString();
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter3Col].Value = oSpecifications.oModel.HName;
                            }
                            else
                            {
                                //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0;
                                grdSource_SeOrder.Rows[sRow].Cells[HDiameter3Col].Value = "";
                            }
                        }
                        break;
                    }
                case 117:  //F6
                    {
                        switch (sCol)
                        {
 
 
                            default:
                                break;
                        }
                        break;
                    }
                default:
                    break;
            }
        }
 
 
 
        private void sx_Click_1(object sender, EventArgs e)
        {
            initGrid();
            Display_ICMO();
            Display_SeOrder();
        }
 
        private void glxx_Click(object sender, EventArgs e)
        {
            tbc1.Visible = !tbc1.Visible;
            if (tbc1.Visible == false)
            {
                spc1.SplitterDistance = spc1.Size.Height-20;
            }
            else
            {
                spc1.SplitterDistance = spc1.Size.Height-200;
            }
        }
 
      
        //ÈÎÎñµ¥¹ØÁªÐÅÏ¢
        private void SetBillRelationInfo()
        {
            if (AllowRow() == false)
            {
                return;
            }
 
            DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeSub, this.Name + "grdSource_SeSub");
            //µÃµ½¿â´æ
            ClsCN SubCn = new ClsCN();
            DataSet DSet;
            //ÏÔʾ±¨±íÍ· ±êÌâ
            string HAreaName = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HAreaNameCol].Value);
            string HModel = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HModelCol].Value);
            long HWhID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HWhIDCol].Value);
            if (HWhID == 0)
            {
                grdSource_SeSub.DataSource = null;
                return;
            }
            //¹ýÂËÌõ¼þDlg
            string sDlgWhere = "";
            sDlgWhere = sDlgWhere + "," + HWhID.ToString();
            sDlgWhere = sDlgWhere + ",'" + HModel + "'";
            sDlgWhere = sDlgWhere + ",'" + HAreaName + "'";
            if (sDlgWhere.Trim().Length > 0)
            {
                sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1);
            }
            //
            DSet = SubCn.RunProcReturn("exec h_p_KF_ICInventoryList_RG " + sDlgWhere, "h_p_KF_ICInventoryList_RG");
            //Éú³ÉÊ×ÐбêÌâ
            if (DSet == null)
            {
                MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo);
                grdSource_SeSub.DataSource = null;
                return;
            }
            //
            grdSource_SeSub.DataSource = DSet.Tables[0].DefaultView;
            //ÉèÖúϼÆÁÐ
            string sTotalCol = "";
            sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
            string[] sT;
            sT = sTotalCol.Split(Convert.ToChar(","));
            //oSumGrid.BuildTotalCols(sT);
            //  
            DBUtility.Xt_BaseBillFun.DisplayGrid(grdSource_SeSub, this.Name + "grdSource_SeSub", "ÊÇ", 0);
            //
            DBUtility.Xt_BaseBillFun.GetGrid(grdSource_SeSub, this.Name + "grdSource_SeSub");
            //Total();
 
        }
 
        private Int32 Fun_GetCol_SourceBill(string sCol)
        {
            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_SeOrder);
        }
 
        private Int32 Fun_GetCol_Source(string sCol)
        {
            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_SeSub);
        }
 
        private Int32 Fun_GetCol_Main(string sCol)
        {
            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_ICMO);
        }
 
        private void grdSourceBill_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
            int i = grdSource_SeOrder.CurrentCell.ColumnIndex;
            if (i < HFixCol && i!= HPCQtyCol)
            {
                e.Cancel = true;
            }
 
        }
 
        DataGridViewTextBoxEditingControl EditingControl;
        private void grdSourceBill_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (this.EditingControl != null)      //ÊÍ·Åʼþ
            {
                EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown);
                this.EditingControl = null;
            }
        }
 
        private void EditingControl_KeyDown(object sender, KeyEventArgs e)
        {
            //ÒµÎñ´¦Àí 
            Sub_GridKey(e.KeyValue, grdSource_SeOrder.CurrentRow.Index, grdSource_SeOrder.CurrentCell.ColumnIndex, EditingControl);
        }
 
        private void grdSourceBill_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (grdSource_SeOrder.CurrentCell != null)
            {
                if (e.Control is DataGridViewTextBoxEditingControl)
                {
                    this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control;
                    //Ôö¼ÓίÍд¦Àí 
                    this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown);
                }
            }
        }
 
 
        private void grdSourceBill_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            SetBillRelationInfo();
        }
 
        private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {
 
        }
 
        private void grdSourceBill_KeyDown(object sender, KeyEventArgs e)
        {
            Sub_GridKey(e.KeyValue, grdSource_SeOrder.CurrentRow.Index, grdSource_SeOrder.CurrentCell.ColumnIndex, EditingControl);
        }
 
        private void xs_Click(object sender, EventArgs e)
        {
 
        }
 
        private void grdSourceBill_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value) == "¡Ì")
            {
                grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value = "";
            }
            else
            {
                grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value = "¡Ì";
            }
        }
 
        private void cmdHCusID_Click(object sender, EventArgs e)
        {
            DAL.ClsK3_Customer_View oCust = new DAL.ClsK3_Customer_View();
            if (oCust.RefreshView())
            {
                this.txtHCusID.Text = oCust.oModel.HName;
                this.txtHCusID.Tag = oCust.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHCusID.Text = "";
            }
        }
 
        private void pc_Click(object sender, EventArgs e)
        {
            Sub_CheckBill();
        }
 
 
        private void Sub_CheckBill()
        {  
            DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3(); 
            //±£´æµ±Ç°Ñ¡ÔñÐÐ
            if (grdSource_ICMO.CurrentRow == null)
            {
                return;
            }
            //»ñÈ¡ÈÎÎñµ¥ÄÚÂë
            BillNew.omodel.HInterID = DBUtility.ClsPub.isLong(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value);
            if (BillNew.CheckICMOBill(BillNew.omodel.HInterID,ref DBUtility.ClsPub.sExeReturnInfo))
            {
                //Éú³ÉÁ÷ת¿¨
 
                //
                MessageBox.Show("ÈÎÎñµ¥Ï´ï³É¹¦£¡");
            }
            else
            {
                MessageBox.Show("Ï´ïʧ°Ü£¡" + DBUtility.ClsPub.sExeReturnInfo);
            }
             
        }
 
 
 
        private void grdMain_DoubleClick(object sender, EventArgs e)
        {
            int selectcol = Fun_GetCol_Main("Ñ¡Ôñ");
            if (DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value) == "¡Ì")
            {
                grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value = "";
            }
            else
            {
                grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value = "¡Ì";
            }
        }
 
 
        GridppReport Report;
 
        private void yl_Click(object sender, EventArgs e)
        {
            //Ñ¡Ôñ´òÓ¡Ä£°å
            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
            oFrm.sBillName = ModName;
            oFrm.sBillModel = ModCaption;
            oFrm.ShowDialog();
            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
            {
                //
                Sub_SetReport(oFrm.sOpenTmp); 
 
                Report.PrintPreview(true);
            }
        }
 
        //ÕÒµ½¶ÔÓ¦´òÓ¡Ä£¿é
        private void Sub_SetReport(string sOpenTmp)
        {
            //
            Report = new GridppReport();
            Report.LoadFromFile(ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here . 
            // 
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
        }
 
        //¸³Öµ±íÍ·
        private void ReportBeforePostRecord()// 
        {
            try
            {
                //
                Report.FieldByName("¶©µ¥ÀàÐÍ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ÀàÐÍ")].Value); 
                Report.FieldByName("Ï´ïÈÕÆÚ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Ï´ïÈÕÆÚ")].Value);
                Report.FieldByName("°ü×°·½Ê½").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("°ü×°·½Ê½")].Value);
                Report.FieldByName("¿Í»§").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¿Í»§")].Value);
                Report.FieldByName("ºÏͬÅúºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ºÏͬÅúºÅ")].Value);
                Report.FieldByName("½»»õÈÕÆÚ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("½»»õÈÕÆÚ")].Value);
                Report.FieldByName("¶©µ¥ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ºÅ")].Value);
                Report.FieldByName("±íÍ·±¸×¢").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("±íÍ·±¸×¢")].Value);
                Report.FieldByName("±íÉí±¸×¢").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("±íÉí±¸×¢")].Value);
                Report.FieldByName("Åä·½ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Åä·½ºÅ")].Value);
                Report.FieldByName("¯ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¯ºÅ")].Value);
                Report.FieldByName("¹¤ÒÕ·Ïß").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¹¤ÒÕ·Ïß")].Value);
                Report.FieldByName("À­Ë¿Ö±¾¶1").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶1")].Value);
                Report.FieldByName("À­Ë¿Ö±¾¶2").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶2")].Value);
                Report.FieldByName("À­Ë¿Ö±¾¶3").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶3")].Value);
                Report.FieldByName("·¢Áϲֿâ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("·¢Áϲֿâ")].Value);
                Report.FieldByName("¸Ö²Ä²úµØ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¸Ö²Ä²úµØ")].Value);
                Report.FieldByName("Çò»¯Â¯ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Çò»¯Â¯ºÅ")].Value);
                Report.FieldByName("²ÄÖÊ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("²ÄÖÊ")].Value);
                Report.FieldByName("ëÁϹæ¸ñ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ëÁϹæ¸ñ")].Value);
                Report.FieldByName("¶©µ¥¾íÊý").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥¾íÊý")].Value);
                Report.FieldByName("¶©µ¥ÖØÁ¿").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ÖØÁ¿")].Value);
                Report.FieldByName("³ÉÆ·¹æ¸ñ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("³ÉÆ·¹æ¸ñ")].Value);
                Report.FieldByName("³ÉÆ·±ê×¼").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("³ÉÆ·±ê×¼")].Value);
                Report.FieldByName("À­Ë¿·½Ïò").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿·½Ïò")].Value);
                Report.FieldByName("ÌØÊâÒªÇó1").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÌØÊâÒªÇó1")].Value);
                Report.FieldByName("ÌØÊâÒªÇó2").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÌØÊâÒªÇó2")].Value);
                Report.FieldByName("ÖÆµ¥ÈË").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÖÆµ¥ÈË")].Value);
            }
            catch (Exception e)
            {
                MessageBox.Show("´òӡʧ°Ü!±íÍ·£º" + e.Message);
            }
        }
        //¸³Öµ±íÌå
        private void ReportFetchRecordByDataTable()
        {
            try
            {
                DataTable dt = new DataTable();
                BLL.Utility.FillRecordToReport_FstRow(Report, grdSource_ICMO, dt, 0);
            }
            catch (Exception e)
            {
                MessageBox.Show("´òӡʧ°Ü!±íÌ壺" + e.Message);
            }
        }
 
        private void sc_Click(object sender, EventArgs e)
        {
            Sub_DeleteBill();
        }
 
        private void Sub_DeleteBill()
        {
            DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3();
            //±£´æµ±Ç°Ñ¡ÔñÐÐ
            if (grdSource_ICMO.CurrentRow == null)
            {
                return;
            }
            //»ñÈ¡ÈÎÎñµ¥ÄÚÂë
            BillNew.omodel.HInterID = DBUtility.ClsPub.isLong(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value);
            if (BillNew.DeleteBill(BillNew.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                MessageBox.Show("ÈÎÎñµ¥É¾³ý³É¹¦£¡");
            }
            else
            {
                MessageBox.Show("ɾ³ýʧ°Ü£¡" + DBUtility.ClsPub.sExeReturnInfo);
            }
 
        }
 
 
    }
}