Esempio n. 1
0
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            DataParameter[] paras = new DataParameter[4];
            if (this.btnCheck.Text == "审核")
            {
                paras[0] = new DataParameter("@Checker", Session["EmployeeCode"].ToString());
                paras[1] = new DataParameter("{0}", "getdate()");
                paras[2] = new DataParameter("@State", 1);
            }
            else
            {
                int State = int.Parse(bll.GetFieldValue("WMS_BillMaster", "State", string.Format("BillID='{0}'", this.txtID.Text)));
                if (State > 1)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel, this.txtID.Text + " 单号已经作业,不能进行反审。");
                    return;
                }

                paras[0] = new DataParameter("@Checker", "");
                paras[1] = new DataParameter("{0}", "null");
                paras[2] = new DataParameter("@State", 0);
            }
            paras[3] = new DataParameter("@BillID", this.txtID.Text);

            bll.ExecNonQuery("WMS.UpdateCheckBillMaster", paras);
            AddOperateLog("入库单 ", btnCheck.Text + " " + txtID.Text);

            DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("BillID='{0}'", strID)) });
            BindData(dt);
        }
Esempio n. 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string TaskNo = this.txtTaskNo.Text;

            DataTable dt;
            DataParameter[] param;
            param = new DataParameter[]
            {
                new DataParameter("@CraneNo", this.txtCraneNo.Text),
                new DataParameter("@CarNo", this.txtCarNo.Text)
            };
            if (this.radioButton1.Checked)
            {
                dt = bll.FillDataTable("WCS.sp_GetEmptyCell", param);
                if (dt.Rows.Count > 0)
                    this.txtNewCellCode.Text = dt.Rows[0][0].ToString();
                else
                    this.txtNewCellCode.Text = "";
            }
            else
            {
                this.txtNewCellCode.Text = this.cbRow.Text.Substring(3, 3) + (1000 + int.Parse(this.cbColumn.Text)).ToString().Substring(1, 3) + (1000 + int.Parse(this.cbHeight.Text)).ToString().Substring(1, 3);
            }

            //判断货位是否空闲,且只有空托盘
            param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='' and IsActive='1' and IsLock='0' and ErrorFlag!='1'",this.txtNewCellCode.Text))
            };
            dt = bll.FillDataTable("CMD.SelectCell", param);
            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("此货位非空货位,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            param = new DataParameter[]
            {
                new DataParameter("@TaskNo", TaskNo),
                new DataParameter("@NewCellCode", this.txtNewCellCode.Text),
                new DataParameter("@IsTarget", "0")
            };

            bll.ExecNonQuery("WCS.Sp_UpdateTaskCellCode", param);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 3
0
        public DataTable GetUserList(int pageIndex, int pageSize, string filter, string OrderByFields)
        {
            DataParameter[] param = new DataParameter[] {
            new DataParameter("@tbname",strTableView),
            new DataParameter("@FieldKey",strPrimaryKey),
               new DataParameter("@PageCurrent",pageIndex),
               new DataParameter("@pageSize",pageSize),
            new DataParameter("@FieldShow",strQueryFields),
               new DataParameter("@Where",filter),
               new DataParameter("@FieldOrder",OrderByFields),
               new DataParameter("@PageCount",0),
               new DataParameter("@RecordCount",0),
               };

            DataTable dtResult = da.FillDataTable("Security.SpDataQuery", param);
            return dtResult;
        }
Esempio n. 4
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            DataTable dt;
            DataParameter[] param;
            param = new DataParameter[]
            {
                new DataParameter("@CraneNo", this.cmbCraneNo.Text),
                new DataParameter("@CarNo", this.cmbCarNo.Text)
            };

            if (this.radioButton1.Checked)
            {
                dt = bll.FillDataTable("WCS.sp_GetPalletCell", param);
                if (dt.Rows.Count > 0)
                    this.txtCellCode.Text = dt.Rows[0][0].ToString();
                else
                    this.txtCellCode.Text = "";
            }
            else
            {
                this.txtCellCode.Text = this.cbRow.Text.Substring(3, 3) + (1000 + int.Parse(this.cbColumn.Text)).ToString().Substring(1, 3) + (1000 + int.Parse(this.cbHeight.Text)).ToString().Substring(1, 3);
            }
            string ProductCode = "00" + this.cmbCraneNo.Text;

            //判断货位是否空闲,且只有空托盘
            param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ProductCode='{0}' and IsActive='1' and IsLock='0' and CellCode='{1}'", ProductCode,this.txtCellCode.Text))
            };
            dt = bll.FillDataTable("CMD.SelectCell", param);
            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("自动获取或指定的货位非空托盘,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //锁定货位
            param = new DataParameter[]
            {
                new DataParameter("@CarNo", this.cmbCarNo.Text),
                new DataParameter("@CraneNo", this.cmbCraneNo.Text),
                new DataParameter("@CellCode", this.txtCellCode.Text)
            };
            bll.ExecNonQueryTran("WCS.Sp_CreatePalletOutTask2", param);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 5
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            //object obj = ObjectUtil.GetObject(stateItem.State);
            //if (obj == null)
            //    return;

            switch (stateItem.ItemName)
            {
                case "CraneTaskFinished":
                    object obj = ObjectUtil.GetObject(stateItem.State);
                    if (obj.ToString() == "50")
                    {

                        string TaskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(Context.ProcessDispatcher.WriteToService(stateItem.Name, "CraneTaskNo")));
                        //存储过程处理
                        Logger.Info(stateItem.ItemName + "完成标志,任务号:" + TaskNo);
                        //更新任务状态
                        DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo)};
                        bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);

                        WriteToService(stateItem.Name, "ReplyFinished", 49);
                    }
                    break;
                case "Run":
                    blRun = (int)stateItem.State == 1;
                    break;
                default:
                    break;
            }
            if (blRun)
            {
                tmWorkTimer.Start();
                Logger.Info("堆垛机联机");
            }
            else
            {
                tmWorkTimer.Stop();
                Logger.Info("堆垛机脱机");
            }

            return;
        }
