Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!FormMain.srmStatus.Contains("正常"))
            {
                MessageBox.Show(this, "堆垛机状态异常,不允许下发指令!");
                return;
            }
            if (dGVItemQuery.SelectedRows.Count == 0)
            {
                return;
            }
            lsBGate.SelectedIndex = 0;
            if (lsBGate.SelectedItem == null)
            {
                MessageBox.Show(this, "请选择出库口!");
                return;
            }
            using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
            {
                //var st1 = srv.DU_Device_GetOneByDeviceId("ST1");
                //if (!st1.WORKINGSTATUS.Contains("正常"))
                //{
                //    MessageBox.Show(this, "升降机有异常!,禁止发货!");
                //    return;
                //}
            }
            if (dGVItemQuery.SelectedRows[0].Cells[1].Value.ToString().Contains("TEMP"))
            {
                return;
            }
            //if (dGVUnLoadItems.Rows.Count >= 1)
            //    return;
            DataGridViewRow oneContainer = CommonMethod.CloneWithValues(dGVItemQuery.SelectedRows[0]);

            if (dGVUnLoadItems.Rows.Count > 0)
            {
                foreach (DataGridViewRow row in dGVUnLoadItems.Rows)
                {
                    if (row.Cells[1].Value.ToString() == oneContainer.Cells[1].Value.ToString())
                    {
                        return;
                    }
                }
            }
            oneContainer.Cells[6].Value = lsBGate.SelectedItem.ToString();

            dGVUnLoadItems.Rows.Add(oneContainer);
            dGVUnLoadItems.Refresh();
        }