主体工程完成

This commit is contained in:
qianhao.xu
2024-01-22 15:22:56 +08:00
parent e3ef300dfb
commit 835025afe9
6 changed files with 116 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ using SqlSugar;
using System.Text.Json; using System.Text.Json;
using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters; using ZR.Admin.WebApi.Filters;
using ZR.Model.mes.pro;
using ZR.Model.MES.pro; using ZR.Model.MES.pro;
using ZR.Service.mes.pro; using ZR.Service.mes.pro;
using ZR.Service.mes.pro.IService; using ZR.Service.mes.pro.IService;
@@ -155,6 +155,63 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
/// <summary>
/// 新增生产工单
/// </summary>
/// <param name="proWorkplan">生产工单对象</param>
/// <returns></returns>
[HttpPost("addworkorder")]
public IActionResult AddWorkOrder([FromBody] ProWorkorder_v2 proWorkorder)
{
int data = 0;
if (proWorkorder != null)
{
proWorkorder.ToCreate(HttpContext);
data = proWorkorderService.AddWorkOrder(proWorkorder);
}
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 = proWorkorderService.DeleteWorkOrder(id);
}
return ToResponse(new ApiResult(200, "success", data));
}
/// <summary>
/// 更新生产计划
/// </summary>
/// <param name="proWorkplan">生产计划对象</param>
/// <returns></returns>
[HttpPost("updateworkorder")]
public IActionResult UpdateWorkOrder([FromBody] ProWorkorder_v2 proWorkorder)
{
int data = 0;
if (proWorkorder != null)
{
proWorkorder.ToUpdate(HttpContext);
data = proWorkorderService.UpdateWorkOrder(proWorkorder);
}
return ToResponse(new ApiResult(200, "success", data));
}

View File

@@ -212,19 +212,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
{ {
return ToResponse(ResultCode.GLOBAL_ERROR,"模板内容错误,请仔细检测格式,并联系管理员"+ex.Message); return ToResponse(ResultCode.GLOBAL_ERROR,"模板内容错误,请仔细检测格式,并联系管理员"+ex.Message);
} }
} }
return SUCCESS(null); return SUCCESS(null);
} }

View File

@@ -7,7 +7,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.op.DTO; using ZR.Model.MES.op.DTO;
using ZR.Model.MES.pro; using ZR.Model.MES.pro;
using ZR.Model.MES.pro.DTO; using ZR.Model.MES.pro.DTO;
@@ -27,5 +27,15 @@ namespace ZR.Service.mes.pro.IService
public int DeleteAllWorkorder(int year, int week, int date); public int DeleteAllWorkorder(int year, int week, int date);
public int AddWorkOrder(ProWorkorder_v2 workorder);
public int DeleteWorkOrder(string id);
public int UpdateWorkOrder(ProWorkorder_v2 workorder);
} }
} }

View File

