From c803f8549dcc49e756292b0cf6fbc1dab525b64a Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期三, 16 四月 2025 13:41:23 +0800
Subject: [PATCH] 焊缝统计表-逻辑更新
---
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessStat.java | 264 +++++++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java | 14
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessStatServiceImpl.java | 164 ++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessStatController.java | 108 +++++++
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java | 74 ++++
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessStatService.java | 65 ++++
aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java | 18
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessStatMapper.xml | 185 ++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java | 2
9 files changed, 885 insertions(+), 9 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessStatController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessStatController.java
new file mode 100644
index 0000000..d98a227
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateProcessStatController.java
@@ -0,0 +1,108 @@
+package com.aps.core.controller.mainPlan;
+
+import java.util.List;
+import java.io.IOException;
+
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.aps.common.log.annotation.Log;
+import com.aps.common.log.enums.BusinessType;
+import com.aps.common.security.annotation.RequiresPermissions;
+import com.aps.core.domain.ApsPlateProcessStat;
+import com.aps.core.service.IApsPlateProcessStatService;
+import com.aps.common.core.web.controller.BaseController;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.core.utils.poi.ExcelUtil;
+import com.aps.common.core.web.page.TableDataInfo;
+
+/**
+ * 閽i噾缁熻Controller
+ *
+ * @author zhl
+ * @date 2025-04-15
+ */
+@RestController
+@RequestMapping("/plateProcessStat")
+public class ApsPlateProcessStatController extends BaseController
+{
+ @Autowired
+ private IApsPlateProcessStatService apsPlateProcessStatService;
+
+
+
+ /**
+ * 瀵煎嚭閽i噾缁熻鍒楄〃
+ */
+ @RequiresPermissions("apsPlateProcessStat:export")
+ @Log(title = "閽i噾缁熻", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ApsPlateProcessStat apsPlateProcessStat)
+ {
+ List<ApsPlateProcessStat> list = apsPlateProcessStatService.selectApsPlateProcessStatList(apsPlateProcessStat);
+ ExcelUtil<ApsPlateProcessStat> util = new ExcelUtil<ApsPlateProcessStat>(ApsPlateProcessStat.class);
+ util.exportExcel(response, list, "閽i噾缁熻鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇閽i噾缁熻璇︾粏淇℃伅
+ */
+ @RequiresPermissions("apsPlateProcessStat:query")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") String id)
+ {
+ return success(apsPlateProcessStatService.selectApsPlateProcessStatById(id));
+ }
+
+ /**
+ * 鏂板閽i噾缁熻
+ */
+ @RequiresPermissions("apsPlateProcessStat:add")
+ @Log(title = "閽i噾缁熻", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ApsPlateProcessStat apsPlateProcessStat)
+ {
+ return toAjax(apsPlateProcessStatService.insertApsPlateProcessStat(apsPlateProcessStat));
+ }
+
+ /**
+ * 鍒犻櫎閽i噾缁熻
+ */
+ @RequiresPermissions("apsPlateProcessStat:remove")
+ @Log(title = "閽i噾缁熻", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable String[] ids)
+ {
+ return toAjax(apsPlateProcessStatService.deleteApsPlateProcessStatByIds(ids));
+ }
+
+ /**
+ * 淇敼閽i噾缁熻
+ */
+ /*@RequiresPermissions("apsPlateProcessStat:edit")*/
+ @Log(title = "閽i噾缁熻", businessType = BusinessType.UPDATE)
+ @PostMapping("/update")
+ public AjaxResult updateStat()
+ {
+ apsPlateProcessStatService.savePlateProcessStat();
+ return toAjax(true);
+ }
+ /**
+ * 鏌ヨ閽i噾缁熻鍒楄〃
+ */
+ /*@RequiresPermissions("apsPlateProcessStat:list")*/
+ @GetMapping("/list")
+ public TableDataInfo list(ApsPlateProcessStat apsPlateProcessStat)
+ {
+ List<ApsPlateProcessStat> list = apsPlateProcessStatService.selectApsPlateProcessStatList(apsPlateProcessStat);
+ return getDataTable(list);
+ }
+
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java
index a36f9f6..50e8760 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamController.java
@@ -38,7 +38,7 @@
/**
* 鏌ヨ鐒婄紳鍒楄〃
*/
- @RequiresPermissions("weldSeam:weldSeam:list")
+// @RequiresPermissions("weldSeam:weldSeam:list")
@GetMapping("/list")
public TableDataInfo list(ApsWeldSeam apsWeldSeam) {
// startPage();
@@ -131,23 +131,25 @@
//鍒嗙被
List<SysDictData> list = DictUtils.getDictCache("aps_weld_classification");
for (int i = 0; i < apsWeldSeamTemps.size(); i++) {
+ ApsWeldSeamTemp apsWeldSeamTemp = apsWeldSeamTemps.get(i);
//鍒嗙被
for (int j = 0; j < list.size(); j++) {
- if (apsWeldSeamTemps.get(i).getClassificationTxt().equals(list.get(j).getDictLabel())) {
- apsWeldSeamTemps.get(i).setClassification(list.get(j).getDictValue());
+ if (apsWeldSeamTemp.getClassificationTxt().equals(list.get(j).getDictLabel())) {
+ apsWeldSeamTemp.setClassification(list.get(j).getDictValue());
}
}
//宸ュ崟绫诲瀷
for (int j = 0; j < listTypes.size(); j++) {
- if (apsWeldSeamTemps.get(i).getWorkOrderTypeTxt().equals(listTypes.get(j).getDictLabel())) {
- apsWeldSeamTemps.get(i).setWorkOrderType(listTypes.get(j).getDictValue());
+ if (apsWeldSeamTemp.getWorkOrderTypeTxt().equals(listTypes.get(j).getDictLabel())) {
+ apsWeldSeamTemp.setWorkOrderType(listTypes.get(j).getDictValue());
}
}
//鎻掑叆鐗堟湰鍙�
- apsWeldSeamTemps.get(i).setBatchNumber(batchNum);
+ apsWeldSeamTemp.setBatchNumber(batchNum);
//鎻掑叆涓存椂琛�
- apsWeldSeamTemps.get(i).setTotalWeldSeam(apsWeldSeamTemps.get(i).getSingleWeldSeam().longValue()*apsWeldSeamTemps.get(i).getProductionQuantity().longValue());
- apsWeldSeamTempService.insertApsWeldSeamTemp(apsWeldSeamTemps.get(i));
+ apsWeldSeamTemp.setTotalWeldSeam(apsWeldSeamTemp.getSingleWeldSeam().longValue()* apsWeldSeamTemp.getProductionQuantity().longValue());
+
+ apsWeldSeamTempService.insertApsWeldSeamTemp(apsWeldSeamTemp);
}
return AjaxResult.success("瀵煎叆鎴愬姛", batchNum);
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java
index ba4c8d0..5422444 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsWeldSeamTempController.java
@@ -2,6 +2,8 @@
import java.util.List;
+import com.aps.common.security.utils.DictUtils;
+import com.aps.system.api.domain.SysDictData;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -44,6 +46,18 @@
{
// startPage();
List<ApsWeldSeamTemp> list = apsWeldSeamTempService.selectApsWeldSeamTempList(apsWeldSeamTemp);
+ //宸ュ崟绫诲瀷
+ List<SysDictData> workOrderTypes = DictUtils.getDictCache("aps_weld_work_order_type");
+ //鍒嗙被
+ List<SysDictData> classification = DictUtils.getDictCache("aps_weld_classification");
+
+ list.forEach(tmp->{
+ classification.stream().filter(t->t.getDictValue().equals(tmp.getClassification()))
+ .findFirst().ifPresent(t->{ tmp.setClassification(t.getDictLabel());}) ;
+ workOrderTypes.stream().filter(t->t.getDictValue().equals(tmp.getWorkOrderType()))
+ .findFirst().ifPresent(t->{ tmp.setWorkOrderType(t.getDictLabel());}) ;
+ });
+
return getDataTable(list);
}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessStat.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessStat.java
new file mode 100644
index 0000000..77a1bd1
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateProcessStat.java
@@ -0,0 +1,264 @@
+package com.aps.core.domain;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.aps.common.core.annotation.Excel;
+import com.aps.common.core.web.domain.BaseEntity;
+
+/**
+ * 閽i噾缁熻瀵硅薄 aps_plate_process_stat
+ *
+ * @author zhl
+ * @date 2025-04-15
+ */
+public class ApsPlateProcessStat extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 涓婚敭id */
+ private String id;
+
+ /** 宸ュ崟鍙� */
+ @Excel(name = "宸ュ崟鍙�")
+ private String workOrderNo;
+
+ /** 宸ュ簭鍚嶇О */
+ @Excel(name = "宸ュ簭鍚嶇О")
+ private String processName;
+
+ /** 鎺掑簭 */
+ @Excel(name = "鎺掑簭")
+ private Integer num;
+
+ /** 宸ュ簭鍙� */
+ @Excel(name = "宸ュ簭鍙�")
+ private BigDecimal routeProcessNumber;
+
+ /** 褰撳墠宸ュ簭鍙� */
+ @Excel(name = "褰撳墠宸ュ簭鍙�")
+ private BigDecimal currentProcessNumber;
+
+ /** 鐢熶骇鏁伴噺 */
+ @Excel(name = "鐢熶骇鏁伴噺")
+ private Integer productionQuantity;
+
+ /** 鏍囧噯宸ユ椂 */
+ @Excel(name = "鏍囧噯宸ユ椂")
+ private Integer standardTime;
+
+ /** 宸ュ簭鎬诲伐鏃� */
+ @Excel(name = "宸ュ簭鎬诲伐鏃�")
+ private Integer processTotalTime;
+
+ /** 璁″垝瀹屾垚鏃� */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "璁″垝瀹屾垚鏃�", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date processPlanEndDay;
+
+ /** 璁$畻瀹屾垚鏃� */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "璁$畻瀹屾垚鏃�", width = 30, dateFormat = "yyyy-MM-dd")
+ private Date computePlanEndDay;
+
+
+
+ /** 璁″垝寮�宸ユ棩 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "璁″垝寮�宸ユ棩", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date processPlanStartDay;
+
+ /** 璁㈠崟寮�宸ユ棩 */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @Excel(name = "璁㈠崟寮�宸ユ棩", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+ private Date orderPlanEndDay;
+
+ /** 璁捐宸ユ椂 */
+ @Excel(name = "璁捐宸ユ椂")
+ private Long designTimes;
+
+ /** 鎵规鍙� */
+ @Excel(name = "鎵规鍙�")
+ private String batchNumber;
+
+ /** 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛� */
+ private String delFlag;
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setWorkOrderNo(String workOrderNo)
+ {
+ this.workOrderNo = workOrderNo;
+ }
+
+ public String getWorkOrderNo()
+ {
+ return workOrderNo;
+ }
+
+ public void setProcessName(String processName)
+ {
+ this.processName = processName;
+ }
+
+ public String getProcessName()
+ {
+ return processName;
+ }
+
+ public void setNum(Integer num)
+ {
+ this.num = num;
+ }
+
+ public Integer getNum()
+ {
+ return num;
+ }
+
+ public void setRouteProcessNumber(BigDecimal routeProcessNumber)
+ {
+ this.routeProcessNumber = routeProcessNumber;
+ }
+
+ public BigDecimal getRouteProcessNumber()
+ {
+ return routeProcessNumber;
+ }
+
+ public void setCurrentProcessNumber(BigDecimal currentProcessNumber)
+ {
+ this.currentProcessNumber = currentProcessNumber;
+ }
+
+ public BigDecimal getCurrentProcessNumber()
+ {
+ return currentProcessNumber;
+ }
+
+ public void setProductionQuantity(Integer productionQuantity)
+ {
+ this.productionQuantity = productionQuantity;
+ }
+
+ public Integer getProductionQuantity()
+ {
+ return productionQuantity;
+ }
+
+ public void setStandardTime(Integer standardTime)
+ {
+ this.standardTime = standardTime;
+ }
+
+ public Integer getStandardTime()
+ {
+ return standardTime;
+ }
+
+ public void setProcessTotalTime(Integer processTotalTime)
+ {
+ this.processTotalTime = processTotalTime;
+ }
+
+ public Integer getProcessTotalTime()
+ {
+ return processTotalTime;
+ }
+
+ public void setProcessPlanEndDay(Date processPlanEndDay)
+ {
+ this.processPlanEndDay = processPlanEndDay;
+ }
+
+ public Date getProcessPlanEndDay()
+ {
+ return processPlanEndDay;
+ }
+
+ public void setComputePlanEndDay(Date computePlanEndDay)
+ {
+ this.computePlanEndDay = computePlanEndDay;
+ }
+
+ public Date getComputePlanEndDay()
+ {
+ return computePlanEndDay;
+ }
+
+ public void setDesignTimes(Long designTimes)
+ {
+ this.designTimes = designTimes;
+ }
+
+ public Long getDesignTimes()
+ {
+ return designTimes;
+ }
+
+ public void setBatchNumber(String batchNumber)
+ {
+ this.batchNumber = batchNumber;
+ }
+
+ public String getBatchNumber()
+ {
+ return batchNumber;
+ }
+ public Date getProcessPlanStartDay() {
+ return processPlanStartDay;
+ }
+
+ public void setProcessPlanStartDay(Date processPlanStartDay) {
+ this.processPlanStartDay = processPlanStartDay;
+ }
+
+ public Date getOrderPlanEndDay() {
+ return orderPlanEndDay;
+ }
+
+ public void setOrderPlanEndDay(Date orderPlanEndDay) {
+ this.orderPlanEndDay = orderPlanEndDay;
+ }
+ public void setDelFlag(String delFlag)
+ {
+ this.delFlag = delFlag;
+ }
+
+ public String getDelFlag()
+ {
+ return delFlag;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("workOrderNo", getWorkOrderNo())
+ .append("processName", getProcessName())
+ .append("num", getNum())
+ .append("routeProcessNumber", getRouteProcessNumber())
+ .append("currentProcessNumber", getCurrentProcessNumber())
+ .append("productionQuantity", getProductionQuantity())
+ .append("standardTime", getStandardTime())
+ .append("processTotalTime", getProcessTotalTime())
+ .append("processPlanEndDay", getProcessPlanEndDay())
+ .append("computePlanEndDay", getComputePlanEndDay())
+ .append("designTimes", getDesignTimes())
+ .append("batchNumber", getBatchNumber())
+ .append("createBy", getCreateBy())
+ .append("delFlag", getDelFlag())
+ .toString();
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java
new file mode 100644
index 0000000..cc7353a
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateProcessStatMapper.java
@@ -0,0 +1,74 @@
+package com.aps.core.mapper;
+
+import java.util.List;
+import com.aps.core.domain.ApsPlateProcessStat;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 閽i噾缁熻Mapper鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-15
+ */
+@Mapper
+public interface ApsPlateProcessStatMapper
+{
+ /**
+ * 鏌ヨ閽i噾缁熻
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 閽i噾缁熻
+ */
+ public ApsPlateProcessStat selectApsPlateProcessStatById(String id);
+
+ /**
+ * 鏌ヨ閽i噾缁熻鍒楄〃
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 閽i噾缁熻闆嗗悎
+ */
+ public List<ApsPlateProcessStat> selectApsPlateProcessStatList(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 鏂板閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ public int insertApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 淇敼閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ public int updateApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 鍒犻櫎閽i噾缁熻
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessStatById(String id);
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessStatByIds(String[] ids);
+ /**缁熻涓存椂鏁版嵁*/
+ List<ApsPlateProcessStat> queryTempStat();
+
+ /**
+ * 鍒犻櫎褰撳墠鎵规涔嬪鐨勬暟鎹�
+ */
+ int removeOtherStat(String batchNumber);
+ /**
+ * 鎵归噺鎻掑叆鏁版嵁
+ * */
+ int batchInsertPlateStat(List<ApsPlateProcessStat> list);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessStatService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessStatService.java
new file mode 100644
index 0000000..8552ad9
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateProcessStatService.java
@@ -0,0 +1,65 @@
+package com.aps.core.service;
+
+import java.util.List;
+import com.aps.core.domain.ApsPlateProcessStat;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 閽i噾缁熻Service鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-15
+ */
+public interface IApsPlateProcessStatService
+{
+ /**
+ * 鏌ヨ閽i噾缁熻
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 閽i噾缁熻
+ */
+ public ApsPlateProcessStat selectApsPlateProcessStatById(String id);
+
+ /**
+ * 鏌ヨ閽i噾缁熻鍒楄〃
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 閽i噾缁熻闆嗗悎
+ */
+ public List<ApsPlateProcessStat> selectApsPlateProcessStatList(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 鏂板閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ public int insertApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 淇敼閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ public int updateApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat);
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑閽i噾缁熻涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessStatByIds(String[] ids);
+
+ /**
+ * 鍒犻櫎閽i噾缁熻淇℃伅
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsPlateProcessStatById(String id);
+
+ @Transactional
+ void savePlateProcessStat();
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessStatServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessStatServiceImpl.java
new file mode 100644
index 0000000..33df3be
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateProcessStatServiceImpl.java
@@ -0,0 +1,164 @@
+package com.aps.core.service.impl;
+
+import java.time.*;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.aps.common.core.utils.uuid.IdUtils;
+import com.aps.common.security.utils.SecurityUtils;
+import org.apache.commons.lang3.SystemUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.aps.core.mapper.ApsPlateProcessStatMapper;
+import com.aps.core.domain.ApsPlateProcessStat;
+import com.aps.core.service.IApsPlateProcessStatService;
+import org.springframework.transaction.annotation.Transactional;
+
+import static java.util.stream.Collectors.groupingBy;
+
+/**
+ * 閽i噾缁熻Service涓氬姟灞傚鐞�
+ *
+ * @author zhl
+ * @date 2025-04-15
+ */
+@Service
+public class ApsPlateProcessStatServiceImpl implements IApsPlateProcessStatService
+{
+ @Autowired
+ private ApsPlateProcessStatMapper apsPlateProcessStatMapper;
+
+ /**
+ * 鏌ヨ閽i噾缁熻
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 閽i噾缁熻
+ */
+ @Override
+ public ApsPlateProcessStat selectApsPlateProcessStatById(String id)
+ {
+ return apsPlateProcessStatMapper.selectApsPlateProcessStatById(id);
+ }
+
+ /**
+ * 鏌ヨ閽i噾缁熻鍒楄〃
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 閽i噾缁熻
+ */
+ @Override
+ public List<ApsPlateProcessStat> selectApsPlateProcessStatList(ApsPlateProcessStat apsPlateProcessStat)
+ {
+ return apsPlateProcessStatMapper.selectApsPlateProcessStatList(apsPlateProcessStat);
+ }
+
+ /**
+ * 鏂板閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat)
+ {
+ return apsPlateProcessStatMapper.insertApsPlateProcessStat(apsPlateProcessStat);
+ }
+
+ /**
+ * 淇敼閽i噾缁熻
+ *
+ * @param apsPlateProcessStat 閽i噾缁熻
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateApsPlateProcessStat(ApsPlateProcessStat apsPlateProcessStat)
+ {
+ return apsPlateProcessStatMapper.updateApsPlateProcessStat(apsPlateProcessStat);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎閽i噾缁熻
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑閽i噾缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsPlateProcessStatByIds(String[] ids)
+ {
+ return apsPlateProcessStatMapper.deleteApsPlateProcessStatByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎閽i噾缁熻淇℃伅
+ *
+ * @param id 閽i噾缁熻涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsPlateProcessStatById(String id)
+ {
+ return apsPlateProcessStatMapper.deleteApsPlateProcessStatById(id);
+ }
+
+ /**
+ * 淇濆瓨閽i噾缁熻鏁版嵁
+ */
+ @Transactional
+ @Override
+ public void savePlateProcessStat() {
+ String batchNum = IdUtils.fastSimpleUUID();
+ List<ApsPlateProcessStat> tempList = apsPlateProcessStatMapper.queryTempStat();
+ Map<String, List<ApsPlateProcessStat>> groupByOrderNo = tempList.stream().collect(groupingBy(ApsPlateProcessStat::getWorkOrderNo));
+ for (Map.Entry<String, List<ApsPlateProcessStat>> entry : groupByOrderNo.entrySet()) {
+ List<ApsPlateProcessStat> statPerOrder = entry.getValue();
+ /*num 涓烘牴鎹畬宸ユ椂闂存帓搴忓嚭鐨勫簭鍙凤紝鎸夋鎺掑簭锛屽彲淇濊瘉鏄寜瀹屽伐鏃堕棿鍊掑彊鎺掑垪*/
+ statPerOrder.sort((a, b)->a.getNum().compareTo(b.getNum()));
+ ApsPlateProcessStat last=null;
+ for (int i = 0; i <statPerOrder.size(); i++) {
+ ApsPlateProcessStat stat = statPerOrder.get(i);
+ stat.setId(IdUtils.fastSimpleUUID());
+ stat.setBatchNumber(batchNum);
+ stat.setCreateBy(SecurityUtils.getUsername());
+ if(i==0){
+ Date orderPlanEndDay = stat.getOrderPlanEndDay();
+ LocalDateTime transLocalDateTime = transLocalDateTime(orderPlanEndDay);
+ LocalTime endOfDay = LocalTime.of(23, 59, 59);
+ LocalDateTime orderPlanEndDayLocalDateTime = LocalDateTime.of( transLocalDateTime.toLocalDate(), endOfDay);
+
+ /*璁″垝瀹屽伐鏃�=閽i噾璁″垝宸ュ崟瀹屾垚鏃堕棿*/
+ stat.setProcessPlanEndDay(transDate(orderPlanEndDayLocalDateTime));
+ /*璁″垝寮�宸ユ棩=閽i噾璁″垝宸ュ崟瀹屾垚鏃堕棿 - 宸ュ簭鎬诲伐鏃�*/
+ stat.setProcessPlanStartDay(transDate(orderPlanEndDayLocalDateTime.minusHours(stat.getProcessTotalTime())));
+ }
+ /*褰撳伐鑹哄伐搴忓彿 > 宸ュ崟褰撳墠宸ュ簭鏃讹紝浠h〃鏄湭鏉ョ殑宸ュ簭锛屾墠杩涜璁″垝寮�宸ユ棩 鍜岃鍒掑畬宸ユ棩鐨勮绠�*/
+ if( stat.getRouteProcessNumber().compareTo(stat.getCurrentProcessNumber())>0){
+ /*&璁″垝寮�宸ユ棩 鍜� 璁″垝瀹屾垚鏃� 锛屽悓鏃跺ぇ浜庡綋鍓嶆棩鏈熸椂鎵ц璁$畻*/
+ LocalDateTime currentEndDay = transLocalDateTime(stat.getProcessPlanEndDay());
+ LocalDateTime currentStartDay = transLocalDateTime(stat.getProcessPlanStartDay());
+ if(currentEndDay.isAfter(LocalDateTime.now()) && currentStartDay.isAfter(LocalDateTime.now())){
+ if(last!=null){
+ /*鏈紑宸ュ伐搴忕殑璁″垝寮�宸ユ棩=涓婁竴閬撳伐搴忕殑璁″垝寮�宸ユ棩+涓婁竴閬撳伐搴忕殑宸ュ簭鎬诲伐鏃躲��*/
+ stat.setProcessPlanEndDay(last.getProcessPlanStartDay());
+ stat.setProcessPlanStartDay(transDate(transLocalDateTime(last.getProcessPlanStartDay()).minusHours(stat.getProcessTotalTime()) ));
+ }
+ }
+ }
+ last = stat;
+ apsPlateProcessStatMapper.insertApsPlateProcessStat(stat);
+ }
+
+ }
+ apsPlateProcessStatMapper.removeOtherStat(batchNum);
+
+ }
+
+
+ private Date transDate(LocalDateTime localDateTime){
+ return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
+ }
+
+ private LocalDateTime transLocalDateTime(Date date){
+ return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java
index 22dd057..b4c43fb 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsWeldSeamServiceImpl.java
@@ -114,7 +114,7 @@
//閫氳繃宸ュ崟鍙锋煡璇㈡槸鍚﹀瓨鍦ㄦ暟鎹�
ApsWeldSeam apsWeldSeam1 = apsWeldSeamMapper.selectApsWeldSeamByWorkOrderNo(apsWeldSeam.getWorkOrderNo());
//褰撳伐鍗曞彿瀛樺湪鍒欐洿鏂版暟鎹惁鍒欐彃鍏ユ暟鎹�
- if (ObjectUtils.isNotEmpty(apsWeldSeam1)) {
+ if (apsWeldSeam1!=null&&apsWeldSeam1.getId()!=null) {
apsWeldSeam.setId(apsWeldSeam1.getId());
apsWeldSeamMapper.updateApsWeldSeam(apsWeldSeam);
} else {
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessStatMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessStatMapper.xml
new file mode 100644
index 0000000..59c905b
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateProcessStatMapper.xml
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.aps.core.mapper.ApsPlateProcessStatMapper">
+
+ <resultMap type="ApsPlateProcessStat" id="ApsPlateProcessStatResult">
+ <result property="id" column="id" />
+ <result property="workOrderNo" column="work_order_no" />
+ <result property="processName" column="process_name" />
+ <result property="num" column="num" />
+ <result property="routeProcessNumber" column="route_process_number" />
+ <result property="currentProcessNumber" column="current_process_number" />
+ <result property="productionQuantity" column="production_quantity" />
+ <result property="standardTime" column="standard_time" />
+ <result property="processTotalTime" column="process_total_time" />
+ <result property="processPlanEndDay" column="process_plan_end_day" />
+ <result property="computePlanEndDay" column="compute_plan_end_day" />
+ <result property="processPlanStartDay" column="process_plan_start_day" />
+ <result property="orderPlanEndDay" column="order_plan_end_day" />
+ <result property="designTimes" column="design_times" />
+ <result property="batchNumber" column="batch_number" />
+ <result property="createBy" column="create_by" />
+ <result property="delFlag" column="del_flag" />
+ </resultMap>
+
+ <sql id="selectApsPlateProcessStatVo">
+ select id, work_order_no, process_name, num, route_process_number, current_process_number, production_quantity, standard_time, process_total_time, process_plan_end_day, compute_plan_end_day, design_times, batch_number, create_by, del_flag from aps_plate_process_stat
+ </sql>
+
+ <select id="selectApsPlateProcessStatList" parameterType="ApsPlateProcessStat" resultMap="ApsPlateProcessStatResult">
+ <include refid="selectApsPlateProcessStatVo"/>
+ <where>
+ <if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if>
+ <if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
+ <if test="num != null "> and num = #{num}</if>
+ <if test="routeProcessNumber != null "> and route_process_number = #{routeProcessNumber}</if>
+ <if test="currentProcessNumber != null "> and current_process_number = #{currentProcessNumber}</if>
+ <if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if>
+ <if test="standardTime != null "> and standard_time = #{standardTime}</if>
+ <if test="processTotalTime != null "> and process_total_time = #{processTotalTime}</if>
+ <if test="processPlanEndDay != null "> and process_plan_end_day = #{processPlanEndDay}</if>
+ <if test="computePlanEndDay != null "> and compute_plan_end_day = #{computePlanEndDay}</if>
+ <if test="designTimes != null "> and design_times = #{designTimes}</if>
+ <if test="batchNumber != null and batchNumber != ''"> and batch_number = #{batchNumber}</if>
+ </where>
+ </select>
+
+ <select id="selectApsPlateProcessStatById" parameterType="String" resultMap="ApsPlateProcessStatResult">
+ <include refid="selectApsPlateProcessStatVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertApsPlateProcessStat" parameterType="ApsPlateProcessStat">
+ insert into aps_plate_process_stat
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="id != null">id,</if>
+ <if test="workOrderNo != null">work_order_no,</if>
+ <if test="processName != null">process_name,</if>
+ <if test="num != null">num,</if>
+ <if test="routeProcessNumber != null">route_process_number,</if>
+ <if test="currentProcessNumber != null">current_process_number,</if>
+ <if test="productionQuantity != null">production_quantity,</if>
+ <if test="standardTime != null">standard_time,</if>
+ <if test="processTotalTime != null">process_total_time,</if>
+ <if test="processPlanEndDay != null">process_plan_end_day,</if>
+ <if test="processPlanStartDay != null">process_plan_start_day,</if>
+ <if test="designTimes != null">design_times,</if>
+ <if test="batchNumber != null">batch_number,</if>
+ <if test="createBy != null">create_by,</if>
+
+ <if test="delFlag != null">del_flag,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="id != null">#{id},</if>
+ <if test="workOrderNo != null">#{workOrderNo},</if>
+ <if test="processName != null">#{processName},</if>
+ <if test="num != null">#{num},</if>
+ <if test="routeProcessNumber != null">#{routeProcessNumber},</if>
+ <if test="currentProcessNumber != null">#{currentProcessNumber},</if>
+ <if test="productionQuantity != null">#{productionQuantity},</if>
+ <if test="standardTime != null">#{standardTime},</if>
+ <if test="processTotalTime != null">#{processTotalTime},</if>
+ <if test="processPlanEndDay != null">#{processPlanEndDay},</if>
+ <if test="processPlanStartDay != null">#{processPlanStartDay},</if>
+ <if test="designTimes != null">#{designTimes},</if>
+ <if test="batchNumber != null">#{batchNumber},</if>
+ <if test="createBy != null">#{createBy},</if>
+
+ <if test="delFlag != null">#{delFlag},</if>
+ </trim>
+ </insert>
+
+ <update id="updateApsPlateProcessStat" parameterType="ApsPlateProcessStat">
+ update aps_plate_process_stat
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="workOrderNo != null">work_order_no = #{workOrderNo},</if>
+ <if test="processName != null">process_name = #{processName},</if>
+ <if test="num != null">num = #{num},</if>
+ <if test="routeProcessNumber != null">route_process_number = #{routeProcessNumber},</if>
+ <if test="currentProcessNumber != null">current_process_number = #{currentProcessNumber},</if>
+ <if test="productionQuantity != null">production_quantity = #{productionQuantity},</if>
+ <if test="standardTime != null">standard_time = #{standardTime},</if>
+ <if test="processTotalTime != null">process_total_time = #{processTotalTime},</if>
+ <if test="processPlanEndDay != null">process_plan_end_day = #{processPlanEndDay},</if>
+ <if test="computePlanEndDay != null">compute_plan_end_day = #{computePlanEndDay},</if>
+ <if test="designTimes != null">design_times = #{designTimes},</if>
+ <if test="batchNumber != null">batch_number = #{batchNumber},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteApsPlateProcessStatById" parameterType="String">
+ delete from aps_plate_process_stat where id = #{id}
+ </delete>
+
+ <delete id="deleteApsPlateProcessStatByIds" parameterType="String">
+ delete from aps_plate_process_stat where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+
+ <select id="queryTempStat" resultMap="ApsPlateProcessStatResult">
+ select
+ row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num,
+ rt.work_order_no,
+ rt.process_name,
+ cast(rt.process_number as numeric(18, 2)) as route_process_number,
+ cast(pl.process_number as numeric(18, 2)) as current_process_number,
+ pl.production_quantity,
+ rt.standard_time,
+ (rt.standard_time * pl.production_quantity) as process_total_time,
+ rt.process_plan_start_day,
+ rt.process_plan_end_day,
+ pl.plan_end_day as order_plan_end_day
+ from aps_plate_plan as pl
+ left join aps_process_route as rt on pl.document_number = rt.work_order_no
+ where pl.del_flag = '0' and rt.del_flag = '0'
+ and (pl.document_status is not null and (pl.document_status != '3'))
+ order by rt.work_order_no asc , rt.process_number desc
+ </select>
+ <update id="removeOtherStat" parameterType="String">
+ delete from aps_plate_process_stat where batch_number != #{batchNumber}
+ </update>
+
+ <insert id="batchInsertPlateStat" parameterType="ApsPlateProcessStat">
+ insert into aps_plate_process_stat
+ (
+ id,
+ work_order_no,
+ process_name,
+ num,
+ route_process_number,
+ current_process_number,
+ production_quantity,
+ standard_time,
+ process_total_time,
+ process_plan_end_day,
+ batch_number,
+ create_by,
+ del_flag
+ )
+ values
+ <foreach collection="list" item="item" index="index" separator=",">
+ (
+ #{item.id},
+ #{item.workOrderNo},
+ #{item.processName},
+ #{item.num},
+ #{item.routeProcessNumber},
+ #{item.currentProcessNumber},
+ #{item.productionQuantity},
+ #{item.standardTime},
+ #{item.processTotalTime},
+ #{item.processPlanEndDay},
+ #{item.batchNumber},
+ #{item.createBy},
+ '0'
+ )
+ </foreach>
+ </insert>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3