using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace SSLMS.MobileUI.uc { public partial class ucMANAGE_MOVE : ucBase { public ucMANAGE_MOVE() { this.InitializeComponent(); this.Init(); } private void Init() { this.cbWAREHOUSE_Bind(); } private void cbWAREHOUSE_Bind() { try { cbWAREHOUSE.ValueMember = "WAREHOUSE_ID"; cbWAREHOUSE.DisplayMember = "WAREHOUSE_NAME"; cbWAREHOUSE.DataSource = this._i_st.WAREHOUSE_GetList(); } catch (Exception ex) { MessageBox.Show("系统异常!\n" + ex.Message); } } private void cbAREA_Bind(string WAREHOUSE_ID) { try { this.cbAREA.ValueMember = "AREA_ID"; this.cbAREA.DisplayMember = "AREA_NAME"; this.cbAREA.DataSource = this._i_st.AREA_GetList(WAREHOUSE_ID); } catch (Exception ex) { MessageBox.Show("系统异常!\n" + ex.Message); } } private void STORAGE_LIST_Bind() { try { string AREA_ID = this.cbAREA.SelectedValue.ToString(); string GOODS = this.txtGOODS.Text.Trim(); string STOCK_BARCODE= this.txtSTOCK_BARCODE.Text.Trim(); this.uclSTORAGE_LIST.listXml = "V_ST_STORAGE_LIST"; this.uclSTORAGE_LIST.listTable = "V_ST_STORAGE_LIST"; string sComon = " AND AREA_ID = {0} AND (STOCK_BARCODE IS NOT NULL OR STOCK_BARCODE<>'') AND STOCK_BARCODE = '{1}'" + string.Format(" AND RUN_STATUS='{0}'", SSLMS.Model.RUN_STATUS.enable.ToString()); this.uclSTORAGE_LIST.listWhere = string.Format(sComon, AREA_ID, STOCK_BARCODE); this.uclSTORAGE_LIST.listWhere += string.IsNullOrEmpty(GOODS) ? string.Empty : string.Format(" AND (GOODS_CODE LIKE '%{0}%' OR GOODS_NAME LIKE '%{0}%' OR GOODS_REMARK LIKE '%{0}%') ", GOODS); this.uclSTORAGE_LIST.colGroup = "GOODS_TYPE_ID"; this.uclSTORAGE_LIST.colSplit = "GOODS_PROPERTY"; this.uclSTORAGE_LIST.bCheck = true; this.uclSTORAGE_LIST.Init(); } catch (Exception ex) { MessageBox.Show("系统异常!\n" + ex.Message); } } private void cbWAREHOUSE_SelectedValueChanged(object sender, EventArgs e) { if (this.cbWAREHOUSE.SelectedValue != null) { string WAREHOUSE_ID = this.cbWAREHOUSE.SelectedValue.ToString(); this.cbAREA_Bind(WAREHOUSE_ID); } } private void cbAREA_SelectedValueChanged(object sender, EventArgs e) { if (null != this.cbAREA.SelectedValue) { this.STORAGE_LIST_Bind(); } } public override void OnRead(object sender, Symbol.Barcode.ReaderData readerData) { if (this.txtGOODS.Focused) { this.txtGOODS.Text = readerData.Text; this.STORAGE_LIST_Bind(); } if (this.txtSTOCK_BARCODE.Focused) { this.txtSTOCK_BARCODE.Text = readerData.Text; this.STORAGE_LIST_Bind(); } if (this.txtCELL.Focused) { this.txtCELL.Text = readerData.Text; } } private void tsbOK_Click(object sender, EventArgs e) { bool bResult = true; string sResult = string.Empty; string[] aSTART_CELL_ID = this.uclSTORAGE_LIST.GetCheckColumns("CELL_ID", new char[] { ',' }).Split(','); if (aSTART_CELL_ID.Length <= 0 || string.IsNullOrEmpty(aSTART_CELL_ID[0])) { MessageBox.Show("请选择要出库的物料!"); return; } if (string.IsNullOrEmpty(this.txtCELL.Text)) { MessageBox.Show("请选择出库站台!"); return; } ST_CELL mST_CELL_END = this._i_st.CELL_GetModel_1(this.txtCELL.Text.Trim()); if (null == mST_CELL_END) { MessageBox.Show("请选择正确的出库站台!"); return; } if (MessageBox.Show("确定移库?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) { return; } int START_CELL_ID = 0; int MANAGE_ID = 0; try { foreach (string sSTART_CELL_ID in aSTART_CELL_ID) { START_CELL_ID = Convert.ToInt32(sSTART_CELL_ID); ST_CELL mST_CELL_START = this._i_st.CELL_GetModel(START_CELL_ID); if (null == mST_CELL_START || !SSLMS.Model.RUN_STATUS.enable.ToString().Equals(mST_CELL_START._run_status)) { continue; } if (!this._i_io.MANAGE_Create_1(this._USER, START_CELL_ID, mST_CELL_END._cell_id, out sResult, out MANAGE_ID)) { continue; } bResult = this._i_io.MANAGE_SendControl(MANAGE_ID, out sResult); } } catch(Exception ex) { MessageBox.Show("系统异常!\n" + ex.Message); } this.STORAGE_LIST_Bind(); } private void txt_KeyDown(object sender, KeyEventArgs e) { if (Keys.Enter != e.KeyCode) { return; } this.STORAGE_LIST_Bind(); } } }