Exemple #1
0
 /// <summary>
 /// 根据远程数据库初始化托盘
 /// </summary>
 /// <param name="list"></param>
 public void InitializeStoragePallet(object o)
 {
     try
     {
         List <Storage.General> list    = o as List <Storage.General>;
         List <Rack>            allRack = RackBll.GetRackAllStorage();
         if (allRack != null && allRack.Count > 0)
         {
             foreach (Rack r in allRack)
             {
                 for (int i = 0; i < list.Count; i++)
                 {
                     if (r.Rack_type == list[i].StorageType)
                     {
                         list[i].Change(r.Rack_z, r.Rack_colum, r.Rack_row, r.Rack_state, r.Rack_id);
                         Thread.Sleep(10);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
        //搜索
        private void bt_search_Click(object sender, EventArgs e)
        {
            string searchstr = this.tb_search.Text.Trim();

            if (searchstr.Length < 1)
            {
                MessageBox.Show("托盘号码不能为空!");
                return;
            }
            Rack r = ControlInterfaceMethod.searchRack(searchstr);

            if (r == null)
            {
                MessageBox.Show("托盘号码不正确!");
                return;
            }
            RackBll rb = new RackBll();

            rb.InsertRack(r);
            //1 新立库 2 双身为 3 配餐  4老库 5 窄巷道
            if (r.Rack_type == 1 || r.Rack_type == 1)
            {
                remote.setCustomView("v_cgk");
            }
            else if (r.Rack_type == 3)
            {
                remote.setCustomView("v_pcc");
            }
            else if (r.Rack_type == 4 || r.Rack_type == 5)
            {
                remote.setCustomView("v_cgk2");
            }
        }
 /// <summary>
 /// On doubleclicking on the grid, It displays the details to edit or delete a rack
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvRack_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             if (dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackName"].Value.ToString() != "NA")
             {
                 RackBll  BllRack  = new RackBll();
                 RackInfo infoRack = new RackInfo();
                 decRackId               = Convert.ToDecimal(dgvRack.Rows[e.RowIndex].Cells["dgvtxtRackId"].Value.ToString());
                 infoRack                = BllRack.RackView(decRackId);
                 txtRackName.Text        = infoRack.RackName;
                 cmbGodown.SelectedValue = infoRack.GodownId.ToString();
                 txtNarration.Text       = infoRack.Narration;
                 btnSave.Text            = "Update";
                 btnDelete.Enabled       = true;
                 strRackName             = infoRack.RackName;
                 txtRackName.Focus();
             }
             else
             {
                 Messages.InformationMessage("Default Rack cannot update or delete");
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #4
0
 public void StorageThreadFunc(object o)
 {
     try
     {
         Storage.General g = o as Storage.General;
         while (true && g != null)
         {
             if (IsStart)
             {
                 List <Rack> allRack = RackBll.GetRackAll(g.StorageType);
                 if (allRack != null)
                 {
                     foreach (Rack r in allRack)
                     {
                         RackBll.deleteRack(r.id, g.StorageType);
                         g.Change(r.Rack_z, r.Rack_colum, r.Rack_row, r.Rack_state, r.Rack_id);
                     }
                 }
             }
             Thread.Sleep(sleepTime);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// Function to save new rack
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RackBll  BllRack  = new RackBll();
         RackInfo InfoRack = new RackInfo();
         InfoRack.RackName  = txtRackName.Text.Trim();
         InfoRack.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         InfoRack.Narration = txtNarration.Text.Trim();
         InfoRack.ExtraDate = DateTime.Now;
         InfoRack.Extra1    = string.Empty;
         InfoRack.Extra2    = string.Empty;
         decimal decGodounId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         if (BllRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false)
         {
             decIdForOtherForms = BllRack.RackAdd(InfoRack);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage(" Rack name already exist");
             txtRackName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to edit the existing rack
 /// </summary>
 public void EditFunction()
 {
     try
     {
         RackBll  BllRack  = new RackBll();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         rackInfo.RackId    = decRackId;
         if (txtRackName.Text != strRackName)
         {
             if (CheckExistenceOfRackName() == false)
             {
                 if (BllRack.RackEdit(rackInfo))
                 {
                     Messages.UpdatedMessage();
                     Clear();
                 }
             }
             else
             {
                 Messages.InformationMessage("Already exists");
                 txtRackName.Focus();
             }
         }
         else if (rackInfo.RackId == 1)
         {
             Messages.InformationMessage("Cannot update");
             Clear();
             txtRackName.Focus();
         }
         else
         {
             if (BllRack.RackEdit(rackInfo))
             {
                 Messages.UpdatedMessage();
                 Clear();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to fill all rack in datagridview
        /// </summary>
        public void GridFill()
        {
            try
            {
                RackBll          BllRack     = new RackBll();
                List <DataTable> listObjRack = new List <DataTable>();

                listObjRack        = BllRack.RackSearch(txtRackNameSearch.Text.Trim(), cmbGodownSearch.Text.ToString());
                dgvRack.DataSource = listObjRack[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show("R5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #8
0
 /// <summary>
 /// Function to Save Rack
 /// </summary>
 public void RackAddCurrespondingtoGodown()
 {
     try
     {
         RackBll  BllRack  = new RackBll();
         RackInfo infoRack = new RackInfo();
         infoRack.RackName  = "NA";
         infoRack.GodownId  = decIdForOtherForms;
         infoRack.Narration = string.Empty;
         infoRack.Extra1    = string.Empty;
         infoRack.Extra2    = string.Empty;
         infoRack.ExtraDate = DateTime.Now;
         BllRack.RackAdd(infoRack);
     }
     catch (Exception ex)
     {
         MessageBox.Show("G3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackBll          BllRack = new RackBll();
         List <DataTable> listObj = new List <DataTable>();
         if (cmbGodown.SelectedValue.ToString() != "System.Data.DataRowView")
         {
             listObj               = BllRack.RackFillForStock(Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
             cmbRack.DataSource    = listObj;
             cmbRack.DisplayMember = "rackName";
             cmbRack.ValueMember   = "rackId";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ST:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill rack combobox
 /// </summary>
 public void RackComboFill()
 {
     try
     {
         RackBll          BllRack = new RackBll();
         List <DataTable> listObj = new List <DataTable>();
         listObj = BllRack.RackViewAll();
         DataRow dr = listObj[0].NewRow();
         dr["rackName"] = "All";
         dr["rackId"]   = 0;
         listObj[0].Rows.InsertAt(dr, 0);
         cmbRack.DataSource    = listObj[0];
         cmbRack.DisplayMember = "rackName";
         cmbRack.ValueMember   = "rackId";
     }
     catch (Exception ex)
     {
         MessageBox.Show("SE:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to delete a Rack
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         RackBll BllRack = new RackBll();
         if (BllRack.RackDeleteReference(decRackId) <= 0)
         {
             Messages.ReferenceExistsMessage();
         }
         else
         {
             Clear();
             btnSave.Text = "Save";
             Messages.DeletedMessage();
             GridFill();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("R39:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to check rack name alredy exist or not
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfRackName()
        {
            bool isExist = false;

            try
            {
                RackBll BllRack = new RackBll();
                isExist = BllRack.RackCheckExistence(txtRackName.Text.Trim(), 0, Convert.ToDecimal(cmbGodown.SelectedValue.ToString()));
                if (isExist)
                {
                    string strRackNames = txtRackName.Text.Trim();
                    if (strRackNames.ToLower() == strRackName.ToLower())
                    {
                        isExist = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("R6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isExist);
        }
        private void setDdjData(CGKddj lastddj, CGKddj thisddj, int[] xmlIndex, int DdjId)
        {
            int DDJXmlIndex_state        = xmlIndex[0];
            int DDJXmlIndex_tgt          = xmlIndex[1];
            int DDJXmlIndex_source       = xmlIndex[2];
            int DDJXmlIndex_forktgt      = xmlIndex[3];
            int DDJXmlIndex_platformtgt  = xmlIndex[4];
            int DDJXmlIndex_pallertstate = xmlIndex[5];

            //堆垛机去取托盘的时候高亮显示目标托盘
            Rack r = getRackIdByModel(lastddj, thisddj, DdjId);

            if (r != null)
            {
                RackBll rb = new RackBll();
                rb.InsertRack(r);
            }
            lastddj = setOutModelDdj(lastddj);
            thisddj = setOutModelDdj(thisddj);


            if (lastddj == null)
            {
                if (thisddj.CGKddj_current == thisddj.CGKddj_tgt)
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_source, thisddj.CGKddj_tgt);
                }
                else
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_source, thisddj.CGKddj_source);
                }
                ComTCPLib.SetOutputAsUINT(1, DDJXmlIndex_state, thisddj.CGKddj_state);
                ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_tgt, thisddj.CGKddj_tgt);
                ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_forktgt, thisddj.CGKddj_forktgt);
                ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_platformtgt, thisddj.CGKddj_platformtgt);
                ComTCPLib.SetOutputAsUINT(1, DDJXmlIndex_pallertstate, thisddj.CGKddj_pallertstate);
            }
            else if (!thisddj.Equals(lastddj))
            {
                if (thisddj.CGKddj_current == thisddj.CGKddj_tgt)
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_source, thisddj.CGKddj_tgt);
                }
                else
                {
                    if (thisddj.CGKddj_source != lastddj.CGKddj_source)
                    {
                        ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_source, thisddj.CGKddj_source);
                    }
                }
                if (thisddj.CGKddj_state != lastddj.CGKddj_state)
                {
                    ComTCPLib.SetOutputAsUINT(1, DDJXmlIndex_state, thisddj.CGKddj_state);
                }
                if (thisddj.CGKddj_tgt != lastddj.CGKddj_tgt)
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_tgt, thisddj.CGKddj_tgt);
                }
                if (thisddj.CGKddj_forktgt != lastddj.CGKddj_forktgt)
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_forktgt, thisddj.CGKddj_forktgt);
                }
                if (thisddj.CGKddj_platformtgt != lastddj.CGKddj_platformtgt)
                {
                    ComTCPLib.SetOutputAsREAL32(1, DDJXmlIndex_platformtgt, thisddj.CGKddj_platformtgt);
                }
                if (thisddj.CGKddj_pallertstate != lastddj.CGKddj_pallertstate)
                {
                    ComTCPLib.SetOutputAsUINT(1, DDJXmlIndex_pallertstate, thisddj.CGKddj_pallertstate);
                }
            }
        }