/// <summary>
        /// 得到所有耗材销售单
        /// </summary>
        /// <returns></returns>
        public DataTable GetOrders()
        {
            var FirstOrders = _ConSalesOrderReposity.GetAll().AsNoTracking();
            var result      = from Order in FirstOrders
                              join User in _SMOWMSDbContext.coreUsers on Order.SALESPERSON equals User.USER_ID
                              select new ConSalesOrderOutputDto()
            {
                SOID            = Order.SOID,
                NAME            = Order.NAME,
                REALID          = Order.REALID,
                STATUS          = Order.STATUS,
                SALESPERSON     = Order.SALESPERSON,
                SALESPERSONNAME = User.USER_NAME,
                CREATEDATE      = Order.CREATEDATE,
                CANEDIT         = "",
                CANDELETE       = "",
                CANSTART        = "",
                TIME            = ""
            };
            var OrderTable = LINQToDataTable.ToDataTable(result);

            foreach (DataRow Row in OrderTable.Rows)
            {
                ConSalesOrderRow conSalesOrderRow = _ConSalesOrderRowReposity.GetBySOID(Row["SOID"].ToString()).FirstOrDefault();
                Consumables      consumables      = _consumablesRepository.GetByID(conSalesOrderRow.CID).FirstOrDefault();
                Row["Image"] = consumables.IMAGE;

                Row["STATUSNAME"] = Enum.GetName(typeof(SalesOrderStatus), int.Parse(Row["STATUS"].ToString()));
                Row["TIME"]       = DateTime.Parse(Row["CREATEDATE"].ToString()).ToShortDateString();
            }
            return(OrderTable);
        }
Example #2
0
        /// <summary>
        /// 得到某区域所有的固定资产
        /// </summary>
        /// <param name="LocationId">区域编号</param>
        /// <returns></returns>
        public DataTable GetAllAss()
        {
            var list = _AssetsRepository.GetAll();


            //list = list.OrderByDescending(a => a.id);
            var result = from assetse in list
                         join location in SMOSECDbContext.AssLocations on assetse.machine_room_id equals location.id
                         join type in SMOSECDbContext.AssetsTypes on assetse.asset_type_id equals type.id
                         join brand in SMOSECDbContext.AssetsBrands on assetse.brand_id equals brand.id
                         select new
            {
                uuid = assetse.uuid,
                //Image = assetse.IMAGE,
                //DEPARTMENTID = assetse.DEPARTMENTID,
                //DepName = "",
                status     = assetse.status,
                StatusName = "",
                room       = location.name,
                position   = assetse.position,
                //Name = assetse.NAME,
                //Price = assetse.PRICE,
                sn       = assetse.sn,
                TypeName = type.name,
                remark   = assetse.remark,
                Brand    = brand.name,
            };
            DataTable table = LINQToDataTable.ToDataTable(result);

            //foreach (DataRow row in table.Rows)
            //{
            //    row["StatusName"] = Enum.GetName(typeof(STATUS), row["status"]);
            //}
            return(table);
        }
Example #3
0
        /// <summary>
        /// 得到某区域所有的固定资产
        /// </summary>
        /// <param name="LocationId">区域编号</param>
        /// <returns></returns>
        public DataTable GetAllAss(string LocationId)
        {
            var list = _AssetsRepository.GetAll();

            if (!string.IsNullOrEmpty(LocationId))
            {
                list = list.Where(a => a.LOCATIONID == LocationId);
            }
            list = list.OrderByDescending(a => a.CREATEDATE);
            var result = from assetse in list
                         join location in SMOSECDbContext.AssLocations on assetse.LOCATIONID equals location.LOCATIONID
                         join type in SMOSECDbContext.AssetsTypes on assetse.TYPEID equals type.TYPEID
                         select new
            {
                ASSID         = assetse.ASSID,
                Image         = assetse.IMAGE,
                LocationName  = location.NAME,
                Name          = assetse.NAME,
                Price         = assetse.PRICE,
                SN            = assetse.SN,
                TypeName      = type.NAME,
                Specification = assetse.SPECIFICATION
            };

            return(LINQToDataTable.ToDataTable(result));
        }
