diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs
index fbade7ef..229897c7 100644
--- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Model.DBModel;
+using ZR.Admin.WebApi.Extensions;
using ZR.Model.mes.pro;
using ZR.Service.mes.pro.IService;
@@ -34,5 +35,63 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
return ToResponse(new ApiResult(200, "success", data));
}
+
+ ///
+ /// 新增生产计划
+ ///
+ /// 生产计划对象
+ ///
+ [HttpPost("addworkplan")]
+ public IActionResult AddWorkPlan([FromBody] ProWorklplan_v2 proWorkplan)
+ {
+ int data = 0;
+ if (proWorkplan != null)
+ {
+ proWorkplan.ToCreate(HttpContext);
+ data = proWorkplanService.AddWorkPlan(proWorkplan);
+ }
+
+ return ToResponse(new ApiResult(200, "success", data));
+ }
+
+
+ ///
+ /// 删除生产计划
+ ///
+ /// 计划ID
+ ///
+ [HttpGet("deleteitem/{id}")]
+ public IActionResult DeleteItem(string id)
+ {
+ int data = 0;
+ if (!string.IsNullOrEmpty(id))
+ {
+ data = proWorkplanService.DeleteWorkPlan(id);
+ }
+
+ return ToResponse(new ApiResult(200, "success", data));
+ }
+
+
+
+ ///
+ /// 更新生产计划
+ ///
+ /// 生产计划对象
+ ///
+ [HttpPost("updateworkplan")]
+ public IActionResult UpdateWorkPlan([FromBody] ProWorklplan_v2 proWorkplan)
+ {
+ int data = 0;
+ if (proWorkplan != null)
+ {
+ proWorkplan.ToUpdate(HttpContext);
+ data = proWorkplanService.UpdateWorkPlan(proWorkplan);
+
+ }
+
+ return ToResponse(new ApiResult(200, "success", data));
+ }
+
}
}
diff --git a/ZR.Model/MES/pro/ProWorklplan_v2.cs b/ZR.Model/MES/pro/ProWorklplan_v2.cs
index 542a63d0..f9e60538 100644
--- a/ZR.Model/MES/pro/ProWorklplan_v2.cs
+++ b/ZR.Model/MES/pro/ProWorklplan_v2.cs
@@ -20,12 +20,13 @@ namespace Model.DBModel
///
/// WP2024030001
///
- [SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
+ [SugarColumn(ColumnName = "id",IsPrimaryKey = true)]
public string Id { get; set; }
///
/// 零件号
///
+ [SugarColumn(ColumnName = "partnumber")]
public string Partnumber { get; set; }
///
@@ -34,6 +35,16 @@ namespace Model.DBModel
[SugarColumn(ColumnName = "product_name")]
public string ProductName { get; set; }
+
+ ///
+ /// 规格
+ ///
+ [SugarColumn(ColumnName = "specification")]
+ public string Specification { get; set; }
+
+
+
+
///
/// 颜色代码
///
@@ -92,7 +103,7 @@ namespace Model.DBModel
///
[SugarColumn(ColumnName = "product_time")]
- public int ProductTime { get; set; }
+ public float ProductTime { get; set; }
///
@@ -107,7 +118,7 @@ namespace Model.DBModel
///
[SugarColumn(ColumnName = "blank_num")]
- public int BlankNum { get; set; }
+ public string BlankNum { get; set; }
diff --git a/ZR.Service/mes/pro/IService/IProWorkplanServiceV2.cs b/ZR.Service/mes/pro/IService/IProWorkplanServiceV2.cs
index cd95bbeb..1b4019da 100644
--- a/ZR.Service/mes/pro/IService/IProWorkplanServiceV2.cs
+++ b/ZR.Service/mes/pro/IService/IProWorkplanServiceV2.cs
@@ -22,9 +22,9 @@ namespace ZR.Service.mes.pro.IService
///
public List GetProWorkplanById(string id);
- public int AddWorkPlan(ProWorkplan proWorkplan);
+ public int AddWorkPlan(ProWorklplan_v2 proWorkplan);
- public int UpdateWorkPlan(ProWorkplan proWorkplan);
+ public int UpdateWorkPlan(ProWorklplan_v2 proWorkplan);
public int DeleteWorkPlan(string id);
diff --git a/ZR.Service/mes/pro/ProWorkplanServiceV2.cs b/ZR.Service/mes/pro/ProWorkplanServiceV2.cs
index bfef2f72..f6fd237f 100644
--- a/ZR.Service/mes/pro/ProWorkplanServiceV2.cs
+++ b/ZR.Service/mes/pro/ProWorkplanServiceV2.cs
@@ -1,4 +1,5 @@
using Infrastructure.Attribute;
+using Mapster.Utils;
using Microsoft.Extensions.DependencyInjection;
using Model.DBModel;
using SqlSugar;
@@ -39,21 +40,30 @@ namespace ZR.Service.mes.pro
return Context.Queryable().Where(it => it.Id == id).ToList();
}
- public int AddWorkPlan(ProWorkplan proWorkplan)
+ public int AddWorkPlan(ProWorklplan_v2 proWorkplan)
{
+ ProWorklplan_v2 max_workplan = Context.Queryable().OrderBy(it => it.Id, OrderByType.Desc).First();
+ if (max_workplan != null && !string.IsNullOrEmpty(max_workplan.Id) && max_workplan.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd"))
+ {
+ int num = Convert.ToInt32(max_workplan.Id.Substring(10)) + 1;
+ proWorkplan.Id = "MP" + DateTime.Now.ToString("yyyyMMdd") + num.ToString("000");
+ }
+ else
+ {
+ proWorkplan.Id = "MP" + DateTime.Now.ToString("yyyyMMdd") + "001";
+ }
- proWorkplan.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
return Context.Insertable(proWorkplan).ExecuteCommand();
}
- public int UpdateWorkPlan(ProWorkplan proWorkplan)
+ public int UpdateWorkPlan(ProWorklplan_v2 proWorkplan)
{
return Context.Updateable(proWorkplan).ExecuteCommand();
}
public int DeleteWorkPlan(string id)
{
- return Context.Deleteable().In(id).ExecuteCommand();
+ return Context.Deleteable().In(id).ExecuteCommand();
}
public List GetWorkorderListByPlanId(string id)