gwbvipvip 8 月之前
父節點
當前提交
a7e6d8489f
共有 11 個檔案被更改,包括 87 行新增36 行删除
  1. +10
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs
  2. +2
    -2
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInsertDto.cs
  3. +1
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs
  4. +19
    -17
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs
  5. +1
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs
  6. +4
    -5
      BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs
  7. +10
    -7
      BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
  8. +36
    -0
      BPA.SAAS.Manage.Application/StoreServers.cs
  9. +2
    -2
      BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs
  10. +1
    -0
      BPA.SAAS.Manage.Web.Core/Startup.cs
  11. +1
    -1
      BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json

+ 10
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs 查看文件

@@ -129,5 +129,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Enum
/// </summary>
[ErrorCodeItemMetadata("模板名称不能为空")]
Code10020,
/// <summary>
/// 获取场景数据失败
/// </summary>
[ErrorCodeItemMetadata("获取场景数据失败")]
Code10021,
/// <summary>
/// 场景不存在
/// </summary>
[ErrorCodeItemMetadata("场景不存在")]
Code10022,
}
}

+ 2
- 2
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInsertDto.cs 查看文件

@@ -27,9 +27,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos
/// </summary>
public string ProductId { get; set; }
/// <summary>
/// 产品标签
/// 设备标签名称
/// </summary>
public string ProductCode { get; set; }
public string DeviceTypeName { get; set; }
/// <summary>
/// 产品版本
/// </summary>


+ 1
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceUpateDto.cs 查看文件

@@ -29,7 +29,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos
/// <summary>
/// 产品标签
/// </summary>
public string ProductCode { get; set; }
public string DeviceTypeName { get; set; }
/// <summary>
/// 产品版本
/// </summary>


+ 19
- 17
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs 查看文件

@@ -1,4 +1,5 @@
using BPA.KitChen.GroupMeal.SqlSugar;
using BPA.SAAS.KitChenManage.Core;
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Enum;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos;
@@ -32,7 +33,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
/// <returns></returns>
public async Task<PageUtil<List<DeviceDto>>> GetDevicePageList(DevicePageInputDto inputDto)
{
int total = new RefAsync<int>();
RefAsync<int> total = 0;
var data =await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product,BPA_ProductVesion>((a, b,c) =>
new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id, JoinType.Left, a.ProductVersionId == c.Id))
.WhereIF(!string.IsNullOrEmpty(inputDto.ProductName), (a, b, c) => b.Name.Contains(inputDto.ProductName))
@@ -67,7 +68,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
resEntity.StopId = dto.StopId;
resEntity.ProductId = dto.ProductId;
resEntity.ProductVersionId = dto.ProductVersionId;
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == dto.ProductCode).First();
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == dto.DeviceTypeName).First();
if (check != null)
{
resEntity.DeviceTypeId = check.Id;
@@ -89,10 +90,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
SqlSugarDb.Db.CommitTran();
return res > 0;
}
catch (Exception)
catch (Exception ex)
{
SqlSugarDb.Db.RollbackTran();
throw Oops.Oh(ErrorCodeEnum.Code1007);
throw Oops.Oh(ErrorCodeEnum.Code1007+","+ex.Message);
}

}
@@ -109,9 +110,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
resEntity.StopId = dto.StopId;
resEntity.ProductId = dto.ProductId;
resEntity.ProductVersionId = dto.ProductVersionId;
if (!string.IsNullOrWhiteSpace(dto.ProductCode))
if (!string.IsNullOrWhiteSpace(dto.DeviceTypeName))
{
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == dto.ProductCode).First();
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == dto.DeviceTypeName).First();
if (check != null)
{
resEntity.DeviceTypeId = check.Id;
@@ -161,13 +162,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
var getStopurl = BaseServerUrl + "api/store/getbyIdstorelist_alm?id=" + dto.StopId;
var responseStop = await getStopurl.SetHeaders(new
{
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value
groupId = CurrentUser.GroupId
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync();
var resStop = JsonConvert.DeserializeObject<ResponDataBase>(responseStop);
if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败");
var dataStop = JsonConvert.DeserializeObject<List<StopDto>>(resStop.data.ToString());
if (dataStop.Count==0) throw Oops.Oh("获取场景数据失败");
if(!dataStop.Where(x=>x.Id == dto.StopId).Any()) throw Oops.Oh("场景不存在");
var responData = JsonConvert.DeserializeObject<ResponDataBase>(responseStop);
var resStop = JsonConvert.DeserializeObject<StopDto> (responData.data.ToString());
if (responData.statusCode != "200") throw Oops.Oh(ErrorCodeEnum.Code10021);
//var dataStop = responData?.data;
if (resStop == null) throw Oops.Oh(ErrorCodeEnum.Code10022);
// if(!dataStop.Where(x=>x.Id == dto.StopId).Any()) throw Oops.Oh(ErrorCodeEnum.Code10022);

var checkProduct = SqlSugarDb.Db.Queryable<BPA_Product>().Where(x => x.Id == dto.ProductId).Any();
if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010);
@@ -187,11 +189,11 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services
{
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync();
var resStop = JsonConvert.DeserializeObject<ResponDataBase>(responseStop);
if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败");
var dataStop = JsonConvert.DeserializeObject<List<StopDto>>(resStop.data.ToString());
if (dataStop.Count == 0) throw Oops.Oh("获取场景数据失败");
if (!dataStop.Where(x => x.Id == dto.StopId).Any()) throw Oops.Oh("场景不存在");
var responData = JsonConvert.DeserializeObject<ResponDataBase>(responseStop);
var resStop = JsonConvert.DeserializeObject<StopDto>(responData.data.ToString());
if (responData.statusCode != "200") throw Oops.Oh(ErrorCodeEnum.Code10021);
//var dataStop = responData?.data;
if (resStop == null) throw Oops.Oh(ErrorCodeEnum.Code10022);

var checkProduct = SqlSugarDb.Db.Queryable<BPA_Product>().Where(x => x.Id == dto.ProductId).Any();
if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010);


+ 1
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs 查看文件

@@ -19,7 +19,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
{
public async Task<PageUtil> GetWarehouseTemplatePage(WarehouseTemplateQueryDto inputDto)
{
var total = new RefAsync<int>();
RefAsync<int> total = 0;
var data = await SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate, BPA_DeviceInfo, BPA_ProductVesion>((a, b, c) => new JoinQueryInfos(JoinType.Left, a.DeviceId == b.Id, JoinType.Left, b.ProductVersionId == c.Id))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.TemplateName), (a, b, c) => a.TemplateName.Contains(inputDto.TemplateName))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.DeviceName), (a, b, c) => a.DeviceId.Contains(inputDto.DeviceName))