Example #4
0
        /// <summary>
        /// 得到所有的固定资产
        /// </summary>
        /// <returns></returns>
        public DataTable GetAllAss(string wareId)
        {
            var list = _AssetsRepository.GetAll().Where(a => a.ISINWAREHOUSE == 1);

            if (!String.IsNullOrEmpty(wareId))
            {
                list = list.Where(a => a.WAREID == wareId);
            }
            list = list.OrderByDescending(a => a.CREATEDATE);
            var result = from assetse in list
                         from location in SMOWMSDbContext.WHStorageLocations
                         from storageType in SMOWMSDbContext.WHStorageTypes
                         from wareHouse in SMOWMSDbContext.WareHouses
                         join type in SMOWMSDbContext.AssetsTypes on assetse.TYPEID equals type.TYPEID
                         where wareHouse.WAREID == assetse.WAREID && storageType.WAREID == assetse.WAREID && storageType.STID == assetse.STID && location.WAREID == assetse.WAREID && location.STID == assetse.STID && location.SLID == assetse.SLID
                         select new
            {
                ASSID         = assetse.ASSID,
                Image         = assetse.IMAGE,
                SLName        = wareHouse.NAME + "/" + storageType.NAME + "/" + location.NAME,
                Name          = assetse.NAME,
                Price         = assetse.PRICE,
                SN            = assetse.SN,
                TypeName      = type.NAME,
                Specification = assetse.SPECIFICATION
            };

            return(LINQToDataTable.ToDataTable(result));
        }
Example #5
0
        /// <summary>
        /// 根据区域编号,类型和部门编号,得到盘点清单
        /// </summary>
        /// <param name="LocationId">区域编号</param>
        /// <param name="typeId">类型编号</param>
        /// <param name="DepartmentId">部门编号</param>
        /// <returns></returns>
        public DataTable GetInventoryAssList(string LocationId, string typeId, string DepartmentId)
        {
            var asslist = _assetsRepository.GetInventoryAssetses(LocationId, typeId, DepartmentId);
            var results = from assetse in asslist
                          from type in _SMOSECDbContext.AssetsTypes
                          from location in _SMOSECDbContext.AssLocations
                          where assetse.TYPEID == type.TYPEID && assetse.LOCATIONID == location.LOCATIONID
                          select new AssInventoryResultOutputDto()
            {
                ASSID         = assetse.ASSID,
                RESULT        = 0,
                RESULTNAME    = "待盘点",
                Image         = assetse.IMAGE,
                LocationId    = assetse.LOCATIONID,
                LocationName  = location.NAME,
                Name          = assetse.NAME,
                Place         = assetse.PLACE,
                Price         = assetse.PRICE,
                SN            = assetse.SN,
                TypeId        = assetse.TYPEID,
                TypeName      = type.NAME,
                Specification = assetse.SPECIFICATION,
                Unit          = assetse.UNIT
            };

            return(LINQToDataTable.ToDataTable(results));
        }
Example #6
0
        /// <summary>
        /// 根据仓库编号,得到盘点清单
        /// </summary>
        /// <param name="WAREID">仓库编号</param>
        /// <returns></returns>
        public DataTable GetInventoryConList(string WAREID, string STID, string SLID)
        {
            var conqlist = _conQuantRepository.GetInventoryCons(WAREID, STID, SLID);
            var results  = from conq in conqlist
                           join con in _SMOWMSDbContext.Consumableses on conq.CID equals con.CID
                           from WH in _SMOWMSDbContext.WareHouses
                           from WHSL in _SMOWMSDbContext.WHStorageLocations
                           from WHST in _SMOWMSDbContext.WHStorageTypes
                           where conq.WAREID == WH.WAREID &&
                           conq.STID == WHSL.STID && conq.SLID == WHSL.SLID &&
                           conq.WAREID == WHST.WAREID && conq.STID == WHST.STID &&
                           conq.WAREID == WH.WAREID
                           select new ConInventoryResultOutputDto()
            {
                CID        = con.CID,
                WAREID     = conq.WAREID,
                WARENAME   = WH.NAME,
                STID       = conq.STID,
                STNAME     = WHST.NAME,
                SLID       = conq.SLID,
                SLNAME     = WHSL.NAME,
                RESULT     = 0,
                RESULTNAME = "待盘点",
                Image      = con.IMAGE,
                Name       = con.NAME,
                Unit       = con.UNIT,
                Total      = conq.QUANTITY
            };

            return(LINQToDataTable.ToDataTable(results));
        }
