This commit is contained in:
qianhao.xu
2024-04-19 19:41:28 +08:00
parent a521d0aa23
commit 3debd6569c
3 changed files with 80 additions and 20 deletions

View File

@@ -6,6 +6,7 @@ using ZR.Admin.WebApi.Filters;
using ZR.Service.mes.wms.IService; using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms.Dto; using ZR.Model.MES.wms.Dto;
using ZR.Model.MES.wms; using ZR.Model.MES.wms;
using Aliyun.OSS;
//创建时间2024-04-17 //创建时间2024-04-17
namespace ZR.Admin.WebApi.Controllers namespace ZR.Admin.WebApi.Controllers
@@ -26,6 +27,21 @@ namespace ZR.Admin.WebApi.Controllers
{ {
_WmFgentryInspectService = WmFgentryInspectService; _WmFgentryInspectService = WmFgentryInspectService;
} }
/// <summary>
/// 把包装数据转换为检验数据
/// </summary>
/// <param name="workorder"></param>
/// <returns></returns>
[HttpGet("transform")]
public IActionResult Transform(string workorder)
{
if(string.IsNullOrEmpty(workorder) == null)
{
return SUCCESS(workorder);
}
var response = _WmFgentryInspectService.TransformData(workorder);
return SUCCESS(response);
}
/// <summary> /// <summary>
/// 查询成品入库检验列表 /// 查询成品入库检验列表
@@ -186,5 +202,8 @@ namespace ZR.Admin.WebApi.Controllers
} }
} }

View File

@@ -13,6 +13,8 @@ namespace ZR.Service.mes.wms.IService
/// </summary> /// </summary>
public interface IWmFgentryInspectService : IBaseService<WmFgentryInspect> public interface IWmFgentryInspectService : IBaseService<WmFgentryInspect>
{ {
int TransformData(string workorder);
PagedInfo<WmFgentryInspectDto> GetList(WmFgentryInspectQueryDto parm); PagedInfo<WmFgentryInspectDto> GetList(WmFgentryInspectQueryDto parm);
PagedInfo<WmFgentryInspect_parentDto> GetList_first(WmFgentryInspectQueryDto parm); PagedInfo<WmFgentryInspect_parentDto> GetList_first(WmFgentryInspectQueryDto parm);
PagedInfo<WmFgentryInspectDto> GetList_second(WmFgentryInspectQueryDto parm); PagedInfo<WmFgentryInspectDto> GetList_second(WmFgentryInspectQueryDto parm);

View File

@@ -11,6 +11,8 @@ using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms; using ZR.Model.MES.wms;
using ZR.Model.MES.wms.Dto; using ZR.Model.MES.wms.Dto;
using Mapster; using Mapster;
using System.Reflection.PortableExecutable;
using Microsoft.AspNetCore.Http.HttpResults;
namespace ZR.Service.mes.wms namespace ZR.Service.mes.wms
{ {
@@ -20,6 +22,43 @@ namespace ZR.Service.mes.wms
[AppService(ServiceType = typeof(IWmFgentryInspectService), ServiceLifetime = LifeTime.Transient)] [AppService(ServiceType = typeof(IWmFgentryInspectService), ServiceLifetime = LifeTime.Transient)]
public class WmFgentryInspectService : BaseService<WmFgentryInspect>, IWmFgentryInspectService public class WmFgentryInspectService : BaseService<WmFgentryInspect>, IWmFgentryInspectService
{ {
/// <summary>
/// 把包装数据转换为检验数据
/// </summary>
/// <param name="workorder"></param>
/// <returns></returns>
public int TransformData(string workorder)
{
int sum = 0;
var inpects = Context.Queryable<WmPackingrecord>()
.Where(it => it.WorkOrderNum == workorder)
.GroupBy(it => it.PackingCode)
.Select(it => new WmFgentryInspect()
{
Workorder = SqlFunc.AggregateMax(it.WorkOrderNum),
Packcode = it.PackingCode,
Machine = SqlFunc.AggregateMax(it.Machine),
ProductionNum = SqlFunc.AggregateCount(it),
Partnumber = SqlFunc.AggregateMax(it.PartNum),
Bfilled = SqlFunc.ToInt32(SqlFunc.AggregateMax(it.BFilled)),
Result = 0,
Bitwm = 0,
CreatedBy = " ",
CreatedTime = DateTime.Now,
}).ToList();
var x = Context.Storageable(inpects)
.WhereColumns(it => it.Packcode)
.ToStorage();
sum= x.AsInsertable.ExecuteCommand();//不存在插入
x.AsUpdateable.ExecuteCommand();//存在更新
return sum;
}
/// <summary> /// <summary>
/// 查询成品入库检验列表 /// 查询成品入库检验列表
/// </summary> /// </summary>