diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs
index 66373d0..227db4d 100644
--- a/BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs
+++ b/BPA.SAAS.Manage.Application/DataBase/Services/BatchingService.cs
@@ -382,5 +382,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
}
#endregion
+ private string GetNumber2(int Length = 10)
+ {
+ byte[] buffer = Guid.NewGuid().ToByteArray();
+ var ram = BitConverter.ToInt64(buffer, 0);
+ var str = string.Format("{0}", ram.ToString().Substring(0, Length));
+ return str;
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/Device/DeviceServices.cs b/BPA.SAAS.Manage.Application/Device/DeviceServices.cs
index 9eccc07..d4b9c05 100644
--- a/BPA.SAAS.Manage.Application/Device/DeviceServices.cs
+++ b/BPA.SAAS.Manage.Application/Device/DeviceServices.cs
@@ -1,7 +1,9 @@
using BPA.SAAS.Manage.Application.Device.Dtos.Device;
using BPA.SAAS.Manage.Application.Device.Interface;
+using BPA.SAAS.Manage.Comm.Model;
using BPA.SAAS.Manage.Core.Base;
using Microsoft.AspNetCore.Components.Forms;
+using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -29,6 +31,15 @@ namespace BPA.SAAS.Manage.Application.Device
return await _deviceService.GetDeviceInfoPage(inputDto);
}
///
+ /// 查询设备列表
+ ///
+ ///
+ [HttpGet("/api/device/list")]
+ public async Task> GetDeviceList()
+ {
+ return await _deviceService.GetDeviceList();
+ }
+ ///
/// 添加
///
///
@@ -58,5 +69,24 @@ namespace BPA.SAAS.Manage.Application.Device
{
return await _deviceService.DelDeviceInfo(inputList);
}
+ ///
+ /// 添加设备标签
+ ///
+ ///
+ ///
+ [HttpPost("/api/device/adddevicetype")]
+ public async Task AddDeviceTypeAsync(DeviceTypeBaseDto inputDto)
+ {
+ return await _deviceService.AddDeviceTypeAsync(inputDto);
+ }
+ ///
+ /// 查询设备标签
+ ///
+ ///
+ [HttpGet("/api/device/getdevicetypelist")]
+ public async Task> GetDeviceTypeList()
+ {
+ return await _deviceService.GetDeviceTypeList();
+ }
}
}
diff --git a/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs b/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs
new file mode 100644
index 0000000..5bf8561
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs
@@ -0,0 +1,91 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion;
+using BPA.SAAS.Manage.Application.Device.Interface;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using Microsoft.AspNetCore.Components.Forms;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device
+{
+ [ApiDescriptionSettings("Device", Tag = "设备版本管理")]
+ public class DeviceVesionServices: IDynamicApiController, ITransient
+ {
+ IDeviceVesionService _deviceVesionService;
+ public DeviceVesionServices(IDeviceVesionService deviceVesionService)
+ {
+ _deviceVesionService= deviceVesionService;
+ }
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+
+ [HttpPost("/api/devicevesion/page")]
+ public async Task GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto)
+ {
+ return await _deviceVesionService.GetDeviceVesionPageAsync(inputDto);
+ }
+ ///
+ /// 新增
+ ///
+ ///
+ [HttpPost("/api/devicevesion/add")]
+ public async Task AddDeviceVesionAsync(DeviceVesionBaseDto inputDto)
+ {
+ return await _deviceVesionService.AddDeviceVesionAsync(inputDto);
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ [HttpPost("/api/devicevesion/delete")]
+ public async Task DelDeviceVesionAsync(List inputList)
+ {
+ return await _deviceVesionService.DelDeviceVesionAsync(inputList);
+ }
+ ///
+ /// 修改
+ ///
+ ///
+ [HttpPost("/api/devicevesion/update")]
+ public async Task UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto)
+ {
+ return await _deviceVesionService.UpdateDeviceVesionAsync(inputDto);
+ }
+ ///
+ /// 更新状态
+ ///
+ ///
+ ///
+ [HttpPost("/api/devicevesion/updatestatus")]
+ public async Task UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto)
+ {
+ return await _deviceVesionService.UpdateDeviceVesionSatatus(inputDto);
+ }
+ ///
+ /// 根据设备编码查询版本
+ ///
+ ///
+ ///
+ [HttpGet("/api/devicevesion/getdevicevesion")]
+ public async Task> GetDeviceVesion(string code)
+ {
+ return await _deviceVesionService.GetDeviceVesion(code);
+ }
+ ///
+ /// 查询版本列表
+ ///
+ ///
+ [HttpGet("/api/devicevesion/getdevicevesionlist")]
+ public async Task> GetDeviceVesionList()
+ {
+ return await _deviceVesionService.GetDeviceVesionList();
+ }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceTypeBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceTypeBaseDto.cs
new file mode 100644
index 0000000..38cad80
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceTypeBaseDto.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
+{
+ public class DeviceTypeBaseDto
+ {
+ public string Name { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs
new file mode 100644
index 0000000..7c70c7b
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductBaseDto.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
+{
+ public class ProductBaseDto
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string Key { get; set; }
+ public string Remark { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs
new file mode 100644
index 0000000..6d24596
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs
@@ -0,0 +1,15 @@
+using BPA.SAAS.Manage.Core.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
+{
+ public class ProductQueryInputDto: PageInputBase
+ {
+ public string Name { get; set; }
+ public string Key { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductSatatusDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductSatatusDto.cs
new file mode 100644
index 0000000..1c37724
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductSatatusDto.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
+{
+ public class ProductSatatusDto
+ {
+ public string Id { get; set; }
+ public int Status { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs
new file mode 100644
index 0000000..4d806b6
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionBaseDto.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion
+{
+ public class DeviceVesionBaseDto
+ {
+ public string Id { get; set; }
+ public string Vesion { get; set; }
+ public string DeviceTypeKey { get; set; }
+
+ ///
+ /// 模版路径
+ ///
+ public string TemplatePath { get; set; }
+ public int Status { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs
new file mode 100644
index 0000000..0fc2a7c
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionQueryInputDto.cs
@@ -0,0 +1,14 @@
+using BPA.SAAS.Manage.Core.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion
+{
+ public class DeviceVesionQueryInputDto : PageInputBase
+ {
+ public string DeviceTypeKey { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionSatatusDto.cs b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionSatatusDto.cs
new file mode 100644
index 0000000..0006944
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Dtos/DeviceVesion/DeviceVesionSatatusDto.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion
+{
+ public class DeviceVesionSatatusDto
+ {
+ public string Id { get; set; }
+ public int Status { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceService.cs
index 6596141..7d81ccb 100644
--- a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceService.cs
+++ b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceService.cs
@@ -1,4 +1,5 @@
using BPA.SAAS.Manage.Application.Device.Dtos.Device;
+using BPA.SAAS.Manage.Comm.Model;
using BPA.SAAS.Manage.Core.Base;
using System;
using System.Collections.Generic;
@@ -11,8 +12,11 @@ namespace BPA.SAAS.Manage.Application.Device.Interface
public interface IDeviceService
{
Task GetDeviceInfoPage(DeviceQueryInputDto inputDto);
+ Task> GetDeviceList();
Task AddDevice(DeviceInfoBaseDto inputDto);
Task UpdateDevice(DeviceInfoBaseDto inputDto);
Task DelDeviceInfo(List inputList);
+ Task AddDeviceTypeAsync(DeviceTypeBaseDto inputDto);
+ Task> GetDeviceTypeList();
}
}
diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs
new file mode 100644
index 0000000..5c69121
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs
@@ -0,0 +1,22 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Interface
+{
+ public interface IDeviceVesionService
+ {
+ Task GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto);
+ Task AddDeviceVesionAsync(DeviceVesionBaseDto inputDto);
+ Task DelDeviceVesionAsync(List inputList);
+ Task UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto);
+ Task UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto);
+ Task> GetDeviceVesion(string Code);
+ Task> GetDeviceVesionList();
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs b/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs
new file mode 100644
index 0000000..66782d1
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Interface/IProductService.cs
@@ -0,0 +1,21 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.Device;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Interface
+{
+ public interface IProductService
+ {
+ Task GetProductPage(ProductQueryInputDto inputDto);
+ Task> GetProductList();
+ Task AddProduct(ProductBaseDto inputDto);
+ Task DeProduct(List inputList);
+ Task UpdateProduct(ProductBaseDto inputDto);
+ Task UpdateDeviceVesionSatatus(ProductSatatusDto inputDto);
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/ProductServices.cs b/BPA.SAAS.Manage.Application/Device/ProductServices.cs
new file mode 100644
index 0000000..02ad5ee
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/ProductServices.cs
@@ -0,0 +1,82 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.Device;
+using BPA.SAAS.Manage.Application.Device.Interface;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using Microsoft.AspNetCore.Components.Forms;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device
+{
+ [ApiDescriptionSettings("Device", Tag = "产品管理")]
+ public class ProductServices: IDynamicApiController, ITransient
+ {
+ IProductService _productService;
+ public ProductServices(IProductService productService)
+ {
+ _productService=productService;
+ }
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+ [HttpPost("/api/product/page")]
+ public async Task GetProductPage(ProductQueryInputDto inputDto)
+ {
+ return await _productService.GetProductPage(inputDto);
+ }
+ ///
+ /// 查询列表
+ ///
+ ///
+ [HttpGet("/api/product/list")]
+ public async Task> GetProductList()
+ {
+ return await _productService.GetProductList();
+ }
+ ///
+ /// 添加
+ ///
+ ///
+ ///
+ [HttpPost("/api/product/add")]
+ public async Task AddProduct(ProductBaseDto inputDto)
+ {
+ return await _productService.AddProduct(inputDto);
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ [HttpPost("/api/product/delete")]
+ public async Task DeProduct(List inputList)
+ {
+ return await _productService.DeProduct(inputList);
+ }
+ ///
+ /// 更新
+ ///
+ ///
+ ///
+ [HttpPost("/api/product/update")]
+ public async Task UpdateProduct(ProductBaseDto inputDto)
+ {
+ return await _productService.UpdateProduct(inputDto);
+ }
+ ///
+ /// 更新状态
+ ///
+ ///
+ ///
+ [HttpPost("/api/product/updatestatus")]
+ public async Task UpdateDeviceVesionSatatus(ProductSatatusDto inputDto)
+ {
+ return await _productService.UpdateDeviceVesionSatatus(inputDto);
+ }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
index f4f35dc..ae154f8 100644
--- a/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
+++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
@@ -1,6 +1,8 @@
using BPA.SAAS.Manage.Application.Device.Dtos.Device;
using BPA.SAAS.Manage.Application.Device.Interface;
using BPA.SAAS.Manage.Comm.Const;
+using BPA.SAAS.Manage.Comm.Enum;
+using BPA.SAAS.Manage.Comm.Model;
using BPA.SAAS.Manage.Comm.Util;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.Device;
@@ -55,6 +57,21 @@ namespace BPA.SAAS.Manage.Application.Device.Services
};
}
///
+ /// 查询设备列表
+ ///
+ ///
+ public async Task> GetDeviceList()
+ {
+ RefAsync total = 0;
+ var data = await _db.Queryable()
+ .Select(a=> new ListSelectQuery
+ {
+ Id = a.Id,
+ Name = a.DeviceName
+ }) .ToListAsync();
+ return data;
+ }
+ ///
/// 添加
///
///
@@ -62,6 +79,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task AddDevice(DeviceInfoBaseDto inputDto)
{
BPA_DeviceInfo bPA_DeviceInfo = inputDto.Adapt();
+ bPA_DeviceInfo.Status = CommonStatus.ENABLE;
var res =await _db.Insertable(bPA_DeviceInfo) .CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
mqttsub(res.AutoKey, res.DeviceTypeKey);
return res != null;
@@ -112,6 +130,33 @@ namespace BPA.SAAS.Manage.Application.Device.Services
return res > 0;
}
///
+ /// 添加设备标签
+ ///
+ ///
+ ///
+ public async Task AddDeviceTypeAsync(DeviceTypeBaseDto inputDto)
+ {
+ var res = await _db.Insertable(new BPA_DeviceType
+ {
+ Name = inputDto.Name,
+ }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
+ return res > 0;
+ }
+ ///
+ /// 查询设备标签
+ ///
+ ///
+ public async Task> GetDeviceTypeList()
+ {
+ var listquery = await _db.Queryable().Where(a => a.IsDeleted == 0).Select(a => new ListSelectQuery
+ {
+ Id = a.Id,
+ Name = a.Name
+
+ }).ToListAsync();
+ return listquery;
+ }
+ ///
/// (调用订单服务)
///
///
diff --git a/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs
new file mode 100644
index 0000000..cd220d9
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs
@@ -0,0 +1,138 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion;
+using BPA.SAAS.Manage.Application.Device.Interface;
+using BPA.SAAS.Manage.Comm.Const;
+using BPA.SAAS.Manage.Comm.Enum;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Services
+{
+ public class DeviceVesionService: IDeviceVesionService, ITransient
+ {
+ ISqlSugarClient _db;
+ public DeviceVesionService(ISqlSugarClient db)
+ {
+ _db=db;
+ }
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+ public async Task GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto)
+ {
+ var total = new RefAsync();
+ var data = await _db.Queryable().Where((x) => x.IsDeleted == 0)
+ .WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceTypeKey), x => x.DeviceTypeKey.Contains(inputDto.DeviceTypeKey))
+ .OrderBy(x => x.CreateAt, OrderByType.Desc)
+ .ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
+
+ return new PageUtil()
+ {
+ Data = data,
+ Total = total
+
+ };
+ }
+
+ ///
+ /// 新增
+ ///
+ ///
+
+ public async Task AddDeviceVesionAsync(DeviceVesionBaseDto inputDto)
+ {
+ var res = await _db.Insertable(new BPA_DeviceVesion
+ {
+ Vesion = inputDto.Vesion,
+ DeviceTypeKey = inputDto.DeviceTypeKey,
+ TemplatePath = inputDto.TemplatePath,
+ Status = CommonStatus.ENABLE
+ }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
+ return res > 0;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public async Task DelDeviceVesionAsync(List inputList)
+ {
+ var data = await _db.Queryable().Where(x => inputList.Contains(x.DeviceVersionKey)).ToListAsync();
+ if (data.Count > 0)
+ {
+ throw Oops.Oh("当前设备类型已使用,无法删除");
+ }
+ var datas = await _db.Queryable()
+ .Where(x => inputList.Contains(x.Id))
+ .ToListAsync();
+ _db.Deleteable(datas).ExecuteCommand();
+ return true;
+ }
+ ///
+ /// 修改
+ ///
+ ///
+ public async Task UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto)
+ {
+ var data = await _db.Queryable().Where(x => x.Id == inputDto.Id).FirstAsync();
+
+ if (data != null)
+ {
+ var res = _db.Updateable().SetColumns(t => t.Vesion == inputDto.Vesion)
+ .SetColumns(t => t.TemplatePath == inputDto.TemplatePath)
+ .SetColumns(t => t.DeviceTypeKey == inputDto.DeviceTypeKey)
+ .SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
+ .ExecuteCommandHasChange();
+
+ return res;
+ }
+
+ return false;
+ }
+ ///
+ /// 更新状态
+ ///
+ ///
+ ///
+ public async Task UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto)
+ {
+ var data = await _db.Queryable().Where(x => x.Id == inputDto.Id).FirstAsync();
+
+ if (data != null)
+ {
+ var res = _db.Updateable()
+ .SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
+ .ExecuteCommandHasChange();
+
+ return res;
+ }
+
+ return false;
+ }
+ ///
+ /// 根据设备编码查询版本
+ ///
+ ///
+ ///
+ public async Task> GetDeviceVesion(string Code)
+ {
+ var resEntity =await _db.Queryable().Where(a => a.DeviceTypeKey == Code).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync();
+ return resEntity;
+ }
+ ///
+ /// 查询版本列表
+ ///
+ ///
+ public async Task> GetDeviceVesionList()
+ {
+ var resEntity =await _db.Queryable().Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync();
+ return resEntity;
+ }
+ }
+}
diff --git a/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs
new file mode 100644
index 0000000..5423038
--- /dev/null
+++ b/BPA.SAAS.Manage.Application/Device/Services/ProductService.cs
@@ -0,0 +1,130 @@
+using BPA.SAAS.Manage.Application.Device.Dtos.Device;
+using BPA.SAAS.Manage.Application.Device.Dtos.DeviceVesion;
+using BPA.SAAS.Manage.Application.Device.Interface;
+using BPA.SAAS.Manage.Comm.Const;
+using BPA.SAAS.Manage.Comm.Enum;
+using BPA.SAAS.Manage.Core.Base;
+using BPA.SAAS.Manage.Core.Device;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Application.Device.Services
+{
+ public class ProductService : IProductService, ITransient
+ {
+ ISqlSugarClient _db;
+ public ProductService(ISqlSugarClient db)
+ {
+ _db=db;
+ }
+ ///
+ /// 分页查询
+ ///
+ ///
+ ///
+ public async Task GetProductPage(ProductQueryInputDto inputDto)
+ {
+ var total = new RefAsync();
+ var data = await _db.Queryable().Where((x) => x.IsDeleted == 0)
+ .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), x => x.Name.Contains(inputDto.Name))
+ .WhereIF(!string.IsNullOrWhiteSpace(inputDto.Key), x => x.Key.Contains(inputDto.Key))
+ .OrderBy(x => x.CreateAt, OrderByType.Desc)
+ .ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
+
+ return new PageUtil()
+ {
+ Data = data,
+ Total = total
+
+ };
+ }
+ ///
+ /// 查询列表
+ ///
+ ///
+ public async Task> GetProductList()
+ {
+ var data = await _db.Queryable() .ToListAsync();
+ return data;
+ }
+ ///
+ /// 新增
+ ///
+ ///
+
+ public async Task AddProduct(ProductBaseDto inputDto)
+ {
+ var count=_db.Queryable().Count();
+ var res = await _db.Insertable(new BPA_Product
+ {
+ Name = inputDto.Name,
+ Key = GetNumber2(count),
+ Remark=inputDto.Remark,
+ Status = CommonStatus.ENABLE
+ }).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
+ return res > 0;
+ }
+ ///
+ /// 删除
+ ///
+ ///
+ ///
+ public async Task DeProduct(List inputList)
+ {
+ var datas = await _db.Queryable()
+ .Where(x => inputList.Contains(x.Id))
+ .ToListAsync();
+ _db.Deleteable(datas).ExecuteCommand();
+ return true;
+ }
+ ///
+ /// 修改
+ ///
+ ///
+ public async Task UpdateProduct(ProductBaseDto inputDto)
+ {
+ var data = await _db.Queryable().Where(x => x.Id == inputDto.Id).FirstAsync();
+
+ if (data != null)
+ {
+ var res = _db.Updateable()
+ .SetColumns(t => t.Name == inputDto.Name)
+ .SetColumns(t => t.Remark == inputDto.Remark).Where(t => t.Id == inputDto.Id)
+ .ExecuteCommandHasChange();
+
+ return res;
+ }
+
+ return false;
+ }
+ ///
+ /// 更新状态
+ ///
+ ///
+ ///
+ public async Task UpdateDeviceVesionSatatus(ProductSatatusDto inputDto)
+ {
+ var data = await _db.Queryable().Where(x => x.Id == inputDto.Id).FirstAsync();
+
+ if (data != null)
+ {
+ var res = _db.Updateable()
+ .SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
+ .ExecuteCommandHasChange();
+
+ return res;
+ }
+
+ return false;
+ }
+ private string GetNumber2(int count)
+ {
+ var groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value;
+ var res=MD5Encryption.Encrypt(groupId + DateTime.Now.ToString("yyyyMMddhhmmsss"), false,true)+ count;
+ return res;
+ }
+ }
+}
diff --git a/BPA.SAAS.Manage.Comm/Model/ListSelectQuery.cs b/BPA.SAAS.Manage.Comm/Model/ListSelectQuery.cs
new file mode 100644
index 0000000..191e2d8
--- /dev/null
+++ b/BPA.SAAS.Manage.Comm/Model/ListSelectQuery.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Comm.Model
+{
+ public class ListSelectQuery
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs
index 87a92d6..a382c40 100644
--- a/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs
+++ b/BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs
@@ -46,5 +46,9 @@ namespace BPA.SAAS.Manage.Core.Device
///
public string DeviceVersionKey { get; set; }
public string GroupId { get; set; }
+ ///
+ /// 支持工艺还是配方 0工艺 1配方
+ ///
+ public int TechnologyOrBom { get; set; }
}
}
diff --git a/BPA.SAAS.Manage.Core/Device/BPA_DeviceType.cs b/BPA.SAAS.Manage.Core/Device/BPA_DeviceType.cs
new file mode 100644
index 0000000..4e5b95a
--- /dev/null
+++ b/BPA.SAAS.Manage.Core/Device/BPA_DeviceType.cs
@@ -0,0 +1,20 @@
+using BPA.SAAS.Manage.Core.Base;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Core.Device
+{
+ ///
+ /// 设备标签
+ ///
+ [SugarTable("bpa_devicetype")]
+ public class BPA_DeviceType : IBaseEntity, IGroupId
+ {
+ public string Name { get; set; }
+ public string GroupId { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Core/Device/BPA_Product.cs b/BPA.SAAS.Manage.Core/Device/BPA_Product.cs
new file mode 100644
index 0000000..c1eed3c
--- /dev/null
+++ b/BPA.SAAS.Manage.Core/Device/BPA_Product.cs
@@ -0,0 +1,27 @@
+using BPA.SAAS.Manage.Comm.Enum;
+using BPA.SAAS.Manage.Core.Base;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPA.SAAS.Manage.Core.Device
+{
+ [SugarTable("bpa_product")]
+ public class BPA_Product: IBaseEntity, IGroupId
+ {
+ public string Name { get; set; }
+ public string Key { get; set; }
+ ///
+ /// 状态 0启用 1禁用
+ ///
+ public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
+ public string GroupId { get; set; }
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+ }
+}
diff --git a/BPA.SAAS.Manage.Web.Entry/appsettings.json b/BPA.SAAS.Manage.Web.Entry/appsettings.json
index 5e8fd5d..d489dad 100644
--- a/BPA.SAAS.Manage.Web.Entry/appsettings.json
+++ b/BPA.SAAS.Manage.Web.Entry/appsettings.json
@@ -16,7 +16,6 @@
}
],
"cos_config": {
-
"AppId": "1305371387",
"Region": "ap-chengdu",
"Bucket": "hbl-test-1305371387",