Example #1
0
        public static string DataMarcacao(int idProcesso)
        {
            string[] andamentosAgenda =
            {
                "LICITAÇÃO MARCADA",
                "DISPUTA",
                "SESSÃO FINAL",
                "SESSÃO DE RESULTADO - HABILITAÇÃO",
                "SESSÃO DE RESULTADO - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA TÉCNICA",
                "SESSÃO DE RESULTADO - PROPOSTA TÉCNICA"
            };

            DetachedCriteria dc = DetachedCriteria.For(typeof(ProcessoAndamento));

            dc.Add(Expression.Eq("Processo.Id", idProcesso));
            dc.Add(Expression.IsNull("AndamentoCorrigido"));
            dc.Add(Expression.IsNull("AndamentoAdiado"));
            dc.CreateAlias("FluxoAndamento", "fan");
            dc.CreateAlias("fan.Atividade", "ati");
            dc.Add(Expression.In("ati.Descricao", andamentosAgenda));
            dc.Add(Expression.Sql(" this_.dat_andamento_pan >= '" + DateTime.Now + "' order by this_.dat_andamento_pan desc "));
            ProcessoAndamento andamento = ProcessoAndamento.FindFirst(dc);
            string            retorno   = string.Empty;

            if (andamento != null && Utilidade.UtdValidador.ValidarData(Convert.ToString(andamento.DataAndamento)))
            {
                retorno = andamento.DataAndamento.ToString("dd/MM/yyyy");
            }
            return(retorno);
        }
        public IList <InProcessLocationDetail> GetInProcessLocationDetailOut(IList <string> itemList, IList <string> locList)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(InProcessLocationDetail));

            criteria.CreateAlias("InProcessLocation", "ip");
            criteria.Add(Expression.Eq("ip.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE));
            criteria.Add(Expression.Eq("ip.Type", BusinessConstants.CODE_MASTER_INPROCESS_LOCATION_TYPE_VALUE_NORMAL));
            criteria.CreateAlias("OrderLocationTransaction", "olt");
            if (itemList.Count == 1)
            {
                criteria.Add(Expression.Eq("olt.Item.Code", itemList[0]));
            }
            else
            {
                criteria.Add(Expression.InG <string>("olt.Item.Code", itemList));
            }
            if (locList.Count == 1)
            {
                criteria.Add(Expression.Eq("olt.Location.Code", locList[0]));
            }
            else
            {
                criteria.Add(Expression.InG <string>("olt.Location.Code", locList));
            }

            criteria.SetProjection(Projections.ProjectionList()
                                   .Add(Projections.GroupProperty("olt.Location.Code").As("LocationCode"))
                                   .Add(Projections.GroupProperty("olt.Item.Code").As("ItemCode"))
                                   .Add(Projections.Sum("Qty").As("Qty")));

            criteria.SetResultTransformer(Transformers.AliasToBean(typeof(InProcessLocationDetail)));
            return(this.criteriaMgr.FindAll <InProcessLocationDetail>(criteria));
        }
Example #3
0
        public void ProdsWDate()
        {
            ISession session = GetConfiguration().BuildSessionFactory().OpenSession();

            Category category = new Category()
            {
                Id = 1
            };

            DetachedCriteria criteria = DetachedCriteria.For <Income>();

            criteria.CreateAlias("Product", "p");
            criteria.CreateAlias("p.Category", "c");
            criteria.SetProjection(
                Projections.ProjectionList()
                .Add(Projections.GroupProperty("Product"))
                .Add(Projections.GroupProperty("c.Name"))
                .Add(Projections.Max("Date")));
            //criteria.Add(Restrictions.Eq("p.Category", category));
            criteria.AddOrder(NHibernate.Criterion.Order.Asc("c.Name"));
            var list = criteria.GetExecutableCriteria(session).List();

            foreach (var VARIABLE in list)
            {
            }
        }
        public bool CheckGoodsIssueFIFO(string locationCode, string itemCode, DateTime baseManufatureDate, IList <string> huIdList)
        {
            DetachedCriteria criteria = DetachedCriteria.For <LocationLotDetail>();

            criteria.SetProjection(Projections.Count("Id"));

            criteria.CreateAlias("Hu", "hu");
            criteria.CreateAlias("Location", "loc");
            criteria.CreateAlias("Item", "item");

            criteria.Add(Expression.IsNotNull("Hu"));
            criteria.Add(Expression.Gt("Qty", new Decimal(0)));
            criteria.Add(Expression.Eq("item.Code", itemCode));
            criteria.Add(Expression.Eq("loc.Code", locationCode));
            criteria.Add(Expression.Lt("hu.ManufactureDate", baseManufatureDate));
            criteria.Add(Expression.Not(Expression.In("hu.HuId", huIdList.ToArray <string>())));

            IList <int> list = this.criteriaMgr.FindAll <int>(criteria);

            if (list[0] > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #5
0
        private IList <OrderLocationTransaction> GetOpenOrderLocTransInByFlow(string flowCode, string itemCode, DateTime?startWinTime, DateTime?endWinTime)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderLocationTransaction), "orderLocTrans");

            criteria.CreateAlias("OrderDetail", "od");
            criteria.CreateAlias("od.OrderHead", "oh");
            criteria.Add(Expression.Eq("orderLocTrans.Item.Code", itemCode));
            criteria.Add(Expression.Eq("orderLocTrans.IOType", BusinessConstants.IO_TYPE_IN));
            criteria.Add(Expression.Eq("oh.Flow", flowCode));
            //WindowTime in [startWinTime,endWinTime)
            if (startWinTime.HasValue)
            {
                criteria.Add(Expression.Ge("oh.WindowTime", (DateTime)startWinTime));
            }
            if (endWinTime.HasValue)
            {
                criteria.Add(Expression.Lt("oh.WindowTime", (DateTime)endWinTime));
            }
            criteria.Add(Expression.Or(Expression.Eq("oh.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT),
                                       Expression.Eq("oh.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)));
            criteria.AddOrder(Order.Asc("oh.WindowTime"));

            IList <OrderLocationTransaction> orderLocTransList = CriteriaMgr.FindAll <OrderLocationTransaction>(criteria);

            return(orderLocTransList);
        }
        public bool CheckGoodsReceiveFIFO(string locationCode, string itemCode, DateTime manufactureDate, string manufactureParty, DateTime?baseManufatureDate)
        {
            DetachedCriteria criteria = DetachedCriteria.For <LocationLotDetail>();

            criteria.SetProjection(Projections.Count("Id"));

            criteria.CreateAlias("Hu", "hu");
            criteria.CreateAlias("Location", "loc");
            criteria.CreateAlias("Item", "item");
            criteria.CreateAlias("hu.ManufactureParty", "party");

            criteria.Add(Expression.IsNotNull("Hu"));
            criteria.Add(Expression.Gt("Qty", new Decimal(0)));
            criteria.Add(Expression.Eq("item.Code", itemCode));
            criteria.Add(Expression.Eq("loc.Code", locationCode));
            criteria.Add(Expression.Gt("hu.ManufactureDate", manufactureDate));
            criteria.Add(Expression.Eq("party.Code", manufactureParty));

            if (baseManufatureDate.HasValue)
            {
                criteria.Add(Expression.Lt("hu.ManufactureDate", baseManufatureDate.Value));
            }

            IList <int> list = this.criteriaMgr.FindAll <int>(criteria);

            if (list[0] > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Example #7
0
        public override void CreateByMaterial(ByMaterial byMaterial)
        {
            #region ¼ì²éOrderºÍItem
            DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderLocationTransaction));
            criteria.CreateAlias("OrderDetail", "od");
            criteria.CreateAlias("od.OrderHead", "oh");
            criteria.Add(Expression.Eq("Item.Code", byMaterial.Item.Code));
            criteria.Add(Expression.Eq("oh.OrderNo", byMaterial.OrderNo));
            criteria.Add(Expression.Eq("oh.Type", BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION));
            criteria.Add(Expression.Eq("oh.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS));
            criteria.Add(Expression.Eq("TransactionType", BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO));
            criteria.Add(Expression.Eq("TagNo", byMaterial.TagNo));
            IList <OrderLocationTransaction> orderLocTransList = criteriaMgr.FindAll <OrderLocationTransaction>(criteria);

            if (orderLocTransList.Count == 0)
            {
                throw new BusinessErrorException("Mes.ByMaterial.OrderItem.NotExist");
            }
            #endregion
            else
            {
                OrderLocationTransaction ol = orderLocTransList[0];
                ol.Cartons = ol.Cartons + 1;
                base.CreateByMaterial(byMaterial);
            }
        }
Example #8
0
        public IList <PickListDetail> GetPickedPickListDetail(int orderLocationTransactionId)
        {
            DetachedCriteria criteria = DetachedCriteria.For <PickListDetail>();

            criteria.CreateAlias("OrderLocationTransaction", "olt");
            criteria.CreateAlias("PickList", "pk");

            IList <string> statusList = new List <string>();

            statusList.Add(BusinessConstants.CODE_MASTER_STATUS_VALUE_SUBMIT);
            statusList.Add(BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS);

            criteria.Add(Expression.Eq("olt.Id", orderLocationTransactionId));
            if (statusList != null && statusList.Count > 0)
            {
                if (statusList.Count == 1)
                {
                    criteria.Add(Expression.Eq("pk.Status", statusList[0]));
                }
                else
                {
                    criteria.Add(Expression.InG <string>("pk.Status", statusList));
                }
            }
            return(this.criteriaMgr.FindAll <PickListDetail>(criteria));
        }
Example #9
0
        public static bool VerificarUltimaRealizacaoDataMaiorQueDataRemarcacao(int idProcesso)
        {
            DetachedCriteria dc = DetachedCriteria.For(typeof(ProcessoAndamento));

            dc.Add(Expression.Eq("Processo.Id", idProcesso));
            dc.Add(Expression.IsNull("AndamentoCorrigido"));
            dc.Add(Expression.IsNull("AndamentoAdiado"));
            dc.CreateAlias("FluxoAndamento", "fan");
            dc.CreateAlias("fan.Atividade", "ati");
            dc.Add(Expression.Sql(@"
			 this_.pk_cod_processo_andamento_pan in 
			(select pan.pk_cod_processo_andamento_pan from adm_licitar.tb_processo_andamento_pan pan
			inner join adm_licitar.tb_fluxo_andamento_fan fan on fan.pk_cod_fluxo_andamento_fan = pan.fk_cod_fluxo_andamento_fan
			inner join adm_licitar.tb_atividade_ati ati on ati.pk_cod_atividade_ati = fan.fk_cod_atividade_ati
			and fk_cod_processo_andamento_remarcado_pan is null	
			and fk_cod_processo_andamento_pan is null
			where fk_cod_processo_pro = "             + idProcesso + @"  and txt_descricao_ati in
			(
			 'LICITAÇÃO MARCADA', 'LICITAÇÃO MARCADA EM CONTINUIDADE', 'DISPUTA', 'SESSÃO FINAL',  'SESSÃO DE RESULTADO - HABILITAÇÃO',  'SESSÃO DE RESULTADO - PROPOSTA COMERCIAL', 'SESSÃO DE ABERTURA - PROPOSTA COMERCIAL',  'SESSÃO DE ABERTURA - PROPOSTA TÉCNICA', 'SESSÃO DE RESULTADO - PROPOSTA TÉCNICA'
			) and dat_andamento_pan >= '"
                                  + DateTime.Now +
                                  @"' order by dat_andamento_pan desc limit 1)"));


            ;
            ProcessoAndamento andamento = ProcessoAndamento.FindOne(dc);

            if (andamento != null)
            {
                return(true);
            }
            return(false);
        }
Example #10
0
        public IList <Flow> GetAllFlow(string userCode)
        {
            DetachedCriteria criteria = DetachedCriteria.For <Flow>();

            criteria.CreateAlias("PartyTo", "pt");
            criteria.CreateAlias("PartyFrom", "pf");


            DetachedCriteria[] pfCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode,
                                                                                       BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_SUPPLIER);

            DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(userCode,
                                                                                       BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

            criteria.Add(
                Expression.Or(
                    Subqueries.PropertyIn("pf.Code", pfCrieteria[0]),
                    Subqueries.PropertyIn("pf.Code", pfCrieteria[1])
                    ));

            criteria.Add(
                Expression.Or(
                    Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
                    Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
                    ));

            return(criteriaMgr.FindAll <Flow>(criteria));
        }
    private void SetCriteria()
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(OrderLocationTransaction));

        criteria.CreateAlias("OrderDetail", "od");
        criteria.CreateAlias("od.OrderHead", "oh");

        OrderHelper.SetOpenOrderStatusCriteria(criteria, "oh.Status");//订单状态
        if (this.EndDate.HasValue)
        {
            if (IOType == BusinessConstants.IO_TYPE_IN)
            {
                criteria.Add(Expression.Le("oh.WindowTime", this.EndDate.Value));
            }
            else
            {
                criteria.Add(Expression.Lt("oh.StartTime", this.EndDate.Value));
            }
        }
        criteria.Add(Expression.Eq("Item.Code", this.Item));
        criteria.Add(Expression.Eq("Location.Code", this.Location));
        criteria.Add(Expression.Eq("IOType", this.IOType));

        DetachedCriteria selectCountCriteria = CloneHelper.DeepClone <DetachedCriteria>(criteria);

        selectCountCriteria.SetProjection(Projections.Count("Id"));
        SetSearchCriteria(criteria, selectCountCriteria);
    }
Example #12
0
        private void ClearOldItemFlowPlan(string item, string loc, string status)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(ItemFlowPlan));

            criteria.CreateAlias("FlowDetail", "fd");
            criteria.CreateAlias("fd.Item", "item");
            criteria.Add(Expression.Eq("item.Code", item));
            criteria.Add(Expression.Eq("Location.Code", loc));
            criteria.Add(Expression.Eq("Status", status));
            IList <ItemFlowPlan> itemFlowPlanList = CriteriaMgr.FindAll <ItemFlowPlan>(criteria);

            if (itemFlowPlanList != null && itemFlowPlanList.Count > 0)
            {
                foreach (ItemFlowPlan itemFlowPlan in itemFlowPlanList)
                {
                    if (itemFlowPlan.ItemFlowPlanDetails != null && itemFlowPlan.ItemFlowPlanDetails.Count > 0)
                    {
                        foreach (ItemFlowPlanDetail itemFlowPlanDetail in itemFlowPlan.ItemFlowPlanDetails)
                        {
                            if (itemFlowPlanDetail.ItemFlowPlanTracks != null && itemFlowPlanDetail.ItemFlowPlanTracks.Count > 0)
                            {
                                foreach (ItemFlowPlanTrack itemFlowPlanTrack in itemFlowPlanDetail.ItemFlowPlanTracks)
                                {
                                    ItemFlowPlanTrackMgr.DeleteItemFlowPlanTrack(itemFlowPlanTrack);
                                }
                            }

                            ItemFlowPlanDetailMgr.DeleteItemFlowPlanDetail(itemFlowPlanDetail);
                        }
                    }

                    this.DeleteItemFlowPlan(itemFlowPlan);
                }
            }
        }
Example #13
0
    private void SetCriteria()
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(InProcessLocationDetail));

        criteria.CreateAlias("OrderLocationTransaction", "olt");
        criteria.CreateAlias("InProcessLocation", "ip");
        criteria.Add(Expression.Eq("ip.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE));
        criteria.Add(Expression.Eq("ip.Type", BusinessConstants.CODE_MASTER_INPROCESS_LOCATION_TYPE_VALUE_NORMAL));

        if (this.IOType == BusinessConstants.IO_TYPE_IN)
        {
            DetachedCriteria subCriteria = DetachedCriteria.For(typeof(OrderLocationTransaction));
            subCriteria.CreateAlias("OrderDetail", "od");
            subCriteria.CreateAlias("od.OrderHead", "oh");
            OrderHelper.SetOpenOrderStatusCriteria(subCriteria, "oh.Status");
            subCriteria.Add(Expression.Eq("IOType", BusinessConstants.IO_TYPE_IN));
            subCriteria.Add(Expression.Eq("Item.Code", this.Item));
            subCriteria.Add(Expression.Eq("Location.Code", this.Location));
            subCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("OrderDetail.Id")));

            criteria.Add(Subqueries.PropertyIn("olt.OrderDetail.Id", subCriteria));
        }
        else
        {
            criteria.Add(Expression.Eq("olt.Item.Code", this.Item));
            criteria.Add(Expression.Eq("olt.Location.Code", this.Location));
        }

        DetachedCriteria selectCountCriteria = CloneHelper.DeepClone <DetachedCriteria>(criteria);

        selectCountCriteria.SetProjection(Projections.Count("Id"));
        this.SetSearchCriteria(criteria, selectCountCriteria);
    }
Example #14
0
        public static bool VerificarSeJaFoiDadoAndamentoAgendaComDataIgual(int idProcesso, DateTime data)
        {
            string[] andamentosAgenda =
            {
                "LICITAÇÃO MARCADA",
                // MF Inicio
                "LICITAÇÃO MARCADA EM CONTINUIDADE",
                // MF Fim
                "DISPUTA",
                "SESSÃO FINAL",
                "SESSÃO DE RESULTADO - HABILITAÇÃO",
                "SESSÃO DE RESULTADO - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA TÉCNICA",
                "SESSÃO DE RESULTADO - PROPOSTA TÉCNICA"
            };

            DetachedCriteria dc = DetachedCriteria.For(typeof(ProcessoAndamento));

            dc.Add(Expression.Eq("Processo.Id", idProcesso));
            dc.Add(Expression.IsNull("AndamentoCorrigido"));
            dc.Add(Expression.IsNull("AndamentoAdiado"));
            dc.CreateAlias("FluxoAndamento", "fan");
            dc.CreateAlias("fan.Atividade", "ati");
            dc.Add(Expression.In("ati.Descricao", andamentosAgenda));
            dc.Add(Expression.Sql(" this_.dat_andamento_pan = '" + data + "' "));
            ProcessoAndamento[] andamentos = ProcessoAndamento.FindAll(dc);

            if (andamentos.Length > 0)
            {
                return(true);
            }

            return(false);
        }
Example #15
0
        private void RegistrarAndamentoIncluindoPessoa(Atividade tipoAndamento, Pessoa responsavel, Pessoa destinatario, string observacao, bool incluirData, bool UnidExercicio, string fase)
        {
            ProcessoAndamento andamento = new ProcessoAndamento();

            DetachedCriteria dcFluxo = DetachedCriteria.For(typeof(FluxoAndamento));

            dcFluxo.CreateAlias("Fase", "fas");
            dcFluxo.CreateAlias("Atividade", "ati");
            dcFluxo.Add(Expression.Eq("fas.Descricao", fase));
            dcFluxo.Add(Expression.Eq("ati.Descricao", tipoAndamento.Descricao));
            dcFluxo.Add(Expression.Sql("this_.fk_cod_workflow_wor in (select wor.pk_cod_workflow_wor from adm_licitar.tb_workflow_modalidade_unidade_exercicio_wmu wmu inner join adm_licitar.tb_workflow_wor wor on wmu.fk_cod_workflow_wor = wor.pk_cod_workflow_wor where wmu.fk_cod_modalidade_mod=" + this.Classificacao.Modalidade.Id + ")"));
            FluxoAndamento objFluxo = FluxoAndamento.FindFirst(dcFluxo);

            //INSERIR ANDAMENTO
            andamento.Cadastrante    = responsavel;
            andamento.Processo       = this;
            andamento.FluxoAndamento = objFluxo;
            andamento.Pessoa         = destinatario;
            if (incluirData)
            {
                andamento.DataCadastro = DateTime.Now;
            }

            andamento.Andamento = observacao ?? null;
            andamento.SaveAndFlush();
        }
Example #16
0
        public int  RetornarUltimoIdDataMarcacao(int idProcesso, int processoAndamentoAdiado)
        {
            string[] andamentosAgenda =
            {
                "LICITAÇÃO MARCADA",
                "LICITAÇÃO MARCADA EM CONTINUIDADE",
                "DISPUTA",
                "SESSÃO FINAL",
                "SESSÃO DE RESULTADO - HABILITAÇÃO",
                "SESSÃO DE RESULTADO - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA TÉCNICA",
                "SESSÃO DE RESULTADO - PROPOSTA TÉCNICA"
            };

            DetachedCriteria dc = DetachedCriteria.For(typeof(ProcessoAndamento));

            dc.Add(Expression.Eq("Processo.Id", idProcesso));
            dc.Add(Expression.IsNull("AndamentoCorrigido"));
            dc.CreateAlias("AndamentoAdiado", "adi");
            dc.Add(Expression.Eq("adi.Id", processoAndamentoAdiado));
            dc.CreateAlias("FluxoAndamento", "fan");
            dc.CreateAlias("fan.Atividade", "ati");
            dc.Add(Expression.In("ati.Descricao", andamentosAgenda));
            dc.Add(Expression.Sql(" this_.dat_andamento_pan >= '" + DateTime.Now + "' order by this_.dat_andamento_pan desc "));
            ProcessoAndamento andamento = ProcessoAndamento.FindFirst(dc);

            return(andamento.Id);
        }
Example #17
0
        public void MarcarUltimaDataRealizacao(int idProcesso, ProcessoAndamento fkCodProcAndRemarcado)
        {
            string[] andamentosAgenda =
            {
                "LICITAÇÃO MARCADA",
                // MF Inicio
                "LICITAÇÃO MARCADA EM CONTINUIDADE",
                // MF Fim
                "DISPUTA",
                "SESSÃO FINAL",
                "SESSÃO DE RESULTADO - HABILITAÇÃO",
                "SESSÃO DE RESULTADO - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA COMERCIAL",
                "SESSÃO DE ABERTURA - PROPOSTA TÉCNICA",
                "SESSÃO DE RESULTADO - PROPOSTA TÉCNICA"
            };

            DetachedCriteria dc = DetachedCriteria.For(typeof(ProcessoAndamento));

            dc.Add(Expression.Eq("Processo.Id", idProcesso));
            dc.Add(Expression.IsNull("AndamentoCorrigido"));
            dc.Add(Expression.IsNull("AndamentoAdiado"));
            dc.CreateAlias("FluxoAndamento", "fan");
            dc.CreateAlias("fan.Atividade", "ati");
            dc.Add(Expression.In("ati.Descricao", andamentosAgenda));
            dc.Add(Expression.Sql(" this_.dat_andamento_pan >= '" + DateTime.Now + "' order by this_.dat_andamento_pan desc "));
            ProcessoAndamento andamento = ProcessoAndamento.FindFirst(dc);

            if (andamento != null)
            {
                andamento.AndamentoAdiado = fkCodProcAndRemarcado;
                andamento.SaveAndFlush();
            }
        }
Example #18
0
        private List <LeanEngine.Entity.InvBalance> GetInspectInvBalance()
        {
            //报验库存
            DetachedCriteria criteria = DetachedCriteria.For(typeof(InspectOrderDetail));

            criteria.CreateAlias("InspectOrder", "io");
            criteria.CreateAlias("LocationLotDetail", "lld");
            criteria.Add(Expression.Eq("io.Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE));
            criteria.Add(Expression.Eq("io.IsSeperated", false));

            criteria.SetProjection(Projections.ProjectionList()
                                   .Add(Projections.Sum("InspectQty").As("InspectQty"))
                                   .Add(Projections.Sum("QualifiedQty").As("QualifiedQty"))
                                   .Add(Projections.Sum("RejectedQty").As("RejectedQty"))
                                   .Add(Projections.GroupProperty("LocationFrom.Code").As("LocationFromCode"))
                                   .Add(Projections.GroupProperty("lld.Item.Code").As("ItemCode")));

            criteria.SetResultTransformer(Transformers.AliasToBean(typeof(InspectOrderDetail)));
            IList <InspectOrderDetail> inspectOrderDetailList = CriteriaMgr.FindAll <InspectOrderDetail>(criteria);
            var query = from i in inspectOrderDetailList
                        select new LeanEngine.Entity.InvBalance
            {
                Loc     = i.LocationFromCode,
                Item    = i.ItemCode,
                Qty     = i.InspectedQty,
                InvType = Enumerators.InvType.Inspect
            };

            return(query.Where(q => q.Qty != 0).ToList());
        }
Example #19
0
        public IDictionary <string, int> getStudentCompanyData()
        {
            Utility.logFile(Constant.METHOD_ENTER + Utility.getCurrentMethodName(1) + "(StatisticsManagerImpl)", null, Constant.LOGTYPE_INFO);
            DetachedCriteria criteria = DetachedCriteria.For <Entity_PlacementDetails>();

            criteria.CreateAlias("compDetailsObj", "compDetail");
            criteria.CreateAlias("compDetail.companyObj", "company");

            ProjectionList projectionList = Projections.ProjectionList();

            projectionList.Add(Projections.GroupProperty(Projections.Property("company.companyName")));
            projectionList.Add(Projections.Count(Projections.Property("compDetail.compDetailsId")));

            criteria.Add(Restrictions.Eq("compDetail.myConfigObj.currentBatch", Common.loggedUser.myConfigObj.currentBatch));
            criteria.Add(Restrictions.Eq("compDetail.myConfigObj.currentDegree", Common.loggedUser.myConfigObj.currentDegree));
            criteria.SetProjection(projectionList);
            criteria.AddOrder(Order.Asc("company.companyName"));

            IList list = persistence.findByCriteria(criteria);

            if (list != null && list.Count > 0)
            {
                IDictionary <string, int> resultMap = new Dictionary <string, int>();

                foreach (Object[] item in list)
                {
                    resultMap.Add(item[0].ToString(), Convert.ToInt32(item[1]));
                }
                return(resultMap);
            }
            else
            {
                return(null);
            }
        }
Example #20
0
        public static DetachedCriteria[] GetPermissionCriteriaByCategory(User user, string category)
        {
            DetachedCriteria[] criteria = new DetachedCriteria[2];

            DetachedCriteria upSubCriteria = DetachedCriteria.For <UserPermission>();

            upSubCriteria.CreateAlias("User", "u");
            upSubCriteria.CreateAlias("Permission", "pm");
            upSubCriteria.CreateAlias("pm.Category", "pmc");
            upSubCriteria.Add(Expression.Eq("pmc.Type", category));
            upSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            upSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria rpSubCriteria = DetachedCriteria.For <RolePermission>();

            rpSubCriteria.CreateAlias("Role", "r");
            rpSubCriteria.CreateAlias("Permission", "pm");
            rpSubCriteria.CreateAlias("pm.Category", "pmc");
            rpSubCriteria.Add(Expression.Eq("pmc.Type", category));
            rpSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria urSubCriteria = DetachedCriteria.For <UserRole>();

            urSubCriteria.CreateAlias("User", "u");
            urSubCriteria.CreateAlias("Role", "r");
            urSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            urSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("r.Code")));

            rpSubCriteria.Add(Subqueries.PropertyIn("r.Code", urSubCriteria));

            criteria[0] = upSubCriteria;
            criteria[1] = rpSubCriteria;

            return(criteria);
        }
Example #21
0
    protected override void SetCriteria()
    {
        DetachedCriteria criteria = DetachedCriteria.For(typeof(CycleCountResult));

        criteria.CreateAlias("CycleCount", "cc");
        criteria.CreateAlias("cc.Location", "l");

        #region Customize
        SecurityHelper.SetRegionSearchCriteria(criteria, "l.Region.Code", this.CurrentUser.Code); //区域权限
        OrderHelper.SetActiveOrderStatusCriteria(criteria, "cc.Status");                          //状态
        #endregion

        #region Select Parameters
        CriteriaHelper.SetPartyCriteria(criteria, "l.Region.Code", this._criteriaParam);
        CriteriaHelper.SetLocationCriteria(criteria, "cc.Location.Code", this._criteriaParam);
        CriteriaHelper.SetStartDateCriteria(criteria, "cc.EffectiveDate", this._criteriaParam);
        CriteriaHelper.SetEndDateCriteria(criteria, "cc.EffectiveDate", this._criteriaParam);
        CriteriaHelper.SetStorageBinCriteria(criteria, "StorageBin.Code", this._criteriaParam);
        CriteriaHelper.SetItemCriteria(criteria, "Item.Code", this._criteriaParam);
        CriteriaHelper.SetOrderNoCriteria(criteria, "CycleCount.Code", this._criteriaParam, MatchMode.Start);
        #endregion

        #region Projections
        ProjectionList projectionList = Projections.ProjectionList()
                                        .Add(Projections.Max("Id").As("Id"))
                                        .Add(Projections.Sum("Qty").As("Qty"))
                                        .Add(Projections.Sum("InvQty").As("InvQty"))
                                        .Add(Projections.Sum("DiffQty").As("DiffQty"))
                                        .Add(Projections.Count("HuId").As("Cartons"))
                                        .Add(Projections.GroupProperty("Item").As("Item"));

        if (!this._criteriaParam.ClassifiedOrderNo)
        {
            projectionList.Add(Projections.GroupProperty("CycleCount").As("CycleCount"));
        }
        if (!this._criteriaParam.ClassifiedLocation)
        {
            projectionList.Add(Projections.GroupProperty("cc.Location").As("Location"));
        }
        if (!this._criteriaParam.ClassifiedBin)
        {
            projectionList.Add(Projections.GroupProperty("StorageBin").As("StorageBin"));//库格
        }
        if (!this._criteriaParam.ClassifiedHuId)
        {
            projectionList.Add(Projections.GroupProperty("HuId").As("HuId"));                           //条码
            projectionList.Add(Projections.GroupProperty("LotNo").As("LotNo"));                         //批号
            projectionList.Add(Projections.GroupProperty("ReferenceLocation").As("ReferenceLocation")); //参考库位
            projectionList.Add(Projections.GroupProperty("DiffReason").As("DiffReason"));               //差异原因
        }

        criteria.SetProjection(projectionList);
        criteria.SetResultTransformer(Transformers.AliasToBean(typeof(CycleCountResult)));
        #endregion

        DetachedCriteria selectCountCriteria = CloneHelper.DeepClone <DetachedCriteria>(criteria);
        selectCountCriteria.SetProjection(Projections.Count("Id"));
        SetSearchCriteria(criteria, selectCountCriteria);
    }
Example #22
0
    protected override void DoSearch()
    {
        string code      = this.tbFlow.Text != string.Empty ? this.tbFlow.Text.Trim() : string.Empty;
        string partyFrom = this.tbPartyFrom.Text != string.Empty ? this.tbPartyFrom.Text.Trim() : string.Empty;
        string partyTo   = this.tbPartyTo.Text != string.Empty ? this.tbPartyTo.Text.Trim() : string.Empty;
        string locFrom   = this.tbLocFrom.Text != string.Empty ? this.tbLocFrom.Text.Trim() : string.Empty;
        string strategy  = this.ddlStrategy.SelectedIndex != -1 ? this.ddlStrategy.SelectedValue : string.Empty;

        if (SearchEvent != null)
        {
            DetachedCriteria selectCriteria      = DetachedCriteria.For(typeof(Flow));
            DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(Flow))
                                                   .SetProjection(Projections.ProjectionList()
                                                                  .Add(Projections.Count("Code")));
            selectCriteria.CreateAlias("PartyFrom", "pf");
            selectCountCriteria.CreateAlias("PartyFrom", "pf");
            selectCriteria.CreateAlias("PartyTo", "pt");
            selectCountCriteria.CreateAlias("PartyTo", "pt");

            #region partyFrom
            SecurityHelper.SetPartyFromSearchCriteria(
                selectCriteria, selectCountCriteria, (this.tbPartyFrom != null ? this.tbPartyFrom.Text : null), BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION, this.CurrentUser.Code);
            #endregion

            #region partyTo
            SecurityHelper.SetPartyToSearchCriteria(
                selectCriteria, selectCountCriteria, (this.tbPartyTo != null ? this.tbPartyTo.Text : null), BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION, this.CurrentUser.Code);
            #endregion

            #region flowType

            selectCriteria.Add(Expression.Eq("Type", BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION));
            selectCountCriteria.Add(Expression.Eq("Type", BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_DISTRIBUTION));
            #endregion

            if (code != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("Code", code));
                selectCountCriteria.Add(Expression.Eq("Code", code));
            }

            if (locFrom != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("LocationFrom.Code", locFrom));
                selectCountCriteria.Add(Expression.Eq("LocationFrom.Code", locFrom));
            }



            if (strategy != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("FlowStrategy", strategy));
                selectCountCriteria.Add(Expression.Eq("FlowStrategy", strategy));
            }

            SearchEvent((new object[] { selectCriteria, selectCountCriteria }), null);
        }
    }
