生产大屏2 version 2
This commit is contained in:
parent
989c418ecb
commit
3861acd41e
@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using DOAN.Admin.WebApi.Filters;
|
||||
using DOAN.Service.MES.bigScreen.IService;
|
||||
using DOAN.Infrastructure;
|
||||
using DOAN.Model.MES.bigscreen.Dto;
|
||||
using DOAN.Model.mes.echarts;
|
||||
|
||||
namespace DOAN.WebApi.Controllers.MES.BigScreen
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产大屏2 version 2
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[Route("mes/bigscreen/product2")]
|
||||
public class Product2Controller : BaseController
|
||||
{
|
||||
private readonly IProduct2BigScreenService productBigScreenService;
|
||||
|
||||
public Product2Controller(IProduct2BigScreenService _product2BigScreenService)
|
||||
{
|
||||
productBigScreenService = _product2BigScreenService;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -61,19 +61,6 @@ namespace DOAN.Admin.Mobile.Controllers
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
//TODO 获取报工工单列表
|
||||
[HttpPost("list")]
|
||||
[ActionPermissionFilter(Permission = "productManagement:proreportwork:list")]
|
||||
public IActionResult QueryProReportwork([FromBody] ProReportworkQueryDto parm)
|
||||
{
|
||||
if(parm==null&&string.IsNullOrEmpty(parm.FkWorkorder))
|
||||
{
|
||||
SUCCESS(null);
|
||||
}
|
||||
var response = padReportWorkService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
//获取工单列表PDA
|
||||
//TODO 获取不同状态的工单 (PDA用)
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
using DOAN.Model.MES.product;
|
||||
|
||||
namespace DOAN.Service.MES.bigScreen.IService;
|
||||
|
||||
public interface IProduct2BigScreenService : IBaseService<ProWorkorder>
|
||||
{}
|
||||
16
DOAN.Service/MES/bigScreen/Product2BigScreenService.cs
Normal file
16
DOAN.Service/MES/bigScreen/Product2BigScreenService.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using DOAN.Model.MES.product;
|
||||
using DOAN.Service.MES.bigScreen.IService;
|
||||
using Infrastructure.Attribute;
|
||||
|
||||
namespace DOAN.Service.MES.bigScreen
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 生产大屏
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IProduct2BigScreenService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class Product2BigScreenService : BaseService<ProWorkorder>, IProduct2BigScreenService
|
||||
{}
|
||||
|
||||
|
||||
}
|
||||
@ -16,8 +16,6 @@ namespace DOAN.Service.MES.bigScreen;
|
||||
[AppService(ServiceType = typeof(IProductBigScreenService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProductBigScreenService : BaseService<ProWorkorder>, IProductBigScreenService
|
||||
{
|
||||
private IProductBigScreenService _productBigScreenServiceImplementation;
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
@ -13,11 +13,10 @@ public interface IPADReportWorkService
|
||||
|
||||
List<BaseGroup> GetGroupList();
|
||||
|
||||
PagedInfo<ProReportworkDto> GetList(ProReportworkQueryDto parm);
|
||||
|
||||
ProWorkorderDto4 GetWorkOrderDetail(string workorder);
|
||||
|
||||
List<ProWorkorder> GetWorkOrderStatusList(string group_code, int status, DateTime handleDate);
|
||||
List<ProReportworkDto> GetWorkOrderStatusList(string group_code, int status, DateTime handleDate);
|
||||
|
||||
|
||||
int UpdateProReportwork(ProReportwork parm);
|
||||
|
||||
@ -72,6 +72,113 @@ namespace DOAN.Service.Mobile
|
||||
return Context.Queryable<BaseGroup>().Where(it => it.Status == 1).ToList();
|
||||
}
|
||||
|
||||
public ProWorkorderDto4 GetWorkOrderDetail(string workorder)
|
||||
{
|
||||
var query = Context.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder);
|
||||
|
||||
|
||||
return Context.Queryable(query)
|
||||
.LeftJoin<ProReportwork>((q, r) => q.Workorder == r.FkWorkorder)
|
||||
.Select((q, r) => new ProWorkorderDto4
|
||||
{
|
||||
FinishNum = r.FinishedNum
|
||||
}, true).First();
|
||||
}
|
||||
|
||||
public List<ProReportworkDto> GetWorkOrderStatusList(string group_code, int status, DateTime handleDate)
|
||||
{
|
||||
var query = Context.Queryable<ProWorkorder>().Where(it => it.GroupCode == group_code)
|
||||
.Where(it => it.Status == status)
|
||||
.Where(it => it.WorkorderDate == handleDate);
|
||||
|
||||
return Context.Queryable(query)
|
||||
.LeftJoin<ProReportwork>((w, r) => w.Workorder == r.FkWorkorder)
|
||||
.Select((w, r) => new ProReportworkDto
|
||||
{
|
||||
Id = r.Id,
|
||||
ProductionCode = w.ProductionCode,
|
||||
ProductionName = w.ProductionName,
|
||||
Specification = w.Specification,
|
||||
QualifiedNumber = r.QualifiedNumber,
|
||||
UnqualifiedNumber = r.UnqualifiedNumber,
|
||||
ReworkNumber = r.ReworkNumber,
|
||||
ScrapNumber = r.ScrapNumber,
|
||||
Remark = r.Remark,
|
||||
Difference = r.QualifiedNumber - r.FinishedNum ?? 0,
|
||||
FkWorkorder = w.Workorder,
|
||||
GroupCode = w.GroupCode,
|
||||
LineCode = w.LineCode,
|
||||
DispatchNum = w.DeliveryNum ?? 0,
|
||||
Priority = w.Priority,
|
||||
Status = w.Status,
|
||||
Beat = w.Beat
|
||||
}, true).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改报工表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProReportwork(ProReportwork model)
|
||||
{
|
||||
// 更新线边库
|
||||
if (model.FinishedNum != null && string.IsNullOrEmpty(model.FkWorkorder))
|
||||
{
|
||||
linesideInventoryRecovery(model.FkWorkorder, model.CreatedBy);
|
||||
linesideInventoryDeductions(model.FkWorkorder, model.FinishedNum ?? 0);
|
||||
}
|
||||
|
||||
|
||||
//var response = Update(w => w.Id == model.Id, it => new ProReportwork()
|
||||
//{
|
||||
// FkWorkorder = model.FkWorkorder,
|
||||
// DispatchNum = model.DispatchNum,
|
||||
// FinishedNum = model.FinishedNum,
|
||||
// GroupCode = model.GroupCode,
|
||||
// LineCode = model.LineCode,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
public int StartWorkOrder(string workorder)
|
||||
{
|
||||
var result = 0;
|
||||
// 获取同一天 同一组 同一线 的所有工单 把状态2 设为init 1
|
||||
var handleWorkorder =
|
||||
Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).First();
|
||||
UseTran2(() =>
|
||||
{
|
||||
Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 1)
|
||||
.Where(it => it.Status == 2)
|
||||
.Where(it => it.WorkorderDate == handleWorkorder.WorkorderDate)
|
||||
.Where(it => it.GroupCode == handleWorkorder.GroupCode)
|
||||
.Where(it => it.LineCode == handleWorkorder.LineCode)
|
||||
.ExecuteCommand();
|
||||
|
||||
|
||||
result = Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 2)
|
||||
.SetColumns(it => it.StartTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public int FinishWorkOrder(string workorder)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Status == 3)
|
||||
.SetColumns(it => it.EndTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询报工表列表
|
||||
@ -129,92 +236,6 @@ namespace DOAN.Service.Mobile
|
||||
return response;
|
||||
}
|
||||
|
||||
public ProWorkorderDto4 GetWorkOrderDetail(string workorder)
|
||||
{
|
||||
var query = Context.Queryable<ProWorkorder>()
|
||||
.Where(it => it.Workorder == workorder);
|
||||
|
||||
|
||||
return Context.Queryable(query)
|
||||
.LeftJoin<ProReportwork>((q, r) => q.Workorder == r.FkWorkorder)
|
||||
.Select((q, r) => new ProWorkorderDto4
|
||||
{
|
||||
FinishNum = r.FinishedNum
|
||||
}, true).First();
|
||||
}
|
||||
|
||||
public List<ProWorkorder> GetWorkOrderStatusList(string group_code, int status, DateTime handleDate)
|
||||
{
|
||||
return Context.Queryable<ProWorkorder>().Where(it => it.GroupCode == group_code)
|
||||
.Where(it => it.Status == status)
|
||||
.Where(it => it.WorkorderDate == handleDate)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改报工表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProReportwork(ProReportwork model)
|
||||
{
|
||||
// 更新线边库
|
||||
if (model.FinishedNum != null&&string.IsNullOrEmpty(model.FkWorkorder))
|
||||
{
|
||||
linesideInventoryRecovery(model.FkWorkorder, model.CreatedBy);
|
||||
linesideInventoryDeductions(model.FkWorkorder, model.FinishedNum??0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//var response = Update(w => w.Id == model.Id, it => new ProReportwork()
|
||||
//{
|
||||
// FkWorkorder = model.FkWorkorder,
|
||||
// DispatchNum = model.DispatchNum,
|
||||
// FinishedNum = model.FinishedNum,
|
||||
// GroupCode = model.GroupCode,
|
||||
// LineCode = model.LineCode,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
public int StartWorkOrder(string workorder)
|
||||
{
|
||||
var result = 0;
|
||||
// 获取同一天 同一组 同一线 的所有工单 把状态2 设为init 1
|
||||
var handleWorkorder =
|
||||
Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder).First();
|
||||
UseTran2(() =>
|
||||
{
|
||||
Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 1)
|
||||
.Where(it => it.Status == 2)
|
||||
.Where(it => it.WorkorderDate == handleWorkorder.WorkorderDate)
|
||||
.Where(it => it.GroupCode == handleWorkorder.GroupCode)
|
||||
.Where(it => it.LineCode == handleWorkorder.LineCode)
|
||||
.ExecuteCommand();
|
||||
|
||||
|
||||
result = Context.Updateable<ProWorkorder>().SetColumns(it => it.Status == 2)
|
||||
.SetColumns(it => it.StartTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public int FinishWorkOrder(string workorder)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Status == 3)
|
||||
.SetColumns(it => it.EndTime == DateTime.Now)
|
||||
.Where(it => it.Workorder == workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 线边库 库存扣除
|
||||
@ -327,7 +348,6 @@ namespace DOAN.Service.Mobile
|
||||
log.CreatedTime = DateTime.Now;
|
||||
|
||||
|
||||
|
||||
UseTran2(() =>
|
||||
{
|
||||
// 增加库存
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user