Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -26,6 +26,10 @@ public static class DictConst
|
||||
/// </summary>
|
||||
public const string AlreadyId = "26033187948309";
|
||||
/// <summary>
|
||||
/// 工单状态-已下发Id
|
||||
/// </summary>
|
||||
public const string ScheduledId = "25019232867093";
|
||||
/// <summary>
|
||||
/// 工单状态-待排产
|
||||
/// </summary>
|
||||
public const string WaitProductId = "25019244276501";
|
||||
|
||||
174
BasicData/Tnb.BasicData.Entities/Entity/BasCustomer.cs
Normal file
174
BasicData/Tnb.BasicData.Entities/Entity/BasCustomer.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.BasicData.Entities
|
||||
{
|
||||
///<summary>
|
||||
///客户信息
|
||||
///</summary>
|
||||
[SugarTable("bas_customer")]
|
||||
public partial class BasCustomer
|
||||
{
|
||||
public BasCustomer(){
|
||||
|
||||
this.org_id =Convert.ToString("NULL::character varying");
|
||||
this.short_name =Convert.ToString("NULL::character varying");
|
||||
this.full_address =Convert.ToString("NULL::character varying");
|
||||
this.postal_code =Convert.ToString("NULL::character varying");
|
||||
this.country =Convert.ToString("NULL::character varying");
|
||||
this.province =Convert.ToString("NULL::character varying");
|
||||
this.city =Convert.ToString("NULL::character varying");
|
||||
this.district =Convert.ToString("NULL::character varying");
|
||||
this.street =Convert.ToString("NULL::character varying");
|
||||
this.contact_name =Convert.ToString("NULL::character varying");
|
||||
this.contact_phone =Convert.ToString("NULL::character varying");
|
||||
this.contact_mobile =Convert.ToString("NULL::character varying");
|
||||
this.create_id =Convert.ToString("NULL::character varying");
|
||||
this.modify_id =Convert.ToString("NULL::character varying");
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Desc:编号
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey=true)]
|
||||
public string id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:客户代码
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string customer_code {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:客户名称
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string customer_name {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:所属组织
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? org_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:客户简称
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? short_name {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:详细地址
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? full_address {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:邮编
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? postal_code {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:国家
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? country {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:省
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? province {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:市
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? city {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:区
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? district {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:街道地址
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? street {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:联系人名称
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? contact_name {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:联系人电话
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? contact_phone {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:联系人手机
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? contact_mobile {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? create_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? create_time {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? modify_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? modify_time {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:扩展字段
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? extras {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,13 @@ namespace Tnb.BasicData.Entities
|
||||
[SugarTable("bas_mbom_output")]
|
||||
public class BasMbomOutput : BaseEntity<string>
|
||||
{
|
||||
public BasMbomOutput()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string mo_id { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:生产bomid
|
||||
/// Default:
|
||||
|
||||
25
EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
Normal file
25
EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备生命周期
|
||||
/// </summary>
|
||||
public static class EquipmentLife
|
||||
{
|
||||
/// <summary>
|
||||
/// 启用
|
||||
/// </summary>
|
||||
public const string ENABLE = "1";
|
||||
/// <summary>
|
||||
/// 停用
|
||||
/// </summary>
|
||||
public const string DISABLE = "2";
|
||||
/// <summary>
|
||||
/// 库存
|
||||
/// </summary>
|
||||
public const string STOCK = "3";
|
||||
/// <summary>
|
||||
/// 报废
|
||||
/// </summary>
|
||||
public const string SCRAP = "4";
|
||||
}
|
||||
}
|
||||
150
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
Normal file
150
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsItem.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///设备点巡检项目
|
||||
///</summary>
|
||||
[SugarTable("eqp_spot_ins_item")]
|
||||
public class EqpSpotInsItem : BaseEntity<string>
|
||||
{
|
||||
public EqpSpotInsItem()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:判断类型1数值2结果
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string judge_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:上限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? high_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否包含上限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? high_value_is_include { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:下限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? low_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否包含下限值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? low_value_is_include { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:标准值
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? standard_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单位id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:排序
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public int ordinal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:类型 1 点检 2巡检
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编码
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:名称
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:判断内容
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string judge_content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检方法
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string inspection_method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:备注
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:所属组织
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string org_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public double? standard_value { get; set; }
|
||||
public decimal? standard_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单位id
|
||||
@@ -131,4 +131,11 @@ public partial class EqpSpotInsRecordD : BaseEntity<string>
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检设备模板id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string spot_ins_tem_equip_id {get;set;}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace Tnb.EquipMgr.Entities
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备id
|
||||
/// Default:
|
||||
@@ -70,18 +71,18 @@ namespace Tnb.EquipMgr.Entities
|
||||
public DateTime? send_date_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:滞后推送时间
|
||||
/// Desc:计划执行通知提前量
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? after_send_date_time { get; set; }
|
||||
public int? plan_run_notice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否滞后推送
|
||||
/// Desc:执行滞后推送时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? is_after_send { get; set; }
|
||||
public int? plan_delay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
@@ -131,5 +132,81 @@ namespace Tnb.EquipMgr.Entities
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string send_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编码
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:计划执行通知提前量单位 1 小时 2 天 3 周
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string plan_run_notice_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:执行滞后推送时间单位 1 小时 2 天 3 周
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string plan_delay_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核岗位id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_post_info_user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:责任岗位id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string send_post_info_user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否复核
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string is_repeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? repeat_time {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核备注
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_remark {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:复核人id
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string repeat_user_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:仅用于关联表字段查询用不存储数据
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName="query_info")]
|
||||
public string query_info {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string attachment { get; set; }
|
||||
}
|
||||
}
|
||||
33
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipD.cs
Normal file
33
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipD.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
///<summary>
|
||||
///点巡检设备模板子表
|
||||
///</summary>
|
||||
[SugarTable("eqp_spot_ins_tem_equip_d")]
|
||||
public class EqpSpotInsTemEquipD : BaseEntity<string>
|
||||
{
|
||||
public EqpSpotInsTemEquipD(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:设备模板id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string spot_ins_tem_equip_id {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:点巡检项id
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string spot_ins_item_id {get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,9 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// </summary>
|
||||
public string mold_type_code { get; set; }
|
||||
/// <summary>
|
||||
/// 型腔数
|
||||
/// 可用台数
|
||||
/// </summary>
|
||||
public int? cavity_qty { get; set; }
|
||||
public int available_stations { get; set; }
|
||||
public string mold_id { get; set;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 组装、包装排产输入参数
|
||||
/// </summary>
|
||||
public class PackSchedlingCrInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 工单Id
|
||||
/// </summary>
|
||||
public string mo_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产bomId
|
||||
/// </summary>
|
||||
public string bom_id { get; set; }
|
||||
/// <summary>
|
||||
/// 产线Id
|
||||
/// </summary>
|
||||
public string workline_id { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排产数量
|
||||
/// </summary>
|
||||
public string scheduled_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预计开始时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime estimated_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预计结束时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime estimated_end_date { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.DirectoryServices.Protocols;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 组装、包装生产任务待下发输出参数列表
|
||||
/// </summary>
|
||||
public class PackSechelToBeIssueListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产任务ID
|
||||
/// </summary>
|
||||
public string mo_task_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务编号
|
||||
/// </summary>
|
||||
public string mo_task_code { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编号
|
||||
/// </summary>
|
||||
public string material_code { get; set; }
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string material_name { get; set; }
|
||||
/// <summary>
|
||||
/// 产线编号
|
||||
/// </summary>
|
||||
public string workline_code { get; set; }
|
||||
/// <summary>
|
||||
/// 产线名称
|
||||
/// </summary>
|
||||
public string workline_name { get; set; }
|
||||
/// <summary>
|
||||
/// 任务单状态
|
||||
/// </summary>
|
||||
public string mo_task_status { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务数量
|
||||
/// </summary>
|
||||
public int scheduled_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 计划数量
|
||||
/// </summary>
|
||||
public int plan_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 工序任务量
|
||||
/// </summary>
|
||||
public int process_task_qty { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 组装、包装排产列表输出类
|
||||
/// </summary>
|
||||
public class PackingSchedulingListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 工单Id
|
||||
/// </summary>
|
||||
public string mo_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工序Id
|
||||
/// </summary>
|
||||
public string process_id { get; set; }
|
||||
/// <summary>
|
||||
/// 产线Id
|
||||
/// </summary>
|
||||
public string workline_id { get; set; }
|
||||
/// <summary>
|
||||
/// 产线名称
|
||||
/// </summary>
|
||||
public string workline_name { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务单号
|
||||
/// </summary>
|
||||
public string mo_task_code { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
/// </summary>
|
||||
public string material_id { get; set; }
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string material_code { get; set; }
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string material_name { get; set; }
|
||||
/// <summary>
|
||||
/// 工序名称
|
||||
/// </summary>
|
||||
public string process_name { get; set; }
|
||||
/// <summary>
|
||||
/// 产出数量
|
||||
/// </summary>
|
||||
public string qty { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// </summary>
|
||||
public string eqp_type_code { get; set; }
|
||||
/// <summary>
|
||||
/// 产线编码
|
||||
/// </summary>
|
||||
public string workline_code { get; set; }
|
||||
/// <summary>
|
||||
/// 产线名称
|
||||
/// </summary>
|
||||
public string workline_name { get; set; }
|
||||
/// <summary>
|
||||
/// 任务单数量
|
||||
/// </summary>
|
||||
public int mo_task_qty { get; set; }
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string line_id { get; set; }
|
||||
public string workline_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -106,6 +106,11 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// 已排产数量
|
||||
/// </summary>
|
||||
public int scheduled_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产bom id
|
||||
/// </summary>
|
||||
public string bom_id { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 拆解组装包装排产输入参数
|
||||
/// </summary>
|
||||
public class UnPackSchedlingInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 工单Id
|
||||
/// </summary>
|
||||
public string mo_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产任务Id
|
||||
/// </summary>
|
||||
public string mo_task_id { get; set; }
|
||||
/// <summary>
|
||||
/// 生产bom Id
|
||||
/// </summary>
|
||||
public string bom_id { get; set; }
|
||||
/// <summary>
|
||||
/// 产线Id
|
||||
/// </summary>
|
||||
public string workline_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预计开始时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? estimated_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预计结束时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -177,6 +177,10 @@ namespace Tnb.ProductionMgr.Entities
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string modify_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具型号
|
||||
/// </summary>
|
||||
public string mold_type_code { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ namespace DbModels
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 父任务ID
|
||||
/// </summary>
|
||||
public string parent_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:生产任务编号
|
||||
@@ -229,6 +233,10 @@ namespace DbModels
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int mold_cavity_qty { get; set; }
|
||||
/// <summary>
|
||||
/// 工序任务量
|
||||
/// </summary>
|
||||
public int process_task_qty { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -108,6 +108,12 @@ namespace Tnb.ProductionMgr.Entities
|
||||
/// 任务单编号
|
||||
/// </summary>
|
||||
public string mo_task_code { get; set; }
|
||||
/// <summary>
|
||||
/// 产线Code
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string workline_code { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ using JNPF.VisualDev.Entitys;
|
||||
using Aop.Api.Domain;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.Card;
|
||||
using Aspose.Cells.Drawing.Texts;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using WebSocketSharp.Frame;
|
||||
using JNPF.Logging;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -48,6 +51,8 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IRunService _runService;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private static Dictionary<string, object> _dicDefect = new Dictionary<string, object>();
|
||||
private static Dictionary<string, object> _dicWorkLine = new Dictionary<string, object>();
|
||||
private static Dictionary<string, object> _dicProcess = new Dictionary<string, object>();
|
||||
private readonly ISqlSugarClient _db;
|
||||
|
||||
|
||||
@@ -106,8 +111,10 @@ namespace Tnb.ProductionMgr
|
||||
mold_id = a.id,
|
||||
mold_code = a.mold_code,
|
||||
mold_name = a.mold_name,
|
||||
mold_type_code = a.mold_type_code,
|
||||
material_name = b.name,
|
||||
cavity_qty = a.cavity_qty,
|
||||
material_code = b.code,
|
||||
available_stations = SqlFunc.Subqueryable<EqpEquipment>().Where(it => it.mold_id == a.id).Count(),
|
||||
})
|
||||
.ToListAsync();
|
||||
return list;
|
||||
@@ -338,40 +345,131 @@ namespace Tnb.ProductionMgr
|
||||
/// <br/>}
|
||||
/// </remarks>
|
||||
[HttpGet("{moId}")]
|
||||
public async Task<dynamic> GetPrdTaskInfoByMoId(string moId)
|
||||
public async Task<dynamic> GetPrdTaskInfoByMoId(string moId, int schedType = 1)
|
||||
{
|
||||
|
||||
List<PrdMoTaskOutput> result = new();
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||
var result = await _db.Queryable<PrdMoTask>().LeftJoin<PrdMo>((a, b) => a.mo_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<Molds>((a, b, c, d) => a.mold_id == d.id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d, e) => a.eqp_id == e.id)
|
||||
.Where((a, b, c, d, e) => a.mo_id == moId)
|
||||
.Select((a, b, c, d, e) => new PrdMoTaskOutput
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_task_status = a.mo_task_status,
|
||||
mold_code = d.mold_code,
|
||||
mold_name = d.mold_name,
|
||||
material_code = c.code,
|
||||
material_name = c.name,
|
||||
eqp_code = e.code,
|
||||
eqp_name = e.name,
|
||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(it => it.id == e.equip_type_id).Select(it => it.code),
|
||||
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
|
||||
estimated_start_date = a.estimated_start_date,
|
||||
estimated_end_date = a.estimated_end_date,
|
||||
plan_qty = b.plan_qty,
|
||||
complete_qty = a.complete_qty,
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "";
|
||||
})
|
||||
.ToListAsync();
|
||||
if (schedType == 1)
|
||||
{
|
||||
result = await _db.Queryable<PrdMoTask>().LeftJoin<PrdMo>((a, b) => a.mo_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<Molds>((a, b, c, d) => a.mold_id == d.id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d, e) => a.eqp_id == e.id)
|
||||
.Where((a, b, c, d, e) => a.mo_id == moId)
|
||||
.Select((a, b, c, d, e) => new PrdMoTaskOutput
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_task_status = a.mo_task_status,
|
||||
mold_code = d.mold_code,
|
||||
mold_name = d.mold_name,
|
||||
material_code = c.code,
|
||||
material_name = c.name,
|
||||
eqp_code = e.code,
|
||||
eqp_name = e.name,
|
||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(it => it.id == e.equip_type_id).Select(it => it.code),
|
||||
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
|
||||
estimated_start_date = a.estimated_start_date,
|
||||
estimated_end_date = a.estimated_end_date,
|
||||
plan_qty = b.plan_qty,
|
||||
complete_qty = a.complete_qty,
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "";
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await _db.Queryable<PrdMoTask>().LeftJoin<PrdMo>((a, b) => a.mo_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
|
||||
.Where((a, b, c, d) => a.mo_id == moId)
|
||||
.Select((a, b, c, d) => new PrdMoTaskOutput
|
||||
{
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_task_status = a.mo_task_status,
|
||||
workline_code = d.EnCode,
|
||||
workline_name = d.FullName,
|
||||
material_code = c.code,
|
||||
material_name = c.name,
|
||||
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
|
||||
estimated_start_date = a.estimated_start_date,
|
||||
estimated_end_date = a.estimated_end_date,
|
||||
plan_qty = b.plan_qty,
|
||||
complete_qty = a.complete_qty,
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "";
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///组装、包装 获取待下发任务列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetPackScheldToBeIssueList()
|
||||
{
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||
var result = await _db.Queryable<PrdMoTask>().Where(it => it.schedule_type == 2)
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.workline_id == c.Id)
|
||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
||||
.Select((a, b, c, d) => new PackSechelToBeIssueListOutput
|
||||
{
|
||||
mo_task_id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
workline_code = c.EnCode,
|
||||
workline_name = c.FullName,
|
||||
mo_task_status = a.mo_task_status,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
plan_qty = d.plan_qty
|
||||
})
|
||||
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "")
|
||||
.ToListAsync();
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据生产任务ID获取子任务列表
|
||||
/// </summary>
|
||||
/// <param name="mo_task_id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{mo_task_id}")]
|
||||
public async Task<dynamic> GetSubMoTaskListByTaskId(string mo_task_id)
|
||||
{
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||
var result = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.workline_id == c.Id)
|
||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
||||
.Where((a, b, c, d) => a.parent_id == mo_task_id)
|
||||
.Select((a, b, c, d) => new PackSechelToBeIssueListOutput
|
||||
{
|
||||
mo_task_id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
workline_code = c.EnCode,
|
||||
workline_name = c.FullName,
|
||||
mo_task_status = a.mo_task_status,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
plan_qty = d.plan_qty,
|
||||
process_task_qty = a.process_task_qty,
|
||||
})
|
||||
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : "")
|
||||
.ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -403,18 +501,204 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var row = -1;
|
||||
if (input.schedule_type.HasValue && input.schedule_type.Value == 1)
|
||||
if (input.schedule_type.HasValue)
|
||||
{
|
||||
if (input.schedule_type.Value == 1) //注塑、基础排产
|
||||
{
|
||||
var moTask = input.Adapt<PrdMoTask>();
|
||||
moTask.id = SnowflakeIdHelper.NextId();
|
||||
moTask.create_id = _userManager.UserId;
|
||||
moTask.create_time = DateTime.Now;
|
||||
moTask.mo_task_status = DictConst.ToBeScheduledEncode;
|
||||
moTask.scheduled_qty = input.scheduled_qty;
|
||||
|
||||
var mo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
var moCode = mo?.mo_code;
|
||||
var taskCode = await db.Queryable<PrdMoTask>().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync();
|
||||
if (taskCode.IsNullOrEmpty())
|
||||
{
|
||||
moTask.mo_task_code = $"{moCode}-01";
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos = taskCode.IndexOf("-", StringComparison.Ordinal);
|
||||
if (pos > -1)
|
||||
{
|
||||
var num = taskCode.AsSpan().Slice(pos + 1).ToString().ParseToInt();
|
||||
var code = taskCode.AsSpan().Slice(0, pos).ToString();
|
||||
var n = (num + 1).ToString().PadLeft(2, '0');
|
||||
moTask.mo_task_code = $"{code}-{n}";
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
await db.Ado.BeginTranAsync();
|
||||
row = await db.Insertable(moTask).ExecuteCommandAsync();
|
||||
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
var schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
|
||||
if (mo != null)
|
||||
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
{
|
||||
mo.mo_status = DictConst.AlreadyId;
|
||||
row = await db.Updateable(mo).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (schedQty.HasValue)
|
||||
mo.scheduled_qty = schedQty.Value;
|
||||
}
|
||||
}
|
||||
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == moTask.material_id);
|
||||
|
||||
var taskLog = new PrdTaskLog();
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code;
|
||||
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code;
|
||||
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code;
|
||||
taskLog.item_code = material?.code;
|
||||
taskLog.item_standard = material?.material_standard;
|
||||
taskLog.status = DictConst.ToBeScheduledEncode;
|
||||
taskLog.operator_name = _userManager.RealName;
|
||||
taskLog.create_id = _userManager.UserId;
|
||||
taskLog.create_time = DateTime.Now;
|
||||
taskLog.mo_task_id = moTask.id;
|
||||
taskLog.mo_task_code = moTask.mo_task_code;
|
||||
|
||||
await db.Insertable(taskLog).ExecuteCommandAsync();
|
||||
//将生产任务插入到自检报废记录表
|
||||
var sacipRecord = new PrdMoTaskDefectRecord();
|
||||
sacipRecord.id = SnowflakeIdHelper.NextId();
|
||||
sacipRecord.material_code = material?.code;
|
||||
sacipRecord.material_name = material?.name;
|
||||
sacipRecord.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moTask.eqp_id))?.code;
|
||||
sacipRecord.mold_name = (await db.Queryable<Molds>().FirstAsync(it => it.id == moTask.mold_id))?.mold_name;
|
||||
sacipRecord.estimated_start_date = moTask.plan_start_date;
|
||||
sacipRecord.estimated_end_date = moTask.plan_end_date;
|
||||
sacipRecord.plan_qty = moTask.plan_qty;
|
||||
sacipRecord.scrap_qty = moTask.scrap_qty;
|
||||
sacipRecord.status = moTask.mo_task_status;
|
||||
sacipRecord.create_id = _userManager.UserId;
|
||||
sacipRecord.create_time = DateTime.Now;
|
||||
sacipRecord.mo_task_id = moTask.id;
|
||||
sacipRecord.mo_task_code = moTask.mo_task_code;
|
||||
await db.Insertable(sacipRecord).ExecuteCommandAsync();
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await db.Ado.RollbackTranAsync();
|
||||
}
|
||||
}
|
||||
else if (input.schedule_type.Value == 2) //组装、包装排产
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return row > 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取组装包装排产任务列表
|
||||
/// </summary>
|
||||
/// <param name="input">拆解bom,生成组装包装任务列表,输入参数</param>
|
||||
/// <remarks>
|
||||
/// output:
|
||||
///<br/>{
|
||||
///<br/> workline_id:产线Id
|
||||
///<br/> workline_name:产线名称
|
||||
///<br/> material_code:物料编码
|
||||
///<br/> material_name:物料名称
|
||||
///<br/> qty:输出料数量
|
||||
///<br/>}
|
||||
/// </remarks>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetPackSchedulingTaskList(UnPackSchedlingInput input)
|
||||
{
|
||||
if (_dicWorkLine.Count < 1)
|
||||
{
|
||||
_dicWorkLine = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToDictionaryAsync(x => x.Id, x => x.FullName);
|
||||
}
|
||||
if (_dicProcess.Count < 1)
|
||||
{
|
||||
_dicProcess = await _db.Queryable<BasProcess>().Select(it => new { id = it.id, process_name = it.process_name }).Distinct().ToDictionaryAsync(x => x.id, x => x.process_name);
|
||||
}
|
||||
var outputList = new List<PackingSchedulingListOutput>();
|
||||
var bom = await _db.Queryable<BasMbom>().FirstAsync(it => it.id == input.bom_id);
|
||||
if (bom != null && bom.route_id.IsNotEmptyOrNull())
|
||||
{
|
||||
var routes = await _db.Queryable<BasRouteD>().Where(it => it.route_id == bom.route_id).ToListAsync();
|
||||
if (routes?.Count > 0)
|
||||
{
|
||||
var processIds = routes.Select(x => x.process_id).ToList();
|
||||
if (processIds?.Count > 0)
|
||||
{
|
||||
var bomOutputs = await _db.Queryable<BasMbomOutput>().Where(it => processIds.Contains(it.process_id)).ToListAsync();
|
||||
if (bomOutputs?.Count > 0)
|
||||
{
|
||||
foreach (var item in bomOutputs)
|
||||
{
|
||||
var material = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == item.material_id);
|
||||
var output = new PackingSchedulingListOutput();
|
||||
output.mo_id = input.mo_id;
|
||||
output.process_id = item.process_id;
|
||||
output.workline_id = input.workline_id;
|
||||
output.workline_name = _dicWorkLine.ContainsKey(input.workline_id) ? _dicWorkLine[input.workline_id].ToString() : "";
|
||||
output.process_name = _dicProcess[item.process_id]?.ToString();
|
||||
output.material_id = item.material_id;
|
||||
output.material_code = material?.code;
|
||||
output.material_name = material?.name;
|
||||
output.qty = item.num;
|
||||
outputList.Add(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成任务单号
|
||||
if (outputList.Count > 0)
|
||||
{
|
||||
var mo = await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
if (mo != null && mo.mo_code.IsNotEmptyOrNull())
|
||||
{
|
||||
var taskCodes = outputList.Where(it => it.mo_task_code.IsNotEmptyOrNull()).ToList();
|
||||
if (taskCodes == null || taskCodes.Count < 1)
|
||||
{
|
||||
for (int i = 1, len = outputList.Count; i <= len; i++)
|
||||
{
|
||||
outputList[i - 1].mo_task_code = $"{mo.mo_code}-{i.ToString().PadLeft(2, '0')}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return outputList;
|
||||
}
|
||||
/// <summary>
|
||||
/// 组装包装排产
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PackSchedling(PackSchedlingCrInput input)
|
||||
{
|
||||
var row = -1;
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
var moTask = input.Adapt<PrdMoTask>();
|
||||
moTask.id = SnowflakeIdHelper.NextId();
|
||||
moTask.create_id = _userManager.UserId;
|
||||
moTask.create_time = DateTime.Now;
|
||||
moTask.schedule_type = 2;
|
||||
moTask.mo_task_status = DictConst.ToBeScheduledEncode;
|
||||
moTask.scheduled_qty = input.scheduled_qty;
|
||||
|
||||
var mo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
moTask.estimated_start_date = input.estimated_start_date;
|
||||
moTask.estimated_end_date = input.estimated_end_date;
|
||||
var mo = await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
var moCode = mo?.mo_code;
|
||||
var taskCode = await db.Queryable<PrdMoTask>().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync();
|
||||
var taskCode = await _db.Queryable<PrdMoTask>().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync();
|
||||
if (taskCode.IsNullOrEmpty())
|
||||
{
|
||||
moTask.mo_task_code = $"{moCode}-01";
|
||||
@@ -424,78 +708,104 @@ namespace Tnb.ProductionMgr
|
||||
var pos = taskCode.IndexOf("-", StringComparison.Ordinal);
|
||||
if (pos > -1)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var num = taskCode.AsSpan().Slice(pos + 1).ToString().ParseToInt();
|
||||
var code = taskCode.AsSpan().Slice(0, pos).ToString();
|
||||
var n = (num + 1).ToString().PadLeft(2, '0');
|
||||
moTask.mo_task_code = sb.Append(code).Append("-").Append(n).ToString();
|
||||
moTask.mo_task_code = $"{code}-{n}";
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
await db.Ado.BeginTranAsync();
|
||||
row = await db.Insertable(moTask).ExecuteCommandAsync();
|
||||
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
var schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
|
||||
if (mo != null)
|
||||
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
row = await _db.Insertable(moTask).ExecuteCommandAsync();
|
||||
var material_h = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == moTask.material_id);
|
||||
//添加生产任务操作记录日志s
|
||||
var taskLog = new PrdTaskLog();
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
taskLog.mo_code = (await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code;
|
||||
//taskLog.eqp_code = (await _db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code;
|
||||
//taskLog.mold_code = (await _db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code;
|
||||
taskLog.item_code = material_h?.code;
|
||||
taskLog.item_standard = material_h?.material_standard;
|
||||
taskLog.status = DictConst.ToBeScheduledEncode;
|
||||
taskLog.operator_name = _userManager.RealName;
|
||||
taskLog.create_id = _userManager.UserId;
|
||||
taskLog.create_time = DateTime.Now;
|
||||
taskLog.mo_task_id = moTask.id;
|
||||
taskLog.mo_task_code = moTask.mo_task_code;
|
||||
row = await _db.Insertable(taskLog).ExecuteCommandAsync();
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
var schedQty = _db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
if (mo != null)
|
||||
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
{
|
||||
mo.mo_status = DictConst.AlreadyId;
|
||||
await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (schedQty.HasValue)
|
||||
{
|
||||
mo.mo_status = DictConst.AlreadyId;
|
||||
row = await db.Updateable(mo).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (schedQty.HasValue)
|
||||
mo.scheduled_qty = schedQty.Value;
|
||||
mo.scheduled_qty += schedQty.Value;
|
||||
await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == moTask.material_id);
|
||||
|
||||
var taskLog = new PrdTaskLog();
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id))?.mo_code;
|
||||
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == input.eqp_id))?.code;
|
||||
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == input.mold_id))?.mold_code;
|
||||
taskLog.item_code = material?.code;
|
||||
taskLog.item_standard = material?.material_standard;
|
||||
taskLog.status = DictConst.ToBeScheduledEncode;
|
||||
taskLog.operator_name = _userManager.RealName;
|
||||
taskLog.create_id = _userManager.UserId;
|
||||
taskLog.create_time = DateTime.Now;
|
||||
taskLog.mo_task_id = moTask.id;
|
||||
taskLog.mo_task_code = moTask.mo_task_code;
|
||||
|
||||
await db.Insertable(taskLog).ExecuteCommandAsync();
|
||||
//将生产任务插入到自检报废记录表
|
||||
var sacipRecord = new PrdMoTaskDefectRecord();
|
||||
sacipRecord.id = SnowflakeIdHelper.NextId();
|
||||
sacipRecord.material_code = material?.code;
|
||||
sacipRecord.material_name = material?.name;
|
||||
sacipRecord.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == moTask.eqp_id))?.code;
|
||||
sacipRecord.mold_name = (await db.Queryable<Molds>().FirstAsync(it => it.id == moTask.mold_id))?.mold_name;
|
||||
sacipRecord.estimated_start_date = moTask.plan_start_date;
|
||||
sacipRecord.estimated_end_date = moTask.plan_end_date;
|
||||
sacipRecord.plan_qty = moTask.plan_qty;
|
||||
sacipRecord.scrap_qty = moTask.scrap_qty;
|
||||
sacipRecord.status = moTask.mo_task_status;
|
||||
sacipRecord.create_id = _userManager.UserId;
|
||||
sacipRecord.create_time = DateTime.Now;
|
||||
sacipRecord.mo_task_id = moTask.id;
|
||||
sacipRecord.mo_task_code = moTask.mo_task_code;
|
||||
await db.Insertable(sacipRecord).ExecuteCommandAsync();
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
//根据生产bomId 拆解生产子任务
|
||||
var outputList = new List<PackingSchedulingListOutput>();
|
||||
var bom = await _db.Queryable<BasMbom>().FirstAsync(it => it.id == input.bom_id);
|
||||
if (bom != null && bom.route_id.IsNotEmptyOrNull())
|
||||
{
|
||||
await db.Ado.RollbackTranAsync();
|
||||
var routes = await _db.Queryable<BasRouteD>().Where(it => it.route_id == bom.route_id).ToListAsync();
|
||||
if (routes?.Count > 0)
|
||||
{
|
||||
var processIds = routes.Select(x => x.process_id).ToList();
|
||||
if (processIds?.Count > 0)
|
||||
{
|
||||
var bomOutputs = await _db.Queryable<BasMbomOutput>().Where(it => processIds.Contains(it.process_id)).ToListAsync();
|
||||
if (bomOutputs?.Count > 0)
|
||||
{
|
||||
List<PrdMoTask> subMoTasks = new();
|
||||
foreach (var item in bomOutputs)
|
||||
{
|
||||
var material = await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == item.material_id);
|
||||
PrdMoTask subMoTask = new();
|
||||
subMoTask.id = SnowflakeIdHelper.NextId();
|
||||
subMoTask.schedule_type = 2;
|
||||
subMoTask.parent_id = moTask.id;
|
||||
subMoTask.bom_id = input.bom_id;
|
||||
subMoTask.mo_task_status = DictConst.ToBeScheduledEncode;
|
||||
subMoTask.workline_id = input.workline_id;
|
||||
subMoTask.material_id = item.material_id;
|
||||
subMoTask.process_task_qty = item.num.ParseToInt() * moTask.scheduled_qty;
|
||||
subMoTask.estimated_start_date = input.estimated_start_date;
|
||||
subMoTask.estimated_end_date = input.estimated_end_date;
|
||||
subMoTask.create_id = _userManager.UserId;
|
||||
subMoTask.create_time = DateTime.Now;
|
||||
subMoTasks.Add(subMoTask);
|
||||
}
|
||||
//根据生产任务编号生成子任务编号
|
||||
if (moTask.mo_task_code.IsNotEmptyOrNull())
|
||||
{
|
||||
for (int i = 1; i <= subMoTasks.Count; i++)
|
||||
{
|
||||
string n = i.ToString();
|
||||
subMoTasks[i - 1].mo_task_code = $"{moTask.mo_task_code}-{n.PadLeft(2, '0')}";
|
||||
}
|
||||
}
|
||||
row = await _db.Insertable(subMoTasks).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("组装包装排产时报错", ex);
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
}
|
||||
return row > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务下发,开始 、结束、完成
|
||||
/// </summary>
|
||||
@@ -548,55 +858,75 @@ namespace Tnb.ProductionMgr
|
||||
.SetColumns(it => new PrdMoTask { mo_task_status = status })
|
||||
.Where(it => input.TaskIds.Contains(it.id))
|
||||
.ExecuteCommandAsync();
|
||||
//插入操作记录日志
|
||||
List<PrdTaskLog> taskLogEntities = new();
|
||||
foreach (var taskId in input.TaskIds)
|
||||
if (row > 0)
|
||||
{
|
||||
var taskLog = await db.Queryable<PrdTaskLog>().FirstAsync(it => it.mo_task_id == taskId);
|
||||
if (taskLog is null)
|
||||
//更新子任务
|
||||
var subMoTaskList = await db.Queryable<PrdMoTask>().Where(it => input.TaskIds.Contains(it.parent_id)).ToListAsync();
|
||||
if (subMoTaskList?.Count > 0)
|
||||
{
|
||||
var taskItem = list?.Find(x => x.id == taskId);
|
||||
taskLog = new PrdTaskLog();
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
if (taskItem != null)
|
||||
{
|
||||
if (taskItem.mo_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code;
|
||||
}
|
||||
if (taskItem.eqp_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskItem.eqp_id))?.code;
|
||||
}
|
||||
if (taskItem.mold_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code;
|
||||
}
|
||||
if (taskItem.material_id.IsNotEmptyOrNull())
|
||||
{
|
||||
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == taskItem.material_id);
|
||||
taskLog.item_code = material?.code;
|
||||
taskLog.item_standard = material?.material_standard;
|
||||
}
|
||||
taskLog.operator_name = _userManager.RealName;
|
||||
taskLog.status = status;
|
||||
taskLog.create_id = _userManager.UserId;
|
||||
taskLog.create_time = DateTime.Now;
|
||||
taskLog.mo_task_id = taskItem.id;
|
||||
}
|
||||
taskLogEntities.Add(taskLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (taskLog.status != status)
|
||||
{
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
taskLog.status = status;
|
||||
taskLogEntities.Add(taskLog);
|
||||
}
|
||||
var subTaskIds = subMoTaskList.Select(it => it.id).ToList();
|
||||
row = await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(it => new PrdMoTask { mo_task_status = status })
|
||||
.Where(it => subTaskIds.Contains(it.id))
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
row = await db.Insertable(taskLogEntities).ExecuteCommandAsync();
|
||||
//插入操作记录日志
|
||||
var prdMOTasks = await _db.Queryable<PrdMoTask>().Where(it => input.TaskIds.Contains(it.id) && string.IsNullOrEmpty(it.parent_id)).ToListAsync();
|
||||
if (prdMOTasks?.Count > 0)
|
||||
{
|
||||
List<PrdTaskLog> taskLogEntities = new();
|
||||
foreach (var taskId in input.TaskIds)
|
||||
{
|
||||
var taskLog = await db.Queryable<PrdTaskLog>().FirstAsync(it => it.mo_task_id == taskId);
|
||||
if (taskLog is null)
|
||||
{
|
||||
var taskItem = list?.Find(x => x.id == taskId);
|
||||
taskLog = new PrdTaskLog();
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
if (taskItem != null)
|
||||
{
|
||||
if (taskItem.mo_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.mo_code = (await db.Queryable<PrdMo>().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code;
|
||||
}
|
||||
if (taskItem.eqp_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskItem.eqp_id))?.code;
|
||||
}
|
||||
if (taskItem.mold_id.IsNotEmptyOrNull())
|
||||
{
|
||||
taskLog.mold_code = (await db.Queryable<Molds>().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code;
|
||||
}
|
||||
if (taskItem.material_id.IsNotEmptyOrNull())
|
||||
{
|
||||
var material = await db.Queryable<BasMaterial>().FirstAsync(it => it.id == taskItem.material_id);
|
||||
taskLog.item_code = material?.code;
|
||||
taskLog.item_standard = material?.material_standard;
|
||||
}
|
||||
taskLog.operator_name = _userManager.RealName;
|
||||
taskLog.status = status;
|
||||
taskLog.create_id = _userManager.UserId;
|
||||
taskLog.create_time = DateTime.Now;
|
||||
taskLog.mo_task_id = taskItem.id;
|
||||
}
|
||||
taskLogEntities.Add(taskLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
var records = await db.Queryable<PrdTaskLog>().Where(it => it.mo_task_id == taskLog.mo_task_id).ToListAsync();
|
||||
if (records != null && !records.Select(x => x.status).Contains(status))
|
||||
{
|
||||
|
||||
taskLog.id = SnowflakeIdHelper.NextId();
|
||||
taskLog.status = status;
|
||||
taskLogEntities.Add(taskLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
row = await db.Insertable(taskLogEntities).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
return (row > 0);
|
||||
}
|
||||
|
||||
@@ -667,7 +997,6 @@ namespace Tnb.ProductionMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_code == input.mo_task_code);
|
||||
|
||||
|
||||
if (report is not null)
|
||||
{
|
||||
report.mo_task_code = input.mo_task_code;
|
||||
@@ -818,15 +1147,15 @@ namespace Tnb.ProductionMgr
|
||||
var result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var row = -1;
|
||||
var prdTask = await db.Queryable<PrdTask>().FirstAsync(it => it.id == id);
|
||||
var prdTask = await db.Queryable<PrdMoTask>().FirstAsync(it => it.id == id);
|
||||
row = await db.Deleteable<PrdTask>().Where(it => it.id == id).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
{
|
||||
var prdMo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == prdTask.mo_id);
|
||||
if (prdMo is not null)
|
||||
{
|
||||
prdMo.input_qty += prdTask.scheduled_qty;
|
||||
//prdMo.icmo_status = DictConst.ToBeScheduledEncode;
|
||||
prdMo.scheduled_qty += prdTask.scheduled_qty;
|
||||
prdMo.mo_status = DictConst.ScheduledId;
|
||||
row = await db.Updateable(prdMo).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
using System.Dynamic;
|
||||
using System.Reflection.Emit;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extensitions.EventBus;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.MailList;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entitys.Entity;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionMgr;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class JwtHandler : AppAuthorizeHandler
|
||||
return true;
|
||||
|
||||
// 路由名称
|
||||
if (httpContext.Request.Path.Value == null) return false;
|
||||
var routeName = httpContext.Request.Path.Value[1..].Replace("/", ":");
|
||||
if (httpContext.Request.Path.StartsWithSegments("/api"))
|
||||
routeName = httpContext.Request.Path.Value[5..].Replace("/", ":");
|
||||
@@ -76,6 +77,7 @@ public class JwtHandler : AppAuthorizeHandler
|
||||
|
||||
// 检查授权
|
||||
//return permissionList.Contains(routeName);
|
||||
await Task.CompletedTask;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Startup : AppStartup
|
||||
app.UseInject(string.Empty);
|
||||
|
||||
//app.MapWebSocketManager("/api/message/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetService<IMHandler>());
|
||||
app.MapWebSocketManager("/websocket", serviceProvider.GetRequiredService<IMHandler>());
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<NoWarn>$(NoWarn);CS1591;CA1307;CS8625;CS8600;CS8601;CS8604;CS8618;</NoWarn>
|
||||
<NoWarn>$(NoWarn);CS1591;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
||||
@@ -112,7 +112,7 @@ public static class EnumExtensions
|
||||
{
|
||||
if (field.FieldType.IsEnum)
|
||||
{
|
||||
strValue = ((int)enumType.InvokeMember(field.Name, BindingFlags.GetField, null, null, null)).ToString();
|
||||
strValue = ((int?)enumType.InvokeMember(field.Name, BindingFlags.GetField, null, null, null)).ToString();
|
||||
object[] arr = field.GetCustomAttributes(typeDescription, true);
|
||||
if (arr.Length > 0)
|
||||
{
|
||||
|
||||
@@ -253,7 +253,9 @@ public class ElemeAuthRequest : DefaultAuthRequest
|
||||
{
|
||||
//就是比string往后一直加要好的优化容器
|
||||
StringBuilder sb = new StringBuilder();
|
||||
#pragma warning disable SYSLIB0021 //MD5CryptoServiceProvider已过时
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
#pragma warning disable SYSLIB0021 //MD5CryptoServiceProvider已过时
|
||||
{
|
||||
//将输入字符串转换为字节数组并计算哈希。
|
||||
byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(willMd5Str));
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Text;
|
||||
|
||||
namespace JNPF.Extras.CollectiveOAuth.Utils;
|
||||
|
||||
#pragma warning disable SYSLIB0014 //WebRequest.Create已过时
|
||||
public class HttpUtils
|
||||
{
|
||||
/// <summary>
|
||||
@@ -269,4 +270,5 @@ public class HttpUtils
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#pragma warning restore SYSLIB0014 //WebRequest.Create已过时
|
||||
|
||||
@@ -52,7 +52,7 @@ public class TwitterBase
|
||||
|
||||
#region IComparer<QueryParameter> Members
|
||||
|
||||
public int Compare(QueryParameter x, QueryParameter y)
|
||||
public int Compare(QueryParameter? x, QueryParameter? y)
|
||||
{
|
||||
if (x.Name == y.Name)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS1998;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
350
common/Tnb.Common/DataValidation/Check.cs
Normal file
350
common/Tnb.Common/DataValidation/Check.cs
Normal file
@@ -0,0 +1,350 @@
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Tnb.Common;
|
||||
|
||||
[DebuggerStepThrough]
|
||||
public static class Check
|
||||
{
|
||||
public static T NotNull<T>(T value, string parameterName)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException(parameterName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static T NotNull<T>(
|
||||
T value,
|
||||
string parameterName,
|
||||
string message)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException(parameterName, message);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static string NotNull(
|
||||
string value,
|
||||
string parameterName,
|
||||
int maxLength = int.MaxValue,
|
||||
int minLength = 0)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} can not be null!", parameterName);
|
||||
}
|
||||
|
||||
if (value.Length > maxLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
|
||||
}
|
||||
|
||||
if (minLength > 0 && value.Length < minLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static string NotNullOrWhiteSpace(
|
||||
string value,
|
||||
string parameterName,
|
||||
int maxLength = int.MaxValue,
|
||||
int minLength = 0)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} can not be null, empty or white space!", parameterName);
|
||||
}
|
||||
|
||||
if (value.Length > maxLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
|
||||
}
|
||||
|
||||
if (minLength > 0 && value.Length < minLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static string NotNullOrEmpty(
|
||||
string value,
|
||||
string parameterName,
|
||||
int maxLength = int.MaxValue,
|
||||
int minLength = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} can not be null or empty!", parameterName);
|
||||
}
|
||||
|
||||
if (value.Length > maxLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
|
||||
}
|
||||
|
||||
if (minLength > 0 && value.Length < minLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static ICollection<T> NotNullOrEmpty<T>(ICollection<T> value, string parameterName)
|
||||
{
|
||||
if (value == null || value.Count <= 0)
|
||||
{
|
||||
throw new ArgumentException(parameterName + " can not be null or empty!", parameterName);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Type AssignableTo<TBaseType>(
|
||||
Type type,
|
||||
string parameterName)
|
||||
{
|
||||
NotNull(type, parameterName);
|
||||
|
||||
if (!type.IsAssignableTo(typeof(TBaseType)))
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} (type of {type.AssemblyQualifiedName}) should be assignable to the {typeof(TBaseType).FullName}!");
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public static string Length(
|
||||
[AllowNull] string value,
|
||||
string parameterName,
|
||||
int maxLength,
|
||||
int minLength = 0)
|
||||
{
|
||||
if (minLength > 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
throw new ArgumentException(parameterName + " can not be null or empty!", parameterName);
|
||||
}
|
||||
|
||||
if (value.Length < minLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or bigger than {minLength}!", parameterName);
|
||||
}
|
||||
}
|
||||
|
||||
if (value != null && value.Length > maxLength)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} length must be equal to or lower than {maxLength}!", parameterName);
|
||||
}
|
||||
|
||||
return value!;
|
||||
}
|
||||
|
||||
public static short Positive(
|
||||
short value,
|
||||
string parameterName)
|
||||
{
|
||||
if(value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if(value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Int32 Positive(
|
||||
Int32 value,
|
||||
string parameterName)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Int64 Positive(
|
||||
Int64 value,
|
||||
string parameterName)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static float Positive(
|
||||
float value,
|
||||
string parameterName)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static double Positive(
|
||||
double value,
|
||||
string parameterName)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static decimal Positive(
|
||||
decimal value,
|
||||
string parameterName)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is equal to zero");
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is less than zero");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Int16 Range(
|
||||
Int16 value,
|
||||
string parameterName,
|
||||
Int16 minimumValue,
|
||||
Int16 maximumValue = Int16.MaxValue)
|
||||
{
|
||||
if(value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
public static Int32 Range(
|
||||
Int32 value,
|
||||
string parameterName,
|
||||
Int32 minimumValue,
|
||||
Int32 maximumValue = Int32.MaxValue)
|
||||
{
|
||||
if (value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static Int64 Range(
|
||||
Int64 value,
|
||||
string parameterName,
|
||||
Int64 minimumValue,
|
||||
Int64 maximumValue = Int64.MaxValue)
|
||||
{
|
||||
if (value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static float Range(
|
||||
float value,
|
||||
string parameterName,
|
||||
float minimumValue,
|
||||
float maximumValue = float.MaxValue)
|
||||
{
|
||||
if (value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static double Range(
|
||||
double value,
|
||||
string parameterName,
|
||||
double minimumValue,
|
||||
double maximumValue = double.MaxValue)
|
||||
{
|
||||
if (value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static decimal Range(
|
||||
decimal value,
|
||||
string parameterName,
|
||||
decimal minimumValue,
|
||||
decimal maximumValue = decimal.MaxValue)
|
||||
{
|
||||
if (value < minimumValue || value > maximumValue)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}");
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static T NotDefaultOrNull<T>(
|
||||
T? value,
|
||||
string parameterName)
|
||||
where T : struct
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} is null!", parameterName);
|
||||
}
|
||||
|
||||
if (value.Value.Equals(default(T)))
|
||||
{
|
||||
throw new ArgumentException($"{parameterName} has a default value!", parameterName);
|
||||
}
|
||||
|
||||
return value.Value;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public static class BooleanExtensions
|
||||
/// </summary>
|
||||
private static bool? GetBool(this object data)
|
||||
{
|
||||
switch (data.ToString().Trim().ToLower())
|
||||
switch (data.ToString()?.Trim().ToLower())
|
||||
{
|
||||
case "0":
|
||||
return false;
|
||||
|
||||
@@ -16,7 +16,7 @@ public static class DictionaryExtensions
|
||||
/// <param name="dictionary">要操作的字典.</param>
|
||||
/// <param name="key">指定键名.</param>
|
||||
/// <returns>获取到的值.</returns>
|
||||
public static TValue GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
|
||||
public static TValue? GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
|
||||
{
|
||||
return dictionary.TryGetValue(key, out TValue value) ? value : default(TValue);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public static class EnumExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDescription(this System.Enum value)
|
||||
{
|
||||
return value.GetType().GetMember(value.ToString()).FirstOrDefault()?.GetCustomAttribute<DescriptionAttribute>()?.Description;
|
||||
return value.GetType().GetMember(value.ToString()).FirstOrDefault()?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -162,7 +162,7 @@ public static class EnumExtensions
|
||||
/// <returns></returns>
|
||||
public static string GetDescription(this object value)
|
||||
{
|
||||
return value.GetType().GetMember(value.ToString() ?? string.Empty).FirstOrDefault()?.GetCustomAttribute<DescriptionAttribute>()?.Description;
|
||||
return value.GetType().GetMember(value.ToString() ?? string.Empty).FirstOrDefault()?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -219,7 +219,7 @@ public static partial class Extensions
|
||||
/// </summary>
|
||||
private static bool? GetBool(this object data)
|
||||
{
|
||||
switch (data.ToString().Trim().ToLower())
|
||||
switch (data.ToString()?.Trim().ToLower())
|
||||
{
|
||||
case "0":
|
||||
return false;
|
||||
@@ -466,7 +466,7 @@ public static partial class Extensions
|
||||
{
|
||||
try
|
||||
{
|
||||
return obj == null ? string.Empty : obj.ToString();
|
||||
return obj == null ? string.Empty : obj.ToString()!;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -489,7 +489,7 @@ public static partial class Extensions
|
||||
return string.Join(",", list);
|
||||
}
|
||||
|
||||
return obj.ToString();
|
||||
return obj.ToString()!;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -608,7 +608,7 @@ public static partial class Extensions
|
||||
/// 是否为空.
|
||||
/// </summary>
|
||||
/// <param name="value">值.</param>
|
||||
public static bool IsEmpty(this string value)
|
||||
public static bool IsEmpty(this string? value)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(value);
|
||||
}
|
||||
@@ -678,7 +678,7 @@ public static partial class Extensions
|
||||
/// <returns></returns>
|
||||
public static string ObjToString(this object thisValue)
|
||||
{
|
||||
if (thisValue != null) return thisValue.ToString().Trim();
|
||||
if (thisValue != null) return thisValue.ToString()!.Trim();
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public static class RandomExtensions
|
||||
|
||||
Array array = System.Enum.GetValues(type);
|
||||
int index = random.Next(array.GetLowerBound(0), array.GetUpperBound(0) + 1);
|
||||
return (T)array.GetValue(index);
|
||||
return (T)array.GetValue(index)!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,7 +67,7 @@ public static class RandomExtensions
|
||||
public static T NextItem<T>(this Random random, T[] items)
|
||||
{
|
||||
if (items == null || items.Length == 0)
|
||||
return default(T);
|
||||
return default(T)!;
|
||||
|
||||
return items[random.Next(items.Length)];
|
||||
}
|
||||
|
||||
@@ -950,4 +950,284 @@ public static class StringExtensions
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 转换,来自Abp
|
||||
/// <summary>
|
||||
/// Converts PascalCase string to camelCase string.
|
||||
/// </summary>
|
||||
/// <param name="str">String to convert</param>
|
||||
/// <param name="useCurrentCulture">set true to use current culture. Otherwise, invariant culture will be used.</param>
|
||||
/// <param name="handleAbbreviations">set true to if you want to convert 'XYZ' to 'xyz'.</param>
|
||||
/// <returns>camelCase of the string</returns>
|
||||
public static string ToCamelCase(this string str, bool useCurrentCulture = false, bool handleAbbreviations = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
if (str.Length == 1)
|
||||
{
|
||||
return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant();
|
||||
}
|
||||
|
||||
if (handleAbbreviations && IsAllUpperCase(str))
|
||||
{
|
||||
return useCurrentCulture ? str.ToLower() : str.ToLowerInvariant();
|
||||
}
|
||||
|
||||
return (useCurrentCulture ? char.ToLower(str[0]) : char.ToLowerInvariant(str[0])) + str.Substring(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts given PascalCase/camelCase string to sentence (by splitting words by space).
|
||||
/// Example: "ThisIsSampleSentence" is converted to "This is a sample sentence".
|
||||
/// </summary>
|
||||
/// <param name="str">String to convert.</param>
|
||||
/// <param name="useCurrentCulture">set true to use current culture. Otherwise, invariant culture will be used.</param>
|
||||
public static string ToSentenceCase(this string str, bool useCurrentCulture = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
return useCurrentCulture
|
||||
? Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLower(m.Value[1]))
|
||||
: Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLowerInvariant(m.Value[1]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts given PascalCase/camelCase string to kebab-case.
|
||||
/// </summary>
|
||||
/// <param name="str">String to convert.</param>
|
||||
/// <param name="useCurrentCulture">set true to use current culture. Otherwise, invariant culture will be used.</param>
|
||||
public static string ToKebabCase(this string str, bool useCurrentCulture = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
str = str.ToCamelCase();
|
||||
|
||||
return useCurrentCulture
|
||||
? Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + "-" + char.ToLower(m.Value[1]))
|
||||
: Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + "-" + char.ToLowerInvariant(m.Value[1]));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts given PascalCase/camelCase string to snake case.
|
||||
/// Example: "ThisIsSampleSentence" is converted to "this_is_a_sample_sentence".
|
||||
/// https://github.com/npgsql/npgsql/blob/dev/src/Npgsql/NameTranslation/NpgsqlSnakeCaseNameTranslator.cs#L51
|
||||
/// </summary>
|
||||
/// <param name="str">String to convert.</param>
|
||||
/// <returns></returns>
|
||||
public static string ToSnakeCase(this string str)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
var builder = new StringBuilder(str.Length + Math.Min(2, str.Length / 5));
|
||||
var previousCategory = default(UnicodeCategory?);
|
||||
|
||||
for (var currentIndex = 0; currentIndex < str.Length; currentIndex++)
|
||||
{
|
||||
var currentChar = str[currentIndex];
|
||||
if (currentChar == '_')
|
||||
{
|
||||
builder.Append('_');
|
||||
previousCategory = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
var currentCategory = char.GetUnicodeCategory(currentChar);
|
||||
switch (currentCategory)
|
||||
{
|
||||
case UnicodeCategory.UppercaseLetter:
|
||||
case UnicodeCategory.TitlecaseLetter:
|
||||
if (previousCategory == UnicodeCategory.SpaceSeparator ||
|
||||
previousCategory == UnicodeCategory.LowercaseLetter ||
|
||||
previousCategory != UnicodeCategory.DecimalDigitNumber &&
|
||||
previousCategory != null &&
|
||||
currentIndex > 0 &&
|
||||
currentIndex + 1 < str.Length &&
|
||||
char.IsLower(str[currentIndex + 1]))
|
||||
{
|
||||
builder.Append('_');
|
||||
}
|
||||
|
||||
currentChar = char.ToLower(currentChar);
|
||||
break;
|
||||
|
||||
case UnicodeCategory.LowercaseLetter:
|
||||
case UnicodeCategory.DecimalDigitNumber:
|
||||
if (previousCategory == UnicodeCategory.SpaceSeparator)
|
||||
{
|
||||
builder.Append('_');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (previousCategory != null)
|
||||
{
|
||||
previousCategory = UnicodeCategory.SpaceSeparator;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.Append(currentChar);
|
||||
previousCategory = currentCategory;
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts camelCase string to PascalCase string.
|
||||
/// </summary>
|
||||
/// <param name="str">String to convert</param>
|
||||
/// <param name="useCurrentCulture">set true to use current culture. Otherwise, invariant culture will be used.</param>
|
||||
/// <returns>PascalCase of the string</returns>
|
||||
public static string ToPascalCase(this string str, bool useCurrentCulture = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
if (str.Length == 1)
|
||||
{
|
||||
return useCurrentCulture ? str.ToUpper() : str.ToUpperInvariant();
|
||||
}
|
||||
|
||||
return (useCurrentCulture ? char.ToUpper(str[0]) : char.ToUpperInvariant(str[0])) + str.Substring(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes first occurrence of the given prefixes from beginning of the given string.
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="preFixes">one or more prefix.</param>
|
||||
/// <returns>Modified string or the same string if it has not any of given prefixes</returns>
|
||||
public static string RemovePreFix(this string str, params string[] preFixes)
|
||||
{
|
||||
return str.RemovePreFix(StringComparison.Ordinal, preFixes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes first occurrence of the given prefixes from beginning of the given string.
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="comparisonType">String comparison type</param>
|
||||
/// <param name="preFixes">one or more prefix.</param>
|
||||
/// <returns>Modified string or the same string if it has not any of given prefixes</returns>
|
||||
public static string RemovePreFix(this string str, StringComparison comparisonType, params string[] preFixes)
|
||||
{
|
||||
if (str.IsNullOrEmpty())
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
if (preFixes.IsNullOrEmpty())
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
foreach (var preFix in preFixes)
|
||||
{
|
||||
if (str.StartsWith(preFix, comparisonType))
|
||||
{
|
||||
return str.Right(str.Length - preFix.Length);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes first occurrence of the given postfixes from end of the given string.
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="postFixes">one or more postfix.</param>
|
||||
/// <returns>Modified string or the same string if it has not any of given postfixes</returns>
|
||||
public static string RemovePostFix(this string str, params string[] postFixes)
|
||||
{
|
||||
return str.RemovePostFix(StringComparison.Ordinal, postFixes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes first occurrence of the given postfixes from end of the given string.
|
||||
/// </summary>
|
||||
/// <param name="str">The string.</param>
|
||||
/// <param name="comparisonType">String comparison type</param>
|
||||
/// <param name="postFixes">one or more postfix.</param>
|
||||
/// <returns>Modified string or the same string if it has not any of given postfixes</returns>
|
||||
public static string RemovePostFix(this string str, StringComparison comparisonType, params string[] postFixes)
|
||||
{
|
||||
if (str.IsNullOrEmpty())
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
if (postFixes.IsNullOrEmpty())
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
foreach (var postFix in postFixes)
|
||||
{
|
||||
if (str.EndsWith(postFix, comparisonType))
|
||||
{
|
||||
return str.Left(str.Length - postFix.Length);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a substring of a string from beginning of the string.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="str"/> is null</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="len"/> is bigger that string's length</exception>
|
||||
public static string Left(this string str, int len)
|
||||
{
|
||||
if (str.Length < len)
|
||||
{
|
||||
throw new ArgumentException("len argument can not be bigger than given string's length!");
|
||||
}
|
||||
|
||||
return str.Substring(0, len);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a substring of a string from end of the string.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="str"/> is null</exception>
|
||||
/// <exception cref="ArgumentException">Thrown if <paramref name="len"/> is bigger that string's length</exception>
|
||||
public static string Right(this string str, int len)
|
||||
{
|
||||
if (str.Length < len)
|
||||
{
|
||||
throw new ArgumentException("len argument can not be bigger than given string's length!");
|
||||
}
|
||||
|
||||
return str.Substring(str.Length - len, len);
|
||||
}
|
||||
private static bool IsAllUpperCase(string input)
|
||||
{
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
if (Char.IsLetter(input[i]) && !Char.IsUpper(input[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -111,10 +111,10 @@ public class UserAgent : IUserAgent
|
||||
private DeviceInfo _device;
|
||||
private OSInfo _os;
|
||||
|
||||
private bool? _isBot;
|
||||
//private bool? _isBot;
|
||||
private bool? _isMobileDevice;
|
||||
private bool? _isTablet;
|
||||
private bool? _isPdfConverter;
|
||||
//private bool? _isPdfConverter;
|
||||
|
||||
static UserAgent()
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public class UserAgent : IUserAgent
|
||||
}
|
||||
}
|
||||
|
||||
return _rawValue;
|
||||
return _rawValue ?? "";
|
||||
}
|
||||
|
||||
set
|
||||
@@ -151,10 +151,10 @@ public class UserAgent : IUserAgent
|
||||
_userAgent = null;
|
||||
_device = null;
|
||||
_os = null;
|
||||
_isBot = null;
|
||||
//_isBot = null;
|
||||
_isMobileDevice = null;
|
||||
_isTablet = null;
|
||||
_isPdfConverter = null;
|
||||
//_isPdfConverter = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public static class CodeGenExportDataHelper
|
||||
|
||||
var len = rowChildDatas.Select(x => x.Value.Count()).OrderByDescending(x => x).FirstOrDefault();
|
||||
|
||||
if (len != null && len > 0)
|
||||
if (len > 0)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ public static class CodeGenHelper
|
||||
field = entityInfo.Columns.Find(it => it.PropertyName.Equals(sort.ToUpperCase()))?.DbColumnName;
|
||||
break;
|
||||
}
|
||||
return string.IsNullOrEmpty(field) ? null : field;
|
||||
return string.IsNullOrEmpty(field) ? "" : field;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -63,7 +63,7 @@ public static class ComparisonHelper<T>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int Compare(T x, T y)
|
||||
public int Compare(T? x, T? y)
|
||||
{
|
||||
return _comparer.Compare(_keySelector(x), _keySelector(y));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.Common.Security;
|
||||
|
||||
@@ -49,14 +50,14 @@ public static class EqualityHelper<T>
|
||||
: this(keySelector, EqualityComparer<TV>.Default)
|
||||
{ }
|
||||
|
||||
public bool Equals(T x, T y)
|
||||
public bool Equals(T? x, T? y)
|
||||
{
|
||||
return _comparer.Equals(_keySelector(x), _keySelector(y));
|
||||
}
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
public int GetHashCode([DisallowNull] T obj)
|
||||
{
|
||||
return _comparer.GetHashCode(_keySelector(obj));
|
||||
return _comparer.GetHashCode(_keySelector(obj)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using JNPF.Common.Helper;
|
||||
using JNPF.Common.Models.NPOI;
|
||||
using JNPF.DependencyInjection;
|
||||
using NPOI.HPSF;
|
||||
@@ -8,9 +9,13 @@ using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.SS.Util;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using Spire.Doc;
|
||||
using static Microsoft.AspNetCore.Razor.Language.TagHelperMetadata;
|
||||
|
||||
namespace JNPF.Common.Security;
|
||||
|
||||
#pragma warning disable CS0618, CA2200 //再次引发捕获到的异常会更改堆栈信息
|
||||
|
||||
/// <summary>
|
||||
/// Excel导出操作类
|
||||
/// 版 本:V3.2.0
|
||||
@@ -740,7 +745,7 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1039,7 +1044,7 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1168,4 +1173,5 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0618, CA2200 //再次引发捕获到的异常会更改堆栈信息
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace JNPF.Common.Helper
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
dataRow[j] = cell.ToString().Trim();
|
||||
dataRow[j] = cell.ToString()?.Trim();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +494,9 @@ public class FileHelper
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#pragma warning disable CA2200 //再次引发捕获到的异常会更改堆栈信息
|
||||
throw ex;
|
||||
#pragma warning disable CA2200 //再次引发捕获到的异常会更改堆栈信息
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -505,6 +507,7 @@ public class FileHelper
|
||||
|
||||
#endregion
|
||||
|
||||
#pragma warning disable CA1416 // 验证平台兼容性
|
||||
#region 生成高清晰缩略图
|
||||
|
||||
/// <summary>
|
||||
@@ -669,6 +672,7 @@ public class FileHelper
|
||||
}
|
||||
|
||||
#endregion
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
|
||||
#region 将文件路径转为内存流
|
||||
|
||||
@@ -712,7 +716,8 @@ public class FileHelper
|
||||
|
||||
if (selectFiles.Count > 0)
|
||||
{
|
||||
return selectFiles.FirstOrDefault().FullName;
|
||||
//modified by PhilPan
|
||||
return selectFiles.First().FullName;
|
||||
}
|
||||
|
||||
return Path.Combine(folderPath, $@"{prefix}_{DateTime.Now.ParseToUnixTime()}.log");
|
||||
@@ -737,7 +742,7 @@ public class FileHelper
|
||||
Microsoft.AspNetCore.Http.HttpContext? httpContext = App.HttpContext;
|
||||
httpContext.Response.ContentType = "application/octet-stream";
|
||||
httpContext.Response.Headers.Add("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8));
|
||||
httpContext.Response.Headers.Add("Content-Length", buff.Length.ToString());
|
||||
httpContext.Response.Headers.Add("Content-Length", buff?.Length.ToString());
|
||||
httpContext.Response.Body.WriteAsync(buff);
|
||||
httpContext.Response.Body.Flush();
|
||||
httpContext.Response.Body.Close();
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this string json)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<T>(json) ?? default(T);
|
||||
return _jsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +58,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this string json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<T>(json, jsonSerializerOptions) ?? default(T);
|
||||
return _jsonSerializer.Deserialize<T>(json, jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,7 +69,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this object json)
|
||||
{
|
||||
return _ = ToJsonString(json).ToObject<T>() ?? default(T);
|
||||
return ToJsonString(json).ToObject<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this object json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = ToJsonString(json, jsonSerializerOptions).ToObject<T>(jsonSerializerOptions) ?? default(T);
|
||||
return ToJsonString(json, jsonSerializerOptions).ToObject<T>(jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,7 +92,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static List<T> ToList<T>(this string json)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<List<T>>(json) ?? null;
|
||||
return _jsonSerializer.Deserialize<List<T>>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -104,7 +104,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static List<T> ToList<T>(this string json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<List<T>>(json, jsonSerializerOptions) ?? null;
|
||||
return _jsonSerializer.Deserialize<List<T>>(json, jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -217,6 +217,7 @@ public static class MachineHelper
|
||||
}
|
||||
#endregion
|
||||
|
||||
#pragma warning disable CA1416 // 验证平台兼容性
|
||||
#region Windows
|
||||
|
||||
/// <summary>
|
||||
@@ -364,4 +365,6 @@ public static class MachineHelper
|
||||
}
|
||||
|
||||
#endregion
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class SuperQueryHelper
|
||||
{
|
||||
case JnpfKeyConst.COMINPUT:
|
||||
case JnpfKeyConst.TEXTAREA:
|
||||
item.fieldValue = item.fieldValue?.ToString().Replace("\r\n", string.Empty);
|
||||
item.fieldValue = item.fieldValue?.ToString()?.Replace("\r\n", string.Empty);
|
||||
switch (item.symbol)
|
||||
{
|
||||
case "==": // 等于
|
||||
@@ -549,8 +549,9 @@ public class SuperQueryHelper
|
||||
queryOr.mainWhere = true;
|
||||
queryList.Add(queryOr);
|
||||
}
|
||||
//modified by PhilPan
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
switch (item.symbol)
|
||||
{
|
||||
case ">=": // 大于等于
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8618;CS8619;CS8625;CS1572;CS1573;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.60" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.73" />
|
||||
<PackageReference Include="Tnb.Core" Version="2023.3.24.1010" />
|
||||
<!--<ProjectReference Include="..\..\..\Tnb.Core\Tnb.Core\Tnb.Core.csproj" />-->
|
||||
</ItemGroup>
|
||||
|
||||
1
common/Tnb.Thirdparty/Tnb.Thirdparty.csproj
vendored
1
common/Tnb.Thirdparty/Tnb.Thirdparty.csproj
vendored
@@ -7,6 +7,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS0618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS1572;CS1573;CS1998;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -44,12 +44,14 @@ public class OrderService : IDynamicApiController, ITransient
|
||||
ISqlSugarRepository<OrderEntity> repository,
|
||||
IUserManager userManager,
|
||||
IUsersService usersService,
|
||||
ICacheManager cacheManager)
|
||||
ICacheManager cacheManager,
|
||||
IFileManager fileManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_usersService = usersService;
|
||||
_cacheManager = cacheManager;
|
||||
_fileManager = fileManager;
|
||||
}
|
||||
|
||||
#region GET
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;CS0168;CS4014;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;CS0168;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS1572;CS1573;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -7,10 +7,11 @@ namespace JNPF.Systems.Entitys.Dto.OrganizeAdministrator;
|
||||
/// </summary>
|
||||
public class OrganizeAdminIsTratorUpInput : OrganizeAdminCrInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键.
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 主键.
|
||||
///// </summary>
|
||||
//public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限组织集合.
|
||||
|
||||
@@ -44,11 +44,11 @@ public class AuthorizeEntity : CEntityBase
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public override bool Equals(object obj)
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj is AuthorizeEntity)
|
||||
if (obj is AuthorizeEntity authorizeEntity)
|
||||
{
|
||||
AuthorizeEntity authorizeEntity = obj as AuthorizeEntity;
|
||||
//AuthorizeEntity authorizeEntity = obj as AuthorizeEntity;
|
||||
return ItemType == authorizeEntity.ItemType && ItemId == authorizeEntity.ItemId && ObjectId == authorizeEntity.ObjectId && ObjectType == authorizeEntity.ObjectType;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8603;CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -386,51 +386,39 @@ public class DataBaseService : IDynamicApiController, ITransient
|
||||
sugarClient = _dataBaseManager.ChangeDataBase(link);
|
||||
}
|
||||
|
||||
string CustomFormatName(string s)
|
||||
var entityName = string.Join("", input.TableName.Split('_').Select(a => a.ToPascalCase()));
|
||||
foreach (var item in sugarClient.DbMaintenance.GetTableInfoList().Where(t => t.Name == input.TableName))
|
||||
{
|
||||
var pos = 0;
|
||||
if ((pos = s.IndexOf("_", StringComparison.Ordinal)) > -1)
|
||||
{
|
||||
var separatorStrings = Regex.Split(s, @"_", RegexOptions.Compiled);
|
||||
if (separatorStrings.Length > 2)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var item in separatorStrings)
|
||||
{
|
||||
sb.Append(item.ToUpperCase());
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
var first = s.AsSpan().Slice(0, pos).ToString().ToUpperCase();
|
||||
var second = s.AsSpan().Slice(pos + 1).ToString().ToUpperCase();
|
||||
return $"{first}{second}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return s.ToUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in sugarClient!.DbMaintenance.GetTableInfoList().Where(t => t.Name == input.TableName))
|
||||
{
|
||||
string entityName = CustomFormatName(item.Name);/*实体名首字母大写*/
|
||||
//string entityName = CustomFormatName(item.Name);/*实体名首字母大写*/
|
||||
sugarClient.MappingTables.Add(entityName, item.Name);
|
||||
foreach (var col in sugarClient.DbMaintenance.GetColumnInfosByTableName(item.Name))
|
||||
{
|
||||
//var colName = CustomFormatName(col.DbColumnName);
|
||||
sugarClient.MappingColumns.Add(col.DbColumnName /*类的属性首字母大写*/, col.DbColumnName, entityName);
|
||||
}
|
||||
//foreach (var col in sugarClient.DbMaintenance.GetColumnInfosByTableName(item.Name))
|
||||
//{
|
||||
// //var colName = CustomFormatName(col.DbColumnName);
|
||||
// sugarClient.MappingColumns.Add(col.DbColumnName /*类的属性首字母大写*/, col.DbColumnName, entityName);
|
||||
//}
|
||||
}
|
||||
var prefix = input.TableName.Split('_')[0];
|
||||
Dictionary<string, string> nsMapper = new()
|
||||
{
|
||||
{"bas", "Tnb.BasicData.Entities" },
|
||||
{"prd", "Tnb.ProductionMgr.Entities" },
|
||||
{"wms", "Tnb.WarehouseMgr.Entities" },
|
||||
{"eqp", "Tnb.EquipMgr.Entities" },
|
||||
{"tool", "Tnb.EquipMgr.Entities" },
|
||||
{"qc", "Tnb.QcMgr.Entities" },
|
||||
};
|
||||
sugarClient.DbFirst.Where(input.TableName)
|
||||
.FormatFileName(CustomFormatName)
|
||||
.SettingConstructorTemplate(a =>
|
||||
{
|
||||
return a;
|
||||
})
|
||||
//.IsCreateDefaultValue(true)
|
||||
.IsCreateAttribute()
|
||||
.CreateClassFile(dir, "DbModels");
|
||||
.StringNullable()
|
||||
.CreateClassFile(dir, nsMapper.ContainsKey(prefix) ? nsMapper[prefix] : "Tnb.Entities");
|
||||
|
||||
var previewContent = "";
|
||||
var codeFile = Path.Combine(dir, $"{CustomFormatName(input.TableName)}.cs");
|
||||
var codeFile = Path.Combine(dir, $"{entityName}.cs");
|
||||
if (File.Exists(codeFile))
|
||||
{
|
||||
using (var sr = File.OpenText(codeFile))
|
||||
|
||||
@@ -1010,7 +1010,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
|
||||
|
||||
// 将逗号替换成一个单引号、逗号、单引号
|
||||
item.defaultValue = item.defaultValue?.Replace(",", "','");
|
||||
entity.Query = entity.Query?.Replace("{" + item.field + "}", "'" + item.defaultValue + "'");
|
||||
entity.Query = entity.Query?.Replace("{" + item.field + "}", item.defaultValue); //自动加引号去掉 modify by ly on 20230515
|
||||
}
|
||||
else
|
||||
entity.Query = entity.Query?.Replace("{" + item.field + "}", item.defaultValue);
|
||||
|
||||
@@ -143,7 +143,7 @@ public class ModuleDataAuthorizeSchemeService : IModuleDataAuthorizeSchemeServic
|
||||
/// <param name="moduleId">功能主键.</param>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
public async Task<List<ModuleDataAuthorizeSchemeEntity>> GetList(string moduleId)
|
||||
public async Task<List<ModuleDataAuthorizeSchemeEntity>> GetList(string? moduleId)
|
||||
{
|
||||
return await _repository.AsQueryable().Where(x => x.DeleteMark == null && x.ModuleId == moduleId).OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc).OrderBy(a => a.LastModifyTime, OrderByType.Desc).ToListAsync();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn)CS8604;CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,11 +1,186 @@
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Logging;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
namespace JNPF.TaskScheduler.Listener
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成点巡检计划
|
||||
/// </summary>
|
||||
public class GenerateSpotInspectionPlanTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
[SpareTime("0 45 14 * * ? *", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||
private ISqlSugarRepository<EqpSpotInsTemEquipH> _repository => App.GetService<ISqlSugarRepository<EqpSpotInsTemEquipH>>();
|
||||
// public GenerateSpotInspectionPlanTimeWorker(ISqlSugarRepository<EqpSpotInsTemEquipH> repository)
|
||||
// {
|
||||
// _repository = repository;
|
||||
// }
|
||||
|
||||
[SpareTime("0 0 0 * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
|
||||
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||
{
|
||||
Console.WriteLine("hello world");
|
||||
Log.Information("----------------------开始生成点巡检计划----------------------");
|
||||
|
||||
try
|
||||
{
|
||||
List<EqpSpotInsTemEquipH> eqpSpotInsTemEquipHsByOne = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "1");
|
||||
List<EqpSpotInsTemEquipH> eqpSpotInsTemEquipHsByCirculate = _repository.GetList(x => x.is_start=="1" && x.plan_cycle_unit == "2");
|
||||
List<EqpSpotInsRecordH> tobeCreateList = new List<EqpSpotInsRecordH>();
|
||||
List<EqpSpotInsTemEquipH> tobeCreateTemplets = new List<EqpSpotInsTemEquipH>();
|
||||
var db = _repository.AsSugarClient();
|
||||
|
||||
foreach (var item in eqpSpotInsTemEquipHsByOne)
|
||||
{
|
||||
if (item.start_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd HH:mm") == DateTime.Now.ToString("yyyy-MM-dd HH:mm"))
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (eqpSpotInsTemEquipHsByCirculate != null && eqpSpotInsTemEquipHsByCirculate.Count > 0)
|
||||
{
|
||||
//查询最后一条数据加上周期是否等于现在等于表示周期到了 已废除
|
||||
// List<string> ids = eqpSpotInsTemEquipHsByCirculate.Select(x => x.id).ToList();
|
||||
// List<SpotInsRecordLastDTO> lastPlans = db.Queryable<EqpSpotInsRecordH>()
|
||||
// .GroupBy(a => new { a.spot_ins_tem_equip_id })
|
||||
// .Where(a => ids.Contains(a.spot_ins_tem_equip_id))
|
||||
// .Select(a => new SpotInsRecordLastDTO()
|
||||
// {
|
||||
// spot_ins_tem_equip_id = a.spot_ins_tem_equip_id,
|
||||
// create_time = SqlFunc.AggregateMax(a.create_time.Value)
|
||||
// }).ToList();
|
||||
//
|
||||
// foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
// {
|
||||
// var lastPlan = lastPlans.FirstOrDefault(x => x.spot_ins_tem_equip_id == item.id);
|
||||
// if (lastPlan == null || lastPlan.create_time == null || lastPlan.create_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd HH") == DateTime.Now.ToString("yyyy-MM-dd HH"))
|
||||
// {
|
||||
// tobeCreateTemplets.Add(item);
|
||||
// }
|
||||
// }
|
||||
|
||||
//整除表示一个周期到了
|
||||
foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
{
|
||||
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm")).Ticks);
|
||||
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd HH:mm")).Ticks);
|
||||
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
if (ts3.TotalMinutes * 10 / 60 % (10 * (double)item.plan_cycle)==0)
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tobeCreateTemplets != null && tobeCreateTemplets.Count > 0)
|
||||
{
|
||||
List<EqpEquipment> equipments = db.Queryable<EqpEquipment>().Where(x => x.life==Tnb.EquipMgr.EquipmentLife.ENABLE).ToList();
|
||||
int index = 1;
|
||||
foreach (var item in tobeCreateTemplets)
|
||||
{
|
||||
//只有启用设备才生成计划
|
||||
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||
continue;
|
||||
|
||||
string code = $"{DateTime.Now.ToString("yyyyMMddHHmm")+(index++).ToString().PadLeft(3,'0')}";
|
||||
tobeCreateList.Add(new EqpSpotInsRecordH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
code = code,
|
||||
// equip_type_id = item.equip_type_id,
|
||||
equip_id = item.equip_id,
|
||||
spot_ins_tem_equip_id = item.id,
|
||||
plan_run_notice = item.plan_run_notice,
|
||||
plan_run_notice_unit = item.plan_run_notice_unit,
|
||||
plan_delay = item.plan_delay,
|
||||
plan_delay_unit = item.plan_delay_unit,
|
||||
send_post_info_user_id = item.send_post_info_user_id,
|
||||
is_repeat = item.is_repeat,
|
||||
repeat_post_info_user_id = item.repeat_post_info_user_id,
|
||||
is_send = item.is_send,
|
||||
create_time = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||
{
|
||||
List<string> templetIDs = tobeCreateList.Select(x => x.spot_ins_tem_equip_id).ToList();
|
||||
List<EqpSpotInsTemEquipD> spotInsTemEquipDs = db.Queryable<EqpSpotInsTemEquipD>().Where(x => templetIDs.Contains(x.spot_ins_tem_equip_id)).ToList();
|
||||
List<string> spotInsItemIDs = spotInsTemEquipDs.Select(x => x.spot_ins_item_id).ToList();
|
||||
List<EqpSpotInsItem> spotCheckItems = db.Queryable<EqpSpotInsItem>().Where(x => spotInsItemIDs.Contains(x.id)).ToList();
|
||||
|
||||
|
||||
foreach (var tobeCreatePlan in tobeCreateList)
|
||||
{
|
||||
List<EqpSpotInsRecordD> spotInsRecordDs = new List<EqpSpotInsRecordD>();
|
||||
List<string> spotInsItems = spotInsTemEquipDs
|
||||
.Where(x => x.spot_ins_tem_equip_id == tobeCreatePlan.spot_ins_tem_equip_id)
|
||||
.Select(x => x.spot_ins_item_id).ToList();
|
||||
List<EqpSpotInsItem> tobeCreateItems = spotCheckItems.Where(x => spotInsItems.Contains(x.id)).ToList();
|
||||
foreach (var tobeCreateItem in tobeCreateItems)
|
||||
{
|
||||
spotInsRecordDs.Add(new EqpSpotInsRecordD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
spot_ins_record_id = tobeCreatePlan.id,
|
||||
spot_ins_tem_equip_id = tobeCreatePlan.spot_ins_tem_equip_id,
|
||||
spot_ins_item_id = tobeCreateItem.id,
|
||||
code = tobeCreateItem.code,
|
||||
name = tobeCreateItem.name,
|
||||
judge_type = tobeCreateItem.judge_type,
|
||||
low_value = tobeCreateItem.low_value,
|
||||
high_value = tobeCreateItem.high_value,
|
||||
low_value_is_include = tobeCreateItem.low_value_is_include,
|
||||
high_value_is_include = tobeCreateItem.high_value_is_include,
|
||||
standard_value = tobeCreateItem.standard_value,
|
||||
unit_id = tobeCreateItem.unit_id,
|
||||
inspection_method = tobeCreateItem.inspection_method,
|
||||
judge_content = tobeCreateItem.judge_content,
|
||||
remark = tobeCreateItem.remark
|
||||
});
|
||||
}
|
||||
|
||||
var dbResult = db.Ado.UseTran(() =>
|
||||
{
|
||||
if (tobeCreateList != null && tobeCreateList.Count > 0)
|
||||
{
|
||||
db.Insertable<EqpSpotInsRecordH>(tobeCreateList).ExecuteCommand();
|
||||
}
|
||||
|
||||
if (spotInsRecordDs != null && spotInsRecordDs.Count > 0)
|
||||
{
|
||||
db.Insertable<EqpSpotInsRecordD>(spotInsRecordDs).ExecuteCommand();
|
||||
}
|
||||
});
|
||||
if (!dbResult.IsSuccess)
|
||||
{
|
||||
Console.WriteLine(dbResult.ErrorMessage);
|
||||
Log.Error(dbResult.ErrorMessage);
|
||||
}
|
||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
Log.Error(e.Message);
|
||||
}
|
||||
|
||||
|
||||
Log.Information("----------------------结束生成点巡检计划----------------------");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 最后一个点巡检记录
|
||||
/// </summary>
|
||||
private class SpotInsRecordLastDTO
|
||||
{
|
||||
public string spot_ins_tem_equip_id { get; set; }
|
||||
public DateTime create_time { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,8 @@ public class SpareTimeListener : ISpareTimeListener, ISingleton
|
||||
}
|
||||
|
||||
var taskEntity = await _sqlSugarClient.Queryable<TimeTaskEntity>().FirstAsync(x => x.Id == executer.Timer.WorkerName);
|
||||
var nextRunTime = ((DateTimeOffset)SpareTime.GetCronNextOccurrence(taskEntity.ExecuteCycleJson)).DateTime;
|
||||
//modified by PhilPan
|
||||
var nextRunTime = SpareTime.GetCronNextOccurrence(taskEntity.ExecuteCycleJson)?.DateTime;
|
||||
|
||||
await _eventPublisher.PublishAsync(new TaskEventSource("Task:UpdateTask", connectionConfig, new TimeTaskEntity()
|
||||
{
|
||||
|
||||
@@ -324,11 +324,12 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
Action<SpareTimer, long>? action = null;
|
||||
ContentModel? comtentModel = input.ExecuteContent.ToObject<ContentModel>();
|
||||
input.ExecuteCycleJson = comtentModel.cron;
|
||||
TaskMethodInfo? taskMethod = null;
|
||||
switch (input.ExecuteType)
|
||||
{
|
||||
case "3":
|
||||
// 查询符合条件的任务方法
|
||||
TaskMethodInfo? taskMethod = GetTaskMethods()?.Result.FirstOrDefault(m => m.id == comtentModel.localHostTaskId);
|
||||
taskMethod = GetTaskMethods()?.Result.FirstOrDefault(m => m.id == comtentModel.localHostTaskId);
|
||||
if (taskMethod == null) break;
|
||||
|
||||
// 创建任务对象
|
||||
@@ -354,20 +355,20 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie
|
||||
{
|
||||
interval = (starTime.ParseToDateTime() - DateTime.Now).TotalMilliseconds.ParseToInt();
|
||||
}
|
||||
SpareTime.DoOnce(interval, action, "Once_" + input.Id);
|
||||
SpareTime.Do(
|
||||
() =>
|
||||
{
|
||||
var isRun = comtentModel.endTime.IsNullOrEmpty() ? DateTime.Now >= starTime : DateTime.Now >= starTime && DateTime.Now < endTime;
|
||||
if (isRun)
|
||||
{
|
||||
return SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
if (taskMethod.StartNow) //modifyby zhoukeda 20230516
|
||||
{
|
||||
SpareTime.DoOnce(interval, action, "Once_" + input.Id);
|
||||
}
|
||||
|
||||
Func<DateTimeOffset?> nextHandle = null;
|
||||
var isRun = comtentModel.endTime.IsNullOrEmpty() ? DateTime.Now >= starTime : DateTime.Now >= starTime && DateTime.Now < endTime;
|
||||
if (isRun)
|
||||
{
|
||||
nextHandle = ()=>SpareTime.GetCronNextOccurrence(comtentModel.cron);
|
||||
}
|
||||
SpareTime.Do(nextHandle
|
||||
,
|
||||
action, input.Id, comtentModel.ConnectionConfig.ToJsonString(), true, executeType: SpareTimeExecuteTypes.Parallel, cancelInNoneNextTime: false);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,18 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS1572;CS1573;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Tnb.TaskScheduler.Interfaces\Tnb.TaskScheduler.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Tnb.Core" Version="2023.3.24.1010" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1269,7 +1269,6 @@ public class CodeGenWay
|
||||
IsRelationForm = isRelationForm,
|
||||
ChildTableStyle = columnDesignModel.childTableStyle,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
return new FrontEndGenConfigModel()
|
||||
{
|
||||
@@ -1339,7 +1338,6 @@ public class CodeGenWay
|
||||
ChildTableStyle = columnDesignModel.childTableStyle,
|
||||
IsFixed = isFixed,
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,11 @@ namespace JNPF.VisualDev.Engine;
|
||||
[SuppressSniffer]
|
||||
public class IndexGridFieldModel : IndexEachConfigBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 对齐.
|
||||
/// </summary>
|
||||
public string align { get; set; }
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 对齐.
|
||||
///// </summary>
|
||||
//public string align { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 固定.
|
||||
|
||||
@@ -14,8 +14,9 @@ public class IndexSearchFieldModel : IndexEachConfigBase
|
||||
/// </summary>
|
||||
public string value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询类型.
|
||||
/// </summary>
|
||||
public int? searchType { get; set; }
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 查询类型.
|
||||
///// </summary>
|
||||
//public int? searchType { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8618;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -8,10 +8,11 @@ namespace JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
/// </summary>
|
||||
public class VisualDevModelListQueryInput : PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单ID.
|
||||
/// </summary>
|
||||
public string menuId { get; set; }
|
||||
//modified by PhilPan
|
||||
///// <summary>
|
||||
///// 菜单ID.
|
||||
///// </summary>
|
||||
//public string menuId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择导出数据key.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -57,10 +57,10 @@ public class RunService : IRunService, ITransient
|
||||
/// </summary>
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存管理.
|
||||
/// </summary>
|
||||
private readonly ICacheManager _cacheManager;
|
||||
///// <summary>
|
||||
///// 缓存管理.
|
||||
///// </summary>
|
||||
//private readonly ICacheManager _cacheManager;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8625;CS8629;CS1572;CS1573;CS0168;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -872,7 +872,7 @@ namespace JNPF.VisualDev
|
||||
|
||||
var len = rowChildDatas.Select(x => x.Value.Count()).OrderByDescending(x => x).FirstOrDefault();
|
||||
|
||||
if (len != null && len > 0)
|
||||
if (len > 0)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
|
||||
@@ -1281,7 +1281,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
foreach (DbTableAndFieldModel? item in addTableList)
|
||||
{
|
||||
bool res = await _changeDataBase.Create(link, item, item.FieldList);
|
||||
if (!res) throw null;
|
||||
if (!res) Oops.Oh(ErrorCode.COM1008); // throw null;
|
||||
}
|
||||
|
||||
if (await _visualDevRepository.IsAnyAsync(x => x.Id.Equals(vEntity.Id)))
|
||||
|
||||
@@ -409,7 +409,7 @@ public class VisualdevModelAppService : IDynamicApiController, ITransient
|
||||
|
||||
var len = rowChildDatas.Select(x => x.Value.Count()).OrderByDescending(x => x).FirstOrDefault();
|
||||
|
||||
if (len != null && len > 0)
|
||||
if (len > 0)
|
||||
{
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8618;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8625;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -361,7 +361,8 @@ public class FlowTaskOtherUtil
|
||||
{
|
||||
try
|
||||
{
|
||||
if (jobj[timeOutConfig.formField] is long)
|
||||
//modified by PhilPan
|
||||
if (jobj[timeOutConfig.formField].Type == Newtonsoft.Json.Linq.JTokenType.Integer)
|
||||
{
|
||||
dt = jobj[timeOutConfig.formField].ParseToLong().TimeStampToDateTime();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);CS8600;CS8601;CS8602;CS8603;CS8604;CS8619;CS8620;CS8625;CS8629;CS1572;CS1573;CS0168;CS4014;CS1998;</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user