Exemplo n.º 1
0
        private void toolStripButton_Cancel_Click(object sender, EventArgs e)
        {
            if (this.dgvMain.CurrentRow == null)
            {
                return;
            }
            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();
                        //bll.ExecNonQuery("WCS.UpdateTaskStateByTaskNo", new DataParameter[] { new DataParameter("@State", 9), new DataParameter("@TaskNo", TaskNo) });

                        DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                        bll.ExecNonQueryTran("WCS.Sp_TaskCancelProcess", param);
                        this.BindData();
                    }
                }
                else
                {
                    MessageBox.Show("选中的状态非[等待],请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
        }
Exemplo n.º 2
0
        private void PalletCodeDoubleClick(int CraneNo, int ItemNo)
        {
            if (GetTextBox("txtCarErrorDesc", ItemNo).Text == "条码检测故障")
            {
                object o = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService("CarPLC", ItemNo + "_HasProduct"));
                if (o.ToString() == "1" || o.ToString() == "True")
                {
                    Task.frmHandlePalletCode frm = new Task.frmHandlePalletCode(ItemNo, CraneNo);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        string TaskStatus = frm.TaskStatus;

                        Context.ProcessDispatcher.WriteToService("CarPLC", ItemNo + "_WriteFinished", 3);
                        string TaskNo = frm.TaskNo;

                        sbyte[]  staskNo = new sbyte[26];
                        string[] LedMsgs = frm.LedNo.Split(',');
                        Util.ConvertStringChar.stringToBytes(TaskNo, 10).CopyTo(staskNo, 0);
                        Util.ConvertStringChar.stringToBytes(LedMsgs[0], 8).CopyTo(staskNo, 10);
                        Util.ConvertStringChar.stringToBytes(LedMsgs[1], 8).CopyTo(staskNo, 18);
                        Context.ProcessDispatcher.WriteToService("CarPLC", ItemNo + "_WriteTaskNo", staskNo);
                        if (Context.ProcessDispatcher.WriteToService("CarPLC", ItemNo + "_WriteFinished", 4))
                        {
                            //插入WCS_Task
                            if (TaskStatus == "0")
                            {
                                bll.ExecNonQueryTran("WCS.SPReciveWmsTask", new DataParameter[] { new DataParameter("VTASKNO", frm.TaskNo) });
                            }
                            Logger.Info(ItemNo + "输送线托盘编号:" + frm.PalletCode + "开始入库");
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void toolStripButton_Delete_Click(object sender, EventArgs e)
        {
            if (this.dgvMain.CurrentRow == null)
            {
                return;
            }
            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 BillID = this.dgvMain.SelectedRows[0].Cells["colBillID"].Value.ToString();
                        //bll.ExecNonQuery("WCS.UpdateTaskStateByTaskNo", new DataParameter[] { new DataParameter("@State", 9), new DataParameter("@TaskNo", TaskNo) });
                        DataParameter[] param = new DataParameter[] { new DataParameter("@BillID", BillID) };
                        bll.ExecNonQueryTran("WCS.DeleteProducePlan", param);

                        this.BindData();
                    }
                }
                else
                {
                    MessageBox.Show("选中的状态非[保存],请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
        }
Exemplo n.º 4
0
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string ItemName = ((ToolStripMenuItem)sender).Name;
            string State    = ItemName.Replace("ToolStripMenuItem1", "");

            if (this.dgvMain.CurrentCell != null)
            {
                DataRow     dataRow  = (this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].DataBoundItem as DataRowView).Row;
                BLL.BLLBase bll      = new BLL.BLLBase();
                string      TaskNo   = dataRow["TaskNo"].ToString();
                string      AreaCode = dataRow["AreaCode"].ToString();
                string      TaskType = dataRow["TaskType"].ToString();

                DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) };
                bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
                BLL.BLLBase bllMiddle = new BLL.BLLBase("MiddleDB");
                Logger.Info("手動修改任务號:" + TaskNo + ",状态為" + State);
                if (State == "7") //手動執行后,修改中間表
                {
                    string TaskID     = dataRow["TaskID"].ToString();
                    string SubTaskID  = dataRow["SubTaskID"].ToString();
                    string PalletCode = dataRow["PalletCode"].ToString();
                    if (AreaCode == "UL" && TaskType == "12")
                    {
                        if (bll.GetRowCount("WCS_Task", string.Format("TaskID={0} and Palletcode='{1}' and SubTaskID!={2} and AreaCode='{3}' and State in (0,1,10) ", TaskID, PalletCode, SubTaskID, "UL")) == 0)
                        {
                            DataTable dtMiddle = bllMiddle.FillDataTable("Middle.SelectConveyMoveTask", new DataParameter[] { new DataParameter("@Device", "UL"), new DataParameter("{0}", string.Format("main.task_id={0} and hu_id='{1}' and subtask_id!={2} ", TaskID, PalletCode, SubTaskID)) });
                            if (dtMiddle.Rows.Count > 0)
                            {
                                dtMiddle.Rows[0]["location_id"] = dataRow["ToStation"].ToString();
                                BLL.Server.InsertTaskToWcs(dtMiddle, false);
                            }
                            else
                            {
                                Logger.Error("ConveyPickProcess中找不到托盤號:" + PalletCode + " 的後續處理方式!");
                            }
                        }
                    }
                    //List<DataParameter[]> paras = new List<DataParameter[]>();
                    //List<string> Comds = new List<string>();
                    //Comds.Add("Middle.UpdateAsrsTaskRTN");
                    //Comds.Add("Middle.UpdateAsrsSubTaskRTN");
                    //paras.Add(new DataParameter[] { new DataParameter("@TaskID", TaskID) });
                    //paras.Add(new DataParameter[] { new DataParameter("@SubTaskID", SubTaskID) });
                    //bllMiddle.ExecTran(Comds.ToArray(), paras);

                    bllMiddle.ExecNonQuery("Middle.UpdateAsrsTaskRTN", new DataParameter[] { new DataParameter("@TaskID", TaskID) });
                    bllMiddle.ExecNonQuery("Middle.UpdateAsrsSubTaskRTN", new DataParameter[] { new DataParameter("@SubTaskID", SubTaskID) });

                    if (bllMiddle.GetRowCount("si_asrs_task_Detail", string.Format("task_id={0} and status in ('ADD','ISS','ACK') and subtask_id<>{1}", TaskID, SubTaskID)) == 0)
                    {
                        bll.ExecNonQuery("WCS.sp_FinshedTaskToBak", new DataParameter[] { new DataParameter("@TaskID", TaskID) });
                    }
                }
                else if (State == "9")
                {
                }
                BindData();
            }
        }
