提交
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增生产计划
|
||||
/// </summary>
|
||||
/// <param name="proWorkplan">生产计划对象</param>
|
||||
/// <returns></returns>
|
||||
[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));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除生产计划
|
||||
/// </summary>
|
||||
/// <param name="id">计划ID</param>
|
||||
/// <returns></returns>
|
||||
[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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新生产计划
|
||||
/// </summary>
|
||||
/// <param name="proWorkplan">生产计划对象</param>
|
||||
/// <returns></returns>
|
||||
[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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,13 @@ namespace Model.DBModel
|
||||
/// <summary>
|
||||
/// WP2024030001
|
||||
/// </summary>
|
||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||
[SugarColumn(ColumnName = "id",IsPrimaryKey = true)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 零件号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "partnumber")]
|
||||
public string Partnumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -34,6 +35,16 @@ namespace Model.DBModel
|
||||
[SugarColumn(ColumnName = "product_name")]
|
||||
public string ProductName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 规格
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "specification")]
|
||||
public string Specification { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 颜色代码
|
||||
/// </summary>
|
||||
@@ -92,7 +103,7 @@ namespace Model.DBModel
|
||||
/// </summary>
|
||||
|
||||
[SugarColumn(ColumnName = "product_time")]
|
||||
public int ProductTime { get; set; }
|
||||
public float ProductTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -107,7 +118,7 @@ namespace Model.DBModel
|
||||
/// </summary>
|
||||
|
||||
[SugarColumn(ColumnName = "blank_num")]
|
||||
public int BlankNum { get; set; }
|
||||
public string BlankNum { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace ZR.Service.mes.pro.IService
|
||||
/// <returns></returns>
|
||||
public List<ProWorkplan> 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);
|
||||
|
||||
|
||||
@@ -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<ProWorkplan>().Where(it => it.Id == id).ToList();
|
||||
}
|
||||
|
||||
public int AddWorkPlan(ProWorkplan proWorkplan)
|
||||
public int AddWorkPlan(ProWorklplan_v2 proWorkplan)
|
||||
{
|
||||
ProWorklplan_v2 max_workplan = Context.Queryable<ProWorklplan_v2>().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<ProWorkplan>().In(id).ExecuteCommand();
|
||||
return Context.Deleteable<ProWorklplan_v2>().In(id).ExecuteCommand();
|
||||
}
|
||||
|
||||
public List<ProWorkorder> GetWorkorderListByPlanId(string id)
|
||||
|
||||
Reference in New Issue
Block a user