Esempio n. 6
0
 private void toolStripButton_Cancel_Click(object sender, EventArgs e)
 {
     if (this.dgvMain.CurrentRow.Index >= 0)
     {
         if (this.dgvMain.SelectedRows[0].Cells["colState"].Value.ToString() == "等待")
         {
             if (DialogResult.Yes == MessageBox.Show("您确定要取消此任务吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
             {
                 string TaskNo = this.dgvMain.SelectedRows[0].Cells["colTaskNo"].Value.ToString();
                 DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                 bll.ExecNonQueryTran("WCS.Sp_TaskCancelProcess", param);
                 this.BindData();
             }
         }
         else
         {
             MessageBox.Show("选中的状态非[等待],请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
     }
 }
Esempio n. 7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.dgvMain.CurrentRow == null)
                return;

            if (this.dgvMain.CurrentRow.Index == -1)
            {
                MessageBox.Show("请选择货位", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string CellCode = this.dgvMain.Rows[this.dgvMain.CurrentRow.Index].Cells[0].Value.ToString();
            string TaskNo = this.txtTaskNo.Text;

            DataParameter[] param;
            param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='{1}' and IsActive='1' and IsLock='0' and ErrorFlag!='1'",CellCode,this.txtProductCode.Text))
            };
            DataTable dt = bll.FillDataTable("CMD.SelectCell", param);
            if (dt.Rows.Count <= 0)
            {
                MessageBox.Show("此货位非指定出库产品货位,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            param = new DataParameter[]
            {
                new DataParameter("@TaskNo", TaskNo),
                new DataParameter("@NewCellCode", CellCode),
                new DataParameter("@IsTarget", "1")
            };

            bll.ExecNonQuery("WCS.Sp_UpdateTaskCellCode", param);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 8
0
        public int ExecTran(string[] commandIDs, string PrimaryKey, DataTable[] dtSub)
        {
            List<string> Comd = new List<string>();

            List<DataParameter[]> paras = new List<DataParameter[]>();

            int InsertID = 0;
            for (int i = 0; i < dtSub.Length; i++)
            {
                string[] SubKey = PrimaryKey.Split(',');
                string strFormater = "";
                for (int j = 0; j < SubKey.Length; j++)
                {
                    if (j == SubKey.Length - 1)
                        strFormater += (SubKey[j] + "='{" + j + "}'");
                    else
                        strFormater += (SubKey[j] + "='{" + j + "}' and ");
                }

                object[] args = new object[SubKey.Length];
                for (int K = 0; K < SubKey.Length; K++)
                {
                    if (dtSub[i].Rows.Count > 0)
                        args[K] = dtSub[i].Rows[0][SubKey[K]];
                }
                DataParameter[] delPara = new DataParameter[] { new DataParameter("{0}", string.Format(strFormater, args)) };
                Comd.Insert(InsertID, commandIDs[i * 2 ]);

                paras.Insert(InsertID, delPara);

                InsertID++;

                for (int j = 0; j < dtSub[i].Rows.Count; j++)
                {
                    DataParameter[] AddPara = new DataParameter[dtSub[i].Columns.Count];

                    for (int K = 0; K < dtSub[i].Columns.Count; K++)
                    {
                        AddPara[K] = new DataParameter("@" + dtSub[i].Columns[K].ColumnName, dtSub[i].Rows[j][K]);
                    }

                    Comd.Insert(InsertID, commandIDs[i * 2 + 1]);
                    paras.Insert(InsertID, AddPara);

                    InsertID++;
                }

            }
            return ExecTran(Comd.ToArray(), paras);
        }
Esempio n. 9
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            DataTable dt;
            DataParameter[] param;

            param = new DataParameter[]
            {
                new DataParameter("@CraneNo", this.txtCraneNo.Text),
                new DataParameter("@CarNo", this.cmbCarNo.Text),
                new DataParameter("@AreaCode", this.txtAreaCode.Text)
            };
            string ProductCode = "00" + this.txtCraneNo.Text;

            if (this.radioButton4.Checked)
            {
                if (this.radioButton1.Checked)
                {
                    dt = bll.FillDataTable("WCS.sp_GetCell", param);
                    if (dt.Rows.Count > 0)
                        this.txtCellCode.Text = dt.Rows[0][0].ToString();
                    else
                        this.txtCellCode.Text = "";
                }
                else
                {
                    this.txtCellCode.Text = this.cbRow.Text.Substring(3, 3) + (1000 + int.Parse(this.cbColumn.Text)).ToString().Substring(1, 3) + (1000 + int.Parse(this.cbHeight.Text)).ToString().Substring(1, 3);
                }

                //判断货位是否空闲,且只有空托盘
                param = new DataParameter[]
                {
                    new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='{1}' and IsActive='1' and IsLock='0' and AreaCode='{2}'", this.txtCellCode.Text,ProductCode,this.txtAreaCode.Text))
                };
                dt = bll.FillDataTable("CMD.SelectCell", param);
                if (dt.Rows.Count <= 0)
                {
                    MessageBox.Show("自动获取的货位或指定的货位无空托盘或非指定库区的货位,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //锁定货位
                param = new DataParameter[]
                {
                    new DataParameter("@CarNo", this.cmbCarNo.Text),
                    new DataParameter("@CraneNo", this.txtCraneNo.Text),
                    new DataParameter("@CellCode", this.txtCellCode.Text),
                    new DataParameter("@BillID", this.txtBillID.Text),
                    new DataParameter("@TaskNo", this.txtTaskNo.Text),
                    new DataParameter("@ProductCode", this.txtProductCode.Text),
                };
                bll.ExecNonQueryTran("WCS.Sp_CreatePalletOutTask", param);
            }
            else if(this.radioButton3.Checked)
            {
                //自带托盘的处理
                dt = bll.FillDataTable("WCS.sp_GetEmptyCellWithPallet", param);
                if (dt.Rows.Count > 0)
                    this.txtCellCode.Text = dt.Rows[0][0].ToString();
                else
                    this.txtCellCode.Text = "";

                //判断货位是否空闲,且只有空托盘
                param = new DataParameter[]
                {
                    new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='' and IsActive='1' and IsLock='0'", this.txtCellCode.Text))
                };
                dt = bll.FillDataTable("CMD.SelectCell", param);
                if (dt.Rows.Count <= 0)
                {
                    MessageBox.Show("自动获取的货位或指定的货位非空货位,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    //锁定货位
                    param = new DataParameter[]
                    {
                        new DataParameter("@TaskNo", this.txtTaskNo.Text),
                        new DataParameter("@CarNo", this.cmbCarNo.Text),
                        new DataParameter("@CellCode", this.txtCellCode.Text)
                    };
                    bll.ExecNonQueryTran("WCS.Sp_CreateProductInTask", param);
                }
            }
            else if (this.radioButton5.Checked)
            {
                //用出库的空托盘位
                dt = bll.FillDataTable("WCS.sp_GetOutStockCell", param);
                if (dt.Rows.Count > 0)
                    this.txtCellCode.Text = dt.Rows[0][0].ToString();
                else
                    this.txtCellCode.Text = "";

                //判断货位是否空闲,且只有空托盘
                param = new DataParameter[]
                {
                    new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='{1}' and IsActive='1' and IsLock='1'", this.txtCellCode.Text,ProductCode))
                };
                dt = bll.FillDataTable("CMD.SelectCell", param);
                if (dt.Rows.Count <= 0)
                {
                    MessageBox.Show("获取出库的空托盘货位异常,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    //锁定货位
                    param = new DataParameter[]
                    {
                        new DataParameter("@TaskNo", this.txtTaskNo.Text),
                        new DataParameter("@CarNo", this.cmbCarNo.Text),
                        new DataParameter("@CellCode", this.txtCellCode.Text)
                    };
                    bll.ExecNonQueryTran("WCS.Sp_CreateProductInTask", param);
                }
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Esempio n. 10
0
 private void cmbCar_SelectedIndexChanged(object sender, EventArgs e)
 {
     DataParameter[] param = new DataParameter[]
     {
         new DataParameter("{0}", string.Format("CraneNo='{0}' and AreaCode='{1}'", CraneNo,this.txtAreaCode.Text))
     };
     DataTable dt = bll.FillDataTable("CMD.SelectCellShelf", param);
     this.cbRow.DataSource = dt.DefaultView;
     this.cbRow.ValueMember = "shelfcode";
     this.cbRow.DisplayMember = "shelfcode";
 }
Esempio n. 11
0
        private void cbRow_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cbRow.Text == "System.Data.DataRowView")
                return;

            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ShelfCode='{0}' and AreaCode='{1}'",this.cbRow.Text,this.txtAreaCode.Text))
            };
            DataTable dt = bll.FillDataTable("CMD.SelectColumn", param);

            this.cbColumn.DataSource = dt.DefaultView;
            this.cbColumn.ValueMember = "CellColumn";
            this.cbColumn.DisplayMember = "CellColumn";
        }
Esempio n. 12
0
        private void UpdatedgvMainState(string State)
        {
            if (this.dgvMain.CurrentCell != null)
            {
                BLL.BLLBase bll = new BLL.BLLBase();
                string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString();
                bll.ExecNonQuery("WCS.UpdateTaskStateByTaskNo", new DataParameter[] { new DataParameter("@State", State), new DataParameter("@TaskNo", TaskNo) });

                //堆垛机完成执行
                if (State == "7")
                {
                    DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                    bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
                }
                BindData();
            }
        }
Esempio n. 13
0
        private void cbFromColumn_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cbFromRow.Text == "System.Data.DataRowView")
                return;
            if (this.cbFromColumn.Text == "System.Data.DataRowView")
                return;

            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ShelfCode='{0}' and CellColumn={1}",this.cbFromRow.Text,this.cbFromColumn.Text))
            };

            if (this.cmbTaskType.SelectedIndex == 0)
            {
                DataTable dt = new DataTable("dt");
                dt.Columns.Add("dtText");
                dt.Columns.Add("dtValue");
                DataRow dr = dt.NewRow();
                dr["dtText"] = "1";
                dr["dtValue"] = "1";
                dt.Rows.Add(dr);
                this.cbFromHeight.DataSource = dt;
                this.cbFromHeight.DisplayMember = "dtText";
                this.cbFromHeight.ValueMember = "dtValue";
            }
            else
            {
                DataTable dt = bll.FillDataTable("CMD.SelectCell", param);
                DataView dv = dt.DefaultView;
                dv.Sort = "CellRow";
                this.cbFromHeight.DataSource = dv;
                this.cbFromHeight.ValueMember = "CellRow";
                this.cbFromHeight.DisplayMember = "CellRow";
            }
        }
Esempio n. 14
0
        private void cbColumn_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cbRow.Text == "System.Data.DataRowView")
                return;
            if (this.cbColumn.Text == "System.Data.DataRowView")
                return;

            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ShelfCode='{0}' and CellColumn={1}",this.cbRow.Text,this.cbColumn.Text))
            };
            DataTable dt = bll.FillDataTable("CMD.SelectCell", param);
            DataView dv = dt.DefaultView;
            dv.Sort = "CellRow";
            this.cbHeight.DataSource = dv;
            this.cbHeight.ValueMember = "CellRow";
            this.cbHeight.DisplayMember = "CellRow";
        }
Esempio n. 15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UpdateTempSub(this.dgViewSub1);
            string[] Commands = new string[3];
            DataParameter[] para;

            if (strID == "") //新增
            {
                int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim()));
                if (Count > 0)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该入库单已经存在!");
                    return;
                }
                para = new DataParameter[] {
                                             new DataParameter("@BillID", this.txtID.Text.Trim()),
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@BillTypeCode",this.ddlBillTypeCode.SelectedValue),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@FactoryID",this.ddlFactoryID.SelectedValue),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Creator", Session["EmployeeCode"].ToString()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString())

                                              };
                Commands[0] = "WMS.InsertInStockBill";

            }
            else //修改
            {
                para = new DataParameter[] {
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@BillTypeCode",this.ddlBillTypeCode.SelectedValue),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@FactoryID",this.ddlFactoryID.SelectedValue),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString()),
                                             new DataParameter("{0}",string.Format("BillID='{0}'", this.txtID.Text.Trim())) };
                Commands[0] = "WMS.UpdateInStock";
            }
            try
            {
                DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"];
                Commands[1] = "WMS.DeleteBillDetail";
                Commands[2] = "WMS.InsertInStockDetail";
                bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt });
            }
            catch (Exception ex)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message);
                return;
            }

            Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text));
        }