Exemplo n.º 5
0
        public string ImportWCSTask(string taskData)
        {
            Log.WriteToLog("1", "transSRMTask-Rec", taskData);
            string json  = "";
            string id    = "";
            string state = "";
            string State = "";

            try
            {
                DataTable dt = Util.JsonHelper.Json2Dtb(taskData);
                if (dt.Rows.Count > 0)
                {
                    id = dt.Rows[0]["id"].ToString();
                }
                else
                {
                    id = "";
                }

                bll.ExecNonQuery("WCS.DeleteWcsTemp");
                bll.BatchInsertTable(dt, "WCS_TaskTemp");
                bll.ExecNonQueryTran("WCS.Sp_ImportWmsTask");

                json = "{\"id\":\"" + id + "\",\"returnCode\":\"000\"" + ",\"message\":\"成功\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}";
            }
            catch (Exception ex)
            {
                json = "{\"id\":\"" + id + "\",\"returnCode\":\"001\"" + ",\"message\":\"" + ex.Message + "\"" + ",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"" + ex.Message + "\"}";
            }
            Log.WriteToLog("1", "transSRMTask-Rtn", json);
            return(json);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 状态切换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string ItemName = ((ToolStripMenuItem)sender).Name;
            string State    = ItemName.Replace("ToolStripMenuItem", "");

            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);

                BindData();

                try
                {
                    App.Dispatching.Process.Report report = new Dispatching.Process.Report();
                    if (State == "7")
                    {
                        report.Send2MES(TaskNo);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("切换状态,上报MES时发生错误:" + ex.Message);
                }
            }
        }
Exemplo n.º 7
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();
                MCP.Logger.Info("任务号:" + TaskNo + "手动更新为:" + State);
            }
        }
Exemplo n.º 8
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            object obj = ObjectUtil.GetObject(stateItem.State);

            if (obj == null)
            {
                return;
            }

            BLL.BLLBase bll     = new BLL.BLLBase();
            string      Request = obj.ToString();

            if (Request.Equals("True") || Request.Equals("1"))
            {
                try
                {
                    string taskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, "Barcode")));
                    if (taskNo.Trim().Length > 0)
                    {
                        string Barcode = taskNo.PadRight(20, ' ').Substring(10, 10).Trim();

                        DataTable dt = bll.FillDataTable("WCS.SelectReadTaskByPallet", new DataParameter[] { new DataParameter("@PalletCode", Barcode) });
                        if (dt.Rows.Count > 0)
                        {
                            string TaskType = dt.Rows[0]["TaskType"].ToString();
                            string TaskNo   = dt.Rows[0]["TaskNo"].ToString();
                            if (TaskType == "12" || TaskType == "15" || TaskType == "14") //出库,托盘出库,盘点
                            {
                                DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                                bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
                                Logger.Info("出库任务完成,任务号:" + TaskNo + " 条码号:" + Barcode);


                                string   strValue = "";
                                string[] str      = new string[3];
                                if (TaskType == "12" || TaskType == "14")//显示拣货信息.
                                {
                                    str[0] = "1";
                                    if (TaskType == "14")
                                    {
                                        str[0] = "2";
                                    }

                                    while ((strValue = FormDialog.ShowDialog(str, dt)) != "")
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("到达出库口,错误讯息:" + ex.Message);
                }
            }
        }
Exemplo n.º 9
0
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     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", 0) };
         bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
         BindData();
     }
 }
