Exemple #1
0
        //检查批次信息,是否已生产完工,是否存在的产品代码
        private bool CheckLot(string lotCode)
        {
            // Get Simulation Info
            object[] objSimulations = m_DataCollectFacade.QueryLotSimulationReport(lotCode);
            if (objSimulations == null)
            {
                ShowMessage("$LotNoProductInfo");
                return(false);
            }

            LotSimulationReport objSimulation = objSimulations[0] as LotSimulationReport;

            if (!objSimulation.IsComplete.Equals("1"))//未完工
            {
                ShowMessage("$LotIsUnfinished");
                return(false);
            }
            if (!objSimulation.LotStatus.Equals(LotStatusForMO2LotLink.LOTSTATUS_USE))//使用的批才可包装
            {
                ShowMessage("$LotIsInvalid");
                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);
        }
Exemple #2
0
        //获得箱的相关信息
        public void GetData(string lotCode)
        {
            object[] objobjSimulations = m_DataCollectFacade.QueryLotSimulationReport(lotCode);
            if (objobjSimulations == null)
            {
                return;
            }
            LotSimulationReport objSimulation = objobjSimulations[0] as LotSimulationReport;

            if (objSimulation != null)
            {
                this.m_CartonCollection                 = new CartonCollection();
                this.m_CartonCollection.CAPACITY        = m_CartonCapacity;
                this.m_CartonCollection.COLLECTED       = objSimulation.LotQty - m_PackageFacade.SumCartonQty(lotCode.Trim().ToUpper());
                this.m_CartonCollection.MOCode          = objSimulation.MOCode;
                this.m_CartonCollection.ItemCode        = objSimulation.ItemCode;
                this.m_CartonCollection.ItemDescription = ((m_PackageFacade.GetItemCodeByMOCode(objSimulation.MOCode)) as CartonCollection).ItemDescription;

                object[] objs = m_PackageFacade.GetCarton2LotByLotCode(lotCode);
                if (objs != null)
                {
                    this.m_Carton2Lot = new Carton2Lot[objs.Length];
                    for (int i = 0; i < objs.Length; i++)
                    {
                        this.m_Carton2Lot[i] = (Carton2Lot)objs[i];
                    }
                }
                if (this.m_Carton2Lot != null)
                {
                    object obj = m_PackageFacade.GetItemCodeByMOCode(this.m_Carton2Lot[0].MOCode);
                    if (obj != null)
                    {
                        //Item2LotCheck item2LotCheck = (Item2LotCheck)m_ItemLotFacade.GetItem2LotCheck(((CartonCollection)obj).ItemCode);
                        //if (item2LotCheck != null)
                        //{
                        //    if (item2LotCheck.SNLength > 0)
                        //    {
                        //        chkLotCodeLen.Checked = true;
                        //        chkLotCodeLen.Value = item2LotCheck.SNLength.ToString();
                        //    }

                        //    if (!string.IsNullOrEmpty(item2LotCheck.SNPrefix))
                        //    {
                        //        chkLotCodeFChar.Checked = true;
                        //        chkLotCodeFChar.Value = item2LotCheck.SNPrefix;
                        //    }
                        //}
                    }
                }
            }
        }
