示例#1
0
        //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;
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        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);
        }