Esempio n. 16
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("您确定要对货位" + this.txtCellCode.Text + "修改吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                DataParameter[] param;
                if (this.radioButton1.Checked)
                {
                    param = new DataParameter[] { new DataParameter("{0}", "IsLock='0'"), new DataParameter("{1}", string.Format("CellCode='{0}'", this.txtCellCode.Text)) };
                    bll.ExecNonQuery("WCS.UpdateCellByFilter", param);
                }
                else if (this.radioButton2.Checked)
                {
                    param = new DataParameter[] { new DataParameter("{0}", "IsLock='0',ProductCode='',PalletCode='',Quantity=0,InDate=NULL,BillNo=''"), new DataParameter("{1}", string.Format("CellCode='{0}'", this.txtCellCode.Text)) };
                    bll.ExecNonQuery("WCS.UpdateCellByFilter", param);
                }
                else if (this.radioButton3.Checked)
                {
                    param = new DataParameter[] { new DataParameter("{0}", "ErrorFlag=''"), new DataParameter("{1}", string.Format("CellCode='{0}'", this.txtCellCode.Text)) };
                    bll.ExecNonQuery("WCS.UpdateCellByFilter", param);
                }
                else if (this.radioButton4.Checked)
                {
                    param = new DataParameter[] { new DataParameter("{0}", "ErrorFlag='',ProductCode='',PalletCode='',Quantity=0,InDate=NULL,BillNo=''"), new DataParameter("{1}", string.Format("CellCode='{0}'", this.txtCellCode.Text)) };
                    bll.ExecNonQuery("WCS.UpdateCellByFilter", param);
                }
                else if (this.radioButton6.Checked)
                {
                    bll.ExecNonQuery("WCS.UpdateCellByTaskNo", new DataParameter[] { new DataParameter("@TaskNo", this.txtTaskNo.Text) });

                }
                else if (this.radioButton5.Checked)
                {
                    string IsLock = this.checkBox1.Checked ? "1" : "0";
                    string IsActive = this.checkBox2.Checked ? "0" : "1";
                    string ErrorFlag = this.checkBox3.Checked ? "1" : "0";

                    string sql = string.Format("IsLock='{0}'", IsLock);
                    sql += string.Format(",IsActive='{0}'", IsActive);
                    sql += string.Format(",ErrorFlag='{0}'", ErrorFlag);

                    //if (this.txtProductCode.Text.Trim().Length > 0)
                        sql += string.Format(",ProductCode='{0}'", this.txtProductCode.Text.Trim());

                        sql += string.Format(",StateNo='{0}'", this.txtStateNo.Text.Trim());
                    //if (this.txtPalletCode.Text.Trim().Length > 0)
                        sql += string.Format(",PalletCode='{0}'", this.txtPalletCode.Text.Trim());

                    //if (this.txtBillNo.Text.Trim().Length > 0)
                        sql += string.Format(",BillNo='{0}'", this.txtBillNo.Text.Trim());

                    if (this.dtpInDate.Checked)
                        sql += string.Format(",InDate='{0}'", this.dtpInDate.Value);

                    param = new DataParameter[] { new DataParameter("{0}", sql), new DataParameter("{1}", string.Format("CellCode='{0}'", this.txtCellCode.Text)) };
                    bll.ExecNonQuery("WCS.UpdateCellByFilter", param);

                    //更改入库类型
                    if (this.cmbInStockType.SelectedValue != null)
                    {
                        if (BillTypeCode != this.cmbInStockType.SelectedValue.ToString())
                        {
                            //更新入库类型
                            param = new DataParameter[]
                        {
                            new DataParameter("@BillID", this.txtBillNo.Text),
                            new DataParameter("@BillTypeCode", this.cmbInStockType.SelectedValue.ToString())
                        };
                            bll.ExecNonQueryTran("WCS.Sp_UpdateBillTypeCode", param);
                        }
                    }
                }

            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 17
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtCELLID.Text.Trim().Length == 0)//新增
                {
                    int count = bll.GetRowCount("CMD_WH_CELL", string.Format("CellCode='{0}'", this.txtCellCode.Text));
                    if (count > 0)
                    {
                        WMS.App_Code.JScript.Instance.ShowMessage(this, "此货位编码已存在,不能新增!");
                        return;
                    }
                    string comds = "Cmd.InsertCell";

                    DataParameter[] paras = new DataParameter[] {    new DataParameter("@CellCode", this.txtCellCode.Text),
                                                       new DataParameter("@CellName", this.txtCellName.Text.Trim().Replace("\'", "\''")),
                                                       new DataParameter("@AreaCode",  this.txtAreaID.Text),
                                                       new DataParameter("@ShelfCode", this.txtShelfID.Text.Trim()),
                                                       new DataParameter("@CellRow",  this.txtCellRows.Text),
                                                       new DataParameter("@CellColumn", this.txtCellCols.Text.Trim()),
                                                       new DataParameter("@IsActive",   this.ddlActive.SelectedValue),
                                                       new DataParameter("@IsLock", this.ddlLock.SelectedValue),
                                                       new DataParameter("@Memo",  this.txtMemo.Text)};

                    bll.ExecNonQuery(comds, paras);

                    this.btnSave.Enabled = false;

                    WMS.App_Code.JScript.Instance.RegisterScript(this, "ReloadParent();");
                    AddOperateLog("货位管理", "添加货位信息");
                }
                else//修改
                {
                    string strWhere = "";

                    if (this.rpt1.Checked)
                    {
                        strWhere = string.Format("CellCode='{0}'", this.txtCELLID.Text);
                    }
                    else if (this.rpt2.Checked)
                    {
                        strWhere = string.Format("CellRow={0} and AreaCode='{1}' and ShelfCode='{2}' and ProductCode not in ('0001','0002')", this.txtCellRows.Text, this.txtAreaID.Text, this.txtShelfID.Text);
                        int count = bll.GetRowCount("Cmd_Cell", string.Format("CellRow={0} and AreaCode='{1}' and ShelfCode='{2}' and ProductCode not in ('0001','0002') and ProductCode!=''", this.txtCellRows.Text, this.txtAreaID.Text, this.txtShelfID.Text));
                        if (count > 0)
                        {
                            WMS.App_Code.JScript.Instance.ShowMessage(this, "货位所在货架层的所有货位中有存放产品的货位,无法整层修改!");
                            return;
                        }

                    }
                    else
                    {
                        strWhere = string.Format("CellColumn={0} and AreaCode='{1}' and ShelfCode='{2}' and ProductCode not in ('0001','0002')", this.txtCellCols.Text, this.txtAreaID.Text, this.txtShelfID.Text);
                        int count = bll.GetRowCount("Cmd_Cell", string.Format("CellColumn={0} and AreaCode='{1}' and ShelfCode='{2}' and ProductCode not in ('0001','0002') and ProductCode!=''", this.txtCellCols.Text, this.txtAreaID.Text, this.txtShelfID.Text));
                        if (count > 0)
                        {
                            WMS.App_Code.JScript.Instance.ShowMessage(this, "货位所在货架列的所有货位中有存放产品的货位,无法整列修改!");
                            return;
                        }
                    }

                    bll.ExecNonQuery("Cmd.UpdateCell", new DataParameter[] {
                                                                             new DataParameter("@AreaCode",  this.ddlAreaCode.SelectedValue),
                                                                             new DataParameter("@IsActive",   this.ddlActive.SelectedValue),
                                                                             new DataParameter("@MEMO",  this.txtMemo.Text),
                                                                             new DataParameter("{0}",strWhere)});

                    WMS.App_Code.JScript.Instance.RegisterScript(this, "UpdateParent();");
                    AddOperateLog("货位管理", "修改货位信息");
                }

            }
            catch (Exception exp)
            {
               WMS.App_Code.JScript.Instance.ShowMessage(this, exp.Message);
            }
        }
