Ejemplo n.º 1
0
 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;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        public string SuplierSiteCode()
        {
            string hql = "from  AscmSupplier where id in (select DISTINCT supplierId from AscmContainer)";
            IList <MideaAscm.Dal.Base.Entities.AscmSupplier> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <MideaAscm.Dal.Base.Entities.AscmSupplier>(hql);
            List <MideaAscm.Dal.Base.Entities.AscmSupplier>  list  = null;

            if (ilist != null && ilist.Count > 0)
            {
                list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <MideaAscm.Dal.Base.Entities.AscmSupplier>(ilist);
                System.Text.StringBuilder sbSn = new System.Text.StringBuilder();
                sbSn.Clear();
                var q = list.Select(e => e.id).Distinct();
                foreach (int supplierId in q)
                {
                    if (sbSn.Length != 0)
                    {
                        sbSn.Append(",");
                    }
                    sbSn.AppendFormat("{0}", supplierId);
                }
                if (string.IsNullOrEmpty(sbSn.ToString()))
                {
                    return("");
                }
                IList <MideaAscm.Dal.Base.Entities.AscmSupplierAddress> ilistII             = YnDaoHelper.GetInstance().nHibernateHelper.Find <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>("from AscmSupplierAddress where vendorId in (" + sbSn.ToString() + ")");
                List <MideaAscm.Dal.Base.Entities.AscmSupplierAddress>  listAscmReadingHead = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList(ilistII);
                if (ilist.Count > 0)
                {
                    foreach (Dal.Base.Entities.AscmSupplier ascmTagLog in list)
                    {
                        if (ascmTagLog.id == 6128)
                        {
                            ascmTagLog.name = "美的";
                        }
                        else
                        {
                            ascmTagLog.name = listAscmReadingHead.Find(e => e.vendorId == ascmTagLog.id).vendorSiteCode;
                        }
                    }
                }
            }
            return(YnBaseClass2.Helper.ObjectHelper.Serialize(list));
        }
