Ejemplo n.º 1
0
        public void LoadLineBoxProcess()
        {
            LineBoxProcessList lineboxprocesslist =
                LineBoxProcessList.GetList(ConfigurationSettings.AppSettings["Mode"].ToLower());

            try
            {
                OperateOpcAndSoft     operateOpcAndSoft = new OperateOpcAndSoft();
                Dictionary <int, int> putoutnums        = operateOpcAndSoft.GetPutOutNum();

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    if (putoutnums.ContainsKey(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)))
                    {
                        lineboxprocesslist[i].OUTQTY    = putoutnums[Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)];
                        lineboxprocesslist[i].REMAINQTY = lineboxprocesslist[i].NONQTY - lineboxprocesslist[i].OUTQTY;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            dgvLineboxprocess.DataSource = lineboxprocesslist;
            footSumLabel1.Sumdata();
        }
Ejemplo n.º 2
0
        private void LoadCig()
        {
            LineBoxProcessList lineBoxProcessList = LineBoxProcessList.GetList(ConfigurationSettings.AppSettings["Mode"].ToLower());

            foreach (LineBoxProcessInfo lineBoxProcessInfo in lineBoxProcessList)
            {
                if (panelExs.ContainsKey(lineBoxProcessInfo.LINEBOXCODE))
                {
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text  = lineBoxProcessInfo.LINEBOXNAME + Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += lineBoxProcessInfo.CigName + Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += lineBoxProcessInfo.FINQTY + "|" + lineBoxProcessInfo.NONQTY +
                                                                     Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += Environment.NewLine;
                    panelExs[lineBoxProcessInfo.LINEBOXCODE].Text += lineBoxProcessInfo.TOTQTY;
                }
            }
        }
Ejemplo n.º 3
0
        public bool SendPD()
        {
            try
            {
                Dictionary <int, int> senDictionary = new Dictionary <int, int>();

                LineBoxProcessList lineboxprocesslist = LineBoxProcessList.GetList("盘点");

                OperateOpcAndSoft     operateOpcAndSoft = new OperateOpcAndSoft();
                Dictionary <int, int> putoutnums        = operateOpcAndSoft.GetPutOutNum();

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    if (putoutnums.ContainsKey(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)))
                    {
                        lineboxprocesslist[i].OUTQTY = putoutnums[Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE)];
                        lineboxprocesslist[i].NONQTY = (lineboxprocesslist[i].NONQTY - lineboxprocesslist[i].OUTQTY);
                    }

                    //if (i == 9 || i == 11 || i == 21 || i == 23 || i == 33 || i == 36 || i == 45 || i == 47 || i == 57 || i == 59 || i == 69 || i == 71 || i == 81 || i == 83)
                    //将双仓的数量与前一个单仓相加
                    if (AppUtil.Put2LineBox.Contains(lineboxprocesslist[i].LINEBOXCODE))
                    {
                        lineboxprocesslist[i - 1].NONQTY = lineboxprocesslist[i - 1].NONQTY + lineboxprocesslist[i].NONQTY;
                    }
                }

                for (int i = 0; i < lineboxprocesslist.Count; i++)
                {
                    senDictionary.Add(Convert.ToInt32(lineboxprocesslist[i].LINEBOXCODE), lineboxprocesslist[i].NONQTY);
                }

                NixielightSDK.SendByMODBUS(senDictionary);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 当天卧式仓道分拣量写入地址区,用于PLC将最后剩余的卷烟打出
        /// </summary>
        /// <returns>成功返回true,失败返回false</returns>
        public PlCResult OutDataToTaskAddress()
        {
            PlCResult plCResult = new PlCResult();

            try
            {
                bool isRun = true;
                LineBoxProcessList lineboxlist = LineBoxProcessList.GetList();


                if (lineboxlist == null)
                {
                    plCResult.Succeed   = false;
                    plCResult.Exception = "无法获取分拣通道机分拣总量!";
                    return(plCResult);
                }

                foreach (LineBoxProcessInfo lineboxprocessinfo in lineboxlist)
                {
                    if (isRun)
                    {
                        if (lineboxprocessinfo.LINEBOXCODE == "85")
                        {
                            PlcValue writeValue = new PlcValue();
                            writeValue.Value = lineboxprocessinfo.TOTQTY;
                            isRun            = plc.SetPlcValue(ItemListEnum.db51Int10, writeValue);
                        }
                        if (lineboxprocessinfo.LINEBOXCODE == "86")
                        {
                            PlcValue writeValue = new PlcValue();
                            writeValue.Value = lineboxprocessinfo.TOTQTY;
                            isRun            = plc.SetPlcValue(ItemListEnum.db51Int12, writeValue);
                        }
                        if (lineboxprocessinfo.LINEBOXCODE == "87")
                        {
                            PlcValue writeValue = new PlcValue();
                            writeValue.Value = lineboxprocessinfo.TOTQTY;
                            isRun            = plc.SetPlcValue(ItemListEnum.db51Int14, writeValue);
                        }
                        if (lineboxprocessinfo.LINEBOXCODE == "88")
                        {
                            PlcValue writeValue = new PlcValue();
                            writeValue.Value = lineboxprocessinfo.TOTQTY;
                            isRun            = plc.SetPlcValue(ItemListEnum.db51Int16, writeValue);
                        }
                        if (lineboxprocessinfo.LINEBOXCODE == "89")
                        {
                            PlcValue writeValue = new PlcValue();
                            writeValue.Value = lineboxprocessinfo.TOTQTY;
                            isRun            = plc.SetPlcValue(ItemListEnum.db51Int18, writeValue);
                        }
                    }
                }

                plCResult.Succeed = isRun;

                if (!isRun)
                {
                    plCResult.Exception = "PLC分拣通道机分拣总量写入失败!";
                    return(plCResult);
                }
                else
                {
                    //写日志
                    MonitorLog monitorLog = MonitorLog.NewMonitorLog();
                    monitorLog.LOGNAME = "PLC分拣通道机分拣总量下达";
                    foreach (LineBoxProcessInfo lineboxprocessinfo in lineboxlist)
                    {
                        if (Convert.ToInt16(lineboxprocessinfo.LINEBOXCODE) >= 67)
                        {
                            monitorLog.LOGINFO += " 通道:" + lineboxprocessinfo.LINEBOXCODE + " - 数量" + lineboxprocessinfo.TOTQTY + "; ";
                        }
                    }
                    monitorLog.LOGLOCATION = "PLC";
                    monitorLog.LOGTYPE     = 0;
                    monitorLog.Save();
                    return(plCResult);
                }
            }
            catch (Exception ex)
            {
                plCResult.Succeed   = false;
                plCResult.Exception = ex.Message;
                return(plCResult);
            }
        }
Ejemplo n.º 5
0
 private void button2_Click(object sender, EventArgs e)
 {
     dgvLineboxprocess.DataSource = LineBoxProcessList.GetList();
     footSumLabel1.Sumdata();
 }
Ejemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     dgvLineboxprocess.DataSource = LineBoxProcessList.GetList(ConfigurationSettings.AppSettings["Mode"].ToLower());
     footSumLabel1.Sumdata();
 }