Example #7
0
        /// <summary>
        /// 得到所有耗材采购单
        /// </summary>
        /// <returns></returns>
        public DataTable GetOrders()
        {
            var FirstOrders = _ConPurchaseOrderReposity.GetAll();
            var result      = from Order in FirstOrders
                              join User in _SMOWMSDbContext.coreUsers on Order.PURCHASER equals User.USER_ID
                              select new ConPurchaseOrderOutputDto()
            {
                POID          = Order.POID,
                NAME          = Order.NAME,
                REALID        = Order.REALID,
                STATUS        = Order.STATUS,
                PURCHASER     = Order.PURCHASER,
                PURCHASERNAME = User.USER_NAME,
                CREATEDATE    = Order.CREATEDATE,
                TIME          = ""
            };
            var OrderTable = LINQToDataTable.ToDataTable(result);

            foreach (DataRow Row in OrderTable.Rows)
            {
                ConPurchaseOrderRow conPurchaseOrderRow = _ConPurchaseOrderRowReposity.GetByPOID(Row["POID"].ToString()).FirstOrDefault();
                Consumables         consumables         = _consumablesRepository.GetByID(conPurchaseOrderRow.CID).FirstOrDefault();
                Row["Image"] = consumables.IMAGE;

                Row["STATUSNAME"] = Enum.GetName(typeof(PurchaseOrderStatus), int.Parse(Row["STATUS"].ToString()));
                Row["TIME"]       = DateTime.Parse(Row["CREATEDATE"].ToString()).ToShortDateString();
            }
            return(OrderTable);
        }
        /// <summary>
        /// 得到销售单行项
        /// </summary>
        /// <param name="SOID">销售单编号</param>
        /// <returns></returns>
        public DataTable GetRows(string SOID)
        {
            var results = from salesOrderRow in SMOWMSDbContext.AssSalesOrderRows
                          join template in SMOWMSDbContext.AssTemplates on salesOrderRow.TEMPLATEID equals template.TEMPLATEID
                          where salesOrderRow.SOID == SOID
                          select new AssSORowOutputDto()
            {
                SOID           = salesOrderRow.SOID,
                IMAGE          = template.IMAGE,
                NAME           = template.NAME,
                SOROWID        = salesOrderRow.SOROWID,
                QUANTOUT       = salesOrderRow.QUANTOUT,
                QUANTRETREATED = salesOrderRow.QUANTRETREATED,
                QUANTSALED     = salesOrderRow.QUANTSALED,
                REALPRICE      = salesOrderRow.REALPRICE,
                TEMPLATEID     = salesOrderRow.TEMPLATEID,
                STATUS         = salesOrderRow.STATUS,
                STATUSNAME     = ""
            };
            DataTable tempTable = LINQToDataTable.ToDataTable(results);

            foreach (DataRow row in tempTable.Rows)
            {
                row["STATUSNAME"] = Enum.GetName(typeof(SalesOrderStatus), int.Parse(row["STATUS"].ToString()));
            }
            return(tempTable);
        }
        /// <summary>
        /// 根据区域编号,类型和部门编号,得到盘点清单
        /// </summary>
        /// <param name="LocationId">区域编号</param>
        /// <param name="typeId">类型编号</param>
        /// <param name="DepartmentId">部门编号</param>
        /// <returns></returns>
        public DataTable GetInventoryAssList(string WAREID, string STID, string SLID, string typeId)
        {
            var asslist = _assetsRepository.GetInventoryAssetses(WAREID, STID, SLID, typeId);
            var results = from assetse in asslist
                          from type in _SMOWMSDbContext.AssetsTypes
                          from location in _SMOWMSDbContext.WHStorageLocations
                          from wareHouse in _SMOWMSDbContext.WareHouses
                          from storageType in _SMOWMSDbContext.WHStorageTypes
                          where assetse.TYPEID == type.TYPEID && assetse.WAREID == wareHouse.WAREID && assetse.STID == storageType.STID && assetse.WAREID == storageType.WAREID && assetse.WAREID == location.WAREID && assetse.STID == location.STID && assetse.SLID == location.SLID
                          select new AssInventoryResultOutputDto()
            {
                ASSID      = assetse.ASSID,
                RESULT     = 0,
                RESULTNAME = "待盘点",
                Image      = assetse.IMAGE,
//                    LocationId = assetse.LOCATIONID,
//                    LocationName = location.NAME,
                SLName        = wareHouse.NAME + "-" + storageType.NAME + "-" + location.NAME,
                Name          = assetse.NAME,
                Place         = assetse.PLACE,
                Price         = assetse.PRICE,
                SN            = assetse.SN,
                TypeId        = assetse.TYPEID,
                TypeName      = type.NAME,
                Specification = assetse.SPECIFICATION,
                Unit          = assetse.UNIT
            };

            return(LINQToDataTable.ToDataTable(results));
        }
