| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoSou.getAgvLocNo()); |
| | | agvBindCtnrAndBinParam.setReqCode(String.valueOf(System.currentTimeMillis())); |
| | | agvBindCtnrAndBinParam.setIndBind("1"); |
| | | ReturnT<String> resultBind = new PostMesDataUtils().postMesDataArmGrating("AGV容器解绑", |
| | | ReturnT<String> resultBind = new PostMesDataUtils().postMesDataArmGrating("AGV容器绑定", |
| | | AgvConstant.AGV_URL+"/"+AgvConstant.AGV_1LBind,AgvConstant.getAGVADAPTOR(1), agvBindCtnrAndBinParam); |
| | | if(resultBind.getCode() != 200){ |
| | | throw new CoolException("agv入库绑定失败"); |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void combAuto(CombParam param, Long userId) { |
| | | public void |
| | | combAuto(CombParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | |
| | | boolean result = false; |
| | | String orderNo = null; |
| | | String orderNo1 = null; |
| | | for (CombParam.CombMat combMat : param.getCombMats()) { |
| | | if(combMat.getSupplier().equals("1")){ |
| | | List<OrderDetlPakin> orderDetlPakins2 = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("matnr", combMat.getMatnr()).eq("box_type3", combMat.getOrderNo()) |
| | | .eq("box_type2","BU-00001")); |
| | | if (orderDetlPakins2.size() > 0) { |
| | | orderNo1 = orderDetlPakins2.get(0).getOrderNo(); |
| | | } else { |
| | | throw new CoolException("未查询到相关订单===>>" + param.getBarcode()); |
| | | } |
| | | result = true; |
| | | } |
| | | //0 |
| | | List<OrderDetlPakin> orderDetlPakins = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq("matnr", combMat.getMatnr()).eq("box_type3", combMat.getOrderNo()) |
| | | .eq("standby1", combMat.getStandby1()).eq("standby2", combMat.getStandby2()) |
| | |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | Order order1 = orderService.selectByNo(orderNo); |
| | | if (Cools.isEmpty(order1) || order1.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | if(result){ |
| | | order1.setPayType(1);// y->h |
| | | order1.setSalesman(orderNo1); |
| | | orderService.updateById(order1); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), |
| | |
| | | throw new CoolException(locDetl.getLocNo() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | @Override |
| | | public void agvUnlockLoc(AgvUnlockLoc agvUnlockLoc){ |
| | | Date now = new Date(); |
| | | if(agvUnlockLoc.getFloorNo().equals(1)){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",agvUnlockLoc.getPositionCode())); |
| | | if(locMast != null){ |
| | | locMast.setLocSts("O"); |
| | | locMast.setBarcode(""); |
| | | locMast.setIoTime(now); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException(agvUnlockLoc.getPositionCode() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | }else{ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",agvUnlockLoc.getPositionCode())); |
| | | AgvBindCtnrAndBinTwoParam agvBindCtnrAndBinTwoParam = new AgvBindCtnrAndBinTwoParam(); |
| | | agvBindCtnrAndBinTwoParam.setReqCode(String.valueOf(snowflakeIdWorker.nextId())); |
| | | agvBindCtnrAndBinTwoParam.setPodcode(agvUnlockLoc.getPodcode()); |
| | | agvBindCtnrAndBinTwoParam.setPositionCode(agvUnlockLoc.getPositionCode()); |
| | | agvBindCtnrAndBinTwoParam.setIndBind("0");; |
| | | ReturnT<String> resultBind = new PostMesDataUtils().postMesDataArmGrating("AGV库位解绑", |
| | | AgvConstant.AGV_URL+"/"+AgvConstant.AGV_hikRpcService,AgvConstant.getAGVADAPTOR(2), agvBindCtnrAndBinTwoParam); |
| | | if (resultBind.getCode()!=1){ |
| | | if(locMast != null){ |
| | | locMast.setLocSts("O"); |
| | | locMast.setBarcode(""); |
| | | locMast.setIoTime(now); |
| | | locMast.setModiTime(now); |
| | | if (!locMastService.updateById(locMast)) { |
| | | throw new CoolException(agvUnlockLoc.getPositionCode() + "库位不是在库状态"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |