1
duhe
2023-09-25 4d2d5f8d8151e6b74811bc1dbd9cbfd74d7498f1
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace WorkM
{
    public partial class Sc_MpsResultBill_ICMO : Form
    {
        public Sc_MpsResultBill_ICMO()
        {
            InitializeComponent();
        }
        public long HMPSInterID;
 
        private void cmbOK_Click(object sender, EventArgs e)
        {
            SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
            string HICMOBillNo;
            string HPPBOMBillNo;
            try
            {
                HICMOBillNo = DBUtility.Xt_BaseBillFun.get_MaxBillNo_K3("85", oCnK3);
                HPPBOMBillNo = DBUtility.Xt_BaseBillFun.get_MaxBillNo_K3("88", oCnK3);
 
                //µÃµ½Óû§ID
                long HBillerID;
                DataSet DsBiller; 
                DsBiller = oCnK3.RunProcReturn("select top 1 fuserid from t_User where fname='" + DBUtility.ClsPub.CurUserName + "'", "t_User");
                if (DsBiller.Tables[0].Rows.Count != 0)
                {
                    HBillerID = DBUtility.ClsPub.isLong(DsBiller.Tables[0].Rows[0][0]);
                }
                else
                {
                    HBillerID = 16394;
                }
                //
                DataSet Ds1;
                //µÃµ½mainid
                long HICMOInterID = 0;
                Ds1 = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ICMO', @InterID output, 1, " + HBillerID.ToString() + " select ltrim(@InterID)", "GetICMaxNum");
                if (Ds1.Tables[0].Rows.Count != 0)
                {
                    HICMOInterID = DBUtility.ClsPub.isLong(Ds1.Tables[0].Rows[0][0]);
                }
                if (HICMOInterID == 0)
                {
                    MessageBox.Show("Éú³ÉÈÎÎñµ¥ÄÚÂëʧ°Ü£¡");
                    return;
                }
 
                DataSet Ds2;
                //µÃµ½mainid
                long HPPBOMInterID = 0;
                Ds2 = oCnK3.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'PPBOM', @InterID output, 1, " + HBillerID.ToString() + " select ltrim(@InterID)", "GetICMaxNum");
                if (Ds2.Tables[0].Rows.Count != 0)
                {
                    HPPBOMInterID = DBUtility.ClsPub.isLong(Ds2.Tables[0].Rows[0][0]);
                }
                if (HPPBOMInterID == 0)
                {
                    MessageBox.Show("Éú³ÉͶÁϵ¥ÄÚÂëʧ°Ü£¡");
                    return;
                }
 
                oCnK3.BeginTran();
                double HQty=DBUtility.ClsPub.isDoule( txtHQty.Text);
                //²ÎÊý  MPSÄÚÂ룬ÊýÁ¿£¬ÖƵ¥ÈË£¬ÈÎÎñµ¥ÄÚÂ룬ÈÎÎñµ¥ºÅ£¬Í¶Áϵ¥ÄÚÂ룬ͶÁϵ¥ºÅ
                oCnK3.RunProc("exec h_p_Sc_MpsResultBill_ICMO " + HMPSInterID + "," + HQty + "," + HBillerID + "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HPPBOMInterID + ",'" + HPPBOMBillNo+"'");
 
                oCnK3.Commit();
            }
            catch (Exception ex)
            {
                oCnK3.RollBack();
                throw (ex);
            }
 
 
            MessageBox.Show("ÈÎÎñµ¥ºÅ£º" + HICMOBillNo + "£¬Í¶Áϵ¥ºÅ£º" + HPPBOMBillNo + "£¬±£´æÍê±Ï£¡");
            this.Close();
        }
 
        private void cmbCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}