Browse Source

商品工艺

master
zhaoy 10 months ago
parent
commit
bce1927324
6 changed files with 65 additions and 83 deletions
  1. +2
    -0
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodstechnologyModel.cs
  2. +28
    -79
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  3. +3
    -1
      BPA.SAAS.Manage.Application/Device/Dtos/Device/TechnologyView.cs
  4. +23
    -0
      BPA.SAAS.Manage.Comm/Enum/TechnologyEnums.cs
  5. +3
    -1
      BPA.SAAS.Manage.Core/Device/BPA_Technology.cs
  6. +6
    -2
      BPA.SAAS.Manage.Core/Device/BPA_TechnologyAction.cs

+ 2
- 0
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodstechnologyModel.cs View File

@@ -16,6 +16,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
public string ActionName { get; set; }
[Column("输入类型")]
public string ActionType { get; set; }
[Column("输入值类型")]
public string TechnologyType { get; set; }
[Column("输入选项")]
public string ActionValue { get; set; }
}


+ 28
- 79
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs View File

@@ -477,59 +477,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
var source = file.OpenReadStream();
var mapper = new Mapper(source);


_db.Ado.BeginTran();
//添加 设备_烹饪工序模型
#region 添加 设备_烹饪工序模型
//ReadExcel<GoodstechnologyModel> readGoodstechnologyExcel = new();
//var GoodstechnologyModellist = readGoodstechnologyExcel.ExcelToList(source, mapper, "设备_烹饪工序模型");
//List<BPA_GoodsTechnology> GoodsTechnologyList = new();
//List<BPA_TechnologyAction> GoodsTechnologyActionList = new();
//string currennaid = "";
//for (int i = 0; i < GoodstechnologyModellist.Count; i++)
//{
// if (!string.IsNullOrWhiteSpace(GoodstechnologyModellist[i].Name))
// {
// BPA_GoodsTechnology item = new BPA_GoodsTechnology()
// {
// Id = Guid.NewGuid().ToString(),
// Name = GoodstechnologyModellist[i].Name,
// Status = 0,
// CreateAt = DateTime.Now,
// GroupId = groupId,
// IsDeleted = 0,
// };
// GoodsTechnologyList.Add(item);
// currennaid = item.Id;
// }
// var actvalueary = GoodstechnologyModellist[i].ActionValue?.Split('、');
// BPA_TechnologyAction technologyAction = new()
// {
// Id = Guid.NewGuid().ToString(),
// GoodstechnologyId = currennaid,
// ActionName = GoodstechnologyModellist[i].ActionName,
// ActionType = GoodstechnologyModellist[i].ActionType,
// Sort = i,
// GroupId = groupId,
// CreateAt = DateTime.Now,
// //ActionValue = GoodstechnologyModellist[i].ActionValue,
// };
// List<ActionValueModel> ActionValueModelList = new();
// if (actvalueary != null)
// {
// foreach (var item in actvalueary)
// {
// ActionValueModelList.Add(new ActionValueModel() { actionValueName = item });
// }
// technologyAction.ActionValue = JsonConvert.SerializeObject(ActionValueModelList);
// }
// GoodsTechnologyActionList.Add(technologyAction);
//}
//await _db.Insertable(GoodsTechnologyList).ExecuteCommandAsync();
//await _db.Insertable(GoodsTechnologyActionList).ExecuteCommandAsync();
#endregion

//添加 商品_物料信息
#region 添加 商品_物料信息

@@ -576,7 +524,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
Aittribute = 0,
Batching_Name = t.BatchingName,
Code = Guid.NewGuid().ToString(),
Code = GetNumber2(),
IsDeleted = 0,
netrecovery = 0,
outstockUint = unit.Id,
@@ -603,6 +551,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
if (thisitem != null)
{
item2.Id = thisitem.Id;
item2.GroupId = thisitem.GroupId;
_db.Updateable(item2).ExecuteCommand();
}
else
@@ -641,6 +590,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
};