Example #10
0
        /// <summary>
        /// 根据采购单编号得到采购单行项
        /// </summary>
        /// <param name="POID">采购单编号</param>
        /// <returns></returns>
        public DataTable GetRows(string POID)
        {
            var results = from purchaseOrderRow in SMOWMSDbContext.AssPurchaseOrderRows
                          join template in SMOWMSDbContext.AssTemplates on purchaseOrderRow.TEMPLATEID equals template.TEMPLATEID
                          where purchaseOrderRow.POID == POID
                          select new AssPORowOutputDto()
            {
                POID           = purchaseOrderRow.POID,
                IMAGE          = template.IMAGE,
                NAME           = template.NAME,
                POROWID        = purchaseOrderRow.POROWID,
                QUANTPURCHASED = purchaseOrderRow.QUANTPURCHASED,
                QUANTRETREATED = purchaseOrderRow.QUANTRETREATED,
                QUANTSTORED    = purchaseOrderRow.QUANTSTORED,
                REALPRICE      = purchaseOrderRow.REALPRICE,
                TEMPLATEID     = purchaseOrderRow.TEMPLATEID,
                STATUS         = purchaseOrderRow.STATUS,
                STATUSNAME     = ""
            };
            DataTable tempTable = LINQToDataTable.ToDataTable(results);

            foreach (DataRow row in tempTable.Rows)
            {
                row["STATUSNAME"] = Enum.GetName(typeof(PurchaseOrderStatus), int.Parse(row["STATUS"].ToString()));
            }
            return(tempTable);
        }
Example #11
0
        /// <summary>
        /// 查询空闲的资产数据
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="SN">资产编号</param>
        /// <returns></returns>
        public DataTable GetUnUsedAssEx(string LocationID, string SN)
        {
            int status = (int)STATUS.闲置;
            var result = _AssetsRepository.GetAssByStatusEx(LocationID, SN, null, status);

            return(LINQToDataTable.ToDataTable(result));
        }
Example #12
0
 /// <summary>
 /// 根据SN列表得到资产数据
 /// </summary>
 /// <param name="Sns">资产列表</param>
 /// <returns></returns>
 public DataTable GetBySnList(List <string> Sns)
 {
     if (Sns.Count > 0)
     {
         var list   = _AssetsRepository.GetAll().Where(a => Sns.Contains(a.SN));
         var result = from assetse in list
                      join location in SMOSECDbContext.AssLocations on assetse.LOCATIONID equals location.LOCATIONID
                      join type in SMOSECDbContext.AssetsTypes on assetse.TYPEID equals type.TYPEID
                      select new
         {
             ASSID         = assetse.ASSID,
             Image         = assetse.IMAGE,
             LocationName  = location.NAME,
             Name          = assetse.NAME,
             Price         = assetse.PRICE,
             SN            = assetse.SN,
             TypeName      = type.NAME,
             Specification = assetse.SPECIFICATION,
             RESULTNAME    = ""
         };
         return(LINQToDataTable.ToDataTable(result));
     }
     else
     {
         return(new DataTable());
     }
     throw new NotImplementedException();
 }
