コード例 #1
0
        //批次装箱
        private bool AddSingleIDIntoCartonAndTry(string lotCode)
        {
            string cartonNo = FormatHelper.CleanString(this.ucLabelCartonNoForLot.Value);
            LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport;
            decimal             cartonQty     = 0;

            //if (messages.IsSuccess())
            //{
            if (cartonNo != string.Empty)
            {
                object objCarton = m_PackageFacade.GetCARTONINFO(cartonNo);

                if (objCarton != null)
                {
                    CARTONINFO carton = objCarton as CARTONINFO;
                    if (carton.CAPACITY <= carton.COLLECTED)
                    {
                        ShowMessage("$CARTON_ALREADY_FILL_OUT");
                        return(false);
                    }
                    else
                    {
                        //获得本次需要装箱的数量
                        cartonQty = GetCartonQty(carton.CAPACITY - carton.COLLECTED, m_CartonCapacity, objSimulation.LotQty - m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper()));
                        m_PackageFacade.UpdateCollected((carton as CARTONINFO).CARTONNO, cartonQty);
                    }
                }
                else if (cartonNo != String.Empty)
                {
                    object objExistCTN = m_PackageFacade.GetExistCARTONINFO(cartonNo);

                    if (objExistCTN != null)
                    {
                        ShowMessage("$CARTON_ALREADY_FULL_PlEASE_CHANGE");
                        return(false);
                    }
                    else
                    {
                        DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                        CARTONINFO carton     = new CARTONINFO();

                        //获得本次需要装箱的数量
                        cartonQty = GetCartonQty(m_CartonCapacity, m_CartonCapacity, objSimulation.LotQty - m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper()));

                        carton.CAPACITY    = m_CartonCapacity;
                        carton.COLLECTED   = cartonQty;
                        carton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                        carton.CARTONNO    = cartonNo;
                        carton.MUSER       = ApplicationService.Current().UserCode;
                        carton.EATTRIBUTE1 = "";
                        carton.MDATE       = dbDateTime.DBDate;
                        carton.MTIME       = dbDateTime.DBTime;

                        if (carton.CAPACITY == 0)
                        {
                            ShowMessage("$CS_PLEASE_MAINTEIN_ITEMCARTON $CS_Param_Lot =" + lotCode);
                            return(false);
                        }
                        else
                        {
                            if (carton.CAPACITY == carton.COLLECTED)
                            {
                                //ShowMessage("$CARTON_ALREADY_FULL_PlEASE_CHANGE");
                            }
                            m_PackageFacade.AddCARTONINFO(carton);
                        }
                    }
                }
            }
            //}
            //if (messages.IsSuccess())
            //{
            m_PackageFacade.AddCarton2Lot(cartonNo, lotCode, cartonQty, ApplicationService.Current().UserCode, objSimulation.MOCode);
            //记log
            m_PackageFacade.AddCarton2LotLog(cartonNo, lotCode, cartonQty, ApplicationService.Current().UserCode);
            //}

            return(true);
        }
コード例 #2
0
        //批次装箱
        private Messages AddSingleIDIntoCartonAndTry(string lotCode)
        {
            string cartonNo = FormatHelper.CleanString(this.ucLabelCartonNo.Value);

            m_FlowControl = 2;
            Messages            messages      = new Messages();
            LotSimulationReport objSimulation = (m_DataCollectFacade.QueryLotSimulationReport(lotCode))[0] as LotSimulationReport;

            if (messages.IsSuccess())
            {
                if (cartonNo != string.Empty)
                {
                    object objCarton = m_PackageFacade.GetCARTONINFO(cartonNo);

                    if (objCarton != null)
                    {
                        CARTONINFO carton = objCarton as CARTONINFO;
                        if (carton.CAPACITY == carton.COLLECTED + objSimulation.LotQty)
                        {
                            messages.Add(new UserControl.Message(MessageType.Normal, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                            m_CartonIsFull = true;
                            m_FlowControl  = 1;
                        }
                        else
                        {
                            m_CartonIsFull = false;
                        }
                        if (carton.CAPACITY < carton.COLLECTED + objSimulation.LotQty)//是否可容纳该批
                        {
                            messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_CAPACITY_NOT_ENOUGH"));
                            m_FlowControl = 3;
                        }
                        if (carton.CAPACITY <= carton.COLLECTED)
                        {
                            messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT"));
                            m_FlowControl = 1;
                        }
                        else
                        {
                            m_PackageFacade.UpdateCollected((carton as CARTONINFO).CARTONNO, objSimulation.LotQty);
                        }
                    }
                    else if (cartonNo != String.Empty)
                    {
                        object objExistCTN = m_PackageFacade.GetExistCARTONINFO(cartonNo);

                        if (objExistCTN != null)
                        {
                            messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                            m_FlowControl = 1;
                        }
                        else
                        {
                            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                            CARTONINFO carton     = new CARTONINFO();
                            carton.CAPACITY    = m_CartonCapacity;
                            carton.COLLECTED   = objSimulation.LotQty;
                            carton.PKCARTONID  = System.Guid.NewGuid().ToString().ToUpper();
                            carton.CARTONNO    = cartonNo;
                            carton.MUSER       = ApplicationService.Current().UserCode;
                            carton.EATTRIBUTE1 = "";
                            carton.MDATE       = dbDateTime.DBDate;
                            carton.MTIME       = dbDateTime.DBTime;

                            if (carton.CAPACITY < carton.COLLECTED)//是否可容纳该批
                            {
                                messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_CAPACITY_NOT_ENOUGH"));
                                m_FlowControl = 3;
                            }
                            if (carton.CAPACITY == 0)
                            {
                                messages.Add(new UserControl.Message(MessageType.Error
                                                                     , "$CS_PLEASE_MAINTEIN_ITEMCARTON $CS_Param_Lot =" + lotCode));
                                m_FlowControl = 3;
                            }
                            else
                            {
                                if (carton.CAPACITY == carton.COLLECTED)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Normal, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                                    m_CartonIsFull = true;
                                    m_FlowControl  = 1;
                                }
                                else
                                {
                                    m_CartonIsFull = false;
                                }
                                m_PackageFacade.AddCARTONINFO(carton);
                            }
                        }
                    }
                }
            }
            if (messages.IsSuccess())
            {
                m_PackageFacade.AddCarton2Lot(cartonNo, lotCode, objSimulation.LotQty, ApplicationService.Current().UserCode, objSimulation.MOCode);
                //记log
                m_PackageFacade.AddCarton2LotLog(cartonNo, lotCode, objSimulation.LotQty, ApplicationService.Current().UserCode);
            }

            return(messages);
        }