From 8cf1d211db04df9d0ebb2d3d921d41aa799e0565 Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 10 Oct 2025 09:22:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=B4=E6=9C=88=E4=BC=A0?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmpac/resource/ApplytaskRestResource.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/mmpac/src/public/nc/api/mmpac/resource/ApplytaskRestResource.java b/mmpac/src/public/nc/api/mmpac/resource/ApplytaskRestResource.java index 38b790fd..3bdbaab5 100644 --- a/mmpac/src/public/nc/api/mmpac/resource/ApplytaskRestResource.java +++ b/mmpac/src/public/nc/api/mmpac/resource/ApplytaskRestResource.java @@ -34,6 +34,10 @@ import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import java.time.LocalDate; +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.*; @Path("mmpac/applytask") @@ -68,14 +72,16 @@ public class ApplytaskRestResource extends AbstractNCCRestResource { List bids= new ArrayList<>(); List aggTaskAVOS = new ArrayList<>(); for (Map param : paramList) { - Object orderId= hybo.findColValue("mm_pmo","cpmohid"," vbillcode ='" + param.get("billcode") + "' "); + Object orderId= param.get("billcode") +""; + +// Object orderId= hybo.findColValue("mm_pmo","cpmohid"," vbillcode ='" + param.get("billcode") + "' "); // String mrlCode= (String) param.get("mrlcode"); // String mrlid=(String) hybo.findColValue("bd_material","pk_material"," code = '" + mrlCode + "' "); // if(mrlid == null){ // throw new BusinessException("产品编码不能为空"); // } if (orderId != null && !orderId.equals("")) { - PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryByPks(new String[]{(String) orderId}); + PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryPMOAggVOByBid(new String[]{(String) orderId}); if (pmoaggvos == null || pmoaggvos.length == 0) { }else{ @@ -98,7 +104,7 @@ public class ApplytaskRestResource extends AbstractNCCRestResource { taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) ); String month = (String) param.get("month"); - taskABVO.setDtaskdate(UFDate.getDate(month) ); + taskABVO.setDtaskdate(UFDate.getDate(get25thOfMonth(month)) ); // taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) ); } @@ -157,4 +163,16 @@ public class ApplytaskRestResource extends AbstractNCCRestResource { return taskvos; } } + public static String get25thOfMonth(String yearMonthStr) throws DateTimeParseException { + // 定义解析年月字符串的格式(yyyyMM) + DateTimeFormatter parser = DateTimeFormatter.ofPattern("yyyyMM"); + // 解析字符串为YearMonth对象(包含年和月) + YearMonth yearMonth = YearMonth.parse(yearMonthStr, parser); + // 获取该月的25号(LocalDate对象) + LocalDate date = yearMonth.atDay(25); + // 定义输出格式(yyyy-MM-dd) + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + // 格式化并返回结果 + return date.format(formatter); + } }