Exemple #3
0
        //Laws Lu,2005/12/23,新增INNO上料记录
        //Laws Lu,2006/01/06,允许记录Lot料的明细记录
        public void InsertINNOOnWipItem(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade)
        {
            string              iNNO             = ((CINNOActionEventArgs)actionEventArgs).INNO;
            LotSimulation       simulation       = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation;
            LotSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport;
            MaterialFacade      material         = new MaterialFacade(_domainDataProvider);

            object[] mINNOs = material.GetLastMINNOs(iNNO);
            int      i      = 0;

            if (mINNOs == null)
            {
                throw new Exception("$CS_INNO_NOT_EXIST");
            }
            foreach (MINNO mINNO in mINNOs)
            {
                if (mINNO == null)
                {
                    throw new Exception("$CS_INNOnotExist");
                }
                if (mINNO.MOCode != simulation.MOCode)
                {
                    throw new Exception("$CS_INNOnotForMO $CS_Param_MOCode=" + mINNO.MOCode);
                }
                if (mINNO.RouteCode != simulation.RouteCode)
                {
                    throw new Exception("$CS_INNOnotForRoute $CS_Param_RouteCode=" + mINNO.RouteCode);
                }
                if (mINNO.OPCode != simulation.OPCode)
                {
                    throw new Exception("$CS_INNOnotForOP $CS_Param_OPCode =" + mINNO.OPCode);
                }
                if (mINNO.ResourceCode != simulation.ResCode)
                {
                    throw new Exception("$CS_INNOnotForResource $CS_Param_ResourceCode=" + mINNO.ResourceCode);
                }

                LotOnWipItem wipItem = new LotOnWipItem();


                wipItem.DateCode            = mINNO.DateCode;
                wipItem.LOTNO               = mINNO.MItemPackedNo; //.LotNO;
                wipItem.MItemCode           = mINNO.MItemCode;     /*ActionOnLineHelper.StringNull;*/
                wipItem.MSeq                = i;
                wipItem.VendorCode          = mINNO.VendorCode;
                wipItem.VendorItemCode      = mINNO.VendorItemCode;
                wipItem.Version             = mINNO.Version;
                wipItem.Eattribute1         = simulation.EAttribute1;
                wipItem.ItemCode            = simulation.ItemCode;
                wipItem.ResCode             = simulation.ResCode;
                wipItem.RouteCode           = simulation.RouteCode;
                wipItem.LotCode             = simulation.LotCode;
                wipItem.LotSeq              = simulation.LotSeq;
                wipItem.SegmentCode         = simulationReport.SegmentCode;
                wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                wipItem.MOCode              = simulation.MOCode;
                wipItem.ModelCode           = simulation.ModelCode;
                wipItem.OPCode              = simulation.OPCode;
                wipItem.CollectStatus       = simulation.CollectStatus;
                wipItem.BeginDate           = simulation.BeginDate;
                wipItem.BeginTime           = simulation.BeginTime;
                wipItem.MaintainUser        = simulation.MaintainUser;

                wipItem.Qty       = mINNO.Qty * simulation.LotQty;
                wipItem.MCardType = MCardType.MCardType_INNO;
                //Laws Lu,2005/12/20,新增	采集类型
                wipItem.ActionType = (int)MaterialType.CollectMaterial;
                wipItem.MOSeq      = simulation.MOSeq; // Added by Icyer 2007/07/02

                dataCollectFacade.AddLotOnWIPItem(wipItem);

                i++;
            }
        }