Exemplo n.º 10
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strColorCode = "'-1',";
            BLL.BLLBase bll = new BLL.BLLBase();
            for (int i = 0; i < this.GridView1.Rows.Count; i++)
            {
                CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect"));
                if (cb != null && cb.Checked)
                {
                    string hk = this.GridView1.Rows[i].Cells[1].Text;
                    //判断能否删除
                    int State = int.Parse(bll.GetFieldValue("WMS_BillMaster", "State", string.Format("BillID='{0}'", hk)));
                    if (State == 0)
                    {
                        WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, GridView1.Rows[i].Cells[2].Text + "单号还未审核不能作业,请审核后,再进行盘库作业。");
                        BindDataSub(this.hdnRowValue.Value);
                        return;
                    }
                    if (State > 1)
                    {
                        WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, GridView1.Rows[i].Cells[2].Text + "单号已经作业,不能再进行盘库作业。");
                        BindDataSub(this.hdnRowValue.Value);
                        return;
                    }

                    strColorCode += "'" + hk + "',";
                }
            }

            strColorCode += "'-1'";
            if (strColorCode.Replace("'-1','-1'", "").Trim().Length == 0)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1,  "请选择单据!");
                SetGridViewEmptyRow(GridView1, (DataTable)ViewState[FormID + "_MainFormData"]);
                BindDataSub(this.hdnRowValue.Value);
                return;
            }
            try
            {

                bll.ExecNonQueryTran("WMS.SpInventoryStockTask", new DataParameter[] { new DataParameter("@strWhere", strColorCode), new DataParameter("@UserName", Session["EmployeeCode"].ToString()) });

                AddOperateLog("盘库单", "盘库作业单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", ""));
                DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1);
                SetBindDataSub(dt);
            }
            catch (Exception ex)
            {
                BindDataSub(this.hdnRowValue.Value);
                WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, ex.Message);

            }
        }
Exemplo n.º 11
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            DataTable dt;

            DataParameter[] param;

            param = new DataParameter[]
            {
                new DataParameter("@StationNo", this.cmbStationNo.Text),
                new DataParameter("@AreaCode", this.txtAreaCode.Text)
            };


            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='' and IsActive='1' and IsLock='0' and AreaCode='{1}'", this.txtCellCode.Text, 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("@CellCode", this.txtCellCode.Text),
                new DataParameter("@TaskNo", this.txtTaskNo.Text),
                new DataParameter("@Station", this.cmbStationNo.Text)
            };
            bll.ExecNonQueryTran("WCS.Sp_ExecuteInStockTask", param);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Exemplo n.º 12
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strColorCode = "'-1',";

            BLL.BLLBase bll = new BLL.BLLBase();
            for (int i = 0; i < this.GridView1.Rows.Count; i++)
            {
                CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect"));
                if (cb != null && cb.Checked)
                {
                    string hk = this.GridView1.Rows[i].Cells[1].Text;
                    //判断能否删除
                    int State = int.Parse(bll.GetFieldValue("WMS_BillMaster", "State", string.Format("BillID='{0}'", hk)));
                    if (State == 0)
                    {
                        WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, GridView1.Rows[i].Cells[2].Text + "单号还未审核不能作业,请审核后,再进行入库作业。");
                        BindDataSub(this.hdnRowValue.Value);
                        return;
                    }
                    if (State > 1)
                    {
                        WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, GridView1.Rows[i].Cells[2].Text + "单号已经作业,不能再进行入库作业。");
                        BindDataSub(this.hdnRowValue.Value);
                        return;
                    }

                    strColorCode += "'" + hk + "',";
                }
            }

            strColorCode += "'-1'";
            if (strColorCode.Replace("'-1','-1'", "").Trim().Length == 0)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, "请选择单据!");
                SetGridViewEmptyRow(GridView1, (DataTable)ViewState[FormID + "_MainFormData"]);
                BindDataSub(this.hdnRowValue.Value);
                return;
            }
            try
            {
                bll.ExecNonQueryTran("WMS.SpInstockTask", new DataParameter[] { new DataParameter("@strWhere", strColorCode), new DataParameter("@UserName", Session["EmployeeCode"].ToString()) });

                AddOperateLog("入库单", "入库作业单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", ""));
                DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1);
                SetBindDataSub(dt);
            }
            catch (Exception ex)
            {
                BindDataSub(this.hdnRowValue.Value);
                WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, ex.Message);
            }
        }
