Merge branch 'dev' of http://192.168.50.149:8085/r/aps-backend into dev
| | |
| | | @Excel(name = "当前工序名称") |
| | | private String stdOp; |
| | | |
| | | /** 工单创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // @Excel(name = "工单创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date orderCreateTime; |
| | | |
| | | /** 工单审核时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // @Excel(name = "工单审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date approveOn; |
| | | |
| | | /** 工单开工时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // @Excel(name = "工单开工时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date startWorkDate; |
| | | |
| | | /** 低阶码*/ |
| | | private String lowOrderCode; |
| | | |
| | | public Date getOrderCreateTime() { |
| | | return orderCreateTime; |
| | | } |
| | | |
| | | public void setOrderCreateTime(Date orderCreateTime) { |
| | | this.orderCreateTime = orderCreateTime; |
| | | } |
| | | |
| | | public Date getApproveOn() { |
| | | return approveOn; |
| | | } |
| | | |
| | | public void setApproveOn(Date approveOn) { |
| | | this.approveOn = approveOn; |
| | | } |
| | | |
| | | public Date getStartWorkDate() { |
| | | return startWorkDate; |
| | | } |
| | | |
| | | public void setStartWorkDate(Date startWorkDate) { |
| | | this.startWorkDate = startWorkDate; |
| | | } |
| | | |
| | | public String getLowOrderCode() { |
| | | return lowOrderCode; |
| | | } |
| | | |
| | | public void setLowOrderCode(String lowOrderCode) { |
| | | this.lowOrderCode = lowOrderCode; |
| | | } |
| | | |
| | | public String getStdOp() { |
| | | return stdOp; |
| | | } |
| | |
| | | List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant,String professionalAffiliation); |
| | | |
| | | /** |
| | | * 获取未匹配的子计划 |
| | | * 获取一条未匹配的子计划 |
| | | * */ |
| | | ApsPlatePlan selectUnMatchPlateSubPlan(String plant,String itemNumber); |
| | | |
| | |
| | | * 初始化 子件工单的 未匹配数量 |
| | | * */ |
| | | int initUnMatchQty(); |
| | | /** |
| | | * 获取未匹配的子计划 |
| | | * */ |
| | | List<ApsPlatePlan> selectUnMatchPlateSubPlanList(String plant,String itemNumber); |
| | | |
| | | /** |
| | | * 更新子件工单未匹配数量和版本 |
| | | * */ |
| | | int updatePlanUnMatchQtyAndVersion(ApsPlatePlan plan); |
| | | } |
| | |
| | | |
| | | Optional<ApsMaterialStorageManagement> getItemStorage(String plant, String itemNumber); |
| | | |
| | | ApsMaterialStorageManagement getRdsStorage(String plant, String itemCode); |
| | | Optional<ApsMaterialStorageManagement> getRdsStorage(String plant, String itemCode); |
| | | |
| | | |
| | | /** |
| | |
| | | import com.aps.core.domain.ApsPlatePlanTemp; |
| | | import com.aps.core.domain.ApsPlateStandardRequire; |
| | | |
| | | import java.util.Hashtable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public List<ApsPlatePlan> selectPlateRedundantOrderList(ApsPlatePlan apsPlatePlan); |
| | | |
| | | // ApsPlatePlan selectUnMatchPlateSubPlan(ApsPlateStandardRequire require); |
| | | ApsPlatePlan selectUnMatchPlateSubPlan(String plant, String itemNumber, Hashtable<String, List<ApsPlatePlan>> subPlans); |
| | | |
| | | // ApsPlatePlan selectUnMatchPlateSubPlan(ApsPlateStandardRequire require); |
| | | } |
| | |
| | | * @return ApsMaterialStorageManagement 返回获取到的库存信息对象,如果没有找到,则返回null |
| | | */ |
| | | @Override |
| | | public ApsMaterialStorageManagement getRdsStorage(String plant, String itemCode){ |
| | | ApsMaterialStorageManagement ams=null; |
| | | public Optional<ApsMaterialStorageManagement> getRdsStorage(String plant, String itemCode){ |
| | | // 尝试从Redis中获取库存信息 |
| | | JSONObject materialStorage = (JSONObject)redisTemplate.opsForValue().get("MaterialStorage:Material_"+plant+"_"+itemCode); |
| | | String key = "MaterialStorage:Material_" + plant + "_" + itemCode; |
| | | JSONObject materialStorage = (JSONObject)redisTemplate.opsForValue().get(key); |
| | | if(materialStorage!=null){ |
| | | // 如果Redis中有缓存,将其转换为ApsMaterialStorageManagement对象并返回 |
| | | ams = materialStorage.toJavaObject(ApsMaterialStorageManagement.class); |
| | | return ams; |
| | | ApsMaterialStorageManagement ams= materialStorage.toJavaObject(ApsMaterialStorageManagement.class); |
| | | Optional<ApsMaterialStorageManagement> optional = Optional.ofNullable(ams); |
| | | return optional ; |
| | | }else { |
| | | // 如果Redis中没有缓存,创建查询参数对象 |
| | | ApsMaterialStorageManagement storageParam = new ApsMaterialStorageManagement(); |
| | | storageParam.setItemNumber(itemCode); |
| | | storageParam.setApplicableFactories(plant); |
| | | // 从数据库中查询库存信息 |
| | | Optional<ApsMaterialStorageManagement> first = apsMaterialStorageManagementMapper.selectApsMaterialStorageManagementList(storageParam).stream() |
| | | .findFirst(); |
| | | if (first.isPresent()){ |
| | | // 如果查询到库存信息,将其缓存到Redis中 |
| | | ams = first.get(); |
| | | redisTemplate.opsForValue().set("MaterialStorage:Material_"+plant+"_"+itemCode,JSONObject.parseObject(JSON.toJSONString(ams))); |
| | | } |
| | | Optional<ApsMaterialStorageManagement> first = getItemStorage( plant, itemCode); |
| | | first.ifPresent(apsMaterialStorageManagement -> |
| | | redisTemplate.opsForValue().set(key, JSONObject.parseObject(JSON.toJSONString(apsMaterialStorageManagement))) |
| | | ); |
| | | return first; |
| | | } |
| | | // 返回库存信息对象 |
| | | return ams; |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.core.domain.ApsMaterialStorageManagement; |
| | | import com.aps.core.domain.ApsPlatePlan; |
| | | import com.aps.core.domain.ApsPlatePlanTemp; |
| | | import com.aps.core.domain.ApsPlateStandardRequire; |
| | | import com.aps.core.mapper.ApsPartPlanTempMapper; |
| | | import com.aps.core.mapper.ApsPlatePlanMapper; |
| | | import com.aps.core.mapper.ApsPlatePlanTempMapper; |
| | |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Hashtable; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | |
| | | public List<ApsPlatePlan> selectPlateRedundantOrderList(ApsPlatePlan apsPlatePlan) { |
| | | return apsPlatePlanMapper.selectPlateRedundantOrderList(apsPlatePlan); |
| | | } |
| | | |
| | | @Override |
| | | public ApsPlatePlan selectUnMatchPlateSubPlan(String plant, String itemNumber, Hashtable<String, List<ApsPlatePlan>> subPlans) { |
| | | if(subPlans.containsKey(itemNumber)) { |
| | | List<ApsPlatePlan> subPlanList = subPlans.get(itemNumber); |
| | | Optional<ApsPlatePlan> firstPlant = subPlanList.stream().filter(x -> x.getUnmatchedQuantity().compareTo(BigDecimal.ZERO) > 0).findFirst(); |
| | | return firstPlant.orElse(null); |
| | | }else { |
| | | List<ApsPlatePlan> plans = apsPlatePlanMapper.selectUnMatchPlateSubPlanList(plant, itemNumber); |
| | | if (!plans.isEmpty()) { |
| | | subPlans.put(itemNumber, plans); |
| | | return selectUnMatchPlateSubPlan(plant, itemNumber, subPlans); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | public void savePlastPlanAndBomOrderDetail(ApsPlateStandardRequire require, ApsPlatePlan platePlan, BigDecimal subtract |
| | | , BigDecimal stock, BigDecimal netRequirement, List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList) { |
| | | platePlan.setUnmatchedQuantity(subtract); |
| | | apsPlatePlanMapper.updatePlanUnMatchQtyByVersion(platePlan); |
| | | // apsPlatePlanMapper.updatePlanUnMatchQtyByVersion(platePlan); |
| | | /* 记录工单与净需求的匹配关系*/ |
| | | ApsPlateStandardRequireBomOrderDetail bomOrderDetail = ApsPlateStandardRequireBomOrderDetail.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | |
| | | bomOrderDetail.setCreateBy(SecurityUtils.getUsername()); |
| | | |
| | | orderDetailsList.add(bomOrderDetail); |
| | | apsPlateStandardRequireBomOrderDetailMapper.insertApsPlateStandardRequireBomOrderDetail(bomOrderDetail); |
| | | //apsPlateStandardRequireBomOrderDetailMapper.insertApsPlateStandardRequireBomOrderDetail(bomOrderDetail); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ,List<ApsPlateStandardRequireBomStockDetail> stockDetailsList){ |
| | | |
| | | |
| | | itemStorageMapper.updateMaterialStorageByVersion(itemStorage.getId(), afterStockAmount,itemStorage.getVersion()); |
| | | //itemStorageMapper.updateMaterialStorageByVersion(itemStorage.getId(), afterStockAmount,itemStorage.getVersion()); |
| | | /*记录扣减明细*/ |
| | | ApsPlateStandardRequireBomStockDetail bomStockDetail = ApsPlateStandardRequireBomStockDetail.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | |
| | | bomStockDetail.setCreateTime(DateUtils.getNowDate()); |
| | | |
| | | stockDetailsList.add(bomStockDetail); |
| | | plateBomStockDetailMapper.insertApsPlateStandardRequireBomStockDetail(bomStockDetail); |
| | | // plateBomStockDetailMapper.insertApsPlateStandardRequireBomStockDetail(bomStockDetail); |
| | | /*更新内存中物料剩余库存*/ |
| | | /*itemStorage.setRemainderStock(afterStockAmount); |
| | | itemStorage.setRemainderStock(afterStockAmount); |
| | | if(null== itemStorage.getVersion()){ |
| | | itemStorage.setVersion(1); |
| | | }else{ |
| | | itemStorage.setVersion(itemStorage.getVersion()+1); |
| | | }*/ |
| | | } |
| | | } |
| | | } |
| | |
| | | ApsPlateStandardRequireBomOrderDetailMapper plateBomOrderDetailMapper; |
| | | |
| | | @Autowired |
| | | private ApsPlatePlanMapper apsPlatePlanMapper; |
| | | private IApsPlatePlanService apsPlatePlanService; |
| | | |
| | | @Resource |
| | | IApsPlateStandardRequireBomOrderDetailService bomOrderDetailService; |
| | |
| | | String batchNum= requireBatchService.getNewBatchNumber(); |
| | | /*获取钣金主单信息*/ |
| | | List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode,mainOrderType); |
| | | Hashtable<String, BigDecimal> usedStorage = new Hashtable<>(); |
| | | Hashtable<String, ApsMaterialStorageManagement> usedStorage = new Hashtable<>(); |
| | | /*内存中存储子件工单*/ |
| | | Hashtable<String, List<ApsPlatePlan>> subPlans = new Hashtable<>(); |
| | | log.info("开始生成需求:"); |
| | | for (ApsPlatePlan mainPlan : mainPlans) { |
| | | String itemNumber = mainPlan.getItemNumber(); |
| | | /*根据料号 获取BOM Header */ |
| | | /*当前Bom节点处理完成后,处理下级BOM*/ |
| | | |
| | | |
| | | List<ApsPlateStandardRequire> requiresList=new ArrayList<>(); |
| | | List<ApsPlateStandardRequireBomStockDetail> stockDetailsList=new ArrayList<>(); |
| | | List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList=new ArrayList<>(); |
| | | |
| | | |
| | | log.info("开始生成需求:工单号:"+mainPlan.getDocumentNumber()); |
| | | /*当前Bom节点处理完成后,处理下级BOM*/ |
| | | getBomRequires(plantCode, "0","0",itemNumber,BigDecimal.ONE, batchNum, null |
| | | , mainPlan, requiresList, 0L,stockDetailsList,orderDetailsList,usedStorage |
| | | , mainPlan, requiresList, 0L,stockDetailsList,orderDetailsList,usedStorage,subPlans |
| | | ); |
| | | |
| | | // 批量插入以提高性能 |
| | |
| | | apsPlateStandardRequireMapper.batchInsert(batch); |
| | | } |
| | | } |
| | | log.info("生成完成"); |
| | | // if(!stockDetailsList.isEmpty()){ |
| | | // int batchSize = 1000; |
| | | // stockDetailsList.forEach(x->x.setId(IdUtil.getSnowflakeNextId())); |
| | | // for (int i = 0; i < stockDetailsList.size(); i += batchSize) { |
| | | // int end = Math.min(i + batchSize, stockDetailsList.size()); |
| | | // List<ApsPlateStandardRequireBomStockDetail> batch = stockDetailsList.subList(i, end); |
| | | // plateBomStockDetailMapper.batchInsert(batch); |
| | | // } |
| | | // } |
| | | // |
| | | // if(!orderDetailsList.isEmpty()){ |
| | | // int batchSize = 1000; |
| | | // orderDetailsList.forEach(x->x.setId(IdUtil.getSnowflakeNextId())); |
| | | // for (int i = 0; i < orderDetailsList.size(); i += batchSize) { |
| | | // int end = Math.min(i + batchSize, orderDetailsList.size()); |
| | | // List<ApsPlateStandardRequireBomOrderDetail> batch = orderDetailsList.subList(i, end); |
| | | // plateBomOrderDetailMapper.batchInsert(batch); |
| | | // } |
| | | // } |
| | | /*集中保存库存信息*/ |
| | | /* if(!usedStorage.isEmpty()){ |
| | | usedStorage.forEach((key, sm) -> { |
| | | storageManagementService.updateRemainderStock(sm.getId(),sm.getRemainderStock(),sm.getVersion()); |
| | | }); |
| | | }*/ |
| | | |
| | | if(!stockDetailsList.isEmpty()){ |
| | | int batchSize = 1000; |
| | | stockDetailsList.forEach(x->x.setId(IdUtil.getSnowflakeNextId())); |
| | | for (int i = 0; i < stockDetailsList.size(); i += batchSize) { |
| | | int end = Math.min(i + batchSize, stockDetailsList.size()); |
| | | List<ApsPlateStandardRequireBomStockDetail> batch = stockDetailsList.subList(i, end); |
| | | plateBomStockDetailMapper.batchInsert(batch); |
| | | } |
| | | } |
| | | if(!orderDetailsList.isEmpty()){ |
| | | int batchSize = 1000; |
| | | orderDetailsList.forEach(x->x.setId(IdUtil.getSnowflakeNextId())); |
| | | for (int i = 0; i < orderDetailsList.size(); i += batchSize) { |
| | | int end = Math.min(i + batchSize, orderDetailsList.size()); |
| | | List<ApsPlateStandardRequireBomOrderDetail> batch = orderDetailsList.subList(i, end); |
| | | plateBomOrderDetailMapper.batchInsert(batch); |
| | | } |
| | | } |
| | | } |
| | | usedStorage.forEach((key,value)->{ |
| | | log.info("料号:"+key+",库存:"+value); |
| | | }); |
| | | |
| | | /*集中保存库存信息*/ |
| | | if(!usedStorage.isEmpty()){ |
| | | usedStorage.forEach((key, sm) -> { |
| | | storageManagementService.updateRemainderStock(sm.getId(),sm.getRemainderStock(),sm.getVersion()); |
| | | }); |
| | | } |
| | | if(!subPlans.isEmpty()){ |
| | | subPlans.forEach((key, subPlansList) -> { |
| | | subPlansList.forEach(x->{ |
| | | if (!x.getUnmatchedQuantity().equals(x.getProductionQuantity())){ |
| | | platePlanMapper.updatePlanUnMatchQtyAndVersion(x); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | List<ApsPlateStandardRequire> allRequires, |
| | | Long level,List<ApsPlateStandardRequireBomStockDetail> stockDetailsList, |
| | | List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList, |
| | | Hashtable<String, BigDecimal> usedStorage |
| | | Hashtable<String, ApsMaterialStorageManagement> usedStorage, |
| | | Hashtable<String, List<ApsPlatePlan>> subPlans |
| | | ) { |
| | | /*构建需求信息*/ |
| | | ApsPlateStandardRequire require = new ApsPlateStandardRequire(); |
| | |
| | | /*默认净需求为BOM用量*/ |
| | | require.setNetRequirement(require.getRequireAmount()); |
| | | |
| | | |
| | | /*读取库存信息的优先级-> 内存、redis、db*/ |
| | | /* ApsMaterialStorageManagement storage = usedStorage.get(itemCode); |
| | | if(storage==null){ |
| | | storage = storageManagementService.getRdsStorage(plant, itemCode); |
| | | if(storage!=null){ |
| | | *//*剩余库存*//* |
| | | remainderStock = storage.getRemainderStock(); |
| | | } |
| | | }*/ |
| | | Optional<ApsMaterialStorageManagement> itemStorageOpt = storageManagementService.getItemStorage(plant, itemCode); |
| | | Optional<ApsMaterialStorageManagement> itemStorageOpt = Optional.ofNullable(usedStorage.get(itemCode)) ; |
| | | if(itemStorageOpt.isEmpty()){ |
| | | itemStorageOpt = storageManagementService.getRdsStorage(plant, itemCode); |
| | | } |
| | | if (itemStorageOpt.isPresent()) { |
| | | |
| | | ApsMaterialStorageManagement itemStorage=itemStorageOpt.get(); |
| | | BigDecimal remainderStock =itemStorage.getRemainderStock(); |
| | | /*计算净需求 默认=需求数量*/ |
| | |
| | | , afterStockAmount, require.getId(), stockDetailsList |
| | | ); |
| | | /*更新内存中的库存使用信息*/ |
| | | usedStorage.put(itemCode, afterStockAmount); |
| | | usedStorage.put(itemCode, itemStorage); |
| | | } |
| | | } |
| | | /*未匹配数量,默认为净需求*/ |
| | |
| | | if (require.getNetRequirement().compareTo(BigDecimal.ZERO) > 0) { |
| | | require.setMatchMode("工单匹配"); |
| | | /*使用子件工单进行需求匹配*/ |
| | | matchRequireAndSubPlan(require,orderDetailsList); |
| | | matchRequireAndSubPlan(require,orderDetailsList,subPlans); |
| | | } |
| | | allRequires.add(require); |
| | | log.info("已生成需求:"+plan.getDocumentNumber()+"bomHeaderCode:"+bomHeaderCode+"bomLineCode:"+itemCode+"bomLevel:"+level); |
| | |
| | | bomLineList.forEach(line -> { |
| | | getBomRequires(plant, itemCode, line.getBomLineId(),line.getItemCode() ,line.getNum() , batchNum |
| | | , require.getStartDate(), plan, allRequires, nextLevel,stockDetailsList |
| | | ,orderDetailsList,usedStorage |
| | | ,orderDetailsList,usedStorage,subPlans |
| | | ); |
| | | }); |
| | | } |
| | |
| | | * 使用子件工单匹配需求中的净需求 |
| | | * */ |
| | | |
| | | private void matchRequireAndSubPlan(ApsPlateStandardRequire require, List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList) { |
| | | private void matchRequireAndSubPlan(ApsPlateStandardRequire require, List<ApsPlateStandardRequireBomOrderDetail> orderDetailsList,Hashtable<String, List<ApsPlatePlan>> subPlans) { |
| | | BigDecimal netRequirement = require.getNetRequirement(); |
| | | require.setMatchMode("工单匹配"); |
| | | require.setMatchState("已匹配"); |
| | | if (netRequirement.compareTo(BigDecimal.ZERO) > 0) { |
| | | ApsPlatePlan platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode()); |
| | | ApsPlatePlan platePlan = apsPlatePlanService.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode(),subPlans); |
| | | /*子件工单的未匹配数量 作为当前的库存*/ |
| | | while (platePlan != null && netRequirement.compareTo(BigDecimal.ZERO) > 0) { |
| | | BigDecimal stock = platePlan.getUnmatchedQuantity(); |
| | |
| | | /* 库存数量 大于 净需求数量*/ |
| | | /* 净需求数量=0 ,子件工单未匹配数量= 库存-净需求*/ |
| | | BigDecimal subtract = stock.subtract(netRequirement); |
| | | platePlan.setUnmatchedQuantity(subtract); |
| | | platePlan.setVersion(platePlan.getVersion() + 1); |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement,orderDetailsList); |
| | | netRequirement = BigDecimal.ZERO; |
| | | |
| | |
| | | /*净需求数量 == 库存数量*/ |
| | | |
| | | BigDecimal subtract = BigDecimal.ZERO; |
| | | platePlan.setUnmatchedQuantity(subtract); |
| | | platePlan.setVersion(platePlan.getVersion() + 1); |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement,orderDetailsList); |
| | | netRequirement = BigDecimal.ZERO; |
| | | |
| | |
| | | /*需求大于库存*/ |
| | | /*净需求 被部分满足 */ |
| | | BigDecimal rest = netRequirement.subtract(stock); |
| | | |
| | | platePlan.setUnmatchedQuantity(BigDecimal.ZERO); |
| | | platePlan.setVersion(platePlan.getVersion() + 1); |
| | | /*工单 未匹配数量为0 全部用于匹配需求*/ |
| | | bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, BigDecimal.ZERO, stock, netRequirement,orderDetailsList); |
| | | /*净需求未被满足,需要继续匹配*/ |
| | | platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode()); |
| | | platePlan = apsPlatePlanService.selectUnMatchPlateSubPlan(require.getOrgCode(), require.getBomLineCode(),subPlans); |
| | | /*剩余净需求*/ |
| | | netRequirement = rest; |
| | | require.setUnmatchedDemandAmount(rest); |
| | |
| | | ret.setRouteTime(totalRouteTime.multiply(netRequirement)); |
| | | return ret; |
| | | } else { |
| | | // 查询标准工艺路线头部信息 |
| | | saveRequireError(require,"标准工艺路线不存在"); |
| | | /*// 查询标准工艺路线头部信息 |
| | | Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemCode).stream().findFirst(); |
| | | if (firstProcessRoute.isPresent()) { |
| | | ApsStandardProcessRouteHeader routeHeader = firstProcessRoute.get(); |
| | |
| | | // 计算返回的数据 |
| | | ret.setRouteTime(totalRouteTime); |
| | | ret.setRouteId(routeHeader.getRouteId()); |
| | | /*存储至Redis*/ |
| | | *//*存储至Redis*//* |
| | | redisTemplate.opsForValue().set(key, standardTime); |
| | | }else { |
| | | saveRequireError(require,"标准工艺路线不存在"); |
| | | } |
| | | }*/ |
| | | return ret; |
| | | } |
| | | } |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.aps.core.mapper.ApsAbnormalProcessAnalysisMapper"> |
| | | |
| | | <resultMap type="ApsAbnormalProcessAnalysis" id="ApsAbnormalProcessAnalysisResult"> |
| | | <resultMap type="com.aps.core.domain.ApsAbnormalProcessAnalysis" id="ApsAbnormalProcessAnalysisResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="processName" column="process_name" /> |
| | | <result property="source" column="source" /> |
| | |
| | | select id, process_name, source, summary, create_time, del_flag, create_by from aps_abnormal_process_analysis |
| | | </sql> |
| | | |
| | | <select id="selectApsAbnormalProcessAnalysisList" parameterType="ApsAbnormalProcessAnalysis" resultMap="ApsAbnormalProcessAnalysisResult"> |
| | | <select id="selectApsAbnormalProcessAnalysisList" parameterType="com.aps.core.domain.ApsAbnormalProcessAnalysis" resultMap="ApsAbnormalProcessAnalysisResult"> |
| | | <include refid="selectApsAbnormalProcessAnalysisVo"/> |
| | | <where> |
| | | and del_flag = '0' |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsAbnormalProcessAnalysis" parameterType="ApsAbnormalProcessAnalysis" useGeneratedKeys="true" keyProperty="id"> |
| | | <insert id="insertApsAbnormalProcessAnalysis" parameterType="com.aps.core.domain.ApsAbnormalProcessAnalysis" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into aps_abnormal_process_analysis |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="processName != null">process_name,</if> |
| | |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateApsAbnormalProcessAnalysis" parameterType="ApsAbnormalProcessAnalysis"> |
| | | <update id="updateApsAbnormalProcessAnalysis" parameterType="com.aps.core.domain.ApsAbnormalProcessAnalysis"> |
| | | update aps_abnormal_process_analysis |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="processName != null">process_name = #{processName},</if> |
| | |
| | | order by resource_group_name; |
| | | </select> |
| | | <!--批量插入信息--> |
| | | <insert id="batchSaveAbnormalInfo" parameterType="ApsAbnormalProcessAnalysis"> |
| | | <insert id="batchSaveAbnormalInfo" parameterType="com.aps.core.domain.ApsAbnormalProcessAnalysis"> |
| | | insert into aps_abnormal_process_analysis(process_name,source,summary,create_time,del_flag,create_by) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | |
| | | <result property="planType" column="plan_type" /> |
| | | <result property="opStatus" column="op_status" /> |
| | | <result property="nextOpName" column="next_op_name" /> |
| | | <result property="orderCreateTime" column="order_create_time" /> |
| | | <result property="approveOn" column="approve_on" /> |
| | | <result property="startWorkDate" column="start_work_date" /> |
| | | <result property="lowOrderCode" column="low_order_code" /> |
| | | <!-- <collection property="apsProcessRoutes" javaType="java.util.ArrayList" ofType="com.aps.core.domain.ApsProcessRoute">--> |
| | | <!-- <result property="id" column="id" />--> |
| | | <!-- <result property="itemNo" column="item_no" />--> |
| | |
| | | department, plan_start_day, plan_end_day, standby_number, standby_name, standby_stock, |
| | | next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials, |
| | | advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete, |
| | | has_turnback, has_risk ,plan_type, op_status, next_op_name |
| | | has_turnback, has_risk ,plan_type, op_status, next_op_name, order_create_time, approve_on, start_work_date, low_order_code |
| | | from aps_gas_piping_plan |
| | | </sql> |
| | | |
| | |
| | | <if test="hasTurnback != null "> and has_turnback = #{hasTurnback}</if> |
| | | <if test="hasRisk != null "> and has_risk = #{hasRisk}</if> |
| | | <if test="planType != null "> and plan_type = #{planType}</if> |
| | | <if test="opStatus != null "> and op_status = #{opStatus}</if> |
| | | <if test="nextOpName != null "> and next_op_name = #{nextOpName}</if> |
| | | <if test="opStatus != null "> and op_status = #{opStatus}</if> |
| | | <if test="nextOpName != null "> and next_op_name = #{nextOpName}</if> |
| | | and del_flag ='0' |
| | | </where> |
| | | </select> |
| | |
| | | <if test="planType != null">plan_type,</if> |
| | | <if test="opStatus != null">op_status,</if> |
| | | <if test="nextOpName != null">next_op_name,</if> |
| | | <if test="orderCreateTime != null">order_create_time,</if> |
| | | <if test="approveOn != null">approve_on,</if> |
| | | <if test="startWorkDate != null">start_work_date,</if> |
| | | <if test="lowOrderCode != null">low_order_code,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | |
| | | <if test="planType != null">#{planType},</if> |
| | | <if test="opStatus != null">#{opStatus},</if> |
| | | <if test="nextOpName != null">#{nextOpName},</if> |
| | | <if test="orderCreateTime != null">#{orderCreateTime},</if> |
| | | <if test="approveOn != null">#{approveOn},</if> |
| | | <if test="startWorkDate != null">#{startWorkDate},</if> |
| | | <if test="lowOrderCode != null">#{lowOrderCode},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="planType != null">plan_type = #{planType},</if> |
| | | <if test="opStatus != null">op_status = #{opStatus},</if> |
| | | <if test="nextOpName != null">next_op_name = #{nextOpName},</if> |
| | | <if test="orderCreateTime != null">order_create_time = #{orderCreateTime},</if> |
| | | <if test="approveOn != null">approve_on = #{approveOn},</if> |
| | | <if test="startWorkDate != null">start_work_date = #{startWorkDate},</if> |
| | | <if test="lowOrderCode != null">low_order_code = #{lowOrderCode},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | order by document_number asc,id asc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="selectUnMatchPlateSubPlanList" parameterType="com.aps.core.domain.ApsPlatePlan" resultMap="ApsPlatePlanResult"> |
| | | select id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity, |
| | | unmatched_quantity,version |
| | | from aps_plate_plan |
| | | where del_flag='0' and professional_affiliation ='sub' and unmatched_quantity > 0 |
| | | <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 |
| | | </select> |
| | | |
| | | <update id="updatePlanUnMatchQtyByVersion" parameterType="com.aps.core.domain.ApsPlatePlan"> |
| | | update aps_plate_plan |
| | |
| | | set unmatched_quantity=production_quantity, version=0,require_id=id |
| | | where del_flag='0' and professional_affiliation !='0' |
| | | </update> |
| | | <update id="updatePlanUnMatchQtyAndVersion" parameterType="com.aps.core.domain.ApsPlatePlan"> |
| | | update aps_plate_plan |
| | | set unmatched_quantity=#{unmatchedQuantity},version=#{version},update_time=now() |
| | | where id=#{id} |
| | | </update> |
| | | </mapper> |
| | |
| | | |
| | | <select id="queryStandardProcessRouteHeaderByPlantAndItemCode" parameterType="String" resultMap="ApsStandardProcessRouteHeaderResult"> |
| | | <include refid="selectApsStandardProcessRouteHeaderVo"/> |
| | | <where> |
| | | where del_flag = '0' |
| | | <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> |
| | | <if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode} </if> |
| | | and del_flag = '0' |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectProcessRouteStandardTimeData" parameterType="String" resultType="com.alibaba.fastjson2.JSONObject"> |
| | |
| | | process_number,work_center,department, |
| | | plan_start_day,plan_end_day,next_process_deparment, |
| | | is_suspended,is_outsourcing,account, |
| | | id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name,plan_type |
| | | id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name,plan_type, |
| | | order_create_time, |
| | | approve_on, |
| | | start_work_date, |
| | | low_order_code |
| | | ) |
| | | select |
| | | doc_no,mainitem_code,mainitem_figure, |
| | |
| | | start_date,complete_date,next_dept, |
| | | is_hold_release,is_out_source,org_code, |
| | | order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name, |
| | | case when substr(item_code,0,4)='A65' then 'gas' else 'piping' end as plan_type |
| | | case when substr(item_code,0,4)='A65' then 'gas' else 'piping' end as plan_type, |
| | | order_create_time, |
| | | approve_on, |
| | | start_work_date, |
| | | low_order_code |
| | | from aps_work_order_job |
| | | where ( doc_status in (0,1,2,4) and is_hold_release='0' |
| | | and (item_code like 'A65%' or item_code like 'W%')); |