diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomListOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomListOutput.cs
index 0a0c08a5..d87f9e8c 100644
--- a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomListOutput.cs
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomListOutput.cs
@@ -19,6 +19,10 @@ namespace Tnb.BasicData.Entities.Dto
public string? unit_id { get; set; }
public string? version { get; set; }
///
+ /// 数量
+ ///
+ public int quantity { get; set; }
+ ///
/// 工艺路线名称
///
public string? route_id { get; set; }
diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs
index 1c494894..bbd8639b 100644
--- a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs
+++ b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs
@@ -45,12 +45,11 @@ namespace Tnb.BasicData.Entities.Dto
///
public string? loss_rate {get;set;}
- ///
- /// Desc:数量
- /// Default:NULL::character varying
- /// Nullable:True
///
- public string? quantity {get;set;}
+ ///
+ /// 数量
+ ///
+ public int quantity { get; set; }
///
/// Desc:需要称量
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasEbomD.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasEbomD.cs
index eb68464a..8ab72cc4 100644
--- a/BasicData/Tnb.BasicData.Entities/Entity/BasEbomD.cs
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasEbomD.cs
@@ -37,7 +37,7 @@ public partial class BasEbomD : BaseEntity
///
/// 数量
///
- public string? quantity { get; set; }
+ public int quantity { get; set; }
///
/// 损耗率
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasEbomH.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasEbomH.cs
index 75de569c..f480d120 100644
--- a/BasicData/Tnb.BasicData.Entities/Entity/BasEbomH.cs
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasEbomH.cs
@@ -32,7 +32,7 @@ public partial class BasEbomH : BaseEntity
///
/// 数量
///
- public string? quantity { get; set; }
+ public int quantity { get; set; }
///
/// 单位id
diff --git a/BasicData/Tnb.BasicData/BasEbomService.cs b/BasicData/Tnb.BasicData/BasEbomService.cs
index 363c5878..01679ee6 100644
--- a/BasicData/Tnb.BasicData/BasEbomService.cs
+++ b/BasicData/Tnb.BasicData/BasEbomService.cs
@@ -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,
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs
new file mode 100644
index 00000000..13b260bd
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs
@@ -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 row { get; set; }
+
+ #region 注释代码
+ public string? org_id { get; set; }
+ ///
+ /// 工单id
+ ///
+
+ public string mo_id { get; set; }
+
+ ///
+ /// 工单代码
+ ///
+ public string mo_code { get; set; } = string.Empty;
+
+ ///
+ /// 物料编号
+ ///
+ public string? material_code { get; set; }
+ ///
+ /// 物料名称
+ ///
+ public string material_name { get; set; }
+ ///
+ /// 物料规格型号
+ ///
+ public string material_standard { get; set; }
+
+ ///
+ /// 工单类型:1-正常工单、2-返工工单、3-试制工单
+ ///
+ public string? mo_type { get; set; }
+
+ ///
+ /// 生产状态 Initial: 初始, Confirm:确认 Release: 下发, Open: 生产中, Close: 关单, Pending: 暂停
+ ///
+ public string? mo_status { get; set; }
+
+ ///
+ /// 计划生产数量
+ ///
+ public string plan_qty { get; set; }
+
+ ///
+ /// 已投入数量
+ ///
+ public string input_qty { get; set; }
+
+ ///
+ /// 已完工数量
+ ///
+ public string complete_qty { get; set; }
+
+ ///
+ /// 报废数量
+ ///
+ public string scrap_qty { get; set; }
+
+ ///
+ /// 计划开始时间
+ ///
+ public string plan_start_date { get; set; }
+
+ ///
+ /// 计划结束时间
+ ///
+ public string plan_end_date { get; set; }
+
+ ///
+ /// 是否生派工单
+ ///
+ public string is_create_dispatch { get; set; }
+
+
+ ///
+ /// 产线代码
+ ///
+ public string? production_linecode { get; set; }
+
+ ///
+ /// 是否合并
+ ///
+ public string is_merge { get; set; }
+
+ ///
+ /// 组合工单
+ ///
+ public string? combine_mo_code { get; set; }
+
+ ///
+ /// 时间戳
+ ///
+ public string? time_stamp { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public string create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public string modify_time { get; set; }
+ ///
+ /// 物料ID
+ ///
+ public string? material_id { get; set; }
+ public string? material_id_id { get; set; }
+ ///
+ /// 已排产数量
+ ///
+ public string scheduled_qty { get; set; }
+ ///
+ /// 父工单id
+ ///
+ public string parent_id { get; set; }
+
+ ///
+ /// 获取节点id.
+ ///
+ ///
+ public string id { get; set; }
+
+ ///
+ /// 获取节点父id.
+ ///
+ ///
+ public string parentId { get; set; }
+
+ ///
+ /// 是否有子级.
+ ///
+ public bool hasChildren { get; set; }
+
+ ///
+ /// 设置Children.
+ ///
+ public List? children { get; set; } = new List();
+
+ ///
+ /// 子节点数量.
+ ///
+ public int num { get; set; }
+
+ ///
+ /// 是否为子节点.
+ ///
+ public bool isLeaf { get; set; } = false;
+ #endregion
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
index e080b375..0c36460f 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
@@ -179,6 +179,56 @@ namespace Tnb.ProductionMgr
.ExecuteCommandAsync();
return (row > 0);
}
+ // ///
+ // /// 关联同组工单
+ // ///
+ // /// 关联同组工单输入参数
+ // ///
+ // [HttpPost]
+ // public async Task RelevancySameGroupMo(MoCrInput input)
+ // {
+ // (bool executeRes, string errMsg) multi = (true, "");
+ // var list = await _repository.AsSugarClient().Queryable()
+ // .InnerJoin((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()
+ // .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;
+ // }
+
///
/// 关联同组工单
///
@@ -189,12 +239,13 @@ namespace Tnb.ProductionMgr
{
(bool executeRes, string errMsg) multi = (true, "");
var list = await _repository.AsSugarClient().Queryable()
- .InnerJoin((a, b) => a.material_id == b.material_id)
- .Where((a, b) => input.WorkOrderIds.Contains(a.id))
- .Select((a, b) => new
+ .LeftJoin((a, b) => a.material_id == b.material_id)
+ .LeftJoin((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("未关联到同一模具下");
}
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 503dbbfd..8060e370 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -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().Where(x=>x.parent_id==a.id).Any(),
+ num = SqlFunc.Subqueryable().Where(x=>x.parent_id==a.id).Count(),
+ isLeaf = SqlFunc.Subqueryable().Where(x=>x.parent_id==a.id).Any(),
+ children = SqlFunc.Subqueryable()
+ .LeftJoin((h,i) => h.material_id == i.id)
+ .LeftJoin((h,i,j) => h.mo_type == j.Id)
+ .LeftJoin((h,i,j,k) => h.mo_status == k.Id)
+ .LeftJoin((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.SqlSugarPageResult(result);
+ return PageResult.SqlSugarPageResult(result);
}
#endregion
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs
index cab28a3f..7c4c1096 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs
@@ -8,14 +8,14 @@ namespace Tnb.QcMgr.Entities
{
public class CheckItemOut
{
- public string checktypeid { get; set; }
- public string checktypename { get; set; }
- public List items { get; set; }
+ public string? checktypeid { get; set; }
+ public string? checktypename { get; set; }
+ public List? 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; }
}
}
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs
index a4cd4289..8af6d628 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs
@@ -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 checktypes { get; set; }
+ public string? id { get; set; }
+ public string? name { get; set; }
+ public string? status { get; set; }
+ public List? checktypes { get; set; }
}
public class CheckTypeInput
{
- public string id { get; set; }
- public List items { get; set; }
+ public string? id { get; set; }
+ public List? 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 checktypes { get; set; }
+ public string? id { get; set; }
+ public string? name { get; set; }
+ public string? status { get; set; }
+ public List? checktypes { get; set; }
}
public class CheckTypeOut
{
- public string checktypeid { get; set; }
- public string checktypename { get; set; }
- public List items { get; set; }
+ public string? checktypeid { get; set; }
+ public string? checktypename { get; set; }
+ public List? 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
{
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs
index 154b2e31..e19c59f6 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs
@@ -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 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? checktypes { get; set; }
}
public class CheckPlanTypeInput
{
- public string id { get; set; }
- public List items { get; set; }
+ public string? id { get; set; }
+ public List? 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 checktypes { get; set; }
+ public string? addid { get; set; }
+ public string? triggertype { get; set; }
+ public string? content { get; set; }
+ public List? checktypes { get; set; }
}
public class CheckPlanTypeOut
{
- public string checktypeid { get; set; }
- public string checktypename { get; set; }
- public List items { get; set; }
+ public string? checktypeid { get; set; }
+ public string? checktypename { get; set; }
+ public List? 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
{
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
index a95ad0ac..dff6b0da 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs
@@ -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 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? checktypes { get; set; }
}
public class CheckExecTypeOut
{
- public string checktypeid { get; set; }
- public string checktypename { get; set; }
- public List items { get; set; }
+ public string? checktypeid { get; set; }
+ public string? checktypename { get; set; }
+ public List? 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 errorcause { get; set; }
- public List 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? errorcause { get; set; }
+ public List? 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 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? 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 checktypes { get; set; }
+ public List? checktypes { get; set; }
}
public class CheckExexTypeInput
{
- public string id { get; set; }
- public List items { get; set; }
+ public string? id { get; set; }
+ public List? 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; }
}
}
diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
index 00f73cb9..d13358b4 100644
--- a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
+++ b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
@@ -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; }
}
}
diff --git a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs
index fa8583a3..df3acbe1 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs
@@ -93,7 +93,7 @@ namespace Tnb.QcMgr
{
CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List() });
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().ToListAsync();
var QcCheckTypes = await db.Queryable().ToListAsync();
var QcCheckItemsH = await db.Queryable().Where(p => p.id == CheckItemsInput.id).FirstAsync();
- List QcCheckItemsRs = null;
- List QcCheckItemsDs = null;
+ List QcCheckItemsRs = new List();
+ List QcCheckItemsDs = new List();
if (QcCheckItemsH != null)
{
QcCheckItemsRs = await db.Queryable().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 QcCheckItemsRs = new List();
List QcCheckItemsDs = new List();
- 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);
diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
index 19fd21ad..e3c4f2bb 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
@@ -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 QcCheckPlanDs = new List();
- 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);
diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
index 86ecf9dd..e50ee4a0 100644
--- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
+++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs
@@ -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().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
CheckTaskOut.checktypes = new List();
@@ -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(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().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);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsHandleCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsHandleCode.cs
index db49acda..4d421b74 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsHandleCode.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsHandleCode.cs
@@ -94,9 +94,4 @@ public partial class WmsHandleCode : BaseEntity
///
public DateTime? modify_time { get; set; }
- ///
- /// 行号
- ///
- public int no { get; set; }
-
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs
index 8a365606..8168b29f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs
@@ -166,9 +166,8 @@ public partial class WmsInstockCode : BaseEntity
///
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;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutbale.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutbale.cs
new file mode 100644
index 00000000..a15d91ce
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutbale.cs
@@ -0,0 +1,97 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.WarehouseMgr.Entities;
+
+///
+/// 寄存出库
+///
+[SugarTable("wms_outbale")]
+public partial class WmsOutbale : BaseEntity
+{
+ public WmsOutbale()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+ ///
+ /// 目标库位ID
+ ///
+ public string? location_id { get; set; }
+
+ ///
+ /// 单号
+ ///
+ public string? bill_code { get; set; }
+
+ ///
+ /// 单据状态
+ ///
+ public string? status { get; set; }
+
+ ///
+ /// 业务类型
+ ///
+ public string? biz_type { get; set; }
+
+ ///
+ /// 载具ID
+ ///
+ public string? carry_id { get; set; }
+
+ ///
+ /// 载具编号
+ ///
+ public string? carry_code { get; set; }
+
+ ///
+ /// 打包号
+ ///
+ public string? bale_num { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 扩展
+ ///
+ public string? extras { get; set; }
+
+ ///
+ /// 时间戳(用于并发控制)
+ ///
+ public DateTime? timestamp { get; set; }
+
+ ///
+ /// 流程任务Id
+ ///
+ public string? f_flowtaskid { get; set; }
+
+ ///
+ /// 流程引擎Id
+ ///
+ public string? f_flowid { get; set; }
+
+}
\ No newline at end of file
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
index b7c5abc4..bb1412d5 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
@@ -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().SingleAsync(it => it.id == carryId);
var subCarry = await _db.Queryable().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()!;
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().Where(it => it.carry_id == subCarryId).ToListAsync();
for (int i = 0; i < items.Count; i++)
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
index f50d12e8..92bacdd8 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
@@ -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().FirstAsync(it => it.id == carryId);
var subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId);
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
index 684fac52..2063fa9a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs
@@ -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
{
///
- /// 出库申请业务类
+ /// 寄存出库
///
- [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 repository,
- IDictionaryDataService dictionaryDataService,
+ ISqlSugarRepository 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 OutStockApplyFor(VisualDevModelDataCrInput input)
+ private async Task 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().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
-
- var carryIds = new List();
- //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().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>();
- if (outStockDList?.Count > 0)
+ ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
+ }
+ if (carry != null)
+ {
+ sPoint = await _db.Queryable().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 carryMats = new();
- List 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().InnerJoin((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()
- .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>();
- 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();
- var sortingOutIds = new List();
- 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().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString() }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync();
- await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
- }
- var carrys = await _db.Queryable().Where(it => carryIds.Contains(it.id)).ToListAsync();
- if (carrys?.Count > 0)
- {
- List preTasks = new();
- List 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().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().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().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>();
+ preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
+ //根据载具移出Id,回更单据状态
+ await _db.Updateable().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(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);
}
-
- ///
- /// 根据出库申请单ID获取申请单明细信息
- ///
- ///
- ///
- [HttpGet]
- public async Task 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().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().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
+ if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
}
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
index 49ac21a0..87d85e61 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
@@ -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" });