Example #23
0
        public IList <PickListResult> GetPickListResult(string pickListNo)
        {
            DetachedCriteria criteria = DetachedCriteria.For <PickListResult>();

            criteria.CreateAlias("PickListDetail", "pld");
            criteria.CreateAlias("pld.PickList", "pl");
            criteria.Add(Expression.Eq("pl.PickListNo", pickListNo));
            return(this.criteriaMgr.FindAll <PickListResult>(criteria));
        }
Example #24
0
    private object[] CollectParam()
    {
        DetachedCriteria selectCriteria      = DetachedCriteria.For(typeof(BillAgingView));
        DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(BillAgingView))
                                               .SetProjection(Projections.Count("Id"));

        IDictionary <string, string> alias = new Dictionary <string, string>();

        selectCriteria.CreateAlias("BillAddress", "ba");
        selectCountCriteria.CreateAlias("BillAddress", "ba");

        alias.Add("BillAddress", "ba");

        if (this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT)
        {
            selectCriteria.CreateAlias("ba.Party", "pf");
            selectCountCriteria.CreateAlias("ba.Party", "pf");

            alias.Add("BillAddress.Party", "pf");

            if (this.tbParty.Text.Trim() != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("pf.Code", this.tbParty.Text.Trim()));
                selectCountCriteria.Add(Expression.Eq("pf.Code", this.tbParty.Text.Trim()));
            }
            else
            {
                SecurityHelper.SetPartyFromSearchCriteria(
                    selectCriteria, selectCountCriteria, (this.tbParty != null ? this.tbParty.Text : null), this.ModuleType, this.CurrentUser.Code);
            }
            selectCriteria.Add(Expression.Eq("TransactionType", BusinessConstants.BILL_TRANS_TYPE_PO));
            selectCountCriteria.Add(Expression.Eq("TransactionType", BusinessConstants.BILL_TRANS_TYPE_PO));
        }
        else if (this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
        {
            selectCriteria.CreateAlias("ba.Party", "pt");
            selectCountCriteria.CreateAlias("ba.Party", "pt");

            alias.Add("BillAddress.Party", "pt");

            if (this.tbParty.Text.Trim() != string.Empty)
            {
                selectCriteria.Add(Expression.Eq("pt.Code", this.tbParty.Text.Trim()));
                selectCountCriteria.Add(Expression.Eq("pt.Code", this.tbParty.Text.Trim()));
            }
            else
            {
                SecurityHelper.SetPartyToSearchCriteria(
                    selectCriteria, selectCountCriteria, (this.tbParty != null ? this.tbParty.Text : null), this.ModuleType, this.CurrentUser.Code);
            }

            selectCriteria.Add(Expression.Eq("TransactionType", BusinessConstants.BILL_TRANS_TYPE_SO));
            selectCountCriteria.Add(Expression.Eq("TransactionType", BusinessConstants.BILL_TRANS_TYPE_SO));
        }

        return(new object[] { selectCriteria, selectCountCriteria, alias });
    }