Esempio n. 18
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string ItemName = ((ToolStripMenuItem)sender).Name;
            string State = ItemName.Substring(ItemName.Length-1, 1);

            if (this.dgvMain.CurrentCell != null)
            {
                BLL.BLLBase bll = new BLL.BLLBase();
                string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString();

                DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) };
                bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);

                //bll.ExecNonQuery("WCS.UpdateTaskStateByTaskNo", new DataParameter[] { new DataParameter("@State", State), new DataParameter("@TaskNo", TaskNo) });

                ////堆垛机完成执行
                //if (State == "7")
                //{
                //    DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                //    bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
                //}
                BindData();
            }
        }
Esempio n. 19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UpdateTempSub(this.dgViewSub1);
            string[] Commands = new string[3];
            DataParameter[] para;

            //判断库存
            DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"];

            DataTable dtProduct = dt.DefaultView.ToTable("Product", true, new string[] { "ProductCode", "ProductName" });

            for (int i = 0; i < dtProduct.Rows.Count; i++)
            {
                object o = dt.Compute("Sum(Quantity)", string.Format("ProductCode='{0}'", dtProduct.Rows[i]["ProductCode"]));
                if (o != null)
                {
                    int Qty = int.Parse(o.ToString());

                    DataTable dtProductQty = bll.FillDataTable("WMS.SelectProductQty", new DataParameter[] { new DataParameter("@BillID", this.txtID.Text), new DataParameter("@ProductCode", dtProduct.Rows[i]["ProductCode"].ToString()) });
                    int StockQty = 0;
                    bool blnvalue = false;
                    if (dtProductQty.Rows.Count == 0)
                    {
                        blnvalue = true;
                    }
                    else
                    {
                        StockQty = int.Parse(dtProductQty.Rows[0]["StockQty"].ToString());
                        if (Qty > StockQty)
                            blnvalue = true;
                    }
                    if (blnvalue)
                    {

                        WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, dtProduct.Rows[i]["ProductName"].ToString() + "现有库存数量为:" + StockQty.ToString() + ", 库存不足,请修改出库数量。");
                        return;

                    }
                }

            }
            if (strID == "") //新增
            {
                int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim()));
                if (Count > 0)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该出库单已经存在!");
                    return;
                }
                para = new DataParameter[] {
                                             new DataParameter("@BillID", this.txtID.Text.Trim()),
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@BillTypeCode",this.ddlBillTypeCode.SelectedValue),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@TrainTypeCode",this.ddlTrainTypeCode.SelectedValue),
                                             new DataParameter("@TrainNo",this.txtTrainNo.Text),
                                             new DataParameter("@AxieLocation",this.txtAxieLocation.Text),
                                             new DataParameter("@Xc",this.txtXc.Text),
                                             new DataParameter("@Ccnz",this.txtCcnz.Text),
                                             new DataParameter("@Ccwz",this.txtCcwz.Text),
                                             new DataParameter("@Fccnz",this.txtFccnz.Text),
                                             new DataParameter("@Fccwz",this.txtFccwz.Text),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Creator", Session["EmployeeCode"].ToString()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString())

                                              };
                Commands[0] = "WMS.InsertOutStockBill";

            }
            else //修改
            {
                para = new DataParameter[] {
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                              new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@BillTypeCode",this.ddlBillTypeCode.SelectedValue),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@TrainTypeCode",this.ddlTrainTypeCode.SelectedValue),
                                             new DataParameter("@TrainNo",this.txtTrainNo.Text),
                                             new DataParameter("@AxieLocation",this.txtAxieLocation.Text),
                                             new DataParameter("@Xc",this.txtXc.Text),
                                             new DataParameter("@Ccnz",this.txtCcnz.Text),
                                             new DataParameter("@Ccwz",this.txtCcwz.Text),
                                             new DataParameter("@Fccnz",this.txtFccnz.Text),
                                             new DataParameter("@Fccwz",this.txtFccwz.Text),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString()),
                                             new DataParameter("{0}",string.Format("BillID='{0}'", this.txtID.Text.Trim())) };
                Commands[0] = "WMS.UpdateOutStock";
            }
            try
            {
                Commands[1] = "WMS.DeleteBillDetail";
                Commands[2] = "WMS.InsertInStockDetail";
                bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt });
            }
            catch (Exception ex)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message);
                return;
            }

            Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text));
        }