Example #13
0
        public DataTable GetRecords(string ASSID)
        {
            var result = from processRecord in SMOSECDbContext.AssProcessRecords
                         join assetse in SMOSECDbContext.Assetss on processRecord.ASSID equals assetse.ASSID
                         join user in SMOSECDbContext.coreUsers on processRecord.HANDLEMAN equals user.USER_ID
                         where processRecord.ASSID == ASSID
                         select new
            {
                PrId            = processRecord.PRID,
                ProcessMode     = processRecord.PROCESSMODE,
                ProcessContent  = processRecord.PROCESSCONTENT,
                AssId           = processRecord.ASSID,
                HandleDate      = processRecord.HANDLEDATE,
                ProcessModeName = "",
                HandleMan       = user.USER_NAME,
                SN = assetse.SN
            };
            DataTable tempTable = LINQToDataTable.ToDataTable(result);

            foreach (DataRow row in tempTable.Rows)
            {
                row["ProcessModeName"] = Enum.GetName(typeof(PROCESSMODE), int.Parse(row["ProcessMode"].ToString()));
            }
            return(tempTable);
        }
Example #14
0
        /// <summary>
        /// 根据盘点单编号得到结果行项信息
        /// </summary>
        /// <param name="IID">盘点单编号</param>
        /// <returns></returns>
        public DataTable GetConInventoryResultsByIID(string IID, ResultStatus Status)
        {
            int status  = (int)Status;
            var list    = _conInventoryResultRepository.GetResultsByStatus(IID, status);
            var results = from invR in list
                          join cons in _SMOSECDbContext.Consumableses on invR.CID equals cons.CID
                          join invs in _SMOSECDbContext.ConInventories on invR.IID equals invs.IID
                          select new ConInventoryResultOutputDto()
            {
                CID           = invR.CID,
                RESULT        = invR.RESULT,
                RESULTNAME    = "",
                Image         = cons.IMAGE,
                Name          = cons.NAME,
                Specification = cons.SPECIFICATION,
                Unit          = cons.UNIT,
                Total         = invR.TOTAL,
                RealAmount    = invR.REALAMOUNT
            };
            DataTable tempTable = LINQToDataTable.ToDataTable(results);

            foreach (DataRow row in tempTable.Rows)
            {
                row["RESULTNAME"] = Enum.GetName(typeof(ResultStatus), int.Parse(row["RESULT"].ToString()));
            }
            return(tempTable);
        }
Example #15
0
        /// <summary>
        /// 根据SN或者名称查询资产
        /// </summary>
        /// <param name="SNOrName">SN或者名称</param>
        /// <param name="LocationId">区域编号</param>
        /// <returns></returns>
        public DataTable QueryAssets(string SNOrName, string LocationId)
        {
            var result = _AssetsRepository.QueryAssets(SNOrName).AsNoTracking();

            if (!string.IsNullOrEmpty(LocationId))
            {
                result = result.Where(a => a.LOCATIONID == LocationId);
            }
            return(LINQToDataTable.ToDataTable(result));
        }
Example #16
0
        /// <summary>
        /// 根据SN得到资产信息
        /// </summary>
        /// <param name="SN">SN编号</param>
        /// <param name="LocationId">区域编号</param>
        /// <returns></returns>
        public DataTable GetAssetsBySN(string SN, string LocationId)
        {
            var result = _AssetsRepository.GetAssetsBySN(SN).AsNoTracking();

            if (!string.IsNullOrEmpty(LocationId))
            {
                result = result.Where(a => a.LOCATIONID == LocationId);
            }
            return(LINQToDataTable.ToDataTable(result));
        }