Example #25
0
        public static Classificacao[] getClassificacoes(string modalidade, string natureza)
        {
            DetachedCriteria dc2 = DetachedCriteria.For(typeof(Classificacao));

            dc2.CreateAlias("Modalidade", "mod");
            dc2.CreateAlias("Natureza", "nat");
            dc2.Add(Expression.Eq("mod.Id", Convert.ToInt32(modalidade)));
            dc2.Add(Expression.Eq("nat.Id", Convert.ToInt32(natureza)));
            return(Classificacao.FindAll(dc2));
        }
Example #26
0
        public bool VerificarExistenciaValorEstimadoGlobal(int idProcesso)
        {
            DetachedCriteria pesqValorEstGlobal = DetachedCriteria.For(typeof(ValorProcesso));

            pesqValorEstGlobal.CreateAlias("TipoValor", "tpvalor");
            pesqValorEstGlobal.CreateAlias("Processo", "proc");
            pesqValorEstGlobal.Add(Expression.Eq("tpvalor.Descricao", "Estimado Global"));
            pesqValorEstGlobal.Add(Expression.Eq("proc.Id", idProcesso));
            return(ValorProcesso.Exists(pesqValorEstGlobal));
        }
Example #27
0
    protected override void DoSearch()
    {
        string pickListNo = this.tbPickListNo.Text != string.Empty ? this.tbPickListNo.Text.Trim() : string.Empty;
        string startDate  = this.tbStartDate.Text != string.Empty ? this.tbStartDate.Text.Trim() : string.Empty;
        string endDate    = this.tbEndDate.Text != string.Empty ? this.tbEndDate.Text.Trim() : string.Empty;


        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(PickList));

        selectCriteria.Add(Expression.Or(Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS),
                                         Expression.Eq("Status", BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE)));
        selectCriteria.CreateAlias("PartyFrom", "pf");
        selectCriteria.CreateAlias("PartyTo", "pt");


        //partyFrom
        DetachedCriteria[] pfCrieteria = SecurityHelper.GetPartyPermissionCriteria(this.CurrentUser.Code,
                                                                                   BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION);

        selectCriteria.Add(
            Expression.Or(
                Subqueries.PropertyIn("pf.Code", pfCrieteria[0]),
                Subqueries.PropertyIn("pf.Code", pfCrieteria[1])
                ));

        ////partyTo
        //DetachedCriteria[] ptCrieteria = SecurityHelper.GetPartyPermissionCriteria(this.CurrentUser.Code,
        //          BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_REGION, BusinessConstants.CODE_MASTER_PARTY_TYPE_VALUE_CUSTOMER);

        //selectCriteria.Add(
        //    Expression.Or(
        //        Subqueries.PropertyIn("pt.Code", ptCrieteria[0]),
        //        Subqueries.PropertyIn("pt.Code", ptCrieteria[1])
        //));

        if (pickListNo != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("PickListNo", pickListNo));
        }

        if (startDate != string.Empty)
        {
            selectCriteria.Add(Expression.Ge("CreateDate", DateTime.Parse(startDate)));
        }
        if (endDate != string.Empty)
        {
            selectCriteria.Add(Expression.Lt("CreateDate", DateTime.Parse(endDate).AddDays(1)));
        }

        IList <PickList> pickList = TheCriteriaMgr.FindAll <PickList>(selectCriteria);


        this.ucList.BindDataSource(pickList);
        this.ucList.Visible = true;
    }
        public IList <InProcessLocationDetail> GetInProcessLocationDetail(OrderHead orderHead)
        {
            DetachedCriteria criteria = DetachedCriteria.For <InProcessLocationDetail>();

            criteria.CreateAlias("OrderLocationTransaction", "olt");
            criteria.CreateAlias("olt.OrderDetail", "od");
            criteria.CreateAlias("od.OrderHead", "oh");
            criteria.Add(Expression.Eq("oh.OrderNo", orderHead.OrderNo));

            return(this.criteriaMgr.FindAll <InProcessLocationDetail>(criteria));
        }
