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 FrmAddPalletizing : Office2007Form { public FrmAddPalletizing() { InitializeComponent(); } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void btnAddP_Click(object sender, EventArgs e) { if (nudPalletizingNo.Value == 0) { MessageUtil.ShowError("码垛编号不能为空"); return; } //else if (nudSonTrayNo.Value == 0) //{ // MessageUtil.ShowError("子托盘编号不能为空"); // return; //} else if (nudBoxNo.Value == 0) { MessageUtil.ShowError("箱子编号不能为空"); return; } else if (string.IsNullOrWhiteSpace(txtBoxSize.Text)) { MessageUtil.ShowError("箱子尺寸不能为空"); return; } //else if (string.IsNullOrWhiteSpace(txtSonTraySize.Text)) //{ // MessageUtil.ShowError("子托盘尺寸不能为空"); // return; //} var palletizingCode = new WCS_PalletizingCode(); palletizingCode.PalletizingNo = Convert.ToInt32(nudPalletizingNo.Value); palletizingCode.PalletizingSonTrayNo = Convert.ToInt32(nudSonTrayNo.Value); palletizingCode.PalletizingSonTrayCode = txtSonTraycode.Text.Trim(); palletizingCode.PalletizingSonTraySize = txtSonTraySize.Text.Trim(); palletizingCode.PalletizingBoxNo = Convert.ToInt32(nudBoxNo.Value); palletizingCode.PalletizingBoxSize = txtBoxSize.Text.Trim(); string result = TryCachHelper.TryExecute((db) => { db.Insertable(palletizingCode).ExecuteCommand(); }); if (string.IsNullOrWhiteSpace(result)) { result = string.Format("添加机械码垛信息成功"); } MessageUtil.ShowTips(result); } } }