Ejemplo n.º 3
0
        public AscmEmployee GetByRfid(string rfid)
        {
            AscmEmployee ascmEmployee = null;

            try
            {
                IList <AscmEmployee> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmEmployee>("from AscmEmployee where id in (select bindId from AscmRfid where id='" + rfid + "')");// and status='" + AscmRfid.StatusDefine.inUse + "'
                if (ilist != null && ilist.Count > 0)
                {
                    return(ilist[0]);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmEmployee)", ex);
                throw ex;
            }
            return(ascmEmployee);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 超期预警数据查询Excel导出
        /// 覃小华于2013/10/22修改
        /// </summary>
        /// <param name="ynPage"></param>
        /// <param name="sortName"></param>
        /// <param name="sortOrder"></param>
        /// <param name="queryWord"></param>
        /// <param name="whereOther"></param>
        /// <param name="extendedTime"></param>
        /// <returns></returns>
        public List <Dal.SupplierPreparation.Entities.AscmContainer> GetlistForExcellExport(string whereOther, string DateRequired)
        {
            List <Dal.SupplierPreparation.Entities.AscmContainer> list = null;

            try
            {
                string strHql = @"select new AscmContainer(container,(suppli.name),(to_char(to_date(container.storeInTime,'yyyy-MM-dd HH24:mi:ss')+suppli.warnHours/24,'yyyy-MM-dd HH24:mi:ss')),(ceil(((to_date('" + System.DateTime.Now.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)))  from AscmContainer container, AscmSupplier suppli  where container.storeInTime is not null and  container.supplierId=suppli.id  and  (suppli.warnHours is not null and suppli.warnHours!=0) and ceil(((to_date('" + System.DateTime.Now.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)>-25 and (container.place not in (select to_char(id) from  AscmReadingHead where ip='0.0.0.0') or container.place is null)";
                //string strHql1 = "from AscmContainer container, AscmSupplier suppli where container.storeInTime is not null and  container.supplierId=suppli.id  and  (suppli.warnHours is not null or suppli.warnHours!=0) and ceil(((to_date('" + System.DateTime.Now.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)>-25 and (container.place not in (select to_char(id) from  AscmReadingHead where address= '容器监管中心' and ip='0.0.0.0') or container.place is null)";
                if (!string.IsNullOrEmpty(DateRequired))
                {
                    DateTime DatereadTime = new DateTime();
                    if (!string.IsNullOrEmpty(DateRequired) && DateTime.TryParse(DateRequired, out DatereadTime))
                    {
                        strHql = @"select new AscmContainer(container,(suppli.name),to_char(to_date(container.storeInTime,'yyyy-MM-dd HH24:mi:ss')+suppli.warnHours/24,'yyyy-MM-dd HH24:mi:ss'),(ceil(((to_date('" + DatereadTime.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)))  from AscmContainer container, AscmSupplier suppli  where container.storeInTime is not null and  container.supplierId=suppli.id  and  (suppli.warnHours is not null and suppli.warnHours!=0) and ceil(((to_date('" + DatereadTime.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)>-25 and (container.place not in (select to_char(id) from  AscmReadingHead where ip='0.0.0.0') or container.place is null)";
                        //  strHql1 = "from AscmContainer container, AscmSupplier suppli where container.storeInTime is not null and  container.supplierId=suppli.id  and  (suppli.warnHours is not null and suppli.warnHours!=0) and ceil(((to_date('" + DatereadTime.ToString() + "','yyyy-MM-dd HH24:mi:ss')-suppli.warnHours/24)-to_date(container.storeInTime, 'yyyy-MM-dd HH24:mi:ss'))*24)>-25 and (container.place not in (select to_char(id) from  AscmReadingHead where ip='0.0.0.0') or container.place is null)";
                    }
                }
                //string sort = " order by store.id ";
                string where = "";
                //in (select id from AscmSupplier where warnHours is not null or warnHours!=0) and sn not in (SELECT containerId  FROM AscmStoreInOut a WHERE readTime=(SELECT max(readTime) FROM AscmStoreInOut WHERE containerId=a.containerId) and  direction='STOREOUT')";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);
                if (!string.IsNullOrEmpty(where))
                {
                    strHql += " and" + where;
                    // strHql1 += " and" + where;
                }
                IList <Dal.SupplierPreparation.Entities.AscmContainer> ilist =

                    //YnDaoHelper.GetInstance().nHibernateHelper.Find<Dal.SupplierPreparation.Entities.AscmContainer>(strHql1);
                    YnDaoHelper.GetInstance().nHibernateHelper.Find <Dal.SupplierPreparation.Entities.AscmContainer>(strHql
                                                                                                                     );
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <Dal.SupplierPreparation.Entities.AscmContainer>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWipEntities)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 5
0
        ///<summary>获取卡信息列表</summary>
        ///<returns>返回卡信息列表</returns>
        public List <AscmReadingHead> GetList(string sql)
        {
            List <AscmReadingHead> list = null;

            try
            {
                IList <AscmReadingHead> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmReadingHead>(sql);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmReadingHead>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmReadingHead)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 6
0
        public AscmPalletDelivery Add(string palletSn, int batSumMainId, int deliveryOrderBatchId, int materialId, decimal quantity)
        {
            try
            {
                AscmPalletDelivery ascmPalletDelivery = new AscmPalletDelivery();
                ascmPalletDelivery.organizationId       = 0;
                ascmPalletDelivery.createUser           = "";
                ascmPalletDelivery.createTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmPalletDelivery.modifyUser           = "";
                ascmPalletDelivery.modifyTime           = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                ascmPalletDelivery.palletSn             = palletSn;
                ascmPalletDelivery.batSumMainId         = batSumMainId;
                ascmPalletDelivery.deliveryOrderBatchId = deliveryOrderBatchId;
                ascmPalletDelivery.deliveryOrderId      = 0;
                ascmPalletDelivery.materialId           = materialId;
                ascmPalletDelivery.quantity             = quantity;
                //ascmPalletDelivery.status = "";
                ascmPalletDelivery.memo = "";

                int maxId = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmPalletDelivery");
                maxId++;
                ascmPalletDelivery.id = maxId;
                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmPalletDelivery);
                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
                return(ascmPalletDelivery);
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmPalletDelivery)", ex);
                throw ex;
            }
        }
Ejemplo n.º 7
0
 public List<AscmDoor> GetList()
 {
     List<AscmDoor> list = null;
     try
     {
         string sql = "from AscmDoor ";
         IList<AscmDoor> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDoor>(sql);
         if (ilist != null)
         {
             list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmDoor>(ilist);
         }
     }
     catch (Exception ex)
     {
         YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDoor)", ex);
         throw ex;
     }
     return list;
 }
Ejemplo n.º 8
0
        public List <AscmWarelocation> GetList(string sortName, string sortOrder, string queryWord, string whereOther)
        {
            List <AscmWarelocation> list = null;

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

                string where = "", whereQueryWord = "";
                if (!string.IsNullOrEmpty(queryWord))
                {
                    whereQueryWord = " docNumber like '%" + queryWord.Trim() + "%'";
                }
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

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

                IList <AscmWarelocation> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWarelocation>(sql + sort);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWarelocation>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmWarelocation)", ex);
                throw ex;
            }
            return(list);
        }
        public void SetPreparationDocNumbers(List <AscmWmsMtlRequisitionMain> list)
        {
            if (list != null && list.Count > 0)
            {
                var    ieIds = list.Select(P => P.id).Distinct();
                var    count = ieIds.Count();
                string ids   = string.Empty;
                for (int i = 0; i < count; i++)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        ids += ",";
                    }
                    ids += ieIds.ElementAt(i);
                }

                if (!string.IsNullOrEmpty(ids))
                {
                    string hql = "from AscmWmsMtlReqMainLink where reqMainLinkPK.reqMainId in(" + ids + ")";
                    IList <AscmWmsMtlReqMainLink> ilistReqMainLink = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsMtlReqMainLink>(hql);
                    if (ilistReqMainLink != null && ilistReqMainLink.Count > 0)
                    {
                        List <AscmWmsMtlReqMainLink> listReqMainLink = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWmsMtlReqMainLink>(ilistReqMainLink);

                        hql = "from AscmWmsPreparationMain where id in(" + " select reqMainLinkPK.preMainId from AscmWmsMtlReqMainLink where reqMainLinkPK.reqMainId in(" + ids + ") )";
                        IList <AscmWmsPreparationMain> ilistPreparationMain = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsPreparationMain>(hql);
                        if (ilistPreparationMain != null && ilistPreparationMain.Count > 0)
                        {
                            List <AscmWmsPreparationMain> listPreparationMain = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWmsPreparationMain>(ilistPreparationMain);
                            foreach (AscmWmsMtlRequisitionMain requisitionMain in list)
                            {
                                requisitionMain.preparationDocNumbers
                                    = string.Join(",", listPreparationMain.Where(P =>
                                                                                 listReqMainLink.Where(T => T.reqMainLinkPK.reqMainId == requisitionMain.id).
                                                                                 Select(T => T.reqMainLinkPK.preMainId).Contains(P.id)).OrderBy(p => p.docNumber).
                                                  Select(P => P.docNumber));
                            }
                        }
                    }
                }
            }
        }
        public List <AscmDeliveryOrderDetail> GetList(int mainId)
        {
            List <AscmDeliveryOrderDetail> 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 AscmDeliveryOrderDetail where mainId=" + mainId;

                string where = "", whereQueryWord = "";
                //if (!string.IsNullOrEmpty(queryWord))
                //    whereQueryWord = " (name like '%" + queryWord.Trim() + "%' or description like '%" + queryWord.Trim() + "%')";
                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);
                //where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " and " + where;
                }
                //IList<AscmDeliveryOrderDetail> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmDeliveryOrderDetail>(sql + sort);
                IList <AscmDeliveryOrderDetail> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliveryOrderDetail>(sql + sort);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDeliveryOrderDetail>(ilist);
                    SetMain(list);
                    SetMaterial(list);
                    SetNotifyDetail(list);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliveryOrderDetail)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 11
