コード例 #1
0
        public void SetWipEntities(List <AscmMarkTaskLog> list)
        {
            if (list != null && list.Count > 0)
            {
                string ids = string.Empty;
                foreach (AscmMarkTaskLog ascmMarkTaskLog in list)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += ascmMarkTaskLog.wipEntityId;
                }

                string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "wipentityid");
                string sql = "from AscmWipEntities";

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;

                    IList <AscmWipEntities> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipEntities>(sql);
                    if (ilist != null && ilist.Count > 0)
                    {
                        List <AscmWipEntities> listAscmMarkTaskLog = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipEntities>(ilist);
                        foreach (AscmMarkTaskLog ascmMarkTaskLog in list)
                        {
                            ascmMarkTaskLog.ascmWipEntities = listAscmMarkTaskLog.Find(e => e.wipEntityId.ToString() == ascmMarkTaskLog.wipEntityId.ToString());
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void SetWipEntities(List <AscmDiscreteJobs> list)
        {
            if (list != null && list.Count > 0)
            {
                string ids = string.Empty;
                foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += "'" + ascmDiscreteJobs.jobId + "'";
                }
                string sql = "from AscmWipEntities";
                string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "name");

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }

                IList <AscmWipEntities> ilistAscmWipEntities = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipEntities>(sql);
                if (ilistAscmWipEntities != null && ilistAscmWipEntities.Count > 0)
                {
                    List <AscmWipEntities> listAscmWipEntities = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipEntities>(ilistAscmWipEntities);
                    foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
                    {
                        ascmDiscreteJobs.ascmWipEntities = listAscmWipEntities.Find(e => e.name == ascmDiscreteJobs.jobId);
                    }
                }
            }
        }
コード例 #3
0
 public void SetDRanker(List <AscmAllocateRule> list)
 {
     if (list != null && list.Count > 0)
     {
         string ids = string.Empty;
         foreach (AscmAllocateRule ascmAllocateRule in list)
         {
             if ((!string.IsNullOrEmpty(ids)) && (!string.IsNullOrEmpty(ascmAllocateRule.dRankerName)))
             {
                 ids += ",";
             }
             if (!string.IsNullOrEmpty(ascmAllocateRule.dRankerName))
             {
                 ids += "'" + ascmAllocateRule.dRankerName + "'";
             }
         }
         string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId");
         if (!string.IsNullOrEmpty(where))
         {
             string sql = "from AscmUserInfo where " + where;
             IList <AscmUserInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmUserInfo>(sql);
             if (ilist != null && ilist.Count > 0)
             {
                 List <AscmUserInfo> listAscmUserInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmUserInfo>(ilist);
                 foreach (AscmAllocateRule ascmAllocateRule in list)
                 {
                     if (!string.IsNullOrEmpty(ascmAllocateRule.dRankerName))
                     {
                         ascmAllocateRule.ascmUserInfoDRanker = listAscmUserInfo.Find(e => e.userId == ascmAllocateRule.dRankerName);
                     }
                 }
             }
         }
     }
 }
コード例 #4
0
        public void SetGetMaterialTask(List <AscmMarkTaskLog> list)
        {
            if (list != null && list.Count > 0)
            {
                string ids = string.Empty;
                foreach (AscmMarkTaskLog ascmMarkTaskLog in list)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += ascmMarkTaskLog.taskId;
                }

                string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "id");
                string sql = "from AscmGetMaterialTask";

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;

                    IList <AscmGetMaterialTask> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmGetMaterialTask>(sql);
                    if (ilist != null && ilist.Count > 0)
                    {
                        List <AscmGetMaterialTask> listAscmGetMaterialTask = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmGetMaterialTask>(ilist);
                        foreach (AscmMarkTaskLog ascmMarkTaskLog in list)
                        {
                            ascmMarkTaskLog.ascmGetMaterialTask = listAscmGetMaterialTask.Find(e => e.id == ascmMarkTaskLog.taskId);
                        }
                    }
                }
            }
        }