Example #17
0
        /// <summary>
        /// 得到盘点单列表
        /// </summary>
        /// <param name="LocationId">区域编号</param>
        /// <returns></returns>
        public DataTable GetConInventoryList(string UserId, string LocationId)
        {
            var area = _conInventoryRepository.GetAll();

            if (!string.IsNullOrEmpty(LocationId))
            {
                area = area.Where(a => a.LOCATIONID == LocationId);
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                area = area.Where(a => a.HANDLEMAN == UserId);
            }
            var list = from conInventory in area
                       join user in _SMOSECDbContext.coreUsers on conInventory.HANDLEMAN equals user.USER_ID
                       orderby conInventory.CREATEDATE descending


                       select new ConInventoryListOutputDto()
            {
                IID         = conInventory.IID,
                NAME        = conInventory.NAME,
                CREATEDATE  = conInventory.CREATEDATE,
                CREATEUSER  = user.USER_NAME,
                TOTAL       = conInventory.TOTAL,
                RESULTCOUNT = conInventory.RESULTCOUNT,
                STATUS      = conInventory.STATUS,
                STATUSNAME  = "",
                CanStart    = "",
                CanEdit     = "",
                CanDelete   = "",
                Time        = ""
            };
            var temTable = LINQToDataTable.ToDataTable(list);

            foreach (DataRow row in temTable.Rows)
            {
                int status = int.Parse(row["STATUS"].ToString());
                row["STATUSNAME"] = Enum.GetName(typeof(InventoryStatus), status);
                switch (status)
                {
                case (int)InventoryStatus.盘点未开始:
                    row["CanStart"]  = "开始盘点";
                    row["CanDelete"] = "删除";
                    row["CanEdit"]   = "编辑";
                    break;

                case (int)InventoryStatus.盘点中:
                    row["CanStart"] = "开始盘点";
                    break;
                }
                row["Time"] = DateTime.Parse(row["CREATEDATE"].ToString()).ToShortDateString();
            }
            return(temTable);
        }
Example #18
0
        /// <summary>
        /// 查询空闲的资产数据(除调入区域外的)
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="Name">资产名称</param>
        /// <returns></returns>
        public DataTable GetUnUsedAssOther(string LocationID, string Name)
        {
            var result = _AssetsRepository.GetUnUsedAssOther(LocationID, Name);
            var dtos   = Mapper.Map <List <Assets>, List <AssSelectOutputDto> >(result.ToList());

            foreach (var dto in dtos)
            {
                dto.IsChecked = false;
            }
            return(LINQToDataTable.ToDataTable(dtos));
        }
Example #19
0
        /// <summary>
        /// 查询在用的资产数据
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="Name">资产名称</param>
        /// <param name="UserID">当前所有者</param>
        /// <returns></returns>
        //public DataTable GetInUseAss(int LocationID)
        //{
        //    int status = 0;
        //    var result = _AssetsRepository.GetAssByStatus(LocationID,status);
        //    var dtos = Mapper.Map<List<cmdb_asset>, List<AssSelectOutputDto>>(result.ToList());
        //    foreach (var dto in dtos)
        //    {
        //        dto.IsChecked = false;
        //    }
        //    return LINQToDataTable.ToDataTable(dtos);
        //}

        /// <summary>
        /// 查询在用的资产数据,扫码添加时使用
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="SN">序列号</param>
        /// <param name="UserID">用户名称</param>
        /// <returns></returns>
        //public DataTable GetInUseAssEx(string LocationID, string SN, string UserID)
        //{
        //    int status = (int)STATUS.使用中;
        //    var result = _AssetsRepository.GetAssByStatusEx(LocationID, SN, UserID, status);
        //    var ass = from assetse in result
        //              join user in SMOSECDbContext.coreUsers on assetse.CURRENTUSER equals user.USER_ID
        //              select new AssSelectOutputDto()
        //              {
        //                  IsChecked = false,
        //                  IMAGE = assetse.IMAGE,
        //                  NAME = assetse.IMAGE,
        //                  ASSID = assetse.ASSID,
        //                  SN = assetse.SN,
        //                  USERNAME = user.USER_NAME
        //              };
        //    return LINQToDataTable.ToDataTable(ass);
        //}

        /// <summary>
        /// 查询空闲的资产数据
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="Name">资产名称</param>
        public DataTable GetUnUsedAss(int LocationID)
        {
            int status = 1;
            var result = _AssetsRepository.GetAssByStatus(status);
            var dtos   = Mapper.Map <List <cmdb_asset>, List <AssSelectOutputDto> >(result.ToList());

            foreach (var dto in dtos)
            {
                dto.IsChecked = false;
            }
            return(LINQToDataTable.ToDataTable(dtos));
        }
Example #20
0
        /// <summary>
        /// 查询在用的资产数据,扫码添加时使用
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="SN">序列号</param>
        /// <param name="UserID">用户名称</param>
        /// <returns></returns>
        public DataTable GetInUseAssEx(string LocationID, string SN, string UserID)
        {
            int status = (int)STATUS.使用中;
            var result = _AssetsRepository.GetAssByStatusEx(LocationID, SN, UserID, status);
            var dtos   = Mapper.Map <List <Assets>, List <AssSelectOutputDto> >(result.ToList());

            foreach (var dto in dtos)
            {
                dto.IsChecked = false;
            }
            return(LINQToDataTable.ToDataTable(dtos));
        }
