| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | // 生成工作档 |
| | | WrkMast wrkMast = new WrkMast(); |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setWhsType(iotype == 1 && param.getPalletizingNo() == 2051 ? 1 : 0); // 返修入库标记 |
| | | wrkMast.setIoTime(new Date()); |
| | | wrkMast.setWrkSts(1L); // 工作状态:设备上走 |
| | | wrkMast.setIoType(iotype); // 入出库状态:1.入库 |
| | |
| | | } |
| | | |
| | | // 物料表备份一份 |
| | | Mat mat = new Mat(); |
| | | mat.sync(wrkDetl); |
| | | mat.setTagId(6L); |
| | | mat.setCreateTime(now); |
| | | mat.setUpdateTime(now); |
| | | if (!matService.insert(mat)) { |
| | | throw new CoolException("备份物料表失败"); |
| | | } |
| | | // Mat mat = new Mat(); |
| | | // mat.sync(wrkDetl); |
| | | // mat.setTagId(6L); |
| | | // mat.setCreateTime(now); |
| | | // mat.setUpdateTime(now); |
| | | // if (!matService.insert(mat)) { |
| | | // throw new CoolException("备份物料表失败"); |
| | | // } |
| | | |
| | | }); |
| | | } |
| | |
| | | } |
| | | |
| | | DocType docType = docTypeService.selectOrAdd(param.getOrderType(), Boolean.FALSE); |
| | | if (docType == null) { |
| | | return R.parse("单据类型不存在,请检查:" + param.getOrderType()); |
| | | } |
| | | Date now = new Date(); |
| | | |
| | | // 单据主档 |
| | |
| | | wrkMastService.updateById(wrkMast); |
| | | } |
| | | |
| | | // 出库上报推送mes记录 |
| | | ckjgsbPushMes(wrkMast,wrkDetls); |
| | | |
| | | return "出库结果上报成功"; |
| | | } |
| | | |
| | | private void ckjgsbPushMes(WrkMast wrkMast, List<WrkDetl> wrkDetls) { |
| | | GwmsGenerateInventoryDto gwmsGenerateInventoryDto = new GwmsGenerateInventoryDto(); |
| | | gwmsGenerateInventoryDto.setBarcode(wrkMast.getBarcode()); |
| | | gwmsGenerateInventoryDto.setPalletizingNo(wrkMast.getStaNo()); |
| | | List<GwmsGenerateInventoryDto.MatList> matLists = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl:wrkDetls) { |
| | | boolean flag = true; |
| | | for (GwmsGenerateInventoryDto.MatList matList : matLists) { |
| | | if (matList.getPackageGroupNo().equals(wrkDetl.getBrand())) { |
| | | matList.getRolls().add(new GwmsGenerateInventoryDto.Rolls(wrkDetl.getModel(), |
| | | wrkDetl.getUnit(),wrkDetl.getMaktx(),wrkDetl.getLength(), |
| | | Integer.parseInt(wrkDetl.getSpecs()),wrkDetl.getWeight(),wrkDetl.getVolume(), |
| | | wrkDetl.getManuDate())); |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | GwmsGenerateInventoryDto.MatList matList = new GwmsGenerateInventoryDto.MatList(); |
| | | matList.setBoxPos(wrkDetl.getOrigin()); |
| | | matList.setPackageGroupNo(wrkDetl.getBrand()); |
| | | matList.setOutOrIn("out"); |
| | | matList.setStockType(wrkMast.getStaNo() == 2041 ? "返修出库" : "成品出库"); |
| | | matList.setBoxType(wrkDetl.getColor()); |
| | | matList.setRollType(wrkDetl.getManu()); |
| | | matList.setWideInWidth(wrkDetl.getSku()); |
| | | matList.setThickness(wrkDetl.getItemNum()); |
| | | List<GwmsGenerateInventoryDto.Rolls> rollsList = new ArrayList<>(); |
| | | GwmsGenerateInventoryDto.Rolls roll = new GwmsGenerateInventoryDto.Rolls(wrkDetl.getModel(), |
| | | wrkDetl.getUnit(),wrkDetl.getMaktx(),wrkDetl.getLength(), |
| | | Integer.parseInt(wrkDetl.getSpecs()),wrkDetl.getWeight(),wrkDetl.getVolume(), |
| | | wrkDetl.getManuDate()); |
| | | rollsList.add(roll); |
| | | matList.setRolls(rollsList); |
| | | matLists.add(matList); |
| | | } |
| | | } |
| | | gwmsGenerateInventoryDto.setMatList(matLists); |
| | | |
| | | |
| | | |
| | | boolean success = false; |
| | | // 获取请求头 |
| | | Map<String,Object> headers = new HashMap<>(); |
| | | headers.put("Content-Type","application/json;charset=UTF-8"); |
| | | |
| | | // 构造请求体 |
| | | String body = JSON.toJSONString(gwmsGenerateInventoryDto); |
| | | String response = ""; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.MES_CC_IP_PORT) |
| | | .setPath(MesConstant.MES_CC_FXRK_URL) |
| | | .setHeaders(headers) |
| | | .setJson(body) |
| | | .build() |
| | | .doPost(); |
| | | if (!Cools.isEmpty(response)) { |
| | | JSONObject jsonObject1 = JSONObject.parseObject(response); |
| | | int code = (int) jsonObject1.get("code"); |
| | | boolean state = jsonObject1.getBoolean("state"); |
| | | if (code == 200 && state) { |
| | | success = true; |
| | | } |
| | | } else { |
| | | log.error("出库上报推送mes记录失败!!!url:{};request:{};response:{}", MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_FXRK_URL, body, response); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("出库上报推送mes记录异常:{}", e.getMessage()); |
| | | } finally { |
| | | try { |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "出库上报推送mes记录", |
| | | MesConstant.MES_CC_IP_PORT + MesConstant.MES_CC_FXRK_URL, |
| | | null, |
| | | "127.0.0.1", |
| | | body, |
| | | response, |
| | | success |
| | | ); |
| | | } catch (Exception e) { |
| | | log.error("", e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | |
| | | wrkMast.setWrkSts(52L); // 工作状态42->52.设备上走(拆垛完成) |
| | | wrkMast.setSourceStaNo(param.getSourceStaNo()); |
| | | wrkMast.setStaNo(oneFloorIn[wrkMast.getCrnNo()]); |
| | | // 源库位 |
| | | LocMast staLocMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | // 目标库位=源库位 |
| | | wrkMast.setLocNo(wrkMast.getSourceLocNo()); |
| | | // 源库位清除 |
| | | wrkMast.setSourceLocNo(""); |
| | | wrkMast.setModiTime(new Date()); |
| | | |
| | | // 更新库位状态 |
| | | LocMast staLocMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | // 更新新库位状态 Q |
| | | staLocMast.setLocSts("Q"); |
| | | staLocMast.setModiTime(new Date()); |
| | |
| | | @Override |
| | | public R kxlhCdwc(KxlhcdwcParam param) { |
| | | |
| | | if (Cools.isEmpty(param.getWorkNo(),param.getSourceStaNo(),param.getSite())) { |
| | | if (Cools.isEmpty(param.getWorkNo(),param.getSourceStaNo(),param.getSite(),param.getBarcode())) { |
| | | return R.parse("参数不能为空,请检查入参"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectById(param.getWorkNo()); |
| | |
| | | zphjcdwcVo.setWorkNo(wrkMast1.getWrkNo()); |
| | | zphjcdwcVo.setStaNo(wrkMast1.getStaNo()); |
| | | zphjcdwcVo.setSourceStaNo(site); |
| | | zphjcdwcVo.setBarcode(site == 3046 ? "T1046" : "T1042"); |
| | | zphjcdwcVo.setBarcode(param.getBarcode()); |
| | | zphjcdwcVos.add(zphjcdwcVo); |
| | | } |
| | | |
| | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.GWCS_IP_PORT) |
| | | .setPath(MesConstant.GWCS_IP_PORT) |
| | | .setPath(MesConstant.GWCS_FPKW_URL) |
| | | .setHeaders(headers) |
| | | .setJson(body) |
| | | .build() |
| | |
| | | if (!Cools.isEmpty(response)) { |
| | | success = true; |
| | | } else { |
| | | log.error(message + "失败!!!url:{};request:{};response:{}", MesConstant.GWCS_IP_PORT + MesConstant.GWCS_IP_PORT, body, response); |
| | | log.error(message + "失败!!!url:{};request:{};response:{}", MesConstant.GWCS_IP_PORT + MesConstant.GWCS_FPKW_URL, body, response); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(message + "异常:{}", e); |