Example #29
0
    private void DoSearch(bool isExport)
    {
        DetachedCriteria selectCriteria = DetachedCriteria.For(typeof(InspectDetailView));

        selectCriteria.CreateAlias("InspectOrder", "o");
        selectCriteria.CreateAlias("LocationFrom", "lf");
        selectCriteria.CreateAlias("LocationTo", "lt");

        DetachedCriteria selectCountCriteria = DetachedCriteria.For(typeof(InspectDetailView)).SetProjection(Projections.Count("Id"));

        selectCountCriteria.CreateAlias("InspectOrder", "o");
        selectCountCriteria.CreateAlias("LocationFrom", "lf");

        if (this.tbLocation.Text.Trim() != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("lf.Code", this.tbLocation.Text.Trim()));
            selectCountCriteria.Add(Expression.Eq("lf.Code", this.tbLocation.Text.Trim()));
        }
        else
        {
            SecurityHelper.SetRegionSearchCriteria(selectCriteria, "lf.Region", this.CurrentUser.Code);
            SecurityHelper.SetRegionSearchCriteria(selectCountCriteria, "lf.Region", this.CurrentUser.Code);
        }

        if (this.tbStartDate.Text.Trim() != string.Empty)
        {
            DateTime startDate = DateTime.Parse(this.tbStartDate.Text.Trim());
            selectCriteria.Add(Expression.Ge("o.CreateDate", startDate));
            selectCountCriteria.Add(Expression.Ge("o.CreateDate", startDate));
        }

        if (this.tbEndDate.Text.Trim() != string.Empty)
        {
            DateTime endDate = DateTime.Parse(this.tbEndDate.Text.Trim());
            selectCriteria.Add(Expression.Lt("o.CreateDate", endDate.AddDays(1)));
            selectCountCriteria.Add(Expression.Lt("o.CreateDate", endDate.AddDays(1)));
        }

        if (this.tbItemCode.Text.Trim() != string.Empty)
        {
            selectCriteria.Add(Expression.Eq("Item.Code", tbItemCode.Text.Trim()));
            selectCountCriteria.Add(Expression.Eq("Item.Code", tbItemCode.Text.Trim()));
        }


        if (isExport)
        {
            ExportEvent((new object[] { selectCriteria, selectCountCriteria }), null);
        }
        else
        {
            SearchEvent((new object[] { selectCriteria, selectCountCriteria }), null);
        }
    }
Example #30
0
        public static FluxoAndamento getFluxoAndamentoCadastroCadastradoPGE(string modalidade)
        {
            DetachedCriteria dcFluxo = DetachedCriteria.For(typeof(FluxoAndamento));

            dcFluxo.CreateAlias("Fase", "fas");
            dcFluxo.CreateAlias("Atividade", "ati");
            dcFluxo.Add(Expression.Eq("fas.Descricao", "CADASTRO"));
            dcFluxo.Add(Expression.Eq("ati.Descricao", "CADASTRADO"));
            dcFluxo.Add(Expression.Sql("this_.fk_cod_workflow_wor in (select wor.pk_cod_workflow_wor from adm_licitar.tb_workflow_modalidade_unidade_exercicio_wmu wmu inner join adm_licitar.tb_workflow_wor wor on wmu.fk_cod_workflow_wor = wor.pk_cod_workflow_wor where wmu.fk_cod_modalidade_mod='" + modalidade + "')"));
            return(FluxoAndamento.FindFirst(dcFluxo));
        }