| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | |
| | | import com.zy.asrs.domain.vo.CrnStateTableVo; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.impl.MainServiceImpl; |
| | | import com.zy.asrs.utils.CommandUtils; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.hibernate.validator.internal.engine.messageinterpolation.parser.ELState; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | private String movePath; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | |
| | | command.setDestinationPosX(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosY(param.getLev()); // 目标库位层 |
| | | command.setCommand((short)1); |
| | | String locNo =String.format("%2d",param.getRow()) + String.format("%3d",param.getBay()) + String.format("%2d",param.getLev()); |
| | | String startlocNo =String.format("%2d",param.getSourceRow()) + String.format("%3d",param.getSourceBay()) + String.format("%2d",param.getSourceLev()); |
| | | boolean wmsLocStatus = toWmsLocStatus(1, startlocNo, locNo, param.getBarcode(), param.getBarcodeType(), param.getEmptyContainer()); |
| | | if (!wmsLocStatus){ |
| | | return R.error("库位更新失败"); |
| | | } |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | command.setDestinationPosZ(param.getRow()); // 目标库位排 |
| | | command.setDestinationPosX(param.getBay()); // 目标库位列 |
| | | command.setDestinationPosY(param.getLev()); // 目标库位层 |
| | | String locNo =String.format("%2d",param.getRow()) + String.format("%3d",param.getBay()) + String.format("%2d",param.getLev()); |
| | | String startlocNo =String.format("%2d",param.getSourceRow()) + String.format("%3d",param.getSourceBay()) + String.format("%2d",param.getSourceLev()); |
| | | boolean wmsLocStatus = toWmsLocStatus(2, startlocNo, locNo, param.getBarcode(), param.getBarcodeType(), param.getEmptyContainer()); |
| | | if (!wmsLocStatus){ |
| | | return R.error("库位更新失败"); |
| | | } |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX()) |
| | | .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ())); |
| | | VersionUtils.locMoveCheckLocType(sourceLoc, loc); |
| | | String locNo =String.format("%2d",param.getRow()) + String.format("%3d",param.getBay()) + String.format("%2d",param.getLev()); |
| | | String startlocNo =String.format("%2d",param.getSourceRow()) + String.format("%3d",param.getSourceBay()) + String.format("%2d",param.getSourceLev()); |
| | | boolean wmsLocStatus = toWmsLocStatus(3, startlocNo, locNo, param.getBarcode(), param.getBarcodeType(), param.getEmptyContainer()); |
| | | if (!wmsLocStatus){ |
| | | return R.error("库位更新失败"); |
| | | } |
| | | return crnControl(command)?R.ok():R.error(); |
| | | } |
| | | |
| | |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | public boolean toWmsLocStatus(Integer type,String startlocNo,String locNo,String barcode,String barcodeType,String emptyContainer){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("x-api-key","7a15b5db-29b6-552c-8cff-0cfec3756da2"); |
| | | WmsLocStatus param = new WmsLocStatus(); |
| | | param.setWarehouseId("1688469798893297665"); |
| | | param.setLocationCode(Utils.getWmsLocNo(locNo)); |
| | | if (emptyContainer.equals("1")){ |
| | | param.setEmptyContainer("Y"); |
| | | }else { |
| | | param.setEmptyContainer("N"); |
| | | } |
| | | param.setStatus("QY"); |
| | | param.setContainerCode(barcode); |
| | | param.setContainerTypeCode(barcodeType); |
| | | |
| | | String response = null; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setHeaders(map) |
| | | .setUri(wmsUrl) |
| | | .setPath("wcsManager/wcsInterface/locationUpdate") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | }catch (Exception e){ |
| | | log.error("库位更新失败"); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)){ |
| | | LocMast originLoc = locMastService.selectByLocNo(startlocNo); |
| | | LocMast locMast = locMastService.selectByLocNo(locNo); |
| | | if (type == 1){ |
| | | locMast.setBarcode(barcode); |
| | | locMast.setLocSts("F"); |
| | | locMastService.updateById(locMast); |
| | | }else if (type == 2){ |
| | | locMast.setBarcode(""); |
| | | locMast.setLocSts("O"); |
| | | locMastService.updateById(locMast); |
| | | }else if (type == 3){ |
| | | originLoc.setLocSts("O"); |
| | | originLoc.setBarcode(""); |
| | | locMast.setBarcode(barcode); |
| | | locMast.setLocSts("F"); |
| | | locMastService.updateById(originLoc); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | |
| | | apiLogService.save("Wms变更货位状态" |
| | | ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply" |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(param) |
| | | ,response |
| | | ,true |
| | | ); |
| | | return true; |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | | |
| | | } |