丸井供应商桌面条码生成程序
yxj
2021-10-20 bba8650eb94f7b5a7341ab7b6268ef4d9ee62877
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
953
954
955
956
957
958
959
960
961
962
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DBUtility;
 
namespace SCM
{
    public partial class Xt_UserNew : Form
    {
        public Xt_UserNew()
        {
            InitializeComponent();
        }
 
        public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
        public Pub_Class.ClsPub.Enum_InputMode InputMode;  //¼Èë״̬±êÖ¾(0-·Ç¼Èë״̬ 1-Ôö¼Ó 2-ÐÞ¸Ä)
        public string Czybm;
        public Int64 HOrgID = -1;
        //´°Ìå¼ÓÔØ
        private void Xt_UserNew_Load(object sender, EventArgs e)
        {
            oWeb.Url = ClsPub1.WEBSURL;
            lblError.Text = "";
            LbYes.Items.Clear();
            LbNo.Items.Clear();
            //¼ÓÔØ×éÖ¯ÐÅÏ¢
            Sub_AddOrdList();
            Init();
            Display();
        }
 
        //¼ÓÔØ×éÖ¯ÐÅÏ¢
        private void Sub_AddOrdList()
        {
            DataSet ds;
            ds = oWeb.get_ORGANIZATIONSList();
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("»ñÈ¡×é֯ʧ°Ü");
                return;
            }
            cmbHOrgID.Items.Clear();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                cmbHOrgID.Items.Add(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HName"]));
            }
        }
        //²éÕÒÊý¾Ý----Óû§×é
        private void Display()
        {
            if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
            {
                try
                {
                    //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    DataSet oDs = new DataSet();
                    oDs = oWeb.getDataSetBySQL("select GroupID,GroupName from  System_UserGroup order by GroupName", "System_UserGroup", ref ClsPub.sExeReturnInfo);
                    if (oDs == null)
                    {
                        MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + ClsPub.sExeReturnInfo);
                        return;
                    }
                    //
                    for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
                    {
                        LbNo.Items.Add(oDs.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDs.Tables[0].Rows[i][1].ToString().Trim());
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ìáʾ");
                    return;
                }
            }
            else
            {
                try
                {
                    //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    DataSet oDs = new DataSet();
                    DataSet oDS = new DataSet();
                    //¼ÓÔØ²»Êô×é
                    oDs = oWeb.getDataSetBySQL("select GroupID,GroupName from  System_UserGroup"
                    +" where Groupid not IN (select Groupid  from  system_UserGroupInfo where userid='"+Czybm+"')", "System_UserGroup", ref ClsPub.sExeReturnInfo);
                    if (oDs == null)
                    {
                        MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + ClsPub.sExeReturnInfo);
                        return;
                    }
                    //
                    if (oDs.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i <= oDs.Tables[0].Rows.Count - 1; i++)
                        {
 
                            LbNo.Items.Add(oDs.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDs.Tables[0].Rows[i][1].ToString().Trim());
                        }
                    }
                    //¼ÓÔØÊôÓÚ×é
                    oDS = oWeb.getDataSetBySQL("select GroupID,GroupName from  System_UserGroup"
                    + " where Groupid IN (select Groupid  from   system_UserGroupInfo where userid='" + Czybm + "')", "System_UserGroup", ref ClsPub.sExeReturnInfo);
                    if (oDS == null)
                    {
                        MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + ClsPub.sExeReturnInfo);
                        return;
                    }
                    //
                    if (oDS.Tables[0].Rows.Count != 0)
                    {
                        for (int i = 0; i <= oDS.Tables[0].Rows.Count - 1; i++)
                        {
 
                            LbYes.Items.Add(oDS.Tables[0].Rows[i][0].ToString().Trim() + "-" + oDS.Tables[0].Rows[i][1].ToString().Trim());
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ìáʾ");
                    return;
                }
            }
        }
        //³õʼ»¯½çÃæ
        private void Init()
        {
            txtHK3UserID.ReadOnly = true;
            txtHKeeperID.ReadOnly = true;
            txtHSecManagerID.ReadOnly = true;
            txtHSellManID.ReadOnly = true;
            txtHDeptID.ReadOnly = true;
            txtHWhID.ReadOnly = true;
            txtHSCWH.ReadOnly = true;
            txtHSupID.ReadOnly = true;
            txtHMouldWhID.ReadOnly = true;
            txtHMouldSCWhID.ReadOnly = true;
            if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
            {
                txtCzybm.Text = "";
                txtCzymc.Text = "";
                txtCzymm.Text = "";
                txtCzyyz.Text = "";
                txtExplain.Text = "";
                txtHEmpID.Text = "";
                txtHK3UserID.Text = "";
                txtHKeeperID.Text = "";
                txtHSecManagerID.Text = "";
                txtHSellManID.Text = "";
                txtHDeptID.Text = "";
                txtHWhID.Text = "";
                txtHSCWH.Text = "";
                txtHSupID.Text = "";
                txtHMouldWhID.Text = "";
                txtHMouldSCWhID.Text = "";
                txtHCloudUserName.Text = "";
                txtHCloudUserPsd.Text = "";
                cmdAllRight.PerformClick();
 
                //»ñÈ¡µ±Ç°×éÖ¯ÐÅÏ¢
                DataSet Ds = oWeb.getDataSetBySQL("select * from Xt_ORGANIZATIONS where HItemID=" + ClsPub1.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
                if (Ds.Tables[0].Rows.Count != 0)
                {
                    cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HName"]);
                }
            }
            else
            {
                txtCzybm.ReadOnly = true;
                txtCzymm.ReadOnly = true;
                txtCzyyz.ReadOnly = true;
                ShowData(Czybm);
            }
        }
        //¼ÓÔØ±íÍ·
        private void ShowData(string sCzybm)
        {
            DataSet oDs = new DataSet();
            SCM.ClsIF_User_View oUser = new SCM.ClsIF_User_View();
            SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
            SCM.ClsXt_ORGANIZATIONS_View oORG = new ClsXt_ORGANIZATIONS_View();
            SCM.ClsIF_Department_View oDep = new SCM.ClsIF_Department_View();
            SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
            SCM.ClsIF_Supplier_View oSup = new SCM.ClsIF_Supplier_View();
            try
            {
                oDs = oWeb.getDataSetBySQL("select Czybm,Czymc,Explain,HEmpID,HK3UserID,HCloudUserName,HCloudUserPsd,HKeeperID,HKeeper,HSecManagerID,HSecManager,HSellManID,HSellMan,HDeptID,HDept,HWhID,HWHName,HSCWHID,HSCWHName,HSupID,HSupName,HUSEORGID,HMouldWhID,HMouldSCWhID from Gy_Czygl where Czybm='" + sCzybm + "'", "Gy_Czygl", ref ClsPub.sExeReturnInfo);
                if (oDs == null)
                {
                    MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + ClsPub.sExeReturnInfo);
                    return;
                }
                else if (oDs.Tables[0].Rows.Count != 0)
                {
                    txtCzybm.Text = oDs.Tables[0].Rows[0]["Czybm"].ToString().Trim();
                    txtCzymc.Text = oDs.Tables[0].Rows[0]["Czymc"].ToString().Trim();
                    txtCzymm.Text = "*****";
                    txtCzyyz.Text = "*****";
                    txtExplain.Text = oDs.Tables[0].Rows[0]["Explain"].ToString().Trim();
 
                    if (oORG.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        cmbHOrgID.Text = ClsPub.isStrNull(oORG.omodel.HName);
                    }
                    else
                    {
                        cmbHOrgID.Text = "";
                    }
                    if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HEmpID"])))
                    {
                        txtHEmpID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
                        txtHEmpID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
                    }
                    else
                    {
                        txtHEmpID.Text = "";
                        txtHEmpID.Tag = 0;
                    }
                    if (oUser.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HK3UserID"])))
                    {
                        txtHK3UserID.Text = ClsPub.isStrNull(oUser.omodel.HName);
                        txtHK3UserID.Tag = ClsPub.isLong(oUser.omodel.HItemID);
                    }
                    else
                    {
                        txtHK3UserID.Text = "";
                        txtHK3UserID.Tag = 0;
                    }
                    if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HKeeperID"])))
                    {
                        txtHKeeperID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
                        txtHKeeperID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
                    }
                    else
                    {
                        txtHKeeperID.Text = "";
                        txtHKeeperID.Tag = 0;
                    }
                    if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSecManagerID"])))
                    {
                        txtHSecManagerID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
                        txtHSecManagerID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
                    }
                    else
                    {
                        txtHSecManagerID.Text = "";
                        txtHSecManagerID.Tag = 0;
                    }
                    if (oEmp.GetInfoByID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSellManID"])))
                    {
                        txtHSellManID.Text = ClsPub.isStrNull(oEmp.omodel.HName);
                        txtHSellManID.Tag = ClsPub.isLong(oEmp.omodel.HItemID);
                    }
                    else
                    {
                        txtHSellManID.Text = "";
                        txtHSellManID.Tag = 0;
                    }
                    if (oDep.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HDeptID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHDeptID.Text = ClsPub.isStrNull(oDep.omodel.HName);
                        txtHDeptID.Tag = ClsPub.isLong(oDep.omodel.HItemID);
                    }
                    else
                    {
                        txtHDeptID.Text = "";
                        txtHDeptID.Tag = 0;
                    }
                    if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
                        txtHWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
                    }
                    else
                    {
                        txtHWhID.Text = "";
                        txtHWhID.Tag = 0;
                    }
                    if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSCWHID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHSCWH.Text = ClsPub.isStrNull(oWh.omodel.HName);
                        txtHSCWH.Tag = ClsPub.isLong(oWh.omodel.HItemID);
                    }
                    else
                    {
                        txtHSCWH.Text = "";
                        txtHSCWH.Tag = 0;
                    }
                    if (oSup.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HSupID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHSupID.Text = ClsPub.isStrNull(oSup.omodel.HName);
                        txtHSupID.Tag = ClsPub.isLong(oSup.omodel.HItemID);
                    }
                    else
                    {
                        txtHSupID.Text = "";
                        txtHSupID.Tag = 0;
                    }
                    if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HMouldWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHMouldWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
                        txtHMouldWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
                    }
                    else
                    {
                        txtHMouldWhID.Text = "";
                        txtHMouldWhID.Tag = 0;
                    }
                    if (oWh.GetInfoByIDandOrgID(ClsPub.isLong(oDs.Tables[0].Rows[0]["HMouldSCWhID"]), ClsPub.isLong(oDs.Tables[0].Rows[0]["HUSEORGID"])))
                    {
                        txtHMouldSCWhID.Text = ClsPub.isStrNull(oWh.omodel.HName);
                        txtHMouldSCWhID.Tag = ClsPub.isLong(oWh.omodel.HItemID);
                    }
                    else
                    {
                        txtHMouldSCWhID.Text = "";
                        txtHMouldSCWhID.Tag = 0;
                    }
                    //txtHKeeperID.Text = oDs.Tables[0].Rows[0]["HKeeper"].ToString().Trim();
                    //txtHKeeperID.Tag = oDs.Tables[0].Rows[0]["HKeeperID"].ToString().Trim();
                    //txtHSecManagerID.Text = oDs.Tables[0].Rows[0]["HSecManager"].ToString().Trim();
                    //txtHSecManagerID.Tag = oDs.Tables[0].Rows[0]["HSecManagerID"].ToString().Trim();
                    //txtHSellManID.Text = oDs.Tables[0].Rows[0]["HSellMan"].ToString().Trim();
                    //txtHSellManID.Tag = oDs.Tables[0].Rows[0]["HSellManID"].ToString().Trim();
                    //txtHDeptID.Text = oDs.Tables[0].Rows[0]["HDept"].ToString().Trim();
                    //txtHDeptID.Tag = oDs.Tables[0].Rows[0]["HDeptID"].ToString().Trim();
                    //txtHWhID.Text = oDs.Tables[0].Rows[0]["HWHName"].ToString().Trim();
                    //txtHWhID.Tag = oDs.Tables[0].Rows[0]["HWhID"].ToString().Trim();
                    //txtHSCWH.Text = oDs.Tables[0].Rows[0]["HSCWHName"].ToString().Trim();
                    //txtHSCWH.Tag = oDs.Tables[0].Rows[0]["HSCWHID"].ToString().Trim();
                    //txtHSupID.Text = oDs.Tables[0].Rows[0]["HSupName"].ToString().Trim();
                    //txtHSupID.Tag = oDs.Tables[0].Rows[0]["HSupID"].ToString().Trim();
                    txtHCloudUserName.Text = oDs.Tables[0].Rows[0]["HCloudUserName"].ToString().Trim();
                    txtHCloudUserPsd.Text = oDs.Tables[0].Rows[0]["HCloudUserPsd"].ToString().Trim();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Ìáʾ");
                return;
            }
        }
 
        //È¡Ïû
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        //×óÒÆ
        private void cmdLeft_Click(object sender, EventArgs e)
        {
            if (this.LbNo.SelectedItems.Count > 0)
            {
                int i = this.LbNo.SelectedIndex;
                this.LbYes.Items.Add(this.LbNo.SelectedItem.ToString());
                this.LbNo.Items.RemoveAt(i);
            }
        }
        //È«²¿×óÒÆ
        private void cmdAllLeft_Click(object sender, EventArgs e)
        {
            if (this.LbNo.Items.Count > 0)
            {
                for (int i = 0; i <= this.LbNo.Items.Count - 1; i++)
                {
                    this.LbYes.Items.Add(this.LbNo.Items[i].ToString());
                    this.LbNo.Items.RemoveAt(i);
                    i--;
                }
            }
        }
        //ÓÒÒÆ
        private void cmdRight_Click(object sender, EventArgs e)
        {
            if (this.LbYes.SelectedItems.Count > 0)
            {
                int i = this.LbYes.SelectedIndex;
                this.LbNo.Items.Add(this.LbYes.SelectedItem.ToString());
                this.LbYes.Items.RemoveAt(i);
            }
        }
        //È«²¿ÓÒÒÆ
        private void cmdAllRight_Click(object sender, EventArgs e)
        {
            if (this.LbYes.Items.Count > 0)
            {
                for (int i = 0; i <= this.LbYes.Items.Count - 1; i++)
                {
                    this.LbNo.Items.Add(this.LbYes.Items[i].ToString());
                    this.LbYes.Items.RemoveAt(i);
                    i--;
                }
            }
        }
        //È·¶¨
        private void cmdOK_Click(object sender, EventArgs e)
        {
            lblError.Text = "";
            DataSet oDs = new DataSet();
            if (!Sub_AllowSave())   //µ¥¾ÝÍêÕûÐÔÅжÏ
            {
                tabControl1.SelectedIndex = 0;
                return;
            }
 
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎó£¡");
                return;
            }
 
            if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
            {
                oWeb.getRunProc("insert into Gy_Czygl (Czybm,Czymc,Czmm,Explain,HempID,HK3UserID " +
                    ",HKeeperID,HKeeper,HSecManagerID,HSecManager " +
                    ",HSellManID,HSellMan,HDeptID,HDept " +
                    ",HWhID,HWHName,HSupID,HSupName " +
                    ",HSCWHID,HSCWHName " +
                    ",HMouldWhID,HMouldWhName,HMouldSCWhID,HMouldSCWhName " +
                    ",HCloudUserName,HCloudUserPsd,HUSEORGID)" +
                    "values ("
                    + "'" + txtCzybm.Text.ToString() + "','" + txtCzymc.Text.ToString() + "','" + ClsPub.StrToPsd(txtCzymm.Text.ToString()) + "','" + txtExplain.Text.ToString() + "'," + ClsPub.isLong(txtHEmpID.Tag).ToString() + "," + ClsPub.isLong(txtHK3UserID.Tag).ToString() +
                    "," + ClsPub.isLong(txtHKeeperID.Tag).ToString() + ",'" + txtHKeeperID.Text.ToString() + "'," + ClsPub.isLong(txtHSecManagerID.Tag).ToString() + ",'" + txtHSecManagerID.Text.ToString() + "'" +
                    "," + ClsPub.isLong(txtHSellManID.Tag).ToString() + ",'" + txtHSellManID.Text.ToString() + "'," + ClsPub.isLong(txtHDeptID.Tag).ToString() + ",'" + txtHDeptID.Text.ToString() + "'" +
                    "," + ClsPub.isLong(txtHWhID.Tag).ToString() + ",'" + txtHWhID.Text.ToString() + "'," + ClsPub.isLong(txtHSupID.Tag).ToString() + ",'" + txtHSupID.Text.ToString() + "'" +
                    "," + ClsPub.isLong(txtHSCWH.Tag).ToString() + ",'" + txtHSCWH.Text.ToString() + "'" +
                    "," + ClsPub.isLong(txtHMouldWhID.Tag).ToString() + ",'" + txtHMouldWhID.Text.ToString() + "'," + ClsPub.isLong(txtHMouldSCWhID.Tag).ToString() + ",'" + txtHMouldSCWhID.Text.ToString() + "'" +
                    ",'" + txtHCloudUserName.Text.ToString() + "','" + txtHCloudUserPsd.Text.ToString() + "'," + HOrgID +
                    ")", ref DBUtility.ClsPub.sExeReturnInfo);
                oDs = oWeb.getDataSetBySQL("Select * from Gy_Czygl where Czybm='" + txtCzybm.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
                if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("ÐÂÔöʧ°Ü£¡", "Ìáʾ");
                }
                this.Czybm = oDs.Tables[0].Rows[0]["Czybm"].ToString();
                oWeb.getRunProc("delete from  System_UserGroupInfo where UserId='" + Czybm.ToString() + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                for (int i = 0; i <= LbYes.Items.Count - 1; i++)
                {
                    oWeb.getRunProc("insert into  System_UserGroupInfo (GroupId,UserId) values (" + ClsPub.isLong(Get_Code(this.LbYes.Items[i].ToString())) + ",'" + Czybm.ToString() + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                lblError.Text = "* ÐÂÔö³É¹¦£¡";
                Init();
                tabControl1.SelectedIndex = 0;
            }
            else
            {
                oWeb.getRunProc("update Gy_Czygl set Czymc='" + txtCzymc.Text.ToString() + "'" +
                    ",Explain='" + txtExplain.Text.ToString() + "'" +
                    ",HEmpID=" + ClsPub.isLong(txtHEmpID.Tag).ToString() +
                    ",HK3UserID=" + ClsPub.isLong(txtHK3UserID.Tag).ToString() +
                    ",HKeeperID=" + ClsPub.isLong(txtHKeeperID.Tag).ToString() +
                    ",HKeeper='" + txtHKeeperID.Text.ToString() + "'" +
                    ",HSecManagerID=" + ClsPub.isLong(txtHSecManagerID.Tag).ToString() +
                    ",HSecManager='" + txtHSecManagerID.Text.ToString() + "'" +
                    ",HSellManID=" + ClsPub.isLong(txtHSellManID.Tag).ToString() +
                    ",HSellMan='" + txtHSellManID.Text.ToString() + "'" +
                    ",HDeptID=" + ClsPub.isLong(txtHDeptID.Tag).ToString() +
                    ",HDept='" + txtHDeptID.Text.ToString() + "'" +
                    ",HWhID=" + ClsPub.isLong(txtHWhID.Tag).ToString() +
                    ",HWHName='" + txtHWhID.Text.ToString() + "'" +
                    ",HSCWHID=" + ClsPub.isLong(txtHSCWH.Tag).ToString() +
                    ",HSCWHName='" + txtHSCWH.Text.ToString() + "'" +
                    ",HSupID=" + ClsPub.isLong(txtHSupID.Tag).ToString() +
                    ",HSupName='" + txtHSupID.Text.ToString() + "'" +
                    ",HCloudUserName='" + txtHCloudUserName.Text.ToString() + "'" +
                    ",HCloudUserPsd='" + txtHCloudUserPsd.Text.ToString() + "'" +
                    ",HUSEORGID=" + HOrgID.ToString() +
                    ",HMouldWhID=" + ClsPub.isLong(txtHMouldWhID.Tag).ToString() +
                    ",HMouldWhName='" + txtHMouldWhID.Text.ToString() + "'" +
                    ",HMouldSCWhID=" + ClsPub.isLong(txtHMouldSCWhID.Tag).ToString() +
                    ",HMouldSCWhName='" + txtHMouldSCWhID.Text.ToString() + "'" +
                    "where Czybm='" + Czybm + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                //
                oWeb.getRunProc("delete from  System_UserGroupInfo where UserId='" + Czybm + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                for (int i = 0; i <= LbYes.Items.Count - 1; i++)
                {
                    oWeb.getRunProc("insert into  System_UserGroupInfo (GroupId,UserId) values (" + ClsPub.isLong(Get_Code(this.LbYes.Items[i].ToString())) + ",'" + Czybm + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                }
                lblError.Text = "* Ð޸ijɹ¦£¡";
                tabControl1.SelectedIndex = 0;
            }
        }
        //µ¥¾ÝÍêÕûÐÔÅжÏ
        private bool Sub_AllowSave()
        {
            if (txtCzybm.Text.Trim() == "")
            {
                lblError.Text = "* ±àÂë²»ÄÜΪ¿Õ£¡";
                return false;
            }
            if (txtCzymc.Text.Trim() == "")
            {
                lblError.Text = "* Óû§Ãû²»ÄÜΪ¿Õ£¡";
                return false;
            }
            // ÑéÖ¤ÃÜÂë
            if (txtCzymm.Text.Trim() != "")
            {
                if (txtCzymm.Text.Trim() != txtCzyyz.Text.Trim())
                {
                    lblError.Text = "* ÃÜÂëÑéÖ¤´íÎó£¡";
                    return false;
                }
            }
            // Óû§±àÂëºÍÓû§Ãû ÊÇ·ñÖØ¸´
            if (InputMode == Pub_Class.ClsPub.Enum_InputMode.InputMode_AddNew)
            {
                DataSet oDs = new DataSet();
                DataSet oDS = new DataSet();
                oDs = oWeb.getDataSetBySQL("select * from  Gy_Czygl where Czybm='" + txtCzybm.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
                oDS = oWeb.getDataSetBySQL("select * from  Gy_Czygl where Czymc='" + txtCzymc.Text.ToString() + "'", "Gy_Czygl", ref DBUtility.ClsPub.sExeReturnInfo);
                if (oDs.Tables[0].Rows.Count != 0)
                {
                    lblError.Text = "* ±àÂëÖØ¸´£¡";
                    return false;
                }
                if (oDS.Tables[0].Rows.Count != 0)
                {
                    lblError.Text = "* Óû§ÃûÖØ¸´£¡";
                    return false;
                }
            }
            return true;
        }
        //²ð·Ö
        private string Get_Code(string sCode)
        {
            sCode = sCode.Trim();
            char c = Convert.ToChar("-");
            string[] s = sCode.Split(c);
            if (s.Length > 1)
            {
                return s[0].Trim();
            }
            else
            {
                return "0";
            }
        }
 
        //ÐÞ¸ÄÃÜÂë
        private void cmdPassWord_Click(object sender, EventArgs e)
        {
            Xt_Password oPassword = new Xt_Password(); 
            oPassword.Czybm = this.Czybm;
            oPassword.ShowDialog();
        }
        #region ¶ÔÓ¦»ù´¡×ÊÁÏÉèÖÃ
 
        //²éÕÒ½ÇÉ«
        public int i = 0;   //ÐеÄÏÂ±ê¿ØÖÆÆ÷ (*****¿ØÖÆ´ÓµÚ¼¸ÐпªÊ¼±éÀú*****)
        public bool notNull = false;    //µÝ¹é¿ØÖÆÆ÷ (*****¿ØÖÆÊÇ·ñ¿Éµ÷Óõݹé******)
        private void cmdHGroup_Click(object sender, EventArgs e)
        {
            string sFind = txtHGroup.Text.Trim();
            string sGroup = "";
            for (int a = i; a <= LbNo.Items.Count - 1; a++)
            {
                sGroup = this.LbNo.Items[a].ToString();
                if (sGroup.IndexOf(sFind) != -1)
                {
                    this.LbNo.SelectedIndex = a;
                    i = a + 1;  //ʹÏ´αéÀú´Ó¸ÃÐеÄÏÂÒ»ÐпªÊ¼²éÕÒ
                    notNull = true;
                    return;   //ÉèÖÃnotNullÎªÕæ,Ìø³ö
                }
            }
            if (notNull) //ʼÖÕδÕÒµ½Æ¥ÅäÏîÔò½øÈë
            {
                i = 0;  //ÖØÖôӵÚÒ»ÐбéÀú
                notNull = false;  //ÉèÖÃnotNullΪ¼Ù,Èç¹ûÔÙÒ»´Î´ÓµÚÒ»ÐбéÀúδÕÒµ½Æ¥ÅäÏîÔò²»»áÔÙ½øÈëIFµ÷Óõݹé
                cmdHGroup_Click(sender, e); //µÝ¹é
            }
            else
            {
                MessageBox.Show("δÕÒµ½£¡£¡");
            }
        }
 
        private void cmdHEmpID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
            string DeWhere = "";
            DeWhere = " ";
            if (oEmp.RefreshView(DeWhere))
            {
                this.txtHEmpID.Text = oEmp.oModel.HName;
                this.txtHEmpID.Tag = oEmp.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHEmpID.Text = "";
                this.txtHEmpID.Tag = 0;
            }
        }
 
        private void txtHEmpID_TextChanged(object sender, EventArgs e)
        {
            if (txtHEmpID.Text.Trim() == "")
            {
                txtHEmpID.Tag = "0";
            }
        }
 
        //-------------------------------------------------------
        private void cmdHK3UserID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_User_View oUser = new SCM.ClsIF_User_View();
            string DeWhere = "";
            DeWhere = " ";
            if (oUser.RefreshView(DeWhere))
            {
                this.txtHK3UserID.Text = oUser.oModel.HName;
                this.txtHK3UserID.Tag = oUser.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHK3UserID.Text = "";
                this.txtHK3UserID.Tag = 0;
            }
        }
 
        private void txtHK3UserID_TextChanged(object sender, EventArgs e)
        {
            if (txtHK3UserID.Text.Trim() == "")
            {
                txtHK3UserID.Tag = "0";
            }
        }
 
        private void cmdHKeeperID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
            string DeWhere = "";
            DeWhere = " ";
            if (oEmp.RefreshView(DeWhere))
            {
                this.txtHKeeperID.Text = oEmp.oModel.HName;
                this.txtHKeeperID.Tag = oEmp.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHKeeperID.Text = "";
                this.txtHKeeperID.Tag = 0;
            }
        }
 
        private void txtHKeeperID_TextChanged(object sender, EventArgs e)
        {
            if (txtHKeeperID.Text.Trim() == "")
            {
                txtHKeeperID.Tag = "0";
            }
        }
 
        private void cmdHSecManagerID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
            string DeWhere = "";
            DeWhere = " ";
            if (oEmp.RefreshView(DeWhere))
            {
                this.txtHSecManagerID.Text = oEmp.oModel.HName;
                this.txtHSecManagerID.Tag = oEmp.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHSecManagerID.Text = "";
                this.txtHSecManagerID.Tag = 0;
            }
        }
 
        private void txtHSecManagerID_TextChanged(object sender, EventArgs e)
        {
            if (txtHSecManagerID.Text.Trim() == "")
            {
                txtHSecManagerID.Tag = "0";
            }
        }
 
        private void cmdHSellManID_Click(object sender, EventArgs e)
        {
            SCM.ClsIF_Employee_View oEmp = new SCM.ClsIF_Employee_View();
            string DeWhere = "";
            DeWhere = " ";
            if (oEmp.RefreshView(DeWhere))
            {
                this.txtHSellManID.Text = oEmp.oModel.HName;
                this.txtHSellManID.Tag = oEmp.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHSellManID.Text = "";
                this.txtHSellManID.Tag = 0;
            }
        }
 
        private void txtHSellManID_TextChanged(object sender, EventArgs e)
        {
            if (txtHSellManID.Text.Trim() == "")
            {
                txtHSellManID.Tag = "0";
            }
        }
 
        private void cmdHDeptID_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Department_View oDep = new SCM.ClsIF_Department_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oDep.RefreshView(DeWhere))
            {
                this.txtHDeptID.Text = oDep.oModel.HName;
                this.txtHDeptID.Tag = oDep.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHDeptID.Text = "";
                this.txtHDeptID.Tag = 0;
            }
        }
 
        private void txtHDeptID_TextChanged(object sender, EventArgs e)
        {
            if (txtHDeptID.Text.Trim() == "")
            {
                txtHDeptID.Tag = "0";
            }
        }
 
        private void cmdHWhID_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oWh.RefreshView(DeWhere))
            {
                if (oWh.oModel.HItemID.ToString() == txtHSCWH.Tag.ToString())
                {
                    MessageBox.Show("¶ÔÓ¦²Ö¿â²»ÄÜÓëµ÷Èë²Ö¿âÏàͬ£¡");
                    this.txtHWhID.Text = "";
                    return;
                }
                else
                {
                    this.txtHWhID.Text = oWh.oModel.HName;
                    this.txtHWhID.Tag = oWh.oModel.HItemID.ToString();
                }
            }
            else
            {
                this.txtHWhID.Text = "";
                this.txtHWhID.Tag = 0;
            }
        }
 
        private void txtHWhID_TextChanged(object sender, EventArgs e)
        {
            if (txtHWhID.Text.Trim() == "")
            {
                txtHWhID.Tag = "0";
            }
        }
 
        //µ÷Èë²Ö¿â
        private void cmdHSCWH_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oWh.RefreshView(DeWhere))
            {
                if (oWh.oModel.HItemID.ToString() == txtHWhID.Tag.ToString())
                {
                    MessageBox.Show("µ÷Èë²Ö¿â²»ÄÜÓë¶ÔÓ¦²Ö¿âÏàͬ£¡");
                    this.txtHSCWH.Text = "";
                    return;
                }
                else
                {
                this.txtHSCWH.Text = oWh.oModel.HName;
                this.txtHSCWH.Tag = oWh.oModel.HItemID.ToString();
                }
            }
            else
            {
                this.txtHSCWH.Text = "";
                this.txtHSCWH.Tag = 0;
            }
        }
 
        private void txtHSCWH_TextChanged(object sender, EventArgs e)
        {
            if (txtHSCWH.Text.Trim() == "")
            {
                txtHSCWH.Tag = "0";
            }
        }
 
        private void cmdHSupID_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Supplier_View oSup = new SCM.ClsIF_Supplier_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oSup.RefreshView(DeWhere))
            {
                this.txtHSupID.Text = oSup.oModel.HName;
                this.txtHSupID.Tag = oSup.oModel.HItemID.ToString();
            }
            else
            {
                this.txtHSupID.Text = "";
                this.txtHSupID.Tag = 0;
            }
        }
 
        private void txtHSupID_TextChanged(object sender, EventArgs e)
        {
            if (txtHSupID.Text.Trim() == "")
            {
                txtHSupID.Tag = "0";
            }
        }
 
 
        #endregion
 
        #region ¶ÔӦģ¾ß»ù´¡×ÊÁÏÉèÖÃ
 
        //µ÷Èë²Ö¿â
        private void cmdHMouldWhID_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oWh.RefreshView(DeWhere))
            {
                if (oWh.oModel.HItemID.ToString() == txtHMouldSCWhID.Tag.ToString())
                {
                    MessageBox.Show("¶ÔÓ¦²Ö¿â²»ÄÜÓëµ÷Èë²Ö¿âÏàͬ£¡");
                    this.txtHMouldWhID.Text = "";
                    return;
                }
                else
                {
                    this.txtHMouldWhID.Text = oWh.oModel.HName;
                    this.txtHMouldWhID.Tag = oWh.oModel.HItemID.ToString();
                }
            }
            else
            {
                this.txtHMouldWhID.Text = "";
                this.txtHMouldWhID.Tag = 0;
            }
        }
 
        private void txtHMouldWhID_TextChanged(object sender, EventArgs e)
        {
            if (txtHMouldWhID.Text.Trim() == "")
            {
                txtHMouldWhID.Tag = "0";
            }
        }
 
        //µ÷³ö²Ö¿â
        private void cmdHMouldSCWhID_Click(object sender, EventArgs e)
        {
            HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            if (HOrgID == -1)
            {
                MessageBox.Show("Ñ¡Ôñ×éÖ¯ÓдíÎ󣬻ñÈ¡ÐÅϢʧ°Ü£¡");
                return;
            }
 
            SCM.ClsIF_Warehouse_View oWh = new SCM.ClsIF_Warehouse_View();
            string DeWhere = "";
            DeWhere = " and HUSEORGID = " + HOrgID;
            if (oWh.RefreshView(DeWhere))
            {
                if (oWh.oModel.HItemID.ToString() == txtHMouldWhID.Tag.ToString())
                {
                    MessageBox.Show("µ÷Èë²Ö¿â²»ÄÜÓë¶ÔÓ¦²Ö¿âÏàͬ£¡");
                    this.txtHMouldSCWhID.Text = "";
                    return;
                }
                else
                {
                    this.txtHMouldSCWhID.Text = oWh.oModel.HName;
                    this.txtHMouldSCWhID.Tag = oWh.oModel.HItemID.ToString();
                }
            }
            else
            {
                this.txtHMouldSCWhID.Text = "";
                this.txtHMouldSCWhID.Tag = 0;
            }
        }
 
        private void txtHMouldSCWhID_TextChanged(object sender, EventArgs e)
        {
            if (txtHMouldSCWhID.Text.Trim() == "")
            {
                txtHMouldSCWhID.Tag = "0";
            }
        }
 
        #endregion
 
        private void cmbHOrgID_TextChanged(object sender, EventArgs e)
        {
            txtHDeptID.Text = "";
            txtHWhID.Text = "";
            txtHSCWH.Text = "";
            txtHSupID.Text = "";
            txtHMouldWhID.Text = "";
            txtHMouldSCWhID.Text = "";
        }
 
 
 
 
    }
}