| | |
| | | package com.aps.core.controller.basicData; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | /** |
| | | * 查询焊缝标准列表 |
| | | */ |
| | | @RequiresPermissions("weldSeamStandard:weldSeamStandard:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsWeldSeamStandard apsWeldSeamStandard) |
| | | { |
| | |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | int i = apsGasPipelineMoService.batchInsertGasPipelineMo(file); |
| | | return toAjax(i); |
| | | apsGasPipelineMoService.batchInsertGasPipelineMo(file); |
| | | return toAjax(true); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.aps.core.controller.mainPlan; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.core.web.controller.BaseController; |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.common.core.web.page.TableDataInfo; |
| | | import com.aps.core.domain.ApsGasPipelineMo; |
| | | 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.ApsGasPipelinePrediction; |
| | | import com.aps.core.service.IApsGasPipelinePredictionService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | 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.common.core.web.controller.BaseController; |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 管路手工气体预测数据Controller |
| | |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | int i = apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(i); |
| | | apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(true); |
| | | } |
| | | /** |
| | | * 导出管路手工气体预测数据列表 |
| | |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | int i = apsMaterialProductGroupManagementService.batchInsertApsMaterialProductGroupManagement(file); |
| | | return toAjax(i); |
| | | apsMaterialProductGroupManagementService.batchInsertApsMaterialProductGroupManagement(file); |
| | | return toAjax(true); |
| | | } |
| | | /** |
| | | * 导出物料产品组数据管理列表 |
| | |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 管路手工气体预测数据对象 aps_gas_pipeline_prediction |
| | |
| | | @Schema(description = "数量") |
| | | private BigDecimal predictQuantity; |
| | | |
| | | @JsonIgnore |
| | | @TableField(exist = false) |
| | | private String key; |
| | | |
| | | @JsonIgnore |
| | | public String getKey() { |
| | | if (key == null && getPredictDate() != null) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | key = getFactory() + "##" + getMaterialCode() + "##" + sdf.format(getPredictDate()); |
| | | } |
| | | return key; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.aps.core.domain; |
| | | |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | |
| | | |
| | | /** |
| | | * 物料产品组数据管理对象 aps_material_product_group_management |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-19 |
| | | */ |
| | | @Schema(description = "物料产品组数据管理实体类") |
| | | @Data |
| | | public class ApsMaterialProductGroupManagement extends BaseEntity |
| | | { |
| | | public class ApsMaterialProductGroupManagement extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | |
| | | @Schema(description = "ID") |
| | | private Long id; |
| | | |
| | | /** 适用工厂 参考 aps_factory */ |
| | | /** |
| | | * 适用工厂 参考 aps_factory |
| | | */ |
| | | @Excel(name = "适用工厂 参考 aps_factory") |
| | | @Schema(description = "适用工厂 参考 aps_factory") |
| | | private String factory; |
| | | |
| | | /** 料号 */ |
| | | /** |
| | | * 料号 |
| | | */ |
| | | @Excel(name = "料号") |
| | | @Schema(description = "料号") |
| | | private String materialCode; |
| | | |
| | | /** 专业 参考 aps_domain */ |
| | | /** |
| | | * 专业 参考 aps_domain |
| | | */ |
| | | @Excel(name = "专业 参考 aps_domain") |
| | | @Schema(description = "专业 参考 aps_domain") |
| | | private String domain; |
| | | |
| | | /** 是否为主阶 是/否 */ |
| | | /** |
| | | * 是否为主阶 是/否 |
| | | */ |
| | | @Excel(name = "是否为主阶 是/否") |
| | | @Schema(description = "是否为主阶 是/否") |
| | | private String isMain; |
| | | |
| | | /** 料号类别 制造件/采购件 */ |
| | | @JsonIgnore |
| | | @TableField(exist = false) |
| | | private String key; |
| | | |
| | | @JsonIgnore |
| | | public String getKey() { |
| | | if (key == null) { |
| | | key = getFactory() + "##" + getMaterialCode(); |
| | | } |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | | * 料号类别 制造件/采购件 |
| | | */ |
| | | @Excel(name = "料号类别 制造件/采购件") |
| | | @Schema(description = "料号类别 制造件/采购件") |
| | | private String materialType; |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setFactory(String factory) |
| | | { |
| | | public void setFactory(String factory) { |
| | | this.factory = factory; |
| | | } |
| | | |
| | | public String getFactory() |
| | | { |
| | | public String getFactory() { |
| | | return factory; |
| | | } |
| | | |
| | | public void setMaterialCode(String materialCode) |
| | | { |
| | | public void setMaterialCode(String materialCode) { |
| | | this.materialCode = materialCode; |
| | | } |
| | | |
| | | public String getMaterialCode() |
| | | { |
| | | public String getMaterialCode() { |
| | | return materialCode; |
| | | } |
| | | |
| | | public void setDomain(String domain) |
| | | { |
| | | public void setDomain(String domain) { |
| | | this.domain = domain; |
| | | } |
| | | |
| | | public String getDomain() |
| | | { |
| | | public String getDomain() { |
| | | return domain; |
| | | } |
| | | |
| | | public void setIsMain(String isMain) |
| | | { |
| | | public void setIsMain(String isMain) { |
| | | this.isMain = isMain; |
| | | } |
| | | |
| | | public String getIsMain() |
| | | { |
| | | public String getIsMain() { |
| | | return isMain; |
| | | } |
| | | |
| | | public void setMaterialType(String materialType) |
| | | { |
| | | public void setMaterialType(String materialType) { |
| | | this.materialType = materialType; |
| | | } |
| | | |
| | | public String getMaterialType() |
| | | { |
| | | public String getMaterialType() { |
| | | return materialType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("factory", getFactory()) |
| | | .append("materialCode", getMaterialCode()) |
| | | .append("domain", getDomain()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("isMain", getIsMain()) |
| | | .append("materialType", getMaterialType()) |
| | | .toString(); |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("factory", getFactory()) |
| | | .append("materialCode", getMaterialCode()) |
| | | .append("domain", getDomain()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("isMain", getIsMain()) |
| | | .append("materialType", getMaterialType()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | @Schema(description = "资源组", type = "String") |
| | | @Excel(name = "资源组") |
| | | private String resourceGroupName; |
| | | /** 专业 */ |
| | | @Schema(description = "专业", type = "String") |
| | | @Excel(name = "专业") |
| | | private String major; |
| | | |
| | | /** 产能模型: 独占/合批 */ |
| | | @Schema(description = "产能模型", type = "String") |
| | |
| | | private String plantId; |
| | | |
| | | /** 工厂 */ |
| | | @Schema(description = "工厂", type = "String") |
| | | @Excel(name = "工厂") |
| | | @Schema(description = "适用工厂", type = "String") |
| | | @Excel(name = "适用工厂") |
| | | private String plant; |
| | | |
| | | /** 车间Id */ |
| | |
| | | private String workShopId; |
| | | |
| | | /** 车间 */ |
| | | @Schema(description = "车间", type = "String") |
| | | @Excel(name = "车间") |
| | | @Schema(description = "适用车间", type = "String") |
| | | @Excel(name = "适用车间") |
| | | private String workShop; |
| | | |
| | | /** 日历Id */ |
| | |
| | | // @Excel(name = "日历Id") |
| | | private Long workCalenderId; |
| | | |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | @Schema(description = "删除标志(0代表存在 2代表删除)", type = "String") |
| | | private String delFlag; |
| | | /** 日历描述 */ |
| | | @Schema(description = "日历描述", type = "String") |
| | | @Excel(name = "日历描述") |
| | | private String workCalender; |
| | | |
| | | /** 产能模型Id */ |
| | | @Schema(description = "产能模型Id", type = "Long") |
| | | // @Excel(name = "产能模型Id") |
| | | private Long modelId; |
| | | |
| | | /** 日历描述 */ |
| | | @Schema(description = "日历描述", type = "String") |
| | | @Excel(name = "日历描述") |
| | | private String workCalender; |
| | | |
| | | /** 专业 */ |
| | | @Schema(description = "专业", type = "String") |
| | | @Excel(name = "专业") |
| | | private String major; |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | @Schema(description = "删除标志(0代表存在 2代表删除)", type = "String") |
| | | private String delFlag; |
| | | |
| | | |
| | | |
| | | public String getMajor() { |
| | | return major; |
| | |
| | | /** 焊接形式(hup\lod) */ |
| | | @Excel(name = "焊接形式") |
| | | private String type; |
| | | |
| | | /** 适用工厂 */ |
| | | @Excel(name = "适用工厂") |
| | | private String plant; |
| | | |
| | | /** 是否删除(0否,1是) */ |
| | | private Integer delFlag; |
| | |
| | | package com.aps.core.mapper; |
| | | |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 管路手工气体预测数据Mapper接口 |
| | |
| | | public int deleteApsGasPipelinePredictionByIds(Long[] ids); |
| | | |
| | | void deleteAll(); |
| | | |
| | | @Select(""" |
| | | <script> |
| | | select id, factory || '##' || material_code || '##' || TO_CHAR(predict_date, 'yyyy-MM') as key |
| | | from aps_gas_pipeline_prediction |
| | | where 1 = 0 |
| | | <if test="!keys.isEmpty()">or factory || '##' || material_code || '##' || TO_CHAR(predict_date, 'yyyy-MM') in |
| | | <foreach collection="keys" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </script> |
| | | """) |
| | | List<Map<String, Object>> selectByFacOrMaterial(@NotNull Set<String> keys); |
| | | |
| | | } |
| | |
| | | |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 物料产品组数据管理Mapper接口 |
| | |
| | | public int deleteApsMaterialProductGroupManagementByIds(Long[] ids); |
| | | |
| | | void deleteAll(); |
| | | |
| | | |
| | | @Select(""" |
| | | <script> |
| | | select distinct factory || '##' || material_code from aps_material_product_group_management |
| | | where 1 = 0 |
| | | <if test="!keys.isEmpty()">or factory || '##' || material_code in |
| | | <foreach collection="keys" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </script> |
| | | """) |
| | | Set<String> selectByFacOrMaterial(@NotNull Set<String> keys); |
| | | } |
| | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.aps.core.mapper.ApsGasPipelinePredictionMapper; |
| | | import com.aps.core.service.IApsGasPipelinePredictionService; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import io.micrometer.common.util.StringUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 管路手工气体预测数据Service业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-19 |
| | | */ |
| | | @Service |
| | | public class ApsGasPipelinePredictionServiceImpl implements IApsGasPipelinePredictionService |
| | | { |
| | | public class ApsGasPipelinePredictionServiceImpl implements IApsGasPipelinePredictionService { |
| | | @Autowired |
| | | private ApsGasPipelinePredictionMapper apsGasPipelinePredictionMapper; |
| | | |
| | | /** |
| | | * 查询管路手工气体预测数据 |
| | | * |
| | | * |
| | | * @param id 管路手工气体预测数据主键 |
| | | * @return 管路手工气体预测数据 |
| | | */ |
| | | @Override |
| | | public ApsGasPipelinePrediction selectApsGasPipelinePredictionById(Long id) |
| | | { |
| | | public ApsGasPipelinePrediction selectApsGasPipelinePredictionById(Long id) { |
| | | return apsGasPipelinePredictionMapper.selectApsGasPipelinePredictionById(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询管路手工气体预测数据列表 |
| | | * |
| | | * |
| | | * @param apsGasPipelinePrediction 管路手工气体预测数据 |
| | | * @return 管路手工气体预测数据 |
| | | */ |
| | | @Override |
| | | public List<ApsGasPipelinePrediction> selectApsGasPipelinePredictionList(ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public List<ApsGasPipelinePrediction> selectApsGasPipelinePredictionList(ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | return apsGasPipelinePredictionMapper.selectApsGasPipelinePredictionList(apsGasPipelinePrediction); |
| | | } |
| | | |
| | | /** |
| | | * 新增管路手工气体预测数据 |
| | | * |
| | | * |
| | | * @param apsGasPipelinePrediction 管路手工气体预测数据 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public int insertApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | apsGasPipelinePrediction.setCreateTime(DateUtils.getNowDate()); |
| | | return apsGasPipelinePredictionMapper.insertApsGasPipelinePrediction(apsGasPipelinePrediction); |
| | | } |
| | | |
| | | /** |
| | | * 修改管路手工气体预测数据 |
| | | * |
| | | * |
| | | * @param apsGasPipelinePrediction 管路手工气体预测数据 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public int updateApsGasPipelinePrediction(ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | apsGasPipelinePrediction.setUpdateTime(DateUtils.getNowDate()); |
| | | return apsGasPipelinePredictionMapper.updateApsGasPipelinePrediction(apsGasPipelinePrediction); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除管路手工气体预测数据 |
| | | * |
| | | * |
| | | * @param ids 需要删除的管路手工气体预测数据主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteApsGasPipelinePredictionByIds(Long[] ids) |
| | | { |
| | | public int deleteApsGasPipelinePredictionByIds(Long[] ids) { |
| | | return apsGasPipelinePredictionMapper.deleteApsGasPipelinePredictionByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * 删除管路手工气体预测数据信息 |
| | | * |
| | | * |
| | | * @param id 管路手工气体预测数据主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteApsGasPipelinePredictionById(Long id) |
| | | { |
| | | public int deleteApsGasPipelinePredictionById(Long id) { |
| | | return apsGasPipelinePredictionMapper.deleteApsGasPipelinePredictionById(id); |
| | | } |
| | | |
| | |
| | | int rows = sheet.getLastRowNum(); |
| | | if (rows > 0) { |
| | | List<ApsGasPipelinePrediction> list = new ArrayList<>(); |
| | | |
| | | Set<String> keys = new HashSet<>(); |
| | | /*数据列从1开始*/ |
| | | for (int i = 1; i <= rows; i++) { |
| | | for (int i = rows; i > 0; --i) { |
| | | Row row = sheet.getRow(i); |
| | | if (row.getCell(0) == null){ |
| | | if (row.getCell(0) == null) { |
| | | continue; |
| | | } |
| | | |
| | | String materialCode = row.getCell(0).getStringCellValue(); |
| | | if (StringUtils.isEmpty(materialCode)){ |
| | | if (StringUtils.isEmpty(materialCode)) { |
| | | continue; |
| | | } |
| | | String factory = row.getCell(1).getStringCellValue(); |
| | |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | item.setPredictQuantity(new BigDecimal(quantity)); |
| | | item.setPredictDate(new Timestamp(date.getTime())); |
| | | list.add(item); |
| | | if (!keys.contains(item.getKey())) { |
| | | keys.add(item.getKey()); |
| | | list.add(item); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | apsGasPipelinePredictionMapper.deleteAll(); |
| | | apsGasPipelinePredictionMapper.insert(list); |
| | | List<Map<String, Object>> facCodeKey = apsGasPipelinePredictionMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsGasPipelinePrediction> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsGasPipelinePrediction item = it.next(); |
| | | long count = facCodeKey.stream() |
| | | .filter(map -> map.get("key").equals(item.getKey())) |
| | | .peek(row -> { |
| | | item.setId((Long) row.get("id")); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsGasPipelinePredictionMapper.updateById(item); |
| | | }).count(); |
| | | if (count > 0){ |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | apsGasPipelinePredictionMapper.insert(list); |
| | | } |
| | | } |
| | | return list.size(); |
| | | } |
| | |
| | | } |
| | | ApsGasPipingRouteStat queryStatParam = new ApsGasPipingRouteStat(); |
| | | BeanUtils.copyProperties(apsGasPipingRouteStat,queryStatParam); |
| | | queryStatParam.setMajor(""); |
| | | queryStatParam.setMajor(apsGasPipingRouteStat.getMajor()); |
| | | queryStatParam.setPlant(apsGasPipingRouteStat.getPlant()); |
| | | apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(queryStatParam); |
| | | //根据开工日进行升序排序 |
| | | apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay())); |
| | |
| | | String dateKey = apsResourceDateStat.getPlanDay().toString(); |
| | | if(dayMap.containsKey(dateKey)){ |
| | | ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(dateKey); |
| | | String capacityKey = processName + "-" + dateKey.substring(0,7); |
| | | String capacityKey = processName + "-"+ apsResourceDateStat.getPlant() + "-" + dateKey.substring(0,7); |
| | | apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(capacityKey)!=null?apsGasPipingPlanMap.get(capacityKey).getDayProduceAllNum():new BigDecimal(0)); |
| | | apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes().add(apsResourceDateStat.getRequireTimes())); |
| | | if(apsResourceDateStatTemp.getDesignTimes().compareTo(BigDecimal.ZERO) > 0){ |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.aps.core.mapper.ApsMaterialProductGroupManagementMapper; |
| | | import com.aps.core.service.IApsMaterialProductGroupManagementService; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import io.micrometer.common.util.StringUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | |
| | | List<ApsMaterialProductGroupManagement> list = new ArrayList<>(); |
| | | |
| | | /*数据列从1开始*/ |
| | | for (int i = 1; i <= rows; i++) { |
| | | Set<String> keys = new HashSet<>(); |
| | | for (int i = rows; i > 0; --i) { |
| | | Row row = sheet.getRow(i); |
| | | if (row.getCell(0) == null) { |
| | | continue; |
| | |
| | | item.setIsMain(isMain); |
| | | item.setCreateBy(SecurityUtils.getUsername()); |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | list.add(item); |
| | | if (!keys.contains(item.getKey())) { |
| | | keys.add(item.getKey()); |
| | | list.add(item); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | apsMaterialProductGroupManagementMapper.insert(list); |
| | | Set<String> facCodeKey = apsMaterialProductGroupManagementMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsMaterialProductGroupManagement> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsMaterialProductGroupManagement item = it.next(); |
| | | if (facCodeKey.contains(item.getKey())) { |
| | | LambdaUpdateWrapper<ApsMaterialProductGroupManagement> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getFactory, item.getFactory()); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getMaterialCode, item.getMaterialCode()); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsMaterialProductGroupManagementMapper.update(item, wrapper); |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!list.isEmpty()) { |
| | | apsMaterialProductGroupManagementMapper.insert(list); |
| | | } |
| | | } |
| | | return list.size(); |
| | | } |
| | |
| | | |
| | | /** |
| | | * @author zhl |
| | | * @description 针对表【aps_plate_require_date(工单计划需求日期表)】的数据库操作Service实现 |
| | | * @createDate 2025-05-19 16:51:36 |
| | | * @description 针对表【aps_plate_require_date(工单计划需求日期表)】的数据库操作Service实现 |
| | | * @createDate 2025-05-19 16:51:36 |
| | | */ |
| | | @Service |
| | | public class ApsPlateRequireDateServiceImpl extends ServiceImpl<ApsPlateRequireDateMapper, ApsPlateRequireDate> |
| | |
| | | //TODO: 根据idList批量删除 |
| | | LambdaUpdateWrapper<ApsPlateRequireDate> queryWrapper = new LambdaUpdateWrapper<>(); |
| | | queryWrapper.in(ApsPlateRequireDate::getId, idList); |
| | | queryWrapper.set(ApsPlateRequireDate::getDelFlag, 0); |
| | | queryWrapper.set(ApsPlateRequireDate::getDelFlag, 1); |
| | | return apsPlateRequireDateMapper.update(queryWrapper); |
| | | } |
| | | |
| | |
| | | <if test="planEnd != null and planEnd != ''"> and plan_end = #{planEnd}</if> |
| | | <if test="quantity != null and quantity != ''"> and quantity = #{quantity}</if> |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | <select id="selectApsGasPipelineMoById" parameterType="Long" resultMap="ApsGasPipelineMoResult"> |
| | |
| | | <if test="predictDate != null and predictDate != ''"> and predict_date = #{predictDate}</if> |
| | | <if test="predictQuantity != null and predictQuantity != ''"> and predict_quantity = #{predictQuantity}</if> |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | <select id="selectApsGasPipelinePredictionById" parameterType="Long" resultMap="ApsGasPipelinePredictionResult"> |
| | |
| | | and process_name in (select process_name from aps_standard_process where major='气柜') |
| | | </if> |
| | | </if> |
| | | <if test="plant != null and plant != ''"> and plant = #{plant} </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | id,work_order_no, road_process_number, current_process_number, production_quantity, standard_time, |
| | | process_total_time, process_plan_start_day, design_times, del_flag, create_by, process_name, |
| | | create_time, item_number, standard_dosage, process_total_dosage, design_capacity, major, |
| | | plan_start_year, plan_start_month, plan_start_day,batch_number,process_plan_end_day,warning,order_plan_end_day |
| | | plan_start_year, plan_start_month, plan_start_day,batch_number,process_plan_end_day,warning,order_plan_end_day,plant |
| | | ) |
| | | VALUES |
| | | <foreach collection="apsGasPipingRouteStatList" item="stat" separator=","> |
| | |
| | | #{stat.standardTime}, #{stat.processTotalTime}, #{stat.processPlanStartDay}, #{stat.designTimes}, #{stat.delFlag}, |
| | | #{stat.createBy}, #{stat.processName}, #{stat.createTime}, #{stat.itemNumber}, #{stat.standardDosage}, |
| | | #{stat.processTotalDosage}, #{stat.designCapacity}, #{stat.major}, #{stat.planStartYear}, |
| | | #{stat.planStartMonth}, #{stat.planStartDay}, #{stat.batchNumber}, #{stat.processPlanEndDay},#{stat.warning},#{stat.orderPlanEndDay} |
| | | #{stat.planStartMonth}, #{stat.planStartDay}, #{stat.batchNumber}, #{stat.processPlanEndDay},#{stat.warning},#{stat.orderPlanEndDay},#{stat.plant} |
| | | ) |
| | | </foreach> |
| | | |
| | |
| | | |
| | | <select id="queryTempStat" resultMap="ApsGasPipingRouteStatResult" > |
| | | select row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num, |
| | | rt.work_order_no, |
| | | rt.work_order_no, |
| | | rt.process_name, |
| | | cast(rt.process_number as numeric(18, 2)) as road_process_number, |
| | | cast(rt.process_number as numeric(18, 2)) as route_process_number, |
| | |
| | | rt.process_plan_start_day, |
| | | rt.process_plan_end_day, |
| | | pl.plan_end_day as order_plan_end_day, |
| | | rt.item_no as item_number, |
| | | pl.plan_type as major, |
| | | false as warning |
| | | rt.item_no as item_number, |
| | | pl.plan_type as major, |
| | | false as warning, |
| | | pl.plant |
| | | from aps_gas_piping_plan as pl |
| | | left join aps_process_route as rt on pl.document_number = rt.work_order_no |
| | | where pl.document_number is not null and rt.work_order_no is not null and pl.plan_end_day is not null |
| | |
| | | <if test="isMain != null and isMain != ''"> and is_main = #{isMain}</if> |
| | | <if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if> |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | <select id="selectApsMaterialProductGroupManagementById" parameterType="Long" resultMap="ApsMaterialProductGroupManagementResult"> |
| | |
| | | <result property="hupQty" column="hup_qty" /> |
| | | <result property="lodQty" column="lod_qty" /> |
| | | <result property="type" column="type" /> |
| | | <result property="plant" column="plant" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsWeldSeamStandardVo"> |
| | | select id, item_code, item_figure, item_figure_version, hup_qty, lod_qty, type, del_flag from aps_weld_seam_standard |
| | | select id, item_code, item_figure, item_figure_version, hup_qty, lod_qty, type, plant, del_flag from aps_weld_seam_standard |
| | | </sql> |
| | | |
| | | <select id="selectApsWeldSeamStandardList" parameterType="com.aps.core.domain.ApsWeldSeamStandard" resultMap="ApsWeldSeamStandardResult"> |
| | |
| | | <if test="hupQty != null "> and hup_qty = #{hupQty}</if> |
| | | <if test="lodQty != null "> and lod_qty = #{lodQty}</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="plant != null and plant != ''"> and plant = #{plant}</if> |
| | | and del_flag = 0 |
| | | </where> |
| | | </select> |
| | |
| | | mgm.domain as 专业 |
| | | FROM aps_gas_pipeline_mo mo |
| | | LEFT JOIN aps_weld_seam_standard ws ON mo.material_code = ws.item_code AND ws.del_flag = 0 |
| | | LEFT JOIN aps_material_product_group_management mgm ON mo.material_code = mgm.material_code |
| | | LEFT JOIN aps_material_product_group_management mgm ON mo.material_code = mgm.material_code AND mo.factory = mgm.factory |
| | | ), |
| | | 预测焊缝计算 AS ( |
| | | -- 计算预测的焊缝数量 |
| | |
| | | mgm.domain as 专业 |
| | | FROM aps_gas_pipeline_prediction gp |
| | | LEFT JOIN aps_weld_seam_standard ws ON gp.material_code = ws.item_code AND ws.del_flag = 0 |
| | | LEFT JOIN aps_material_product_group_management mgm ON gp.material_code = mgm.material_code |
| | | LEFT JOIN aps_material_product_group_management mgm ON gp.material_code = mgm.material_code AND gp.factory = mgm.factory |
| | | ), |
| | | 汇总数据 AS ( |
| | | SELECT |