Beispiel #1
0
        //检查批次信息,是否已生产完工,是否存在的产品代码
        private bool CheckLot(string lotCode)
        {
            #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.ucLabelLotCode.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_LEN_CHECK_FAIL"), false);
            //        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.ucLabelLotCode.Value, new UserControl.Message(MessageType.Error, "$CS_LOT_NO_FCHAR_CHECK_FAIL"), false);
            //        return false;
            //    }
            //}
            #endregion

            // Get Simulation Info
            object[] objSimulations = m_DataCollectFacade.QueryLotSimulationReport(lotCode);
            if (objSimulations == null)
            {
                ShowMessage("$LotNoProductInfo");
                return(false);
            }

            LotSimulationReport objSimulation = objSimulations[0] as LotSimulationReport;
            if (!objSimulation.LotStatus.Equals(LotStatusForMO2LotLink.LOTSTATUS_USE))//使用的批才可包装
            {
                ShowMessage("$LotIsInvalid");
                return(false);
            }
            if (!objSimulation.IsComplete.Equals("1"))//未完工
            {
                ShowMessage("$LotIsUnfinished");
                return(false);
            }

            //check批次是否重复包装
            decimal cartonQty = m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper());
            if (cartonQty >= objSimulation.LotQty)
            {
                ShowMessage("$CS_LOT_HAS_PACKED");
                return(false);
            }

            // Get Item Info
            object item = m_ItemFacade.GetItem(objSimulation.ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
            if (item == null)
            {
                ShowMessage("$Error_ItemCode_NotExist $Domain_Item=" + objSimulation.ItemCode);
                return(false);
            }
            m_CartonCapacity = (item as Item).ItemCartonQty;

            return(true);
        }
Beispiel #2
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);
        }