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? version { get; set; }
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int quantity { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺路线名称
|
||||
/// </summary>
|
||||
public string? route_id { get; set; }
|
||||
|
||||
@@ -45,12 +45,11 @@ namespace Tnb.BasicData.Entities.Dto
|
||||
/// </summary>
|
||||
public string? loss_rate {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:数量
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? quantity {get;set;}
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:需要称量
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class BasEbomD : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string? quantity { get; set; }
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 损耗率
|
||||
|
||||
@@ -32,7 +32,7 @@ public partial class BasEbomH : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string? quantity { get; set; }
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位id
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Tnb.BasicData
|
||||
material_id_id = b.id,
|
||||
status = SqlFunc.IIF(a.status == "0", "禁用", "启用"),
|
||||
descrip = a.descrip,
|
||||
quantity = a.quantity,
|
||||
version = a.version,
|
||||
route_id = c.name,
|
||||
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();
|
||||
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>
|
||||
@@ -189,12 +239,13 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
(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
|
||||
.LeftJoin<ToolMoldsMaterial>((a, b) => a.material_id == b.material_id)
|
||||
.LeftJoin<ToolMolds>((a,b,c)=>b.mold_id==c.id)
|
||||
.Where((a, b,c) => input.WorkOrderIds.Contains(a.id))
|
||||
.Select((a, b,c) => new
|
||||
{
|
||||
planDate = a.plan_start_date,
|
||||
mold_code = b.mold_code,
|
||||
mold_code = c.mold_code,
|
||||
}).ToListAsync();
|
||||
var planDateAll = true;
|
||||
var moldIdAll = true;
|
||||
@@ -203,8 +254,8 @@ namespace Tnb.ProductionMgr
|
||||
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);
|
||||
planDateAll = list.All(x => x.planDate == planDate);
|
||||
moldIdAll = moldCode != null && list.All(x => x.mold_code == moldCode);
|
||||
if (planDateAll && moldIdAll)
|
||||
{
|
||||
var groupId = SnowflakeIdHelper.NextId();
|
||||
@@ -218,11 +269,11 @@ namespace Tnb.ProductionMgr
|
||||
multi.executeRes = false;
|
||||
if (!planDateAll)
|
||||
{
|
||||
throw new AppFriendlyException("计划开始日期不一致", null);
|
||||
throw Oops.Bah("计划开始日期不一致");
|
||||
}
|
||||
if (!moldIdAll)
|
||||
{
|
||||
throw new AppFriendlyException("未关联到同一模具下", null);
|
||||
throw Oops.Bah("未关联到同一模具下");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +426,7 @@ namespace Tnb.ProductionMgr
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(MoModuleId, true);
|
||||
// var data = await _runService.GetListResult(templateEntity, input);
|
||||
//
|
||||
//
|
||||
// if (data?.list?.Count > 0)
|
||||
// {
|
||||
// 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(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode))
|
||||
.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,
|
||||
mo_id = a.id,
|
||||
@@ -557,13 +558,50 @@ namespace Tnb.ProductionMgr
|
||||
scheduled_qty = a.scheduled_qty.Value.ToString(),
|
||||
parent_id = "0",
|
||||
id = a.id,
|
||||
hasChildren = false,
|
||||
num = 0,
|
||||
isLeaf = true,
|
||||
hasChildren = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Any(),
|
||||
num = SqlFunc.Subqueryable<PrdMo>().Where(x=>x.parent_id==a.id).Count(),
|
||||
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);
|
||||
|
||||
|
||||
return PageResult<PrdMoTreeOutput>.SqlSugarPageResult(result);
|
||||
return PageResult<PrdMoListTreeOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
public class CheckItemOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<CheckItem> items { get; set; }
|
||||
public string? checktypeid { get; set; }
|
||||
public string? checktypename { get; set; }
|
||||
public List<CheckItem>? items { get; set; }
|
||||
}
|
||||
public class CheckItem
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? code { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,54 +8,54 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class CheckItemsInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<CheckTypeInput> checktypes { get; set; }
|
||||
public string? id { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? status { get; set; }
|
||||
public List<CheckTypeInput>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckTypeInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<ItemInput> items { get; set; }
|
||||
public string? id { get; set; }
|
||||
public List<ItemInput>? items { get; set; }
|
||||
}
|
||||
public class ItemInput
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? itemdid { get; set; }
|
||||
|
||||
public string extype { get; set; }
|
||||
public string excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public string errorcause { get; set; }
|
||||
public string errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string isexec { get; set; }
|
||||
public string customer { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public string? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public string? errorcause { get; set; }
|
||||
public string? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? isexec { get; set; }
|
||||
public string? customer { get; set; }
|
||||
}
|
||||
public class CheckItemsOut
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<CheckTypeOut> checktypes { get; set; }
|
||||
public string? id { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? status { get; set; }
|
||||
public List<CheckTypeOut>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckTypeOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<ItemOut> items { get; set; }
|
||||
public string? checktypeid { get; set; }
|
||||
public string? checktypename { get; set; }
|
||||
public List<ItemOut>? items { get; set; }
|
||||
}
|
||||
public class ItemOut
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public Show setShow { get; set; }
|
||||
public Data setData { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? itemdid { get; set; }
|
||||
public Show? setShow { get; set; }
|
||||
public Data? setData { get; set; }
|
||||
|
||||
}
|
||||
public class Show {
|
||||
@@ -70,15 +70,15 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
public bool isexec { get; set; }
|
||||
}
|
||||
public class Data {
|
||||
public string extype { get; set; }
|
||||
public Excontent excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public string[] errorcause { get; set; }
|
||||
public string[] errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string customer { get; set; }
|
||||
public Isexec isexec { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public Excontent? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public string[]? errorcause { get; set; }
|
||||
public string[]? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? customer { get; set; }
|
||||
public Isexec? isexec { get; set; }
|
||||
}
|
||||
public class Isexec
|
||||
{
|
||||
|
||||
@@ -9,55 +9,55 @@ namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
public class CheckPlanInput
|
||||
{
|
||||
public string mainid { get; set; }
|
||||
public string addid { get; set; }
|
||||
public string triggertype { get; set; }
|
||||
public string content { get; set; }
|
||||
public List<CheckPlanTypeInput> checktypes { get; set; }
|
||||
public string? mainid { get; set; }
|
||||
public string? addid { get; set; }
|
||||
public string? triggertype { get; set; }
|
||||
public string? content { get; set; }
|
||||
public List<CheckPlanTypeInput>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<PlanItemInput> items { get; set; }
|
||||
public string? id { get; set; }
|
||||
public List<PlanItemInput>? items { get; set; }
|
||||
}
|
||||
public class PlanItemInput
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string extype { get; set; }
|
||||
public string excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public string errorcause { get; set; }
|
||||
public string errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string isexec { get; set; }
|
||||
public string customer { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public string? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public string? errorcause { get; set; }
|
||||
public string? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? isexec { get; set; }
|
||||
public string? customer { get; set; }
|
||||
}
|
||||
|
||||
public class CheckPlansOut
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string? id { get; set; }
|
||||
public bool hasadd { get; set; }
|
||||
public bool hasitem{ get; set; }
|
||||
public string addid { get; set; }
|
||||
public string triggertype { get; set; }
|
||||
public string content { get; set; }
|
||||
public List<CheckPlanTypeOut> checktypes { get; set; }
|
||||
public string? addid { get; set; }
|
||||
public string? triggertype { get; set; }
|
||||
public string? content { get; set; }
|
||||
public List<CheckPlanTypeOut>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<PlanItemOut> items { get; set; }
|
||||
public string? checktypeid { get; set; }
|
||||
public string? checktypename { get; set; }
|
||||
public List<PlanItemOut>? items { get; set; }
|
||||
}
|
||||
public class PlanItemOut
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public PlanItemShow setShow { get; set; }
|
||||
public PlanItemData setData { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? itemdid { get; set; }
|
||||
public PlanItemShow? setShow { get; set; }
|
||||
public PlanItemData? setData { get; set; }
|
||||
|
||||
}
|
||||
public class PlanItemShow
|
||||
@@ -74,15 +74,15 @@ namespace Tnb.QcMgr.Entities
|
||||
}
|
||||
public class PlanItemData
|
||||
{
|
||||
public string extype { get; set; }
|
||||
public Excontent excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public string[] errorcause { get; set; }
|
||||
public string[] errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string customer { get; set; }
|
||||
public IsexecP isexec { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public Excontent? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public string[]? errorcause { get; set; }
|
||||
public string[]? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? customer { get; set; }
|
||||
public IsexecP? isexec { get; set; }
|
||||
}
|
||||
public class IsexecP
|
||||
{
|
||||
|
||||
@@ -8,28 +8,42 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class CheckTaskOut
|
||||
{
|
||||
public string mainid { get; set; }
|
||||
public string workid { get; set; }
|
||||
public string workname { get; set; }
|
||||
public string wareid { get; set; }
|
||||
public List<CheckExecTypeOut> checktypes { get; set; }
|
||||
public string? mainid { get; set; }
|
||||
public string? workid { get; set; }
|
||||
public string? workname { get; set; }
|
||||
public string? wareid { get; set; }
|
||||
public string? status { get; set; }
|
||||
public List<CheckExecTypeOut>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckExecTypeOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<ExecItemOut> items { get; set; }
|
||||
public string? checktypeid { get; set; }
|
||||
public string? checktypename { get; set; }
|
||||
public List<ExecItemOut>? items { get; set; }
|
||||
}
|
||||
public class ExecItemOut
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public ExecItemShow setShow { get; set; }
|
||||
public ExecItemData setData { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? itemdid { get; set; }
|
||||
public ExecItemShow? setShow { 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 bool extype { get; set; }
|
||||
@@ -44,37 +58,37 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
}
|
||||
public class ExecItemData
|
||||
{
|
||||
public string extype { get; set; }
|
||||
public Excontent excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public List<Error> errorcause { get; set; }
|
||||
public List<Error> errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string customer { get; set; }
|
||||
public IsexecE isexec { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public Excontent? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public List<Error>? errorcause { get; set; }
|
||||
public List<Error>? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? customer { get; set; }
|
||||
public IsexecE? isexec { get; set; }
|
||||
}
|
||||
public class Excontent
|
||||
{
|
||||
public string excontentType { get; set; }
|
||||
public string excontentNum { get; set; }
|
||||
public string amongMaxNum { get; set; }
|
||||
public string amongMinNum { get; set; }
|
||||
public string amongMinUnit { get; set; }
|
||||
public string gapValue { get; set; }
|
||||
public string greaterThanValue { get; set; }
|
||||
public string lessThanValue { get; set; }
|
||||
public string excontentText { get; set; }
|
||||
public List<ExcontentOption> excontentOptions { get; set; }
|
||||
public string? excontentType { get; set; }
|
||||
public string? excontentNum { get; set; }
|
||||
public string? amongMaxNum { get; set; }
|
||||
public string? amongMinNum { get; set; }
|
||||
public string? amongMinUnit { get; set; }
|
||||
public string? gapValue { get; set; }
|
||||
public string? greaterThanValue { get; set; }
|
||||
public string? lessThanValue { get; set; }
|
||||
public string? excontentText { get; set; }
|
||||
public List<ExcontentOption>? excontentOptions { get; set; }
|
||||
}
|
||||
public class ExcontentOption
|
||||
{
|
||||
public string value { get; set; }
|
||||
public string? value { get; set; }
|
||||
}
|
||||
public class Error
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string? id { get; set; }
|
||||
public string? name { get; set; }
|
||||
}
|
||||
public class IsexecE
|
||||
{
|
||||
@@ -84,34 +98,34 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
|
||||
public class CheckTaskInput
|
||||
{
|
||||
public string mainid { get; set; }
|
||||
public string checknum { get; set; }
|
||||
public string status { get; set; }
|
||||
public string result { get; set; }
|
||||
public string? mainid { get; set; }
|
||||
public string? checknum { get; set; }
|
||||
public string? status { get; set; }
|
||||
public string? result { get; set; }
|
||||
|
||||
public List<CheckExexTypeInput> checktypes { get; set; }
|
||||
public List<CheckExexTypeInput>? checktypes { get; set; }
|
||||
}
|
||||
public class CheckExexTypeInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<ExecItemInput> items { get; set; }
|
||||
public string? id { get; set; }
|
||||
public List<ExecItemInput>? items { get; set; }
|
||||
}
|
||||
public class ExecItemInput
|
||||
{
|
||||
public string itemdid { get; set; }
|
||||
public string? itemdid { get; set; }
|
||||
|
||||
public string itemid { get; set; }
|
||||
public string extype { get; set; }
|
||||
public string excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
public string errorcause { get; set; }
|
||||
public string errorlevel { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string isexec { get; set; }
|
||||
public string customer { get; set; }
|
||||
public string result { get; set; }
|
||||
public string postItemForm { get; set; }
|
||||
public string? itemid { get; set; }
|
||||
public string? extype { get; set; }
|
||||
public string? excontent { get; set; }
|
||||
public string? check { get; set; }
|
||||
public string? errorcause { get; set; }
|
||||
public string? errorlevel { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? attachment { get; set; }
|
||||
public string? isexec { get; set; }
|
||||
public string? customer { get; set; }
|
||||
public string? result { get; set; }
|
||||
public string? postItemForm { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class TriggerPlan
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string type { get; set; }
|
||||
public string cycle { get; set; }
|
||||
public string[] trievent { get; set; }
|
||||
public string[] trieventid { get; set; }
|
||||
public string? id { get; set; }
|
||||
public string? name { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? type { get; set; }
|
||||
public string? cycle { get; set; }
|
||||
public string[]? trievent { 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>() });
|
||||
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;
|
||||
@@ -111,8 +111,8 @@ namespace Tnb.QcMgr
|
||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
||||
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
|
||||
List<QcCheckItemsR> QcCheckItemsRs = null;
|
||||
List<QcCheckItemsD> QcCheckItemsDs = null;
|
||||
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
||||
if (QcCheckItemsH != null)
|
||||
{
|
||||
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.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CheckItemsInput.id))
|
||||
await Delete(CheckItemsInput.id);
|
||||
await Delete(CheckItemsInput.id);
|
||||
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
|
||||
QcCheckItemsH.name = CheckItemsInput.name;
|
||||
QcCheckItemsH.status = CheckItemsInput.status;
|
||||
@@ -197,32 +197,38 @@ namespace Tnb.QcMgr
|
||||
QcCheckItemsH.create_id = _userManager.UserId;
|
||||
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||
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,
|
||||
excontent = item.excontent,
|
||||
check = item.check,
|
||||
errorcause = item.errorcause.Replace("\"","").Trim(),
|
||||
errorlevel = item.errorlevel.Replace("\"", "").Trim(),
|
||||
remark = item.remark,
|
||||
attachment = item.attachment,
|
||||
isexec = item.isexec,
|
||||
custom=item.customer
|
||||
};
|
||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||
var QcCheckItemsR = new QcCheckItemsR()
|
||||
{
|
||||
itemshid = QcCheckItemsH.id,
|
||||
typeid = checktype.id,
|
||||
itemid = item.itemid,
|
||||
itemsdid = QcCheckItemsD.id
|
||||
};
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
var QcCheckItemsD = new QcCheckItemsD()
|
||||
{
|
||||
extype = item.extype,
|
||||
excontent = item.excontent,
|
||||
check = item.check,
|
||||
errorcause = item.errorcause?.Replace("\"", "").Trim(),
|
||||
errorlevel = item.errorlevel?.Replace("\"", "").Trim(),
|
||||
remark = item.remark,
|
||||
attachment = item.attachment,
|
||||
isexec = item.isexec,
|
||||
custom = item.customer
|
||||
};
|
||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||
var QcCheckItemsR = new QcCheckItemsR()
|
||||
{
|
||||
itemshid = QcCheckItemsH.id,
|
||||
typeid = checktype.id,
|
||||
itemid = item.itemid,
|
||||
itemsdid = QcCheckItemsD.id
|
||||
};
|
||||
|
||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QcCheckItemsDs.ForEach(p =>
|
||||
@@ -237,7 +243,7 @@ namespace Tnb.QcMgr
|
||||
await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await db.Ado.RollbackTranAsync();
|
||||
throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Tnb.QcMgr
|
||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
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;
|
||||
@@ -160,24 +160,30 @@ namespace Tnb.QcMgr
|
||||
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
|
||||
QcCheckPlanAdd.content = CheckPlanInput.content;
|
||||
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();
|
||||
QcCheckPlanD.mainid = CheckPlanInput.mainid;
|
||||
QcCheckPlanD.typeid = checktype.id;
|
||||
QcCheckPlanD.itemid = item.itemid;
|
||||
QcCheckPlanD.extype = item.extype;
|
||||
QcCheckPlanD.excontent = item.excontent;
|
||||
QcCheckPlanD.check = item.check;
|
||||
QcCheckPlanD.errorcause = item.errorcause.Replace("\"", "").Trim();
|
||||
QcCheckPlanD.errorlevel = item.errorlevel.Replace("\"", "").Trim();
|
||||
QcCheckPlanD.remark = item.remark;
|
||||
QcCheckPlanD.attachment = item.attachment;
|
||||
QcCheckPlanD.isexec = item.isexec;
|
||||
QcCheckPlanD.custom = item.customer;
|
||||
QcCheckPlanDs.Add(QcCheckPlanD);
|
||||
if (checktype.items != null)
|
||||
{
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
|
||||
QcCheckPlanD.mainid = CheckPlanInput.mainid;
|
||||
QcCheckPlanD.typeid = checktype.id;
|
||||
QcCheckPlanD.itemid = item.itemid;
|
||||
QcCheckPlanD.extype = item.extype;
|
||||
QcCheckPlanD.excontent = item.excontent;
|
||||
QcCheckPlanD.check = item.check;
|
||||
QcCheckPlanD.errorcause = item.errorcause?.Replace("\"", "").Trim();
|
||||
QcCheckPlanD.errorlevel = item.errorlevel?.Replace("\"", "").Trim();
|
||||
QcCheckPlanD.remark = item.remark;
|
||||
QcCheckPlanD.attachment = item.attachment;
|
||||
QcCheckPlanD.isexec = item.isexec;
|
||||
QcCheckPlanD.custom = item.customer;
|
||||
QcCheckPlanDs.Add(QcCheckPlanD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await db.Ado.BeginTranAsync();
|
||||
@@ -185,7 +191,7 @@ namespace Tnb.QcMgr
|
||||
await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await db.Ado.RollbackTranAsync();
|
||||
throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace Tnb.QcMgr
|
||||
CheckTaskOut.mainid = id;
|
||||
CheckTaskOut.wareid = QcCheckExecH.wareid!;
|
||||
CheckTaskOut.workid = QcCheckExecH.workid!;
|
||||
CheckTaskOut.status = QcCheckExecH.status!;
|
||||
if (!string.IsNullOrEmpty(CheckTaskOut.workid))
|
||||
CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
|
||||
CheckTaskOut.checktypes = new List<CheckExecTypeOut>();
|
||||
@@ -130,13 +131,15 @@ namespace Tnb.QcMgr
|
||||
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
||||
Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent);
|
||||
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
||||
Item.setShow.errorcause = Item.setData.errorcause.Count == 0 ? false : true;
|
||||
Item.setShow.errorlevel = Item.setData.errorlevel.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.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
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;
|
||||
}
|
||||
@@ -159,23 +162,29 @@ namespace Tnb.QcMgr
|
||||
QcCheckExecH.execuser = _userManager.UserId;
|
||||
QcCheckExecH.exectime = DateTime.Now.ToString();
|
||||
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 (QcCheckExecD == null)
|
||||
continue;
|
||||
QcCheckExecD.excontent = item.excontent;
|
||||
QcCheckExecD.check = item.check;
|
||||
QcCheckExecD.errorcause = item.errorcause;
|
||||
QcCheckExecD.errorlevel = item.errorlevel;
|
||||
QcCheckExecD.remark = item.remark;
|
||||
QcCheckExecD.attachment = item.attachment;
|
||||
QcCheckExecD.isexec = item.isexec;
|
||||
QcCheckExecD.custom = item.customer;
|
||||
QcCheckExecD.result = item.result;
|
||||
QcCheckExecD.postdata = item.postItemForm;
|
||||
if (checktype.items != null)
|
||||
{
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
||||
if (QcCheckExecD == null)
|
||||
continue;
|
||||
QcCheckExecD.excontent = item.excontent;
|
||||
QcCheckExecD.check = item.check;
|
||||
QcCheckExecD.errorcause = item.errorcause;
|
||||
QcCheckExecD.errorlevel = item.errorlevel;
|
||||
QcCheckExecD.remark = item.remark;
|
||||
QcCheckExecD.attachment = item.attachment;
|
||||
QcCheckExecD.isexec = item.isexec;
|
||||
QcCheckExecD.custom = item.customer;
|
||||
QcCheckExecD.result = item.result;
|
||||
QcCheckExecD.postdata = item.postItemForm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await db.Ado.BeginTranAsync();
|
||||
@@ -183,7 +192,7 @@ namespace Tnb.QcMgr
|
||||
await db.Updateable(QcCheckExecDs).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
@@ -94,9 +94,4 @@ public partial class WmsHandleCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int no { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -166,9 +166,8 @@ public partial class WmsInstockCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
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))
|
||||
{
|
||||
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));
|
||||
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 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>()!;
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
||||
|
||||
carry.carry_status = "1";
|
||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
var row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||
subCarry.carry_status = "1";
|
||||
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();
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
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 subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
@@ -17,221 +18,144 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 出库申请业务类
|
||||
/// 寄存出库
|
||||
/// </summary>
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
|
||||
public class WmsOutBaleService : BaseWareHouseService, IWmsOutStockService
|
||||
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTBALE_ID)]
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsOutBaleService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "26191525396517";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
|
||||
private readonly IUserManager _userManager;
|
||||
public WmsOutBaleService(
|
||||
ISqlSugarRepository<WmsOutstockD> repository,
|
||||
IDictionaryDataService dictionaryDataService,
|
||||
ISqlSugarRepository<WmsCarryH> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService)
|
||||
IWareHouseService wareHouseService,
|
||||
IUserManager userManager,
|
||||
IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
_wareHouseService = wareHouseService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
OverideFuncs.CreateAsync = OutStockApplyFor;
|
||||
OverideFuncs.CreateAsync = CarryOutBale;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> OutStockApplyFor(VisualDevModelDataCrInput input)
|
||||
private async Task<dynamic> CarryOutBale(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
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);
|
||||
|
||||
//判断目标库位是否自动签收
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
|
||||
var carryIds = new List<string>();
|
||||
//tablefield120 出库物料明细
|
||||
if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull())
|
||||
//入库取终点
|
||||
//var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 };
|
||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString());
|
||||
WmsPointH sPoint = null;
|
||||
WmsPointH ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
{
|
||||
var outStockDList = input.data["tablefield120"].ToObject<List<WmsOutstockD>>();
|
||||
if (outStockDList?.Count > 0)
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
}
|
||||
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();
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
foreach (var os in outStockDList)
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.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.占用)
|
||||
.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();
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id;
|
||||
preTask.startlocation_code = sPoint?.location_code;
|
||||
preTask.endlocation_id = ePoint?.location_id;
|
||||
preTask.endlocation_code = ePoint?.location_code;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carry.id;
|
||||
preTask.carry_code = carry.carry_code;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
if (loc.is_sign == 0)
|
||||
{
|
||||
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
preTasks.AddRange(curPreTasks);
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id;
|
||||
preTask.startlocation_code = sPoint?.location_code;
|
||||
preTask.endlocation_id = ePoint?.location_id;
|
||||
preTask.endlocation_code = ePoint?.location_code;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
||||
preTask.area_id = sPoint?.area_id;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
//判断目标库位是否自动签收
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
if (loc.is_sign == 0)
|
||||
{
|
||||
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();
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据出库申请单ID获取申请单明细信息
|
||||
/// </summary>
|
||||
/// <param name="billId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetInStockDetailsListById([FromRoute] string billId)
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
||||
var items = await _db.Queryable<WmsOutstockD>().Where(it => it.bill_id == billId).ToListAsync();
|
||||
_db.ThenMapper(items,
|
||||
it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
|
||||
return items;
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsOutbale>().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.OpenXmlFormats.Vml;
|
||||
@@ -233,8 +234,9 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
var orgId= _userManager.User.OrganizeId;
|
||||
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,
|
||||
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" });
|
||||
|
||||
Reference in New Issue
Block a user