コード例 #5
0
 private void SetMaterialCategory(List <AscmMaterialSubCategory> list)
 {
     if (list != null && list.Count > 0)
     {
         string ids = string.Empty;
         foreach (AscmMaterialSubCategory ascmMaterialSubCategory in list)
         {
             if (!string.IsNullOrEmpty(ids))
             {
                 ids += ",";
             }
             ids += "" + ascmMaterialSubCategory.categoryId + "";
         }
         string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "id");
         if (!string.IsNullOrEmpty(where))
         {
             string sql = "from AscmMaterialCategory where " + where;
             IList <AscmMaterialCategory> ilistAscmMaterialCategory = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmMaterialCategory>(sql);
             if (ilistAscmMaterialCategory != null && ilistAscmMaterialCategory.Count > 0)
             {
                 List <AscmMaterialCategory> listAscmMaterialCategory = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmMaterialCategory>(ilistAscmMaterialCategory);
                 foreach (AscmMaterialSubCategory ascmMaterialSubCategory in list)
                 {
                     ascmMaterialSubCategory.ascmMaterialCategory = listAscmMaterialCategory.Find(e => e.id == ascmMaterialSubCategory.categoryId);
                 }
             }
         }
     }
 }
コード例 #6
0
        public void SetLogisticsClass(List <AscmAllocateRule> list)
        {
            if (list != null && list.Count > 0)
            {
                string ids = string.Empty;
                foreach (AscmAllocateRule ascmAllocateRule in list)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += ascmAllocateRule.logisticsClassId;
                }

                string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "id");
                string sql = "from AscmLogisticsClassInfo";

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                    IList <AscmLogisticsClassInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLogisticsClassInfo>(sql);
                    if (ilist != null && ilist.Count > 0)
                    {
                        List <AscmLogisticsClassInfo> listAscmLogisticsClassInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmLogisticsClassInfo>(ilist);
                        foreach (AscmAllocateRule ascmAllocateRule in list)
                        {
                            if (!string.IsNullOrEmpty(ascmAllocateRule.logisticsClassId.ToString()) && ascmAllocateRule.logisticsClassId != 0)
                            {
                                ascmAllocateRule.ascmLogisticsClassInfo = listAscmLogisticsClassInfo.Find(e => e.id == ascmAllocateRule.logisticsClassId);
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
 public void SetRanker(List <AscmDiscreteJobs> list)
 {
     if (list != null && list.Count > 0)
     {
         string ids = string.Empty;
         foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
         {
             if (!string.IsNullOrEmpty(ids))
             {
                 ids += ",";
             }
             ids += "'" + ascmDiscreteJobs.workerId + "'";
         }
         string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId");
         if (!string.IsNullOrEmpty(where))
         {
             string         sql   = "from YnUser where " + where;
             IList <YnUser> ilist = YnFrame.Dal.YnDaoHelper.GetInstance().nHibernateHelper.Find <YnUser>(sql);
             if (ilist != null && ilist.Count > 0)
             {
                 List <YnUser> listYnUser = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <YnUser>(ilist);
                 foreach (AscmDiscreteJobs ascmDiscreteJobs in list)
                 {
                     ascmDiscreteJobs.ynUser = listYnUser.Find(e => e.userId == ascmDiscreteJobs.workerId);
                 }
             }
         }
     }
 }
コード例 #8
0
 public void SetMonitorLeader(List <AscmLogisticsClassInfo> list)
 {
     if (list != null && list.Count > 0)
     {
         string ids = string.Empty;
         foreach (AscmLogisticsClassInfo ascmLogisticsClassInfo in list)
         {
             if (!string.IsNullOrEmpty(ids))
             {
                 ids += ",";
             }
             if (!string.IsNullOrEmpty(ascmLogisticsClassInfo.monitorLeader))
             {
                 ids += "'" + ascmLogisticsClassInfo.monitorLeader + "'";
             }
         }
         string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId");
         if (!string.IsNullOrEmpty(where))
         {
             string sql = "from AscmUserInfo where " + where;
             IList <AscmUserInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmUserInfo>(sql);
             if (ilist != null && ilist.Count > 0)
             {
                 List <AscmUserInfo> listUser = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmUserInfo>(ilist);
                 foreach (AscmLogisticsClassInfo ascmLogisticsClassInfo in list)
                 {
                     ascmLogisticsClassInfo.monitorUser = listUser.Find(e => e.userId == ascmLogisticsClassInfo.monitorLeader);
                 }
             }
         }
     }
 }
コード例 #9
0
 public static AscmCommonHelperService GetInstance()
 {
     if (service == null)
     {
         service = new AscmCommonHelperService();
     }
     return(service);
 }
コード例 #10
0
 public void SetLogisticsClassName(List <AscmAllocateRule> list)
 {
     if (list != null && list.Count > 0)
     {
         foreach (AscmAllocateRule ascmAllocateRule in list)
         {
             ascmAllocateRule.logisticsClassName = AscmCommonHelperService.GetInstance().DisplayLogisticsClass(ascmAllocateRule.logisticsClass);
         }
     }
 }
コード例 #11
0
        public string getTaskId(int number)
        {
            string autoTask = AscmCommonHelperService.GetInstance().GetConfigTaskWords(0);

            int a = number / 1000;
            int b = (number - a * 1000) / 100;
            int c = (number - a * 1000 - b * 100) / 10;
            int d = (number - a * 1000 - b * 100 - c * 10);

            return(autoTask + a.ToString() + b.ToString() + c.ToString() + d.ToString());
        }
コード例 #12
0
ファイル: AscmForkliftService.cs プロジェクト: wuhuayun/Midea
 public void SetWorker(List <AscmForklift> list, bool isSetLogisticsClassName = true)
 {
     if (list != null && list.Count > 0)
     {
         string ids = string.Empty;
         foreach (AscmForklift ascmForklift in list)
         {
             if (!string.IsNullOrEmpty(ids) && !string.IsNullOrEmpty(ascmForklift.workerId))
             {
                 ids += ",";
             }
             if (!string.IsNullOrEmpty(ascmForklift.workerId))
             {
                 ids += "'" + ascmForklift.workerId + "'";
             }
         }
         string where = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "userId");
         if (!string.IsNullOrEmpty(where))
         {
             string sql = "from AscmUserInfo where " + where;
             IList <AscmUserInfo> ilistAscmUserInfo = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmUserInfo>(sql);
             if (ilistAscmUserInfo != null && ilistAscmUserInfo.Count > 0)
             {
                 List <AscmUserInfo> listAscmUserInfo = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmUserInfo>(ilistAscmUserInfo);
                 if (isSetLogisticsClassName)
                 {
                     AscmUserInfoService.GetInstance().SetUserLogisticsClass(listAscmUserInfo);
                 }
                 foreach (AscmForklift ascmForklift in list)
                 {
                     if (!string.IsNullOrEmpty(ascmForklift.workerId))
                     {
                         ascmForklift.ascmUserInfo = listAscmUserInfo.Find(e => e.userId == ascmForklift.workerId);
                     }
                     if (isSetLogisticsClassName && ascmForklift.ascmUserInfo != null)
                     {
                         ascmForklift.logisticsClassName = ascmForklift.ascmUserInfo.logisticsClassName;
                     }
                 }
             }
         }
     }
 }
コード例 #13
0
 public static AscmCommonHelperService GetInstance()
 {
     if (service == null)
         service = new AscmCommonHelperService();
     return service;
 }
コード例 #14
0
ファイル: AscmForkliftService.cs プロジェクト: wuhuayun/Midea
        //public List<AscmForklift> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string queryOtherWord)
        //{
        //    List<AscmForklift> list = null;
        //    try
        //    {
        //        string sort = " order by id ";
        //        if (!string.IsNullOrEmpty(sortName))
        //        {
        //            sort = " order by " + sortName.Trim() + " ";
        //            if (!string.IsNullOrEmpty(sortOrder))
        //                sort += sortOrder.Trim();
        //        }
        //        string sql = "from AscmForklift";

        //        string where = "", whereQueryWord = "";
        //        if (!string.IsNullOrEmpty(queryWord))
        //        {
        //            whereQueryWord = "forkliftType = '" + queryWord.Trim() + "'";
        //            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
        //        }
        //        if (!string.IsNullOrEmpty(queryOtherWord))
        //        {
        //            string sSql = " from YnUser where userName like '" + queryOtherWord + "%'";
        //            IList<YnUser> ilistYnUser = YnFrame.Dal.YnDaoHelper.GetInstance().nHibernateHelper.Find<YnUser>(sSql);
        //            if (ilistYnUser != null && ilistYnUser.Count > 0)
        //            {
        //                queryOtherWord = "";
        //                foreach (YnUser ynUser in ilistYnUser)
        //                {
        //                    if (!string.IsNullOrEmpty(queryOtherWord))
        //                        queryOtherWord += ",";
        //                    queryOtherWord += "'" + ynUser.userName + "'";
        //                }
        //            }
        //            whereQueryWord = "workerId in (" + queryOtherWord + ")";
        //            where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
        //        }

        //        if (!string.IsNullOrEmpty(where))
        //            sql += " where " + where;
        //        IList<AscmForklift> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmForklift>(sql, sql, ynPage);
        //        if (ilist != null)
        //        {
        //            list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmForklift>(ilist);
        //            SetWorker(list);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmForklift)",ex);
        //        throw ex;
        //    }
        //    return list;
        //}

        public List <AscmForklift> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string whereOther, bool isSetWorker = true)
        {
            List <AscmForklift> list = null;

            try
            {
                string sort = " order by id ";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = " order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }

                string sql = "from AscmForklift";
                string where = "", whereQueryWord = "";

                if (!string.IsNullOrEmpty(queryWord))
                {
                    string whereOtherWord = "";
                    whereQueryWord = "userName like '" + queryWord + "%'";
                    List <AscmUserInfo> listAscmUserInfo = AscmUserInfoService.GetInstance().GetList(null, "", "", "", whereQueryWord);
                    string ids = string.Empty;
                    if (listAscmUserInfo != null && listAscmUserInfo.Count > 0)
                    {
                        foreach (AscmUserInfo ascmUserInfo in listAscmUserInfo)
                        {
                            if (!string.IsNullOrEmpty(ids))
                            {
                                ids += ",";
                            }
                            ids += ascmUserInfo.userId;
                        }

                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "workerId");
                        whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord);
                    }

                    whereQueryWord = "forkliftNumber like '%" + queryWord + "%'";
                    whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord);

                    whereQueryWord = "assetsId like '%" + queryWord + "%'";
                    whereOtherWord = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(whereOtherWord, whereQueryWord);

                    where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOtherWord);
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                if (!string.IsNullOrEmpty(sort))
                {
                    sql += sort;
                }

                IList <AscmForklift> ilist = null;
                if (ynPage != null)
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmForklift>(sql, sql, ynPage);
                }
                else
                {
                    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmForklift>(sql);
                }

                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmForklift>(ilist);
                    if (isSetWorker)
                    {
                        SetWorker(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmForklift)", ex);
                throw ex;
            }

            return(list);
        }
