private void defaultItemStatusBinding(string itemNumber, string statusName) { try { List <string> _listItemStatus = new List <string>(); _listItemStatus = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventoryStatuss(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtLocation.Text.Trim(), string.Empty, string.Empty, this.txtItemNumber.Text.Trim()).ToList(); if (_listItemStatus != null) { /*แสดงแบบ ถ้ามีข้อมูลเพียง Record เดียวให้ แสดงค่ามาเลย*/ if (string.IsNullOrEmpty(statusName)) { if (_listItemStatus.Count() > 1) { _listItemStatus.Insert(0, Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect); ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus); } else { ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus); } } else { ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus); this.cmbItemStatus.Text = statusName; } } else { this.cmbItemStatus.DataSource = null; } } catch (Exception ex) { if (ex.InnerException != null) { MsgBox.DialogError(ex.InnerException.Message.ToString()); } else { if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y")) { // Show error description detail MsgBox.DialogError(ex.GetBaseException().ToString()); } else { // Show message error MsgBox.DialogError(ex.Message.ToString()); } } } }
private void itemNumberBinding(string warehouseCode, string countNumber, string locationCode) { try { List <string> _listItemNumber = new List <string>(); _listItemNumber = Calbee.WMS.Services.Count.CountLocationServiceProxy.WS.GetCountItems(warehouseCode, countNumber, locationCode).ToList(); if (_listItemNumber != null) { if (_listItemNumber.Count() == 0) { this.cmbItemNumber.Text = string.Empty; this.cmbItemNumber.DataSource = null; } else if (_listItemNumber.Count() > 1) { _listItemNumber.Insert(0, string.Empty); // Calbee.Infra.Common.Constants.WConstants.defaultDropdownSelect); ComboBoxBinding.BindLStringToCombobox(_listItemNumber, this.cmbItemNumber); } else { ComboBoxBinding.BindLStringToCombobox(_listItemNumber, this.cmbItemNumber); } } else { this.cmbItemNumber.Text = string.Empty; this.cmbItemNumber.DataSource = null; } } catch (Exception ex) { if (ex.InnerException != null) { MsgBox.DialogError(ex.InnerException.Message.ToString()); } else { if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y")) { // Show error description detail MsgBox.DialogError(ex.GetBaseException().ToString()); } else { // Show message error MsgBox.DialogError(ex.Message.ToString()); } } } }
private void LotNumberBinding() { try { List <string> _listLotNumber = new List <string>(); _listLotNumber = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventoryLotNumbers(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, this.txtLocation.Text.Trim(), string.Empty, string.Empty, this.txtItemNumber.Text.Trim()).OrderBy(s => s).ToList(); if (_listLotNumber != null) { if (_listLotNumber.Count() >= 1) { ComboBoxBinding.BindLStringToCombobox(_listLotNumber, this.cmbLotNumber); } else { this.cmbLotNumber.DataSource = null; } } else { this.cmbLotNumber.DataSource = null; } } catch (Exception ex) { if (ex.InnerException != null) { MsgBox.DialogError(ex.InnerException.Message.ToString()); } else { if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y")) { // Show error description detail MsgBox.DialogError(ex.GetBaseException().ToString()); } else { // Show message error MsgBox.DialogError(ex.Message.ToString()); } } } }
private void txtLPN_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (string.IsNullOrEmpty(this.txtLPN.Text.Trim())) { MsgBox.DialogWarning("Please scan lpn"); this.txtLPN.Focus(); this.txtLPN.SelectAll(); return; } else { try { var LpnDetailResult = Calbee.WMS.Services.Inventory.InventoryServiceProxy.WS.GetInventorys(Calbee.Infra.Common.Constants.WConstants.wareHouseDDL, string.Empty, string.Empty, this.txtLPN.Text.Trim(), string.Empty, string.Empty); if (LpnDetailResult != null) { if (LpnDetailResult.Count() > 0) { // เอาข้อมูลมาใส่ Gridview Production CreateTableDetailOnGridView(); DataTable dtTempProduction = ConvertObject.ToTable(LpnDetailResult); if (dtTempProduction != null) { if (dtTempProduction.Rows.Count > 0) { //Add to datagrid. DataRow AddAll; foreach (DataRow item in dtTempProduction.Rows) { AddAll = dtDetail.NewRow(); AddAll["Quantity"] = Convert.ToString(item["Quantity"]).Trim(); AddAll["ItemStatus"] = Convert.ToString(item["StatusName"]).Trim(); AddAll["UOM"] = Convert.ToString(item["UOM"]).Trim(); AddAll["ReceiveDate"] = Convert.ToString(item["ReceiveDate"]).Trim(); dtDetail.Rows.Add(AddAll); } dtDetail.TableName = "Detail"; dgvChangeStatusDetail.DataSource = dtDetail; } } this.txtLocation.Text = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().LocationCode) ? string.Empty : LpnDetailResult.FirstOrDefault().LocationCode; this.txtLocation.ReadOnly = true; this.txtItemNumber.Text = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().ItemNumber) ? string.Empty : LpnDetailResult.FirstOrDefault().ItemNumber; this.txtItemNumber.ReadOnly = true; this.txtDescription.Text = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().ItemName) ? string.Empty : LpnDetailResult.FirstOrDefault().ItemName; this.txtDescription.ReadOnly = true; this.txtLotNumber.Text = string.IsNullOrEmpty(LpnDetailResult.FirstOrDefault().LotNumber) ? string.Empty : LpnDetailResult.FirstOrDefault().LotNumber; this.txtLotNumber.ReadOnly = true; if (LpnDetailResult.FirstOrDefault().ExpiryDate != null) { this.dtpExpiryDate.Value = LpnDetailResult.FirstOrDefault().ExpiryDate.Value; } else { this.dtpExpiryDate.Value = AppContext.GetDateTimeServer(); } this.toLpn = LpnDetailResult.FirstOrDefault().Lpn; this.UOM = LpnDetailResult.FirstOrDefault().UOM; this.expiryDateControl = LpnDetailResult.FirstOrDefault().ExpiryDateControl; this.dtpExpiryDate.Enabled = false; this.txtQuantity.Text = LpnDetailResult.FirstOrDefault().Quantity.ToString(); List <string> _listItemStatus = new List <string>(); foreach (var item in LpnDetailResult) { _listItemStatus.Add(item.StatusName); } ComboBoxBinding.BindLStringToCombobox(_listItemStatus, this.cmbItemStatus); this.txtQuantity.Focus(); } } else { MsgBox.DialogWarning("Not found lpn : " + this.txtLPN.Text); this.txtItemNumber.Focus(); this.txtItemNumber.SelectAll(); return; } } catch (Exception ex) { if (ex.InnerException != null) { MsgBox.DialogError(ex.InnerException.Message.ToString()); } else { if (Calbee.Infra.Common.Constants.IConstants.CatchFlag.Equals("Y")) { // Show error description detail MsgBox.DialogError(ex.GetBaseException().ToString()); } else { // Show message error MsgBox.DialogError(ex.Message.ToString()); } } } } } }