Esempio n. 20
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            UpdateTempSub(this.dgViewSub1);
            string[] Commands = new string[3];
            DataParameter[] para;
            if (strID == "") //新增
            {
                int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim()));
                if (Count > 0)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该移库库单已经存在!");
                    return;
                }
                para = new DataParameter[] {
                                             new DataParameter("@BillID", this.txtID.Text.Trim()),
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@BillTypeCode","030"),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Creator", Session["EmployeeCode"].ToString()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString())

                                              };
                Commands[0] = "WMS.InsertMoveStockBill";

            }
            else //修改
            {
                para = new DataParameter[] {
                                             new DataParameter("@BillDate", this.txtBillDate.DateValue),
                                             new DataParameter("@AreaCode",this.ddlAreaCode.SelectedValue),
                                             new DataParameter("@Memo", this.txtMemo.Text.Trim()),
                                             new DataParameter("@Updater", Session["EmployeeCode"].ToString()),
                                             new DataParameter("{0}",string.Format("BillID='{0}'", this.txtID.Text.Trim())) };
                Commands[0] = "WMS.UpdateMoveStock";
            }
            DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"];
            //判断货位是否被其他单据锁定
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int count = 0;
                count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["CellCode"]));
                if (count > 0)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["CellCode"].ToString() + "已经被其它单据锁定,不能移库!");
                    return;
                }
                count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["NewCellCode"]));
                if (count > 0)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["NewCellCode"].ToString() + "已经被其它单据锁定,不能移库!");
                    return;
                }
            }
            try
            {

                Commands[1] = "WMS.DeleteBillDetail";
                Commands[2] = "WMS.InsertMoveStockDetail";
                bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt });

            }
            catch (Exception ex)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message);
                return;
            }

            Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text));
        }