Example #21
0
        /// <summary>
        /// 查询空闲的资产数据
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="Name">资产名称</param>
        public DataTable GetUnUsedAss(string LocationID, string Name)
        {
            int status = (int)STATUS.闲置;
            var result = _AssetsRepository.GetAssByStatus(LocationID, Name, null, status);
            var dtos   = Mapper.Map <List <Assets>, List <AssSelectOutputDto> >(result.ToList());

            foreach (var dto in dtos)
            {
                dto.IsChecked = false;
            }
            return(LINQToDataTable.ToDataTable(dtos));
        }
Example #22
0
        /// <summary>
        /// 查询借用的资产数据,资产选择时用到
        /// </summary>
        /// <param name="LocationID">区域编号</param>
        /// <param name="Name">名称</param>
        /// <param name="UserID">用户编号</param>
        /// <returns></returns>
        public DataTable GetBorrowedAss()
        {
            int status = 3;
            var result = _AssetsRepository.GetAssByStatus(status);
            var dtos   = Mapper.Map <List <cmdb_asset>, List <AssSelectOutputDto> >(result.ToList());

            //foreach (var dto in dtos)
            //{
            //    dto.IsChecked = false;
            //}
            return(LINQToDataTable.ToDataTable(dtos));
        }
Example #23
0
        /// <summary>
        /// 查询即将失效的资产
        /// </summary>
        /// <param name="days">距离现在的天数</param>
        /// <returns></returns>
        public DataTable GetImminentAssets(int days)
        {
            DateTime targetDateTime = DateTime.Now.Date.AddDays(days);
            DateTime Now            = DateTime.Now.Date;
            var      result         = from ass in SMOSECDbContext.Assetss
                                      where ass.EXPIRYDATE >= Now && ass.EXPIRYDATE <= targetDateTime
                                      select new
            {
            };

            return(LINQToDataTable.ToDataTable(_AssetsRepository.GetImminentAssets(days)));
        }
Example #24
0
        /// <summary>
        /// 查询空闲的资产数据
        /// </summary>
        /// <param name="LocationID"></param>
        /// <param name="ID"></param>
        /// <returns></returns>
        public DataTable GetUnUsedAssEx(string LocationID, string ID)
        {
            int status = (int)STATUS.闲置;
            var result = _AssetsRepository.GetAssByStatusEx(LocationID, ID, null, status);

//            var dtos = Mapper.Map<List<Assets>, List<AssSelectOutputDto>>(result.ToList());
//            foreach (var dto in dtos)
//            {
//                dto.IsChecked = false;
//            }

//            return LINQToDataTable.ToDataTable(dtos);
            return(LINQToDataTable.ToDataTable(result));
        }
Example #25
0
        /// <summary>
        /// 得到盘点单列表
        /// </summary>
        /// <param name="UserId">用户编号</param>
        /// <returns></returns>
        public DataTable GetAssInventoryList(string UserId)
        {
            var area = _assInventoryRepository.GetAll();

            if (!string.IsNullOrEmpty(UserId))
            {
                area = area.Where(a => a.HANDLEMAN == UserId);
            }
            var list = from assInventory in area
                       join user in _SMOWMSDbContext.coreUsers on assInventory.HANDLEMAN equals user.USER_ID
                       orderby assInventory.CREATEDATE descending


                       select new AssInventoryListOutputDto()
            {
                IID        = assInventory.IID,
                NAME       = assInventory.NAME,
                CREATEDATE = assInventory.CREATEDATE,
                CREATEUSER = user.USER_NAME,
                Result     = assInventory.RESULTCOUNT + "/" + assInventory.TOTAL,
                STATUS     = assInventory.STATUS,
                STATUSNAME = "",
                CanStart   = "",
                CanEdit    = "",
                CanDelete  = "",
                Image      = user.USER_IMAGEID,
                Time       = ""
            };
            var temTable = LINQToDataTable.ToDataTable(list);

            foreach (DataRow row in temTable.Rows)
            {
                int status = int.Parse(row["STATUS"].ToString());
                row["STATUSNAME"] = Enum.GetName(typeof(InventoryStatus), status);
//                switch (status)
//                {
//                    case (int)InventoryStatus.盘点未开始:
//                        row["CanStart"] = "开始盘点";
//                        row["CanDelete"] = "删除";
//                        row["CanEdit"] = "编辑";
//                        break;
//                    case (int)InventoryStatus.盘点中:
//                        row["CanStart"] = "开始盘点";
//                        break;
//                }
                row["Time"] = DateTime.Parse(row["CREATEDATE"].ToString()).ToShortDateString();
            }
            return(temTable);
        }
