diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs
index f234fff4..1d602cf9 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmFgentryInspectController.cs
@@ -6,6 +6,7 @@ using ZR.Admin.WebApi.Filters;
using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms.Dto;
using ZR.Model.MES.wms;
+using Aliyun.OSS;
//创建时间:2024-04-17
namespace ZR.Admin.WebApi.Controllers
@@ -26,6 +27,21 @@ namespace ZR.Admin.WebApi.Controllers
{
_WmFgentryInspectService = WmFgentryInspectService;
}
+ ///
+ /// 把包装数据转换为检验数据
+ ///
+ ///
+ ///
+ [HttpGet("transform")]
+ public IActionResult Transform(string workorder)
+ {
+ if(string.IsNullOrEmpty(workorder) == null)
+ {
+ return SUCCESS(workorder);
+ }
+ var response = _WmFgentryInspectService.TransformData(workorder);
+ return SUCCESS(response);
+ }
///
/// 查询成品入库检验列表
@@ -186,5 +202,8 @@ namespace ZR.Admin.WebApi.Controllers
+
+
+
}
}
\ No newline at end of file
diff --git a/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs b/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs
index c6d8ca0c..5966b155 100644
--- a/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs
+++ b/ZR.Service/mes/wms/IService/IWmFgentryInspectService.cs
@@ -13,6 +13,8 @@ namespace ZR.Service.mes.wms.IService
///
public interface IWmFgentryInspectService : IBaseService
{
+
+ int TransformData(string workorder);
PagedInfo GetList(WmFgentryInspectQueryDto parm);
PagedInfo GetList_first(WmFgentryInspectQueryDto parm);
PagedInfo GetList_second(WmFgentryInspectQueryDto parm);
diff --git a/ZR.Service/mes/wms/WmFgentryInspectService.cs b/ZR.Service/mes/wms/WmFgentryInspectService.cs
index 7ff2fc00..8ba482a4 100644
--- a/ZR.Service/mes/wms/WmFgentryInspectService.cs
+++ b/ZR.Service/mes/wms/WmFgentryInspectService.cs
@@ -11,6 +11,8 @@ using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms;
using ZR.Model.MES.wms.Dto;
using Mapster;
+using System.Reflection.PortableExecutable;
+using Microsoft.AspNetCore.Http.HttpResults;
namespace ZR.Service.mes.wms
{
@@ -20,6 +22,43 @@ namespace ZR.Service.mes.wms
[AppService(ServiceType = typeof(IWmFgentryInspectService), ServiceLifetime = LifeTime.Transient)]
public class WmFgentryInspectService : BaseService, IWmFgentryInspectService
{
+
+ ///
+ /// 把包装数据转换为检验数据
+ ///
+ ///
+ ///
+ public int TransformData(string workorder)
+ {
+ int sum = 0;
+
+ var inpects = Context.Queryable()
+ .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;
+
+ }
///
/// 查询成品入库检验列表
///
@@ -47,30 +86,30 @@ namespace ZR.Service.mes.wms
.AndIF(!string.IsNullOrEmpty(parm.Workorder), it => it.Workorder.Contains(parm.Workorder))
.AndIF(!string.IsNullOrEmpty(parm.Packcode), it => it.Packcode.Contains(parm.Packcode))
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
- .AndIF(parm.starttime!=null&&parm.starttime>new DateTime(1999,1,1), it => it.CreatedTime>parm.starttime)
- .AndIF(parm.endtime!=null&&parm.endtime>new DateTime(1999,1,1), it => it.CreatedTime new DateTime(1999, 1, 1), it => it.CreatedTime > parm.starttime)
+ .AndIF(parm.endtime != null && parm.endtime > new DateTime(1999, 1, 1), it => it.CreatedTime < parm.endtime)
;
-
+
List inspects = Queryable()
.Where(predicate.ToExpression())
- .Where(it=>it.Bitwm==0)
+ .Where(it => it.Bitwm == 0)
.GroupBy(it => it.Workorder)
.Select(it => new WmFgentryInspect_parentDto()
{
Workorder = it.Workorder,
ProductionNum = SqlFunc.AggregateSum(it.ProductionNum ?? 0),
- // Result= SqlFunc.AggregateSum(it.Result??0),
+ // Result= SqlFunc.AggregateSum(it.Result??0),
Partnumber = SqlFunc.AggregateMax(it.Partnumber)
}).ToList();
foreach (var inspect in inspects)
{
- inspect.Result_good=Queryable().Where(it=>it.Workorder==inspect.Workorder).Where(it=>it.Result==1).Count();
- inspect.Result_bad=Queryable().Where(it=>it.Workorder==inspect.Workorder).Where(it=>it.Result==2).Count();
- inspect.Result_null=Queryable().Where(it=>it.Workorder==inspect.Workorder).Where(it=>it.Result==0|| it.Result==null).Count();
+ inspect.Result_good = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 1).Count();
+ inspect.Result_bad = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 2).Count();
+ inspect.Result_null = Queryable().Where(it => it.Workorder == inspect.Workorder).Where(it => it.Result == 0 || it.Result == null).Count();
}
-
+
int totalPages = (int)Math.Ceiling((double)inspects.Count / parm.PageSize);
@@ -81,7 +120,7 @@ namespace ZR.Service.mes.wms
PageSize = parm.PageSize,
PageIndex = parm.PageNum,
TotalPage = totalPages,
- Result= pageProducts
+ Result = pageProducts
};
return response;
@@ -160,17 +199,17 @@ namespace ZR.Service.mes.wms
///
///
///
- public int BatchQualified(string[] packcode_select,string updateby)
+ public int BatchQualified(string[] packcode_select, string updateby)
{
int sum = 0;
foreach (string packcode in packcode_select)
{
- sum= sum+ Context.Updateable()
- .Where(it=>it.Packcode == packcode)
- .SetColumns(it=>it.Result==1)
+ sum = sum + Context.Updateable()
+ .Where(it => it.Packcode == packcode)
+ .SetColumns(it => it.Result == 1)
.ExecuteCommand();
}
- return sum;
+ return sum;
}
@@ -180,12 +219,12 @@ namespace ZR.Service.mes.wms
///
///
///
- public int SetAllQualified(string workorder_selected, string updateby)
+ public int SetAllQualified(string workorder_selected, string updateby)
{
- return Context.Updateable()
- .SetColumns(it=>it.Result==1)
- .Where(it=>it.Workorder==workorder_selected)
- .ExecuteCommand();
+ return Context.Updateable()
+ .SetColumns(it => it.Result == 1)
+ .Where(it => it.Workorder == workorder_selected)
+ .ExecuteCommand();
}