コード例 #15
0
        public List <AscmDiscreteJobs> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord, string queryStartTime, string queryEndTime, string queryType, string queryRanker, string userName)
        {
            List <AscmDiscreteJobs> list = null;

            try
            {
                string sort = "", whereQueryWord = "", where = "", where_Param = "";
                string userRole          = AscmUserInfoService.GetInstance().GetUserRoleName(userName);
                string userLogisticsName = AscmUserInfoService.GetInstance().GetUserLogisticsName(userName, userRole);

                string hql        = "from AscmDiscreteJobs";
                string hql_ParamZ = "select zRankerName from AscmAllocateRule";
                string hql_ParamD = "select dRankerName from AscmAllocateRule";

                string sql = "select * from ASCM_DISCRETE_JOBS";

                if (userRole == "领料员")
                {
                    whereQueryWord = "workerName = '" + userName + "'";
                    where_Param    = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where_Param, whereQueryWord);
                }
                else if (userRole == "总装排产员" || userRole == "电装排产员")
                {
                    whereQueryWord = "workerId = '" + userName + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }
                else
                {
                    if (!string.IsNullOrEmpty(userLogisticsName))
                    {
                        IList <AscmLogisticsClassInfo> ilistAscmLogisticsClassInfo = AscmLogisticsClassInfoService.GetInstance().GetList("from AscmLogisticsClassInfo where logisticsClass in (" + userLogisticsName + ")", false, false);
                        string ids = string.Empty;
                        if (ilistAscmLogisticsClassInfo != null && ilistAscmLogisticsClassInfo.Count > 0)
                        {
                            foreach (AscmLogisticsClassInfo ascmlogisticsClassInfo in ilistAscmLogisticsClassInfo)
                            {
                                if (!string.IsNullOrEmpty(ids))
                                {
                                    ids += ",";
                                }
                                ids += ascmlogisticsClassInfo.id;
                            }
                        }

                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "logisticsClassId");
                        where_Param    = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where_Param, whereQueryWord);
                    }
                }

                if (!string.IsNullOrEmpty(where_Param))
                {
                    string newCondition = string.Empty;
                    hql_ParamZ  += " where " + where_Param;
                    hql_ParamZ   = "workerId in (" + hql_ParamZ + ")";
                    newCondition = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(newCondition, hql_ParamZ);

                    hql_ParamD  += " where " + where_Param;
                    hql_ParamD   = "workerId in (" + hql_ParamD + ")";
                    newCondition = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(newCondition, hql_ParamD);
                    where       += "(" + newCondition + ")";
                }

                if (!string.IsNullOrEmpty(queryType))
                {
                    whereQueryWord = "identificationId = " + queryType;
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime))
                {
                    queryStartTime = queryStartTime + " 00:00:00";
                    queryEndTime   = queryEndTime + " 23:59:59";

                    whereQueryWord = "createTime > '" + queryStartTime + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);

                    whereQueryWord = "createTime <= '" + queryEndTime + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }
                else if (!string.IsNullOrEmpty(queryStartTime) && string.IsNullOrEmpty(queryEndTime))
                {
                    whereQueryWord = "createTime like '" + queryStartTime + "%'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }
                else if (string.IsNullOrEmpty(queryStartTime) && !string.IsNullOrEmpty(queryEndTime))
                {
                    whereQueryWord = "createTime like '" + queryEndTime + "%'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryRanker))
                {
                    whereQueryWord = "workerId = '" + queryRanker + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(where))
                {
                    hql += " where " + where;
                    sql += " where " + where;
                }

                sql = sql.Replace("AscmAllocateRule", "ASCM_ALLOCATE_RULE");

                object object1 = YnDaoHelper.GetInstance().nHibernateHelper.GetObjectBySQL("select count(*) from (" + sql + ")");
                int    count   = 0;
                int.TryParse(object1.ToString(), out count);
                IList <AscmDiscreteJobs> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDiscreteJobs>(hql, count, ynPage);
                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDiscreteJobs>(ilist);
                    SetRanker(list);
                    list = list.OrderBy(e => e.workerId).OrderBy(e => e.productLine).OrderBy(e => e.sequence).OrderBy(e => e.identificationId).OrderBy(e => e.id).ToList();
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDiscreteJobs)", ex);
                throw ex;
            }

            return(list);
        }
