using SYNC_SAP_MES; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SYNC_SAP_MES { /// /// /// public partial class D_Update_FlowNo : Form { /// /// /// public string FlowNo = ""; /// /// /// public D_Update_FlowNo() { InitializeComponent(); } /// /// /// /// public D_Update_FlowNo(string flowNo) { InitializeComponent(); txt_FlowNo.Text = flowNo; } /// /// /// /// /// private void btn_Sure_Click(object sender, EventArgs e) { if (!ifIntValue(txt_FlowNo.Text.Trim())) { MessageBox.Show("流水号不能为空,且必须为整数!"); return; } else { Sql_Biz_SAP.GetFlowNo_CurrMax(out string flowNo_CurrMax); var setFlowNo = txt_FlowNo.Text; if (Convert.ToInt32(setFlowNo) < Convert.ToInt32(flowNo_CurrMax)) { //允许设置 >= 的流水号 MessageBox.Show("不允许设置小于当前生产的流水号!"); return; } } if (string.IsNullOrEmpty(txt_Sure.Text)) { MessageBox.Show("为了防止错误操作,请填写在文本框填入 确认 !"); return; } FlowNo = txt_FlowNo.Text; DialogResult = DialogResult.OK; } private bool ifIntValue(string inputValue) { try { var k = Convert.ToInt32(inputValue); return true; } catch { return false; } } private void btn_Cancel_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } private void btn_Query_Click(object sender, EventArgs e) { Sql_Biz_SAP.GetFlowNo_CurrMax(out string FlowNo); txt_FlowNo_CurrMax.Text = FlowNo; } } }