using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; using Gm_WMS.DataAccess.DataService; using Stone.Common; namespace Stone.WinModule.BasicData { public partial class frmASNManager : Stone.WinModule.frmBase { public frmASNManager() { InitializeComponent(); } private void frmASNManager_Load(object sender, EventArgs e) { tbSerNum.ReadOnly = true; RefreshAsnNum(); } private void RefreshAsnNum() { var strsql = ""; var sysDate = ""; sysDate = Convert.ToDateTime(MyDateTime.GetServerDateTime()).Date.ToString("yyyy"); strsql = "select * from t_BillNo" + " where type = 'VDAASN编号_SY88_" + sysDate + "'"; var db = new LocalDBService(); DataTable dtData = db.Exec_DataSet(strsql).Tables[0]; if (dtData.Rows.Count > 0) { tbSerNum.Text = dtData.Rows[0]["value"].ToString(); } else { tbSerNum.Text = "0"; } } private void btnModify_Click(object sender, EventArgs e) { tbSerNum.ReadOnly = false; tbSerNum.Focus(); tbSerNum.SelectAll(); } private void btnUpdate_Click(object sender, EventArgs e) { var serNum = 0; try { serNum = int.Parse(tbSerNum.Text); } catch (Exception exception) { MessageBox.Show("请输入有效的数值!"); tbSerNum.SelectAll(); return; } var sysDate = ""; sysDate = Convert.ToDateTime(MyDateTime.GetServerDateTime()).Date.ToString("yyyy"); var strsql = "Update t_BillNo set value = " + serNum + " where type = 'VDAASN编号_SY88_" + sysDate + "'"; var db = new LocalDBService(); db.Exec_NonQuery(strsql); tbSerNum.ReadOnly = true; RefreshAsnNum(); MessageBox.Show("修改ASN单当前最大流水号成功!"); } } }