| | |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import com.alibaba.fastjson.JSON; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | public synchronized R getLocNo(@RequestBody SearchLocParam param, HttpServletRequest request) { |
| | | long startTime = System.currentTimeMillis(); |
| | | if (param != null && request != null) { |
| | | log.info("[getLocNo] cache: {}", JSON.toJSONString(param)); |
| | | request.setAttribute("cache", param); |
| | | } |
| | | String barcode = param == null ? null : param.getBarcode(); |
| | |
| | | // } |
| | | waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); |
| | | if (Cools.isEmpty(waitPakins)) { |
| | | return R.error("请先添加入库通知档"); |
| | | return R.error("请先收货后再入库"); |
| | | // WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); |
| | | // if (wrkMast != null && wrkMast.getIoType() == 103) { |
| | | // return R.parse(CodeRes.PICK_600); |
| | |
| | | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNoEntity = basDevpService.checkSiteStatus(param.getSourceStaNo(), true); |
| | | sourceStaNoEntity.setLocType1(param.getLocType1()); |
| | | sourceStaNoEntity.setLocType1((short) (param.getLocType1()!=1?2:1)); |
| | | LocTypeDto locTypeDto = new LocTypeDto(sourceStaNoEntity); |
| | | if (waitPakins.get(0).getMatnr().equals("emptyPallet")) { |
| | | locTypeDto.setLocType2((short) 1); |
| | | } |
| | | |
| | | // 入参重量最多两位小数 |
| | | if (param.getWeight() != null) { |
| | | param.setWeight(param.getWeight().setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | StartupDto dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins,param.getWeight()); |
| | |
| | | // 源站点状态检测 |
| | | BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true); |
| | | // 检索库位 |
| | | List<String> matnrs = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList()); |
| | | List<String> batchs = waitPakins.stream().map(WaitPakin::getBatch).distinct().collect(Collectors.toList()); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(matnrs.get(0), batchs.get(0)); |
| | | // FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(waitPakins.get(0)); |
| | | FindLocNoAttributeVo findLocNoAttributeVo = new FindLocNoAttributeVo(waitPakins.get(0)); |
| | | // IoT 指定了目标库位时优先尝试该库位;不可用时再退回现有自动找位规则。 |
| | | StartupDto dto = buildPreferredStartupDto(devpNo, extractPreferredInboundLoc(waitPakins)); |
| | | if (dto == null) { |