Esempio n. 21
0
        private void cbToRow_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.cbToRow.Text == "System.Data.DataRowView")
                return;

            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ShelfCode='{0}'",this.cbToRow.Text))
            };

            if (this.cmbTaskType.SelectedIndex == 1)
            {
                DataTable dt = new DataTable("dt");
                dt.Columns.Add("dtText");
                dt.Columns.Add("dtValue");
                DataRow dr = dt.NewRow();

                if (this.cbToRow.Text == "001005")
                {
                    dr["dtText"] = "12";
                    dr["dtValue"] = "12";
                }
                else
                {
                    dr["dtText"] = "1";
                    dr["dtValue"] = "1";
                }

                dt.Rows.Add(dr);
                this.cbToColumn.DataSource = dt;
                this.cbToColumn.DisplayMember = "dtText";
                this.cbToColumn.ValueMember = "dtValue";
            }
            else
            {
                DataTable dt = bll.FillDataTable("CMD.SelectColumn", param);

                this.cbToColumn.DataSource = dt.DefaultView;
                this.cbToColumn.ValueMember = "CellColumn";
                this.cbToColumn.DisplayMember = "CellColumn";
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="craneNo"></param>
        private void CraneOut(int craneNo)
        {
            // 判断堆垛机的状态 自动  空闲
            //Logger.Debug("判断堆垛机" + piCrnNo.ToString() + "能否出库");
            try
            {
                //判断堆垛机
                if (!Check_Crane_Status_IsOk(craneNo))
                {
                    //Logger.Info("堆垛机状态不符合出库");
                    return;
                }
                //切换入库优先
                dCrnStatus[craneNo].io_flag = 1;
            }
            catch (Exception e)
            {
                Logger.Debug("Crane out 状态检查错误:" + e.Message.ToString());
                return;
            }

            string serviceName = "CranePLC" + craneNo;

            int[] craneInfo = new int[6];
            object[] obj = ObjectUtil.GetObjects(WriteToService(serviceName, "CraneInfo"));
            for (int j = 0; j < obj.Length; j++)
                craneInfo[j] = Convert.ToInt16(obj[j]) - 48;

            obj = ObjectUtil.GetObjects(Context.ProcessDispatcher.WriteToService(serviceName, "CraneTaskNo"));
            string plcTaskNo = Util.ConvertStringChar.BytesToString(obj);

            string CraneNo = "0" + craneNo.ToString();
            //获取任务,排序优先等级、任务时间
            DataParameter[] parameter = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_Task.TaskType in ('12','13','14') and WCS_Task.State='0' and WCS_Task.CraneNo='{0}'",CraneNo)) };
            DataTable dt = bll.FillDataTable("WCS.SelectTask", parameter);

            //出库
            if (dt.Rows.Count>0)
            {
                DataRow dr = dt.Rows[0];
                string carNo = dr["CarNo"].ToString();
                string TaskNo = dr["TaskNo"].ToString();
                string BillID = dr["BillID"].ToString();
                byte taskType = byte.Parse(dt.Rows[0]["TaskType"].ToString().Substring(1, 1));

                string fromStation = dt.Rows[0]["FromStation"].ToString();
                string toStation = dt.Rows[0]["ToStation"].ToString();
                //string fromStation = dt.Rows[0]["StationNo"].ToString();
                //string toStation = dt.Rows[0]["CellCode"].ToString();

                if (taskType != 3 || craneInfo[4] != 6)
                {
                    //判断小车,出库小车必须待机+空载
                    if (!Check_Car_Out_Status_IsOk(carNo))
                    {
                        Logger.Info("小车状态不符合堆垛机出库");
                        return;
                    }
                }

                if (plcTaskNo != "0000000000" && TaskNo != plcTaskNo.Trim())
                    return;

                //if (taskType == 2)
                //{
                //    fromStation = dt.Rows[0]["CellCode"].ToString();
                //    toStation = dt.Rows[0]["StationNo"].ToString();
                //}
                //else if (taskType == 3)
                //{
                //    fromStation = dt.Rows[0]["CellCode"].ToString();
                //    toStation = dt.Rows[0]["ToCellCode"].ToString();
                //}
                //else if (taskType == 4)
                //{
                //    fromStation = dt.Rows[0]["CellCode"].ToString();
                //    toStation = dt.Rows[0]["StationNo"].ToString();
                //}

                byte[] cellAddr = new byte[8];

                cellAddr[0] = taskType;
                cellAddr[1] = 0;  //0-不允许伸叉,1-允许伸叉
                cellAddr[2] = byte.Parse(fromStation.Substring(0, 3));
                cellAddr[3] = byte.Parse(fromStation.Substring(3, 3));
                cellAddr[4] = byte.Parse(fromStation.Substring(6, 3));
                cellAddr[5] = byte.Parse(toStation.Substring(0, 3));
                cellAddr[6] = byte.Parse(toStation.Substring(3, 3));
                cellAddr[7] = byte.Parse(toStation.Substring(6, 3));

                for (int i = 0; i < cellAddr.Length; i++)
                    cellAddr[i] += 48;

                sbyte[] palletBarcode = new sbyte[8];
                Util.ConvertStringChar.stringToBytes(dr["PalletCode"].ToString(), 8).CopyTo(palletBarcode, 0);

                sbyte[] taskNo = new sbyte[10];
                Util.ConvertStringChar.stringToBytes(dr["TaskNo"].ToString(), 10).CopyTo(taskNo, 0);

                WriteToService(serviceName, "TaskAddress", cellAddr);
                WriteToService(serviceName, "PalletCode", palletBarcode);
                WriteToService(serviceName, "TaskNo", taskNo);
                WriteToService(serviceName, "ProductType", 49);
                if (WriteToService(serviceName, "WriteFinished", 49))
                {
                    //更新任务状态为执行中
                    bll.ExecNonQuery("WCS.UpdateTaskTimeByTaskNo", new DataParameter[] { new DataParameter("@State", 3), new DataParameter("@TaskNo", TaskNo) });
                    bll.ExecNonQuery("WCS.UpdateBillStateByBillID", new DataParameter[] { new DataParameter("@State", 3), new DataParameter("@BillID", BillID) });
                }
                Logger.Info("任务:" + dr["TaskNo"].ToString() + "已下发给" + craneNo + "堆垛机;起始地址:" + fromStation + ",目标地址:" + toStation);
            }
        }
Esempio n. 23
0
        private void BindShelf()
        {
            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("CraneNo='{0}'", this.cmbCraneNo.Text))
            };
            if (this.cmbTaskType.SelectedIndex == 0)
            {
                DataTable dt = new DataTable("dt");
                dt.Columns.Add("dtText");
                dt.Columns.Add("dtValue");
                DataRow dr = dt.NewRow();
                if (this.cmbCarNo.Text == "01")
                {
                    dr["dtText"] = "001002";
                    dr["dtValue"] = "001002";
                }
                else if (this.cmbCarNo.Text == "02")
                {
                    dr["dtText"] = "001004";
                    dr["dtValue"] = "001004";
                }
                else
                {
                    dr["dtText"] = "001005";
                    dr["dtValue"] = "001005";
                }
                dt.Rows.Add(dr);
                this.cbFromRow.DataSource = dt;
                this.cbFromRow.DisplayMember = "dtText";
                this.cbFromRow.ValueMember = "dtValue";
            }
            else
            {
                DataTable dt = bll.FillDataTable("CMD.SelectShelf", param);
                this.cbFromRow.DataSource = dt.DefaultView;
                this.cbFromRow.ValueMember = "shelfcode";
                this.cbFromRow.DisplayMember = "shelfcode";
            }

            if (this.cmbTaskType.SelectedIndex == 1)
            {
                DataTable dt = new DataTable("dt");
                dt.Columns.Add("dtText");
                dt.Columns.Add("dtValue");
                DataRow dr = dt.NewRow();
                if (this.cmbCarNo.Text == "01")
                {
                    dr["dtText"] = "001002";
                    dr["dtValue"] = "001002";
                }
                else if (this.cmbCarNo.Text == "02")
                {
                    dr["dtText"] = "001004";
                    dr["dtValue"] = "001004";
                }
                else
                {
                    dr["dtText"] = "001005";
                    dr["dtValue"] = "001005";
                }
                dt.Rows.Add(dr);
                this.cbToRow.DataSource = dt;
                this.cbToRow.DisplayMember = "dtText";
                this.cbToRow.ValueMember = "dtValue";
            }
            else
            {
                DataTable dtt = bll.FillDataTable("CMD.SelectShelf", param);
                this.cbToRow.DataSource = dtt.DefaultView;
                this.cbToRow.ValueMember = "shelfcode";
                this.cbToRow.DisplayMember = "shelfcode";
            }
        }