+ 4
- 5
BPA.SAAS.Manage.Application/Device/Dtos/Device/DeviceInfoBaseDto.cs 查看文件

@@ -27,15 +27,14 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
/// 所属产品
/// </summary>
public string ProductId { get; set; }
/// <summary>
/// 产品标签
/// </summary>
public string ProductCode { get; set; }
///// <summary>
///// 产品标签
///// </summary>
//public string ProductCode { get; set; }
/// <summary>
/// 产品版本
/// </summary>
public string ProductVersionId { get; set; }
public CommonStatus Status { get; set; }
public int TechnologyOrBom { get; set; }
}
}

+ 10
- 7
BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs 查看文件

@@ -27,6 +27,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public class DeviceService: IDeviceService, ITransient
{
ISqlSugarClient _db;
StoreServers storeServer = new();
public DeviceService(ISqlSugarClient db)
{
_db=db;
@@ -39,6 +40,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<PageUtil> GetDeviceInfoPage(DeviceQueryInputDto inputDto)
{
RefAsync<int> total =0;
var dataStore=await storeServer.GetStop();
var data = await _db.Queryable<BPA_DeviceInfo, BPA_Product>((a, b) => new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id))

.WhereIF(!string.IsNullOrWhiteSpace(inputDto.StoreId), (a, b) => a.StopId == inputDto.StoreId)
@@ -56,8 +58,9 @@ namespace BPA.SAAS.Manage.Application.Device.Services
.Mapper(x =>
{
var Vesion = _db.Queryable<BPA_ProductVesion>().Where(c => c.Id == x.ProductVersionId).First();
var Stop=dataStore?.Where(f => f.Id == x.StopId).FirstOrDefault();
x.ProductVersionName = Vesion?.Vesion;
//x.StopName= dataStore?.Where(f=>f.Id==x.StopId).First()?.Name;
x.StopName= Stop?.Name;
})
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
return new PageUtil()
@@ -129,9 +132,9 @@ namespace BPA.SAAS.Manage.Application.Device.Services
BPA_DeviceInfo bPA_DeviceInfo = inputDto.Adapt<BPA_DeviceInfo>();
var product=_db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First();
bPA_DeviceInfo.Status = CommonStatus.ENABLE;
bPA_DeviceInfo.ProductCode= product?.Code;
//bPA_DeviceInfo.ProductCode= product?.Code;
var res =await _db.Insertable(bPA_DeviceInfo) .CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
mqttsub(res.AutoKey, res.ProductCode);
//mqttsub(res.AutoKey, product?.Code);
return res != null;
}
/// <summary>
@@ -145,10 +148,10 @@ namespace BPA.SAAS.Manage.Application.Device.Services

if (data != null)
{
mqttsub(data.AutoKey, data.ProductCode);
//mqttsub(data.AutoKey, data.ProductCode);
var product = _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.ProductId).First();
var inputData = inputDto.Adapt<BPA_DeviceInfo>();
inputData.ProductCode = product?.Code;
//inputData.ProductCode = product?.Code;
var res = await _db.Updateable(inputData)
.UpdateColumns(x => new
{
@@ -156,10 +159,10 @@ namespace BPA.SAAS.Manage.Application.Device.Services
x.DeviceTypeId,
x.StopId,
x.ProductId,
x.ProductCode,
//x.ProductCode,
x.Status,
x.ProductVersionId,
x.TechnologyOrBom
// x.TechnologyOrBom
})
.Where(x => x.Id == inputDto.Id).ExecuteCommandAsync();


+ 36
- 0
BPA.SAAS.Manage.Application/StoreServers.cs 查看文件

@@ -0,0 +1,36 @@
using BPA.SAAS.Manage.Application.Device.Dtos.Device;
using BPA.SAAS.Manage.Comm.Const;
using BPA.SAAS.Manage.Core.Base;
using Furion.RemoteRequest.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application
{
[ApiDescriptionSettings("Stop", Tag = "获取场景")]
public class StoreServers: IDynamicApiController
{
public StoreServers()
{

}
private string BaseServerUrl = App.GetConfig<string>("baseurl");
[HttpGet("/api/stop/getstop")]
public async Task<List<StoreDto>> GetStop()
{
var getStoreurl = BaseServerUrl + "api/store/getstorelist_alm";//获取商品属性
var responseGoodsAttribute = await getStoreurl.SetHeaders(new
{
groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value
}).SetHttpMethod(HttpMethod.Get).GetAsStringAsync();
var resStore = JsonConvert.DeserializeObject<ResponDataBase>(responseGoodsAttribute);
if (resStore?.statusCode != "200") throw Oops.Oh("获取场景数据失败");
var dataStore = JsonConvert.DeserializeObject<List<StoreDto>>(resStore.data.ToString());
return dataStore;
}
}
}

+ 2
- 2
BPA.SAAS.Manage.Core/Device/BPA_DeviceInfo.cs 查看文件

@@ -35,7 +35,7 @@ namespace BPA.SAAS.Manage.Core.Device
/// <summary>
/// 产品标签
/// </summary>
public string ProductCode { get; set; }
//public string ProductCode { get; set; }
/// <summary>
/// 状态 【正常 停用】默认 正常
/// </summary>
@@ -54,6 +54,6 @@ namespace BPA.SAAS.Manage.Core.Device
/// <summary>
/// 支持工艺还是配方 0工艺 1配方
/// </summary>
public int TechnologyOrBom { get; set; }
//public int TechnologyOrBom { get; set; }
}
}

+ 1
- 0
BPA.SAAS.Manage.Web.Core/Startup.cs 查看文件

@@ -64,6 +64,7 @@ namespace BPA.SAAS.Manage.Web.Core

});
});
services.AddRemoteRequest();
services.AddCorsAccessor();
services.AddSqlsugarSetup(App.Configuration);
services.AddControllers()


+ 1
- 1
BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json 查看文件

@@ -14,7 +14,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://192.168.1.17:5006"
"applicationUrl": "http://192.168.1.19:5006"
},
"Docker": {
"commandName": "Docker",


Loading…
取消
儲存