Ejemplo n.º 1
0
        public bool stepIn(LotReaderDeviceElement lotinfo, Lot lot, LotReaderFinishedArgs Args, TrackInParameter p1)
        {
            bool flag = true;
            //进站
            MethodReturnResult result = null;

            using (WipEngineerServiceClient client = new WipEngineerServiceClient())
            {
                if (lot.StateFlag == EnumLotState.WaitTrackIn)
                {
                    result = client.TrackInLot(p1);
                    if (result.Code == 0)
                    {
                        Args.TransferMsg = string.Format("批次:{0} 进站成功", lotinfo.LotNumber);
                        flag             = true;
                    }
                    else
                    {
                        Args.TransferMsg = string.Format("批次:{0} 进站失败", lotinfo.LotNumber);
                        //存储读头扫码结果信息
                        Args.TransferMsg = Args.TransferMsg + "-------------";
                        if (OnLotReaderFinished != null)
                        {
                            CommonFun.eventInvoket(() => { OnLotReaderFinished(this, Args); });
                        }
                        flag = false;
                    }
                }
            }
            ErrorLog(null, Args.TransferMsg);
            return(flag);
        }
Ejemplo n.º 2
0
 void DataTransferFinished(object sender, LotReaderFinishedArgs e)
 {
     if (queue.Count > 0)
     {
         if (richTextBox1.TextLength > 2000)
         {
             richTextBox1.Text = "";
         }
         richTextBox1.Text = queue.Peek().ReaderIP + "—'批号:" + queue.Peek().LotNumber + "'\r\n" + e.TransferMsg + "\r\n" + richTextBox1.Text;
     }
 }