コード例 #16
0
        //public List<AscmDiscreteJobs> GetList(YnPage ynPage, string sortName, string sortOrder, string queryWord)
        //{
        //    List<AscmDiscreteJobs> list = null;
        //    try
        //    {
        //        string sort = "";
        //        if (!string.IsNullOrEmpty(sortName))
        //        {
        //            sort = "order by " + sortName.Trim() + " " ;
        //            if (!string.IsNullOrEmpty(sortOrder))
        //                sort += sortOrder.Trim();
        //        }

        //        string sql = "from AscmDiscreteJobs";
        //        IList<AscmDiscreteJobs> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDiscreteJobs>(sql + sort, sql, ynPage);
        //        if (ilist != null)
        //        {
        //            list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmDiscreteJobs>(ilist);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDiscreteJobs)", ex);
        //        throw ex;
        //    }
        //    return list;
        //}

        public List <AscmDiscreteJobs> GetList(YnPage ynpage, string sortName, string sortOrder, string queryWord, string queryDate, string queryType, string queryRanker, string userLogistisClass, string userRole, string userName)
        {
            List <AscmDiscreteJobs> list = null;

            try
            {
                string sort = "", whereQueryWord = "", where = "";
                string sql = "from AscmDiscreteJobs";
                if (!string.IsNullOrEmpty(sortName))
                {
                    sort = "order by " + sortName.Trim() + " ";
                    if (!string.IsNullOrEmpty(sortOrder))
                    {
                        sort += sortOrder.Trim();
                    }
                }

                if (!string.IsNullOrEmpty(queryDate))
                {
                    whereQueryWord = "createTime like '%" + queryDate + "%'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(queryType))
                {
                    whereQueryWord = "identificationId = " + queryType;
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                }

                if (!string.IsNullOrEmpty(userLogistisClass))
                {
                    IList <AscmLogisticsClassInfo> ilistAscmLogisticsClassInfo = AscmLogisticsClassInfoService.GetInstance().GetList("from AscmLogisticsClassInfo where logisticsClass in (" + userLogistisClass + ")", false, false);
                    string ids = string.Empty;
                    if (ilistAscmLogisticsClassInfo != null && ilistAscmLogisticsClassInfo.Count > 0)
                    {
                        foreach (AscmLogisticsClassInfo ascmlogisticsClassInfo in ilistAscmLogisticsClassInfo)
                        {
                            if (!string.IsNullOrEmpty(ids))
                            {
                                ids += ",";
                            }
                            ids += ascmlogisticsClassInfo.id;
                        }
                    }

                    string newCondition = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "logisticsClassId");
                    if (!string.IsNullOrEmpty(newCondition))
                    {
                        string newsql = "from AscmAllocateRule where " + newCondition;
                        IList <AscmAllocateRule> ilistAscmAllocateRule = AscmAllocateRuleService.GetInstance().GetList(newsql, false, false, false);
                        ids = "";
                        if (ilistAscmAllocateRule != null && ilistAscmAllocateRule.Count > 0)
                        {
                            foreach (AscmAllocateRule ascmAllocateRule in ilistAscmAllocateRule)
                            {
                                if (!string.IsNullOrEmpty(ids) && (!string.IsNullOrEmpty(ascmAllocateRule.zRankerName) || !string.IsNullOrEmpty(ascmAllocateRule.dRankerName)))
                                {
                                    ids += ",";
                                }
                                if (!string.IsNullOrEmpty(ascmAllocateRule.zRankerName))
                                {
                                    ids += "'" + ascmAllocateRule.zRankerName + "'";
                                }
                                if (!string.IsNullOrEmpty(ids) && !string.IsNullOrEmpty(ascmAllocateRule.dRankerName))
                                {
                                    ids += ",";
                                }
                                if (!string.IsNullOrEmpty(ascmAllocateRule.dRankerName))
                                {
                                    ids += "'" + ascmAllocateRule.dRankerName + "'";
                                }
                            }
                        }

                        if (string.IsNullOrEmpty(queryRanker))
                        {
                            whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "workerId");
                            where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                        }
                        else
                        {
                            if (ids.IndexOf(queryRanker) > -1)
                            {
                                whereQueryWord = "workerId like '%" + queryRanker + "%'";
                                where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                            }
                            else
                            {
                                whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "workerId");
                                where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                            }
                        }
                    }
                }
                else
                {
                    if (userRole == "总装排产员" || userRole == "电装排产员")
                    {
                        whereQueryWord = "workerId = '" + userName + "'";
                        where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                    }
                    else if (userRole == "领料员")
                    {
                        string newsql = "from AscmAllocateRule where workerName = '" + userName + "'";
                        string ids    = string.Empty;
                        IList <AscmAllocateRule> ilistAscmAllocateRule = AscmAllocateRuleService.GetInstance().GetList(newsql, false, false, false);
                        if (ilistAscmAllocateRule != null && ilistAscmAllocateRule.Count > 0)
                        {
                            foreach (AscmAllocateRule ascmAllocateRule in ilistAscmAllocateRule)
                            {
                                if (!string.IsNullOrEmpty(ids))
                                {
                                    ids += ",";
                                }
                                if (!string.IsNullOrEmpty(ascmAllocateRule.zRankerName))
                                {
                                    ids += "'" + ascmAllocateRule.zRankerName + "'";
                                }
                                if (!string.IsNullOrEmpty(ascmAllocateRule.dRankerName))
                                {
                                    ids += "'" + ascmAllocateRule.dRankerName + "'";
                                }
                            }
                        }

                        whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "workerId");
                        where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                    }
                }

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where + " order by workerId,workerId,productLine,sequence,id";
                    IList <AscmDiscreteJobs> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDiscreteJobs>(sql, sql, ynpage);
                    if (ilist != null && ilist.Count > 0)
                    {
                        list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDiscreteJobs>(ilist);
                        SetRanker(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDiscreteJobs)", ex);
                throw ex;
            }

            return(list);
        }
