1
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
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class WmsCarryD : BaseEntity<string>, IWmsCarryEntity
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
public string loc { get; set; } = string.Empty;
|
||||
public int loc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
|
||||
@@ -161,5 +161,9 @@ public partial class WmsPretaskH : BaseEntity<string>
|
||||
/// 优先级
|
||||
/// </summary>
|
||||
public int is_sign { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// 任务属性
|
||||
/// </summary>
|
||||
public string chain_type { get; set; } = "3";
|
||||
|
||||
}
|
||||
|
||||
@@ -240,19 +240,18 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
x.is_chain = 0;
|
||||
|
||||
x.chain_type = "0";
|
||||
});
|
||||
}
|
||||
else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
|
||||
{
|
||||
items.ForEach(x => x.is_chain = 1);
|
||||
items[0].chain_type = "1";
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
if (i == 0 || i == items.Count - 1) continue;
|
||||
items[i].chain_type = "2";
|
||||
}
|
||||
items[^1].chain_type = "3";
|
||||
//items[0].chain_type = "1";
|
||||
//for (int i = 0; i < items.Count; i++)
|
||||
//{
|
||||
// if (i == 0 || i == items.Count - 1) continue;
|
||||
// items[i].chain_type = "2";
|
||||
//}
|
||||
//items[^1].chain_type = "3";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -288,7 +287,7 @@ namespace Tnb.WarehouseMgr
|
||||
items.ForEach(x =>
|
||||
{
|
||||
x.is_chain = 0;
|
||||
x.chain_type = "0";
|
||||
x.chain_type = "3";
|
||||
});
|
||||
}
|
||||
else if (moveNum > 1)
|
||||
@@ -461,18 +460,10 @@ namespace Tnb.WarehouseMgr
|
||||
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() };
|
||||
upInput.loginType = !_userManager.LoginType.IsNullOrEmpty() ? "app" : "web";
|
||||
if (dt.is_sign == 1) //区分出入库操作
|
||||
if (dt.is_sign == 1 && dt.chain_type == "3")
|
||||
{
|
||||
if (dt.is_chain == 0)
|
||||
{
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
else if (dt.is_chain == 1 && dt.chain_type == "3")
|
||||
{
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
await DoUpdate(upInput);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +486,19 @@ namespace Tnb.WarehouseMgr
|
||||
/// <returns></returns>
|
||||
public async Task<bool> GenPreTask(List<WmsPretaskH> preTasks, List<WmsPretaskCode> preTaskCodes)
|
||||
{
|
||||
var grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList();
|
||||
if (grpList?.Count > 0)
|
||||
{
|
||||
foreach (var grp in grpList)
|
||||
{
|
||||
var arr = grp.ToArray();
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
var subArr = arr[..^1];
|
||||
Array.ForEach(subArr, a => a.chain_type = "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
var row = await _db.Insertable(preTasks).ExecuteCommandAsync();
|
||||
if (preTaskCodes?.Count > 0)
|
||||
{
|
||||
|
||||
@@ -143,8 +143,8 @@ namespace Tnb.WarehouseMgr
|
||||
List<string> locIds = new();
|
||||
foreach (var carry in carrys)
|
||||
{
|
||||
WmsPointH sPoint = null;
|
||||
WmsPointH ePoint = null;
|
||||
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);
|
||||
@@ -168,10 +168,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
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.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();
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Tnb.WarehouseMgr
|
||||
org_id = carry?.org_id!,
|
||||
membercarry_id = subCarry.id,
|
||||
membercarry_code = subCarry.carry_code,
|
||||
loc = input.data[nameof(WmsCarrybindH.loc)]?.ToString()!,
|
||||
loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1),
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user