Ejemplo n.º 3
0
        public void Execute(LotReaderDeviceElement lotinfo)
        {
            LotReaderFinishedArgs Args = new LotReaderFinishedArgs();

            try
            {
                if (lotinfo.LotNumber.Length < 3)
                {
                    Args.TransferMsg = string.Format("未扫到码,车间{0}线别{1}"
                                                     , lotinfo.WorkShop
                                                     , lotinfo.LineCode);


                    Args.TransferMsg = Args.TransferMsg + "-------------";
                    ErrorLog(null, Args.TransferMsg);
                    if (OnLotReaderFinished != null)
                    {
                        CommonFun.eventInvoket(() => { OnLotReaderFinished(this, Args); });
                    }
                }
                else
                {
                    //根据条码获取批次信息
                    Lot lot = null;
                    MethodReturnResult resultLot = new MethodReturnResult();
                    try
                    {
                        string lotNumber = lotinfo.LotNumber.ToUpper();
                        lot = GetLot(lotNumber);
                        if (lot == null)
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        resultLot.Code    = 1000;
                        resultLot.Message = ex.Message;
                        resultLot.Detail  = ex.ToString();
                        ErrorLog(ex, resultLot.Message);
                    }



                    //判断进出站状态、设备及工序
                    TrackInParameter pIn = new TrackInParameter()
                    {
                        Creator            = "system",
                        RouteOperationName = "",
                        LineCode           = lotinfo.LineCode,
                        LotNumbers         = new List <string>(),
                        OperateComputer    = lotinfo.ReaderIP,
                        Operator           = "system",
                        EquipmentCode      = ""
                    };
                    pIn.LotNumbers.Add(lotinfo.LotNumber);
                    TrackOutParameter pOut = new TrackOutParameter()
                    {
                        Creator            = "system",
                        RouteOperationName = "",
                        LineCode           = lotinfo.LineCode,
                        LotNumbers         = new List <string>(),
                        OperateComputer    = lotinfo.ReaderIP,
                        Operator           = "system",
                        EquipmentCode      = ""
                    };
                    pOut.LotNumbers.Add(lotinfo.LotNumber);
                    //工序,状态
                    if (lot.RouteStepName == lotinfo.FirstStepCode)
                    {
                        if (lot.StateFlag == EnumLotState.WaitTrackIn)
                        {
                            //第一站进站赋值进站属性
                            pIn.RouteOperationName = lotinfo.FirstStepCode;
                            pIn.EquipmentCode      = lotinfo.FirstEquipmentCode;
                            if (stepIn(lotinfo, lot, Args, pIn))//第一站进站
                            {
                                //第一站出站赋值出站属性
                                pOut.RouteOperationName = lotinfo.FirstStepCode;
                                pOut.EquipmentCode      = lotinfo.FirstEquipmentCode;
                                lot.StateFlag           = EnumLotState.WaitTrackOut;
                                if (stepOut(lotinfo, lot, Args, pOut))//第一站出站
                                {
                                    //第二站进站赋值进站属性
                                    pIn.RouteOperationName = lotinfo.SecondStepCode;
                                    pIn.EquipmentCode      = lotinfo.SecondEquipmentCode;

                                    lot.StateFlag = EnumLotState.WaitTrackIn;
                                    if (stepIn(lotinfo, lot, Args, pIn)) //第二站进站
                                    {
                                        //第二站出站赋值进站属性
                                        pOut.RouteOperationName = lotinfo.SecondStepCode;
                                        pOut.EquipmentCode      = lotinfo.SecondEquipmentCode;

                                        lot.RouteStepName = lotinfo.SecondStepCode;
                                        lot.EquipmentCode = lotinfo.SecondEquipmentCode;
                                        lot.StateFlag     = EnumLotState.WaitTrackOut;
                                        if (stepOut(lotinfo, lot, Args, pOut))//第二站出站
                                        {
                                            //启线
                                            //m_retFlag = m_soap.SetLineState(m_workShopId, m_flowId, m_flowSubId, 1);
                                            //StartLine(lotinfo.WorkShopId, lotinfo.FlowId, lotinfo.FlowSubId, lotinfo.LineCode, lotinfo.SecondEquipmentCode);
                                        }
                                    }
                                }
                            }
                        }
                        else if (lot.StateFlag == EnumLotState.WaitTrackOut)
                        {
                            //第一站出站赋值出站属性
                            pOut.RouteOperationName = lotinfo.FirstStepCode;
                            pOut.EquipmentCode      = lotinfo.FirstEquipmentCode;

                            lot.StateFlag = EnumLotState.WaitTrackOut;
                            if (stepOut(lotinfo, lot, Args, pOut))//第一站出站
                            {
                                //第二站进站赋值进站属性
                                pIn.RouteOperationName = lotinfo.SecondStepCode;
                                pIn.EquipmentCode      = lotinfo.SecondEquipmentCode;

                                lot.StateFlag = EnumLotState.WaitTrackIn;
                                if (stepIn(lotinfo, lot, Args, pIn)) //第二站进站
                                {
                                    //第二站出站赋值进站属性
                                    pOut.RouteOperationName = lotinfo.SecondStepCode;
                                    pOut.EquipmentCode      = lotinfo.SecondEquipmentCode;

                                    lot.RouteStepName = lotinfo.SecondStepCode;
                                    lot.EquipmentCode = lotinfo.SecondEquipmentCode;
                                    lot.StateFlag     = EnumLotState.WaitTrackOut;
                                    if (stepOut(lotinfo, lot, Args, pOut))//第二站出站
                                    {
                                        //启线
                                        //m_retFlag = m_soap.SetLineState(m_workShopId, m_flowId, m_flowSubId, 1);
                                        //StartLine(lotinfo.WorkShopId, lotinfo.FlowId, lotinfo.FlowSubId, lotinfo.LineCode, lotinfo.SecondEquipmentCode);
                                    }
                                }
                            }
                        }
                    }
                    else if (lot.RouteStepName == lotinfo.SecondStepCode)
                    {
                        if (lot.StateFlag == EnumLotState.WaitTrackIn)
                        {
                            //第二站进站赋值进站属性
                            pIn.RouteOperationName = lotinfo.SecondStepCode;
                            pIn.EquipmentCode      = lotinfo.SecondEquipmentCode;

                            lot.StateFlag = EnumLotState.WaitTrackIn;
                            if (stepIn(lotinfo, lot, Args, pIn)) //第二站进站
                            {
                                //第二站出站赋值进站属性
                                pOut.RouteOperationName = lotinfo.SecondStepCode;
                                pOut.EquipmentCode      = lotinfo.SecondEquipmentCode;

                                lot.RouteStepName = lotinfo.SecondStepCode;
                                lot.EquipmentCode = lotinfo.SecondEquipmentCode;
                                lot.StateFlag     = EnumLotState.WaitTrackOut;
                                if (stepOut(lotinfo, lot, Args, pOut))//第二站出站
                                {
                                    //启线
                                    //m_retFlag = m_soap.SetLineState(m_workShopId, m_flowId, m_flowSubId, 1);
                                    //StartLine(lotinfo.WorkShopId, lotinfo.FlowId, lotinfo.FlowSubId, lotinfo.LineCode, lotinfo.SecondEquipmentCode);
                                }
                            }
                        }
                        if (lot.StateFlag == EnumLotState.WaitTrackOut)
                        {
                            //第二站出站赋值进站属性
                            pOut.RouteOperationName = lotinfo.SecondStepCode;
                            pOut.EquipmentCode      = lotinfo.SecondEquipmentCode;

                            lot.RouteStepName = lotinfo.SecondStepCode;
                            lot.EquipmentCode = lotinfo.SecondEquipmentCode;
                            lot.StateFlag     = EnumLotState.WaitTrackOut;
                            if (stepOut(lotinfo, lot, Args, pOut))//第二站出站
                            {
                                string msg = null;
                                //启线
                                //m_retFlag = m_soap.SetLineState(m_workShopId, m_flowId, m_flowSubId, 1);
                                //StartLine(lotinfo.WorkShopId, lotinfo.FlowId, lotinfo.FlowSubId, lotinfo.LineCode, lotinfo.SecondEquipmentCode);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Args.TransferMsg = Args.TransferMsg + "-------------" + ex;
                ErrorLog(ex, Args.TransferMsg);
            }
        }
Ejemplo n.º 4
0
        public bool stepOut(LotReaderDeviceElement lotinfo, Lot lot, LotReaderFinishedArgs Args, TrackOutParameter p)
        {
            bool flag = true;
            //出站
            MethodReturnResult result = null;

            using (WipEngineerServiceClient client = new WipEngineerServiceClient())
            {
                if (lot.StateFlag == EnumLotState.WaitTrackOut)
                {
                    IDictionary <string, IList <TransactionParameter> > dicParams = new Dictionary <string, IList <TransactionParameter> >();
                    //获取工序参数列表。
                    IList <RouteStepParameter> lstRouteStepParameter = GetParameterList(lot.RouteName, lot.RouteStepName, EnumLotState.WaitTrackOut);

                    if (lstRouteStepParameter != null)
                    {
                        #region 组织批次附加代码
                        foreach (RouteStepParameter item in lstRouteStepParameter)
                        {
                            if (!dicParams.ContainsKey(lot.Key))
                            {
                                dicParams.Add(lot.Key, new List <TransactionParameter>());
                            }
                            string val = null;
                            if (item.Key.ParameterName == "电池片批号" || item.Key.ParameterName == "电池片小包装号")
                            {
                                val = GetCellLotList(item.MaterialType, lot.LineCode, lot.RouteStepName, lot.OrderNumber, p.EquipmentCode);
                            }
                            else
                            {
                                val = GetParameterLotList(item.MaterialType, lot.LineCode, lot.RouteStepName, lot.OrderNumber, p.EquipmentCode);
                            }
                            TransactionParameter tp = new TransactionParameter()
                            {
                                Index = item.ParamIndex,
                                Name  = item.Key.ParameterName,
                                Value = val
                            };
                            dicParams[lot.Key].Add(tp);
                        }

                        p.Paramters = dicParams;
                        #endregion
                    }

                    MethodReturnResult resultTrackOut = client.TrackOutLot(p);
                    if (resultTrackOut.Code == 0)
                    {
                        Args.TransferMsg = string.Format("批次:{0} {1}出站成功", lotinfo.LotNumber, p.RouteOperationName);
                        flag             = true;
                    }
                    else
                    {
                        flag             = false;
                        Args.TransferMsg = string.Format("批次:{0} {1}出站失败 =>  ", lotinfo.LotNumber, p.RouteOperationName) + resultTrackOut.Message;
                    }
                    //存储读头扫码结果信息

                    Args.TransferMsg = Args.TransferMsg + "-------------";
                    if (OnLotReaderFinished != null)
                    {
                        CommonFun.eventInvoket(() => { OnLotReaderFinished(this, Args); });
                    }
                }
            }
            ErrorLog(null, Args.TransferMsg);
            return(flag);
        }