更新和删除
This commit is contained in:
@@ -40,5 +40,28 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
|
|||||||
return ToResponse(new ApiResult(200, "success", data));
|
return ToResponse(new ApiResult(200, "success", data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("updateworkplan")]
|
||||||
|
public IActionResult UpdateWorkPlan([FromBody] ProWorkplan proWorkplan)
|
||||||
|
{
|
||||||
|
int data = 0;
|
||||||
|
if (proWorkplan != null)
|
||||||
|
{
|
||||||
|
data = proWorkplanService.UpdateWorkPlan(proWorkplan);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ToResponse(new ApiResult(200, "success", data));
|
||||||
|
}
|
||||||
|
|
||||||
|
[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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,9 @@ namespace ZR.Service.mes.pro.IService
|
|||||||
public (List<ProWorkplan>,int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color);
|
public (List<ProWorkplan>,int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color);
|
||||||
|
|
||||||
public int AddWorkPlan(ProWorkplan proWorkplan);
|
public int AddWorkPlan(ProWorkplan proWorkplan);
|
||||||
|
|
||||||
|
public int UpdateWorkPlan(ProWorkplan proWorkplan);
|
||||||
|
|
||||||
|
public int DeleteWorkPlan(string id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,6 @@ namespace ZR.Service.mes.pro
|
|||||||
[AppService(ServiceType = typeof(IProWorkplanService), ServiceLifetime = LifeTime.Transient)]
|
[AppService(ServiceType = typeof(IProWorkplanService), ServiceLifetime = LifeTime.Transient)]
|
||||||
public class ProWorkplanService : BaseService<ProWorkplan>, IProWorkplanService
|
public class ProWorkplanService : BaseService<ProWorkplan>, IProWorkplanService
|
||||||
{
|
{
|
||||||
public int AddWorkPlan(ProWorkplan proWorkplan)
|
|
||||||
{
|
|
||||||
|
|
||||||
proWorkplan.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
||||||
return Context.Insertable(proWorkplan).ExecuteCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
public (List<ProWorkplan>, int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color)
|
public (List<ProWorkplan>, int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color)
|
||||||
{
|
{
|
||||||
@@ -37,5 +31,23 @@ namespace ZR.Service.mes.pro
|
|||||||
List<ProWorkplan> proWorkplanList = Context.Queryable<ProWorkplan>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
|
List<ProWorkplan> proWorkplanList = Context.Queryable<ProWorkplan>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
|
||||||
return (proWorkplanList, totalCount);
|
return (proWorkplanList, totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int AddWorkPlan(ProWorkplan proWorkplan)
|
||||||
|
{
|
||||||
|
|
||||||
|
proWorkplan.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||||
|
return Context.Insertable(proWorkplan).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int UpdateWorkPlan(ProWorkplan proWorkplan)
|
||||||
|
{
|
||||||
|
return Context.Updateable(proWorkplan).ExecuteCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int DeleteWorkPlan(string id)
|
||||||
|
{
|
||||||
|
return Context.Deleteable<ProWorkplan>().In(id).ExecuteCommand();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user