Example #26
0
 /// <summary>
 /// 得到对应的归还单行项列表
 /// <param name="rtoid">归还单编号</param>
 /// </summary>
 /// <returns></returns>
 public DataTable GetRowsByRtoid(string rtoid)
 {
     var result = from ass in _SMOSECDbContext.Assetss
                  from rto in _SMOSECDbContext.AssReturnOrders
                  from row in _SMOSECDbContext.AssReturnOrderRows
                  where ass.ASSID == row.ASSID && rto.RTOID == rtoid && rto.RTOID == row.RTOID
                  select new OperDetailSnOutputDto()
                  {
                      Assid = ass.ASSID,
                      Image = ass.IMAGE,
                      Name = ass.NAME,
                      Sn = ass.SN
                  };
     return LINQToDataTable.ToDataTable(result);
 }
Example #27
0
        /// <summary>
        /// 返回全部借用单信息
        /// </summary>
        public DataTable GetAllBo()
        {
            var list   = _assBorrowOrderRepository.GetAllBo().AsNoTracking();
            var result = from borrowOrder in list
                         join user in _SMOSECDbContext.Userman on borrowOrder.use_man_id equals user.id
                         select new
            {
                BORROWER     = user.name,
                BOID         = borrowOrder.id,
                BORROWDATE   = borrowOrder.give_time,
                LOCATIONNAME = borrowOrder.position
            };

            return(LINQToDataTable.ToDataTable(result.OrderByDescending(a => a.BOID)));
        }
Example #28
0
        /// <summary>
        /// 根据耗材名称得到耗材信息
        /// </summary>
        /// <param name="Name">耗材名称</param>
        /// <returns></returns>
        public DataTable GetConListByName(string Name)
        {
            var list   = _consumablesRepository.GetByName(Name);
            var result = from consumablese in list
                         select new
            {
                CID       = consumablese.CID,
                NAME      = consumablese.NAME,
                IsChecked = false,
                IMAGE     = consumablese.IMAGE,
                QUANTITY  = 0,
                MONEY     = 0
            };

            return(LINQToDataTable.ToDataTable(result));
        }
Example #29
0
        /// <summary>
        /// 得到对应的领用单行项列表
        /// <param name="coid">领用单编号</param>
        /// </summary>
        /// <returns></returns>
        public DataTable GetRowsByCoid(string coid)
        {
            var result = from ass in _SMOSECDbContext.Assetss
                         from co in _SMOSECDbContext.AssCollarOrders
                         from row in _SMOSECDbContext.AssCollarOrderRows
                         where ass.ASSID == row.ASSID && co.COID == coid && co.COID == row.COID
                         select new OperDetailSnOutputDto()
            {
                Assid = ass.ASSID,
                Image = ass.IMAGE,
                Name  = ass.NAME,
                Sn    = ass.SN
            };

            return(LINQToDataTable.ToDataTable(result));
        }
Example #30
0
        /// <summary>
        /// 得到所有资产模板(资产模板选择时用到)
        /// </summary>
        /// <returns></returns>
        public DataTable GetAllAssTemps()
        {
            var result = from assTemplate in SMOWMSDbContext.AssTemplates
                         select new ATChooseOutputDto()
            {
                TEMPLATEID = assTemplate.TEMPLATEID,
                IMAGE      = assTemplate.IMAGE,
                IsChecked  = false,
                NAME       = assTemplate.NAME,
                PRICE      = 0,
                QUANT      = 0
//                    TPRICE = assTemplate.PRICE.Value
            };

            return(LINQToDataTable.ToDataTable(result));
        }