【UPDATE】1.新增同步标准工艺路线定时任务代码 2.从redis中获取BOM数据 3.将工艺路线数据存入redis中 4.从redis中获取工艺路线数据
| | |
| | | @PostMapping("/job/refreshBomData") |
| | | R<Boolean> refreshBomData(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | /** |
| | | * å·æ°å·¥èºè·¯çº¿å
¨éæ°æ® |
| | | * @param source |
| | | * @return |
| | | */ |
| | | @PostMapping("/job/refreshProcessRouteData") |
| | | R<Boolean> refreshProcessRouteData(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | } |
| | |
| | | @Override |
| | | public RemoteJobService create(Throwable throwable) |
| | | { |
| | | |
| | | log.error("任塿å¡è°ç¨å¤±è´¥:{}", throwable.getMessage()); |
| | | return source -> R.fail("å·æ°BOMæ°æ®å¤±è´¥:" + throwable.getMessage()); |
| | | return new RemoteJobService() |
| | | { |
| | | @Override |
| | | public R<Boolean> refreshBomData(String source) |
| | | { |
| | | return R.fail("å·æ°å
¨éBOMæ°æ®å¤±è´¥:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Boolean> refreshProcessRouteData(String source) |
| | | { |
| | | return R.fail("å·æ°å
¨éå·¥èºè·¯çº¿æ°æ®å¤±è´¥:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @RequiresPermissions("Aps:ApsBomHeader:refreshBomData") |
| | | @PostMapping("/refreshBomData") |
| | | public void refreshBomData() |
| | | public AjaxResult refreshBomData() |
| | | { |
| | | R<Boolean> res = remoteJobService.refreshBomData(SecurityConstants.INNER); |
| | | if (R.isSuccess(res)) |
| | | { |
| | | apsBomHeaderService.setBomDataToRedis(""); |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | @PostMapping("/setBomDataToRedis") |
| | |
| | | package com.aps.core.controller.mainPlan; |
| | | |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.domain.R; |
| | | 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.security.annotation.RequiresPermissions; |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | import com.aps.core.service.IApsStandardProcessRouteHeaderService; |
| | | import com.aps.system.api.RemoteJobService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | { |
| | | @Autowired |
| | | private IApsStandardProcessRouteHeaderService apsStandardProcessRouteHeaderService; |
| | | |
| | | @Autowired |
| | | private RemoteJobService remoteJobService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Headerå表 |
| | |
| | | { |
| | | return toAjax(apsStandardProcessRouteHeaderService.deleteApsStandardProcessRouteHeaderByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°å
¨éå·¥èºè·¯çº¿æ°æ® |
| | | */ |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:refreshProcessRouteData") |
| | | @PostMapping("/refreshProcessRouteData") |
| | | public AjaxResult refreshProcessRouteData() |
| | | { |
| | | R<Boolean> res = remoteJobService.refreshProcessRouteData(SecurityConstants.INNER); |
| | | if (R.isSuccess(res)) |
| | | { |
| | | return success(); |
| | | } |
| | | return error(); |
| | | } |
| | | |
| | | @PostMapping("/test") |
| | | public void test() |
| | | { |
| | | apsStandardProcessRouteHeaderService.setProcessRouteDataToRedis("FORTUNA"); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.*; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | private String mainitemcode; |
| | | private BigDecimal mainstock; |
| | | private String subitemcode; |
| | | private BigDecimal usagenum; |
| | | private BigDecimal substock; |
| | | private String selfmade; |
| | | |
| | | } |
| | |
| | | package com.aps.core.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderMapperæ¥å£ |
| | |
| | | * æ ¹æ®å·¥åãç©æå·æ¥è¯¢å·¥èºè·¯çº¿ |
| | | * */ |
| | | List<ApsStandardProcessRouteHeader> queryStandardProcessRouteHeaderByPlantAndItemCode(String orgCode, String itemCode); |
| | | |
| | | /** |
| | | * æ¥è¯¢å·¥èºè·¯çº¿æ åå·¥æ¶æ°æ® |
| | | * @param orgCode |
| | | * @return |
| | | */ |
| | | List<JSONObject> selectProcessRouteStandardTimeData(String orgCode); |
| | | |
| | | } |
| | |
| | | package com.aps.core.service; |
| | | |
| | | import java.util.List; |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderServiceæ¥å£ |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteHeaderById(Long id); |
| | | |
| | | /** |
| | | * å°æ åå·¥èºè·¯çº¿æ åå·¥æ¶å计æ°éæ¾å
¥redisä¸ |
| | | * @param orgCode |
| | | * @return |
| | | */ |
| | | public boolean setProcessRouteDataToRedis(String orgCode); |
| | | } |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import java.util.*; |
| | | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.core.domain.ApsBom; |
| | | import com.aps.core.domain.ApsBomHeader; |
| | | import com.aps.core.mapper.ApsBomHeaderMapper; |
| | | import com.aps.core.mapper.ApsBomMapper; |
| | | import com.aps.core.service.IApsBomService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsBomMapper; |
| | | import com.aps.core.domain.ApsBom; |
| | | import com.aps.core.service.IApsBomService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | | * BOMæ°æ®ç®¡çServiceä¸å¡å±å¤ç |
| | |
| | | |
| | | @Resource |
| | | private ApsBomHeaderMapper bomHeaderMapper; |
| | | |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢BOMæ°æ®ç®¡ç |
| | | * |
| | |
| | | build.setOrgCode(apsBomHeader.getOrgCode()); |
| | | bomLineList = apsBomMapper.selectApsBomList(build); |
| | | } |
| | | // JSONArray jsonArray = (JSONArray)redisTemplate.opsForValue().get("BOM:BOM_"+plant+"_"+itemNumber); |
| | | // for (int i = 0; i < jsonArray.size(); i++){ |
| | | // ApsBom apsBom = jsonArray.getJSONObject(i).to(ApsBom.class); |
| | | // bomLineList.add(apsBom); |
| | | // } |
| | | return bomLineList; |
| | | } |
| | | } |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import java.util.List; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsStandardProcessRouteHeaderMapper; |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | import com.aps.core.mapper.ApsStandardProcessRouteHeaderMapper; |
| | | import com.aps.core.service.IApsStandardProcessRouteHeaderService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderServiceä¸å¡å±å¤ç |
| | |
| | | { |
| | | @Autowired |
| | | private ApsStandardProcessRouteHeaderMapper apsStandardProcessRouteHeaderMapper; |
| | | |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Header |
| | |
| | | { |
| | | return apsStandardProcessRouteHeaderMapper.deleteApsStandardProcessRouteHeaderById(id); |
| | | } |
| | | |
| | | @Override |
| | | public boolean setProcessRouteDataToRedis(String orgCode) { |
| | | try { |
| | | List<JSONObject> res = apsStandardProcessRouteHeaderMapper.selectProcessRouteStandardTimeData(orgCode); |
| | | for (JSONObject jsonObject : res) { |
| | | redisTemplate.opsForValue().set("ROUTE:ROUTE_"+jsonObject.getString("org_code")+"_"+jsonObject.getString("item_code"), jsonObject.getBigDecimal("standardtime")); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | and del_flag = '0' |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectProcessRouteStandardTimeData" parameterType="String" resultType="com.alibaba.fastjson2.JSONObject"> |
| | | select hd.item_code,sum(standard_time) as standardTime,hd.org_code |
| | | from aps_standard_process_route_line as ln |
| | | left join aps_standard_process_route_header as hd on ln.route_id=hd.route_id |
| | | where ln.del_flag='0' and hd.del_flag='0' |
| | | <if test="orgCode != null and orgCode != ''"> |
| | | and hd.org_code = #{orgCode} |
| | | </if> |
| | | group by hd.item_code,hd.org_code |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.aps.job.controller; |
| | | |
| | | import com.aps.common.core.constant.Constants; |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.exception.job.TaskException; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | private IApsMaterialStorageManagementJobService apsMaterialStorageManagementJobService; |
| | | |
| | | @Autowired |
| | | private IApsStandardProcessRouteHeaderJobService apsStandardProcessRouteHeaderJobService; |
| | | |
| | | @Autowired |
| | | private RemoteCoreService remoteCoreService; |
| | | |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡å表 |
| | | */ |
| | |
| | | return apsBomHeaderJobService.syncBomDataJob(1, 1000, "", ""); |
| | | } |
| | | |
| | | @PostMapping("/refreshProcessRouteData") |
| | | public Boolean refreshProcessRouteData() throws SchedulerException, TaskException |
| | | { |
| | | return apsStandardProcessRouteHeaderJobService.syncProcessRouteDataJob(1, 1000, "", ""); |
| | | } |
| | | |
| | | @PutMapping("/test") |
| | | public void test(@RequestBody SysJob job) throws Exception |
| | | { |
| | | System.out.println("start"); |
| | | apsStandardProcessRouteHeaderJobService.syncProcessRouteData(159, 1000, "", ""); |
| | | //è·åRedisç¼åä¸çBOMæ°æ® |
| | | // JSONArray jsonArray = (JSONArray)redisTemplate.opsForValue().get("BOM:BOM_FORTUNA_A6501-001080"); |
| | | //å°BOMæ°æ®åè¿Redisä¸ |
| | | remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | // remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | //åæ¥ç©æåºåæ°æ® |
| | | // apsMaterialStorageManagementJobService.syncApsMaterialStorageData(1, 1000, "", ""); |
| | | //忥BOMæ°æ® |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.domain; |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿Header对象 aps_standard_process_route_header_job |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Schema(description = "æ åå·¥èºè·¯çº¿Headerå®ä½ç±»") |
| | | public class ApsStandardProcessRouteHeaderJob extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | @Schema(description = "$column.columnComment") |
| | | private Long id; |
| | | |
| | | /** å·¥èºè·¯çº¿ID */ |
| | | @Excel(name = "å·¥èºè·¯çº¿ID") |
| | | @Schema(description = "å·¥èºè·¯çº¿ID") |
| | | private String routeId; |
| | | |
| | | /** å·¥èºè·¯çº¿çæ¬ */ |
| | | @Excel(name = "å·¥èºè·¯çº¿çæ¬") |
| | | @Schema(description = "å·¥èºè·¯çº¿çæ¬") |
| | | private String version; |
| | | |
| | | /** çææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "çææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "çææ¥æ") |
| | | private Date startDate; |
| | | |
| | | /** å¤±ææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¤±ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | private Date endDate; |
| | | |
| | | /** éç¨å·¥å */ |
| | | @Excel(name = "éç¨å·¥å") |
| | | @Schema(description = "éç¨å·¥å") |
| | | private String orgCode; |
| | | |
| | | /** æ¯å¦å é¤ï¼0ææ 1å é¤ */ |
| | | @Schema(description = "æ¯å¦å é¤ï¼0ææ 1å é¤") |
| | | private String delFlag; |
| | | |
| | | /** ç©æå· */ |
| | | @Excel(name = "ç©æå·") |
| | | @Schema(description = "ç©æå·") |
| | | private String itemCode; |
| | | |
| | | /** å¾å· */ |
| | | @Excel(name = "å¾å·") |
| | | @Schema(description = "å¾å·") |
| | | private String drawingNumber; |
| | | |
| | | /** å·¥åºæ»å·¥æ¶ */ |
| | | @Excel(name = "å·¥åºæ»å·¥æ¶") |
| | | @Schema(description = "å·¥åºæ»å·¥æ¶") |
| | | private BigDecimal processAllTime; |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setRouteId(String routeId) |
| | | { |
| | | this.routeId = routeId; |
| | | } |
| | | |
| | | public String getRouteId() |
| | | { |
| | | return routeId; |
| | | } |
| | | |
| | | public void setVersion(String version) |
| | | { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getVersion() |
| | | { |
| | | return version; |
| | | } |
| | | |
| | | public void setStartDate(Date startDate) |
| | | { |
| | | this.startDate = startDate; |
| | | } |
| | | |
| | | public Date getStartDate() |
| | | { |
| | | return startDate; |
| | | } |
| | | |
| | | public void setEndDate(Date endDate) |
| | | { |
| | | this.endDate = endDate; |
| | | } |
| | | |
| | | public Date getEndDate() |
| | | { |
| | | return endDate; |
| | | } |
| | | |
| | | public void setOrgCode(String orgCode) |
| | | { |
| | | this.orgCode = orgCode; |
| | | } |
| | | |
| | | public String getOrgCode() |
| | | { |
| | | return orgCode; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setItemCode(String itemCode) |
| | | { |
| | | this.itemCode = itemCode; |
| | | } |
| | | |
| | | public String getItemCode() |
| | | { |
| | | return itemCode; |
| | | } |
| | | |
| | | public void setDrawingNumber(String drawingNumber) |
| | | { |
| | | this.drawingNumber = drawingNumber; |
| | | } |
| | | |
| | | public String getDrawingNumber() |
| | | { |
| | | return drawingNumber; |
| | | } |
| | | |
| | | public void setProcessAllTime(BigDecimal processAllTime) |
| | | { |
| | | this.processAllTime = processAllTime; |
| | | } |
| | | |
| | | public BigDecimal getProcessAllTime() |
| | | { |
| | | return processAllTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("routeId", getRouteId()) |
| | | .append("version", getVersion()) |
| | | .append("startDate", getStartDate()) |
| | | .append("endDate", getEndDate()) |
| | | .append("orgCode", getOrgCode()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("itemCode", getItemCode()) |
| | | .append("drawingNumber", getDrawingNumber()) |
| | | .append("processAllTime", getProcessAllTime()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.domain; |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿Line对象 aps_standard_process_route_line_job |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Schema(description = "æ åå·¥èºè·¯çº¿Lineå®ä½ç±»") |
| | | public class ApsStandardProcessRouteLineJob extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | @Schema(description = "$column.columnComment") |
| | | private Long id; |
| | | |
| | | /** å·¥èºè·¯çº¿ID */ |
| | | @Excel(name = "å·¥èºè·¯çº¿ID") |
| | | @Schema(description = "å·¥èºè·¯çº¿ID") |
| | | private String routeId; |
| | | |
| | | /** å·¥åºåºå· */ |
| | | @Excel(name = "å·¥åºåºå·") |
| | | @Schema(description = "å·¥åºåºå·") |
| | | private String routeNum; |
| | | |
| | | /** å·¥åºåç§° */ |
| | | @Excel(name = "å·¥åºåç§°") |
| | | @Schema(description = "å·¥åºåç§°") |
| | | private String routeName; |
| | | |
| | | /** çææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "çææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "çææ¥æ") |
| | | private Date startDate; |
| | | |
| | | /** å¤±ææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¤±ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | private Date endDate; |
| | | |
| | | /** éç¨å·¥å */ |
| | | @Excel(name = "éç¨å·¥å") |
| | | @Schema(description = "éç¨å·¥å") |
| | | private String orgCode; |
| | | |
| | | /** éç¨è½¦é´ */ |
| | | @Excel(name = "éç¨è½¦é´") |
| | | @Schema(description = "éç¨è½¦é´") |
| | | private String shopCode; |
| | | |
| | | /** äº§è½æ¨¡å */ |
| | | @Excel(name = "äº§è½æ¨¡å") |
| | | @Schema(description = "äº§è½æ¨¡å") |
| | | private String productivityModel; |
| | | |
| | | /** è®¾è®¡äº§è½ */ |
| | | @Excel(name = "设计产è½") |
| | | @Schema(description = "设计产è½") |
| | | private BigDecimal designCapacity; |
| | | |
| | | /** æ¯å¦å é¤ï¼0ææ 1å é¤ */ |
| | | @Schema(description = "æ¯å¦å é¤ï¼0ææ 1å é¤") |
| | | private String delFlag; |
| | | |
| | | /** å·¥åºç¼ç */ |
| | | @Excel(name = "å·¥åºç¼ç ") |
| | | @Schema(description = "å·¥åºç¼ç ") |
| | | private String routeCode; |
| | | |
| | | /** æ åå·¥æ¶ */ |
| | | @Excel(name = "æ åå·¥æ¶") |
| | | @Schema(description = "æ åå·¥æ¶") |
| | | private BigDecimal standardTime; |
| | | |
| | | public String getRouteCode() { |
| | | return routeCode; |
| | | } |
| | | |
| | | public void setRouteCode(String routeCode) { |
| | | this.routeCode = routeCode; |
| | | } |
| | | |
| | | public BigDecimal getStandardTime() { |
| | | return standardTime; |
| | | } |
| | | |
| | | public void setStandardTime(BigDecimal standardTime) { |
| | | this.standardTime = standardTime; |
| | | } |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setRouteId(String routeId) |
| | | { |
| | | this.routeId = routeId; |
| | | } |
| | | |
| | | public String getRouteId() |
| | | { |
| | | return routeId; |
| | | } |
| | | |
| | | public void setRouteNum(String routeNum) |
| | | { |
| | | this.routeNum = routeNum; |
| | | } |
| | | |
| | | public String getRouteNum() |
| | | { |
| | | return routeNum; |
| | | } |
| | | |
| | | public void setRouteName(String routeName) |
| | | { |
| | | this.routeName = routeName; |
| | | } |
| | | |
| | | public String getRouteName() |
| | | { |
| | | return routeName; |
| | | } |
| | | |
| | | public void setStartDate(Date startDate) |
| | | { |
| | | this.startDate = startDate; |
| | | } |
| | | |
| | | public Date getStartDate() |
| | | { |
| | | return startDate; |
| | | } |
| | | |
| | | public void setEndDate(Date endDate) |
| | | { |
| | | this.endDate = endDate; |
| | | } |
| | | |
| | | public Date getEndDate() |
| | | { |
| | | return endDate; |
| | | } |
| | | |
| | | public void setOrgCode(String orgCode) |
| | | { |
| | | this.orgCode = orgCode; |
| | | } |
| | | |
| | | public String getOrgCode() |
| | | { |
| | | return orgCode; |
| | | } |
| | | |
| | | public void setShopCode(String shopCode) |
| | | { |
| | | this.shopCode = shopCode; |
| | | } |
| | | |
| | | public String getShopCode() |
| | | { |
| | | return shopCode; |
| | | } |
| | | |
| | | public void setProductivityModel(String productivityModel) |
| | | { |
| | | this.productivityModel = productivityModel; |
| | | } |
| | | |
| | | public String getProductivityModel() |
| | | { |
| | | return productivityModel; |
| | | } |
| | | |
| | | public void setDesignCapacity(BigDecimal designCapacity) |
| | | { |
| | | this.designCapacity = designCapacity; |
| | | } |
| | | |
| | | public BigDecimal getDesignCapacity() |
| | | { |
| | | return designCapacity; |
| | | } |
| | | |
| | | 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("routeId", getRouteId()) |
| | | .append("routeNum", getRouteNum()) |
| | | .append("routeName", getRouteName()) |
| | | .append("startDate", getStartDate()) |
| | | .append("endDate", getEndDate()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("orgCode", getOrgCode()) |
| | | .append("shopCode", getShopCode()) |
| | | .append("productivityModel", getProductivityModel()) |
| | | .append("designCapacity", getDesignCapacity()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsStandardProcessRouteHeaderJob; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderMapperæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | public interface ApsStandardProcessRouteHeaderJobMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | public ApsStandardProcessRouteHeaderJob selectApsStandardProcessRouteHeaderJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Headerå表 |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return æ åå·¥èºè·¯çº¿Headeréå |
| | | */ |
| | | public List<ApsStandardProcessRouteHeaderJob> selectApsStandardProcessRouteHeaderJobList(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteHeaderJobById(Long id); |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteHeaderJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * æ¹éæå
¥å·¥èºè·¯çº¿ Headeræ°æ® |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public int insertProcessRouteHeaderBatch(@Param("list") List<ApsStandardProcessRouteHeaderJob> list); |
| | | |
| | | /** |
| | | * æ¹éæå
¥å·¥èºè·¯çº¿ Headeræ°æ®å°ä¸å¡è¡¨ |
| | | * @return |
| | | */ |
| | | public void insertIntoProcessRouteHeader(); |
| | | |
| | | /** |
| | | * å é¤å·¥èºè·¯çº¿ Headeræ°æ® |
| | | * @return |
| | | */ |
| | | public void deleteProcessRouteHeader(); |
| | | |
| | | /** |
| | | * å é¤ä¸é´è¡¨å·¥èºè·¯çº¿ Headeræ°æ® |
| | | */ |
| | | public void deleteProcessRouteHeaderJob(); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsStandardProcessRouteLineJob; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿LineMapperæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | public interface ApsStandardProcessRouteLineJobMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | public ApsStandardProcessRouteLineJob selectApsStandardProcessRouteLineJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Lineå表 |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return æ åå·¥èºè·¯çº¿Lineéå |
| | | */ |
| | | public List<ApsStandardProcessRouteLineJob> selectApsStandardProcessRouteLineJobList(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteLineJobById(Long id); |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteLineJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * æ¹éæå
¥å·¥èºè·¯çº¿ Lineæ°æ®ç®¡ç |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public int insertProcessRouteLineBatch(@Param("list") List<ApsStandardProcessRouteLineJob> list); |
| | | |
| | | /** |
| | | * æ¹éæå
¥å·¥èºè·¯çº¿ Lineæ°æ®ç®¡çå°ä¸å¡è¡¨ |
| | | * @return |
| | | */ |
| | | public void insertIntoProcessRouteLine(); |
| | | |
| | | /** |
| | | * å é¤å·¥èºè·¯çº¿ Lineæ°æ® |
| | | */ |
| | | public void deleteProcessRouteLine() ; |
| | | |
| | | /** |
| | | * å é¤ä¸é´è¡¨å·¥èºè·¯çº¿ Lineæ°æ® |
| | | */ |
| | | public void deleteProcessRouteLineJob() ; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service; |
| | | |
| | | import com.aps.job.domain.ApsStandardProcessRouteHeaderJob; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderServiceæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | public interface IApsStandardProcessRouteHeaderJobService |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | public ApsStandardProcessRouteHeaderJob selectApsStandardProcessRouteHeaderJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Headerå表 |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return æ åå·¥èºè·¯çº¿Headeréå |
| | | */ |
| | | public List<ApsStandardProcessRouteHeaderJob> selectApsStandardProcessRouteHeaderJobList(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob); |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param ids éè¦å é¤çæ åå·¥èºè·¯çº¿Header主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteHeaderJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Headerä¿¡æ¯ |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteHeaderJobById(Long id); |
| | | |
| | | /** |
| | | * 忥工èºè·¯çº¿æ°æ® |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | public boolean syncProcessRouteData(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList); |
| | | |
| | | |
| | | /** |
| | | * 忥工èºè·¯çº¿æ°æ®å®æ¶ä»»å¡ |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | public boolean syncProcessRouteDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service; |
| | | |
| | | import com.aps.job.domain.ApsStandardProcessRouteLineJob; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿LineServiceæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | public interface IApsStandardProcessRouteLineJobService |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | public ApsStandardProcessRouteLineJob selectApsStandardProcessRouteLineJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Lineå表 |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return æ åå·¥èºè·¯çº¿Lineéå |
| | | */ |
| | | public List<ApsStandardProcessRouteLineJob> selectApsStandardProcessRouteLineJobList(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob); |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param ids éè¦å é¤çæ åå·¥èºè·¯çº¿Line主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteLineJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Lineä¿¡æ¯ |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsStandardProcessRouteLineJobById(Long id); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.job.domain.ApsBomHeaderJob; |
| | | import com.aps.job.domain.ApsBomLineJob; |
| | | import com.aps.job.domain.ApsWorkOrderJobLog; |
| | |
| | | |
| | | @Override |
| | | public boolean syncBomData(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) { |
| | | JSONObject requestBody = new JSONObject(); |
| | | ResponseEntity<String> response = null; |
| | | ApsWorkOrderJobLog jobLog = new ApsWorkOrderJobLog(); |
| | | String batchNum = ""; |
| | | try { |
| | | // 设置请æ±å¤´ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | // 设置请æ±ä½ |
| | | while (true) { |
| | | ApsWorkOrderJobLog jobLog = new ApsWorkOrderJobLog(); |
| | | JSONObject requestBody = new JSONObject(); |
| | | batchNum = IdUtils.fastSimpleUUID(); |
| | | jobLog = new ApsWorkOrderJobLog(); |
| | | requestBody = new JSONObject(); |
| | | requestBody.put("PageIndex", pageIndex); |
| | | requestBody.put("PageSize", pageSize); |
| | | if(!StringUtils.isEmpty(orgCode)){ |
| | |
| | | // å建HttpEntity对象 |
| | | HttpEntity<String> request = new HttpEntity<>(requestBody.toJSONString(), headers); |
| | | // åéPOSTè¯·æ± |
| | | ResponseEntity<String> response = restTemplate.postForEntity(getBomUrl, request, String.class); |
| | | response = restTemplate.postForEntity(getBomUrl, request, String.class); |
| | | JSONObject responseBodyJson = JSONObject.parseObject(response.getBody()); |
| | | if (response.getStatusCode().is2xxSuccessful() && "200".equals(responseBodyJson.getString("status"))) { |
| | | JSONArray jsonArray = responseBodyJson.getJSONArray("data"); |
| | |
| | | insertBomHeader.setStartDate(DateUtils.parseDate(bomHeader.getString("HEffectiveDate"))); |
| | | insertBomHeader.setEndDate(DateUtils.parseDate(bomHeader.getString("HDisableDate"))); |
| | | insertBomHeader.setOrgCode(bomHeader.getString("HOrgName").contains("æ²é³")?"FORTUNE":bomHeader.getString("HOrgName").contains("åé")?"FORTUNA":bomHeader.getString("HOrgName").contains("å京")?"FORTUBE":bomHeader.getString("HOrgName")); |
| | | insertBomHeader.setCreateBy(batchNum); |
| | | headerList.add(insertBomHeader); |
| | | for(Object line : bomLines){ |
| | | JSONObject lineJson = (JSONObject) line; |
| | |
| | | bomLine.setStartDate(DateUtils.parseDate(lineJson.getString("LEffectiveDate"))); |
| | | bomLine.setEndDate(DateUtils.parseDate(lineJson.getString("LDisableDate"))); |
| | | bomLine.setOrgCode(lineJson.getString("LOrgName").contains("æ²é³")?"FORTUNE":lineJson.getString("LOrgName").contains("åé")?"FORTUNA":lineJson.getString("LOrgName").contains("å京")?"FORTUBE":lineJson.getString("LOrgName")); |
| | | bomLine.setCreateBy(batchNum); |
| | | lineList.add(bomLine); |
| | | } |
| | | } |
| | |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("bom"); |
| | | jobLog.setResult("header:"+headerList.size() + " line:"+lineList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | pageIndex++; |
| | | }else{ |
| | |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("bom"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | break; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | jobLog.setRequestData(requestBody.toJSONString()); |
| | | jobLog.setResponseData(response.getBody()); |
| | | jobLog.setPageNum(Long.valueOf(pageIndex)); |
| | | jobLog.setPageCount(Long.valueOf(pageSize)); |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("bom"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.job.domain.ApsMaterialStorageManagementJob; |
| | | import com.aps.job.domain.ApsWorkOrderJobLog; |
| | | import com.aps.job.mapper.ApsMaterialStorageManagementJobMapper; |
| | |
| | | JSONObject requestBody = new JSONObject(); |
| | | ResponseEntity<String> response = null; |
| | | ApsWorkOrderJobLog jobLog = new ApsWorkOrderJobLog(); |
| | | String batchNum = ""; |
| | | try { |
| | | // 设置请æ±å¤´ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | // 设置请æ±ä½ |
| | | while (true) { |
| | | batchNum = IdUtils.fastSimpleUUID(); |
| | | jobLog = new ApsWorkOrderJobLog(); |
| | | requestBody = new JSONObject(); |
| | | requestBody.put("PageIndex", pageIndex); |
| | |
| | | materialStorage.setItemNumber(storage.getString("ItemCode")); |
| | | materialStorage.setNum(storage.getBigDecimal("StoreQty")); |
| | | materialStorage.setApplicableFactories(storage.getString("OrgCode")); |
| | | materialStorage.setCreateBy(batchNum); |
| | | storageList.add(materialStorage); |
| | | } |
| | | List<ApsMaterialStorageManagementJob> temp = new ArrayList<>(); |
| | |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("storage"); |
| | | jobLog.setResult("storage:"+storageList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | pageIndex++; |
| | | }else{ |
| | |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("storage"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | break; |
| | | } |
| | |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("storage"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | return false; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.job.domain.ApsStandardProcessRouteHeaderJob; |
| | | import com.aps.job.domain.ApsStandardProcessRouteLineJob; |
| | | import com.aps.job.domain.ApsWorkOrderJobLog; |
| | | import com.aps.job.mapper.ApsStandardProcessRouteHeaderJobMapper; |
| | | import com.aps.job.mapper.ApsStandardProcessRouteLineJobMapper; |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsStandardProcessRouteHeaderJobService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿HeaderServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Service |
| | | public class ApsStandardProcessRouteHeaderJobServiceImpl implements IApsStandardProcessRouteHeaderJobService |
| | | { |
| | | @Autowired |
| | | private ApsStandardProcessRouteHeaderJobMapper apsStandardProcessRouteHeaderJobMapper; |
| | | |
| | | @Autowired |
| | | private ApsStandardProcessRouteLineJobMapper apsStandardProcessRouteLineJobMapper; |
| | | |
| | | @Value("${u9.processRouteUrl}") |
| | | private String getProcessRouteUrl; |
| | | |
| | | @Autowired |
| | | private ApsWorkOrderJobLogMapper jobLogMapper; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | @Override |
| | | public ApsStandardProcessRouteHeaderJob selectApsStandardProcessRouteHeaderJobById(Long id) |
| | | { |
| | | return apsStandardProcessRouteHeaderJobMapper.selectApsStandardProcessRouteHeaderJobById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Headerå表 |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | @Override |
| | | public List<ApsStandardProcessRouteHeaderJob> selectApsStandardProcessRouteHeaderJobList(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob) |
| | | { |
| | | return apsStandardProcessRouteHeaderJobMapper.selectApsStandardProcessRouteHeaderJobList(apsStandardProcessRouteHeaderJob); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob) |
| | | { |
| | | apsStandardProcessRouteHeaderJob.setCreateTime(DateUtils.getNowDate()); |
| | | return apsStandardProcessRouteHeaderJobMapper.insertApsStandardProcessRouteHeaderJob(apsStandardProcessRouteHeaderJob); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param apsStandardProcessRouteHeaderJob æ åå·¥èºè·¯çº¿Header |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsStandardProcessRouteHeaderJob(ApsStandardProcessRouteHeaderJob apsStandardProcessRouteHeaderJob) |
| | | { |
| | | apsStandardProcessRouteHeaderJob.setUpdateTime(DateUtils.getNowDate()); |
| | | return apsStandardProcessRouteHeaderJobMapper.updateApsStandardProcessRouteHeaderJob(apsStandardProcessRouteHeaderJob); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Header |
| | | * |
| | | * @param ids éè¦å é¤çæ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessRouteHeaderJobByIds(Long[] ids) |
| | | { |
| | | return apsStandardProcessRouteHeaderJobMapper.deleteApsStandardProcessRouteHeaderJobByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Headerä¿¡æ¯ |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Headerä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessRouteHeaderJobById(Long id) |
| | | { |
| | | return apsStandardProcessRouteHeaderJobMapper.deleteApsStandardProcessRouteHeaderJobById(id); |
| | | } |
| | | |
| | | @Override |
| | | public boolean syncProcessRouteData(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) { |
| | | JSONObject requestBody = new JSONObject(); |
| | | ResponseEntity<String> response = null; |
| | | ApsWorkOrderJobLog jobLog = new ApsWorkOrderJobLog(); |
| | | String batchNum = ""; |
| | | try { |
| | | // 设置请æ±å¤´ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | // 设置请æ±ä½ |
| | | while (true) { |
| | | batchNum = IdUtils.fastSimpleUUID(); |
| | | jobLog = new ApsWorkOrderJobLog(); |
| | | requestBody = new JSONObject(); |
| | | requestBody.put("PageIndex", pageIndex); |
| | | requestBody.put("PageSize", pageSize); |
| | | if(!StringUtils.isEmpty(orgCode)){ |
| | | requestBody.put("OrgCode", orgCode); |
| | | } |
| | | // å建HttpEntity对象 |
| | | HttpEntity<String> request = new HttpEntity<>(requestBody.toJSONString(), headers); |
| | | // åéPOSTè¯·æ± |
| | | response = restTemplate.postForEntity(getProcessRouteUrl, request, String.class); |
| | | JSONObject responseBodyJson = JSONObject.parseObject(response.getBody()); |
| | | if (response.getStatusCode().is2xxSuccessful() && "200".equals(responseBodyJson.getString("status"))) { |
| | | JSONArray jsonArray = responseBodyJson.getJSONArray("data"); |
| | | if (!jsonArray.isEmpty()) { |
| | | List<ApsStandardProcessRouteHeaderJob> headerList = new ArrayList<>(); |
| | | List<ApsStandardProcessRouteLineJob> lineList = new ArrayList<>(); |
| | | for (Object o : jsonArray) { |
| | | //o对象ä¸ç屿§èµå¼ç»ApsBomHeaderJob对象 |
| | | JSONObject routeHeader = (JSONObject) o; |
| | | JSONArray routeLines = routeHeader.getJSONArray("RoutingLines"); |
| | | ApsStandardProcessRouteHeaderJob insertRouteHeader = new ApsStandardProcessRouteHeaderJob(); |
| | | insertRouteHeader.setId(IdUtil.getSnowflakeNextId()); |
| | | insertRouteHeader.setRouteId(routeHeader.getString("HID")); |
| | | insertRouteHeader.setItemCode(routeHeader.getString("HItemCode")); |
| | | insertRouteHeader.setVersion(routeHeader.getString("RoutingVersionCode")); |
| | | insertRouteHeader.setStartDate(DateUtils.parseDate(routeHeader.getString("HEffectiveDate"))); |
| | | insertRouteHeader.setEndDate(DateUtils.parseDate(routeHeader.getString("HDisableDate"))); |
| | | insertRouteHeader.setOrgCode(routeHeader.getString("HOrgCode")); |
| | | insertRouteHeader.setCreateBy(batchNum); |
| | | headerList.add(insertRouteHeader); |
| | | for(Object line : routeLines){ |
| | | JSONObject lineJson = (JSONObject) line; |
| | | ApsStandardProcessRouteLineJob routeLine = new ApsStandardProcessRouteLineJob(); |
| | | routeLine.setId(IdUtil.getSnowflakeNextId()); |
| | | routeLine.setRouteId(lineJson.getString("HID")); |
| | | routeLine.setRouteNum(lineJson.getString("Sequence")); |
| | | routeLine.setRouteName(lineJson.getString("WorkCenterName")); |
| | | routeLine.setRouteCode(lineJson.getString("WorkCenterCode")); |
| | | routeLine.setStartDate(DateUtils.parseDate(lineJson.getString("LEffectiveDate"))); |
| | | routeLine.setEndDate(DateUtils.parseDate(lineJson.getString("LDisableDate"))); |
| | | routeLine.setOrgCode(lineJson.getString("LOrgCode")); |
| | | routeLine.setStandardTime(lineJson.getBigDecimal("StandardTime")); |
| | | routeLine.setCreateBy(batchNum); |
| | | lineList.add(routeLine); |
| | | } |
| | | } |
| | | List<ApsStandardProcessRouteHeaderJob> temp1 = new ArrayList<>(); |
| | | for(int i=0;i<headerList.size();i++){ |
| | | temp1.add(headerList.get(i)); |
| | | if(temp1.size()>=20){ |
| | | apsStandardProcessRouteHeaderJobMapper.insertProcessRouteHeaderBatch(temp1); |
| | | temp1 = new ArrayList<>(); |
| | | } |
| | | } |
| | | List<ApsStandardProcessRouteLineJob> temp2 = new ArrayList<>(); |
| | | for(int j=0;j<lineList.size();j++){ |
| | | temp2.add(lineList.get(j)); |
| | | if(temp2.size()>=20){ |
| | | apsStandardProcessRouteLineJobMapper.insertProcessRouteLineBatch(temp2); |
| | | temp2 = new ArrayList<>(); |
| | | } |
| | | } |
| | | jobLog.setRequestData(requestBody.toJSONString()); |
| | | jobLog.setPageNum(Long.valueOf(pageIndex)); |
| | | jobLog.setPageCount(Long.valueOf(pageSize)); |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("processRoute"); |
| | | jobLog.setResult("header:"+headerList.size() + " line:"+lineList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | pageIndex++; |
| | | }else{ |
| | | break; |
| | | } |
| | | }else{ |
| | | jobLog.setRequestData(requestBody.toJSONString()); |
| | | jobLog.setResponseData(response.getBody()); |
| | | jobLog.setPageNum(Long.valueOf(pageIndex)); |
| | | jobLog.setPageCount(Long.valueOf(pageSize)); |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("processRoute"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | break; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | jobLog.setRequestData(requestBody.toJSONString()); |
| | | jobLog.setResponseData(response.getBody()); |
| | | jobLog.setPageNum(Long.valueOf(pageIndex)); |
| | | jobLog.setPageCount(Long.valueOf(pageSize)); |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("processRoute"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public boolean syncProcessRouteDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) { |
| | | try { |
| | | apsStandardProcessRouteHeaderJobMapper.deleteProcessRouteHeaderJob(); |
| | | apsStandardProcessRouteLineJobMapper.deleteProcessRouteLineJob(); |
| | | boolean res = syncProcessRouteData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | apsStandardProcessRouteHeaderJobMapper.deleteProcessRouteHeader(); |
| | | apsStandardProcessRouteLineJobMapper.deleteProcessRouteLine(); |
| | | apsStandardProcessRouteHeaderJobMapper.insertIntoProcessRouteHeader(); |
| | | apsStandardProcessRouteLineJobMapper.insertIntoProcessRouteLine(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | return true; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service.impl; |
| | | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.job.domain.ApsStandardProcessRouteLineJob; |
| | | import com.aps.job.mapper.ApsStandardProcessRouteLineJobMapper; |
| | | import com.aps.job.service.IApsStandardProcessRouteLineJobService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ åå·¥èºè·¯çº¿LineServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Service |
| | | public class ApsStandardProcessRouteLineJobServiceImpl implements IApsStandardProcessRouteLineJobService |
| | | { |
| | | @Autowired |
| | | private ApsStandardProcessRouteLineJobMapper apsStandardProcessRouteLineJobMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | @Override |
| | | public ApsStandardProcessRouteLineJob selectApsStandardProcessRouteLineJobById(Long id) |
| | | { |
| | | return apsStandardProcessRouteLineJobMapper.selectApsStandardProcessRouteLineJobById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Lineå表 |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | @Override |
| | | public List<ApsStandardProcessRouteLineJob> selectApsStandardProcessRouteLineJobList(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob) |
| | | { |
| | | return apsStandardProcessRouteLineJobMapper.selectApsStandardProcessRouteLineJobList(apsStandardProcessRouteLineJob); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob) |
| | | { |
| | | apsStandardProcessRouteLineJob.setCreateTime(DateUtils.getNowDate()); |
| | | return apsStandardProcessRouteLineJobMapper.insertApsStandardProcessRouteLineJob(apsStandardProcessRouteLineJob); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param apsStandardProcessRouteLineJob æ åå·¥èºè·¯çº¿Line |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsStandardProcessRouteLineJob(ApsStandardProcessRouteLineJob apsStandardProcessRouteLineJob) |
| | | { |
| | | apsStandardProcessRouteLineJob.setUpdateTime(DateUtils.getNowDate()); |
| | | return apsStandardProcessRouteLineJobMapper.updateApsStandardProcessRouteLineJob(apsStandardProcessRouteLineJob); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥èºè·¯çº¿Line |
| | | * |
| | | * @param ids éè¦å é¤çæ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessRouteLineJobByIds(Long[] ids) |
| | | { |
| | | return apsStandardProcessRouteLineJobMapper.deleteApsStandardProcessRouteLineJobByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Lineä¿¡æ¯ |
| | | * |
| | | * @param id æ åå·¥èºè·¯çº¿Lineä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessRouteLineJobById(Long id) |
| | | { |
| | | return apsStandardProcessRouteLineJobMapper.deleteApsStandardProcessRouteLineJobById(id); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.job.param.ApsWorkOrderJobParam; |
| | | import com.aps.job.service.IApsBomHeaderJobService; |
| | | import com.aps.job.service.IApsMaterialStorageManagementJobService; |
| | | import com.aps.job.service.IApsWorkOrderJobService; |
| | | import com.aps.job.service.IApsWorkOrderProcessService; |
| | | import com.aps.job.service.*; |
| | | import com.aps.system.api.RemoteCoreService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | |
| | | @Autowired |
| | | private IApsMaterialStorageManagementJobService apsMaterialStorageManagementJobService; |
| | | |
| | | @Autowired |
| | | private IApsStandardProcessRouteHeaderJobService apsStandardProcessRouteHeaderJobService; |
| | | |
| | | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) |
| | | { |
| | |
| | | { |
| | | apsMaterialStorageManagementJobService.syncApsMaterialStorageDataJob(pageIndex, pageSize, orgCode, itemCodeList); |
| | | } |
| | | |
| | | /** |
| | | * 忥å
¨éå·¥èºè·¯çº¿æ°æ®å®æ¶ä»»å¡ |
| | | */ |
| | | public void syncProcessRouteJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) |
| | | { |
| | | boolean res = apsStandardProcessRouteHeaderJobService.syncProcessRouteDataJob(pageIndex, pageSize, orgCode, itemCodeList); |
| | | // if(res){ |
| | | // remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | // } |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.job.mapper.ApsStandardProcessRouteHeaderJobMapper"> |
| | | |
| | | <resultMap type="ApsStandardProcessRouteHeaderJob" id="ApsStandardProcessRouteHeaderJobResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="routeId" column="route_id" /> |
| | | <result property="version" column="version" /> |
| | | <result property="startDate" column="start_date" /> |
| | | <result property="endDate" column="end_date" /> |
| | | <result property="orgCode" column="org_code" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="itemCode" column="item_code" /> |
| | | <result property="drawingNumber" column="drawing_number" /> |
| | | <result property="processAllTime" column="process_all_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsStandardProcessRouteHeaderJobVo"> |
| | | select id, route_id, version, start_date, end_date, org_code, del_flag, create_by, create_time, update_by, update_time, item_code, drawing_number, process_all_time from aps_standard_process_route_header_job |
| | | </sql> |
| | | |
| | | <select id="selectApsStandardProcessRouteHeaderJobList" parameterType="ApsStandardProcessRouteHeaderJob" resultMap="ApsStandardProcessRouteHeaderJobResult"> |
| | | <include refid="selectApsStandardProcessRouteHeaderJobVo"/> |
| | | <where> |
| | | <if test="routeId != null and routeId != ''"> and route_id = #{routeId}</if> |
| | | <if test="version != null and version != ''"> and version = #{version}</if> |
| | | <if test="startDate != null "> and start_date = #{startDate}</if> |
| | | <if test="endDate != null "> and end_date = #{endDate}</if> |
| | | <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> |
| | | <if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if> |
| | | <if test="drawingNumber != null and drawingNumber != ''"> and drawing_number = #{drawingNumber}</if> |
| | | <if test="processAllTime != null "> and process_all_time = #{processAllTime}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectApsStandardProcessRouteHeaderJobById" parameterType="Long" resultMap="ApsStandardProcessRouteHeaderJobResult"> |
| | | <include refid="selectApsStandardProcessRouteHeaderJobVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsStandardProcessRouteHeaderJob" parameterType="ApsStandardProcessRouteHeaderJob"> |
| | | insert into aps_standard_process_route_header_job |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="routeId != null">route_id,</if> |
| | | <if test="version != null">version,</if> |
| | | <if test="startDate != null">start_date,</if> |
| | | <if test="endDate != null">end_date,</if> |
| | | <if test="orgCode != null">org_code,</if> |
| | | <if test="delFlag != null">del_flag,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="itemCode != null">item_code,</if> |
| | | <if test="drawingNumber != null">drawing_number,</if> |
| | | <if test="processAllTime != null">process_all_time,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="routeId != null">#{routeId},</if> |
| | | <if test="version != null">#{version},</if> |
| | | <if test="startDate != null">#{startDate},</if> |
| | | <if test="endDate != null">#{endDate},</if> |
| | | <if test="orgCode != null">#{orgCode},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="itemCode != null">#{itemCode},</if> |
| | | <if test="drawingNumber != null">#{drawingNumber},</if> |
| | | <if test="processAllTime != null">#{processAllTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateApsStandardProcessRouteHeaderJob" parameterType="ApsStandardProcessRouteHeaderJob"> |
| | | update aps_standard_process_route_header_job |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="routeId != null">route_id = #{routeId},</if> |
| | | <if test="version != null">version = #{version},</if> |
| | | <if test="startDate != null">start_date = #{startDate},</if> |
| | | <if test="endDate != null">end_date = #{endDate},</if> |
| | | <if test="orgCode != null">org_code = #{orgCode},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="itemCode != null">item_code = #{itemCode},</if> |
| | | <if test="drawingNumber != null">drawing_number = #{drawingNumber},</if> |
| | | <if test="processAllTime != null">process_all_time = #{processAllTime},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteApsStandardProcessRouteHeaderJobById" parameterType="Long"> |
| | | delete from aps_standard_process_route_header_job where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteApsStandardProcessRouteHeaderJobByIds" parameterType="String"> |
| | | delete from aps_standard_process_route_header_job where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <insert id="insertProcessRouteHeaderBatch"> |
| | | INSERT INTO aps_standard_process_route_header_job ( |
| | | id, |
| | | route_id, |
| | | item_code, |
| | | version, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | create_time |
| | | ) VALUES |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.id}, |
| | | #{item.routeId}, |
| | | #{item.itemCode}, |
| | | #{item.version}, |
| | | #{item.startDate}, |
| | | #{item.endDate}, |
| | | #{item.orgCode}, |
| | | now() |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <!-- æå
¥æ°æ®å° aps_bom_header --> |
| | | <insert id="insertIntoProcessRouteHeader"> |
| | | INSERT INTO aps_standard_process_route_header ( |
| | | id, |
| | | route_id, |
| | | item_code, |
| | | version, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | create_time |
| | | ) |
| | | SELECT |
| | | id, |
| | | route_id, |
| | | item_code, |
| | | version, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | now() |
| | | FROM aps_standard_process_route_header_job |
| | | </insert> |
| | | |
| | | <!-- å é¤ aps_standard_process_route_header 表ä¸çæ°æ® --> |
| | | <delete id="deleteProcessRouteHeader"> |
| | | DELETE FROM aps_standard_process_route_header |
| | | </delete> |
| | | |
| | | <!-- å é¤ aps_standard_process_route_header_job 表ä¸çæ°æ® --> |
| | | <delete id="deleteProcessRouteHeaderJob"> |
| | | DELETE FROM aps_standard_process_route_header_job |
| | | </delete> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.job.mapper.ApsStandardProcessRouteLineJobMapper"> |
| | | |
| | | <resultMap type="ApsStandardProcessRouteLineJob" id="ApsStandardProcessRouteLineJobResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="routeId" column="route_id" /> |
| | | <result property="routeNum" column="route_num" /> |
| | | <result property="routeName" column="route_name" /> |
| | | <result property="startDate" column="start_date" /> |
| | | <result property="endDate" column="end_date" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="orgCode" column="org_code" /> |
| | | <result property="shopCode" column="shop_code" /> |
| | | <result property="productivityModel" column="productivity_model" /> |
| | | <result property="designCapacity" column="design_capacity" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="routeCode" column="route_code" /> |
| | | <result property="standardTime" column="standard_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsStandardProcessRouteLineJobVo"> |
| | | select id, route_id, route_num, route_name, start_date, end_date, create_time, org_code, shop_code, productivity_model, design_capacity, del_flag, create_by, update_by, update_time, route_code, standard_time from aps_standard_process_route_line_job |
| | | </sql> |
| | | |
| | | <select id="selectApsStandardProcessRouteLineJobList" parameterType="ApsStandardProcessRouteLineJob" resultMap="ApsStandardProcessRouteLineJobResult"> |
| | | <include refid="selectApsStandardProcessRouteLineJobVo"/> |
| | | <where> |
| | | <if test="routeId != null and routeId != ''"> and route_id = #{routeId}</if> |
| | | <if test="routeNum != null and routeNum != ''"> and route_num = #{routeNum}</if> |
| | | <if test="routeName != null and routeName != ''"> and route_name like concat('%', #{routeName}, '%')</if> |
| | | <if test="startDate != null "> and start_date = #{startDate}</if> |
| | | <if test="endDate != null "> and end_date = #{endDate}</if> |
| | | <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> |
| | | <if test="shopCode != null and shopCode != ''"> and shop_code = #{shopCode}</if> |
| | | <if test="productivityModel != null and productivityModel != ''"> and productivity_model = #{productivityModel}</if> |
| | | <if test="designCapacity != null "> and design_capacity = #{designCapacity}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectApsStandardProcessRouteLineJobById" parameterType="Long" resultMap="ApsStandardProcessRouteLineJobResult"> |
| | | <include refid="selectApsStandardProcessRouteLineJobVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsStandardProcessRouteLineJob" parameterType="ApsStandardProcessRouteLineJob"> |
| | | insert into aps_standard_process_route_line_job |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="routeId != null">route_id,</if> |
| | | <if test="routeNum != null">route_num,</if> |
| | | <if test="routeName != null">route_name,</if> |
| | | <if test="startDate != null">start_date,</if> |
| | | <if test="endDate != null">end_date,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="orgCode != null">org_code,</if> |
| | | <if test="shopCode != null">shop_code,</if> |
| | | <if test="productivityModel != null">productivity_model,</if> |
| | | <if test="designCapacity != null">design_capacity,</if> |
| | | <if test="delFlag != null">del_flag,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="routeId != null">#{routeId},</if> |
| | | <if test="routeNum != null">#{routeNum},</if> |
| | | <if test="routeName != null">#{routeName},</if> |
| | | <if test="startDate != null">#{startDate},</if> |
| | | <if test="endDate != null">#{endDate},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="orgCode != null">#{orgCode},</if> |
| | | <if test="shopCode != null">#{shopCode},</if> |
| | | <if test="productivityModel != null">#{productivityModel},</if> |
| | | <if test="designCapacity != null">#{designCapacity},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateApsStandardProcessRouteLineJob" parameterType="ApsStandardProcessRouteLineJob"> |
| | | update aps_standard_process_route_line_job |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="routeId != null">route_id = #{routeId},</if> |
| | | <if test="routeNum != null">route_num = #{routeNum},</if> |
| | | <if test="routeName != null">route_name = #{routeName},</if> |
| | | <if test="startDate != null">start_date = #{startDate},</if> |
| | | <if test="endDate != null">end_date = #{endDate},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="orgCode != null">org_code = #{orgCode},</if> |
| | | <if test="shopCode != null">shop_code = #{shopCode},</if> |
| | | <if test="productivityModel != null">productivity_model = #{productivityModel},</if> |
| | | <if test="designCapacity != null">design_capacity = #{designCapacity},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteApsStandardProcessRouteLineJobById" parameterType="Long"> |
| | | delete from aps_standard_process_route_line_job where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteApsStandardProcessRouteLineJobByIds" parameterType="String"> |
| | | delete from aps_standard_process_route_line_job where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <insert id="insertProcessRouteLineBatch"> |
| | | INSERT INTO aps_standard_process_route_line_job ( |
| | | id, |
| | | route_id, |
| | | route_num, |
| | | route_name, |
| | | route_code, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | shop_code, |
| | | standard_time, |
| | | create_time |
| | | ) VALUES |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.id}, |
| | | #{item.routeId}, |
| | | #{item.routeNum}, |
| | | #{item.routeName}, |
| | | #{item.routeCode}, |
| | | #{item.startDate}, |
| | | #{item.endDate}, |
| | | #{item.orgCode}, |
| | | #{item.shopCode}, |
| | | #{item.standardTime}, |
| | | now() |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <!-- æå
¥æ°æ®å° aps_bom_header --> |
| | | <insert id="insertIntoProcessRouteLine"> |
| | | INSERT INTO aps_standard_process_route_line ( |
| | | id, |
| | | route_id, |
| | | route_num, |
| | | route_name, |
| | | route_code, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | shop_code, |
| | | standard_time, |
| | | create_time |
| | | ) |
| | | SELECT |
| | | id, |
| | | route_id, |
| | | route_num, |
| | | route_name, |
| | | route_code, |
| | | start_date, |
| | | end_date, |
| | | org_code, |
| | | shop_code, |
| | | standard_time, |
| | | now() |
| | | FROM aps_standard_process_route_line_job |
| | | </insert> |
| | | |
| | | <!-- å é¤ aps_standard_process_route_line 表ä¸çæ°æ® --> |
| | | <delete id="deleteProcessRouteLine"> |
| | | DELETE FROM aps_standard_process_route_line |
| | | </delete> |
| | | |
| | | <!-- å é¤ aps_standard_process_route_line_job 表ä¸çæ°æ® --> |
| | | <delete id="deleteProcessRouteLineJob"> |
| | | DELETE FROM aps_standard_process_route_line_job |
| | | </delete> |
| | | |
| | | </mapper> |