Exemplo n.º 13
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();

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

                BindData();
            }
        }
Exemplo n.º 14
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["colTaskNo"].Value.ToString();
                DataParameter[] param  = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) };
                bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
                MCP.Logger.Info("frmInventor中任何号:" + TaskNo + "手动更新为" + State);

                BindData();
            }
        }
Exemplo n.º 15
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_GetEmptyCell", 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" + CraneNo;

            //判断货位是否空闲,且只有空托盘
            param = new DataParameter[]
            {
                new DataParameter("{0}", string.Format("ProductCode='' and IsActive='1' and IsLock='0' and ErrorFlag!='1' and CellCode='{0}'", 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_CreatePalletInTask", param);
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Exemplo n.º 16
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);

            //增加出库作业
            if (this.btnCheck.Text == "出库作业")
            {
                string strColorCode = "'" + this.txtID.Text + "'";
                try
                {
                    bll.ExecNonQueryTran("WMS.SpOutStockTask", new DataParameter[] { new DataParameter("@strWhere", strColorCode), new DataParameter("@UserName", Session["EmployeeCode"].ToString()) });

                    AddOperateLog("出库单", "出库作业单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", ""));
                }
                catch (Exception ex)
                {
                    WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel, ex.Message);
                    return;
                }
            }
            AddOperateLog("出库单 ", btnCheck.Text + " " + txtID.Text);

            DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("BillID='{0}'", strID)) });

            BindData(dt);
        }
Exemplo n.º 17
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();
            }
        }
Exemplo n.º 18
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();
         DataParameter[] param  = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) };
         bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
         ////堆垛机完成执行
         //if (State == "7")
         //{
         //    DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
         //    bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
         //}
         BindData();
         MCP.Logger.Info("任务号:" + TaskNo + "手动更新为:" + State);
     }
 }
Exemplo n.º 19
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;
        }
Exemplo n.º 20
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            object obj = ObjectUtil.GetObject(stateItem.State);

            if (obj == null)
            {
                return;
            }
            if (obj.ToString().Trim().Length <= 0)
            {
                return;
            }
            string PalletBarcode = obj.ToString();

            string StationNo = "";
            int    state     = 1;

            switch (stateItem.ItemName)
            {
            case "ToInStation1":
                StationNo = "AX-" + stateItem.Name.Substring(5, 2) + "-00";
                break;

            case "ToInStation2":
                StationNo = "AX-" + stateItem.Name.Substring(5, 2) + "-01";
                state     = 2;
                break;
            }

            try
            {
                BLL.BLLBase bll = new BLL.BLLBase();

                DataParameter[] param = new DataParameter[] { new DataParameter("@PalletBarcode", PalletBarcode), new DataParameter("@AisleNo", stateItem.Name.Substring(5, 2)), new DataParameter("@State", state) };
                bll.ExecNonQueryTran("WCS.UpdateTaskStateByBarcode", param);

                Logger.Info("托盘/箱号:" + PalletBarcode + "到达入库站台:" + StationNo);
            }
            catch (Exception ex)
            {
                Logger.Error("InStockToStationProcess出错,原因:" + ex.Message);
            }
        }
Exemplo n.º 21
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                DataParameter[] para = new DataParameter[] {
                    new DataParameter("@ProductCode", strID),
                    new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue),
                    new DataParameter("@FactoryID", this.ddlFactoryID.SelectedValue),
                    new DataParameter("@UserName", Session["EmployeeCode"].ToString()),
                };

                bll.ExecNonQueryTran("WMS.spCreateInStockByProduct", para);
                ClientScript.RegisterClientScriptBlock(ClientScript.GetType(), "myscript", "<script type='text/javascript'>alert('入库单新增成功!'); Exit();</script>");
            }
            catch (Exception ex)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this, ex.Message);
                return;
            }
        }
Exemplo n.º 22
0
Arquivo: Main.cs Projeto: 0000duck/XN
        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();
                string      TaskState = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[2].Value.ToString();
                if (TaskState == "等待" && State == "7")
                {
                    frmChangefalse frm = new frmChangefalse();
                    frm.ShowDialog();
                    return;
                }

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

                BindData();
                Logger.Info("任务:" + TaskNo + " 手动切换状态为:" + State);
                try
                {
                    App.Dispatching.Process.Report report = new Dispatching.Process.Report();
                    if (State == "7")
                    {
                        report.Send2MJWcs(context, 3, TaskNo);
                    }
                    else if (State == "9")
                    {
                        report.Send2MJWcs(context, 5, TaskNo);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("切换状态,上报MJ-WCS时发生错误:" + ex.Message);
                }
            }
        }