type=await _db.Insertable(parentType).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
parentType = type;
}
//属性
var goodsAttribute = await _db.Queryable<BPA_GoodsAttribute>()
@@ -650,7 +600,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
goodsAttribute = new BPA_GoodsAttribute()
{
AttributeName = "默认属性",
GoodsTypeId = type.Id,
GoodsTypeId = parentType.Id,
IsDeleted = 0,
Sort = 0,

@@ -696,7 +646,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var imagePath = images.FirstOrDefault(x => x.Index == index);
goodsInfo.Add(new BPA_GoodsInfo()
{
Code = Guid.NewGuid().ToString(),
Code = GetNumber2(),
CreateAt = DateTime.Now,
CreateBy = userId,
DefaultMate = null,
@@ -708,7 +658,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
ImgUrl = imagePath?.ImgesPath,
Name = item.Name,
Sort = 0,
GoodsTypeId = type.Id,
GoodsTypeId = parentType.Id,
Price = 0,
IsAttrubute = false,
IsDeleted = 0,
@@ -732,6 +682,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
if (thisitem != null)
{
item2.Id = thisitem.Id;
item2.AutoKey = thisitem.AutoKey;
item2.GroupId= thisitem.GroupId;
_db.Updateable(item2).ExecuteCommand();
}
else
@@ -842,12 +794,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services

var data = await _db.Queryable<BPA_Technology>()
.Where(x => x.Name == thisName && x.DeviceVersionId == device.ProductVersionId).FirstAsync();
var data2 = new BPA_TechnologyAction();
if (data != null)
{
data2 = await _db.Queryable<BPA_TechnologyAction>()
.Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.TechnologyId == data.Id).FirstAsync();
}
if (data == null) throw Oops.Oh("该设备还没有设置工艺基础信息");
var data2 = await _db.Queryable<BPA_TechnologyAction>()
.Where(x => x.ActionName == goodTechnologyModel[i].Configuration && x.TechnologyId == data.Id).FirstAsync();
var batching = new BPA_Batching();
var IsBatch = goodTechnologyModel[i].Name != "液体料";

@@ -897,15 +846,15 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services

var json = info.Where(x => x.chnologyId == thisItem.ChnologyId && x.index == thisItem.Index).ToList();

if (thisItem.StepName == "液体料")
{
foreach (var item in json)
{
var batching = await _db.Queryable<BPA_Batching>()
.FirstAsync(x => x.Batching_Name == item.actionName);
item.technologyactionId = batching?.Id;
}
}
//if (thisItem.StepName == "液体料")
//{
// foreach (var item in json)
// {
// var batching = await _db.Queryable<BPA_Batching>()
// .FirstAsync(x => x.Batching_Name == item.actionName);
// item.technologyactionId = batching?.Id;
// }
//}
if (thisItem.StepName == "主料")
{
var v1 = json.FirstOrDefault(x => x.actionName == "主料名称");
@@ -983,13 +932,13 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
}
if (value.ToString().Trim() == goodsName.Trim())
{
ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false);
return attribute?.Name;
//if (item2.IsDefined(typeof(ColumnAttribute), false))
//{
// ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false);
// return attribute.Name;
//}
//ColumnAttribute attribute = (ColumnAttribute)item2.GetCustomAttribute(typeof(ColumnAttribute), false);
//return attribute?.Name;
if (item2.IsDefined(typeof(Npoi.Mapper.Attributes.ColumnAttribute), false))
{
Npoi.Mapper.Attributes.ColumnAttribute attribute = (Npoi.Mapper.Attributes.ColumnAttribute)item2.GetCustomAttribute(typeof(Npoi.Mapper.Attributes.ColumnAttribute), false);
return attribute.Name;
}
}
}
return "";
@@ -1056,7 +1005,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
Id = goodsTechnologyId == null ? Guid.NewGuid().ToString() : goodsTechnologyId.Id,
Name = GoodstechnologyModellist[i].Name,
DeviceVersionId = deviceVersion.Id
};
GoodsTechnologyList.Add(item);
@@ -1075,6 +1023,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
ActionName = GoodstechnologyModellist[i].ActionName,
ActionType = CharacterConversion(GoodstechnologyModellist[i].ActionType),
Sort = i,
TechnologyType = GoodstechnologyModellist[i].TechnologyType == "物料" ? TechnologyEnums.Batch : TechnologyEnums.Other,
CreateAt = DateTime.Now,
//ActionValue = GoodstechnologyModellist[i].ActionValue,
};


+ 3
- 1
BPA.SAAS.Manage.Application/Device/Dtos/Device/TechnologyView.cs View File

@@ -1,4 +1,5 @@
using BPA.SAAS.Manage.Core.Device;
using BPA.SAAS.Manage.Comm.Enum;
using BPA.SAAS.Manage.Core.Device;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,6 +12,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
{
public string Id { get; set; }
public string Name { get; set; }
public TechnologyEnums TechnologyType { get; set; }
public string DeviceVersionId { get; set; }
public string ForeignKeyRe { get; set; }
public DateTime CreateAt { get; set; }


+ 23
- 0
BPA.SAAS.Manage.Comm/Enum/TechnologyEnums.cs View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Comm.Enum
{
public enum TechnologyEnums
{
/// <summary>
/// 物料
/// </summary>
[Description("物料")]
Batch = 1,
/// <summary>
/// 物料
/// </summary>
[Description("物料")]
Other = 0,
}
}

+ 3
- 1
BPA.SAAS.Manage.Core/Device/BPA_Technology.cs View File

@@ -1,4 +1,6 @@
using SqlSugar;
using BPA.SAAS.Manage.Comm.Enum;
using Kdbndp.KingbaseTypes;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;


+ 6
- 2
BPA.SAAS.Manage.Core/Device/BPA_TechnologyAction.cs View File

@@ -1,4 +1,5 @@
using SqlSugar;
using BPA.SAAS.Manage.Comm.Enum;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -20,7 +21,10 @@ namespace BPA.SAAS.Manage.Core.Device
public string ActionValue { get; set; }
public string ActionType { get; set; }
public string Unit { get; set; }
public bool IsBatch { get; set; }
/// <summary>
/// 工艺类型
/// </summary>
public TechnologyEnums TechnologyType { get; set; }
public DateTime CreateAt { get; set; }
public int Sort { get; set; }
}


Loading…
Cancel
Save