Merge branch 'dev' of http://192.168.50.149:8085/r/aps-backend into dev
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.system.api; |
| | | |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.constant.ServiceNameConstants; |
| | | import com.aps.common.core.domain.R; |
| | | import com.aps.system.api.factory.RemoteCoreFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | |
| | | /** |
| | | * ä»»å¡æå¡ |
| | | * |
| | | * @author hjy |
| | | */ |
| | | @FeignClient(contextId = "remoteCoreService", value = ServiceNameConstants.CORE_SERVICE, fallbackFactory = RemoteCoreFallbackFactory.class) |
| | | public interface RemoteCoreService |
| | | { |
| | | |
| | | /** |
| | | * å·æ°BOMæ°æ®å°Redis |
| | | * @param source |
| | | * @return |
| | | */ |
| | | @PostMapping("/ApsBomHeader/setBomDataToRedis") |
| | | R<Boolean> setBomDataToRedis(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.system.api; |
| | | |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.constant.ServiceNameConstants; |
| | | import com.aps.common.core.domain.R; |
| | | import com.aps.system.api.factory.RemoteJobFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestHeader; |
| | | |
| | | /** |
| | | * ä»»å¡æå¡ |
| | | * |
| | | * @author hjy |
| | | */ |
| | | @FeignClient(contextId = "remoteJobService", value = ServiceNameConstants.JOB_SERVICE, fallbackFactory = RemoteJobFallbackFactory.class) |
| | | public interface RemoteJobService |
| | | { |
| | | |
| | | /** |
| | | * å·æ°BOMå
¨éæ°æ® |
| | | * @param source |
| | | * @return |
| | | */ |
| | | @PostMapping("/job/refreshBomData") |
| | | R<Boolean> refreshBomData(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.system.api.factory; |
| | | |
| | | import com.aps.common.core.domain.R; |
| | | import com.aps.system.api.RemoteCoreService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç¨æ·æå¡é级å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class RemoteCoreFallbackFactory implements FallbackFactory<RemoteCoreService> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(RemoteCoreFallbackFactory.class); |
| | | |
| | | @Override |
| | | public RemoteCoreService create(Throwable throwable) |
| | | { |
| | | log.error("任塿å¡è°ç¨å¤±è´¥:{}", throwable.getMessage()); |
| | | return source -> R.fail("BOMæ°æ®åå¨å°Redisä¸å¤±è´¥:" + throwable.getMessage()); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.system.api.factory; |
| | | |
| | | import com.aps.common.core.domain.R; |
| | | import com.aps.system.api.RemoteJobService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * ç¨æ·æå¡é级å¤ç |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class RemoteJobFallbackFactory implements FallbackFactory<RemoteJobService> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(RemoteJobFallbackFactory.class); |
| | | |
| | | @Override |
| | | public RemoteJobService create(Throwable throwable) |
| | | { |
| | | log.error("任塿å¡è°ç¨å¤±è´¥:{}", throwable.getMessage()); |
| | | return source -> R.fail("å·æ°BOMæ°æ®å¤±è´¥:" + throwable.getMessage()); |
| | | } |
| | | } |
| | |
| | | com.aps.system.api.factory.RemoteUserFallbackFactory |
| | | com.aps.system.api.factory.RemoteLogFallbackFactory |
| | | com.aps.system.api.factory.RemoteFileFallbackFactory |
| | | com.aps.system.api.factory.RemoteJobFallbackFactory |
| | | com.aps.system.api.factory.RemoteCoreFallbackFactory |
| | |
| | | * æä»¶æå¡çserviceid |
| | | */ |
| | | public static final String FILE_SERVICE = "aps-file"; |
| | | |
| | | /** |
| | | * apsæå¡çserviceid |
| | | */ |
| | | public static final String CORE_SERVICE = "aps-core"; |
| | | |
| | | /** |
| | | * 任塿å¡çserviceid |
| | | */ |
| | | public static final String JOB_SERVICE = "aps-job"; |
| | | } |
| | |
| | | /** |
| | | * æ¥è¯¢BOMæ°æ®ç®¡çå表 |
| | | */ |
| | | @RequiresPermissions("apsBom:list") |
| | | @RequiresPermissions("Aps:apsBom:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsBom apsBom) |
| | | { |
| | |
| | | /** |
| | | * 导åºBOMæ°æ®ç®¡çå表 |
| | | */ |
| | | @RequiresPermissions("apsBom:export") |
| | | @RequiresPermissions("Aps:apsBom:export") |
| | | @Log(title = "BOMæ°æ®ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsBom apsBom) |
| | |
| | | /** |
| | | * è·åBOMæ°æ®ç®¡ç详ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("apsBom:query") |
| | | @RequiresPermissions("Aps:apsBom:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | |
| | | /** |
| | | * æ°å¢BOMæ°æ®ç®¡ç |
| | | */ |
| | | @RequiresPermissions("apsBom:add") |
| | | @RequiresPermissions("Aps:apsBom:add") |
| | | @Log(title = "BOMæ°æ®ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsBom apsBom) |
| | |
| | | /** |
| | | * ä¿®æ¹BOMæ°æ®ç®¡ç |
| | | */ |
| | | @RequiresPermissions("apsBom:edit") |
| | | @RequiresPermissions("Aps:apsBom:edit") |
| | | @Log(title = "BOMæ°æ®ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsBom apsBom) |
| | |
| | | /** |
| | | * å é¤BOMæ°æ®ç®¡ç |
| | | */ |
| | | @RequiresPermissions("apsBom:remove") |
| | | @RequiresPermissions("Aps:apsBom:remove") |
| | | @Log(title = "BOMæ°æ®ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | |
| | | 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.ApsBomHeader; |
| | | import com.aps.core.service.IApsBomHeaderService; |
| | | 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 IApsBomHeaderService apsBomHeaderService; |
| | | |
| | | @Autowired |
| | | private RemoteJobService remoteJobService; |
| | | |
| | | /** |
| | | * æ¥è¯¢BOM Header æ°æ®ç®¡çå表 |
| | | */ |
| | | |
| | | @RequiresPermissions("aps:ApsBomHeader:list") |
| | | @RequiresPermissions("Aps:ApsBomHeader:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsBomHeader apsBomHeader) |
| | | { |
| | |
| | | return toAjax(apsBomHeaderService.deleteApsBomHeaderByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * å·æ°å
¨éBOMæ°æ® |
| | | */ |
| | | @RequiresPermissions("Aps:ApsBomHeader:refreshBomData") |
| | | @PostMapping("/refreshBomData") |
| | | public void refreshBomData() |
| | | { |
| | | R<Boolean> res = remoteJobService.refreshBomData(SecurityConstants.INNER); |
| | | if (R.isSuccess(res)) |
| | | { |
| | | apsBomHeaderService.setBomDataToRedis(""); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/setBomDataToRedis") |
| | | public void setBomDataToRedis() |
| | | { |
| | | apsBomHeaderService.setBomDataToRedis(""); |
| | | } |
| | | |
| | | @PostMapping("/test") |
| | | public void test() |
| | | { |
| | |
| | | */ |
| | | |
| | | @Operation(summary = "æ¥è¯¢é£éæ åéæ±å¼å¸¸ä¿¡æ¯å表", description = "å页æ¥è¯¢") |
| | | //@RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:list") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsPlateStandardRequireError apsPlateStandardRequireError) |
| | | { |
| | |
| | | * 导åºé£éæ åéæ±å¼å¸¸ä¿¡æ¯å表 |
| | | */ |
| | | @Operation(summary = "导åºé£éæ åéæ±å¼å¸¸ä¿¡æ¯å表", description = "导åº") |
| | | //@RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:export") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:export") |
| | | @Log(title = "é£éæ åéæ±å¼å¸¸ä¿¡æ¯", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsPlateStandardRequireError apsPlateStandardRequireError) |
| | |
| | | * è·åé£éæ åéæ±å¼å¸¸ä¿¡æ¯è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·åé£éæ åéæ±å¼å¸¸ä¿¡æ¯è¯¦ç»ä¿¡æ¯", description = "æ ¹æ®idè·å") |
| | | //@RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:query") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | |
| | | * æ°å¢é£éæ åéæ±å¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "æ°å¢é£éæ åéæ±å¼å¸¸ä¿¡æ¯", description = "å个æ°å¢") |
| | | //@RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:add") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:add") |
| | | @Log(title = "é£éæ åéæ±å¼å¸¸ä¿¡æ¯", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsPlateStandardRequireError apsPlateStandardRequireError) |
| | |
| | | * ä¿®æ¹é£éæ åéæ±å¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "ä¿®æ¹é£éæ åéæ±å¼å¸¸ä¿¡æ¯", description = "å个修æ¹") |
| | | //@RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:edit") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:edit") |
| | | @Log(title = "é£éæ åéæ±å¼å¸¸ä¿¡æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsPlateStandardRequireError apsPlateStandardRequireError) |
| | |
| | | * å é¤é£éæ åéæ±å¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "å é¤é£éæ åéæ±å¼å¸¸ä¿¡æ¯", description = "æ¹éå é¤") |
| | | // @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:remove") |
| | | @RequiresPermissions("Aps:ApsPlateStandardRequireError:remove") |
| | | @Log(title = "é£éæ åéæ±å¼å¸¸ä¿¡æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Headerå表 |
| | | */ |
| | | |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:list") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsStandardProcessRouteHeader apsStandardProcessRouteHeader) |
| | | { |
| | |
| | | * å¯¼åºæ åå·¥èºè·¯çº¿Headerå表 |
| | | */ |
| | | |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:export") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:export") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Header", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsStandardProcessRouteHeader apsStandardProcessRouteHeader) |
| | |
| | | /** |
| | | * è·åæ åå·¥èºè·¯çº¿Header详ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:query") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:add") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:add") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Header", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsStandardProcessRouteHeader apsStandardProcessRouteHeader) |
| | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Header |
| | | */ |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:edit") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:edit") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Header", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsStandardProcessRouteHeader apsStandardProcessRouteHeader) |
| | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Header |
| | | */ |
| | | @RequiresPermissions("aps:ApsStandardProcessRouteHeader:remove") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteHeader:remove") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Header", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥èºè·¯çº¿Lineå表 |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:list") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsStandardProcessRouteLine apsStandardProcessRouteLine) |
| | | { |
| | |
| | | /** |
| | | * å¯¼åºæ åå·¥èºè·¯çº¿Lineå表 |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:export") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:export") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Line", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsStandardProcessRouteLine apsStandardProcessRouteLine) |
| | |
| | | /** |
| | | * è·åæ åå·¥èºè·¯çº¿Line详ç»ä¿¡æ¯ |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:query") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | |
| | | /** |
| | | * æ°å¢æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:add") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:add") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Line", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsStandardProcessRouteLine apsStandardProcessRouteLine) |
| | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥èºè·¯çº¿Line |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:edit") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:edit") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Line", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsStandardProcessRouteLine apsStandardProcessRouteLine) |
| | |
| | | /** |
| | | * å 餿 åå·¥èºè·¯çº¿Line |
| | | */ |
| | | @RequiresPermissions("ApsStandardProcessRouteLine:ApsStandardProcessRouteLine:remove") |
| | | @RequiresPermissions("Aps:ApsStandardProcessRouteLine:remove") |
| | | @Log(title = "æ åå·¥èºè·¯çº¿Line", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | |
| | | private String requireTrackId; |
| | | /**åå·*/ |
| | | private String docNum; |
| | | |
| | | /**ä¸çº§ç©æç¼ç */ |
| | | private String bomHeaderCode; |
| | | /** bom_line_id */ |
| | | // @Excel(name = "bom_line_id") |
| | | private String bomLineId; |
| | |
| | | private BigDecimal netRequirement; |
| | | |
| | | /** 计åå¼å·¥æ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计åå¼å·¥æ¥") |
| | | private Date startDate; |
| | | |
| | | /** 计åå®å·¥æ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计åå®å·¥æ¥") |
| | | private Date completeDate; |
| | | |
| | | /** éæ±æ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "éæ±æ¥æ") |
| | | private Date demandDate; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "å»ºè®®å®ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date suggestedCompletionDate; |
| | | |
| | | /** å»¶è¿é£é©æ è¯ */ |
| | | private String hasDelayRisk; |
| | | |
| | |
| | | /** |
| | | * è·åæªå¹é
çå计å |
| | | * */ |
| | | ApsPlatePlan selectUnMatchPlateSubPlan(String plant); |
| | | ApsPlatePlan selectUnMatchPlateSubPlan(String plant,String itemNumber); |
| | | |
| | | /** |
| | | * æ´æ°åè®¡åæªå¹é
æ°é |
| | |
| | | |
| | | List<ApsPlateStandardRequire> requiresList=new ArrayList<>(); |
| | | |
| | | getBomRequires(plantCode, "0",itemNumber,BigDecimal.ONE, batchNum, null, mainPlan, requiresList, 0L); |
| | | getBomRequires(plantCode, "0","0",itemNumber,BigDecimal.ONE, batchNum, null, mainPlan, requiresList, 0L); |
| | | |
| | | // æ¹éæå
¥ä»¥æé«æ§è½ |
| | | if (!requiresList.isEmpty()) { |
| | |
| | | * æå»ºéæ±ä¿¡æ¯ |
| | | * |
| | | * @param plant å·¥å代ç |
| | | * @param bomHeaderCode BOMä¸çº§ç©æç¼ç |
| | | * @param bomLineId BOMè¡ID |
| | | * @param itemCode ç©æä»£ç |
| | | * @param itemNum ç©ææ°é |
| | |
| | | * @param allRequires ææéæ±çå表 |
| | | * @param level å±çº§ |
| | | */ |
| | | private void getBomRequires(String plant, String bomLineId,String itemCode,BigDecimal itemNum, String batchNum, Date upLevelStartDate, ApsPlatePlan plan, List<ApsPlateStandardRequire> allRequires, Long level) { |
| | | private void getBomRequires(String plant, String bomHeaderCode, String bomLineId,String itemCode,BigDecimal itemNum, String batchNum, Date upLevelStartDate, ApsPlatePlan plan, List<ApsPlateStandardRequire> allRequires, Long level) { |
| | | /*æå»ºéæ±ä¿¡æ¯*/ |
| | | ApsPlateStandardRequire require = new ApsPlateStandardRequire(); |
| | | require.setId(IdUtil.getSnowflakeNextId()); |
| | |
| | | require.setBatchNumber(batchNum); |
| | | require.setDocNum(plan.getDocumentNumber()); |
| | | require.setOrgCode(plant); |
| | | require.setBomHeaderCode(bomHeaderCode); |
| | | require.setBomLineId(bomLineId); |
| | | require.setBomLineCode(itemCode); |
| | | require.setBomLineLevel(level); |
| | |
| | | bomStockDetailService.saveStorageAndDetail(storage, plan, bomLineId,itemCode, batchNum, deductionAmount, afterStockAmount,require.getId()); |
| | | } |
| | | } |
| | | /*æªå¹é
æ°éï¼é»è®¤ä¸ºåéæ±*/ |
| | | require.setUnmatchedDemandAmount(require.getNetRequirement()); |
| | | /*å·¥èºè·¯çº¿æ»éæ±*/ |
| | | ApsStandardProcessRouteLine routeHeader = routeLineService.getRouteLineTotalTime(require); |
| | | String routeId = routeHeader.getRouteId(); |
| | |
| | | List<ApsBom> bomLineList = bomLineService.selectApsBomLineList(plant, itemCode); |
| | | if (!bomLineList.isEmpty()) { |
| | | bomLineList.forEach(line -> { |
| | | getBomRequires(plant, line.getBomLineId(),line.getItemCode() ,line.getNum() , batchNum, require.getStartDate(), plan, allRequires, nextLevel); |
| | | getBomRequires(plant, itemCode, line.getBomLineId(),line.getItemCode() ,line.getNum() , batchNum, require.getStartDate(), plan, allRequires, nextLevel); |
| | | }); |
| | | } |
| | | } |
| | |
| | | |
| | | private void matchRequireAndSubPlan(ApsPlateStandardRequire require) { |
| | | BigDecimal netRequirement = require.getNetRequirement(); |
| | | require.setMatchMode("å·¥åå¹é
"); |
| | | if (netRequirement.compareTo(BigDecimal.ZERO) > 0) { |
| | | ApsPlatePlan platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode()); |
| | | ApsPlatePlan platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode()); |
| | | /*åä»¶å·¥åçæªå¹é
æ°é ä½ä¸ºå½åçåºå*/ |
| | | while (platePlan != null && netRequirement.compareTo(BigDecimal.ZERO) > 0) { |
| | | BigDecimal stock = platePlan.getUnmatchedQuantity(); |
| | | if (netRequirement.compareTo(stock) < 0) { |
| | | /* åºåæ°é å¤§äº åéæ±æ°é*/ |
| | | /* åéæ±æ°é=0 ï¼åä»¶å·¥åæªå¹é
æ°é= åºå-åéæ±*/ |
| | | netRequirement = BigDecimal.ZERO; |
| | | require.setNetRequirement(netRequirement); |
| | | BigDecimal subtract = stock.subtract(netRequirement); |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement); |
| | | netRequirement = BigDecimal.ZERO; |
| | | require.setMatchState("å·²å¹é
"); |
| | | require.setUnmatchedDemandAmount(netRequirement); |
| | | /*å鿱已ç»è¢«æ»¡è¶³ï¼ä¸éè¦ç»§ç»å¹é
*/ |
| | | |
| | | } else if (netRequirement.compareTo(stock) == 0) { |
| | | /*åéæ±æ°é == åºåæ°é*/ |
| | | netRequirement = BigDecimal.ZERO; |
| | | require.setNetRequirement(netRequirement); |
| | | |
| | | BigDecimal subtract = BigDecimal.ZERO; |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement); |
| | | netRequirement = BigDecimal.ZERO; |
| | | require.setMatchState("å·²å¹é
"); |
| | | require.setUnmatchedDemandAmount(netRequirement); |
| | | /*å鿱已ç»è¢«æ»¡è¶³ï¼ä¸éè¦ç»§ç»å¹é
*/ |
| | | } |
| | | if (netRequirement.compareTo(stock) > 0) { |
| | | /*鿱大äºåºå*/ |
| | | /*åéæ± 被é¨å满足 */ |
| | | BigDecimal rest = netRequirement.subtract(stock); |
| | | require.setNetRequirement(rest); |
| | | require.setMatchState("å¹é
ä¸"); |
| | | /*å·¥å æªå¹é
æ°é为0 å
¨é¨ç¨äºå¹é
éæ±*/ |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, BigDecimal.ZERO, stock, netRequirement); |
| | | /*åéæ±æªè¢«æ»¡è¶³ï¼éè¦ç»§ç»å¹é
*/ |
| | | platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode()); |
| | | platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode()); |
| | | /*å©ä½åéæ±*/ |
| | | netRequirement = rest; |
| | | require.setUnmatchedDemandAmount(netRequirement); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <select id="selectPlatePlanByPlantMajor" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id, |
| | | unmatched_quantity,version, production_base |
| | | unmatched_quantity,version, production_base, |
| | | (case when custom_time is null then plan_end_day else custom_time end ) as plan_end_day |
| | | from aps_plate_plan |
| | | <where> |
| | | <if test="plant != null "> and plant = #{plant}</if> |
| | | <if test="professionalAffiliation != null "> and professional_affiliation = #{professionalAffiliation}</if> |
| | |
| | | unmatched_quantity,version |
| | | from aps_plate_plan |
| | | where del_flag='0' and professional_affiliation !='0' and unmatched_quantity > 0 |
| | | <if test="plant != null and plan !='' "> and plant = #{plant}</if> |
| | | <if test="plant != null and plant !='' "> and plant = #{plant}</if> |
| | | <if test="itemNumber != null and itemNumber !='' "> and item_number = #{itemNumber}</if> |
| | | order by document_number asc,id asc |
| | | limit 1 |
| | | </select> |
| | |
| | | |
| | | <insert id="batchInsert" parameterType="java.util.List"> |
| | | insert into aps_plate_standard_require |
| | | (id, require_track_id,doc_num,batch_number, org_code, bom_line_id, bom_line_code, bom_line_level, bom_use_amount, process_route_id, |
| | | (id, require_track_id,doc_num,batch_number, org_code, bom_header_code,bom_line_id, bom_line_code, bom_line_level, bom_use_amount, process_route_id, |
| | | process_route_hours, require_amount, net_requirement, start_date, complete_date, demand_date, |
| | | production_base, match_state, match_mode, unmatched_demand_amount, suggested_completion_date, |
| | | has_delay_risk, del_flag, create_time, create_by) |
| | |
| | | #{item.docNum}, |
| | | #{item.batchNumber}, |
| | | #{item.orgCode}, |
| | | #{item.bomHeaderCode}, |
| | | #{item.bomLineId}, |
| | | #{item.bomLineCode}, |
| | | #{item.bomLineLevel}, |
| | |
| | | package com.aps.job.controller; |
| | | |
| | | import java.util.List; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | 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.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 com.aps.common.core.utils.uuid.Sequence; |
| | | 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.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.job.domain.SysJob; |
| | | import com.aps.job.service.ISysJobService; |
| | | import com.aps.job.service.*; |
| | | import com.aps.job.util.CronUtils; |
| | | import com.aps.job.util.ScheduleUtils; |
| | | import com.aps.system.api.RemoteCoreService; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.quartz.SchedulerException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.Instant; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è°åº¦ä»»å¡ä¿¡æ¯æä½å¤ç |
| | |
| | | @Autowired |
| | | private ISysJobService jobService; |
| | | |
| | | @Autowired |
| | | private IApsWorkOrderProcessService apsWorkOrderProcessService; |
| | | |
| | | @Autowired |
| | | private IApsWorkOrderJobService apsWorkOrderJobService; |
| | | |
| | | @Autowired |
| | | private IApsBomHeaderJobService apsBomHeaderJobService; |
| | | |
| | | @Autowired |
| | | private Sequence sequence; |
| | | |
| | | @Autowired |
| | | private IApsMaterialStorageManagementJobService apsMaterialStorageManagementJobService; |
| | | |
| | | @Autowired |
| | | private RemoteCoreService remoteCoreService; |
| | | /** |
| | | * æ¥è¯¢å®æ¶ä»»å¡å表 |
| | | */ |
| | |
| | | jobService.deleteJobByIds(jobIds); |
| | | return success(); |
| | | } |
| | | |
| | | @PostMapping("/refreshBomData") |
| | | public Boolean refreshBomData() throws SchedulerException, TaskException |
| | | { |
| | | return apsBomHeaderJobService.syncBomDataJob(1, 1000, "", ""); |
| | | } |
| | | |
| | | @PutMapping("/test") |
| | | public void test(@RequestBody SysJob job) throws Exception |
| | | { |
| | | System.out.println("start"); |
| | | //å°BOMæ°æ®åè¿Redisä¸ |
| | | remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | //åæ¥ç©æåºåæ°æ® |
| | | // apsMaterialStorageManagementJobService.syncApsMaterialStorageData(1, 1000, "", ""); |
| | | //忥BOMæ°æ® |
| | | // apsBomHeaderJobService.syncBomData(1, 1000, "FORTUNA", ""); |
| | | |
| | | // System.out.println(sequence.nextId()); |
| | | // List<String> docNos = new ArrayList<>(); |
| | | // docNos.add("MO-240328010093"); |
| | | // apsWorkOrderProcessService.getWorkOrderProcessFromU9(docNos); |
| | | // apsWorkOrderProcessService.syncWorkOrderProcessData("", 100); |
| | | // apsWorkOrderJobService.syncPartOrderData(); |
| | | // apsWorkOrderJobService.syncPlateOrderData(); |
| | | // apsWorkOrderJobService.syncGasPipingData(); |
| | | // apsWorkOrderProcessService.syncProcessRouteData(); |
| | | System.out.println("end"); |
| | | //çææ°æ®åå
¸ |
| | | // HikariConfig hikariConfig = new HikariConfig(); |
| | | // hikariConfig.setDriverClassName("org.postgresql.Driver"); |
| | | // hikariConfig.setJdbcUrl("jdbc:postgresql://192.168.50.160:5432/postgres?stringtype=unspecified"); |
| | | // hikariConfig.setUsername("postgres"); |
| | | // hikariConfig.setPassword("pwd@aps"); |
| | | // //设置å¯ä»¥è·åtables remarksä¿¡æ¯ |
| | | // hikariConfig.addDataSourceProperty("useInformationSchema", "true"); |
| | | // hikariConfig.setMinimumIdle(2); |
| | | // hikariConfig.setMaximumPoolSize(5); |
| | | // DataSource dataSource = new HikariDataSource(hikariConfig); |
| | | // //çæé
ç½® |
| | | // EngineConfig engineConfig = EngineConfig.builder() |
| | | // //çææä»¶è·¯å¾ |
| | | // .fileOutputDir("D:\\projects\\aps\\ææ¡£") |
| | | // //æå¼ç®å½ |
| | | // .openOutputDir(true) |
| | | // //æä»¶ç±»å |
| | | // .fileType(EngineFileType.WORD) |
| | | // //çææ¨¡æ¿å®ç° |
| | | // .produceType(EngineTemplateType.freemarker) |
| | | // //èªå®ä¹æä»¶åç§° |
| | | // .fileName("èªå®ä¹æä»¶åç§°").build(); |
| | | // |
| | | // //忽ç¥è¡¨ |
| | | // ArrayList<String> ignoreTableName = new ArrayList<>(); |
| | | // ignoreTableName.add("test_user"); |
| | | // ignoreTableName.add("test_group"); |
| | | // //忽ç¥è¡¨åç¼ |
| | | // ArrayList<String> ignorePrefix = new ArrayList<>(); |
| | | // ignorePrefix.add("test_"); |
| | | // //忽ç¥è¡¨åç¼ |
| | | // ArrayList<String> ignoreSuffix = new ArrayList<>(); |
| | | // ignoreSuffix.add("_test"); |
| | | // ProcessConfig processConfig = ProcessConfig.builder() |
| | | // //æå®çæé»è¾ãå½å卿å®è¡¨ãæå®è¡¨åç¼ãæå®è¡¨åç¼æ¶ï¼å°çææå®è¡¨ï¼å
¶ä½è¡¨ä¸çæãå¹¶è·³è¿å¿½ç¥è¡¨é
ç½® |
| | | // //æ ¹æ®åç§°æå®è¡¨çæ |
| | | // .designatedTableName(new ArrayList<>()) |
| | | // //æ ¹æ®è¡¨åç¼çæ |
| | | // .designatedTablePrefix(new ArrayList<>()) |
| | | // //æ ¹æ®è¡¨åç¼çæ |
| | | // .designatedTableSuffix(new ArrayList<>()) |
| | | // //忽ç¥è¡¨å |
| | | // .ignoreTableName(ignoreTableName) |
| | | // //忽ç¥è¡¨åç¼ |
| | | // .ignoreTablePrefix(ignorePrefix) |
| | | // //忽ç¥è¡¨åç¼ |
| | | // .ignoreTableSuffix(ignoreSuffix).build(); |
| | | // //é
ç½® |
| | | // Configuration config = Configuration.builder() |
| | | // //çæ¬ |
| | | // .version("1.0.0") |
| | | // //æè¿° |
| | | // .description("æ°æ®åºè®¾è®¡ææ¡£çæ") |
| | | // //æ°æ®æº |
| | | // .dataSource(dataSource) |
| | | // //çæé
ç½® |
| | | // .engineConfig(engineConfig) |
| | | // //çæé
ç½® |
| | | // .produceConfig(processConfig) |
| | | // .build(); |
| | | // //æ§è¡çæ |
| | | // new DocumentationExecute(config).execute(); |
| | | // System.out.println("end"); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | BigDecimal a = new BigDecimal("0.1234"); |
| | | Double b = a.doubleValue()*60*60*1000; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | //å°nowæ¢æææ¯«ç§ ç¶åå ä¸a ç¶åè½¬æ¢æLocalDateTime |
| | | //aè½¬æ¢ææ¯«ç§ |
| | | System.out.println(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | System.out.println(b/1000/60); |
| | | Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | milliSecond += b.longValue(); |
| | | System.out.println(LocalDateTime.ofInstant(Instant.ofEpochMilli(milliSecond), ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | System.out.println(new BigDecimal(585).divide(BigDecimal.valueOf(1232), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(100))); |
| | | new BigDecimal(585).divide(BigDecimal.valueOf(1232), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * ç©æåºå管ç对象 aps_material_storage_management_job |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Schema(description = "ç©æåºå管çå®ä½ç±»") |
| | | public class ApsMaterialStorageManagementJob extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** id */ |
| | | @Schema(description = "id") |
| | | private Long id; |
| | | |
| | | /** æå· */ |
| | | @Excel(name = "æå·") |
| | | @Schema(description = "æå·") |
| | | private String itemNumber; |
| | | |
| | | /** æ°é */ |
| | | @Excel(name = "æ°é") |
| | | @Schema(description = "æ°é") |
| | | private BigDecimal num; |
| | | |
| | | /** éç¨å·¥å */ |
| | | @Excel(name = "éç¨å·¥å") |
| | | @Schema(description = "éç¨å·¥å") |
| | | private String applicableFactories; |
| | | |
| | | /** éææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "éææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "éææ¥æ") |
| | | private Date integrationDate; |
| | | |
| | | /** å·æ°æ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å·æ°æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | @Schema(description = "å·æ°æ¥æ") |
| | | private Date refreshDate; |
| | | |
| | | /** å©ä½åºå */ |
| | | @Excel(name = "å©ä½åºå") |
| | | @Schema(description = "å©ä½åºå") |
| | | private BigDecimal remainderStock; |
| | | |
| | | /** ä¿®æ¹çæ¬ */ |
| | | @Excel(name = "ä¿®æ¹çæ¬") |
| | | @Schema(description = "ä¿®æ¹çæ¬") |
| | | private Double version; |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setItemNumber(String itemNumber) |
| | | { |
| | | this.itemNumber = itemNumber; |
| | | } |
| | | |
| | | public String getItemNumber() |
| | | { |
| | | return itemNumber; |
| | | } |
| | | |
| | | public void setNum(BigDecimal num) |
| | | { |
| | | this.num = num; |
| | | } |
| | | |
| | | public BigDecimal getNum() |
| | | { |
| | | return num; |
| | | } |
| | | |
| | | public void setApplicableFactories(String applicableFactories) |
| | | { |
| | | this.applicableFactories = applicableFactories; |
| | | } |
| | | |
| | | public String getApplicableFactories() |
| | | { |
| | | return applicableFactories; |
| | | } |
| | | |
| | | public void setIntegrationDate(Date integrationDate) |
| | | { |
| | | this.integrationDate = integrationDate; |
| | | } |
| | | |
| | | public Date getIntegrationDate() |
| | | { |
| | | return integrationDate; |
| | | } |
| | | |
| | | public void setRefreshDate(Date refreshDate) |
| | | { |
| | | this.refreshDate = refreshDate; |
| | | } |
| | | |
| | | public Date getRefreshDate() |
| | | { |
| | | return refreshDate; |
| | | } |
| | | |
| | | public void setRemainderStock(BigDecimal remainderStock) |
| | | { |
| | | this.remainderStock = remainderStock; |
| | | } |
| | | |
| | | public BigDecimal getRemainderStock() |
| | | { |
| | | return remainderStock; |
| | | } |
| | | |
| | | public void setVersion(Double version) |
| | | { |
| | | this.version = version; |
| | | } |
| | | |
| | | public Double getVersion() |
| | | { |
| | | return version; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("itemNumber", getItemNumber()) |
| | | .append("num", getNum()) |
| | | .append("applicableFactories", getApplicableFactories()) |
| | | .append("integrationDate", getIntegrationDate()) |
| | | .append("refreshDate", getRefreshDate()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remainderStock", getRemainderStock()) |
| | | .append("version", getVersion()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public void deleteApsBomHeader(); |
| | | |
| | | /** |
| | | * å é¤ä¸é´è¡¨BOM Headeræ°æ® |
| | | */ |
| | | public void deleteApsBomHeaderJob(); |
| | | } |
| | |
| | | */ |
| | | public void deleteApsBomLine() ; |
| | | |
| | | /** |
| | | * å é¤ä¸é´è¡¨BOM Lineæ°æ® |
| | | */ |
| | | public void deleteApsBomLineJob() ; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsMaterialStorageManagementJob; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç©æåºå管çMapperæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface ApsMaterialStorageManagementJobMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管ç |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç©æåºå管ç |
| | | */ |
| | | public ApsMaterialStorageManagementJob selectApsMaterialStorageManagementJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管çå表 |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç©æåºå管çéå |
| | | */ |
| | | public List<ApsMaterialStorageManagementJob> selectApsMaterialStorageManagementJobList(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * æ°å¢ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * å é¤ç©æåºå管ç |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsMaterialStorageManagementJobById(Long id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ç©æåºå管ç |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsMaterialStorageManagementJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * æ¹éæå
¥ç©æåºåæ°æ® |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public int insertApsMaterialStorageBatch(@Param("list") List<ApsMaterialStorageManagementJob> list); |
| | | |
| | | /** |
| | | * æ¹éæå
¥ç©æåºåæ°æ®å°ä¸å¡è¡¨ |
| | | * @return |
| | | */ |
| | | public void insertIntoApsMaterialStorage(); |
| | | |
| | | /** |
| | | * å é¤ç©æåºåæ°æ® |
| | | * @return |
| | | */ |
| | | public void deleteApsMaterialStorage(); |
| | | |
| | | /** |
| | | * å é¤ä¸é´è¡¨ç©æåºåæ°æ® |
| | | */ |
| | | public void deleteApsMaterialStorageJob(); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public boolean syncBomData(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList); |
| | | |
| | | /** |
| | | * 忥bomæ°æ®å®æ¶ä»»å¡ |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | public boolean syncBomDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service; |
| | | |
| | | import com.aps.job.domain.ApsMaterialStorageManagementJob; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç©æåºå管çServiceæ¥å£ |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | public interface IApsMaterialStorageManagementJobService |
| | | { |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管ç |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç©æåºå管ç |
| | | */ |
| | | public ApsMaterialStorageManagementJob selectApsMaterialStorageManagementJobById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管çå表 |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç©æåºå管çéå |
| | | */ |
| | | public List<ApsMaterialStorageManagementJob> selectApsMaterialStorageManagementJobList(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * æ°å¢ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * ä¿®æ¹ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob); |
| | | |
| | | /** |
| | | * æ¹éå é¤ç©æåºå管ç |
| | | * |
| | | * @param ids éè¦å é¤çç©æåºå管ç主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsMaterialStorageManagementJobByIds(Long[] ids); |
| | | |
| | | /** |
| | | * å é¤ç©æåºå管çä¿¡æ¯ |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsMaterialStorageManagementJobById(Long id); |
| | | |
| | | /** |
| | | * åæ¥ç©æåºåæ°æ® |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | public boolean syncApsMaterialStorageData(int pageIndex, int pageSize, String orgCode, String itemCodeList); |
| | | |
| | | /** |
| | | * 忥å
¨éç©æåºåæ°æ®å®æ¶ä»»å¡ |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | public boolean syncApsMaterialStorageDataJob(int pageIndex, int pageSize, String orgCode, String itemCodeList); |
| | | } |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private ApsBomLineJobMapper apsBomLineJobMapper; |
| | | |
| | | /** |
| | | * è·åè®¢åæ¥å£ |
| | | * */ |
| | | @Value("${u9.bomJobUrl}") |
| | | private String getBomUrl; |
| | | |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * å
¨é忥BOMæ°æ®å®æ¶ä»»å¡ |
| | | * @param pageIndex |
| | | * @param pageSize |
| | | * @param orgCode |
| | | * @param itemCodeList |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public boolean syncBomDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList){ |
| | | try { |
| | | apsBomHeaderJobMapper.deleteApsBomHeaderJob(); |
| | | apsBomLineJobMapper.deleteApsBomLineJob(); |
| | | boolean res = syncBomData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | apsBomHeaderJobMapper.deleteApsBomHeader(); |
| | | apsBomLineJobMapper.deleteApsBomLine(); |
| | | apsBomHeaderJobMapper.insertIntoApsBomHeader(); |
| | | apsBomLineJobMapper.insertIntoApsBomLine(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | return true; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.job.domain.ApsMaterialStorageManagementJob; |
| | | import com.aps.job.domain.ApsWorkOrderJobLog; |
| | | import com.aps.job.mapper.ApsMaterialStorageManagementJobMapper; |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsMaterialStorageManagementJobService; |
| | | 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; |
| | | |
| | | /** |
| | | * ç©æåºå管çServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Service |
| | | public class ApsMaterialStorageManagementJobServiceImpl implements IApsMaterialStorageManagementJobService |
| | | { |
| | | @Autowired |
| | | private ApsMaterialStorageManagementJobMapper apsMaterialStorageManagementJobMapper; |
| | | |
| | | @Value("${u9.materialStorageUrl}") |
| | | private String getMaterialStorageUrl; |
| | | |
| | | @Autowired |
| | | private ApsWorkOrderJobLogMapper jobLogMapper; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管ç |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç©æåºå管ç |
| | | */ |
| | | @Override |
| | | public ApsMaterialStorageManagementJob selectApsMaterialStorageManagementJobById(Long id) |
| | | { |
| | | return apsMaterialStorageManagementJobMapper.selectApsMaterialStorageManagementJobById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æåºå管çå表 |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç©æåºå管ç |
| | | */ |
| | | @Override |
| | | public List<ApsMaterialStorageManagementJob> selectApsMaterialStorageManagementJobList(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob) |
| | | { |
| | | return apsMaterialStorageManagementJobMapper.selectApsMaterialStorageManagementJobList(apsMaterialStorageManagementJob); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob) |
| | | { |
| | | apsMaterialStorageManagementJob.setCreateTime(DateUtils.getNowDate()); |
| | | return apsMaterialStorageManagementJobMapper.insertApsMaterialStorageManagementJob(apsMaterialStorageManagementJob); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç©æåºå管ç |
| | | * |
| | | * @param apsMaterialStorageManagementJob ç©æåºå管ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsMaterialStorageManagementJob(ApsMaterialStorageManagementJob apsMaterialStorageManagementJob) |
| | | { |
| | | apsMaterialStorageManagementJob.setUpdateTime(DateUtils.getNowDate()); |
| | | return apsMaterialStorageManagementJobMapper.updateApsMaterialStorageManagementJob(apsMaterialStorageManagementJob); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ç©æåºå管ç |
| | | * |
| | | * @param ids éè¦å é¤çç©æåºå管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsMaterialStorageManagementJobByIds(Long[] ids) |
| | | { |
| | | return apsMaterialStorageManagementJobMapper.deleteApsMaterialStorageManagementJobByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç©æåºå管çä¿¡æ¯ |
| | | * |
| | | * @param id ç©æåºå管çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsMaterialStorageManagementJobById(Long id) |
| | | { |
| | | return apsMaterialStorageManagementJobMapper.deleteApsMaterialStorageManagementJobById(id); |
| | | } |
| | | |
| | | @Override |
| | | public boolean syncApsMaterialStorageData(int pageIndex, int pageSize, String orgCode, String itemCodeList) { |
| | | JSONObject requestBody = new JSONObject(); |
| | | ResponseEntity<String> response = null; |
| | | ApsWorkOrderJobLog jobLog = new ApsWorkOrderJobLog(); |
| | | try { |
| | | // 设置请æ±å¤´ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | // 设置请æ±ä½ |
| | | while (true) { |
| | | 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(getMaterialStorageUrl, 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<ApsMaterialStorageManagementJob> storageList = new ArrayList<>(); |
| | | for (Object o : jsonArray) { |
| | | JSONObject storage = (JSONObject) o; |
| | | ApsMaterialStorageManagementJob materialStorage = new ApsMaterialStorageManagementJob(); |
| | | materialStorage.setId(IdUtil.getSnowflakeNextId()); |
| | | materialStorage.setItemNumber(storage.getString("ItemCode")); |
| | | materialStorage.setNum(storage.getBigDecimal("StoreQty")); |
| | | materialStorage.setApplicableFactories(storage.getString("OrgCode")); |
| | | storageList.add(materialStorage); |
| | | } |
| | | List<ApsMaterialStorageManagementJob> temp = new ArrayList<>(); |
| | | for(int i=0;i<storageList.size();i++){ |
| | | temp.add(storageList.get(i)); |
| | | if(temp.size()>=20){ |
| | | apsMaterialStorageManagementJobMapper.insertApsMaterialStorageBatch(temp); |
| | | temp = new ArrayList<>(); |
| | | } |
| | | } |
| | | jobLog.setRequestData(requestBody.toJSONString()); |
| | | jobLog.setPageNum(Long.valueOf(pageIndex)); |
| | | jobLog.setPageCount(Long.valueOf(pageSize)); |
| | | jobLog.setCreateTime(DateUtils.getNowDate()); |
| | | jobLog.setBizType("storage"); |
| | | jobLog.setResult("storage:"+storageList.size()); |
| | | 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("storage"); |
| | | jobLog.setResult("error"); |
| | | 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("storage"); |
| | | jobLog.setResult("error"); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public boolean syncApsMaterialStorageDataJob(int pageIndex, int pageSize, String orgCode, String itemCodeList) { |
| | | try { |
| | | apsMaterialStorageManagementJobMapper.deleteApsMaterialStorageJob(); |
| | | boolean res = syncApsMaterialStorageData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | apsMaterialStorageManagementJobMapper.deleteApsMaterialStorage(); |
| | | apsMaterialStorageManagementJobMapper.insertIntoApsMaterialStorage(); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.aps.job.task; |
| | | |
| | | 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.system.api.RemoteCoreService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IApsWorkOrderJobService iApsWorkOrderJobService; |
| | | |
| | | @Autowired |
| | | private IApsBomHeaderJobService iApsBomHeaderJobService; |
| | | |
| | | @Autowired |
| | | private RemoteCoreService remoteCoreService; |
| | | |
| | | @Autowired |
| | | private IApsMaterialStorageManagementJobService apsMaterialStorageManagementJobService; |
| | | |
| | | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) |
| | | { |
| | |
| | | iApsWorkOrderJobService.syncGasPipingData(); |
| | | iApsWorkOrderProcessService.syncProcessRouteData(); |
| | | } |
| | | |
| | | /** |
| | | * 忥å
¨éBOMæ°æ®å®æ¶ä»»å¡ |
| | | */ |
| | | public void syncBomDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) |
| | | { |
| | | boolean res = iApsBomHeaderJobService.syncBomDataJob(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(res){ |
| | | remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 忥å
¨éåºåæ°æ®å®æ¶ä»»å¡ |
| | | */ |
| | | public void syncApsMaterialStorageDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) |
| | | { |
| | | apsMaterialStorageManagementJobService.syncApsMaterialStorageDataJob(pageIndex, pageSize, orgCode, itemCodeList); |
| | | } |
| | | } |
| | |
| | | FROM aps_bom_header_job |
| | | </insert> |
| | | |
| | | <!-- å é¤ aps_process_route 表ä¸çæ°æ® --> |
| | | <!-- å é¤ aps_bom_header 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsBomHeader"> |
| | | DELETE FROM aps_bom_header |
| | | </delete> |
| | | |
| | | <!-- å é¤ aps_bom_header_job 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsBomHeaderJob"> |
| | | DELETE FROM aps_bom_header_job |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | FROM aps_bom_line_job |
| | | </insert> |
| | | |
| | | <!-- å é¤ aps_process_route 表ä¸çæ°æ® --> |
| | | <!-- å é¤ aps_bom_line 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsBomLine"> |
| | | DELETE FROM aps_bom_line |
| | | </delete> |
| | | |
| | | <!-- å é¤ aps_bom_line_job 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsBomLineJob"> |
| | | DELETE FROM aps_bom_line_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.ApsMaterialStorageManagementJobMapper"> |
| | | |
| | | <resultMap type="ApsMaterialStorageManagementJob" id="ApsMaterialStorageManagementJobResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="itemNumber" column="item_number" /> |
| | | <result property="num" column="num" /> |
| | | <result property="applicableFactories" column="applicable_factories" /> |
| | | <result property="integrationDate" column="integration_date" /> |
| | | <result property="refreshDate" column="refresh_date" /> |
| | | <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="remainderStock" column="remainder_stock" /> |
| | | <result property="version" column="version" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsMaterialStorageManagementJobVo"> |
| | | select id, item_number, num, applicable_factories, integration_date, refresh_date, create_by, create_time, update_by, update_time, remainder_stock, version from aps_material_storage_management_job |
| | | </sql> |
| | | |
| | | <select id="selectApsMaterialStorageManagementJobList" parameterType="ApsMaterialStorageManagementJob" resultMap="ApsMaterialStorageManagementJobResult"> |
| | | <include refid="selectApsMaterialStorageManagementJobVo"/> |
| | | <where> |
| | | <if test="itemNumber != null and itemNumber != ''"> and item_number = #{itemNumber}</if> |
| | | <if test="num != null "> and num = #{num}</if> |
| | | <if test="applicableFactories != null and applicableFactories != ''"> and applicable_factories = #{applicableFactories}</if> |
| | | <if test="integrationDate != null "> and integration_date = #{integrationDate}</if> |
| | | <if test="refreshDate != null "> and refresh_date = #{refreshDate}</if> |
| | | <if test="remainderStock != null "> and remainder_stock = #{remainderStock}</if> |
| | | <if test="version != null "> and version = #{version}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectApsMaterialStorageManagementJobById" parameterType="Long" resultMap="ApsMaterialStorageManagementJobResult"> |
| | | <include refid="selectApsMaterialStorageManagementJobVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsMaterialStorageManagementJob" parameterType="ApsMaterialStorageManagementJob"> |
| | | insert into aps_material_storage_management_job |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="itemNumber != null">item_number,</if> |
| | | <if test="num != null">num,</if> |
| | | <if test="applicableFactories != null">applicable_factories,</if> |
| | | <if test="integrationDate != null">integration_date,</if> |
| | | <if test="refreshDate != null">refresh_date,</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="remainderStock != null">remainder_stock,</if> |
| | | <if test="version != null">version,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="itemNumber != null">#{itemNumber},</if> |
| | | <if test="num != null">#{num},</if> |
| | | <if test="applicableFactories != null">#{applicableFactories},</if> |
| | | <if test="integrationDate != null">#{integrationDate},</if> |
| | | <if test="refreshDate != null">#{refreshDate},</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="remainderStock != null">#{remainderStock},</if> |
| | | <if test="version != null">#{version},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateApsMaterialStorageManagementJob" parameterType="ApsMaterialStorageManagementJob"> |
| | | update aps_material_storage_management_job |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="itemNumber != null">item_number = #{itemNumber},</if> |
| | | <if test="num != null">num = #{num},</if> |
| | | <if test="applicableFactories != null">applicable_factories = #{applicableFactories},</if> |
| | | <if test="integrationDate != null">integration_date = #{integrationDate},</if> |
| | | <if test="refreshDate != null">refresh_date = #{refreshDate},</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="remainderStock != null">remainder_stock = #{remainderStock},</if> |
| | | <if test="version != null">version = #{version},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteApsMaterialStorageManagementJobById" parameterType="Long"> |
| | | delete from aps_material_storage_management_job where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteApsMaterialStorageManagementJobByIds" parameterType="String"> |
| | | delete from aps_material_storage_management_job where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <insert id="insertApsMaterialStorageBatch"> |
| | | INSERT INTO aps_material_storage_management_job ( |
| | | id, |
| | | item_number, |
| | | num, |
| | | applicable_factories, |
| | | create_time |
| | | ) VALUES |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.id}, |
| | | #{item.itemNumber}, |
| | | #{item.num}, |
| | | #{item.applicableFactories}, |
| | | now() |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <!-- æå
¥æ°æ®å° aps_material_storage_management --> |
| | | <insert id="insertIntoApsMaterialStorage"> |
| | | INSERT INTO aps_material_storage_management ( |
| | | id, |
| | | item_number, |
| | | num, |
| | | applicable_factories, |
| | | create_time |
| | | ) |
| | | SELECT |
| | | id, |
| | | item_number, |
| | | num, |
| | | applicable_factories, |
| | | now() |
| | | FROM aps_material_storage_management_job |
| | | </insert> |
| | | |
| | | <!-- å é¤ aps_material_storage_management 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsMaterialStorage"> |
| | | DELETE FROM aps_material_storage_management |
| | | </delete> |
| | | |
| | | <!-- å é¤ aps_material_storage_management_job 表ä¸çæ°æ® --> |
| | | <delete id="deleteApsMaterialStorageJob"> |
| | | DELETE FROM aps_material_storage_management_job |
| | | </delete> |
| | | |
| | | </mapper> |