| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 | using DevComponents.DotNetBar;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;using WCS.Data.Models;using WCS_Client.UC;namespace WCS_Client.Frm{    public partial class FrmUpdateCurrenMatureNum : Office2007Form    {        DataRow dr = null;        public FrmUpdateCurrenMatureNum(DataRow datarow)        {            InitializeComponent();            dr = datarow;            this.txt_BARCODE.Text = datarow["BARCODE"].ToString();            this.txt_MatureRoomNo.Text = datarow["MatureRoomNo"].ToString();            this.txt_MatureRoomName.Text = datarow["MatureRoomName"].ToString();            this.txt_InMatureRoomDate.Text = datarow["InMatureRoomDate"].ToString();            this.txt_MatureNum.Text = datarow["MatureNum"].ToString();            this.txt_CurrentMatureNum.Text = datarow["CurrentMatureNum"].ToString();        }        private void button2_Click(object sender, EventArgs e)        {            this.Close();        }        private void button1_Click(object sender, EventArgs e)        {            if (Convert.ToInt32(this.txt_CurrentMatureNum.Text) == 0)            {                MessageUtil.ShowError("码垛编号不能为零!");                return;            }            if (string.IsNullOrWhiteSpace(this.txt_CurrentMatureNum.Text))            {                MessageUtil.ShowError("当前熟化次数不能为空!");                return;            }            if (Convert.ToInt32(this.txt_CurrentMatureNum.Text) > Convert.ToInt32(this.txt_MatureNum.Text))            {                MessageUtil.ShowError("当前熟化次数不能大于熟化次数!");                return;            }            var palletizingCode = new MatureRoomCache();            palletizingCode.CurrentMatureNum = Convert.ToInt32(txt_CurrentMatureNum.Text);            string result = TryCachHelper.TryExecute((db) =>            {                if (db.Updateable<MatureRoomCache>()                      .UpdateColumns(it => new MatureRoomCache                      {                          CurrentMatureNum = palletizingCode.CurrentMatureNum                       })                      .Where(v => v.BARCODE == txt_BARCODE.Text && v.MatureRoomNo == txt_MatureRoomNo.Text).ExecuteCommand() < 0)                {                    throw new Exception(string.Format("熟化房编号【{0}】中熟化架条码【{1}】修改参数失败", txt_BARCODE.Text, txt_MatureRoomNo.Text));                }            });            if (string.IsNullOrWhiteSpace(result))            {                result = string.Format("熟化信息成功!");            }            MessageUtil.ShowTips(result);        }    }}
 |