Exemplo n.º 23
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                DataParameter[] para = new DataParameter[] {
                    new DataParameter("@ProductCode", strID),
                    new DataParameter("@ProductNewCode", this.txtProductNewCode.Text),
                    new DataParameter("@UserName", Session["EmployeeCode"].ToString()),
                };

                bll.ExecNonQueryTran("WMS.spBatchChangeProductNo", para);
                App_Code.JScript.Instance.ShowMessage(this, "编号修改成功!");



                Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtProductNewCode.Text));
            }
            catch (Exception ex)
            {
                WMS.App_Code.JScript.Instance.ShowMessage(this, ex.Message);
                return;
            }
        }
Exemplo n.º 24
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();
                string      state  = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[2].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);
                }
                if (State == "9" && state != "完成" && state != "取消")
                {
                    App.Dispatching.Process.Report report = new Dispatching.Process.Report();
                    report.Send2MJWcs(base.Context, 5, TaskNo);
                }
                BindData();
            }
        }
Exemplo n.º 25
0
        void Monitor_OnCrane(CraneEventArgs args)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new CraneEventHandler(Monitor_OnCrane), args);
            }
            else
            {
                Crane   crane = args.crane;
                TextBox txt   = GetTextBox("txtTaskNo", crane.CraneNo);
                if (txt != null)
                {
                    txt.Text = crane.TaskNo;
                }

                txt = GetTextBox("txtState", crane.CraneNo);
                if (txt != null && dicCraneState.ContainsKey(crane.TaskType))
                {
                    txt.Text = dicCraneState[crane.TaskType];
                }

                txt = GetTextBox("txtCraneAction", crane.CraneNo);
                if (txt != null && dicCraneAction.ContainsKey(crane.Action))
                {
                    txt.Text = dicCraneAction[crane.Action];
                }

                txt = GetTextBox("txtRow", crane.CraneNo);
                if (txt != null)
                {
                    txt.Text = crane.Row.ToString();
                }

                txt = GetTextBox("txtColumn", crane.CraneNo);
                if (txt != null)
                {
                    txt.Text = crane.Column.ToString();
                }

                //堆垛机位置
                if (crane.CraneNo == 1)
                {
                    this.picCrane.Visible = true;
                    Point P1 = InitialP1;
                    if (crane.Column < 46)
                    {
                        P1.X = P1.X + (int)((crane.Column - 1) * colDis);
                    }
                    else
                    {
                        P1.X = picCar.Location.X + 15;
                    }

                    P1.Y = P1.Y + (int)(rowDis * (crane.Row - 1));
                    this.picCrane.Location = P1;

                    Point P2 = InitialP2;
                    P2.Y = P2.Y + (int)(rowDis * (crane.Row - 1));
                    this.picCar.Location = P2;
                }

                txt = GetTextBox("txtHeight", crane.CraneNo);
                if (txt != null)
                {
                    txt.Text = crane.Height.ToString();
                }

                txt = GetTextBox("txtForkStatus", crane.CraneNo);
                if (txt != null && dicCraneFork.ContainsKey(crane.ForkStatus))
                {
                    txt.Text = dicCraneFork[crane.ForkStatus];
                }
                txt = GetTextBox("txtErrorNo", crane.CraneNo);
                if (txt != null)
                {
                    txt.Text = crane.ErrCode.ToString();
                }

                string strError = "";
                txt = GetTextBox("txtErrorDesc", crane.CraneNo);
                if (txt != null)
                {
                    if (crane.ErrCode != 0)
                    {
                        DataRow[] drs = dtCraneErr.Select(string.Format("CraneErrCode={0}", crane.ErrCode));
                        if (drs.Length > 0)
                        {
                            strError = drs[0]["CraneErrDesc"].ToString();
                        }
                        else
                        {
                            strError = "堆垛机未知错误!";
                        }
                    }
                    else
                    {
                        strError = "";
                    }
                    txt.Text = strError;
                }

                //更新错误代码、错误描述
                //更新任务状态为执行中
                //bll.ExecNonQuery("WCS.UpdateTaskError", new DataParameter[] { new DataParameter("@CraneErrCode", crane.ErrCode.ToString()), new DataParameter("@CraneErrDesc", dicCraneError[crane.ErrCode]), new DataParameter("@TaskNo", crane.TaskNo) });
                if (crane.ErrCode > 0)
                {
                    DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", crane.TaskNo), new DataParameter("@CraneErrCode", crane.ErrCode.ToString()), new DataParameter("@CraneErrDesc", strError) };
                    bll.ExecNonQueryTran("WCS.Sp_UpdateTaskError", param);
                    Logger.Error(crane.CraneNo.ToString() + "堆垛机执行时出现错误,代码:" + crane.ErrCode.ToString() + ",描述:" + strError);
                }
            }
        }
