ch
2022-05-30 f9ef44a67fbf73f073efe65600bc25e204fde04f
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace MES
{
    public partial class Sc_CheckRequest : Form
    {
        public Sc_CheckRequest()
        {
            InitializeComponent();
        }
 
        public long HInterID;
        public int IsOk;
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
 
        private void cmdHCheckMan_Click(object sender, EventArgs e)
        {
            DBUtility.Gy_UserSelect oUser = new DBUtility.Gy_UserSelect();
            oUser.bSingle = true;
            oUser.ShowDialog();
            if (oUser.IsOk == 1)
            {
                txtHMarker.Text = oUser.sReturn;
            }
            else
            {
                txtHMarker.Text = "";
            }
        }
 
        private void cmdCancel_Click(object sender, EventArgs e)
        {
            IsOk = 2;
            this.Close();
        }
 
        private void cmdOK_Click(object sender, EventArgs e)
        {
            IsOk = 1;
            if (!AllowSave())
            {
                return;
            }
            Save();
            this.Close();
        }
 
        private void Xs_SellOutDayReportDlg_Activated(object sender, EventArgs e)
        {
        }
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            IsOk = 0;
            Show();
        }
 
        private void Show()
        {
            DataSet oDs = new DataSet();
            oDs = oCn.RunProcReturn(" Select * From h_v_Sc_ProcessReportList where HMainID=" + HInterID.ToString(), "h_v_Sc_ProcessReportList");
            if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                return;
            txtHBillNo.Tag = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HMainID"]);
            txtHBillNo.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["µ¥¾ÝºÅ"]);
            txtHNumber.Tag = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HMaterID"]);
            txtHNumber.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["ÎïÁÏ´úÂë"]);
            txtHName.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["ÎïÁÏÃû³Æ"]);
            txtHModel.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["¹æ¸ñÐͺÅ"]);
            txtHQty.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["ÊýÁ¿"]).ToString();
            txtHBadCount.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["²»Á¼ÊýÁ¿"]).ToString();
            txtHWasterQty.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["±¨·ÏÊý"]).ToString();
        }
 
        private bool AllowSave()
        {
            if (DBUtility.ClsPub.isLong(txtHBillNo.Tag) == 0)
            {
                MessageBox.Show("»ã±¨µ¥ÄÚÂë²»ÕýÈ·£¡");
                return false;
            }
            if (DBUtility.ClsPub.isLong(txtHNumber.Tag) == 0)
            {
                MessageBox.Show("ÎïÁÏÄÚÂë²»ÕýÈ·£¡");
                return false;
            }
            if (DBUtility.ClsPub.isDoule(txtHQty.Text) == 0)
            {
                MessageBox.Show("»ã±¨ÊýÁ¿²»ÄܵÈÓÚ0£¡");
                return false;
            }
            if (DBUtility.ClsPub.isStrNull(txtHMarker.Text.Trim()) == "")
            {
                MessageBox.Show("ÇëÑ¡Ôñ¼ìÑéÔ±£¡");
                return false;
            }
            return true;
        }
        private void Save()
        {
            try
            {
                oCn.BeginTran();
                oCn.RunProc("UpDate Sc_ProcessReportSub set  " +
                " HQty=" + DBUtility.ClsPub.isDoule(txtHQty.Text).ToString() +
                ",HBadCount=" + DBUtility.ClsPub.isDoule(txtHBadCount.Text).ToString() +
                ",HWasterQty=" + DBUtility.ClsPub.isDoule(txtHWasterQty.Text).ToString() +
                " where HInterID=" + DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString());
                oCn.RunProc(" Insert into Sc_ProcessReportCheckRequest (HInterID,HMaterID,HQty,HBadCount,HWasterQty,HChecker,HMakeDate) "+
                    " values (" +
                     DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHNumber.Tag).ToString() + "," + DBUtility.ClsPub.isDoule(txtHQty.Text).ToString() +
                     "," + DBUtility.ClsPub.isDoule(txtHBadCount.Text).ToString() + "," + DBUtility.ClsPub.isDoule(txtHWasterQty.Text).ToString() + ",'" + DBUtility.ClsPub.isStrNull(txtHMarker.Text) + "',getdate()" +
                     ")");
                //
                //ĬÈϱäΪ ÉêÇë¼ìÑé״̬
                oCn.RunProc("exec h_p_Sc_UpDateProcessReportStatus " + DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString() + ",15");
                //
                MessageBox.Show("±¨¼ìÉêÇë³É¹¦£¡", "Ìáʾ");
                oCn.Commit();
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
 
 
    }
}