Esempio n. 24
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            try
            {
                object obj = ObjectUtil.GetObject(stateItem.State);
                if (obj == null)
                    return;
                if (obj.ToString() == "48" || obj.ToString() == "0")
                    return;

                string carNo = stateItem.ItemName.Substring(0, 2);

                Logger.Info("小车" + carNo + "接到入库确认请求");
                string CraneNo = "01";
                if (carNo == "02")
                    CraneNo = "02";

                BLL.BLLBase bll = new BLL.BLLBase();
                //判断堆垛机状态是否可用

                //查找有无请求状态(state='1')的任务,如没有则认为是空托盘回库
                string filter = string.Format("WCS_Task.State='1' and WCS_TASK.TaskType='11' and WCS_TASK.CarNo='{0}'", carNo);
                DataParameter[] parameter = new DataParameter[] { new DataParameter("{0}", filter) };
                DataTable dt = bll.FillDataTable("WCS.SelectTask", parameter);

                int rows = 0;
                if (dt.Rows.Count > 0)
                {
                    rows = bll.ExecNonQuery("WCS.UpdateTaskState", new DataParameter[] { new DataParameter("@State", 2), new DataParameter("@CarNo", carNo) });
                    WriteToService("CarPLC", carNo + "_CarReply", 49);
                    Logger.Info("小车:" + carNo + "收到入库请求,更新任务状态,影响行数" + rows);
                }
                else
                {
                    //判断有无正在执行的任务,如有不做处理,如没有则产生一笔空盘回库任务
                    filter = string.Format("WCS_Task.State='3' and WCS_TASK.TaskType='11' and WCS_TASK.CarNo='{0}'", carNo);
                    parameter = new DataParameter[] { new DataParameter("{0}", filter) };
                    DataTable dting = bll.FillDataTable("WCS.SelectTask", parameter);

                    if (dting.Rows.Count > 0)
                    {
                        WriteToService("CarPLC", carNo + "_CarReply", 50);
                        return;
                    }
                    //有无盘点回库任务
                    filter = string.Format("WCS_Task.State='4' and WCS_TASK.TaskType='14' and WCS_TASK.CarNo='{0}'", carNo);
                    parameter = new DataParameter[] { new DataParameter("{0}", filter) };
                    dting = bll.FillDataTable("WCS.SelectTask", parameter);
                    if (dting.Rows.Count > 0)
                    {
                        //盘点任务改变状态为5,堆垛机调度回库
                        string TaskNo = dting.Rows[0]["TaskNo"].ToString();
                        bll.ExecNonQuery("WCS.UpdateTaskStateByTaskNo", new DataParameter[] { new DataParameter("@State", 5), new DataParameter("@TaskNo", TaskNo) });

                        WriteToService("CarPLC", carNo + "_CarReply", 49);
                        return;
                    }

                    //查找锁定货位,且产品是托盘的货位,如有判断为实托盘出库后,托盘回库
                    string ProductCode = "00" + CraneNo;
                    parameter = new DataParameter[]
                    {
                        new DataParameter("{0}", string.Format("CMD_Cell.ProductCode='{0}' and CMD_Cell.IsActive='1' and CMD_Cell.IsLock='1' and CMD_Cell.ErrorFlag!='1'",ProductCode)),
                        new DataParameter("{1}", carNo)
                    };
                    dt = bll.FillDataTable("CMD.SelectCellByCar", parameter);
                    if (dt.Rows.Count > 0)
                    {
                        //产生一笔空托盘入库任务
                        //锁定货位
                        parameter = new DataParameter[]
                        {
                            new DataParameter("@CarNo", carNo),
                            new DataParameter("@CraneNo", CraneNo),
                            new DataParameter("@CellCode", dt.Rows[0]["CellCode"].ToString())
                        };
                        bll.ExecNonQueryTran("WCS.Sp_RequestPalletInTask", parameter);
                        WriteToService("CarPLC", carNo + "_CarReply", 49);
                        Logger.Info("小车:" + carNo + "接到入库请求,产生一笔托盘回库任务");
                    }
                }
                WriteToService("CarPLC", carNo + "_CarReply", 50);
            }
            catch (Exception e)
            {
                Logger.Error("Dispatching.Process.CarProcess:" + e.Message);
            }
        }
Esempio n. 25
0
        private void frmReassignEmptyCell_Load(object sender, EventArgs e)
        {
            this.txtTaskNo.Text = dr["TaskNo"].ToString();
            this.txtCellCode.Text = dr["CellCode"].ToString();
            this.txtCarNo.Text = dr["CarNo"].ToString();
            this.txtCraneNo.Text = dr["CraneNo"].ToString();
            this.txtProductCode.Text = dr["ProductCode"].ToString();
            this.txtProductName.Text = dr["ProductName"].ToString();
            this.txtAreaCode.Text = dr["AreaCode"].ToString();

            CraneNo = dr["CraneNo"].ToString();

            DataParameter[] param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("CraneNo='{0}' and AreaCode='{1}'", CraneNo,this.txtAreaCode.Text))
            };
            DataTable dt = bll.FillDataTable("CMD.SelectCellShelf", param);
            this.cbRow.DataSource = dt.DefaultView;
            this.cbRow.ValueMember = "shelfcode";
            this.cbRow.DisplayMember = "shelfcode";
        }