diff --git a/DOAN.Admin.WebApi/Controllers/MES/Product/ProWorkorderController.cs b/DOAN.Admin.WebApi/Controllers/MES/Product/ProWorkorderController.cs
new file mode 100644
index 0000000..4febbf2
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Product/ProWorkorderController.cs
@@ -0,0 +1,383 @@
+using Microsoft.AspNetCore.Mvc;
+using DOAN.Model.MES.product;
+using DOAN.Model.MES.product.Dto;
+
+
+using DOAN.Service.MES.product.IService;
+using DOAN.Service.MES.product;
+using DOAN.Admin.WebApi.Filters;
+using Org.BouncyCastle.Crypto;
+using DOAN.Model.System;
+using MiniExcelLibs;
+using DOAN.Model.System.Dto;
+using DOAN.Model;
+using DOAN.Model.MES.base_.Dto;
+using Microsoft.AspNetCore.Http;
+using Aliyun.OSS;
+using System;
+using DOAN.Infrastructure;
+using DOAN.Model.MES.product.Dto;
+using Infrastructure.Converter;
+
+//创建时间:2024-07-16
+namespace DOAN.Admin.WebApi.Controllers
+{
+ ///
+ /// 生产工单
+ ///
+ [Verify]
+ [Route("mes/productManagement/ProWorkorder")]
+ public class ProWorkorderController : BaseController
+ {
+ ///
+ /// 生产工单接口
+ ///
+ private readonly IProWorkorderService _ProWorkorderService;
+
+ public ProWorkorderController(IProWorkorderService ProWorkorderService)
+ {
+ _ProWorkorderService = ProWorkorderService;
+ }
+
+ ///
+ /// 查询生产工单列表 启用(9/14)
+ ///
+ ///
+ ///
+ [HttpPost("list")]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:list")]
+ public IActionResult QueryProWorkorder([FromBody] ProWorkorderQueryDto parm)
+ {
+ parm.WorkorderDate[0] = DOANConvertDate.ConvertLocalDate(parm.WorkorderDate[0]);
+ parm.WorkorderDate[1]= DOANConvertDate.ConvertLocalDate(parm.WorkorderDate[1]);
+
+ var response = _ProWorkorderService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 查询生产工单列表 启用(9/14) 没有校验
+ ///
+ ///
+ ///
+ [HttpPost("list_nocheck")]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:list")]
+ public IActionResult QueryProWorkorder_NOCheck([FromBody] ProWorkorderQueryDto parm)
+ {
+ parm.WorkorderDate[0] = DOANConvertDate.ConvertLocalDate(parm.WorkorderDate[0]);
+ parm.WorkorderDate[1]= DOANConvertDate.ConvertLocalDate(parm.WorkorderDate[1]);
+
+ var response = _ProWorkorderService.GetList_NOCheck(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询生产工单详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:query")]
+ public IActionResult GetProWorkorder(string Id)
+ {
+ var response = _ProWorkorderService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加生产工单
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:add")]
+ [Log(Title = "生产工单", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddProWorkorder([FromBody] ProWorkorderDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _ProWorkorderService.AddProWorkorder(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新生产工单 启用(9/14)
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:edit")]
+ [Log(Title = "生产工单", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateProWorkorder([FromBody] ProWorkorderDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _ProWorkorderService.UpdateProWorkorder(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除生产工单 启用(9/14)
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "productManagement:proworkorder:delete")]
+ [Log(Title = "生产工单", BusinessType = BusinessType.DELETE)]
+ public IActionResult DeleteProWorkorder(string ids)
+ {
+ string[] idsArr = Tools.SpitStrArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+
+ var response = _ProWorkorderService.Delete(idsArr);
+
+ return ToResponse(response);
+ }
+
+ /////
+ ///// 生成工单号
+ /////
+ /////
+ ///// 生成工单号 数量
+ //[HttpPost("Generate_workorder")]
+ //public IActionResult Generate_workorder([FromBody] ProWorkorderQueryDto2 parm)
+ //{
+ // if (parm.WorkorderDate <= DateTime.MinValue)
+ // {
+ // SUCCESS(null);
+ // }
+
+ // var response = _ProWorkorderService.Generate_workorder(parm);
+
+ // return SUCCESS(response);
+ //}
+
+
+ ///
+ /// 插入工单/或者新增工单 启用(9/14)
+ ///
+ ///
+ /// 1成功 0失败
+ [HttpPost("insert_workorder")]
+ [Log(Title = "插入工单/或者新增工单", BusinessType = BusinessType.INSERT)]
+ public IActionResult Insert_workOrder([FromBody] ProWorkorderDto2 parm)
+ {
+ if (parm == null)
+ {
+ return SUCCESS(null);
+ }
+
+ ProWorkorder newparm = parm.Adapt().ToCreate(HttpContext);
+ var response = _ProWorkorderService.Insert_workOrder(newparm, parm.next_id);
+
+ return SUCCESS(response);
+
+
+ }
+
+ ///
+ /// 移动工单
+ ///
+ /// 1上 2下
+ ///
+ ///
+ [HttpGet("move_workorder")]
+ [Log(Title = "移动工单", BusinessType = BusinessType.INSERT)]
+ public IActionResult MoveWorkorder(string id, int type)
+ {
+ if (string.IsNullOrEmpty(id))
+ {
+ return SUCCESS(null);
+ }
+ var response = _ProWorkorderService.MoveWorkorder(id, type);
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 生产工单导入模板下载 workorder 启用(9/14)
+ ///
+ ///
+ [HttpGet("importTemplate")]
+ [Log(Title = "生产工单导入模板", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)]
+ [AllowAnonymous]
+ public IActionResult ImportTemplateExcel()
+ {
+ (string, string) result = DownloadImportTemplate("workorder");
+ return ExportExcel(result.Item2, result.Item1);
+ }
+
+ ///
+ /// 导入 启用(9/14)
+ ///
+ /// 使用IFromFile必须使用name属性否则获取不到文件
+ /// 导入成功数 若-1 则excel读取异常
+ [HttpPost("importData")]
+ [Log(Title = "生产工单导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)]
+ [AllowAnonymous]
+ public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile)
+ {
+
+ if (formFile == null)
+ {
+ return SUCCESS(null);
+ }
+ int response = _ProWorkorderService.ImportData(formFile, HttpContext.GetName());
+
+ return SUCCESS(response);
+
+
+
+ }
+
+ //TODO 分批导入工单,追加工单
+ [HttpPost("importData_append")]
+ [Log(Title = "生产工单导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)]
+ [AllowAnonymous]
+ public IActionResult ImportDataAppend([FromForm(Name = "file")] IFormFile formFile)
+ {
+
+ if (formFile == null)
+ {
+ return SUCCESS(null);
+ }
+ int response = _ProWorkorderService.ImportDataAppend(formFile, HttpContext.GetName());
+
+ return SUCCESS(response);
+
+
+
+ }
+
+
+ ///
+ /// 工单导出 启用(9/14)
+ ///
+ ///
+ ///
+ [HttpGet("export")]
+ [Log(Title = "工单导出", BusinessType = BusinessType.EXPORT)]
+ [AllowAnonymous]
+ public IActionResult WorkOrderExport([FromQuery] DateTime extportDate)
+ {
+ if (extportDate == DateTime.MinValue)
+ {
+ return SUCCESS(null);
+ }
+ var list = _ProWorkorderService.WorkOrderExport(extportDate, new PagerInfo(1, 10000));
+
+ var result = ExportExcelMini(list.Result, "workorder", "工单列表");
+ return ExportExcel(result.Item2, result.Item1);
+ }
+
+ //TODO 获取物料
+ [HttpPost("get_material")]
+ public IActionResult GetMaterialInfo([FromBody] BaseMaterialListQueryDto5 query)
+ {
+ if (query == null)
+ {
+ return SUCCESS(null);
+ }
+ var response = _ProWorkorderService.GetMaterialInfo(query);
+ return SUCCESS(response);
+
+ }
+
+
+ //TODO 获取客户
+ [HttpPost("get_custom")]
+ public IActionResult GetCustomInfo([FromBody] BaseCustomQueryDto2 parm)
+ {
+ if (parm == null)
+ {
+ return SUCCESS(null);
+ }
+ var response = _ProWorkorderService.GetCustomInfo(parm);
+ return SUCCESS(response);
+ }
+
+
+ //TODO 获取指定日期工艺路线
+ [HttpGet("get_process_route")]
+ public IActionResult GetProcessRoute(DateTime dateTime)
+ {
+ if (dateTime == DateTime.MinValue)
+ {
+ return SUCCESS(null);
+
+ }
+
+ var response = _ProWorkorderService.GetProcessRoute(dateTime);
+ return SUCCESS(response);
+ }
+
+ //TODO 获取全部工艺路线 启用(9/14)
+ [HttpGet("get_all_route")]
+ public IActionResult GetAllRoute()
+ {
+ var response = _ProWorkorderService.GetAllRoute();
+ return SUCCESS(response);
+ }
+
+ //TODO 获取组
+ //[HttpGet("get_groups")]
+ //public IActionResult GetGroupList(string route_code,DateTime dateTime)
+ //{
+ // if (string.IsNullOrEmpty(route_code)) { return SUCCESS(null); }
+ // if (dateTime == DateTime.MinValue)
+ // {
+ // return SUCCESS(null);
+
+ // }
+
+ // var response = _ProWorkorderService.GetGroupList(route_code, dateTime);
+ // return SUCCESS(response);
+
+ //}
+ // 启用(9/14)
+ [HttpGet("get_groups")]
+ public IActionResult GetGroupList()
+ {
+ var response = _ProWorkorderService.GetGroupList();
+ return SUCCESS(response);
+ }
+
+ //TODO 查询BOM 及其所需数量
+ ///
+ /// 查询BOM 及其所需数量
+ ///
+ /// 工单号
+ ///
+ [HttpGet("search_BOM_num")]
+ public IActionResult SearchBOMNum(string workorder_num)
+ {
+ if (string.IsNullOrEmpty(workorder_num)) { return SUCCESS(null); }
+
+ var response = _ProWorkorderService.SearchBOMNum(workorder_num);
+ return SUCCESS(response);
+
+
+ }
+
+ //TODO 工单变更日志
+ [HttpGet("workorder_log")]
+ public IActionResult WorkOrderLog(string workorder, string log)
+ {
+ if (string.IsNullOrEmpty(workorder)) { return SUCCESS(null); }
+ var response = _ProWorkorderService.WorkOrderLog(workorder, log, HttpContext.GetName());
+ return SUCCESS(response);
+ }
+
+ //TODO 获取工单进度追溯
+ [HttpPost("get_workorder_trace_progress")]
+ public IActionResult GetWorkorderTraceProgressList([FromBody]ProWorkorderQueryDto query)
+ {
+ query.WorkorderDate[0] = DOANConvertDate.ConvertLocalDate(query.WorkorderDate[0]);
+ query.WorkorderDate[1] = DOANConvertDate.ConvertLocalDate(query.WorkorderDate[1]);
+ if (query == null) { throw new Exception("query为空"); }
+ var response= _ProWorkorderService.GetWorkorderTraceProgressList(query);
+
+ return SUCCESS(response);
+ }
+ }
+}
diff --git a/DOAN.Admin.WebApi/DOAN.Admin.WebApi.csproj b/DOAN.Admin.WebApi/DOAN.Admin.WebApi.csproj
index e0720ac..fda4e9b 100644
--- a/DOAN.Admin.WebApi/DOAN.Admin.WebApi.csproj
+++ b/DOAN.Admin.WebApi/DOAN.Admin.WebApi.csproj
@@ -27,6 +27,7 @@
+
diff --git a/DOAN.Admin.WebApi/appsettings.Development.json b/DOAN.Admin.WebApi/appsettings.Development.json
index 7ac82ef..580f396 100644
--- a/DOAN.Admin.WebApi/appsettings.Development.json
+++ b/DOAN.Admin.WebApi/appsettings.Development.json
@@ -12,11 +12,11 @@
//代码生成数据库配置
"CodeGenDbConfig": {
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
- "Conn": "Data Source=192.168.0.58;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308",
+ "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306",
"DbType": 0,
"IsAutoCloseConnection": true,
"DbName": "bzfm_mes" //代码生成默认连接数据库,Oracle库是实例的名称
},
- "urls": "http://0.0.0.0:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
+ "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
"corsUrls": [ "http://localhost:8887", "http://localhost:8886", "http://localhost:9090", "http://localhost:8080" ] //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx b/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx
new file mode 100644
index 0000000..a5d9b48
Binary files /dev/null and b/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx differ
diff --git a/DOAN.Common/Tools.cs b/DOAN.Common/Tools.cs
index 6d17787..a99a8e8 100644
--- a/DOAN.Common/Tools.cs
+++ b/DOAN.Common/Tools.cs
@@ -42,6 +42,19 @@ namespace DOAN.Common
return result;
}
+ ///
+ /// 雪花id
+ ///
+ ///
+ ///
+ ///
+ public static string[] SpitStrArrary(string str, char split = ',')
+ {
+ if (string.IsNullOrEmpty(str)) { return Array.Empty(); }
+ string[] strIds = str.Split(split, (char)StringSplitOptions.RemoveEmptyEntries);
+
+ return strIds;
+ }
///
/// 根据日期获取星期几
diff --git a/DOAN.Model/MES/Base/BaseCustom.cs b/DOAN.Model/MES/Base/BaseCustom.cs
new file mode 100644
index 0000000..2b94446
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseCustom.cs
@@ -0,0 +1,96 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 客户信息
+ ///
+ [SugarTable("base_custom")]
+ [Tenant("0")]
+ public class BaseCustom
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 客户代码
+ ///
+ [SugarColumn(ColumnName = "custom_no")]
+ public string CustomNo { get; set; }
+
+ ///
+ /// 客户名称
+ ///
+ [SugarColumn(ColumnName = "custom_name")]
+ public string CustomName { get; set; }
+
+
+
+
+ ///
+ /// 客户简称
+ ///
+ [SugarColumn(ColumnName = "custom_add_name")]
+ public string CustomAddName { get; set; }
+
+ ///
+ /// 客户地址
+ ///
+ [SugarColumn(ColumnName = "custom_address")]
+ public string CustomAddress { get; set; }
+
+ ///
+ /// 客户联系人
+ ///
+ [SugarColumn(ColumnName = "custom_liaison")]
+ public string CustomLiaison { get; set; }
+
+ ///
+ /// 客户手机号
+ ///
+ [SugarColumn(ColumnName = "custom_phone")]
+ public string CustomPhone { get; set; }
+
+ ///
+ /// 类别
+ ///
+ public int? Type { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseDevice.cs b/DOAN.Model/MES/Base/BaseDevice.cs
new file mode 100644
index 0000000..c4e0811
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseDevice.cs
@@ -0,0 +1,87 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 设备信息
+ ///
+ [SugarTable("base_device")]
+ public class BaseDevice
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 工位
+ ///
+ [SugarColumn(ColumnName = "fk_work_station")]
+ public int? FkWorkStation { get; set; }
+
+ ///
+ /// 设备编号
+ ///
+ [SugarColumn(ColumnName = "device_code")]
+ public string DeviceCode { get; set; }
+
+ ///
+ /// 设备名称
+ ///
+ [SugarColumn(ColumnName = "device_name")]
+ public string DeviceName { get; set; }
+
+ ///
+ /// 设备规格
+ ///
+ [SugarColumn(ColumnName = "device_specification")]
+ public string DeviceSpecification { get; set; }
+
+ ///
+ /// 购买日期
+ ///
+ [SugarColumn(ColumnName = "purchase_time")]
+ public DateTime? PurchaseTime { get; set; }
+
+ ///
+ /// 供应商
+ ///
+ [SugarColumn(ColumnName = "device_supplier")]
+ public string DeviceSupplier { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseGroup.cs b/DOAN.Model/MES/Base/BaseGroup.cs
new file mode 100644
index 0000000..27039f1
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseGroup.cs
@@ -0,0 +1,62 @@
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 组
+ ///
+ [SugarTable("base_group")]
+ public class BaseGroup
+ {
+ ///
+ /// id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 组代码
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "group_code")]
+ public string GroupCode { get; set; }
+
+ ///
+ /// 组名称
+ ///
+ [SugarColumn(ColumnName = "group_name")]
+ public string GroupName { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseMaterialBom.cs b/DOAN.Model/MES/Base/BaseMaterialBom.cs
new file mode 100644
index 0000000..192626b
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseMaterialBom.cs
@@ -0,0 +1,83 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ ///
+ ///
+ [SugarTable("base_material_bom")]
+ public class BaseMaterialBom
+ {
+ ///
+ /// 雪花id
+ ///
+ [SugarColumn(ColumnName = "Id" ,IsPrimaryKey =true) ]
+ public string Id { get; set; }
+ ///
+ /// 母件编码
+ ///
+ [SugarColumn(ColumnName = "InvCode")]
+ public string InvCode { get; set; }
+
+ ///
+ /// 母件名称
+ ///
+ [SugarColumn(ColumnName = "InvName")]
+ public string InvName { get; set; }
+
+ ///
+ /// 子件编码
+ ///
+ [SugarColumn(ColumnName = "subInvCode")]
+ public string SubInvCode { get; set; }
+
+ ///
+ /// 子件名称
+ ///
+ [SugarColumn(ColumnName = "subInvName")]
+ public string SubInvName { get; set; }
+
+ ///
+ /// 使用数量
+ ///
+ [SugarColumn(ColumnName = "iusequantity")]
+ public string Iusequantity { get; set; }
+
+ ///
+ /// BOM版本号
+ ///
+ [SugarColumn(ColumnName = "BOMVersion")]
+ public string BOMVersion { get; set; }
+
+
+ ///
+ /// CreatedBy
+ ///
+ [SugarColumn(ColumnName = "created_by")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// CreatedTime
+ ///
+ [SugarColumn(ColumnName = "created_time")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// UpdatedBy
+ ///
+ [SugarColumn(ColumnName = "updated_by")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// UpdatedTime
+ ///
+ [SugarColumn(ColumnName = "updated_time")]
+ public DateTime? UpdatedTime { get; set; }
+
+ ///
+ /// 子节点
+ ///
+ //[Navigate(NavigateType.OneToMany, nameof(BaseMaterialBom.SubInvCode), nameof(BaseMaterialBom.InvCode))]
+ //public List Child { get; set; }
+
+ }
+}
diff --git a/DOAN.Model/MES/Base/BaseMaterialBom1.cs b/DOAN.Model/MES/Base/BaseMaterialBom1.cs
new file mode 100644
index 0000000..8f5ab8a
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseMaterialBom1.cs
@@ -0,0 +1,52 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ ///
+ ///
+ [SugarTable("base_material_bom")]
+ public class BaseMaterialBom1
+ {
+ ///
+ /// FkId
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_id")]
+ public string FkId { get; set; }
+
+ ///
+ /// FkParentId
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_parent_id")]
+ public string FkParentId { get; set; }
+
+ ///
+ /// Sort
+ ///
+ public int? Sort { get; set; }
+
+ ///
+ /// CreatedBy
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// CreatedTime
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// UpdatedBy
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// UpdatedTime
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
diff --git a/DOAN.Model/MES/Base/BaseMaterialList.cs b/DOAN.Model/MES/Base/BaseMaterialList.cs
new file mode 100644
index 0000000..42304f2
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseMaterialList.cs
@@ -0,0 +1,151 @@
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 物料清单
+ ///
+ [SugarTable("base_material_list")]
+ public class BaseMaterialList
+ {
+ ///
+ /// 雪花id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ /////
+ ///// 物料类别外键id
+ /////
+ //[SugarColumn(ColumnName = "fk_type_id")]
+ //public int? FkTypeId { get; set; }
+
+
+
+ ///
+ /// 物料编码
+ ///
+ [SugarColumn(ColumnName = "fk_material_type_code")]
+ public string FkMaterialTypeCode { get; set; }
+
+
+ ///
+ /// 物料名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ public string Code { get; set; }
+ ///
+ /// 物料代码
+ ///
+ [SugarColumn(ColumnName = "addcode")]
+ public string ADDCode { get; set; }
+
+ ///
+ /// 客户编码 customer_ code
+ ///
+ [SugarColumn(ColumnName = "customer_code")]
+
+ public string CustomerCode { get; set; }
+
+ ///
+ /// 颜色
+ ///
+ public string Color { get; set; }
+
+ ///
+ /// 规格型号
+ ///
+ public string Specification { get; set; }
+
+ ///
+ /// 计量单位
+ ///
+ public string Unit { get; set; }
+
+ ///
+ /// 描述
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// 供应商外键id
+ ///
+ [SugarColumn(ColumnName = "fk_supplier_id")]
+ public int? FkSupplierId { get; set; }
+
+ ///
+ /// 保质期单位
+ ///
+ [SugarColumn(ColumnName = "expiration_unit")]
+ public string ExpirationUnit { get; set; }
+
+ ///
+ /// 保质期
+ ///
+ [SugarColumn(ColumnName = "expiration_date")]
+ public decimal ExpirationDate { get; set; }
+
+ ///
+ /// 保质期预警天数
+ ///
+ [SugarColumn(ColumnName = "shelf_life_warning_days")]
+ public int? ShelfLifeWarningDays { get; set; }
+
+ ///
+ /// 是否有效期管理
+ ///
+ [SugarColumn(ColumnName = "is_shelf_life")]
+ public int? IsShelfLife { get; set; }
+
+ ///
+ /// 启用日期
+ ///
+ [SugarColumn(ColumnName = "start_time")]
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 停用日期
+ ///
+ [SugarColumn(ColumnName = "stop_time")]
+ public DateTime? StopTime { get; set; }
+
+ ///
+ /// 对应条码
+ ///
+ [SugarColumn(ColumnName = "bar_code")]
+ public string BarCode { get; set; }
+
+ ///
+ /// 是否启用批次管理
+ ///
+ [SugarColumn(ColumnName = "is_batch")]
+ public int? IsBatch { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseMaterialType.cs b/DOAN.Model/MES/Base/BaseMaterialType.cs
new file mode 100644
index 0000000..248d081
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseMaterialType.cs
@@ -0,0 +1,74 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 物料类别
+ ///
+ [SugarTable("base_material_type")]
+ public class BaseMaterialType
+ {
+ ///
+ /// id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ /////
+ ///// 父id
+ /////
+ //[SugarColumn(ColumnName = "parent_id")]
+ //public int ParentId { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 类别编码
+ ///
+ public string Code { get; set; }
+
+ ///
+ /// 父类别编码
+ ///
+ ///
+ [SugarColumn(ColumnName = "parent_code")]
+ public string ParentCode { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseRelWorkRouteProcesses.cs b/DOAN.Model/MES/Base/BaseRelWorkRouteProcesses.cs
new file mode 100644
index 0000000..f18cf01
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseRelWorkRouteProcesses.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 工艺路线与工序绑定表
+ ///
+ [SugarTable("base_rel_work_route_processes")]
+ public class BaseRelWorkRouteProcesses
+ {
+ ///
+ /// 工艺路线主键
+ ///
+ [SugarColumn(ColumnName = "fk_work_route")]
+ public int FkWorkRoute { get; set; }
+
+ ///
+ /// 生产工序主键
+ ///
+ [SugarColumn(ColumnName = "fk_work_processes")]
+ public int FkWorkProcesses { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int Sort { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseSupplier.cs b/DOAN.Model/MES/Base/BaseSupplier.cs
new file mode 100644
index 0000000..d694850
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseSupplier.cs
@@ -0,0 +1,94 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 供应商信息
+ ///
+ [SugarTable("base_supplier")]
+ public class BaseSupplier
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 供应商代码
+ ///
+ [SugarColumn(ColumnName = "supplier_no")]
+ public string SupplierNo { get; set; }
+
+ ///
+ /// 供应商名称
+ ///
+ [SugarColumn(ColumnName = "supplier_name")]
+ public string SupplierName { get; set; }
+
+
+
+ ///
+ /// 供应商简称
+ ///
+ [SugarColumn(ColumnName = "supplier_add_name")]
+ public string SupplierAddName { get; set; }
+
+ ///
+ /// 供应商地址
+ ///
+ [SugarColumn(ColumnName = "supplier_address")]
+ public string SupplierAddress { get; set; }
+
+ ///
+ /// 供应商联系人
+ ///
+ [SugarColumn(ColumnName = "supplier_liaison")]
+ public string SupplierLiaison { get; set; }
+
+ ///
+ /// 供应商手机号
+ ///
+ [SugarColumn(ColumnName = "supplier_phone")]
+ public string SupplierPhone { get; set; }
+
+ ///
+ /// 类别
+ ///
+ public int? Type { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseUnit.cs b/DOAN.Model/MES/Base/BaseUnit.cs
new file mode 100644
index 0000000..c0feaa1
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseUnit.cs
@@ -0,0 +1,64 @@
+
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 单位信息
+ ///
+ [SugarTable("base_unit")]
+ public class BaseUnit
+ {
+ ///
+ /// 自增
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 单位名称
+ ///
+ [SugarColumn(ColumnName = "unit_name")]
+ public string UnitName { get; set; }
+
+ ///
+ /// 单位代码
+ ///
+ [SugarColumn(ColumnName = "unit_code")]
+ public string UnitCode { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseWorkProcesses.cs b/DOAN.Model/MES/Base/BaseWorkProcesses.cs
new file mode 100644
index 0000000..31de5ae
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseWorkProcesses.cs
@@ -0,0 +1,65 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 生产工序
+ ///
+ [SugarTable("base_work_processes")]
+ public class BaseWorkProcesses
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int? Id { get; set; }
+
+ ///
+ /// 工序类别
+ ///
+ [SugarColumn(ColumnName = "dict_work_type")]
+ public string DictWorkType { get; set; }
+
+ ///
+ /// 工序名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ [Navigate(NavigateType.OneToMany, nameof(BaseWorkStation.FkWorkProcesses))]
+ public List BindedWorkStationArray { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/BaseWorkRoute.cs b/DOAN.Model/MES/Base/BaseWorkRoute.cs
new file mode 100644
index 0000000..328d069
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseWorkRoute.cs
@@ -0,0 +1,70 @@
+using DOAN.Model.MES.base_.Dto;
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 工艺路线
+ ///
+ [SugarTable("base_work_route")]
+ public class BaseWorkRoute
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 编号
+ ///
+ public string Code { get; set; }
+
+ [SugarColumn(IsIgnore =true)]
+ public List BaseWorkProcessesList { get; set; }
+
+ ///
+ /// 工艺流程图原始json数据,用来进行复现
+ ///
+ [SugarColumn(ColumnName = "logic_flow_data")]
+ public string LogicFlowData { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
diff --git a/DOAN.Model/MES/Base/BaseWorkStation.cs b/DOAN.Model/MES/Base/BaseWorkStation.cs
new file mode 100644
index 0000000..fcfc445
--- /dev/null
+++ b/DOAN.Model/MES/Base/BaseWorkStation.cs
@@ -0,0 +1,74 @@
+
+namespace DOAN.Model.MES.base_
+{
+ ///
+ /// 工位
+ ///
+ [SugarTable("base_work_station")]
+ public class BaseWorkStation
+ {
+ ///
+ /// 主键
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 所属工序
+ ///
+ [SugarColumn(ColumnName = "fk_work_processes")]
+ public int? FkWorkProcesses { get; set; }
+
+ ///
+ /// 工序类别(与工序统一)
+ ///
+ [SugarColumn(ColumnName = "dict_work_type")]
+ public string DictWorkType { get; set; }
+
+ ///
+ /// 工位描述
+ ///
+ [SugarColumn(ColumnName = "work_station_description")]
+ public string WorkStationDescription { get; set; }
+
+
+
+ [Navigate(NavigateType.OneToMany, nameof(BaseDevice.FkWorkStation))]
+ public List BindedDeviceArray { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseBomTreeDto.cs b/DOAN.Model/MES/Base/Dto/BaseBomTreeDto.cs
new file mode 100644
index 0000000..267ddc4
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseBomTreeDto.cs
@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ public class BaseBomTreeDto
+ {
+ ///
+ /// 雪花id
+ ///
+
+ public string Id { get; set; }
+ ///
+ /// 母件编码
+ ///
+
+ public string InvCode { get; set; }
+
+ ///
+ /// 母件名称
+ ///
+
+ public string InvName { get; set; }
+
+ ///
+ /// 子件编码
+ ///
+
+ public string SubInvCode { get; set; }
+
+ ///
+ /// 子件名称
+ ///
+
+ public string SubInvName { get; set; }
+
+ ///
+ /// 使用数量
+ ///
+
+ public string Iusequantity { get; set; }
+
+ ///
+ /// BOM版本号
+ ///
+
+ public string BOMVersion { get; set; }
+
+
+ ///
+ /// CreatedBy
+ ///
+
+ public string CreatedBy { get; set; }
+ ///
+ /// CreatedTime
+ ///
+
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// UpdatedBy
+ ///
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// UpdatedTime
+ ///
+ public DateTime? UpdatedTime { get; set; }
+
+
+ public List Child { get; set; }=new List();
+ }
+}
diff --git a/DOAN.Model/MES/Base/Dto/BaseCustomDto.cs b/DOAN.Model/MES/Base/Dto/BaseCustomDto.cs
new file mode 100644
index 0000000..ba9974b
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseCustomDto.cs
@@ -0,0 +1,67 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 客户信息查询对象
+ ///
+ public class BaseCustomQueryDto : PagerInfo
+ {
+ public string CustomNo { get; set; }
+
+ public string CustomName { get; set; }
+
+ public int? Type { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ public class BaseCustomQueryDto2
+ {
+ public string CustomNo { get; set; }
+
+
+ }
+
+ ///
+ /// 客户信息输入输出对象
+ ///
+ public class BaseCustomDto
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public string CustomNo { get; set; }
+
+ public string CustomName { get; set; }
+
+
+ ///
+ /// 客户简称
+ ///
+ public string CustomAddName { get; set; }
+
+ public string CustomAddress { get; set; }
+
+ public string CustomLiaison { get; set; }
+
+ public string CustomPhone { get; set; }
+
+ public int? Type { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseDeviceDto.cs b/DOAN.Model/MES/Base/Dto/BaseDeviceDto.cs
new file mode 100644
index 0000000..d887969
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseDeviceDto.cs
@@ -0,0 +1,60 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 设备信息查询对象
+ ///
+ public class BaseDeviceQueryDto : PagerInfo
+ {
+ public int? FkWorkStation { get; set; }
+
+ public string DeviceCode { get; set; }
+
+ public string DeviceName { get; set; }
+
+ public string DeviceSpecification { get; set; }
+
+ public DateTime? PurchaseTime { get; set; }
+
+ public string DeviceSupplier { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 设备信息输入输出对象
+ ///
+ public class BaseDeviceDto
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public int? FkWorkStation { get; set; }
+
+ public string DeviceCode { get; set; }
+
+ public string DeviceName { get; set; }
+
+ public string DeviceSpecification { get; set; }
+
+ public DateTime? PurchaseTime { get; set; }
+
+ public string DeviceSupplier { get; set; }
+
+ public string Remark { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseGroupDto.cs b/DOAN.Model/MES/Base/Dto/BaseGroupDto.cs
new file mode 100644
index 0000000..24c4b0a
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseGroupDto.cs
@@ -0,0 +1,45 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 组查询对象
+ ///
+ public class BaseGroupQueryDto : PagerInfo
+ {
+ public string GroupCode { get; set; }
+
+ public string GroupName { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 组输入输出对象
+ ///
+ public class BaseGroupDto
+ {
+ [Required(ErrorMessage = "id不能为空")]
+ public int Id { get; set; }
+
+ [Required(ErrorMessage = "组代码不能为空")]
+ public string GroupCode { get; set; }
+
+ public string GroupName { get; set; }
+
+ public string Remark { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseMaterialBomDto.cs b/DOAN.Model/MES/Base/Dto/BaseMaterialBomDto.cs
new file mode 100644
index 0000000..b9e9a1f
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseMaterialBomDto.cs
@@ -0,0 +1,63 @@
+using System.ComponentModel.DataAnnotations;
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 查询对象
+ ///
+ public class BaseMaterialBomQueryDto : PagerInfo
+ {
+ public string InvCode { get; set; }
+ public string SubInvCode { get; set; }
+ }
+
+ ///
+ /// 输入输出对象
+ ///
+ public class BaseMaterialBomDto
+ {
+ [Required(ErrorMessage = "雪花id不能为空")]
+ public string Id { get; set; }
+
+ [Required(ErrorMessage = "母件code不能为空")]
+ public string InvCode { get; set; }
+
+ public string InvName { get; set; }
+
+ [Required(ErrorMessage = "子件编码不能为空")]
+ public string SubInvCode { get; set; }
+
+ public string SubInvName { get; set; }
+
+
+
+ public string Iusequantity { get; set; }
+
+ public string BOMVersion { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+ // public List Child { get; set; }
+
+
+
+ }
+
+ //增加 规格和单位
+ public class BaseMaterialBomDto2 : BaseMaterialBomDto
+ {
+
+ public string Specification { get; set; }
+
+ public string Unit { get; set; }
+
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseMaterialListDto.cs b/DOAN.Model/MES/Base/Dto/BaseMaterialListDto.cs
new file mode 100644
index 0000000..6ba1f7c
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseMaterialListDto.cs
@@ -0,0 +1,274 @@
+using System.ComponentModel.DataAnnotations;
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 物料清单查询对象
+ ///
+ public class BaseMaterialListQueryDto : PagerInfo
+ {
+
+
+ ///
+ /// 物料编码
+ ///
+
+ public string FkMaterialTypeCode { get; set; }
+
+
+ ///
+ /// 物料名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ public string Code { get; set; }
+
+ public DateTime[] TimeRange { get; set; }
+ }
+ public class BaseMaterialListQueryDto5
+ {
+
+ ///
+ /// 物料名称 物料编码
+ ///
+ public string Name_or_Code { get; set; }
+
+
+
+
+ }
+
+
+ public class BaseMaterialListQueryDto2 : PagerInfo
+ {
+ public string Name { get; set; }
+
+ public int Type { get; set; }
+
+ public int? FkTypeId { get; set; }
+
+ public string Code { get; set; }
+
+ public string CustomerCode { get; set; }
+
+
+ public string Description { get; set; }
+
+
+
+ public DateTime[] TimeRange { get; set; }
+ }
+
+ public class BaseMaterialListQueryDto3 : PagerInfo
+ {
+ ///
+ /// 成品id
+ ///
+ public string Id { get; set; }
+
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public string CustomerCode { get; set; }
+
+ }
+
+ ///
+ /// 物料清单输入输出对象
+ ///
+ public class BaseMaterialListDto
+ {
+
+ public string Id { get; set; }
+
+ public int? FkTypeId { get; set; }
+
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public string CustomerCode { get; set; }
+
+ public string Color { get; set; }
+
+ public string Specification { get; set; }
+
+ public string Unit { get; set; }
+
+ public string Description { get; set; }
+
+ public int? FkSupplierId { get; set; }
+
+ public string ExpirationUnit { get; set; }
+
+ public decimal ExpirationDate { get; set; }
+
+ public int? ShelfLifeWarningDays { get; set; }
+
+ public int? IsShelfLife { get; set; }
+
+ public DateTime? StartTime { get; set; }
+
+ public DateTime? StopTime { get; set; }
+
+ public string BarCode { get; set; }
+
+ public int? IsBatch { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+ public class BaseMaterialListDto2
+ {
+
+ public string FkMaterialTypeCode { get; set; }
+ public string FkMaterialTypeName { get; set; }
+
+
+
+
+ ///
+ /// 雪花id
+ ///
+
+ public string Id { get; set; }
+
+
+
+
+
+
+
+
+ ///
+ /// 物料名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 物料编码
+ ///
+ public string Code { get; set; }
+ ///
+ /// 物料代码
+ ///
+
+ public string ADDCode { get; set; }
+
+ ///
+ /// 客户编码 customer_ code
+ ///
+
+
+ public string CustomerCode { get; set; }
+
+ ///
+ /// 颜色
+ ///
+ public string Color { get; set; }
+
+ ///
+ /// 规格型号
+ ///
+ public string Specification { get; set; }
+
+ ///
+ /// 计量单位
+ ///
+ public string Unit { get; set; }
+
+ ///
+ /// 描述
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// 供应商外键id
+ ///
+
+ public int? FkSupplierId { get; set; }
+
+ ///
+ /// 保质期单位
+ ///
+ [SugarColumn(ColumnName = "expiration_unit")]
+ public string ExpirationUnit { get; set; }
+
+ ///
+ /// 保质期
+ ///
+
+ public decimal ExpirationDate { get; set; }
+
+ ///
+ /// 保质期预警天数
+ ///
+
+ public int? ShelfLifeWarningDays { get; set; }
+
+ ///
+ /// 是否有效期管理
+ ///
+
+ public int? IsShelfLife { get; set; }
+
+ ///
+ /// 启用日期
+ ///
+
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 停用日期
+ ///
+
+ public DateTime? StopTime { get; set; }
+
+ ///
+ /// 对应条码
+ ///
+
+ public string BarCode { get; set; }
+
+ ///
+ /// 是否启用批次管理
+ ///
+
+ public int? IsBatch { get; set; }
+
+ ///
+ /// 创建人
+
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseMaterialTypeDto.cs b/DOAN.Model/MES/Base/Dto/BaseMaterialTypeDto.cs
new file mode 100644
index 0000000..2a32046
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseMaterialTypeDto.cs
@@ -0,0 +1,54 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 物料类别查询对象
+ ///
+ public class BaseMaterialTypeQueryDto : PagerInfo
+ {
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 物料类别输入输出对象
+ ///
+ public class BaseMaterialTypeDto
+ {
+ [Required(ErrorMessage = "id不能为空")]
+ public int Id { get; set; }
+
+ //[Required(ErrorMessage = "父id不能为空")]
+ //public int ParentId { get; set; }
+
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+
+ ///
+ /// 父类别编码
+ ///
+ public string ParentCode { get; set; }
+
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseParseNode.cs b/DOAN.Model/MES/Base/Dto/BaseParseNode.cs
new file mode 100644
index 0000000..a99c6e4
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseParseNode.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+
+ public class BaseParseNodeDto
+ {
+ public int FkRouteCode { get; set; } //工艺路线id
+
+ public string LogicFlowData { get; set; }
+ }
+
+ ///
+ /// 流程图节点解析
+ ///
+ public class BaseParseNode
+ {
+
+ public Nodes__[] nodes { get; set; }
+
+ public Edges__[] edges { get; set; }
+ }
+
+ public class Nodes__
+ {
+ public string id { get; set; }
+
+ public string type { get; set; }
+
+ public int x { get; set; }
+ public int y { get; set; }
+ public Properties_ properties { get; set; }
+
+ public Text_ text { get; set; }
+
+ }
+ public class Properties_
+ {
+ public int processesId { get; set; }
+ }
+
+ public class Text_
+ {
+ public int x { get; set; }
+ public int y { get; set; }
+
+ public string value { get; set; }
+
+ }
+
+ public class Edges__
+ {
+ public string Id { get; set; }
+ public string type { get; set; }
+ public string sourceNodeId { get; set; }
+ public string targetNodeId { get; set; }
+ public Point startPoint { get; set; }
+ public Point endPoint { get; set; }
+ public Properties_ properties { get; set; }
+ public Point[] pointsList { get; set; }
+ }
+
+ public class Point
+ {
+ public int x { get; set; }
+ public int y { get; set; }
+ }
+
+
+}
diff --git a/DOAN.Model/MES/Base/Dto/BaseSupplierDto.cs b/DOAN.Model/MES/Base/Dto/BaseSupplierDto.cs
new file mode 100644
index 0000000..ddfb9a2
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseSupplierDto.cs
@@ -0,0 +1,57 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 供应商信息查询对象
+ ///
+ public class BaseSupplierQueryDto : PagerInfo
+ {
+ public string SupplierNo { get; set; }
+
+ public string SupplierName { get; set; }
+ public int? Type { get; set; }
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 供应商信息输入输出对象
+ ///
+ public class BaseSupplierDto
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public string SupplierNo { get; set; }
+
+ public string SupplierName { get; set; }
+
+ public string SupplierAddress { get; set; }
+
+ ///
+ /// 供应商简称
+ ///
+ public string SupplierAddName { get; set; }
+
+ public string SupplierLiaison { get; set; }
+
+ public string SupplierPhone { get; set; }
+
+ public int? Type { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseUnitDto.cs b/DOAN.Model/MES/Base/Dto/BaseUnitDto.cs
new file mode 100644
index 0000000..270a012
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseUnitDto.cs
@@ -0,0 +1,45 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 单位信息查询对象
+ ///
+ public class BaseUnitQueryDto : PagerInfo
+ {
+ public string UnitName { get; set; }
+
+ public string UnitCode { get; set; }
+
+
+ public int Status { get; set; }
+ }
+
+ ///
+ /// 单位信息输入输出对象
+ ///
+ public class BaseUnitDto
+ {
+ [Required(ErrorMessage = "自增不能为空")]
+ public int Id { get; set; }
+
+ public string UnitName { get; set; }
+
+ public string UnitCode { get; set; }
+
+ public string Remark { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseWorkProcessesDto.cs b/DOAN.Model/MES/Base/Dto/BaseWorkProcessesDto.cs
new file mode 100644
index 0000000..2fa04b3
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseWorkProcessesDto.cs
@@ -0,0 +1,111 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 生产工序查询对象
+ ///
+ public class BaseWorkProcessesQueryDto : PagerInfo
+ {
+ public string Name { get; set; }
+
+ public int? Status { get; set; }
+ public string DictWorkType { get; set; }
+ }
+ public class BaseWorkProcessesQueryDto2 : PagerInfo
+ {
+ public string Name { get; set; }
+
+ public int? Status { get; set; }
+ public string DictWorkType { get; set; }
+
+
+ public int FkRouteCode { get; set; }
+ }
+
+ ///
+ /// 生产工序输入输出对象
+ ///
+ public class BaseWorkProcessesDto
+ {
+ public int? Id { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string Name { get; set; }
+
+ public List BindedWorkStationArray { get; set; }
+
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+
+ ///
+ /// 生产工序输入输出对象
+ ///
+ public class BaseWorkProcessesDto2
+ {
+ public int? Id { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string Name { get; set; }
+
+ public int? Status { get; set; }
+
+ public int[] BindedWorkStationArray { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+
+ public class BaseWorkProcessesDto3
+ {
+ public int? Id { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string Name { get; set; }
+
+ public int fk_id { get; set; }
+
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/BaseWorkRouteDto.cs b/DOAN.Model/MES/Base/Dto/BaseWorkRouteDto.cs
new file mode 100644
index 0000000..1b4f2c8
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseWorkRouteDto.cs
@@ -0,0 +1,71 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 工艺路线查询对象
+ ///
+ public class BaseWorkRouteQueryDto : PagerInfo
+ {
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 工艺路线输入输出对象
+ ///
+ public class BaseWorkRouteDto
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public string LogicFlowData { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+ }
+
+ ///
+ /// 工艺路线输入输出对象 带工序的
+ ///
+ public class BaseWorkRouteDto_bind_process
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public List BaseWorkProcessesList { get; set; }
+ public string Name { get; set; }
+
+ public string Code { get; set; }
+
+ public string LogicFlowData { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
diff --git a/DOAN.Model/MES/Base/Dto/BaseWorkStationDto.cs b/DOAN.Model/MES/Base/Dto/BaseWorkStationDto.cs
new file mode 100644
index 0000000..5cb53e6
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/BaseWorkStationDto.cs
@@ -0,0 +1,109 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 工位查询对象
+ ///
+ public class BaseWorkStationQueryDto : PagerInfo
+ {
+ public string WorkStationDescription { get; set; }
+ public int? Status { get; set; }
+
+ }
+
+ public class BaseWorkStationQueryDto2 : PagerInfo
+ {
+ public int route_id { get; set; }
+
+ }
+
+ ///
+ /// 工位输入输出对象
+ ///
+ public class BaseWorkStationDto
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public int? FkWorkProcesses { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string WorkStationDescription { get; set; }
+
+ public List BindedDeviceArray { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+
+ public class BaseWorkStationDto3
+ {
+ ///
+ /// 1 被选中 0 未选中
+ ///
+ public int flag { get; set; }
+
+ public int Id { get; set; }
+
+ public int? FkWorkProcesses { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string WorkStationDescription { get; set; }
+
+
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+
+
+
+ }
+ ///
+ /// 添加工位和修改工位使用
+ ///
+ public class BaseWorkStationDto2
+ {
+ [Required(ErrorMessage = "主键不能为空")]
+ public int Id { get; set; }
+
+ public int? FkWorkProcesses { get; set; }
+
+ public string DictWorkType { get; set; }
+
+ public string WorkStationDescription { get; set; }
+
+ public int[] BindedDeviceArray { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Base/Dto/RouteANDprocess.cs b/DOAN.Model/MES/Base/Dto/RouteANDprocess.cs
new file mode 100644
index 0000000..0ec43e2
--- /dev/null
+++ b/DOAN.Model/MES/Base/Dto/RouteANDprocess.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.base_.Dto
+{
+ ///
+ /// 工艺路线与工序父子表
+ ///
+ public class RouteANDprocess
+ {
+ ///
+ /// 工艺路线id
+ ///
+ public int parentId { get; set; }
+ ///
+ /// 工序id
+ ///
+ public int Id { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+ }
+}
diff --git a/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs b/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs
new file mode 100644
index 0000000..0006ff8
--- /dev/null
+++ b/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs
@@ -0,0 +1,317 @@
+
+namespace DOAN.Model.MES.product.Dto
+{
+ ///
+ /// 工单查询对象
+ ///
+ public class ProWorkorderQueryDto : PagerInfo
+ {
+ public string productionName { get; set; }
+
+ public string productionCode { get; set; }
+
+ public string Workorder { get; set; }
+
+
+ public string RouteCode { get; set; }
+ public string GroupCode { get; set; }
+
+ public int Status { get; set; }
+
+ public DateTime[] WorkorderDate { get; set; } = new DateTime[2];
+ }
+
+ public class ProWorkorderQueryDto2
+ {
+ public DateTime WorkorderDate { get; set; }
+ }
+
+
+
+
+ ///
+ /// 工单输入输出对象
+ ///
+ public class ProWorkorderDto
+ {
+ [Required(ErrorMessage = "雪花不能为空")]
+ public string Id { get; set; }
+
+ [Required(ErrorMessage = "工单号(一旦确定,不可更改)不能为空")]
+ public string Workorder { get; set; }
+
+ public string productionName { get; set; }
+
+ public string productionCode { get; set; }
+
+ public string Unit { get; set; }
+
+ public int? PlanNum { get; set; }
+
+ public int? Sort { get; set; }
+
+
+ public DateTime? WorkorderDate { get; set; }
+
+ public int? Priority { get; set; }
+
+ public int? Beat { get; set; }
+
+ public int? Status { get; set; }
+
+ public DateTime? InstructionDate { get; set; }
+
+ public string MaterialName { get; set; }
+
+ public string MaterialtextureCode { get; set; }
+
+ public string MaterialCode { get; set; }
+
+ public string DrawingCode { get; set; }
+
+ public string Version { get; set; }
+
+ public string StoveCode { get; set; }
+
+ public string WorkshopCode { get; set; }
+
+ public string RouteCode { get; set; }
+
+ public string GroupCode { get; set; }
+
+ public string Remark01 { get; set; }
+
+ public string Remark02 { get; set; }
+
+ public string Remark03 { get; set; }
+
+ public string Remark04 { get; set; }
+
+ public string Remark05 { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ [ExcelColumn(Name = "工单状态(1 init,2 start 3 end))")]
+ public string StatusLabel { get; set; }
+ }
+
+
+ ///
+ /// 工单备料进度
+ ///
+ public class MaterialPreparationProgress
+ {
+ ///
+ /// 工单号
+ ///
+ public string WorkOrder { get; set; }
+
+ ///
+ /// 0未备料 1备料中 2备料已经完成
+ ///
+ public int PreparationStatus { get; set; }
+
+ ///
+ /// 已经备料任务数
+ ///
+ public int Preparationed_num { get; set; }
+
+ ///
+ /// 全部备料任务数
+ ///
+ public int Preparation_all_num { get; set; }
+ }
+
+ ///
+ /// 工单 带 完成数量
+ ///
+ public class ProWorkorderDto4 : ProWorkorderDto
+ {
+ ///
+ /// 完成数量
+ ///
+ public int? FinishNum { get; set; }
+
+ public MaterialPreparationProgress progress { get; set; }
+ }
+
+ public class ProWorkorderDto2 : ProWorkorderDto
+ {
+ ///
+ /// 下一个工单号
+ ///
+
+ public string next_id { get; set; }
+ }
+
+ ///
+ /// 带参数报警
+ ///
+ public class ProWorkorderDto3 : ProWorkorderDto
+ {
+ ///
+ /// 物料code在物料清单是否存在
+ ///
+ public string IsMatch_material_code { get; set; }
+
+
+ ///
+ /// 物料name在物料清单是否存在
+ ///
+ public string IsMatch_material_name { get; set; }
+
+
+ ///
+ /// 工艺路线是否存在
+ ///
+ public string IsMatch_line { get; set; }
+
+
+ ///
+ /// 组是否存在
+ ///
+ public string IsMatch_group { get; set; }
+
+
+ ///
+ /// 单位是否存在
+ ///
+ public string IsMatch_Unit { get; set; }
+ }
+ ///
+ /// 工单BOM 及其所需数量
+ ///
+
+ public class WorkOrderBom
+ {
+ ///
+ /// 子件编码
+ ///
+
+ public string SubInvCode { get; set; }
+
+ ///
+ /// 子件名称
+ ///
+
+ public string SubInvName { get; set; }
+
+ ///
+ /// 单件数量
+ ///
+ public string Iusequantity_Single { get; set; }
+
+ ///
+ /// 使用总数量
+ ///
+
+ public string Iusequantity_All { get; set; }
+
+ ///
+ /// BOM版本号
+ ///
+
+ public string BOMVersion { get; set; }
+ }
+
+ ///
+ /// 工单进度追溯
+ ///
+ public class ProWorkorderTranceProgressDto
+ {
+ ///
+ /// 雪花id
+ ///
+ public string Id { get; set; }
+
+ ///
+ /// 工单号
+ ///
+ public string Workorder { get; set; }
+
+ ///
+ /// 存货编码
+ ///
+ public string productionCode { get; set; }
+
+ ///
+ /// 产品名称
+ ///
+ public string productionName { get; set; }
+
+ ///
+ /// 规格型号
+ ///
+ public string Specification { get; set; }
+
+
+ ///
+ /// 交货数量
+ ///
+ public int? DeliveryNum { get; set; }
+
+ ///
+ /// 组别
+ ///
+ public string GroupCode { get; set; }
+
+ ///
+ /// 线别
+ ///
+ public string RouteCode { get; set; }
+
+ ///
+ /// 序号
+ ///
+ public int? Sort { get; set; }
+
+ ///
+ /// 工单日期
+ ///
+ public DateTime? WorkorderDate { get; set; }
+
+ ///
+ /// 优先级 1-100
+ ///
+ public int? Priority { get; set; }
+
+ ///
+ /// 工单状态
+ ///
+ public int? Status { get; set; }
+
+
+ ///
+ /// 工单开始时间
+ ///
+
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 工单结束时间
+
+ public DateTime? EndTime { get; set; }
+
+
+ ///
+ /// 计划数量
+ ///
+ public int? PlanNum { get; set; }
+
+
+ ///
+ /// 实际数量
+ ///
+ public int? ActualNum { get; set; }
+ }
+
+
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Product/ProReportwork.cs b/DOAN.Model/MES/Product/ProReportwork.cs
new file mode 100644
index 0000000..463d9b7
--- /dev/null
+++ b/DOAN.Model/MES/Product/ProReportwork.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.product
+{
+ ///
+ /// 报工表
+ ///
+ [SugarTable("pro_reportwork")]
+ public class ProReportwork
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 工单号
+ ///
+ [SugarColumn(ColumnName = "fk_workorder")]
+ public string FkWorkorder { get; set; }
+
+ ///
+ /// 派发数量
+ ///
+ [SugarColumn(ColumnName = "dispatch_num")]
+ public int? DispatchNum { get; set; }
+
+ ///
+ /// 完成数量
+ ///
+ [SugarColumn(ColumnName = "finished_num")]
+ public int? FinishedNum { get; set; }
+
+ ///
+ /// 组code
+ ///
+ [SugarColumn(ColumnName = "group_code")]
+ public string GroupCode { get; set; }
+
+ ///
+ /// 线code
+ ///
+ [SugarColumn(ColumnName = "line_code")]
+ public string LineCode { get; set; }
+
+ ///
+ /// 合格数
+ ///
+ [SugarColumn(ColumnName = "qualified_number")]
+ public int? QualifiedNumber { get; set; }
+
+ ///
+ /// 不合格数
+ ///
+ [SugarColumn(ColumnName = "unqualified_number")]
+ public int? UnqualifiedNumber { get; set; }
+
+ ///
+ /// 返工数
+ ///
+ [SugarColumn(ColumnName = "rework_number")]
+ public int? ReworkNumber { get; set; }
+
+ ///
+ /// 报废数
+ ///
+ [SugarColumn(ColumnName = "scrap_number")]
+ public int? ScrapNumber { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Product/ProWorkorder.cs b/DOAN.Model/MES/Product/ProWorkorder.cs
new file mode 100644
index 0000000..74dda31
--- /dev/null
+++ b/DOAN.Model/MES/Product/ProWorkorder.cs
@@ -0,0 +1,179 @@
+
+namespace DOAN.Model.MES.product
+{
+ ///
+ /// 工单
+ ///
+ [SugarTable("pro_workorder")]
+ public class ProWorkorder
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 工单号(一旦确定,不可更改)
+ ///
+ public string Workorder { get; set; }
+
+ ///
+ /// 主体品名
+ ///
+ [SugarColumn(ColumnName = "production_name")]
+ public string productionName { get; set; }
+
+ ///
+ /// 主体型号
+ ///
+ [SugarColumn(ColumnName = "production_code")]
+ public string productionCode { get; set; }
+
+ ///
+ /// 单位
+ ///
+ public string Unit { get; set; }
+
+ ///
+ /// 计划数量
+ ///
+ [SugarColumn(ColumnName = "plan_num")]
+ public int? PlanNum { get; set; }
+
+ ///
+ /// 序号
+ ///
+ public int? Sort { get; set; }
+
+ ///
+ /// 工单日期
+ ///
+ [SugarColumn(ColumnName = "workorder_date")]
+ public DateTime? WorkorderDate { get; set; }
+
+ ///
+ /// 优先级(1正常 2插单 3 紧急)
+ ///
+ public int? Priority { get; set; }
+
+ ///
+ /// 节拍(s)
+ ///
+ public int? Beat { get; set; }
+
+ ///
+ /// 工单状态(1 init,2 start 3 end))
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 指示日期
+ ///
+ [SugarColumn(ColumnName = "instruction_date")]
+ public DateTime? InstructionDate { get; set; }
+
+ ///
+ /// 材料型号
+ ///
+ [SugarColumn(ColumnName = "material_name")]
+ public string MaterialName { get; set; }
+
+ ///
+ /// 材质
+ ///
+ [SugarColumn(ColumnName = "materialtexture_code")]
+ public string MaterialtextureCode { get; set; }
+
+ ///
+ /// 材料编码
+ ///
+ [SugarColumn(ColumnName = "material_code")]
+ public string MaterialCode { get; set; }
+
+ ///
+ /// 图号
+ ///
+ [SugarColumn(ColumnName = "drawing_code")]
+ public string DrawingCode { get; set; }
+
+ ///
+ /// 版本
+ ///
+ public string Version { get; set; }
+
+ ///
+ /// 炉号
+ ///
+ [SugarColumn(ColumnName = "stove_code")]
+ public string StoveCode { get; set; }
+
+ ///
+ /// 车间code
+ ///
+ [SugarColumn(ColumnName = "workshop_code")]
+ public string WorkshopCode { get; set; }
+
+ ///
+ /// 线别code
+ ///
+ [SugarColumn(ColumnName = "route_code")]
+ public string RouteCode { get; set; }
+
+ ///
+ /// 组code
+ ///
+ [SugarColumn(ColumnName = "group_code")]
+ public string GroupCode { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark01 { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark02 { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark03 { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark04 { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark05 { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Product/ProWorkorderUpdateLog.cs b/DOAN.Model/MES/Product/ProWorkorderUpdateLog.cs
new file mode 100644
index 0000000..6c48760
--- /dev/null
+++ b/DOAN.Model/MES/Product/ProWorkorderUpdateLog.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.product
+{
+ ///
+ /// 工单修改日志
+ ///
+ [SugarTable("pro_workorder_update_log")]
+ public class ProWorkorderUpdateLog
+ {
+
+ ///
+ /// 雪花id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+
+ ///
+ /// 工单号
+ ///
+ [SugarColumn(ColumnName = "workorder")]
+ public string Workorder { get; set; }
+
+ ///
+ /// log
+ ///
+ [SugarColumn(ColumnName = "log")]
+ public string Log { get; set; }
+
+
+ ///
+ /// 状态更改时间
+ ///
+ [SugarColumn(ColumnName = "change_time")]
+ public DateTime? ChangeTime { get; set; }
+
+
+ ///
+ /// 操作者
+ ///
+ [SugarColumn(ColumnName = "operator")]
+ public string Operator { get; set; }
+
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "CREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "CREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "UPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "UPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
diff --git a/DOAN.Repository/BaseRepository.cs b/DOAN.Repository/BaseRepository.cs
index d39ead2..0932457 100644
--- a/DOAN.Repository/BaseRepository.cs
+++ b/DOAN.Repository/BaseRepository.cs
@@ -17,6 +17,13 @@ namespace DOAN.Repository
///
public class BaseRepository : SimpleClient where T : class, new()
{
+ public string XueHua
+ {
+ get
+ {
+ return SnowFlakeSingle.Instance.NextId().ToString();
+ }
+ }
public ITenant itenant = null;//多租户事务
public BaseRepository(ISqlSugarClient context = null) : base(context)
{
@@ -347,5 +354,31 @@ namespace DOAN.Repository
page.Result = result.Adapt>();
return page;
}
+ ///
+ /// 分页查询 不转
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static PagedInfo ToPage_NO_Convert(this ISugarQueryable source, PagerInfo parm)
+ {
+ var page = new PagedInfo();
+ var total = 0;
+ page.PageSize = parm.PageSize;
+ page.PageIndex = parm.PageNum;
+ if (parm.Sort.IsNotEmpty())
+ {
+ source.OrderByPropertyName(parm.Sort, parm.SortType.Contains("desc") ? OrderByType.Desc : OrderByType.Asc);
+ }
+ var result = source
+ //.OrderByIF(parm.Sort.IsNotEmpty(), $"{parm.Sort.ToSqlFilter()} {(!string.IsNullOrWhiteSpace(parm.SortType) && parm.SortType.Contains("desc") ? "desc" : "asc")}")
+ .ToPageList(parm.PageNum, parm.PageSize, ref total);
+
+ page.TotalNum = total;
+ page.Result = result;
+ return page;
+ }
+
}
}
diff --git a/DOAN.Service/DOAN.Service.csproj b/DOAN.Service/DOAN.Service.csproj
index 4ed2e15..6816838 100644
--- a/DOAN.Service/DOAN.Service.csproj
+++ b/DOAN.Service/DOAN.Service.csproj
@@ -8,6 +8,9 @@
1591
+
+
+
diff --git a/DOAN.Service/MES/Product/IService/IProWorkorderService.cs b/DOAN.Service/MES/Product/IService/IProWorkorderService.cs
new file mode 100644
index 0000000..4aee5b2
--- /dev/null
+++ b/DOAN.Service/MES/Product/IService/IProWorkorderService.cs
@@ -0,0 +1,66 @@
+using System;
+using DOAN.Model;
+
+using DOAN.Model.MES.product;
+using DOAN.Model.MES.product.Dto;
+using DOAN.Model.System.Dto;
+using DOAN.Model.System;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using DOAN.Model.MES.base_;
+using DOAN.Model.MES.base_.Dto;
+using SqlSugar;
+
+
+
+namespace DOAN.Service.MES.product.IService
+{
+ ///
+ /// 生产工单service接口
+ ///
+ public interface IProWorkorderService : IBaseService
+ {
+ PagedInfo GetList(ProWorkorderQueryDto parm);
+ PagedInfo GetList_NOCheck(ProWorkorderQueryDto parm);
+
+
+ PagedInfo GetWorkorderTraceProgressList(ProWorkorderQueryDto query);
+
+ ProWorkorder GetInfo(string Id);
+
+ ProWorkorder AddProWorkorder(ProWorkorder parm);
+
+ int UpdateProWorkorder(ProWorkorder parm);
+
+ int Generate_workorder(ProWorkorderQueryDto2 parm);
+
+ int Insert_workOrder(ProWorkorder proWorkorder, string next_id);
+
+ int MoveWorkorder(string id, int type);
+
+ int ImportData(IFormFile formFile,string username);
+
+
+ int ImportDataAppend(IFormFile formFile,string username);
+
+ public PagedInfo WorkOrderExport(DateTime exportTime, PagerInfo pager);
+
+ List GetMaterialInfo(BaseMaterialListQueryDto5 parm);
+ List GetCustomInfo(BaseCustomQueryDto2 parm);
+
+ // List GetGroupList(DateTime dateTime);
+
+ List GetProcessRoute(DateTime dateTime);
+
+ List GetAllRoute();
+
+
+ // List GetGroupList(string route_code, DateTime dateTime);
+
+ List GetGroupList();
+
+ List SearchBOMNum(string workorder_num);
+
+ int WorkOrderLog(string workorder, string log, string Operator);
+ }
+}
diff --git a/DOAN.Service/MES/Product/ProWorkorderService.cs b/DOAN.Service/MES/Product/ProWorkorderService.cs
new file mode 100644
index 0000000..b5d803c
--- /dev/null
+++ b/DOAN.Service/MES/Product/ProWorkorderService.cs
@@ -0,0 +1,1236 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using DOAN.Model;
+
+using DOAN.Model.MES.product;
+using DOAN.Model.MES.product.Dto;
+
+using DOAN.Repository;
+using DOAN.Service.MES.product.IService;
+
+using System.Linq;
+using SqlSugar.Extensions;
+using MimeKit.Tnef;
+using DOAN.Model.MES.base_;
+using Microsoft.AspNetCore.Http;
+using DOAN.Model.System;
+using MiniExcelLibs;
+using NPOI.SS.Formula.Functions;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using System.Data.Common;
+using NPOI.XWPF.UserModel;
+using NPOI.HSSF.UserModel;
+using Microsoft.AspNetCore.Components.Forms;
+using System.Globalization;
+using System.ComponentModel;
+using NPOI.Util;
+using DOAN.Model.MES.base_.Dto;
+using Aliyun.OSS;
+
+using Mapster;
+using Microsoft.AspNetCore.Authentication;
+using System.Reflection;
+
+using Infrastructure;
+using Infrastructure.Converter;
+using Microsoft.Extensions.Logging;
+using Microsoft.AspNetCore.Http.HttpResults;
+using DOAN.Model.MES.product;
+
+namespace DOAN.Service.MES.product
+{
+ ///
+ /// 生产工单Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IProWorkorderService), ServiceLifetime = LifeTime.Transient)]
+ public class ProWorkorderService : BaseService, IProWorkorderService
+ {
+ ///
+ /// 查询生产工单列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(ProWorkorderQueryDto parm)
+ {
+ if (parm.WorkorderDate != null && parm.WorkorderDate.Length > 0)
+ {
+ parm.WorkorderDate[0] = parm.WorkorderDate[0].Date;
+ parm.WorkorderDate[1] = parm.WorkorderDate[1].Date;
+
+ }
+
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.productionName), it => it.productionName.Contains(parm.productionName))
+ .AndIF(!string.IsNullOrEmpty(parm.productionCode), it => it.productionCode.Contains(parm.productionCode))
+ .AndIF(!string.IsNullOrEmpty(parm.RouteCode), it => it.RouteCode == parm.RouteCode)
+ .AndIF(!string.IsNullOrEmpty(parm.GroupCode), it => it.GroupCode == parm.GroupCode)
+ .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= parm.WorkorderDate[0])
+ .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= parm.WorkorderDate[1])
+ ;
+ var query = Queryable()
+ .Where(predicate.ToExpression());
+ var finalQuery = Context.Queryable(query)
+ .LeftJoin((q, m) => q.productionCode == m.Code)
+ .LeftJoin((q, m, m2) => q.productionName == m2.Name)
+ .LeftJoin((q, m, m2, r) => q.RouteCode == r.Code)
+ .LeftJoin((q, m, m2, r, g) => q.GroupCode == g.GroupCode)
+ .LeftJoin((q, m, m2, r, g, u) => q.Unit == u.UnitCode)
+ .Select((q, m, m2, r, g, u) => new ProWorkorderDto3()
+ {
+ IsMatch_material_code = m.Code,
+ IsMatch_material_name = m2.Name,
+ IsMatch_line = r.Code,
+ IsMatch_group = g.GroupCode,
+ IsMatch_Unit = u.UnitCode,
+ }, true);
+
+ var response = finalQuery.MergeTable().Distinct().OrderBy(it => it.WorkorderDate).ToPage(parm);
+
+ //var query = Queryable()
+ // .Where(predicate.ToExpression());
+ ////TODO 添加校验
+
+ //var query1 = Context.Queryable(query).LeftJoin((q, m) => q.productionCode == m.Code)
+ // .Select((q, m) => new ProWorkorderDto3()
+ // {
+
+ // IsMatch_material_code = m.Code
+
+ // }, true);
+
+ //var query2 = Context.Queryable(query1).LeftJoin((q1, m) => q1.productionName == m.Name)
+ // .Select((q1, m) => new ProWorkorderDto3()
+ // {
+
+ // IsMatch_material_name = m.Name
+
+ // }, true);
+
+ //var query3 = Context.Queryable(query2).LeftJoin((q2, r) => q2.RouteCode == r.Code)
+ // .Select((q2, r) => new ProWorkorderDto3()
+ // {
+ // IsMatch_line = r.Code??""
+
+ // }, true);
+
+ //var query4 = Context.Queryable(query3).LeftJoin((q3, g) => q3.GroupCode == g.GroupCode)
+ // .Select((q3, g) => new ProWorkorderDto3()
+ // {
+ // IsMatch_group = g.GroupCode
+
+ // }, true);
+ //var response = query4.MergeTable().OrderBy(it => it.WorkorderDate).ToPage(parm);
+
+
+
+
+ return response;
+ }
+
+
+ ///
+ /// 获取工单无校验
+ ///
+ ///
+ ///
+ public PagedInfo GetList_NOCheck(ProWorkorderQueryDto parm)
+ {
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.productionName), it => it.productionName.Contains(parm.productionName))
+ .AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder))
+
+ .AndIF(!string.IsNullOrEmpty(parm.productionCode), it => it.productionCode.Contains(parm.productionCode))
+ .AndIF(!string.IsNullOrEmpty(parm.RouteCode), it => it.RouteCode == parm.RouteCode)
+ .AndIF(!string.IsNullOrEmpty(parm.GroupCode), it => it.GroupCode == parm.GroupCode)
+ .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= parm.WorkorderDate[0])
+ .AndIF(parm.WorkorderDate != null && parm.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= parm.WorkorderDate[1])
+
+ ;
+
+ var query = Queryable()
+ .Where(predicate.ToExpression()).ToPage(parm);
+
+ return query;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public ProWorkorder GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加生产工单
+ ///
+ ///
+ ///
+ public ProWorkorder AddProWorkorder(ProWorkorder model)
+ {
+ model.Id = SnowFlakeSingle.Instance.NextId().ToString();
+
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改生产工单
+ ///
+ ///
+ ///
+ public int UpdateProWorkorder(ProWorkorder model)
+ {
+ //增加日志
+ /*ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
+ logObj.Id = XueHua;
+ logObj.Workorder = model.Workorder;
+ logObj.Log = "修改生产工单";
+ logObj.ChangeTime = DateTime.Now;
+ logObj.Operator = model.CreatedBy;
+ Context.Insertable(logObj).ExecuteCommand();*/
+
+ var response = Update(model, true);
+ return response;
+
+ }
+
+
+ ///
+ /// 生成工单号
+ ///
+ ///
+ ///
+ public int Generate_workorder(ProWorkorderQueryDto2 parm)
+ {
+ DateTime update_time = parm.WorkorderDate.ToLocalTime().Date;
+
+ List proWorkorderList = Context.Queryable().Where(it => it.WorkorderDate == update_time)
+ .Where(it => it.Status == 1)
+ .OrderBy(it => it.Sort).ToList();
+ string maxs = Context.Queryable().Where(it => it.WorkorderDate == update_time)
+ .Where(it => it.Status == 3).Max(it => it.Workorder);
+
+
+ if (proWorkorderList != null && proWorkorderList.Count() > 0)
+ {
+
+ string baseSort = update_time.ToString("yyyyMMdd");
+ int index = 1;
+ if (!string.IsNullOrEmpty(maxs))
+ {
+ index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
+
+ }
+
+ foreach (ProWorkorder item in proWorkorderList)
+ {
+ item.Workorder = baseSort + index.ToString("000");
+ item.Sort = index * 10;
+ index++;
+ }
+ }
+ return Context.Updateable(proWorkorderList).ExecuteCommand();
+ }
+
+
+ ///
+ /// 插入工单、新增工单
+ ///
+ ///
+ ///
+ ///
+ ///
+ public int Insert_workOrder(ProWorkorder proWorkorder, string next_id)
+ {
+ int result = 0;
+ proWorkorder.Id = XueHua;
+ proWorkorder.WorkorderDate= DOANConvertDate.ConvertLocalDate(proWorkorder.WorkorderDate??DateTime.MinValue);
+
+ DateTime handleDate = proWorkorder.WorkorderDate.Value;
+ //插入工单
+ if (!string.IsNullOrEmpty(next_id) && next_id != "-1")
+ {
+ // 向前插工单
+ UseTran2(() =>
+ {
+ ProWorkorder maxs = Context.Queryable().Where(it => it.WorkorderDate == handleDate)
+ .OrderByDescending(it =>SqlFunc.Right(it.Workorder,3)).First();
+ int index = 1;
+ if (!string.IsNullOrEmpty(maxs.Workorder))
+ {
+ index = Convert.ToInt32(maxs.Workorder.Substring(maxs.Workorder.Length - 3)) + 1;
+
+ }
+ proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000");
+
+
+
+ int sortNum = Context.Queryable().Where(it => it.Id == next_id).Select(it => it.Sort.Value).First();
+ // 调整序号
+ Context.Updateable()
+ .Where(it => it.WorkorderDate == handleDate)
+ .Where(it => it.Sort >= sortNum)
+ .SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
+ .ExecuteCommand();
+ proWorkorder.Sort = sortNum;
+ proWorkorder.Status = 1;
+
+
+
+ //增加日志
+ ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
+ logObj.Id = XueHua;
+ logObj.Workorder = proWorkorder.Workorder;
+ logObj.Log = "手动新增";
+ logObj.ChangeTime = DateTime.Now;
+ logObj.Operator = proWorkorder.CreatedBy;
+ logObj.ChangeTime= DateTime.Now;
+ logObj.CreatedBy = proWorkorder.CreatedBy;
+ UseTran2(() =>
+ {
+ result = Context.Insertable(proWorkorder).ExecuteCommand();
+ Context.Insertable(logObj).ExecuteCommand();
+ });
+
+ });
+ }
+ else
+ {
+ // 新增工单
+ int sortNum = Context.Queryable().Where(it => it.WorkorderDate == handleDate).Max(it => it.Sort.Value);
+
+ ProWorkorder maxWorkorder = Context.Queryable().Where(it => it.WorkorderDate == handleDate)
+ .OrderByDescending(it =>SqlFunc.Right(it.Workorder,3)).First();
+
+ int index = 0;
+ if (maxWorkorder == null)
+ {
+ index = 1;
+ proWorkorder.Sort = 10;
+ }
+ else
+ {
+ string maxs = maxWorkorder.Workorder;
+ index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
+ proWorkorder.Sort = maxWorkorder.Sort + 10;
+ }
+ proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000");
+
+
+ proWorkorder.Status = 1;
+
+
+ //增加日志
+ ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
+ logObj.Id = XueHua;
+ logObj.Workorder = proWorkorder.Workorder;
+ logObj.Log = "手动新增";
+ logObj.ChangeTime = DateTime.Now;
+ logObj.Operator = proWorkorder.CreatedBy;
+ logObj.ChangeTime= DateTime.Now;
+ logObj.CreatedBy = proWorkorder.CreatedBy;
+ UseTran2(() =>
+ {
+ result = Context.Insertable(proWorkorder).ExecuteCommand();
+ Context.Insertable(logObj).ExecuteCommand();
+ });
+
+
+
+ }
+
+ return result;
+
+ }
+
+
+ ///
+ /// 移动工单移动工单
+ ///
+ ///
+ ///
+ ///
+ public int MoveWorkorder(string id, int type)
+ {
+ int result = 0;
+ ProWorkorder toMove = Context.Queryable().Where(it => it.Id == id).First();
+ var pervious = Context.Queryable()
+ .Where(it => it.WorkorderDate == toMove.WorkorderDate);
+
+
+ //上移动
+ if (type == 1)
+ {
+
+
+ pervious = pervious.Where(it => it.Sort <= toMove.Sort).OrderByDescending(it => it.Sort);
+
+
+ }
+ //下移
+ else if (type == 2)
+ {
+
+
+ pervious = pervious.Where(it => it.Sort >= toMove.Sort).OrderBy(it => it.Sort);
+ }
+ ProWorkorder exchange = pervious.Skip(1).Take(1).First();
+ if (exchange != null)
+ {
+ int temp = toMove.Sort.Value;
+ toMove.Sort = exchange.Sort;
+ exchange.Sort = temp;
+ result += Context.Updateable(toMove).ExecuteCommand();
+ result += Context.Updateable(exchange).ExecuteCommand();
+
+ }
+
+
+
+ return result;
+
+ }
+
+
+ ///
+ /// 导入工单 必须整删除 整改
+ ///
+ ///
+ ///
+ public int ImportData(IFormFile formFile, string username)
+ {
+ int result = 0;
+ List workorderList = new();
+ DateTime dateValue = DateTime.MinValue;
+ using (var stream = formFile.OpenReadStream())
+ {
+ try
+ {
+ IWorkbook workbook = new XSSFWorkbook(stream);
+ ISheet sheet = workbook.GetSheetAt(0);
+ // 处理第2行 获取日期
+
+ IRow secondRow = sheet.GetRow(1);
+ NPOI.SS.UserModel.ICell cell = secondRow.GetCell(0);
+
+
+ // 将单元格的数字值转换为DateTime
+ dateValue = cell.DateCellValue.Value;
+ #region 读取excel
+ // 遍历每一行
+ for (int row = 4; row <= sheet.LastRowNum; row++)
+ {
+ IRow currentRow = sheet.GetRow(row);
+ if (currentRow != null) // 确保行不为空
+ {
+ ProWorkorder workorder = new ProWorkorder();
+
+ //00主体品名
+ NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
+
+ workorder.productionName = currentCell_01?.ToString();
+ if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName))
+ {
+ continue;
+ }
+
+ //01主体型号
+ NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
+
+ workorder.productionCode = currentCell_02?.ToString();
+ if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode))
+ {
+ continue;
+ }
+
+
+
+ //02单位
+ NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
+
+ workorder.Unit = currentCell_04?.ToString();
+ if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit))
+ {
+ continue;
+ }
+
+
+
+
+ //3 plan_num
+ NPOI.SS.UserModel.ICell currentCell_07 = currentRow.GetCell(3);
+ workorder.PlanNum = (int)currentCell_07?.NumericCellValue;
+
+ //4 材料型号
+ NPOI.SS.UserModel.ICell currentCell_11 = currentRow.GetCell(4);
+
+ workorder.MaterialName = currentCell_11?.ToString();
+ if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName))
+ {
+ continue;
+ }
+
+
+ //5 材料编号
+ NPOI.SS.UserModel.ICell currentCell_12 = currentRow.GetCell(5);
+
+ workorder.MaterialCode = currentCell_12?.ToString();
+ if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode))
+ {
+ continue;
+ }
+
+
+ //6 材质
+ NPOI.SS.UserModel.ICell currentCell_13 = currentRow.GetCell(6);
+
+ workorder.MaterialtextureCode = currentCell_13?.ToString();
+ if (currentCell_13 == null || string.IsNullOrEmpty(workorder.MaterialtextureCode))
+ {
+ continue;
+ }
+
+ //7 炉号
+ NPOI.SS.UserModel.ICell currentCell_14 = currentRow.GetCell(7);
+
+ workorder.StoveCode = currentCell_14?.ToString();
+ if (currentCell_14 == null || string.IsNullOrEmpty(workorder.StoveCode))
+ {
+ continue;
+ }
+
+
+ //8 图号
+ NPOI.SS.UserModel.ICell currentCell_15 = currentRow.GetCell(8);
+
+ workorder.DrawingCode = currentCell_15?.ToString();
+ if (currentCell_15 == null || string.IsNullOrEmpty(workorder.DrawingCode))
+ {
+ continue;
+ }
+
+ //
+
+ //9 版本
+ NPOI.SS.UserModel.ICell currentCell_16 = currentRow.GetCell(9);
+
+ workorder.Version = currentCell_16?.ToString();
+
+ if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version))
+ {
+ continue;
+ }
+
+ //10指示日期
+ NPOI.SS.UserModel.ICell cell17 = secondRow.GetCell(10);
+
+
+ // 将单元格的数字值转换为DateTime
+ workorder.InstructionDate = cell17.DateCellValue.Value;
+
+
+ //装箱容积
+ /*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
+ workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
+
+
+
+ // 11车间code
+ NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
+ if (currentCell_18 == null)
+ {
+ workorder.GroupCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_18.CellType == CellType.Numeric)
+ {
+ workorder.GroupCode = currentCell_18.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.GroupCode = currentCell_18.StringCellValue;
+ }
+
+ }
+
+
+ //12 组别code
+ NPOI.SS.UserModel.ICell currentCell_19 = currentRow.GetCell(12);
+ if (currentCell_19 == null)
+ {
+ workorder.GroupCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_19.CellType == CellType.Numeric)
+ {
+ workorder.GroupCode = currentCell_19.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.GroupCode = currentCell_19.StringCellValue;
+ }
+
+ }
+ //13 线别code
+ NPOI.SS.UserModel.ICell currentCell_20 = currentRow.GetCell(13);
+
+ if (currentCell_20 == null)
+ {
+ workorder.RouteCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_20.CellType == CellType.Numeric)
+ {
+ workorder.RouteCode = currentCell_20.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.RouteCode = currentCell_20.StringCellValue;
+ }
+ }
+
+
+
+ //14 优先级
+ NPOI.SS.UserModel.ICell currentCell_21 = currentRow.GetCell(14);
+ if (currentCell_21.StringCellValue == "紧急")
+ {
+ workorder.Priority = 3;
+
+ }
+ else
+ {
+ if (currentCell_21.StringCellValue == "插单")
+ {
+ workorder.Priority = 2;
+
+ }
+ else if (currentCell_21.StringCellValue == "正常" || string.IsNullOrEmpty(currentCell_11.StringCellValue))
+ {
+ workorder.Priority = 1;
+
+ }
+ }
+
+ //15节拍
+ NPOI.SS.UserModel.ICell currentCell_22 = currentRow.GetCell(15);
+ workorder.Beat = (int)currentCell_22?.NumericCellValue;
+
+
+ //16备注
+ NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16);
+ workorder.Remark01 = currentCell_010.StringCellValue;
+
+ workorder.Id = XueHua;
+ workorder.CreatedBy = username;
+ workorder.CreatedTime = DateTime.Now;
+ workorder.WorkorderDate = dateValue;
+ workorder.Status = 1;
+ //工单 2024-9-13-组-线-序号
+ int index = (row - 2);
+ workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + index.ToString("000");
+ workorder.Sort = index * 10;
+
+
+ CultureInfo culture = CultureInfo.CurrentCulture;
+
+ workorderList.Add(workorder);
+
+ }
+ }
+ #endregion
+
+
+
+ }
+ catch (Exception ex)
+ {
+ return -1;
+
+
+ }
+
+
+
+ }
+ UseTran2(() =>
+ {
+
+ Context.Deleteable().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
+ result = Context.Insertable(workorderList).ExecuteCommand();
+ });
+ return result;
+ }
+
+ ///
+ /// 分批导入,追加导入
+ ///
+ ///
+ ///
+ ///
+ public int ImportDataAppend(IFormFile formFile, string username)
+ {
+ int result = 0;
+ List workorderList = new();
+ DateTime dateValue = DateTime.MinValue;
+
+
+ using (var stream = formFile.OpenReadStream())
+ {
+ try
+ {
+ IWorkbook workbook = new XSSFWorkbook(stream);
+ ISheet sheet = workbook.GetSheetAt(0);
+ // 处理第2行 获取日期
+
+ IRow secondRow = sheet.GetRow(1);
+ NPOI.SS.UserModel.ICell cell = secondRow.GetCell(0);
+
+
+ // 将单元格的数字值转换为DateTime
+ dateValue = cell.DateCellValue.Value;
+
+
+ // 遍历每一行
+ for (int row = 3; row <= sheet.LastRowNum; row++)
+ {
+ IRow currentRow = sheet.GetRow(row);
+ if (currentRow != null) // 确保行不为空
+ {
+ ProWorkorder workorder = new ProWorkorder();
+ #region 读取excel
+ //00主体品名
+ NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
+
+ workorder.productionName = currentCell_01?.ToString();
+ if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName))
+ {
+ continue;
+ }
+
+ //01主体型号
+ NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
+
+ workorder.productionCode = currentCell_02?.ToString();
+ if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode))
+ {
+ continue;
+ }
+
+
+
+ //02单位
+ NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
+
+ workorder.Unit = currentCell_04?.ToString();
+ if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit))
+ {
+ continue;
+ }
+
+
+
+
+ //3 plan_num
+ NPOI.SS.UserModel.ICell currentCell_07 = currentRow.GetCell(3);
+ workorder.PlanNum = (int)currentCell_07?.NumericCellValue;
+
+ //4 材料型号
+ NPOI.SS.UserModel.ICell currentCell_11 = currentRow.GetCell(4);
+
+ workorder.MaterialName = currentCell_11?.ToString();
+ if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName))
+ {
+ continue;
+ }
+
+
+ //5 材料编号
+ NPOI.SS.UserModel.ICell currentCell_12 = currentRow.GetCell(5);
+
+ workorder.MaterialCode = currentCell_12?.ToString();
+ if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode))
+ {
+ continue;
+ }
+
+
+ //6 材质
+ NPOI.SS.UserModel.ICell currentCell_13 = currentRow.GetCell(6);
+
+ workorder.MaterialtextureCode = currentCell_13?.ToString();
+ if (currentCell_13 == null || string.IsNullOrEmpty(workorder.MaterialtextureCode))
+ {
+ continue;
+ }
+
+ //7 炉号
+ NPOI.SS.UserModel.ICell currentCell_14 = currentRow.GetCell(7);
+
+ workorder.StoveCode = currentCell_14?.ToString();
+ if (currentCell_14 == null || string.IsNullOrEmpty(workorder.StoveCode))
+ {
+ continue;
+ }
+
+
+ //8 图号
+ NPOI.SS.UserModel.ICell currentCell_15 = currentRow.GetCell(8);
+
+ workorder.DrawingCode = currentCell_15?.ToString();
+ if (currentCell_15 == null || string.IsNullOrEmpty(workorder.DrawingCode))
+ {
+ continue;
+ }
+
+ //
+
+ //9 版本
+ NPOI.SS.UserModel.ICell currentCell_16 = currentRow.GetCell(9);
+
+ workorder.Version = currentCell_16?.ToString();
+
+ if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version))
+ {
+ continue;
+ }
+
+ //10指示日期
+ NPOI.SS.UserModel.ICell cell17 = secondRow.GetCell(10);
+
+
+ // 将单元格的数字值转换为DateTime
+ workorder.InstructionDate = cell17.DateCellValue.Value;
+
+
+ //装箱容积
+ /*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
+ workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
+
+
+
+ // 11车间code
+ NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
+ if (currentCell_18 == null)
+ {
+ workorder.GroupCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_18.CellType == CellType.Numeric)
+ {
+ workorder.GroupCode = currentCell_18.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.GroupCode = currentCell_18.StringCellValue;
+ }
+
+ }
+
+
+ //12 组别code
+ NPOI.SS.UserModel.ICell currentCell_19 = currentRow.GetCell(12);
+ if (currentCell_19 == null)
+ {
+ workorder.GroupCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_19.CellType == CellType.Numeric)
+ {
+ workorder.GroupCode = currentCell_19.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.GroupCode = currentCell_19.StringCellValue;
+ }
+
+ }
+ //13 线别code
+ NPOI.SS.UserModel.ICell currentCell_20 = currentRow.GetCell(13);
+
+ if (currentCell_20 == null)
+ {
+ workorder.RouteCode = string.Empty;
+ }
+ else
+ {
+ if (currentCell_20.CellType == CellType.Numeric)
+ {
+ workorder.RouteCode = currentCell_20.NumericCellValue.ToString();
+
+ }
+ else
+ {
+ workorder.RouteCode = currentCell_20.StringCellValue;
+ }
+ }
+
+
+
+ //14 优先级
+ NPOI.SS.UserModel.ICell currentCell_21 = currentRow.GetCell(14);
+ if (currentCell_21.StringCellValue == "紧急")
+ {
+ workorder.Priority = 3;
+
+ }
+ else
+ {
+ if (currentCell_21.StringCellValue == "插单")
+ {
+ workorder.Priority = 2;
+
+ }
+ else if (currentCell_21.StringCellValue == "正常" || string.IsNullOrEmpty(currentCell_11.StringCellValue))
+ {
+ workorder.Priority = 1;
+
+ }
+ }
+
+ //15节拍
+ NPOI.SS.UserModel.ICell currentCell_22 = currentRow.GetCell(15);
+ workorder.Beat = (int)currentCell_22?.NumericCellValue;
+
+
+ //16备注
+ NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16);
+ workorder.Remark01 = currentCell_010.StringCellValue;
+ #endregion
+
+
+ workorder.Id = XueHua;
+ workorder.CreatedBy = username;
+ workorder.CreatedTime = DateTime.Now;
+ workorder.WorkorderDate = dateValue;
+ workorder.Status = 1;
+ //获取当前日期工单序列号 和序号
+ DateTime currentDate = dateValue.Date;
+ var MaxWorkorder = Context.Queryable()
+ .Where(it => it.WorkorderDate == currentDate)
+ .OrderByDescending(it => it.Sort)
+ .Select(it => new { it.Workorder, it.Sort })
+ .First();
+ //工单 2024-9-13-组-线-序号
+ int index = (row - 2);
+
+ int flowNum = index +
+ Convert.ToInt16(MaxWorkorder.Workorder.Substring(MaxWorkorder.Workorder.Length - 3, 3));
+
+ workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + flowNum.ToString("000");
+
+
+ workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort);
+
+
+ CultureInfo culture = CultureInfo.CurrentCulture;
+
+ workorderList.Add(workorder);
+
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ return -1;
+
+
+ }
+
+
+
+ }
+ UseTran2(() =>
+ {
+
+ // Context.Deleteable().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
+ result = Context.Insertable(workorderList).ExecuteCommand();
+ });
+ return result;
+ }
+
+
+ ///
+ /// 工单导出
+ ///
+ ///
+ ///
+ ///
+ public PagedInfo WorkOrderExport(DateTime exportTime, PagerInfo pager)
+ {
+ exportTime = exportTime.Date;
+ return Context.Queryable().Where(it => it.WorkorderDate == exportTime).ToPage(pager);
+ }
+
+ ///
+ /// 获取物料信息
+ ///
+ ///
+ ///
+ public List GetMaterialInfo(BaseMaterialListQueryDto5 parm)
+ {
+ var predicate = Expressionable.Create()
+ .OrIF(!string.IsNullOrEmpty(parm.Name_or_Code), it => it.Name.Contains(parm.Name_or_Code))
+ .OrIF(!string.IsNullOrEmpty(parm.Name_or_Code), it => it.Code.Contains(parm.Name_or_Code))
+ ;
+
+ return Context.Queryable()
+ .Where(predicate.ToExpression()).Take(20).ToList();
+
+ }
+
+ ///
+ /// 获取客户信息
+ ///
+ ///
+ ///
+ public List GetCustomInfo(BaseCustomQueryDto2 parm)
+ {
+ var predicate = Expressionable
+ .Create()
+ .AndIF(
+ !string.IsNullOrEmpty(parm.CustomNo),
+ it => it.CustomNo.Contains(parm.CustomNo)
+ )
+ //.AndIF(
+ // !string.IsNullOrEmpty(parm.CustomNo),
+ // it => it.CustomName.Contains(parm.CustomNo)
+ //)
+ .And(it => it.Status == 1);
+
+ var response = Context.Queryable()
+ .Where(predicate.ToExpression())
+ .OrderBy(it => it.CustomNo)
+ .Take(20)
+ .ToList();
+ return response;
+
+
+ }
+
+ public List GetProcessRoute(DateTime dateTime)
+ {
+ throw new NotImplementedException();
+ }
+
+
+ /*///
+ /// 获取工艺路线
+ ///
+ ///
+ ///
+ public List GetProcessRoute(DateTime dateTime)
+ {
+ DateTime dataTO = dateTime.ToLocalTime().Date;
+ var query = Context.Queryable().Where(it => it.ScheduleDate == dataTO);
+
+ return Context
+ .Queryable(query)
+ .LeftJoin((q, p) => q.FkBelongRouteCode == p.Code)
+ .Select((q, p) => p)
+ .Distinct()
+ .ToList();
+ }*/
+
+
+ public List GetAllRoute()
+ {
+ return Context.Queryable().ToList();
+ }
+
+
+ ///
+ /// 获取班组
+ ///
+ ///
+ ///
+ /*public List GetGroupList(string route_code, DateTime dateTime)
+ {
+ dateTime = dateTime.ToLocalTime().Date;
+ return Context.Queryable().Where(it => it.FkBelongRouteCode == route_code)
+ .Where(it => it.ScheduleDate == dateTime)
+ .ToList();
+ }*/
+
+ //public List GetGroupList(string route_code, DateTime dateTime)
+ //{
+ // throw new NotImplementedException();
+ //}
+
+ public List GetGroupList()
+ {
+ return Context.Queryable().Where(it => it.Status == 1).ToList();
+ }
+
+
+ ///
+ /// 查询BOM 及其所需数量
+ ///
+ ///
+ ///
+ public List SearchBOMNum(string workorder_num)
+ {
+ List workOrderBoms = new List();
+ List baseMaterialBoms = null;
+ ProWorkorder proworkorder = Context.Queryable().Where(it => it.Workorder == workorder_num).First();
+ if (proworkorder != null)
+ {
+ baseMaterialBoms = Context.Queryable().Where(it => it.InvCode == proworkorder.productionCode).ToList();
+
+ if (baseMaterialBoms != null && baseMaterialBoms
+ .Count() > 0)
+ {
+ foreach (var item in baseMaterialBoms)
+ {
+ WorkOrderBom objectMaterial = new WorkOrderBom();
+
+ objectMaterial.SubInvCode=item.SubInvCode;
+ objectMaterial.SubInvName = item.SubInvName;
+ objectMaterial.Iusequantity_Single = item.Iusequantity;
+ float num = float.Parse(item.Iusequantity) * proworkorder.PlanNum.Value;
+ objectMaterial.Iusequantity_All = num.ToString();
+ objectMaterial.BOMVersion = item.BOMVersion;
+ workOrderBoms.Add(objectMaterial);
+
+ }
+
+ }
+
+
+ }
+
+
+
+ return workOrderBoms;
+
+
+ }
+
+
+ ///
+ /// 工单日志
+ ///
+ ///
+ ///
+ ///
+ public int WorkOrderLog(string workorder, string log, string Operator)
+ {
+ ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
+ logObj.Id = XueHua;
+ logObj.Workorder = workorder;
+ logObj.Log = log;
+ logObj.ChangeTime = DateTime.Now;
+ logObj.Operator = Operator;
+ logObj.ChangeTime= DateTime.Now;
+ logObj.CreatedBy = Operator;
+
+
+ return Context.Insertable(logObj).ExecuteCommand();
+
+ }
+
+ ///
+ /// 工单进度跟踪
+ ///
+ ///
+ ///
+ public PagedInfo GetWorkorderTraceProgressList(ProWorkorderQueryDto query)
+ {
+
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(query.productionName), it => it.productionName.Contains(query.productionName))
+ .AndIF(!string.IsNullOrEmpty(query.productionCode), it => it.productionCode.Contains(query.productionCode))
+ .AndIF(!string.IsNullOrEmpty(query.RouteCode), it => it.RouteCode == query.RouteCode)
+ .AndIF(!string.IsNullOrEmpty(query.GroupCode), it => it.GroupCode == query.GroupCode)
+ .AndIF(query.WorkorderDate != null && query.WorkorderDate[0] > DateTime.MinValue, it => it.WorkorderDate >= query.WorkorderDate[0])
+ .AndIF(query.WorkorderDate != null && query.WorkorderDate[1] > DateTime.MinValue, it => it.WorkorderDate <= query.WorkorderDate[1])
+ .AndIF(query.Status>-1,it=>it.Status==query.Status)
+
+ ;
+ var query2 = Queryable()
+ .Where(predicate.ToExpression());
+
+ return Context.Queryable(query2).LeftJoin((q, r) => q.Workorder == r.FkWorkorder)
+ .Select((q, r) => new ProWorkorderTranceProgressDto()
+ {
+ PlanNum = q.PlanNum,
+ ActualNum = r.FinishedNum,
+ }, true).ToPage_NO_Convert(query);
+
+
+ }
+
+ public int Insert_workOrder2(ProWorkorder proWorkorder, string next_id)
+ {
+ int result = 0;
+ proWorkorder.Id = XueHua;
+ proWorkorder.WorkorderDate = proWorkorder.WorkorderDate.Value.Date;
+ if (!string.IsNullOrEmpty(next_id) && next_id != "-1")
+ {
+ UseTran2(() =>
+ {
+
+ int sortNum = Context.Queryable().Where(it => it.Id == next_id).Select(it => it.Sort.Value).First();
+ Context.Updateable()
+ .Where(it => it.WorkorderDate == proWorkorder.WorkorderDate)
+ .Where(it => it.Sort >= sortNum)
+ .SetColumns(it => new ProWorkorder() { Sort = it.Sort + 10 })
+ .ExecuteCommand();
+
+
+ proWorkorder.Sort = sortNum;
+ proWorkorder.Status = 1;
+
+ Context.Insertable(proWorkorder).ExecuteCommand();
+
+ });
+ }
+ else
+ {
+ DateTime dateOnly = proWorkorder.WorkorderDate.Value.Date;
+
+ int sortNum = Context.Queryable().Where(it => it.WorkorderDate == dateOnly).Max(it => it.Sort.Value);
+
+ proWorkorder.Sort = sortNum + 10;
+
+ proWorkorder.Status = 1;
+
+ Context.Insertable(proWorkorder).ExecuteCommand();
+ }
+
+
+
+ Generate_workorder(new ProWorkorderQueryDto2()
+ {
+ WorkorderDate = proWorkorder.WorkorderDate.Value
+ });
+
+ return result;
+
+ }
+
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/Infrastructure/Converter/DOANConvertDateTime.cs b/Infrastructure/Converter/DOANConvertDateTime.cs
new file mode 100644
index 0000000..c397b00
--- /dev/null
+++ b/Infrastructure/Converter/DOANConvertDateTime.cs
@@ -0,0 +1,38 @@
+using System;
+
+namespace Infrastructure.Converter;
+
+public class DOANConvertDate
+{
+ ///
+ /// 日期转本地日期
+ ///
+ ///
+ ///
+ public static DateTime ConvertLocalDate(DateTime handleDate)
+ {
+ if (handleDate.Kind == DateTimeKind.Utc)
+ {
+ handleDate = handleDate.ToLocalTime();
+
+ }
+
+ return handleDate.Date;
+ }
+
+ ///
+ /// 日期转本地日期
+ ///
+ ///
+ ///
+ public static DateTime ConvertLocalDateTime(DateTime handleDate)
+ {
+ if (handleDate.Kind == DateTimeKind.Utc)
+ {
+ handleDate = handleDate.ToLocalTime();
+
+ }
+
+ return handleDate;
+ }
+}