yusijie
2022-11-25 af74d787372fe679d9301cad7178b3ad6acb31cb
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace APSM
{
    public partial class Sc_ICMOSortBillDlg_Remark : Form
    {
        public Sc_ICMOSortBillDlg_Remark()
        {
            InitializeComponent();
        }
        public long HICMOInterID;
        public long HSourceID;
        public string HSplitNO;
        public DateTime HDate;
 
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            this.Visible = false;
        }
 
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (!Sub_Save())
            {
                return;
            }
            //
            this.Visible = false;
        }
 
        private void Sub_Show()
        {
            DAL.ClsGy_Source_View oSource =new DAL.ClsGy_Source_View();
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet Ds = new DataSet();
            Ds = oCn.RunProcReturn("select * from h_v_Sc_ICMOSortBillSource where HMainID=" + HICMOInterID.ToString(), "h_v_Sc_ICMOSortBillSource");
            if (Ds.Tables[0].Rows.Count == 0)
                return;
            txtHICMOBillNo.Tag = Ds.Tables[0].Rows[0]["HMainID"].ToString();
            txtHICMOBillNo.Text = Ds.Tables[0].Rows[0]["HBillNo"].ToString();
            txtHSplitNO.Text = HSplitNO;
            txtHMaterNumber.Tag = Ds.Tables[0].Rows[0]["HMaterID"].ToString();
            txtHMaterNumber.Text = Ds.Tables[0].Rows[0]["HMaterNumber"].ToString();
            txtHMaterName.Text = Ds.Tables[0].Rows[0]["HMaterName"].ToString();
            txtHMaterModel.Text = Ds.Tables[0].Rows[0]["HMaterModel"].ToString();
            if (oSource.GetInfoByID(HSourceID))
            {
                txtHSourceNumber.Tag = oSource.omodel.HItemID;
                txtHSourceNumber.Text = oSource.omodel.HNumber;
                txtHSourceName.Text = oSource.omodel.HName;
            }
            else
            {
                txtHSourceNumber.Tag = 0;
                txtHSourceNumber.Text = "";
                txtHSourceName.Text = "";
            }
            dtpHDate.Value = HDate;
            //
            Ds = null;
            Ds = oCn.RunProcReturn("select * from Sc_ICMOSortBill_Remark where HICMOInterID=" + HICMOInterID.ToString() + " and HSplitNO='" + HSplitNO + "' and HSourceID=" + HSourceID.ToString() + " and HDate='" + HDate.ToShortDateString() + "'", "Sc_ICMOSortBill_Remark");
            if (Ds.Tables[0].Rows.Count == 0)
                return;
            txtHRemark.Text = Ds.Tables[0].Rows[0]["HRemark"].ToString();
            //
            Ds = null;
        }
 
        private bool Sub_Save()
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Delete From Sc_ICMOSortBill_Remark where HICMOInterID=" + txtHICMOBillNo.Tag.ToString() + " and HSplitNO='" + txtHSplitNO.Text.Trim() + "' and HSourceID=" + txtHSourceNumber.Tag.ToString() + " and HDate='" + dtpHDate.Value.ToShortDateString() + "'");
                //
                oCn.RunProc("Insert Into Sc_ICMOSortBill_Remark (HICMOInterID,HSplitNO,HMaterID,HSourceID,HDate,HRemark) values (" +
                    txtHICMOBillNo.Tag.ToString() + ",'" + txtHSplitNO.Text.Trim() + "'," + txtHMaterNumber.Tag.ToString() + "," + txtHSourceNumber.Tag.ToString() + ",'" + dtpHDate.Value.ToShortDateString() + "','" + txtHRemark.Text.Trim() + "')");
                //
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                MessageBox.Show("ÉèÖñ¸×¢Ê§°Ü£¡Ô­Òò£º" + e.Message, "Ìáʾ");
                oCn.RollBack();
                return false;
            }
        }
 
        private void Sc_ICMOSortBillDlg_Remark_Load(object sender, EventArgs e)
        {
            Sub_Show();
        }
 
    }
}