コード例 #17
0
        /// <summary>
        /// 关联作业@2014-04-22
        /// </summary>
        /// <param name="ynPage"></param>
        /// <param name="sortName"></param>
        /// <param name="sortOrder"></param>
        /// <param name="queryWord"></param>
        /// <param name="queryStartTime"></param>
        /// <param name="queryEndTime"></param>
        /// <param name="materialId"></param>
        /// <returns></returns>
        public List <AscmDiscreteJobs> GetRelatedDiscreteJobs(YnPage ynPage, string sortName, string sortOrder, string queryWord, string queryStartTime, string queryEndTime, int materialId)
        {
            List <AscmDiscreteJobs> list = null;

            try
            {
                //string hql_ParamData = "from AscmWipRequirementOperations where wipentityId in (select t1.wipentityId from AscmWipEntities t1, AscmDiscreteJobs t2 where t1.name = t2.jobId and t2.createTime > '{0}' and t2.createTime <= '{1}') and inventoryItemId = {2}";
                string hql_ParamData = "select new AscmWipRequirementOperations(t1.wipEntityId) from AscmWipRequirementOperations t1, AscmWipEntities t2, AscmDiscreteJobs t3 where t2.name = t3.jobId and t1.wipEntityId = t2.wipEntityId and t3.jobDate >= '{0}' and t3.jobDate <= '{1}' and t1.inventoryItemId = {2}";
                //string hql_ParamData = "select t1.wipEntityId from AscmWipRequirementOperations t1, AscmWipEntities t2, AscmDiscreteJobs t3 where t2.name = t3.jobId and t1.wipentityId = t2.wipentityId and t3.jobDate > '{0}' and t3.jobDate <= '{1}' and t1.inventoryItemId = {2}";
                string hql       = "from AscmDiscreteJobs where jobId in ({0})";
                string hql_Param = "select name from AscmWipEntities";

                hql_ParamData = string.Format(hql_ParamData, queryStartTime, queryEndTime, materialId);

                IList <AscmWipRequirementOperations> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipRequirementOperations>(hql_ParamData);
                if (ilist != null && ilist.Count > 0)
                {
                    List <AscmWipRequirementOperations> newlist = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipRequirementOperations>(ilist);
                    var    wipEntityIds = newlist.Select(P => P.wipEntityId).Distinct();
                    var    count        = wipEntityIds.Count();
                    string ids          = string.Empty;
                    for (int i = 0; i < count; i++)
                    {
                        if (!string.IsNullOrEmpty(ids))
                        {
                            ids += ",";
                        }
                        ids += wipEntityIds.ElementAt(i);
                    }

                    string where   = "", whereQueryWord = "";
                    whereQueryWord = AscmCommonHelperService.GetInstance().IsJudgeListCount(ids, "wipentityId");
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);

                    if (!string.IsNullOrEmpty(where))
                    {
                        hql_Param += " where " + where;
                        hql        = string.Format(hql, hql_Param);
                    }

                    IList <AscmDiscreteJobs> ilistAscmDiscreteJobs = null;
                    if (ynPage != null)
                    {
                        ilistAscmDiscreteJobs = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDiscreteJobs>(hql, hql, ynPage);
                    }
                    else
                    {
                        ilistAscmDiscreteJobs = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDiscreteJobs>(hql);
                    }
                    if (ilistAscmDiscreteJobs != null && ilistAscmDiscreteJobs.Count > 0)
                    {
                        list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDiscreteJobs>(ilistAscmDiscreteJobs);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDiscreteJobs)", ex);
                throw ex;
            }

            return(list);
        }