@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using ZR.Model.mes.pro; using ZR.Model.mes.pro;
using ZR.Model.MES.op.DTO; using ZR.Model.MES.op.DTO;
using ZR.Model.MES.pro.DTO; using ZR.Model.MES.pro.DTO;
using ZR.Model.mes.pro;
namespace ZR.Service.mes.pro.IService namespace ZR.Service.mes.pro.IService
{ {
@@ -22,7 +23,7 @@ namespace ZR.Service.mes.pro.IService
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
public List<ProWorkplan> GetProWorkplanById(string id); public List<ProWorklplan_v2> GetProWorkplanById(string id);
public int AddWorkPlan(ProWorklplan_v2 proWorkplan); public int AddWorkPlan(ProWorklplan_v2 proWorkplan);

View File

@@ -10,13 +10,9 @@ using System.Linq.Expressions;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using ZR.Common; using ZR.Common;
using ZR.Model.mes.md;
using ZR.Model.mes.pro;
using ZR.Model.MES.wm;
using ZR.Service.mes.pro.IService; using ZR.Service.mes.pro.IService;
using ZR.Service.MES.md.IService; using ZR.Service.MES.md.IService;
using static System.Net.WebRequestMethods; using static System.Net.WebRequestMethods;
using JinianNet.JNTemplate; using JinianNet.JNTemplate;
using static Aliyun.OSS.Model.LiveChannelStat; using static Aliyun.OSS.Model.LiveChannelStat;
using ZR.Model.MES.pro.DTO; using ZR.Model.MES.pro.DTO;
@@ -28,6 +24,7 @@ using Microsoft.AspNetCore.Hosting;
using MiniExcelLibs; using MiniExcelLibs;
using System.IO; using System.IO;
using SqlSugar.Extensions; using SqlSugar.Extensions;
using ZR.Model.mes.pro;
namespace ZR.Service.mes.pro namespace ZR.Service.mes.pro
{ {
@@ -100,7 +97,7 @@ namespace ZR.Service.mes.pro
} }
UseTran(() => UseTran(() =>
{ {
// 删除之前的工单 // 删除之前的工单
@@ -165,7 +162,7 @@ namespace ZR.Service.mes.pro
{ {
year = year, year = year,
week = week, week = week,
date=date, date = date,
title = $"{year}年车镜实业涂装事业{week}周{date}生产滚动表", title = $"{year}年车镜实业涂装事业{week}周{date}生产滚动表",
workorder = list workorder = list
@@ -177,7 +174,7 @@ namespace ZR.Service.mes.pro
// MiniExcel.SaveAs(fullPath, list); // MiniExcel.SaveAs(fullPath, list);
//3.0 返回路径和文件名 //3.0 返回路径和文件名
@@ -198,7 +195,45 @@ namespace ZR.Service.mes.pro
{ {
return Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == year && it.Week == week && it.Date == date).ExecuteCommand(); return Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == year && it.Week == week && it.Date == date).ExecuteCommand();
} }
/// <summary>
/// 获取生产计划id
/// </summary>
/// <returns></returns>
private int Getworkorderid_max()
{
ProWorkorder_v2 max_workorder = Context.Queryable<ProWorkorder_v2>().OrderBy(it => it.Id, OrderByType.Desc).First();
if (max_workorder != null && !string.IsNullOrEmpty(max_workorder.Id) && max_workorder.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd"))
{
int num = Convert.ToInt32(max_workorder.Id.Substring(10)) + 1;
return num;
}
else
{
return 0;
}
}
public int AddWorkOrder(ProWorkorder_v2 workorder)
{
workorder.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + Getworkorderid_max().ToString("000");
return Context.Insertable(workorder).ExecuteCommand();
}
public int DeleteWorkOrder(string id)
{
return Context.Deleteable<ProWorkorder_v2>().In(id).ExecuteCommand();
}
public int UpdateWorkOrder(ProWorkorder_v2 workorder)
{
return Context.Updateable(workorder).ExecuteCommand();
}
} }
} }

View File

@@ -14,7 +14,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using ZR.Model.mes.md;
using ZR.Model.mes.pro; using ZR.Model.mes.pro;
using ZR.Model.MES.pro.DTO; using ZR.Model.MES.pro.DTO;
using ZR.Service.mes.pro.IService; using ZR.Service.mes.pro.IService;
@@ -41,9 +40,9 @@ namespace ZR.Service.mes.pro
} }
public List<ProWorkplan> GetProWorkplanById(string id) public List<ProWorklplan_v2> GetProWorkplanById(string id)
{ {
return Context.Queryable<ProWorkplan>().Where(it => it.Id == id).ToList(); return Context.Queryable<ProWorklplan_v2>().Where(it => it.Id == id).ToList();
} }
@@ -245,8 +244,6 @@ namespace ZR.Service.mes.pro
return Context.Deleteable<ProWorklplan_v2>().Where(it => it.Year == year && it.Week == week).ExecuteCommand(); return Context.Deleteable<ProWorklplan_v2>().Where(it => it.Year == year && it.Week == week).ExecuteCommand();
} }
} }
} }