Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -19,6 +19,10 @@ namespace Tnb.BasicData.Entities.Dto
|
|||||||
public string? unit_id { get; set; }
|
public string? unit_id { get; set; }
|
||||||
public string? version { get; set; }
|
public string? version { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public int quantity { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 工艺路线名称
|
/// 工艺路线名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? route_id { get; set; }
|
public string? route_id { get; set; }
|
||||||
|
|||||||
@@ -45,12 +45,11 @@ namespace Tnb.BasicData.Entities.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? loss_rate {get;set;}
|
public string? loss_rate {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Desc:数量
|
|
||||||
/// Default:NULL::character varying
|
|
||||||
/// Nullable:True
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? quantity {get;set;}
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public int quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Desc:需要称量
|
/// Desc:需要称量
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public partial class BasEbomD : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量
|
/// 数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? quantity { get; set; }
|
public int quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 损耗率
|
/// 损耗率
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public partial class BasEbomH : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量
|
/// 数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? quantity { get; set; }
|
public int quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位id
|
/// 单位id
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ namespace Tnb.BasicData
|
|||||||
material_id_id = b.id,
|
material_id_id = b.id,
|
||||||
status = SqlFunc.IIF(a.status == "0", "禁用", "启用"),
|
status = SqlFunc.IIF(a.status == "0", "禁用", "启用"),
|
||||||
descrip = a.descrip,
|
descrip = a.descrip,
|
||||||
|
quantity = a.quantity,
|
||||||
version = a.version,
|
version = a.version,
|
||||||
route_id = c.name,
|
route_id = c.name,
|
||||||
route_id_id = c.id,
|
route_id_id = c.id,
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
|
{
|
||||||
|
public class PrdMoListTreeOutput
|
||||||
|
{
|
||||||
|
|
||||||
|
//public Dictionary<string, object> row { get; set; }
|
||||||
|
|
||||||
|
#region 注释代码
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工单id
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string mo_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工单代码
|
||||||
|
/// </summary>
|
||||||
|
public string mo_code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string material_name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格型号
|
||||||
|
/// </summary>
|
||||||
|
public string material_standard { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工单类型:1-正常工单、2-返工工单、3-试制工单
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产状态 Initial: 初始, Confirm:确认 Release: 下发, Open: 生产中, Close: 关单, Pending: 暂停
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划生产数量
|
||||||
|
/// </summary>
|
||||||
|
public string plan_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已投入数量
|
||||||
|
/// </summary>
|
||||||
|
public string input_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已完工数量
|
||||||
|
/// </summary>
|
||||||
|
public string complete_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报废数量
|
||||||
|
/// </summary>
|
||||||
|
public string scrap_qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划开始时间
|
||||||
|
/// </summary>
|
||||||
|
public string plan_start_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 计划结束时间
|
||||||
|
/// </summary>
|
||||||
|
public string plan_end_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否生派工单
|
||||||
|
/// </summary>
|
||||||
|
public string is_create_dispatch { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产线代码
|
||||||
|
/// </summary>
|
||||||
|
public string? production_linecode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否合并
|
||||||
|
/// </summary>
|
||||||
|
public string is_merge { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组合工单
|
||||||
|
/// </summary>
|
||||||
|
public string? combine_mo_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
public string? time_stamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public string create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public string modify_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
public string? material_id { get; set; }
|
||||||
|
public string? material_id_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 已排产数量
|
||||||
|
/// </summary>
|
||||||
|
public string scheduled_qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 父工单id
|
||||||
|
/// </summary>
|
||||||
|
public string parent_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取节点id.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取节点父id.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string parentId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否有子级.
|
||||||
|
/// </summary>
|
||||||
|
public bool hasChildren { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置Children.
|
||||||
|
/// </summary>
|
||||||
|
public List<PrdMoListTreeOutput>? children { get; set; } = new List<PrdMoListTreeOutput>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子节点数量.
|
||||||
|
/// </summary>
|
||||||
|
public int num { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否为子节点.
|
||||||
|
/// </summary>
|
||||||
|
public bool isLeaf { get; set; } = false;
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -179,6 +179,56 @@ namespace Tnb.ProductionMgr
|
|||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
return (row > 0);
|
return (row > 0);
|
||||||
}
|
}
|
||||||
|
// /// <summary>
|
||||||
|
// /// 关联同组工单
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="input">关联同组工单输入参数</param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// [HttpPost]
|
||||||
|
// public async Task<dynamic> RelevancySameGroupMo(MoCrInput input)
|
||||||
|
// {
|
||||||
|
// (bool executeRes, string errMsg) multi = (true, "");
|
||||||
|
// var list = await _repository.AsSugarClient().Queryable<PrdMo>()
|
||||||
|
// .InnerJoin<ToolMolds>((a, b) => a.material_id == b.material_id)
|
||||||
|
// .Where((a, b) => input.WorkOrderIds.Contains(a.id))
|
||||||
|
// .Select((a, b) => new
|
||||||
|
// {
|
||||||
|
// planDate = a.plan_start_date,
|
||||||
|
// mold_code = b.mold_code,
|
||||||
|
// }).ToListAsync();
|
||||||
|
// var planDateAll = true;
|
||||||
|
// var moldIdAll = true;
|
||||||
|
// if (list?.Count > 0)
|
||||||
|
// {
|
||||||
|
// var planDate = list.FirstOrDefault()?.planDate;
|
||||||
|
// var moldCode = list.FirstOrDefault()?.mold_code;
|
||||||
|
//
|
||||||
|
// planDateAll = list.Skip(1).All(x => x.planDate == planDate);
|
||||||
|
// moldIdAll = list.Skip(1).All(x => x.mold_code == moldCode);
|
||||||
|
// if (planDateAll && moldIdAll)
|
||||||
|
// {
|
||||||
|
// var groupId = SnowflakeIdHelper.NextId();
|
||||||
|
// multi.executeRes = await _repository.AsSugarClient().Updateable<PrdMo>()
|
||||||
|
// .SetColumns(c => new PrdMo { combine_mo_code = groupId })
|
||||||
|
// .Where(it => input.WorkOrderIds.Contains(it.id))
|
||||||
|
// .ExecuteCommandHasChangeAsync();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// multi.executeRes = false;
|
||||||
|
// if (!planDateAll)
|
||||||
|
// {
|
||||||
|
// throw new AppFriendlyException("计划开始日期不一致", null);
|
||||||
|
// }
|
||||||
|
// if (!moldIdAll)
|
||||||
|
// {
|
||||||
|
// throw new AppFriendlyException("未关联到同一模具下", null);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return multi;
|
||||||
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 关联同组工单
|
/// 关联同组工单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -189,12 +239,13 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
(bool executeRes, string errMsg) multi = (true, "");
|
(bool executeRes, string errMsg) multi = (true, "");
|
||||||
var list = await _repository.AsSugarClient().Queryable<PrdMo>()
|
var list = await _repository.AsSugarClient().Queryable<PrdMo>()
|
||||||
.InnerJoin<ToolMolds>((a, b) => a.material_id == b.material_id)
|
.LeftJoin<ToolMoldsMaterial>((a, b) => a.material_id == b.material_id)
|
||||||
.Where((a, b) => input.WorkOrderIds.Contains(a.id))
|
.LeftJoin<ToolMolds>((a,b,c)=>b.mold_id==c.id)
|
||||||
.Select((a, b) => new
|
.Where((a, b,c) => input.WorkOrderIds.Contains(a.id))
|
||||||
|
.Select((a, b,c) => new
|
||||||
{
|
{
|
||||||
planDate = a.plan_start_date,
|
planDate = a.plan_start_date,
|
||||||
mold_code = b.mold_code,
|
mold_code = c.mold_code,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
var planDateAll = true;
|
var planDateAll = true;
|
||||||
var moldIdAll = true;
|
var moldIdAll = true;
|
||||||
@@ -203,8 +254,8 @@ namespace Tnb.ProductionMgr
|
|||||||
var planDate = list.FirstOrDefault()?.planDate;
|
var planDate = list.FirstOrDefault()?.planDate;
|
||||||
var moldCode = list.FirstOrDefault()?.mold_code;
|
var moldCode = list.FirstOrDefault()?.mold_code;
|
||||||
|
|
||||||
planDateAll = list.Skip(1).All(x => x.planDate == planDate);
|
planDateAll = list.All(x => x.planDate == planDate);
|
||||||
moldIdAll = list.Skip(1).All(x => x.mold_code == moldCode);
|
moldIdAll = moldCode != null && list.All(x => x.mold_code == moldCode);
|
||||||
if (planDateAll && moldIdAll)
|
if (planDateAll && moldIdAll)
|
||||||
{
|
{
|
||||||
var groupId = SnowflakeIdHelper.NextId();
|
var groupId = SnowflakeIdHelper.NextId();
|
||||||
@@ -218,11 +269,11 @@ namespace Tnb.ProductionMgr
|
|||||||
multi.executeRes = false;
|
multi.executeRes = false;
|
||||||
if (!planDateAll)
|
if (!planDateAll)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("计划开始日期不一致", null);
|
throw Oops.Bah("计划开始日期不一致");
|
||||||
}
|
}
|
||||||
if (!moldIdAll)
|
if (!moldIdAll)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("未关联到同一模具下", null);
|
throw Oops.Bah("未关联到同一模具下");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,6 +426,7 @@ namespace Tnb.ProductionMgr
|
|||||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
|
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
|
||||||
// var data = await _runService.GetListResult(templateEntity, input);
|
// var data = await _runService.GetListResult(templateEntity, input);
|
||||||
//
|
//
|
||||||
|
//
|
||||||
// if (data?.list?.Count > 0)
|
// if (data?.list?.Count > 0)
|
||||||
// {
|
// {
|
||||||
// var parentIdField = nameof(PrdMo.parent_id);
|
// var parentIdField = nameof(PrdMo.parent_id);
|
||||||
@@ -529,7 +530,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.WhereIF(!string.IsNullOrEmpty(moCode),(a,b,c,d,e)=>a.mo_code.Contains(moCode))
|
.WhereIF(!string.IsNullOrEmpty(moCode),(a,b,c,d,e)=>a.mo_code.Contains(moCode))
|
||||||
.WhereIF(!string.IsNullOrEmpty(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode))
|
.WhereIF(!string.IsNullOrEmpty(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode))
|
||||||
.OrderByDescending((a,b,c,d,e)=>a.create_time)
|
.OrderByDescending((a,b,c,d,e)=>a.create_time)
|
||||||
.Select((a, b, c, d, e) => new PrdMoTreeOutput
|
.Select((a, b, c, d, e) => new PrdMoListTreeOutput
|
||||||
{
|
{
|
||||||
org_id = a.org_id,
|
org_id = a.org_id,
|
||||||
mo_id = a.id,
|
mo_id = a.id,
|
||||||
@@ -557,13 +558,50 @@ namespace Tnb.ProductionMgr
|
|||||||
scheduled_qty = a.scheduled_qty.Value.ToString(),
|
scheduled_qty = a.scheduled_qty.Value.ToString(),
|
||||||
parent_id = "0",
|
parent_id = "0",
|
||||||
id = a.id,
|
id = a.id,
|
||||||
hasChildren = false,
|
hasChildren = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
|
||||||
num = 0,
|
num = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Count(),
|
||||||
isLeaf = true,
|
isLeaf = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
|
||||||
|
children = SqlFunc.Subqueryable<PrdMo>()
|
||||||
|
.LeftJoin<BasMaterial>((h,i) => h.material_id == i.id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((h,i,j) => h.mo_type == j.Id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((h,i,j,k) => h.mo_status == k.Id)
|
||||||
|
.LeftJoin<UserEntity>((h,i,j,k,l) => h.create_id == l.Id)
|
||||||
|
.Where((h,i,j,k,l)=>a.id==h.parent_id).ToList((h,i,j,k,l)=>new PrdMoListTreeOutput()
|
||||||
|
{
|
||||||
|
org_id = h.org_id,
|
||||||
|
mo_id = h.id,
|
||||||
|
mo_code = h.mo_code,
|
||||||
|
material_code = i.code,
|
||||||
|
material_name = i.name,
|
||||||
|
material_standard = i.material_standard,
|
||||||
|
mo_type = j.FullName,
|
||||||
|
mo_status = k.FullName,
|
||||||
|
plan_qty = h.plan_qty.Value.ToString(),
|
||||||
|
input_qty = h.input_qty.Value.ToString(),
|
||||||
|
complete_qty = h.complete_qty.Value.ToString(),
|
||||||
|
scrap_qty = h.scrap_qty.Value.ToString(),
|
||||||
|
plan_start_date = h.plan_start_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
plan_end_date = h.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
is_create_dispatch = h.is_create_dispatch==0 ? "否" : "是",
|
||||||
|
production_linecode = h.production_linecode,
|
||||||
|
is_merge = h.is_merge==0 ? "否" : "是",
|
||||||
|
combine_mo_code = h.combine_mo_code,
|
||||||
|
time_stamp = h.time_stamp,
|
||||||
|
create_id = l.RealName,
|
||||||
|
create_time = h.create_time.Value.ToString("yyyy-MM-dd : HH:mm:ss"),
|
||||||
|
material_id = i.code,
|
||||||
|
material_id_id = h.material_id,
|
||||||
|
scheduled_qty = h.scheduled_qty.Value.ToString(),
|
||||||
|
parent_id = a.id,
|
||||||
|
id = h.id,
|
||||||
|
hasChildren = false,
|
||||||
|
num = 0,
|
||||||
|
isLeaf = true,
|
||||||
|
})
|
||||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
|
||||||
return PageResult<PrdMoTreeOutput>.SqlSugarPageResult(result);
|
return PageResult<PrdMoListTreeOutput>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ namespace Tnb.QcMgr.Entities
|
|||||||
{
|
{
|
||||||
public class CheckItemOut
|
public class CheckItemOut
|
||||||
{
|
{
|
||||||
public string checktypeid { get; set; }
|
public string? checktypeid { get; set; }
|
||||||
public string checktypename { get; set; }
|
public string? checktypename { get; set; }
|
||||||
public List<CheckItem> items { get; set; }
|
public List<CheckItem>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckItem
|
public class CheckItem
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,54 +8,54 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
{
|
{
|
||||||
public class CheckItemsInput
|
public class CheckItemsInput
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string status { get; set; }
|
public string? status { get; set; }
|
||||||
public List<CheckTypeInput> checktypes { get; set; }
|
public List<CheckTypeInput>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckTypeInput
|
public class CheckTypeInput
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public List<ItemInput> items { get; set; }
|
public List<ItemInput>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class ItemInput
|
public class ItemInput
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string itemdid { get; set; }
|
public string? itemdid { get; set; }
|
||||||
|
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public string excontent { get; set; }
|
public string? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public string errorcause { get; set; }
|
public string? errorcause { get; set; }
|
||||||
public string errorlevel { get; set; }
|
public string? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string isexec { get; set; }
|
public string? isexec { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckItemsOut
|
public class CheckItemsOut
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string status { get; set; }
|
public string? status { get; set; }
|
||||||
public List<CheckTypeOut> checktypes { get; set; }
|
public List<CheckTypeOut>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckTypeOut
|
public class CheckTypeOut
|
||||||
{
|
{
|
||||||
public string checktypeid { get; set; }
|
public string? checktypeid { get; set; }
|
||||||
public string checktypename { get; set; }
|
public string? checktypename { get; set; }
|
||||||
public List<ItemOut> items { get; set; }
|
public List<ItemOut>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class ItemOut
|
public class ItemOut
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string itemdid { get; set; }
|
public string? itemdid { get; set; }
|
||||||
public Show setShow { get; set; }
|
public Show? setShow { get; set; }
|
||||||
public Data setData { get; set; }
|
public Data? setData { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class Show {
|
public class Show {
|
||||||
@@ -70,15 +70,15 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
public bool isexec { get; set; }
|
public bool isexec { get; set; }
|
||||||
}
|
}
|
||||||
public class Data {
|
public class Data {
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public Excontent excontent { get; set; }
|
public Excontent? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public string[] errorcause { get; set; }
|
public string[]? errorcause { get; set; }
|
||||||
public string[] errorlevel { get; set; }
|
public string[]? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
public Isexec isexec { get; set; }
|
public Isexec? isexec { get; set; }
|
||||||
}
|
}
|
||||||
public class Isexec
|
public class Isexec
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,55 +9,55 @@ namespace Tnb.QcMgr.Entities
|
|||||||
{
|
{
|
||||||
public class CheckPlanInput
|
public class CheckPlanInput
|
||||||
{
|
{
|
||||||
public string mainid { get; set; }
|
public string? mainid { get; set; }
|
||||||
public string addid { get; set; }
|
public string? addid { get; set; }
|
||||||
public string triggertype { get; set; }
|
public string? triggertype { get; set; }
|
||||||
public string content { get; set; }
|
public string? content { get; set; }
|
||||||
public List<CheckPlanTypeInput> checktypes { get; set; }
|
public List<CheckPlanTypeInput>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckPlanTypeInput
|
public class CheckPlanTypeInput
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public List<PlanItemInput> items { get; set; }
|
public List<PlanItemInput>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class PlanItemInput
|
public class PlanItemInput
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public string excontent { get; set; }
|
public string? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public string errorcause { get; set; }
|
public string? errorcause { get; set; }
|
||||||
public string errorlevel { get; set; }
|
public string? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string isexec { get; set; }
|
public string? isexec { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CheckPlansOut
|
public class CheckPlansOut
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public bool hasadd { get; set; }
|
public bool hasadd { get; set; }
|
||||||
public bool hasitem{ get; set; }
|
public bool hasitem{ get; set; }
|
||||||
public string addid { get; set; }
|
public string? addid { get; set; }
|
||||||
public string triggertype { get; set; }
|
public string? triggertype { get; set; }
|
||||||
public string content { get; set; }
|
public string? content { get; set; }
|
||||||
public List<CheckPlanTypeOut> checktypes { get; set; }
|
public List<CheckPlanTypeOut>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckPlanTypeOut
|
public class CheckPlanTypeOut
|
||||||
{
|
{
|
||||||
public string checktypeid { get; set; }
|
public string? checktypeid { get; set; }
|
||||||
public string checktypename { get; set; }
|
public string? checktypename { get; set; }
|
||||||
public List<PlanItemOut> items { get; set; }
|
public List<PlanItemOut>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class PlanItemOut
|
public class PlanItemOut
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string itemdid { get; set; }
|
public string? itemdid { get; set; }
|
||||||
public PlanItemShow setShow { get; set; }
|
public PlanItemShow? setShow { get; set; }
|
||||||
public PlanItemData setData { get; set; }
|
public PlanItemData? setData { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class PlanItemShow
|
public class PlanItemShow
|
||||||
@@ -74,15 +74,15 @@ namespace Tnb.QcMgr.Entities
|
|||||||
}
|
}
|
||||||
public class PlanItemData
|
public class PlanItemData
|
||||||
{
|
{
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public Excontent excontent { get; set; }
|
public Excontent? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public string[] errorcause { get; set; }
|
public string[]? errorcause { get; set; }
|
||||||
public string[] errorlevel { get; set; }
|
public string[]? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
public IsexecP isexec { get; set; }
|
public IsexecP? isexec { get; set; }
|
||||||
}
|
}
|
||||||
public class IsexecP
|
public class IsexecP
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,28 +8,42 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
{
|
{
|
||||||
public class CheckTaskOut
|
public class CheckTaskOut
|
||||||
{
|
{
|
||||||
public string mainid { get; set; }
|
public string? mainid { get; set; }
|
||||||
public string workid { get; set; }
|
public string? workid { get; set; }
|
||||||
public string workname { get; set; }
|
public string? workname { get; set; }
|
||||||
public string wareid { get; set; }
|
public string? wareid { get; set; }
|
||||||
public List<CheckExecTypeOut> checktypes { get; set; }
|
public string? status { get; set; }
|
||||||
|
public List<CheckExecTypeOut>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckExecTypeOut
|
public class CheckExecTypeOut
|
||||||
{
|
{
|
||||||
public string checktypeid { get; set; }
|
public string? checktypeid { get; set; }
|
||||||
public string checktypename { get; set; }
|
public string? checktypename { get; set; }
|
||||||
public List<ExecItemOut> items { get; set; }
|
public List<ExecItemOut>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class ExecItemOut
|
public class ExecItemOut
|
||||||
{
|
{
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string itemdid { get; set; }
|
public string? itemdid { get; set; }
|
||||||
public ExecItemShow setShow { get; set; }
|
public ExecItemShow? setShow { get; set; }
|
||||||
public ExecItemData setData { get; set; }
|
public ExecItemData? setData { get; set; }
|
||||||
|
public PostItemForm? postItemForm { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public class PostItemForm
|
||||||
|
{
|
||||||
|
public string? attachment { get; set; }
|
||||||
|
public string[]? checkbox { get; set; }
|
||||||
|
public string? errorcause { get; set; }
|
||||||
|
public string? errorlevel { get; set; }
|
||||||
|
public int measuredValue { get; set; }
|
||||||
|
public string? radio { get; set; }
|
||||||
|
public string? remark { get; set; }
|
||||||
|
public string? text { get; set; }
|
||||||
|
public string? verdict { get; set; }
|
||||||
|
}
|
||||||
public class ExecItemShow
|
public class ExecItemShow
|
||||||
{
|
{
|
||||||
public bool extype { get; set; }
|
public bool extype { get; set; }
|
||||||
@@ -44,37 +58,37 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
}
|
}
|
||||||
public class ExecItemData
|
public class ExecItemData
|
||||||
{
|
{
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public Excontent excontent { get; set; }
|
public Excontent? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public List<Error> errorcause { get; set; }
|
public List<Error>? errorcause { get; set; }
|
||||||
public List<Error> errorlevel { get; set; }
|
public List<Error>? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
public IsexecE isexec { get; set; }
|
public IsexecE? isexec { get; set; }
|
||||||
}
|
}
|
||||||
public class Excontent
|
public class Excontent
|
||||||
{
|
{
|
||||||
public string excontentType { get; set; }
|
public string? excontentType { get; set; }
|
||||||
public string excontentNum { get; set; }
|
public string? excontentNum { get; set; }
|
||||||
public string amongMaxNum { get; set; }
|
public string? amongMaxNum { get; set; }
|
||||||
public string amongMinNum { get; set; }
|
public string? amongMinNum { get; set; }
|
||||||
public string amongMinUnit { get; set; }
|
public string? amongMinUnit { get; set; }
|
||||||
public string gapValue { get; set; }
|
public string? gapValue { get; set; }
|
||||||
public string greaterThanValue { get; set; }
|
public string? greaterThanValue { get; set; }
|
||||||
public string lessThanValue { get; set; }
|
public string? lessThanValue { get; set; }
|
||||||
public string excontentText { get; set; }
|
public string? excontentText { get; set; }
|
||||||
public List<ExcontentOption> excontentOptions { get; set; }
|
public List<ExcontentOption>? excontentOptions { get; set; }
|
||||||
}
|
}
|
||||||
public class ExcontentOption
|
public class ExcontentOption
|
||||||
{
|
{
|
||||||
public string value { get; set; }
|
public string? value { get; set; }
|
||||||
}
|
}
|
||||||
public class Error
|
public class Error
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
}
|
}
|
||||||
public class IsexecE
|
public class IsexecE
|
||||||
{
|
{
|
||||||
@@ -84,34 +98,34 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
|
|
||||||
public class CheckTaskInput
|
public class CheckTaskInput
|
||||||
{
|
{
|
||||||
public string mainid { get; set; }
|
public string? mainid { get; set; }
|
||||||
public string checknum { get; set; }
|
public string? checknum { get; set; }
|
||||||
public string status { get; set; }
|
public string? status { get; set; }
|
||||||
public string result { get; set; }
|
public string? result { get; set; }
|
||||||
|
|
||||||
public List<CheckExexTypeInput> checktypes { get; set; }
|
public List<CheckExexTypeInput>? checktypes { get; set; }
|
||||||
}
|
}
|
||||||
public class CheckExexTypeInput
|
public class CheckExexTypeInput
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public List<ExecItemInput> items { get; set; }
|
public List<ExecItemInput>? items { get; set; }
|
||||||
}
|
}
|
||||||
public class ExecItemInput
|
public class ExecItemInput
|
||||||
{
|
{
|
||||||
public string itemdid { get; set; }
|
public string? itemdid { get; set; }
|
||||||
|
|
||||||
public string itemid { get; set; }
|
public string? itemid { get; set; }
|
||||||
public string extype { get; set; }
|
public string? extype { get; set; }
|
||||||
public string excontent { get; set; }
|
public string? excontent { get; set; }
|
||||||
public string check { get; set; }
|
public string? check { get; set; }
|
||||||
public string errorcause { get; set; }
|
public string? errorcause { get; set; }
|
||||||
public string errorlevel { get; set; }
|
public string? errorlevel { get; set; }
|
||||||
public string remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
public string isexec { get; set; }
|
public string? isexec { get; set; }
|
||||||
public string customer { get; set; }
|
public string? customer { get; set; }
|
||||||
public string result { get; set; }
|
public string? result { get; set; }
|
||||||
public string postItemForm { get; set; }
|
public string? postItemForm { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ namespace Tnb.QcMgr.Entities.Dto
|
|||||||
{
|
{
|
||||||
public class TriggerPlan
|
public class TriggerPlan
|
||||||
{
|
{
|
||||||
public string id { get; set; }
|
public string? id { get; set; }
|
||||||
public string name { get; set; }
|
public string? name { get; set; }
|
||||||
public string code { get; set; }
|
public string? code { get; set; }
|
||||||
public string type { get; set; }
|
public string? type { get; set; }
|
||||||
public string cycle { get; set; }
|
public string? cycle { get; set; }
|
||||||
public string[] trievent { get; set; }
|
public string[]? trievent { get; set; }
|
||||||
public string[] trieventid { get; set; }
|
public string[]? trieventid { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace Tnb.QcMgr
|
|||||||
{
|
{
|
||||||
CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List<CheckItem>() });
|
CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List<CheckItem>() });
|
||||||
var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First();
|
var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First();
|
||||||
CheckItemOut.items.Add(new CheckItem() { itemid = data.id, name = data.name!, code = data.code! });
|
CheckItemOut.items?.Add(new CheckItem() { itemid = data.id, name = data.name!, code = data.code! });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CheckItemOuts;
|
return CheckItemOuts;
|
||||||
@@ -111,8 +111,8 @@ namespace Tnb.QcMgr
|
|||||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||||
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
||||||
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
|
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
|
||||||
List<QcCheckItemsR> QcCheckItemsRs = null;
|
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||||
List<QcCheckItemsD> QcCheckItemsDs = null;
|
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
||||||
if (QcCheckItemsH != null)
|
if (QcCheckItemsH != null)
|
||||||
{
|
{
|
||||||
QcCheckItemsRs = await db.Queryable<QcCheckItemsR>().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync();
|
QcCheckItemsRs = await db.Queryable<QcCheckItemsR>().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync();
|
||||||
@@ -169,7 +169,7 @@ namespace Tnb.QcMgr
|
|||||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||||
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
||||||
CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items.Add(Item);
|
CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items?.Add(Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ namespace Tnb.QcMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(CheckItemsInput.id))
|
if (!string.IsNullOrEmpty(CheckItemsInput.id))
|
||||||
await Delete(CheckItemsInput.id);
|
await Delete(CheckItemsInput.id);
|
||||||
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
|
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
|
||||||
QcCheckItemsH.name = CheckItemsInput.name;
|
QcCheckItemsH.name = CheckItemsInput.name;
|
||||||
QcCheckItemsH.status = CheckItemsInput.status;
|
QcCheckItemsH.status = CheckItemsInput.status;
|
||||||
@@ -197,32 +197,38 @@ namespace Tnb.QcMgr
|
|||||||
QcCheckItemsH.create_id = _userManager.UserId;
|
QcCheckItemsH.create_id = _userManager.UserId;
|
||||||
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||||
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
||||||
foreach (var checktype in CheckItemsInput.checktypes)
|
if (CheckItemsInput.checktypes != null)
|
||||||
{
|
{
|
||||||
foreach (var item in checktype.items)
|
foreach (var checktype in CheckItemsInput.checktypes)
|
||||||
{
|
{
|
||||||
var QcCheckItemsD = new QcCheckItemsD()
|
if (checktype.items != null)
|
||||||
{
|
{
|
||||||
extype = item.extype,
|
foreach (var item in checktype.items)
|
||||||
excontent = item.excontent,
|
{
|
||||||
check = item.check,
|
var QcCheckItemsD = new QcCheckItemsD()
|
||||||
errorcause = item.errorcause.Replace("\"","").Trim(),
|
{
|
||||||
errorlevel = item.errorlevel.Replace("\"", "").Trim(),
|
extype = item.extype,
|
||||||
remark = item.remark,
|
excontent = item.excontent,
|
||||||
attachment = item.attachment,
|
check = item.check,
|
||||||
isexec = item.isexec,
|
errorcause = item.errorcause?.Replace("\"", "").Trim(),
|
||||||
custom=item.customer
|
errorlevel = item.errorlevel?.Replace("\"", "").Trim(),
|
||||||
};
|
remark = item.remark,
|
||||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
attachment = item.attachment,
|
||||||
var QcCheckItemsR = new QcCheckItemsR()
|
isexec = item.isexec,
|
||||||
{
|
custom = item.customer
|
||||||
itemshid = QcCheckItemsH.id,
|
};
|
||||||
typeid = checktype.id,
|
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||||
itemid = item.itemid,
|
var QcCheckItemsR = new QcCheckItemsR()
|
||||||
itemsdid = QcCheckItemsD.id
|
{
|
||||||
};
|
itemshid = QcCheckItemsH.id,
|
||||||
|
typeid = checktype.id,
|
||||||
|
itemid = item.itemid,
|
||||||
|
itemsdid = QcCheckItemsD.id
|
||||||
|
};
|
||||||
|
|
||||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QcCheckItemsDs.ForEach(p =>
|
QcCheckItemsDs.ForEach(p =>
|
||||||
@@ -237,7 +243,7 @@ namespace Tnb.QcMgr
|
|||||||
await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync();
|
await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync();
|
||||||
await db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await db.Ado.RollbackTranAsync();
|
await db.Ado.RollbackTranAsync();
|
||||||
throw Oops.Oh(ErrorCode.COM1000);
|
throw Oops.Oh(ErrorCode.COM1000);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Tnb.QcMgr
|
|||||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||||
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
||||||
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First().items.Add(Item);
|
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First()?.items?.Add(Item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CheckPlansOut;
|
return CheckPlansOut;
|
||||||
@@ -160,24 +160,30 @@ namespace Tnb.QcMgr
|
|||||||
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
|
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
|
||||||
QcCheckPlanAdd.content = CheckPlanInput.content;
|
QcCheckPlanAdd.content = CheckPlanInput.content;
|
||||||
List<QcCheckPlanD> QcCheckPlanDs = new List<QcCheckPlanD>();
|
List<QcCheckPlanD> QcCheckPlanDs = new List<QcCheckPlanD>();
|
||||||
foreach (var checktype in CheckPlanInput.checktypes)
|
if (CheckPlanInput.checktypes != null)
|
||||||
{
|
{
|
||||||
foreach (var item in checktype.items)
|
foreach (var checktype in CheckPlanInput.checktypes)
|
||||||
{
|
{
|
||||||
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
|
if (checktype.items != null)
|
||||||
QcCheckPlanD.mainid = CheckPlanInput.mainid;
|
{
|
||||||
QcCheckPlanD.typeid = checktype.id;
|
foreach (var item in checktype.items)
|
||||||
QcCheckPlanD.itemid = item.itemid;
|
{
|
||||||
QcCheckPlanD.extype = item.extype;
|
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
|
||||||
QcCheckPlanD.excontent = item.excontent;
|
QcCheckPlanD.mainid = CheckPlanInput.mainid;
|
||||||
QcCheckPlanD.check = item.check;
|
QcCheckPlanD.typeid = checktype.id;
|
||||||
QcCheckPlanD.errorcause = item.errorcause.Replace("\"", "").Trim();
|
QcCheckPlanD.itemid = item.itemid;
|
||||||
QcCheckPlanD.errorlevel = item.errorlevel.Replace("\"", "").Trim();
|
QcCheckPlanD.extype = item.extype;
|
||||||
QcCheckPlanD.remark = item.remark;
|
QcCheckPlanD.excontent = item.excontent;
|
||||||
QcCheckPlanD.attachment = item.attachment;
|
QcCheckPlanD.check = item.check;
|
||||||
QcCheckPlanD.isexec = item.isexec;
|
QcCheckPlanD.errorcause = item.errorcause?.Replace("\"", "").Trim();
|
||||||
QcCheckPlanD.custom = item.customer;
|
QcCheckPlanD.errorlevel = item.errorlevel?.Replace("\"", "").Trim();
|
||||||
QcCheckPlanDs.Add(QcCheckPlanD);
|
QcCheckPlanD.remark = item.remark;
|
||||||
|
QcCheckPlanD.attachment = item.attachment;
|
||||||
|
QcCheckPlanD.isexec = item.isexec;
|
||||||
|
QcCheckPlanD.custom = item.customer;
|
||||||
|
QcCheckPlanDs.Add(QcCheckPlanD);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
@@ -185,7 +191,7 @@ namespace Tnb.QcMgr
|
|||||||
await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync();
|
await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync();
|
||||||
await db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await db.Ado.RollbackTranAsync();
|
await db.Ado.RollbackTranAsync();
|
||||||
throw Oops.Oh(ErrorCode.COM1000);
|
throw Oops.Oh(ErrorCode.COM1000);
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ namespace Tnb.QcMgr
|
|||||||
CheckTaskOut.mainid = id;
|
CheckTaskOut.mainid = id;
|
||||||
CheckTaskOut.wareid = QcCheckExecH.wareid!;
|
CheckTaskOut.wareid = QcCheckExecH.wareid!;
|
||||||
CheckTaskOut.workid = QcCheckExecH.workid!;
|
CheckTaskOut.workid = QcCheckExecH.workid!;
|
||||||
|
CheckTaskOut.status = QcCheckExecH.status!;
|
||||||
if (!string.IsNullOrEmpty(CheckTaskOut.workid))
|
if (!string.IsNullOrEmpty(CheckTaskOut.workid))
|
||||||
CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
|
CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
|
||||||
CheckTaskOut.checktypes = new List<CheckExecTypeOut>();
|
CheckTaskOut.checktypes = new List<CheckExecTypeOut>();
|
||||||
@@ -130,13 +131,15 @@ namespace Tnb.QcMgr
|
|||||||
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
||||||
Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent);
|
Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent);
|
||||||
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
||||||
Item.setShow.errorcause = Item.setData.errorcause.Count == 0 ? false : true;
|
Item.setShow.errorcause = Item.setData.errorcause?.Count == 0 ? false : true;
|
||||||
Item.setShow.errorlevel = Item.setData.errorlevel.Count == 0 ? false : true;
|
Item.setShow.errorlevel = Item.setData.errorlevel?.Count == 0 ? false : true;
|
||||||
Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
||||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||||
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
||||||
CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).First().items.Add(Item);
|
if(!string.IsNullOrEmpty(QcCheckExecD.postdata))
|
||||||
|
Item.postItemForm= JSON.Deserialize<PostItemForm>(QcCheckExecD.postdata!);
|
||||||
|
CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).First()?.items?.Add(Item);
|
||||||
}
|
}
|
||||||
return CheckTaskOut;
|
return CheckTaskOut;
|
||||||
}
|
}
|
||||||
@@ -159,23 +162,29 @@ namespace Tnb.QcMgr
|
|||||||
QcCheckExecH.execuser = _userManager.UserId;
|
QcCheckExecH.execuser = _userManager.UserId;
|
||||||
QcCheckExecH.exectime = DateTime.Now.ToString();
|
QcCheckExecH.exectime = DateTime.Now.ToString();
|
||||||
var QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync();
|
var QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync();
|
||||||
foreach (var checktype in CheckTaskInput.checktypes)
|
if (CheckTaskInput.checktypes != null)
|
||||||
{
|
{
|
||||||
foreach (var item in checktype.items)
|
foreach (var checktype in CheckTaskInput.checktypes)
|
||||||
{
|
{
|
||||||
var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
if (checktype.items != null)
|
||||||
if (QcCheckExecD == null)
|
{
|
||||||
continue;
|
foreach (var item in checktype.items)
|
||||||
QcCheckExecD.excontent = item.excontent;
|
{
|
||||||
QcCheckExecD.check = item.check;
|
var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
||||||
QcCheckExecD.errorcause = item.errorcause;
|
if (QcCheckExecD == null)
|
||||||
QcCheckExecD.errorlevel = item.errorlevel;
|
continue;
|
||||||
QcCheckExecD.remark = item.remark;
|
QcCheckExecD.excontent = item.excontent;
|
||||||
QcCheckExecD.attachment = item.attachment;
|
QcCheckExecD.check = item.check;
|
||||||
QcCheckExecD.isexec = item.isexec;
|
QcCheckExecD.errorcause = item.errorcause;
|
||||||
QcCheckExecD.custom = item.customer;
|
QcCheckExecD.errorlevel = item.errorlevel;
|
||||||
QcCheckExecD.result = item.result;
|
QcCheckExecD.remark = item.remark;
|
||||||
QcCheckExecD.postdata = item.postItemForm;
|
QcCheckExecD.attachment = item.attachment;
|
||||||
|
QcCheckExecD.isexec = item.isexec;
|
||||||
|
QcCheckExecD.custom = item.customer;
|
||||||
|
QcCheckExecD.result = item.result;
|
||||||
|
QcCheckExecD.postdata = item.postItemForm;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
@@ -183,7 +192,7 @@ namespace Tnb.QcMgr
|
|||||||
await db.Updateable(QcCheckExecDs).ExecuteCommandAsync();
|
await db.Updateable(QcCheckExecDs).ExecuteCommandAsync();
|
||||||
await db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
||||||
throw Oops.Oh(ErrorCode.COM1000);
|
throw Oops.Oh(ErrorCode.COM1000);
|
||||||
|
|||||||
@@ -94,9 +94,4 @@ public partial class WmsHandleCode : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? modify_time { get; set; }
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 行号
|
|
||||||
/// </summary>
|
|
||||||
public int no { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,9 +166,8 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? mo_bom_detail_id { get; set; }
|
public string? mo_bom_detail_id { get; set; }
|
||||||
|
|
||||||
public void Create()
|
public void Create(string orgId)
|
||||||
{
|
{
|
||||||
var orgId = App.User?.FindFirst(ClaimConst.CLAINMORGID)?.Value;
|
|
||||||
if (!string.IsNullOrEmpty(orgId))
|
if (!string.IsNullOrEmpty(orgId))
|
||||||
{
|
{
|
||||||
this.org_id = orgId;
|
this.org_id = orgId;
|
||||||
|
|||||||
97
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutbale.cs
Normal file
97
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutbale.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 寄存出库
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("wms_outbale")]
|
||||||
|
public partial class WmsOutbale : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public WmsOutbale()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 目标库位ID
|
||||||
|
/// </summary>
|
||||||
|
public string? location_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单号
|
||||||
|
/// </summary>
|
||||||
|
public string? bill_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据状态
|
||||||
|
/// </summary>
|
||||||
|
public string? status { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 业务类型
|
||||||
|
/// </summary>
|
||||||
|
public string? biz_type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具ID
|
||||||
|
/// </summary>
|
||||||
|
public string? carry_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具编号
|
||||||
|
/// </summary>
|
||||||
|
public string? carry_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打包号
|
||||||
|
/// </summary>
|
||||||
|
public string? bale_num { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展
|
||||||
|
/// </summary>
|
||||||
|
public string? extras { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳(用于并发控制)
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? timestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程任务Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowtaskid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程引擎Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -64,28 +64,30 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : "";
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||||
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
|
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
|
||||||
WmsCarryD wmsCarryD = new()
|
|
||||||
{
|
|
||||||
id = SnowflakeIdHelper.NextId(),
|
|
||||||
carry_id = carry.id,
|
|
||||||
org_id = carry?.org_id!,
|
|
||||||
membercarry_id = subCarry.id,
|
|
||||||
membercarry_code = subCarry.carry_code,
|
|
||||||
loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1),
|
|
||||||
create_id = _userManager.UserId,
|
|
||||||
create_time = DateTime.Now
|
|
||||||
};
|
|
||||||
//WmsCarrybindH wmsCarrybindH = carry?.Adapt<WmsCarrybindH>()!;
|
//WmsCarrybindH wmsCarrybindH = carry?.Adapt<WmsCarrybindH>()!;
|
||||||
if (carry != null && subCarry != null)
|
if (carry != null && subCarry != null)
|
||||||
{
|
{
|
||||||
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
|
||||||
carry.carry_status = "1";
|
carry.carry_status = "1";
|
||||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
var row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
subCarry.carry_status = "1";
|
subCarry.carry_status = "1";
|
||||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
|
WmsCarryD wmsCarryD = new()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
carry_id = carry.id,
|
||||||
|
org_id = carry?.org_id!,
|
||||||
|
membercarry_id = subCarry.id,
|
||||||
|
membercarry_code = subCarry.carry_code,
|
||||||
|
loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1),
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
|
};
|
||||||
|
row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
||||||
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||||
for (int i = 0; i < items.Count; i++)
|
for (int i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : "";
|
||||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||||
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||||
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
@@ -17,221 +18,144 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Entities.Enums;
|
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库申请业务类
|
/// 寄存出库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
|
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTBALE_ID)]
|
||||||
public class WmsOutBaleService : BaseWareHouseService, IWmsOutStockService
|
[ServiceModule(BizTypeId)]
|
||||||
|
public class WmsOutBaleService : BaseWareHouseService
|
||||||
{
|
{
|
||||||
|
private const string BizTypeId = "26191525396517";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
private readonly IWareHouseService _wareHouseService;
|
private readonly IWareHouseService _wareHouseService;
|
||||||
private readonly IUserManager _userManager;
|
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
public WmsOutBaleService(
|
public WmsOutBaleService(
|
||||||
ISqlSugarRepository<WmsOutstockD> repository,
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
IDictionaryDataService dictionaryDataService,
|
|
||||||
IRunService runService,
|
IRunService runService,
|
||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IWareHouseService wareHouseService,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IBillRullService billRullService)
|
IBillRullService billRullService)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_dictionaryDataService = dictionaryDataService;
|
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
_wareHouseService = wareHouseService;
|
_wareHouseService = wareHouseService;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
OverideFuncs.CreateAsync = OutStockApplyFor;
|
OverideFuncs.CreateAsync = CarryOutBale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> CarryOutBale(VisualDevModelDataCrInput input)
|
||||||
private async Task<dynamic> OutStockApplyFor(VisualDevModelDataCrInput input)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTSTOCK_ID, true);
|
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTBALE_ID, true);
|
||||||
await _runService.Create(templateEntity, input);
|
await _runService.Create(templateEntity, input);
|
||||||
|
//入库取终点
|
||||||
//判断目标库位是否自动签收
|
//var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 };
|
||||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString());
|
||||||
|
WmsPointH sPoint = null;
|
||||||
var carryIds = new List<string>();
|
WmsPointH ePoint = null;
|
||||||
//tablefield120 出库物料明细
|
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||||
if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
|
|
||||||
{
|
{
|
||||||
var outStockDList = input.data["tablefield120"].ToObject<List<WmsOutstockD>>();
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||||
if (outStockDList?.Count > 0)
|
}
|
||||||
|
if (carry != null)
|
||||||
|
{
|
||||||
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sPoint != null && ePoint != null)
|
||||||
|
{
|
||||||
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||||
|
if (points?.Count > 0)
|
||||||
{
|
{
|
||||||
List<WmsCarryMat> carryMats = new();
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
List<WmsCarryCode> carryCodes = new();
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
foreach (var os in outStockDList)
|
|
||||||
{
|
{
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
var sPoint = it.FirstOrDefault();
|
||||||
.Where((a, b) => b.material_id == os.material_id && b.code_batch == os.code_batch && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用)
|
var ePoint = it.LastOrDefault();
|
||||||
.Select<WmsCarryCode>()
|
|
||||||
.ToListAsync();
|
|
||||||
if (carryCodesPart?.Count > 0)
|
|
||||||
{
|
|
||||||
carryCodes.AddRange(carryCodesPart);
|
|
||||||
var codeQty = carryCodes.Sum(x => x.codeqty);
|
|
||||||
if (codeQty < os.pr_qty)
|
|
||||||
{
|
|
||||||
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
|
|
||||||
}
|
|
||||||
var partCarryMats = carryCodesPart.Adapt<List<WmsCarryMat>>();
|
|
||||||
partCarryMats.ForEach(x =>
|
|
||||||
{
|
|
||||||
x.need_qty = (int)os.pr_qty;
|
|
||||||
x.real_qty = codeQty;
|
|
||||||
});
|
|
||||||
carryMats.AddRange(partCarryMats);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (carryMats.Count > 0)
|
|
||||||
{
|
|
||||||
carryMats.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
|
||||||
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
|
|
||||||
.Select(x =>
|
|
||||||
{
|
|
||||||
WmsCarryMat? carryMat = x.FirstOrDefault()!;
|
|
||||||
carryMat.real_qty = x.Sum(d => d.real_qty);
|
|
||||||
return carryMat;
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
await _db.Insertable(carryMats).ExecuteCommandAsync();
|
|
||||||
var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.real_qty);
|
|
||||||
var allOutIds = new List<string>();
|
|
||||||
var sortingOutIds = new List<string>();
|
|
||||||
foreach (var pair in dic)
|
|
||||||
{
|
|
||||||
var codes = carryCodes.FindAll(x => x.carry_id == pair.Key);
|
|
||||||
if (codes?.Count > 0)
|
|
||||||
{
|
|
||||||
if (pair.Value == codes.Sum(d => d.codeqty))
|
|
||||||
{
|
|
||||||
allOutIds.Add(pair.Key);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sortingOutIds.Add(pair.Key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
carryIds = allOutIds.Concat(sortingOutIds).ToList();
|
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString() }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync();
|
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToListAsync();
|
|
||||||
if (carrys?.Count > 0)
|
|
||||||
{
|
|
||||||
List<WmsPretaskH> preTasks = new();
|
|
||||||
List<string> locIds = new();
|
|
||||||
foreach (var carry in carrys)
|
|
||||||
{
|
|
||||||
WmsPointH sPoint = null;
|
|
||||||
WmsPointH ePoint = null;
|
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
|
||||||
{
|
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
|
||||||
}
|
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)) && input.data[nameof(WmsPointH.location_id)].IsNotEmptyOrNull())
|
|
||||||
{
|
|
||||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
|
||||||
}
|
|
||||||
if (sPoint != null && ePoint != null)
|
|
||||||
{
|
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
|
||||||
locIds.AddRange(points.Select(x => x.location_id).ToList()!);
|
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
|
||||||
if (points?.Count > 0)
|
|
||||||
{
|
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
|
||||||
var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
|
||||||
{
|
|
||||||
var sPoint = it.FirstOrDefault();
|
|
||||||
var ePoint = it.LastOrDefault();
|
|
||||||
|
|
||||||
WmsPretaskH preTask = new();
|
WmsPretaskH preTask = new();
|
||||||
preTask.org_id = _userManager.User.OrganizeId;
|
preTask.org_id = _userManager.User.OrganizeId;
|
||||||
preTask.startlocation_id = sPoint?.location_id;
|
preTask.startlocation_id = sPoint?.location_id;
|
||||||
preTask.startlocation_code = sPoint?.location_code;
|
preTask.startlocation_code = sPoint?.location_code;
|
||||||
preTask.endlocation_id = ePoint?.location_id;
|
preTask.endlocation_id = ePoint?.location_id;
|
||||||
preTask.endlocation_code = ePoint?.location_code;
|
preTask.endlocation_code = ePoint?.location_code;
|
||||||
preTask.start_floor = sPoint?.floor.ToString();
|
preTask.start_floor = sPoint?.floor.ToString();
|
||||||
preTask.end_floor = ePoint?.floor.ToString();
|
preTask.end_floor = ePoint?.floor.ToString();
|
||||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID;
|
||||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||||
preTask.carry_id = carry.id;
|
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||||
preTask.carry_code = carry.carry_code;
|
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||||
preTask.area_id = sPoint?.area_id!;
|
preTask.area_id = sPoint?.area_id;
|
||||||
preTask.area_code = it.Key;
|
preTask.area_code = it.Key;
|
||||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
||||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||||
preTask.create_id = _userManager.UserId;
|
preTask.create_id = _userManager.UserId;
|
||||||
preTask.create_time = DateTime.Now;
|
preTask.create_time = DateTime.Now;
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
if (loc.is_sign == 0)
|
//判断目标库位是否自动签收
|
||||||
{
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||||
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
if (loc.is_sign == 0)
|
||||||
}
|
{
|
||||||
preTasks.AddRange(curPreTasks);
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
|
}
|
||||||
|
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
|
var preTaskUpInput = new GenPreTaskUpInput();
|
||||||
|
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
||||||
|
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||||
|
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||||
|
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||||
|
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||||
|
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||||
|
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||||
|
//根据载具移出Id,回更单据状态
|
||||||
|
await _db.Updateable<WmsOutbale>().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { is_lock = 1 },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else throw new AppFriendlyException($"请输入物料明细", 500);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
/// <summary>
|
|
||||||
/// 根据出库申请单ID获取申请单明细信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="billId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<dynamic> GetInStockDetailsListById([FromRoute] string billId)
|
|
||||||
{
|
{
|
||||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
var items = await _db.Queryable<WmsOutstockD>().Where(it => it.bill_id == billId).ToListAsync();
|
var isOk = await _db.Updateable<WmsOutbale>().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||||
_db.ThenMapper(items,
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using JNPF.VisualDev;
|
|||||||
using JNPF.VisualDev.Entitys;
|
using JNPF.VisualDev.Entitys;
|
||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NPOI.OpenXmlFormats.Vml;
|
using NPOI.OpenXmlFormats.Vml;
|
||||||
@@ -233,8 +234,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var orgId= _userManager.User.OrganizeId;
|
||||||
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||||
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create()).ExecuteCommandAsync();
|
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
it => new BasLocation { is_lock = 1, is_use = "1" });
|
it => new BasLocation { is_lock = 1, is_use = "1" });
|
||||||
|
|||||||
Reference in New Issue
Block a user