Exemple #4
0
        public Messages InsertLotOnWipItem(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade, object[] OPBOMDetail)
        {
            Messages returnValue = new Messages();

            string              iNNO             = ((CINNOActionEventArgs)actionEventArgs).INNO;
            LotSimulation       simulation       = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation;
            LotSimulationReport simulationReport = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport;
            MaterialFacade      material         = new MaterialFacade(_domainDataProvider);

            //object[] mINNOs = material.GetLastMINNOs(iNNO);
            object[] mINNOs = OPBOMDetail;
            int      i      = 0;

            if (mINNOs == null)
            {
                throw new Exception("$CS_INNO_NOT_EXIST");
            }

            //确定是否需要扣料
            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            Parameter           objParameter        = (Parameter)systemSettingFacade.GetParameter("DEDUCTQTY", "DEDUCTMATERIAL");
            bool isDeductQty = true;

            if (objParameter == null || objParameter.ParameterAlias != "Y")
            {
                isDeductQty = false;
            }

            foreach (MINNO mINNO in mINNOs)
            {
                if (mINNO == null)
                {
                    throw new Exception("$CS_INNOnotExist");
                }
                if (!isDeductQty)//如果不扣料只记录同一首选料的一笔过账
                {
                    //原有过账记录,挪到此处
                    LotOnWipItem wipItem = new LotOnWipItem();

                    wipItem.DateCode       = mINNO.DateCode;
                    wipItem.LOTNO          = mINNO.LotNO;
                    wipItem.MItemCode      = mINNO.MItemCode;
                    wipItem.VendorCode     = mINNO.VendorCode;
                    wipItem.VendorItemCode = mINNO.VendorItemCode;
                    wipItem.Version        = mINNO.Version;
                    wipItem.MSeq           = i;
                    wipItem.MCardType      = mINNO.EAttribute1;

                    wipItem.Eattribute1         = simulation.EAttribute1;
                    wipItem.ItemCode            = simulation.ItemCode;
                    wipItem.ResCode             = simulation.ResCode;
                    wipItem.RouteCode           = simulation.RouteCode;
                    wipItem.LotCode             = simulation.LotCode;
                    wipItem.LotSeq              = simulation.LotSeq;
                    wipItem.SegmentCode         = simulationReport.SegmentCode;
                    wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                    wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                    wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                    wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                    wipItem.MOCode              = simulation.MOCode;
                    wipItem.ModelCode           = simulation.ModelCode;
                    wipItem.OPCode              = simulation.OPCode;
                    wipItem.CollectStatus       = simulation.CollectStatus;
                    wipItem.BeginDate           = simulation.BeginDate;
                    wipItem.BeginTime           = simulation.BeginTime;
                    wipItem.MaintainUser        = simulation.MaintainUser;
                    wipItem.TransStatus         = TransactionStatus.TransactionStatus_YES;

                    if (mINNO.Qty.ToString() != string.Empty && Convert.ToInt32(mINNO.Qty) != 0)
                    {
                        wipItem.Qty = mINNO.Qty * simulation.LotQty;
                    }
                    else
                    {
                        wipItem.Qty = simulation.LotQty;
                    }

                    //Laws Lu,2005/12/20,新增	采集类型
                    wipItem.ActionType = (int)MaterialType.CollectMaterial;
                    wipItem.MOSeq      = simulation.MOSeq; // Added by Icyer 2007/07/02

                    dataCollectFacade.AddLotOnWIPItem(wipItem);

                    LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode);
                    if (simulationRpt != null)
                    {
                        dataCollectFacade.UpdateLotSimulationReport(simulationRpt);

                        // End Added
                    }
                    i++;
                }
                else
                {
                    //add by Jarvis 20120316 For 扣料
                    DeductQty(actionEventArgs, dataCollectFacade, mINNO);
                }
            }
            seqForDeductQty = 0;
            return(returnValue);
        }
Exemple #5
0
        public Messages DeductQty(ActionEventArgs actionEventArgs, DataCollectFacade dataCollectFacade, MINNO minno)
        {
            SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider);
            MaterialFacade      materialFacade      = new MaterialFacade(this.DataProvider);
            MOFacade            moFacade            = new MOFacade(this.DataProvider);
            OPBOMFacade         opbomFacade         = new OPBOMFacade(this.DataProvider);
            ItemFacade          itemFacade          = new ItemFacade(this.DataProvider);
            InventoryFacade     inventoryFacade     = new InventoryFacade(this.DataProvider);
            LotSimulation       simulation          = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulation;
            LotSimulationReport simulationReport    = ((CINNOActionEventArgs)actionEventArgs).ProductInfo.NowSimulationReport;
            Messages            returnValue         = new Messages();
            string lotNoList = string.Empty;// add by Jarvis For onWipItem

            ProductInfo   productionInfo = actionEventArgs.ProductInfo;
            LotSimulation sim            = actionEventArgs.ProductInfo.NowSimulation;
            int           orgid          = actionEventArgs.ProductInfo.Resource.OrganizationID;
            MO            mo             = actionEventArgs.ProductInfo.CurrentMO;

            if (mo == null)
            {
                mo = moFacade.GetMO(sim.MOCode) as MO;
            }

            //获取当前工单号
            string moCode = productionInfo.NowSimulation.MOCode;
            //获取当前工序号
            string opCode = productionInfo.NowSimulation.OPCode;
            //获取当前产品号
            string itemCode = productionInfo.NowSimulation.ItemCode;
            //获取途程代码
            string routeCode = productionInfo.NowSimulation.RouteCode;
            string resCode   = productionInfo.Resource.ResourceCode;
            //获取ORGID
            int    orgID    = productionInfo.Resource.OrganizationID;
            string moBomVer = string.Empty;

            object objMo = moFacade.GetMO(moCode);

            if (objMo != null)
            {
                moBomVer = (objMo as MO).BOMVersion;
            }

            //获取物料名称
            string MItemName = string.Empty;

            Domain.MOModel.Material material = ((Domain.MOModel.Material)itemFacade.GetMaterial(minno.MItemCode, orgID));
            if (material != null)
            {
                MItemName = material.MaterialName;
            }

            //添加产品已上料扣料判断  tblonwip
            string  lotNo = productionInfo.NowSimulation.LotCode;
            decimal seq   = productionInfo.NowSimulation.LotSeq;

            //object[] objOnWip = dataCollectFacade.QueryLotOnWIP(lotNo, moCode, opCode, "CINNO");

            //if (objOnWip != null && objOnWip.Length > 0)
            //{
            //    return returnValue;
            //}

            //remove by Jarvis 不检查工单BOM 20120321
            //object[] objMoBoms = moFacade.QueryMoBom(sim.ItemCode, minno.MItemCode, sim.MOCode);//检查工单BOM是否有该首选料, Jarvis 20120319
            //if (objMoBoms == null)
            //{
            //    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInMoBOM" + String.Format("[$MOCode='{0}']", sim.MOCode));
            //}

            object[] opbomObjs = opbomFacade.QueryOPBOMDetail(sim.ItemCode, minno.MItemCode, string.Empty, string.Empty, string.Empty, sim.RouteCode, opCode, (int)MaterialType.CollectMaterial, int.MinValue, int.MaxValue, orgid, true);
            if (opbomObjs == null)
            {
                throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$Error_NotExistInOPBOM" + String.Format("[$ItemCode='{0}']", sim.ItemCode));
            }

            object[] moRouteObjs = moFacade.QueryMORoutes(sim.MOCode, sim.RouteCode);
            if (moRouteObjs == null)
            {
                throw new Exception("$Error_MORouteNOExist");
            }

            bool iflag = false;

            decimal iOPBOMItemQty = 0;

            //需要比对的子阶料料号 比对成功的 只在工单生产BOM 中
            if (opbomObjs == null)//去掉检查工单BOM是否为空
            {
                return(returnValue);
            }

            //以工单标准BOM为基准,扣减当前工单的倒冲库存地(tblmo. EATTRIBUTE2)中相对应的库存信息
            //for (int n = 0; n < objMoBoms.Length; n++)//去掉工单BOM 20120321 Jarvis
            //{
            //求得opbom中对应的料品
            string TempMOBOMItemCode = minno.MItemCode;

            iflag         = false;
            iOPBOMItemQty = 0;
            for (int j = 0; j < opbomObjs.Length; j++)
            {
                if (TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode.ToUpper() ||
                    TempMOBOMItemCode.ToUpper() == ((OPBOMDetail)opbomObjs[j]).OPBOMSourceItemCode.ToUpper())
                {   //子阶料存在或有替代料可用
                    iflag = true;
                    //TempMOBOMItemCode = ((OPBOMDetail)opbomObjs[j]).OPBOMItemCode;//remove by Jarvis 20120316
                    //For 替代料,记录首选料号,Jarvis 20120316
                    //TempMOBOMItemCode = ((MOBOM)objMoBoms[n]).MOBOMItemCode;

                    iOPBOMItemQty  = (decimal)((OPBOMDetail)opbomObjs[j]).OPBOMItemQty;
                    iOPBOMItemQty *= sim.LotQty;

                    break;
                }
            }

            //比对成功:子阶料料号一致
            if (iflag)//子阶料不存在, 即只在工单标准bom中
            {
                //object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(mo.EAttribute2, TempMOBOMItemCode.ToUpper());
                object[] objInfos = inventoryFacade.QueryStorageInfoByIDAndMCode(TempMOBOMItemCode.ToUpper());
                if (objInfos == null)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR");
                }

                //获取物料的总库存数,Jarvis 20120316
                //decimal total = inventoryFacade.GetStorageQty(mo.EAttribute2, TempMOBOMItemCode.ToUpper());
                decimal total = inventoryFacade.GetStorageQty(TempMOBOMItemCode.ToUpper());

                if (total < iOPBOMItemQty)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "]" + "$CS_StorageQty_ERROR");
                }

                #region //先判断备料批号中的数据量,不够扣减就退出
                decimal   temlotQty          = 0;
                object[]  objStorageLotInfo  = null;
                ArrayList StorageLotInfoList = new ArrayList();

                //获取子阶料的备料信息,Jarvis 20120316,按Seq排序
                object[] minnoss = materialFacade.QueryMINNO_New(moCode, routeCode, opCode, resCode, moBomVer, minno.MSourceItemCode);    //获取同一首选料的备料信息,Jarvis 20120321

                //获取备料信息中可扣减数,Jarvis 20120316
                foreach (MINNO temp in minnoss)
                {
                    //objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, mo.EAttribute2, temp.MItemCode);
                    objStorageLotInfo = inventoryFacade.QueryStorageLot(temp.LotNO, temp.MItemCode);
                    if (objStorageLotInfo != null)
                    {
                        foreach (StorageLotInfo lotInfo in objStorageLotInfo)
                        {
                            temlotQty += lotInfo.Lotqty;
                            if (lotInfo.Lotqty <= 0)    //如果批数量为0不记录该批
                            {
                                continue;
                            }
                            StorageLotInfoList.Add(lotInfo);
                        }
                    }
                }


                if (temlotQty < iOPBOMItemQty)
                {
                    throw new Exception("$CS_ItemCode[" + minno.MItemCode + "-" + MItemName + "]" + "$CS_DeductQty_ERROR");
                }
                #endregion

                #region 数量可以扣减

                foreach (StorageLotInfo lotInfo in StorageLotInfoList)
                {
                    if (iOPBOMItemQty > lotInfo.Lotqty)
                    {
                        iOPBOMItemQty = iOPBOMItemQty - lotInfo.Lotqty;
                        inventoryFacade.DeleteStorageLotInfo(lotInfo);
                        this.UpdateStorageQty(lotInfo, inventoryFacade, lotInfo.Lotqty);
                        lotNoList += ("," + lotInfo.Lotno + ",");

                        #region 记录过账信息
                        LotOnWipItem wipItem    = new LotOnWipItem();
                        MINNO        minnoTemp  = null;
                        object[]     minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno);
                        if (minnoTemps != null)
                        {
                            minnoTemp = (MINNO)minnoTemps[0];
                        }
                        wipItem.DateCode       = minnoTemp.DateCode;
                        wipItem.LOTNO          = minnoTemp.LotNO;
                        wipItem.MItemCode      = minnoTemp.MItemCode;
                        wipItem.VendorCode     = minnoTemp.VendorCode;
                        wipItem.VendorItemCode = minnoTemp.VendorItemCode;
                        wipItem.Version        = minnoTemp.Version;
                        wipItem.MSeq           = seqForDeductQty;
                        wipItem.MCardType      = minno.EAttribute1;

                        wipItem.Eattribute1         = simulation.EAttribute1;
                        wipItem.ItemCode            = simulation.ItemCode;
                        wipItem.ResCode             = simulation.ResCode;
                        wipItem.RouteCode           = simulation.RouteCode;
                        wipItem.LotCode             = simulation.LotCode;
                        wipItem.LotSeq              = simulation.LotSeq;
                        wipItem.SegmentCode         = simulationReport.SegmentCode;
                        wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                        wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                        wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                        wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                        wipItem.MOCode              = simulation.MOCode;
                        wipItem.ModelCode           = simulation.ModelCode;
                        wipItem.OPCode              = simulation.OPCode;
                        wipItem.CollectStatus       = simulation.CollectStatus;
                        wipItem.BeginDate           = simulation.BeginDate;
                        wipItem.BeginTime           = simulation.BeginTime;
                        wipItem.MaintainUser        = simulation.MaintainUser;
                        wipItem.TransStatus         = TransactionStatus.TransactionStatus_YES;
                        wipItem.Qty = lotInfo.Lotqty;

                        wipItem.ActionType = (int)MaterialType.CollectMaterial;
                        wipItem.MOSeq      = simulation.MOSeq;

                        dataCollectFacade.AddLotOnWIPItem(wipItem);

                        LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode);
                        if (simulationRpt != null)
                        {
                            dataCollectFacade.UpdateLotSimulationReport(simulationRpt);
                        }
                        seqForDeductQty++;
                        #endregion
                    }
                    else
                    {
                        lotInfo.Lotqty = lotInfo.Lotqty - iOPBOMItemQty;
                        inventoryFacade.UpdateStorageLotInfo(lotInfo);
                        this.UpdateStorageQty(lotInfo, inventoryFacade, iOPBOMItemQty);

                        #region 记录过账信息
                        LotOnWipItem wipItem    = new LotOnWipItem();
                        MINNO        minnoTemp  = null;
                        object[]     minnoTemps = materialFacade.QueryMINNO(moCode, routeCode, opCode, resCode, moBomVer, lotInfo.Mcode, minno.MSourceItemCode, lotInfo.Lotno);
                        if (minnoTemps != null)
                        {
                            minnoTemp = (MINNO)minnoTemps[0];
                        }
                        wipItem.DateCode       = minnoTemp.DateCode;
                        wipItem.LOTNO          = minnoTemp.LotNO;
                        wipItem.MItemCode      = minnoTemp.MItemCode;
                        wipItem.VendorCode     = minnoTemp.VendorCode;
                        wipItem.VendorItemCode = minnoTemp.VendorItemCode;
                        wipItem.Version        = minnoTemp.Version;
                        wipItem.MSeq           = seqForDeductQty;
                        wipItem.MCardType      = minno.EAttribute1;

                        wipItem.Eattribute1         = simulation.EAttribute1;
                        wipItem.ItemCode            = simulation.ItemCode;
                        wipItem.ResCode             = simulation.ResCode;
                        wipItem.RouteCode           = simulation.RouteCode;
                        wipItem.LotCode             = simulation.LotCode;
                        wipItem.LotSeq              = simulation.LotSeq;
                        wipItem.SegmentCode         = simulationReport.SegmentCode;
                        wipItem.BeginShiftCode      = simulationReport.BeginShiftCode;
                        wipItem.ShiftTypeCode       = simulationReport.ShiftTypeCode;
                        wipItem.StepSequenceCode    = simulationReport.StepSequenceCode;
                        wipItem.BeginTimePeriodCode = simulationReport.BeginTimePeriodCode;
                        wipItem.MOCode              = simulation.MOCode;
                        wipItem.ModelCode           = simulation.ModelCode;
                        wipItem.OPCode              = simulation.OPCode;
                        wipItem.CollectStatus       = simulation.CollectStatus;
                        wipItem.BeginDate           = simulation.BeginDate;
                        wipItem.BeginTime           = simulation.BeginTime;
                        wipItem.MaintainUser        = simulation.MaintainUser;
                        wipItem.TransStatus         = TransactionStatus.TransactionStatus_YES;
                        wipItem.Qty = iOPBOMItemQty;

                        wipItem.ActionType = (int)MaterialType.CollectMaterial;
                        wipItem.MOSeq      = simulation.MOSeq;

                        dataCollectFacade.AddLotOnWIPItem(wipItem);

                        LotSimulationReport simulationRpt = dataCollectFacade.GetLastLotSimulationReport(wipItem.LotCode);
                        if (simulationRpt != null)
                        {
                            dataCollectFacade.UpdateLotSimulationReport(simulationRpt);
                        }
                        seqForDeductQty++;
                        #endregion
                        iOPBOMItemQty = 0;
                        lotNoList    += ("," + lotInfo.Lotno + ",");
                        break;
                    }
                }

                #endregion
            }
            //}
            return(returnValue);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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 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);
        }