0
        public List <AscmContainerDelivery> GetCurrentList(string containerSn)
        {
            List <AscmContainerDelivery> list = null;

            try
            {
                string sort = " order by id desc ";

                string sql = "from AscmContainerDelivery where containerSn='" + containerSn + "'";

                //IList<AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql);
                YnPage ynPage = new YnPage();
                ynPage.SetPageSize(1);
                ynPage.SetCurrentPage(1);
                IList <AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerDelivery>(sql + sort, sql, ynPage);
                if (ilist != null && ilist.Count > 0)
                {
                    foreach (AscmContainerDelivery ascmContainerDelivery in ilist)
                    {
                        ascmContainerDelivery.ascmDeliBatSumMain     = AscmDeliBatSumMainService.GetInstance().Get(ascmContainerDelivery.batSumMainId);
                        ascmContainerDelivery.ascmDeliveryOrderBatch = AscmDeliveryOrderBatchService.GetInstance().Get(ascmContainerDelivery.deliveryOrderBatchId);
                    }
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmContainerDelivery>(ilist);
                    //AscmDeliBatSumMain ascmDeliBatSumMain = AscmDeliBatSumMainService.GetInstance().Get(ilist[0].batSumMainId);
                    //if (ascmDeliBatSumMain != null &&( ascmDeliBatSumMain.status == AscmDeliBatSumMain.StatusDefine.outPlant||ascmDeliBatSumMain.status == AscmDeliBatSumMain.StatusDefine.confirm))
                    //{
                    //    sql = "from AscmContainerDelivery where batSumMainId =" + ilist[0].batSumMainId + "  and containerSn='" + containerSn + "'";
                    //    ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find<AscmContainerDelivery>(sql);
                    //    if (ilist != null)
                    //    {
                    //        list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList<AscmContainerDelivery>(ilist);
                    //    }
                    //}
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainerDelivery)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 12
0
        public List <AscmCuxWipReleaseLines> GetList(string whereOther, bool isSetMaterial = false,
                                                     bool isSetWipRequirementOperations    = false, bool isSetWipReleaseHeader = false)
        {
            List <AscmCuxWipReleaseLines> list = null;

            try
            {
                string sort = " order by inventoryItemId ";
                string sql  = "from AscmCuxWipReleaseLines";

                string where = "";
                where        = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereOther);

                if (!string.IsNullOrEmpty(where))
                {
                    sql += " where " + where;
                }
                IList <AscmCuxWipReleaseLines> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmCuxWipReleaseLines>(sql + sort);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmCuxWipReleaseLines>(ilist);
                    if (isSetWipReleaseHeader)
                    {
                        SetWipReleaseHeader(list);
                    }
                    if (isSetMaterial)
                    {
                        SetMaterial(list);
                    }
                    if (isSetWipRequirementOperations)
                    {
                        SetWipRequirementOperations(list);
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmCuxWipReleaseLines)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 13
0
        public void Update(AscmContainerDelivery ascmContainerDelivery, int readingHeadId, string sessionKey)
        {
            try
            {
                AscmContainer ascmContainer = null;
                if (!string.IsNullOrEmpty(ascmContainerDelivery.containerSn))
                {
                    ascmContainer = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmContainer>(ascmContainerDelivery.containerSn, sessionKey);
                    if (ascmContainer != null)
                    {
                        ascmContainer.place       = readingHeadId.ToString();
                        ascmContainer.storeInTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    }
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(sessionKey).BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmContainerDelivery>(ascmContainerDelivery, sessionKey);

                        if (ascmContainer != null)
                        {
                            YnDaoHelper.GetInstance().nHibernateHelper.Update <AscmContainer>(ascmContainer, sessionKey);
                        }

                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmContainerDelivery)", ex);
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmContainerDelivery)", ex);
                throw ex;
            }
        }
Ejemplo n.º 14
0
        public string GetUserLogisticsName(string userName, string userRole)
        {
            string logisticsName = string.Empty;

            try
            {
                if (userRole != "领料员" && !string.IsNullOrEmpty(userRole))
                {
                    string sql = "from AscmLogisticsClassInfo";
                    string where = "", whereQueryWord = "";

                    whereQueryWord = "groupLeader ='" + userName + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(where, whereQueryWord);
                    whereQueryWord = "monitorLeader = '" + userName + "'";
                    where          = YnBaseClass2.Helper.StringHelper.SqlWhereOrAdd(where, whereQueryWord);

                    if (!string.IsNullOrEmpty(where))
                    {
                        sql += " where " + where;
                        IList <AscmLogisticsClassInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmLogisticsClassInfo>(sql);
                        if (ilist != null && ilist.Count > 0)
                        {
                            List <AscmLogisticsClassInfo> list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmLogisticsClassInfo>(ilist);
                            foreach (AscmLogisticsClassInfo ascmLogisticsClassInfo in list)
                            {
                                if (!string.IsNullOrEmpty(logisticsName))
                                {
                                    logisticsName += ",";
                                }
                                logisticsName += "'" + ascmLogisticsClassInfo.logisticsClass + "'";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(logisticsName);
        }
Ejemplo n.º 15
0
        public List <AscmGenerateTaskRule> GetList(string sql)
        {
            List <AscmGenerateTaskRule> list = null;

            try
            {
                IList <AscmGenerateTaskRule> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmGenerateTaskRule>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmGenerateTaskRule>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmGenerateTaskRule)", ex);
                throw ex;
            }

            return(list);
        }
        public List <AscmContainerUnitQuantity> GetList(int supplierId, string materialDocNumber)
        {
            List <AscmContainerUnitQuantity> list = null;

            try
            {
                string sql = "from AscmContainerUnitQuantity where materialDocNumber='" + materialDocNumber + "' and supplierId =" + supplierId;
                IList <AscmContainerUnitQuantity> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerUnitQuantity>(sql);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmContainerUnitQuantity>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmContainerUnitQuantity)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 17
0
 public void SetScheduleGroups(List <AscmCuxWipReleaseHeaders> list)
 {
     if (list != null && list.Count > 0)
     {
         string sql = "from AscmWipScheduleGroups where scheduleGroupId in (" + string.Join(",", list.Select(P => P.scheduleGroupId).Distinct()) + ")";
         IList <AscmWipScheduleGroups> ilistAscmWipScheduleGroups = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipScheduleGroups>(sql);
         if (ilistAscmWipScheduleGroups != null && ilistAscmWipScheduleGroups.Count > 0)
         {
             List <AscmWipScheduleGroups> listAscmWipScheduleGroups = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWipScheduleGroups>(ilistAscmWipScheduleGroups);
             foreach (AscmCuxWipReleaseHeaders cuxWipReleaseHeaders in list)
             {
                 AscmWipScheduleGroups wipScheduleGroups = listAscmWipScheduleGroups.Find(e => e.scheduleGroupId == cuxWipReleaseHeaders.scheduleGroupId);
                 if (wipScheduleGroups != null)
                 {
                     cuxWipReleaseHeaders.scheduleGroupName = wipScheduleGroups.scheduleGroupName;
                 }
             }
         }
     }
 }
        public AscmBuildingWarehouseLink Get(int buildingId, string warehouseId)
        {
            AscmBuildingWarehouseLink ascmBuildingWarehouseLink = null;

            try
            {
                string sql = "from AscmBuildingWarehouseLink where buildingId=" + buildingId + " and warehouseId='" + warehouseId + "'";
                IList <AscmBuildingWarehouseLink> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmBuildingWarehouseLink>(sql);
                if (ilist != null && ilist.Count > 0)
                {
                    ascmBuildingWarehouseLink = ilist[0];
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmBuildingWarehouseLink)", ex);
                throw ex;
            }
            return(ascmBuildingWarehouseLink);
        }
Ejemplo n.º 19
0
        public AscmContainer GetAllInfo(string sn)
        {
            AscmContainer ascmContainer = null;

            try
            {
                ascmContainer = YnDaoHelper.GetInstance().nHibernateHelper.Get <AscmContainer>(sn);
                if (ascmContainer != null)
                {
                    ascmContainer.SpecName = MideaAscm.Services.SupplierPreparation.AscmContainerSpecService.GetInstance().Get(ascmContainer.specId).spec;
                    ascmContainer.supplier = MideaAscm.Services.Base.AscmSupplierService.GetInstance().Get(ascmContainer.supplierId);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmContainer)", ex);
                throw ex;
            }
            return(ascmContainer);
        }
Ejemplo n.º 20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="docNumber"></param>
        /// <param name="direction"></param>
        /// <returns></returns>
        public List <AscmStoreInOut> GetReportList(string docNumber, string direction)
        {
            string strHql            = "select b.specId, b.supplierId, count(b.specId), a.direction  from AscmStoreInOut as a,AscmContainer as b where a.containerId=b.sn and a.docNumber='" + docNumber + "' GROUP BY  b.supplierId, b.specId, a.direction";
            List <AscmStoreInOut> st = new List <AscmStoreInOut>();

            System.Collections.IList ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find(strHql);
            if (ilist.Count != 0)
            {
                foreach (object[] obj in ilist)
                {
                    foreach (object[] obj2 in YnDaoHelper.GetInstance().nHibernateHelper.Find("select name, docNumber from AscmSupplier where id=" + obj[1].ToString() + ""))
                    {
                        st.Add(new AscmStoreInOut {
                            docNumber = obj[5].ToString(), direction = obj[4].ToString(), createUser = obj[3].ToString(), supplierName = obj2[0].ToString(), specCount = Convert.ToInt32(obj[2].ToString()), specName = YnDaoHelper.GetInstance().nHibernateHelper.GetObject("select spec from AscmContainerSpec where id=" + obj[0].ToString() + "").ToString(), supplierDoc = obj2[1].ToString()
                        });
                    }
                }
            }
            return(st);
        }
Ejemplo n.º 21
0
        /// <summary>手持登录</summary>
        public AscmUserInfo TryGet2(string userId)
        {
            AscmUserInfo ascmUserInfo = null;

            try
            {
                string sql = "from AscmUserInfo where extExpandId='" + userId + "'";
                IList <AscmUserInfo> ilist = YnDaoHelper.GetInstance().nHibernateHelper.FindTop <AscmUserInfo>(sql, 1);
                if (ilist != null && ilist.Count > 0)
                {
                    ascmUserInfo = ilist[0];
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Get AscmUserInfo)", ex);
                throw ex;
            }
            return(ascmUserInfo);
        }
Ejemplo n.º 22
0
        public AscmReadingHeadLog GetAddLog(int readingHeadId, string rfid, string sn, DateTime createTime, bool processed, string sessionKey = null)
        {
            try
            {
                DateTime dtServerTime = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentDate("AscmReadingHead", sessionKey);

                AscmReadingHeadLog ascmReadingHeadLog = new AscmReadingHeadLog();
                ascmReadingHeadLog.readingHeadId = readingHeadId;
                ascmReadingHeadLog.rfid          = rfid;
                ascmReadingHeadLog.sn            = sn;
                ascmReadingHeadLog.createTime    = createTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmReadingHeadLog.modifyTime    = dtServerTime.ToString("yyyy-MM-dd HH:mm:ss");
                ascmReadingHeadLog.processed     = processed;
                return(ascmReadingHeadLog);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Save(AscmWmsLogisticsMainLog wmsLogisticsMainLog, List <WmsAndLogistics> listWmsAndLogistics)
        {
            try
            {
                int maxId_Detail = YnDaoHelper.GetInstance().nHibernateHelper.GetMaxId("select max(id) from AscmWmsLogisticsDetailLog");
                List <AscmWmsLogisticsDetailLog> listWmsLogisticsDetailLog = new List <AscmWmsLogisticsDetailLog>();
                foreach (WmsAndLogistics wmsAndLogistics in listWmsAndLogistics)
                {
                    AscmWmsLogisticsDetailLog wmsLogisticsDetailLog = new AscmWmsLogisticsDetailLog();
                    wmsLogisticsDetailLog.id                = ++maxId_Detail;
                    wmsLogisticsDetailLog.mainId            = wmsLogisticsMainLog.id;
                    wmsLogisticsDetailLog.wipEntityId       = wmsAndLogistics.wipEntityId;
                    wmsLogisticsDetailLog.materialId        = wmsAndLogistics.materialId;
                    wmsLogisticsDetailLog.quantity          = wmsAndLogistics.quantity;
                    wmsLogisticsDetailLog.preparationString = wmsAndLogistics.preparationString;
                    wmsLogisticsDetailLog.workerId          = wmsAndLogistics.workerId;
                    listWmsLogisticsDetailLog.Add(wmsLogisticsDetailLog);
                }

                using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction())
                {
                    try
                    {
                        YnDaoHelper.GetInstance().nHibernateHelper.Save(wmsLogisticsMainLog);
                        YnDaoHelper.GetInstance().nHibernateHelper.SaveList(listWmsLogisticsDetailLog);

                        tx.Commit();//正确执行提交
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();//回滚
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("保存失败(Save AscmWmsLogisticsMainLog)", ex);
                throw ex;
            }
        }
        public List <AscmDeliveryOrderDetail> GetListByBatch(List <AscmDeliveryOrderBatch> ListAscmDeliveryOrderBatch)
        {
            List <AscmDeliveryOrderDetail> list = null;

            try
            {
                string whereIds = "";
                foreach (AscmDeliveryOrderBatch ascmDeliveryOrderBatch in ListAscmDeliveryOrderBatch)
                {
                    if (!string.IsNullOrEmpty(whereIds))
                    {
                        whereIds += ",";
                    }
                    whereIds += ascmDeliveryOrderBatch.id;
                }

                string sql = "from AscmDeliveryOrderDetail where mainId in (select id from AscmDeliveryOrderMain where batchId in (" + whereIds + "))";

                string where = "", whereQueryWord = "";

                where = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(where, whereQueryWord);

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

                IList <AscmDeliveryOrderDetail> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmDeliveryOrderDetail>(sql);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmDeliveryOrderDetail>(ilist);
                    SetNotifyDetail(list);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliveryOrderDetail)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 25
0
        public void SetWipEntities(List <AscmWmsPreparationDetail> list)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }

            var    wipEntityIds = list.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);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string sql = "from AscmWipEntities where wipEntityId in (" + ids + ")";
                        IList <AscmWipEntities> ilistAscmWipEntities = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWipEntities>(sql);
                        if (ilistAscmWipEntities != null && ilistAscmWipEntities.Count > 0)
                        {
                            List <AscmWipEntities> listAscmWipEntities = ilistAscmWipEntities.ToList();
                            foreach (AscmWmsPreparationDetail ascmWmsPreparationDetail in list)
                            {
                                AscmWipEntities ascmWipEntities = listAscmWipEntities.Find(P => P.wipEntityId == ascmWmsPreparationDetail.wipEntityId);
                                if (ascmWipEntities != null)
                                {
                                    ascmWmsPreparationDetail.wipEntityName = ascmWipEntities.name;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
Ejemplo n.º 26
0
        public void SetMaterial(List <AscmDeliveryOrderBatch> list)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }

            var    materialIds = list.Select(P => P.materialIdTmp).Distinct();
            var    count       = materialIds.Count();
            string ids         = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    ids += ",";
                }
                ids += materialIds.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string hql = "from AscmMaterialItem where id in (" + ids + ")";
                        IList <AscmMaterialItem> ilistMaterialItem = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmMaterialItem>(hql);
                        if (ilistMaterialItem != null && ilistMaterialItem.Count > 0)
                        {
                            List <AscmMaterialItem> listMaterialItem = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmMaterialItem>(ilistMaterialItem);
                            foreach (AscmDeliveryOrderBatch deliveryOrderBatch in list)
                            {
                                AscmMaterialItem materialItem = listMaterialItem.Find(P => P.id == deliveryOrderBatch.materialIdTmp);
                                if (materialItem != null)
                                {
                                    deliveryOrderBatch.ascmMaterialItem = materialItem;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
Ejemplo n.º 27
0
        /// <summary>设置作业备料单已领数量</summary>
        public void SetReceivedQuantity(int wipEntityId, List <AscmWmsPreparationDetail> list)
        {
            if (list == null && list.Count == 0)
            {
                return;
            }

            var    materialIds = list.Select(P => P.materialId).Distinct();
            var    count       = materialIds.Count();
            string ids         = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    ids += ",";
                }
                ids += materialIds.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string hql = "select new AscmWmsLogisticsDetailLog(" + wipEntityId + ",materialId,sum(quantity)) from AscmWmsLogisticsDetailLog where wipEntityId=" + wipEntityId + " and materialId in (" + ids + ") group by materialId";
                        IList <AscmWmsLogisticsDetailLog> ilistLogisticsDetailLog = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWmsLogisticsDetailLog>(hql);
                        if (ilistLogisticsDetailLog != null && ilistLogisticsDetailLog.Count > 0)
                        {
                            List <AscmWmsLogisticsDetailLog> listLogisticsDetailLog = ilistLogisticsDetailLog.ToList();
                            foreach (AscmWmsPreparationDetail preparationDetail in list)
                            {
                                AscmWmsLogisticsDetailLog logisticsDetailLog = listLogisticsDetailLog.Find(P => P.materialId == preparationDetail.materialId);
                                if (logisticsDetailLog != null)
                                {
                                    preparationDetail.receivedQuantity = logisticsDetailLog.quantity;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
Ejemplo n.º 28
0
        public void SetWarelocationDocNumber(List <AscmWmsPreparationDetail> list)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }

            var    warelocationIds = list.Select(P => P.warelocationId).Distinct();
            var    count           = warelocationIds.Count();
            string ids             = string.Empty;

            for (int i = 0; i < count; i++)
            {
                if (!string.IsNullOrEmpty(ids))
                {
                    ids += ",";
                }
                ids += warelocationIds.ElementAt(i);
                if ((i + 1) % 500 == 0 || (i + 1) == count)
                {
                    if (!string.IsNullOrEmpty(ids))
                    {
                        string sql = "from AscmWarelocation where id in (" + ids + ")";
                        IList <AscmWarelocation> ilistAscmWarelocation = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmWarelocation>(sql);
                        if (ilistAscmWarelocation != null && ilistAscmWarelocation.Count > 0)
                        {
                            List <AscmWarelocation> listAscmWarelocation = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmWarelocation>(ilistAscmWarelocation);
                            foreach (AscmWmsPreparationDetail ascmWmsPreparationDetail in list)
                            {
                                AscmWarelocation ascmWarelocation = listAscmWarelocation.Find(P => P.id == ascmWmsPreparationDetail.warelocationId);
                                if (ascmWarelocation != null)
                                {
                                    ascmWmsPreparationDetail.locationDocNumber = ascmWarelocation.docNumber;
                                }
                            }
                        }
                    }
                    ids = string.Empty;
                }
            }
        }
Ejemplo n.º 29
0
        public List <AscmContainerDelivery> GetList(int?batSumMainId)
        {
            List <AscmContainerDelivery> list = null;

            try
            {
                string sql = "from AscmContainerDelivery where batSumMainId=" + batSumMainId;

                IList <AscmContainerDelivery> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmContainerDelivery>(sql);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmContainerDelivery>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmContainerDelivery)", ex);
                throw ex;
            }
            return(list);
        }
Ejemplo n.º 30
0
        public List <AscmGetMaterialTask> TaskDetailStatisticsList(string strWorkId)
        {
            List <AscmGetMaterialTask> list = null;

            try
            {
                string sort   = " order by id ";
                string strHql = "from AscmGetMaterialTask  where workerId='" + strWorkId + "'";
                IList <AscmGetMaterialTask> ilist = YnDaoHelper.GetInstance().nHibernateHelper.Find <AscmGetMaterialTask>(strHql + sort);
                if (ilist != null)
                {
                    list = YnBaseClass2.Helper.ConvertHelper.ConvertIListToList <AscmGetMaterialTask>(ilist);
                }
            }
            catch (Exception ex)
            {
                YnBaseClass2.Helper.LogHelper.GetLog().Error("查询失败(Find AscmDeliveryOrderDetail)", ex);
                throw ex;
            }
            return(list);
        }