//private void RefreshCartonNumber()
        //{
        //    string cartonNo = FormatHelper.CleanString(this.ucLabelCartonNo.Value.Trim().ToUpper());
        //    CARTONINFO objCartonInfo = (new Package.PackageFacade(DataProvider)).GetCARTONINFO(cartonNo) as CARTONINFO;
        //    //Refresh CartonCapacity and Lot Capacity
        //    if (objCartonInfo != null)
        //    {
        //        this.ucLabelCartonCollected.Value = objCartonInfo.COLLECTED.ToString();
        //    }
        //    else
        //    {
        //        this.ucLabelCartonCollected.Value = "";
        //    }

        //    //Check
        //    if (objCartonInfo != null && objCartonInfo.CAPACITY == objCartonInfo.COLLECTED)
        //    {
        //        ucMessage.AddEx(this._FunctionName, "包装箱号: " + this.ucLabelCartonNo.Value, new UserControl.Message(MessageType.Normal, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"), false);
        //        this.m_FlowControl = 1;
        //        this.SetInputMessageByFlowControl();
        //        return;
        //    }

        //    this.m_FlowControl = 3;
        //    this.SetInputMessageByFlowControl();
        //    //End Add
        //}

        public void GetData(string cartonNo)
        {
            PackageFacade pf            = new PackageFacade(DataProvider);
            CARTONINFO    objCartonInfo = pf.GetCARTONINFO(cartonNo) as CARTONINFO;

            if (objCartonInfo != null)
            {
                this.cartonCollection           = new CartonCollection();
                this.cartonCollection.CAPACITY  = objCartonInfo.CAPACITY;
                this.cartonCollection.COLLECTED = objCartonInfo.COLLECTED;

                object[] objs = pf.GetCarton2RCARDByCartonNO(cartonNo);
                if (objs != null)
                {
                    this.carton2RCARD = new Carton2RCARD[objs.Length];
                    for (int i = 0; i < objs.Length; i++)
                    {
                        this.carton2RCARD[i] = (Carton2RCARD)objs[i];
                    }
                }
                if (this.carton2RCARD != null)
                {
                    this.cartonCollection.MOCode = this.carton2RCARD[0].MOCode;
                    object obj = pf.GetItemCodeByMOCode(this.carton2RCARD[0].MOCode);
                    if (obj != null)
                    {
                        this.cartonCollection.ItemCode        = ((CartonCollection)obj).ItemCode;
                        this.cartonCollection.ItemDescription = ((CartonCollection)obj).ItemDescription;
                        ItemFacade   itemFacade   = new ItemFacade(this.DataProvider);
                        Item2SNCheck item2SNCheck = (Item2SNCheck)itemFacade.GetItem2SNCheck(((CartonCollection)obj).ItemCode, ItemCheckType.ItemCheckType_SERIAL);
                        if (item2SNCheck != null)
                        {
                            if (item2SNCheck.SNLength > 0)
                            {
                                chkCardLen.Checked = true;
                                chkCardLen.Value   = item2SNCheck.SNLength.ToString();
                            }

                            if (!string.IsNullOrEmpty(item2SNCheck.SNPrefix))
                            {
                                chkCardFChar.Checked = true;
                                chkCardFChar.Value   = item2SNCheck.SNPrefix;
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private bool CartonPack()
        {
            if (this.ucLabelCartonNoForLot.Value.Trim() == "")
            {
                this.m_FlowControl = 2;
                this.SetInputMessageByFlowControl();
                return(false);
            }
            string cartonNo = FormatHelper.CleanString(this.ucLabelCartonNoForLot.Value.Trim().ToUpper());

            if (this.ucLabelLotCode.Value.Trim() == "")
            {
                m_FlowControl = 1;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            //ucMessage.AddWithoutEnter("<<");
            //ucMessage.AddBoldText(ucLabelCartonNoForLot.Value.Trim());

            if (!CheckCarton(cartonNo))
            {
                this.m_FlowControl = 4;
                this.SetInputMessageByFlowControl();
                return(false);
            }
            string lotCode = FormatHelper.CleanString(ucLabelLotCode.Value.Trim().ToUpper());

            LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport;
            Item   item      = m_ItemFacade.GetItem(objSimulation.ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item;
            string newMOCode = objSimulation.MOCode.Trim().ToUpper();

            //判断序列号是否已经装过箱,应该装在之前的箱中
            //OQCFacade _OQCFacade = new OQCFacade(this.DataProvider);
            //object lot2Card = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", "");
            //if(lot2Card != null)
            //{
            //    if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString())
            //    {
            //        ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false);
            //        this.m_FlowControl = 3;
            //        this.SetInputMessageByFlowControl();
            //        return false;
            //    }
            //}

            #region check批次
            if (!CheckLot(lotCode))
            {
                this.m_FlowControl = 3;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品
            object[] objects = m_PackageFacade.GetCarton2LotByCartonNO(cartonNo);
            if (objects != null)
            {
                string oldMOCode = ((Carton2Lot)objects[0]).MOCode.Trim().ToUpper();
                if (newMOCode != oldMOCode)
                {
                    ShowMessage("$OneCarton_OneMoCode");
                    this.m_FlowControl = 4;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
                object obj = m_PackageFacade.GetItemCodeByMOCode(oldMOCode);
                if (obj != null)
                {
                    if (item.ItemCode != ((CartonCollection)obj).ItemCode)
                    {
                        ShowMessage("$OneCarton_OneProduct");
                        this.m_FlowControl = 4;
                        this.SetInputMessageByFlowControl();
                        return(false);
                    }
                }
            }
            #endregion
            this.AfterToSave();
            return(true);
        }
Beispiel #3
0
        private bool CartonPack()
        {
            if (this.ucLabelLotCodeForCarton.Value.Trim() == "")
            {
                this.SetInputMessageByFlowControl();
                return(false);
            }
            string lotCode = FormatHelper.CleanString(this.ucLabelLotCodeForCarton.Value.Trim().ToUpper());

            if (this.ucLabelCartonNo.Value.Trim() == "")
            {
                m_FlowControl = 1;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            #region LotCode Length Check
            //if (chkLotCodeLen.Checked && chkLotCodeLen.Value.Trim().Length > 0)
            //{
            //    if (lotCode.Length != Convert.ToInt32(chkLotCodeLen.Value.Replace("-", "")))
            //    {
            //        ucMessage.AddEx(this.m_FunctionName, "批次条码: " + this.ucLabelLotCodeForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_LEN_CHECK_FAIL"), false);
            //        this.m_FlowControl = 3;
            //        this.SetInputMessageByFlowControl();
            //        return false;
            //    }
            //}
            #endregion

            #region LotCode First Char Check
            //if (chkLotCodeFChar.Checked && chkLotCodeFChar.Value.Trim().Length > 0)
            //{
            //    if (lotCode.IndexOf(chkLotCodeFChar.Value.Trim()) != 0)
            //    {
            //        ucMessage.AddEx(this.m_FunctionName, "批次条码: " + this.ucLabelLotCodeForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_FCHAR_CHECK_FAIL"), false);
            //        this.m_FlowControl = 3;
            //        this.SetInputMessageByFlowControl();
            //        return false;
            //    }
            //}
            #endregion

            //ucMessage.AddWithoutEnter("<<");
            //ucMessage.AddBoldText(ucLabelLotCodeForCarton.Value.Trim());

            if (!CheckLot(lotCode))
            {
                this.m_FlowControl = 3;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport;
            Item   item      = m_ItemFacade.GetItem(objSimulation.ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item;
            string newMOCode = objSimulation.MOCode.Trim().ToUpper();

            string cartonNo = FormatHelper.CleanString(ucLabelCartonNo.Value.Trim().ToUpper());
            //判断序列号是否已经装过箱,应该装在之前的箱中
            //OQCFacade _OQCFacade = new OQCFacade(this.DataProvider);
            //object lot2Card = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", "");
            //if(lot2Card != null)
            //{
            //    if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString())
            //    {
            //        ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false);
            //        this.m_FlowControl = 3;
            //        this.SetInputMessageByFlowControl();
            //        return false;
            //    }
            //}

            #region check箱
            if (!CheckCarton(cartonNo))
            {
                return(false);
            }

            //check产品序列号是否重复包装
            decimal cartonQty = m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper());
            if (cartonQty >= objSimulation.LotQty)
            {
                ShowMessage("$CS_LOT_HAS_PACKED");
                this.m_FlowControl = 3;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品
            object[] objects = m_PackageFacade.GetCarton2LotByCartonNO(cartonNo);
            if (objects != null)
            {
                string oldMOCode = ((Carton2Lot)objects[0]).MOCode.Trim().ToUpper();
                if (newMOCode != oldMOCode)
                {
                    ShowMessage("$OneCarton_OneMoCode");
                    this.m_FlowControl = 3;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
                object obj = m_PackageFacade.GetItemCodeByMOCode(oldMOCode);
                if (obj != null)
                {
                    if (item.ItemCode != ((CartonCollection)obj).ItemCode)
                    {
                        ShowMessage("$OneCarton_OneProduct");
                        this.m_FlowControl = 3;
                        this.SetInputMessageByFlowControl();
                        return(false);
                    }
                }
            }
            #endregion
            // 包装动作
            this.AfterToSave();
            return(true);
        }
        private bool CartonPack()
        {
            if (this.ucLabelRCardForCarton.Value.Trim() == "")
            {
                this.SetInputMessageByFlowControl();
                return(false);
            }
            string rcard = FormatHelper.CleanString(this.ucLabelRCardForCarton.Value.Trim().ToUpper());

            //转换成起始序列号
            if (_face == null)
            {
                _face = new DataCollectFacade(this.DataProvider);
            }
            string sourceCard = _face.GetSourceCard(rcard, string.Empty);

            //end

            if (this.ucLabelCartonNo.Value.Trim() == "")
            {
                m_FlowControl = 1;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            #region RCard Length Check
            if (chkCardLen.Checked && chkCardLen.Value.Trim().Length > 0)
            {
                if (rcard.Length != Convert.ToInt32(chkCardLen.Value.Replace("-", "")))
                {
                    ucMessage.AddEx(this._FunctionName, "$CS_RCARD: " + this.ucLabelRCardForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_CARD_NO_LEN_CHECK_FAIL"), false);
                    this.m_FlowControl = 3;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
            }
            #endregion
            #region RCard First Char Check
            if (chkCardFChar.Checked && chkCardFChar.Value.Trim().Length > 0)
            {
                if (rcard.IndexOf(chkCardFChar.Value.Trim()) != 0)
                {
                    ucMessage.AddEx(this._FunctionName, "$CS_RCARD: " + this.ucLabelRCardForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_CARD_NO_FCHAR_CHECK_FAIL"), false);
                    this.m_FlowControl = 3;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
            }
            #endregion

            ucMessage.AddWithoutEnter("<<");
            ucMessage.AddBoldText(ucLabelRCardForCarton.Value.Trim());

            if (!checkRcard(rcard, sourceCard))
            {
                this.m_FlowControl = 3;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            Simulation objSimulation = _face.GetSimulation(sourceCard.Trim().ToUpper()) as Simulation;
            string     lastAction    = objSimulation.LastAction.Trim();

            ItemFacade itemFacade = new ItemFacade(DataProvider);
            Item       item       = itemFacade.GetItem((objSimulation as Simulation).ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item;
            string     newMOCode  = objSimulation.MOCode.Trim().ToUpper();

            PackageFacade pf = new PackageFacade(DataProvider);
            //check产品序列号是否重复包装
            //object rcardobj = pf.GetCarton2RCARD("", sourceCard.Trim().ToUpper());
            object rcardobj = pf.GetCarton2RcardByRcard(sourceCard.Trim().ToUpper());
            if (rcardobj != null)
            {
                ucMessage.AddEx(this._FunctionName, "$CS_CARTON_NO: " + ((Carton2RCARD)rcardobj).CartonCode, new UserControl.Message(MessageType.Error, "$CS_CARD_HAS_PACKED"), false);
                this.m_FlowControl = 3;
                this.SetInputMessageByFlowControl();
                return(false);
            }

            string cartonNo = FormatHelper.CleanString(ucLabelCartonNo.Value.Trim().ToUpper());

            #region OQC检查
            //modified by lisa@2012-8-29
            //1,序列号是维修回流过来的,即属于未判定的LOT并且不属于任何小箱,应该装在之前的箱中。
            OQCFacade _OQCFacade     = new OQCFacade(this.DataProvider);
            object    lot2Card       = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", "");
            Boolean   blnCheckCarton = true;
            if (lot2Card != null)
            {
                OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot;
                if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting ||
                      oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing))
                {
                    if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString())
                    {
                        ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false);
                        this.m_FlowControl = 3;
                        this.SetInputMessageByFlowControl();
                        return(false);
                    }

                    if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo == ((OQCLot2Card)lot2Card).EAttribute1.ToString())
                    {
                        blnCheckCarton = false;
                    }
                }
            }

            //2,产品序列号是新的,或者是返工回来的,则不能放入已归属了Lot的小箱
            if (blnCheckCarton)
            {
                object objLot2Carton = _OQCFacade.GetLot2CartonByCartonNo(cartonNo);
                if (objLot2Carton != null)
                {
                    ucMessage.AddEx(this._FunctionName, "$CS_CARTON_NO: " + this.ucLabelCartonNo.Value, new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_OQC"), false);
                    this.m_FlowControl = 1;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
            }
            #endregion


            #region check箱
            if (!checkCarton(cartonNo))
            {
                return(false);
            }


            //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品
            object[] objects = pf.GetCarton2RCARDByCartonNO(cartonNo);
            if (objects != null)
            {
                string oldMOCode = ((Carton2RCARD)objects[0]).MOCode.Trim().ToUpper();
                if (newMOCode != oldMOCode)
                {
                    ucMessage.AddEx(this._FunctionName, "", new UserControl.Message(MessageType.Error, "$OneCarton_OneMoCode"), true);
                    this.m_FlowControl = 3;
                    this.SetInputMessageByFlowControl();
                    return(false);
                }
                object obj = pf.GetItemCodeByMOCode(oldMOCode);
                if (obj != null)
                {
                    if (item.ItemCode != ((CartonCollection)obj).ItemCode)
                    {
                        ucMessage.AddEx(this._FunctionName, "", new UserControl.Message(MessageType.Error, "$OneCarton_OneProduct"), true);
                        this.m_FlowControl = 3;
                        this.SetInputMessageByFlowControl();
                        return(false);
                    }
                }
            }
            #endregion
            // 包装动作
            this.AfterToSave();
            return(true);
        }