yusijie
2024-11-29 89873b7d156f21e7aa71b3f004a11ced2e7a7d4e
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
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 Xs_SendGoodsPlan_MPS : Form
    {
        public Xs_SendGoodsPlan_MPS()
        {
            InitializeComponent();
        }
 
        private void cmdOK_Click(object sender, EventArgs e)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            SQLHelper.ClsCNK3 oK3Cn = new SQLHelper.ClsCNK3();
            //µÃµ½Óû§ID
            Int64 HBillerID;
            DataSet DsBiller;
            string HSourceBillType = "";
            DsBiller = oK3Cn.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;
            DataSet Ds2;
            //µÃµ½mainid
            Int64 HInterID = 0;     //MPSÄÚÂë
            Int64 HRunInterID = 0; //ÔËËãÄÚÂë  ÔËËãµ¥¾ÝºÅ=¡®MPS¡¯+ÔËËãÄÚÂë
            Ds1 = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'ICMrpResult', @InterID output, 1, " + HBillerID.ToString() + " select ltrim(@InterID)", "GetICMaxNum");
            if (Ds1.Tables[0].Rows.Count != 0)
            {
                HInterID = DBUtility.ClsPub.isLong(Ds1.Tables[0].Rows[0][0]);
            }
 
            Ds2 = oK3Cn.RunProcReturn("declare @InterID int set @InterID=0 exec GetICMaxNum 'PlanCalc', @InterID output, 1, " + HBillerID.ToString() + " select ltrim(@InterID)", "GetICMaxNum");
            if (Ds2.Tables[0].Rows.Count != 0)
            {
                HRunInterID = DBUtility.ClsPub.isLong(Ds2.Tables[0].Rows[0][0]);
            }
            //µÃµ½µ¥¾ÝºÅ
            string HBillNo;
            HBillNo = DBUtility.Xt_BaseBillFun.get_MaxBillNo_K3("500", oK3Cn);
 
            long HItemID = DBUtility.ClsPub.isLong(txtHBillNo.Tag);
            double HQty = DBUtility.ClsPub.isDoule(txtHQty.Text);
            //·¢»õ¼Æ»®ÄÚÂ룬MPSÄÚÂ룬MPSµ¥¾ÝºÅ£¬Éú³ÉÊýÁ¿£¬ÖƵ¥ÈË
            oCn.RunProc("exec h_p_Xs_SendGoodsPlan_MPS " + HItemID + "," + HInterID + ",'" + HBillNo + "'," + HQty + "," + HBillerID + "," + HRunInterID);
            MessageBox.Show("Éú³É³É¹¦£¡","Ìáʾ");
            this.Close();
        }
 
        private void tc_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}