| | |
| | | |
| | | @Value("${erp.address.URL}") |
| | | private String URL; |
| | | @Value("${erp.address.outaddress}") |
| | | private String outAddress; |
| | | @Value("${erp.address.outReportAddress}") |
| | | private String outReportAddress; |
| | | @Value("${erp.address.inReportAddress}") |
| | | private String inReportAddress; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | |
| | | * 单个任务上报erp |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ? ") |
| | | private void execute() { |
| | | private synchronized void execute() { |
| | | //查找所有任务档任务状态为40ERP上报中的任务 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", 40)); |
| | | |
| | |
| | | map.put("itemNo",orderDetl.getMatnr()); |
| | | map.put("qty",wrkDetl.getAnfme()); |
| | | map.put("unitNo",orderDetl.getUnit()); |
| | | map.put("warehouseNo",orderDetl.getColor()); |
| | | map.put("warehouseNo","02201"); |
| | | map.put("cellNo",orderDetl.getBrand()); |
| | | map.put("combinationLotNo",String.valueOf(orderDetl.getBatch())); |
| | | map.put("barcode",wrkDetl.getZpallet()); |
| | | map.put("barcode",wrkDetl.getMatnr()); |
| | | datas.add(map); |
| | | } |
| | | |
| | | String path= ""; |
| | | String work= ""; |
| | | if(wrkMast.getIoType()<100){ |
| | | path=inReportAddress; |
| | | work="入库"; |
| | | }else{ |
| | | path=outReportAddress; |
| | | work="出库"; |
| | | } |
| | | path=outReportAddress; |
| | | HashMap<String,Object> map=new HashMap<>(); |
| | | map.put("data",datas); |
| | | //上报ERP |
| | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(URL) |
| | | .setPath(outAddress) |
| | | .setPath(path) |
| | | .setJson(JSON.toJSONString(map)) |
| | | .build() |
| | | .doPost(); |
| | |
| | | }else{ |
| | | wrkMast.setWrkSts(18L);//出库转历史档 |
| | | } |
| | | wrkMastService.updateById(wrkMast); |
| | | } else { |
| | | log.error("任务号={},上报失败",wrkMast.getWrkNo()); |
| | | } |
| | |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "上报任务结果给ERP", |
| | | URL + outAddress, |
| | | "上报"+work+"任务结果给ERP", |
| | | URL + path, |
| | | null, |
| | | "127.0.0.1", |
| | | map.toString(), |