Exemplo n.º 26
0
        private void btnRequest_Click(object sender, EventArgs e)
        {
            try
            {
                if (dtSource == null || dtSource.Rows.Count == 0)
                {
                    MessageBox.Show("熔次卷号不能为空,请扫码或输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtBarcode.Focus();
                    return;
                }

                DataTable       dt;
                DataParameter[] param;


                param = new DataParameter[]
                {
                    new DataParameter("@AreaCode", AreaCode),
                    new DataParameter("@AisleNo", this.cmbAisleNo.Text)
                };
                string strTaskNo = "";
                for (int i = 0; i < dtSource.Rows.Count; i++)
                {
                    strTaskNo += "'" + dtSource.Rows[i]["TaskNo"] + "'";
                    if (i < dtSource.Rows.Count - 1)
                    {
                        strTaskNo += ",";
                    }
                }
                bll.ExecNonQuery("WCS.updateCrane", new DataParameter[] { new DataParameter("{0}", this.CraneNo), new DataParameter("{1}", "(" + strTaskNo + ")") });

                if (this.radioButton1.Checked)
                {
                    dt = bll.FillDataTable("WCS.sp_GetCellByAisle", param);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtCellCode.Text = dt.Rows[0][0].ToString();
                    }
                    else
                    {
                        this.txtCellCode.Text = "";
                    }
                }
                else if (this.radioButton2.Checked)
                {
                    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);
                }
                else
                {
                    if (dtSource.Rows.Count > 1)
                    {
                        MCP.Logger.Info("缓存区只能处理单个熔次卷号!");
                        return;
                    }

                    strTaskNo = dtSource.Rows[0]["TaskNo"].ToString();
                    bll.ExecNonQuery("WCS.UpdateTaskAreaCodeByTaskNo", new DataParameter[] { new DataParameter("@AreaCode", AreaCode), new DataParameter("@TaskNo", strTaskNo) });
                    param = new DataParameter[] { new DataParameter("@TaskNo", strTaskNo) };

                    DataTable dtXml = bll.FillDataTable("WCS.Sp_TaskProcessNoShelf", param);
                    if (dtXml.Rows.Count > 0)
                    {
                        string BillNo = dtXml.Rows[0][0].ToString();
                        if (BillNo.Trim().Length > 0)
                        {
                            string xml = Util.ConvertObj.ConvertDataTableToXmlOperation(dtXml, "BatchInStock");
                            Context.ProcessDispatcher.WriteToService("ERP", "ACK", xml);
                            MCP.Logger.Info("单号" + dtXml.Rows[0][0].ToString() + "已完成,开始上报ERP系统");
                        }
                    }
                    SetControlEmpty();
                    this.txtBarcode.Focus();
                    return;
                }


                //判断货位是否为空
                param = new DataParameter[]
                {
                    new DataParameter("{0}", string.Format("CellCode='{0}' and ProductCode='' and IsActive='1' and IsLock='0' and AreaCode='{1}'", this.txtCellCode.Text, AreaCode))
                };
                dt = bll.FillDataTable("CMD.SelectCell", param);
                if (dt.Rows.Count <= 0)
                {
                    MessageBox.Show("自动获取的货位或指定的货位非空货位,请确认!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //锁定货位



                param = new DataParameter[]
                {
                    new DataParameter("@CellCode", this.txtCellCode.Text),
                    new DataParameter("@TaskNo", strTaskNo),
                    new DataParameter("@StationNo", this.cmbAisleNo.Text)
                };

                bll.ExecNonQueryTran("WCS.Sp_ExecuteInStockTask", param);


                this.dtSource          = null;
                this.bsMain.DataSource = null;
                SetControlEmpty();
                this.txtBarcode.Focus();
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
            }
        }
Exemplo n.º 27
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            switch (stateItem.ItemName)
            {
            case "101_TaskNo":
                object[] obj = ObjectUtil.GetObjects(stateItem.State);
                if (obj == null)
                {
                    return;
                }
                string TaskNo = obj[0].ToString() + obj[1].ToString().PadLeft(4, '0') + obj[2].ToString().PadLeft(4, '0');
                if (TaskNo.Length > 0)
                {
                    string StationNo     = stateItem.ItemName.Substring(0, 3);
                    string PalletBarcode = ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, StationNo + "_RPalletCode")));

                    try
                    {
                        DataParameter[] param = new DataParameter[] { new DataParameter("{0}", "State='2',Covey_FinishDate=getdate()"), new DataParameter("{1}", string.Format("TaskNo='{0}'", TaskNo)) };
                        bll.ExecNonQueryTran("WCS.UpdateTaskState", param);
                        Logger.Info("任务号:" + TaskNo + " 聊箱号:" + PalletBarcode + " 到达入库站台:" + StationNo);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("InStockToStationProcess出错,原因:" + ex.Message);
                    }
                }
                break;

            case "TaskNo":
                string ReadTaskNo = stateItem.State.ToString();
                //下达输送线入库任务

                try
                {
                    DataParameter[] parameter = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_Task.TaskType='11'and WCS_Task.State='0' and TaskNo='{0}'", ReadTaskNo)) };
                    DataTable       dt        = bll.FillDataTable("WCS.SelectTask", parameter);
                    if (dt.Rows.Count > 0)
                    {
                        string ConveyID    = dt.Rows[0]["ConveyFromStation"].ToString();
                        string PalletCode  = dt.Rows[0]["PalletCode"].ToString();
                        string Destination = dt.Rows[0]["ConveyToStation"].ToString();
                        int[]  iTaskNo     = new int[3];
                        iTaskNo[0] = int.Parse(ReadTaskNo.Substring(0, 2));
                        iTaskNo[1] = int.Parse(ReadTaskNo.Substring(2, 4));
                        iTaskNo[2] = int.Parse(ReadTaskNo.Substring(6, 4));
                        WriteToService(ConveyServer, ConveyID + "_WTaskNo", iTaskNo);
                        WriteToService(ConveyServer, ConveyID + "_WPalletCode", PalletCode);
                        WriteToService(ConveyServer, ConveyID + "_Destination", Destination);     //目的地
                        if (WriteToService(ConveyServer, ConveyID + "_WriteFinished", 1))
                        {
                            bll.ExecNonQuery("WCS.UpdateTaskState", new DataParameter[] { new DataParameter("{0}", "State=1,Convey_StartDate=getdate()"), new DataParameter("{1}", string.Format("TaskNo='{0}'", ReadTaskNo)) });
                            Logger.Info("任务号:" + ReadTaskNo + " 料箱号:" + PalletCode + " 已下输送线:" + ConveyID + " 目的地址:" + Destination);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("InStockToStationProcess出错,下达输送入库任务出错,原因:" + ex.Message);
                }


                break;
            }
        }
Exemplo n.º 28
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();
                if (State == "9")
                {
                    string PLCTaskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(Context.ProcessDispatcher.WriteToService(serviceName, "CraneTaskNo"))); ;
                    if (TaskNo == PLCTaskNo)
                    {

                        int[] cellAddr = new int[9];
                        cellAddr[0] = 0;
                        cellAddr[1] = 1;

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

                        Context.ProcessDispatcher.WriteToService(serviceName, "TaskNo", taskNo);

                        int i = 0;
                        while (i < 1000)
                        {
                            i++;
                        }

                        Context.ProcessDispatcher.WriteToService(serviceName, "TaskAddress", cellAddr);
                        Context.ProcessDispatcher.WriteToService(serviceName, "WriteFinished", 0);

                        MCP.Logger.Info("已给堆垛机下发取消任务指令");
                    }
                }

                MCP.Logger.Info("任务号:" + TaskNo + "手动更新为:" + State);
            }
        }
Exemplo n.º 29
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);
            }
        }
Exemplo n.º 30
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();
            }
        }
Exemplo n.º 31
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();
            }
        }
Exemplo n.º 32
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            object obj = ObjectUtil.GetObject(stateItem.State);

            if (obj == null)
            {
                return;
            }

            if (stateItem.ItemName.IndexOf("nAlarmCode") >= 0)
            {
                int CraneNo = int.Parse(stateItem.Name.Replace("CranePLC", "")) * 2;
                ShowLedMessage(CraneNo.ToString(), stateItem);
                return;
            }
            string ItemNo = stateItem.ItemName.Split('_')[0];

            ShowLedMessage(GetLedNo(int.Parse(ItemNo)), stateItem);

            try
            {
                if (stateItem.ItemName.IndexOf("TaskNo") >= 0 && (ItemNo == "102" || ItemNo == "106" || ItemNo == "110" || ItemNo == "114" || ItemNo == "118" || ItemNo == "103" || ItemNo == "107" || ItemNo == "111" || ItemNo == "115" || ItemNo == "119"))
                {
                    string Tasks = ConvertStringChar.BytesToString(ObjectUtil.GetObjects(stateItem.State));
                    Tasks = Tasks.PadRight(26, ' ');
                    string TaskNo = Tasks.Substring(0, 10).Trim();
                    if (TaskNo.Length > 0)
                    {
                        BLL.BLLBase bll    = new BLL.BLLBase();
                        DataTable   dtTask = bll.FillDataTable("WCS.SelectWCSTask", new DataParameter[] { new DataParameter("{0}", string.Format("TaskID='{0}'", TaskNo)) });
                        if (dtTask.Rows.Count > 0)
                        {
                            string PalletCode = dtTask.Rows[0]["PALLETID"].ToString();
                            switch (ItemNo)
                            {
                            case "102":
                            case "106":
                            case "110":
                            case "114":
                            case "118":
                                //更新WCS_Task入库状态
                                bll.ExecNonQuery("WCS.UpdateWCSTaskStateByStatus", new DataParameter[] { new DataParameter("{0}", "2"), new DataParameter("{1}", TaskNo), new DataParameter("{2}", 1) });
                                Logger.Info("入库任务:" + TaskNo + "托盘编号:" + PalletCode + "到达入库端!");
                                break;

                            case "103":
                            case "107":
                            case "111":
                            case "115":
                            case "119":
                                //更新出库完成
                                bll.ExecNonQueryTran("WCS.SpTaskFinished", new DataParameter[] { new DataParameter("VTaskNo", TaskNo) });
                                Logger.Info("出库任务:" + TaskNo + "托盘编号:" + PalletCode + "完成任务!");
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("LEDProcess中StateChanged出现异常" + ex.Message);
            }
        }
Exemplo n.º 33
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);
            }
        }
Exemplo n.º 34
0
        protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher)
        {
            switch (stateItem.ItemName)
            {
            case "TaskFinished01":
            case "TaskFinished02":
                object[] obj = ObjectUtil.GetObjects(stateItem.State);

                if (obj == null)
                {
                    return;
                }
                string TaskNo = ConvertStringChar.BytesToString(obj);
                {
                    //存储过程处理
                    if (TaskNo.Length > 0)
                    {
                        byte[] b = new byte[30];
                        ConvertStringChar.stringToByte("", 30).CopyTo(b, 0);
                        WriteToService(stateItem.Name, stateItem.ItemName, b);

                        Logger.Info(stateItem.ItemName + "完成标志,任务号:" + TaskNo);
                        DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
                        bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
                    }
                    //上报总控WCS,下架完成
                }
                break;

            case "CarAlarm01":
            case "CarAlarm02":
                object obj1 = ObjectUtil.GetObject(stateItem.State);
                if (obj1 == null)
                {
                    return;
                }
                if (obj1.ToString() != "0")
                {
                    string    strError = "";
                    DataRow[] drs      = dtDeviceAlarm.Select(string.Format("Flag=2 and AlarmCode={0}", obj1.ToString()));
                    if (drs.Length > 0)
                    {
                        strError = drs[0]["AlarmCode"].ToString();
                    }
                    else
                    {
                        strError = "穿梭车未知错误!";
                    }
                    Logger.Error(strError);
                }
                break;

            case "ElevatorAlarm":
                object obj2 = ObjectUtil.GetObject(stateItem.State);
                if (obj2 == null)
                {
                    return;
                }
                if (obj2.ToString() != "0")
                {
                    string    strError = "";
                    DataRow[] drs      = dtDeviceAlarm.Select(string.Format("Flag=3 and AlarmCode={0}", obj2.ToString()));
                    if (drs.Length > 0)
                    {
                        strError = drs[0]["AlarmCode"].ToString();
                    }
                    else
                    {
                        strError = "提升机未知错误!";
                    }
                    Logger.Error(strError);
                }
                break;

            case "Run":
                blRun = (int)stateItem.State == 1;
                if (blRun)
                {
                    tmWorkTimer.Start();
                    Logger.Info("提升机联机");
                }
                else
                {
                    tmWorkTimer.Stop();
                    Logger.Info("提升机脱机");
                }
                break;

            default:
                break;
            }


            return;
        }
Exemplo n.º 35
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();
         DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) };
         bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
         ////堆垛机完成执行
         //if (State == "7")
         //{
         //    DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) };
         //    bll.ExecNonQueryTran("WCS.Sp_TaskProcess", param);
         //}
         BindData();
         MCP.Logger.Info("任务号:" + TaskNo + "手动更新为:" + State);
     }
 }
Exemplo n.º 36
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;
        }
Exemplo n.º 37
0
 private void toolStripMenuItem2_Click(object sender, EventArgs e)
 {
     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", 0) };
         bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param);
         BindData();
         MCP.Logger.Info("任务号:" + TaskNo + "手动更新为:0");
     }
 }