| | |
| | | @RequestParam(required = false) String endDate){ |
| | | |
| | | List<DtLocVo> locVoList = digitalTwinService.recentLoc(areaId, startDate, endDate); |
| | | |
| | | // DtLocVo dtLocVo = DtLocVo.builder() |
| | | // .locDate("2025-10-22") |
| | | // .idleNum(208) |
| | | // .build(); |
| | | // DtLocVo dtLocVo2 = DtLocVo.builder() |
| | | // .locDate("2025-10-23") |
| | | // .idleNum(177) |
| | | // .build(); |
| | | // List<DtLocVo> locVoList = new ArrayList<>(); |
| | | // locVoList.add(dtLocVo); |
| | | // locVoList.add(dtLocVo2); |
| | | |
| | | return R.ok().add(locVoList); |
| | | } |
| | | |
| | |
| | | @RequestParam(required = false) String endDate){ |
| | | |
| | | List<DtInAndOutBoundVo> inAndOutBoundVoList = digitalTwinService.inAndOutBound(areaId, startDate, endDate); |
| | | |
| | | |
| | | // |
| | | // DtInAndOutBoundVo dtInAndOutBoundVo = DtInAndOutBoundVo.builder() |
| | | // .boundDate("2025-10-22") |
| | | // .inBoundNum(237) |
| | |
| | | @RequestParam(required = false) Integer pageSize){ |
| | | |
| | | List<DtDetainMatVo> detainMatVoList = digitalTwinService.recentDetainMat(areaId, overDayNum, pageIndex, pageSize); |
| | | |
| | | // DtDetainMatVo dtDetainMatVo = DtDetainMatVo.builder() |
| | | // .belongAreaId("A1") |
| | | // .belongAreaName("刀具库") |
| | | // .matId("mat10001") |
| | | // .matName("道具把") |
| | | // .lokId("loc1001") |
| | | // .lokName("库位10001") |
| | | // .detainTime(765) |
| | | // .inBoundTime("2025-10-11T11:15:16") |
| | | // .build(); |
| | | // DtDetainMatVo dtDetainMatVo2 = DtDetainMatVo.builder() |
| | | // .belongAreaId("A1") |
| | | // .belongAreaName("刀具库") |
| | | // .matId("mat10002") |
| | | // .matName("道具把") |
| | | // .lokId("loc1002") |
| | | // .lokName("库位10002") |
| | | // .detainTime(665) |
| | | // .inBoundTime("2025-10-10T11:15:16") |
| | | // .build(); |
| | | // List<DtDetainMatVo> detainMatVoList = new ArrayList<>(); |
| | | // detainMatVoList.add(dtDetainMatVo); |
| | | // detainMatVoList.add(dtDetainMatVo2); |
| | | |
| | | return R.ok().add(detainMatVoList); |
| | | } |
| | | |
| | |
| | | // @ManagerAuth |
| | | public R equipment(@RequestParam(required = false) String areaId){ |
| | | |
| | | DtEquipmentVo dtDetainMatVo = DtEquipmentVo.builder() |
| | | .equipmentId("eq1001") |
| | | .equipmentName("堆垛机1") |
| | | .equipmentType(1) |
| | | .belongAreaId("A1") |
| | | .belongAreaName("刀具库") |
| | | .verticalSpeed(288) |
| | | .horizontalSpeed(203) |
| | | .voltage(48) |
| | | .status(1) |
| | | .operateMethod(1) |
| | | .build(); |
| | | DtEquipmentVo dtDetainMatVo2 = DtEquipmentVo.builder() |
| | | .equipmentId("eq1002") |
| | | .equipmentName("堆垛机2") |
| | | .equipmentType(1) |
| | | .belongAreaId("A1") |
| | | .belongAreaName("刀具库") |
| | | .verticalSpeed(208) |
| | | .horizontalSpeed(253) |
| | | .voltage(48) |
| | | .status(1) |
| | | .operateMethod(1) |
| | | .build(); |
| | | List<DtEquipmentVo> dtEquipmentVoList = new ArrayList<>(); |
| | | dtEquipmentVoList.add(dtDetainMatVo); |
| | | dtEquipmentVoList.add(dtDetainMatVo2); |
| | | |
| | | return R.ok().add(dtEquipmentVoList); |
| | | return R.ok(digitalTwinService.equipment(areaId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/warehouseDetail") |
| | | // @ManagerAuth |
| | | public R warehouseDetail(@RequestParam(required = false) String areaId){ |
| | | List<DtLocDetailVo> dtLocDetailVoList = digitalTwinService.warehouseDetail(areaId); |
| | | |
| | | return R.ok().add(dtLocDetailVoList); |
| | | } |
| | | return R.ok(digitalTwinService.warehouseDetail(areaId)); |
| | | // List<DtLocDetailVo> dtLocDetailVoList = new ArrayList<>(); |
| | | // DtLocDetailVo dtLocDetailVo = new DtLocDetailVo(); |
| | | // dtLocDetailVo.setLocNo("CA0100202"); |
| | |
| | | // locDetl2.setMaktx("刀把"); |
| | | // dtLocDetailVo2.setLocDetl(locDetl2); |
| | | // dtLocDetailVoList.add(dtLocDetailVo2); |
| | | |
| | | |
| | | // LocDetl locDetl2 = new LocDetl(); |
| | | // locDetl2.setLocNo("1001"); |
| | | // locDetl2.setAreaId(10010L); |
| | | // locDetl2.setAreaName("刀具库"); |
| | | // locDetl2.setMatnr("mat10001"); |
| | | // locDetl2.setMaktx("刀把"); |
| | | // |
| | | // |
| | | //// LocDetl locDetl2 = new LocDetl(); |
| | | //// locDetl2.setLocNo("1001"); |
| | | //// locDetl2.setAreaId(10010L); |
| | | //// locDetl2.setAreaName("刀具库"); |
| | | //// locDetl2.setMatnr("mat10001"); |
| | | //// locDetl2.setMaktx("刀把"); |
| | | //// |
| | | ////// List<LocDetl> locDetlList = new ArrayList<>(); |
| | | ////// locDetlList.add(locDetl); |
| | | ////// locDetlList.add(locDetl2); |
| | | //// List<LocDetl> locDetlList = new ArrayList<>(); |
| | | //// locDetlList.add(locDetl); |
| | | //// locDetlList.add(locDetl2); |
| | | |
| | | // return R.ok().add(dtLocDetailVoList); |
| | | } |
| | | |
| | | } |
| | |
| | | break; |
| | | } |
| | | } |
| | | if (boo) { |
| | | settle.remove(orderPakin); |
| | | }else { |
| | | if (!boo) { |
| | | list.add(orderPakin.getOrderNo()); |
| | | } |
| | | }else { |
| | |
| | | break; |
| | | } |
| | | } |
| | | if (boo) { |
| | | settle.remove(orderPakout); |
| | | }else { |
| | | if (!boo) { |
| | | list.add(orderPakout.getOrderNo()); |
| | | } |
| | | }else { |
| | |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | |
| | | @RestController |
| | | @Slf4j |
| | | public class OutController extends BaseController { |
| | | |
| | | @Autowired |
| | |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | locDto.setBrand(orderDetl.getBrand()); |
| | | locDto.setStandby1(orderDetl.getStandby1()); |
| | | locDto.setStandby2(orderDetl.getStandby2()); |
| | | locDto.setStandby3(orderDetl.getStandby3()); |
| | | locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | | // LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | // locDto.setBrand(orderDetl.getBrand()); |
| | | // locDto.setStandby1(orderDetl.getStandby1()); |
| | | // locDto.setStandby2(orderDetl.getStandby2()); |
| | | // locDto.setStandby3(orderDetl.getStandby3()); |
| | | // locDto.setBoxType1(orderDetl.getBoxType1()); |
| | | // locDto.setBoxType2(orderDetl.getBoxType2()); |
| | | // locDto.setBoxType3(orderDetl.getBoxType3()); |
| | | // locDto.setLack(Boolean.TRUE); |
| | | // locDtos.add(locDto); |
| | | return R.error("库存不足"); |
| | | } |
| | | } |
| | | R pakout = pakout(locDtos); |
| | |
| | | |
| | | // 数字孪生:呆滞品信息 |
| | | @Data |
| | | @Builder |
| | | public class DtDetainMatVo { |
| | | |
| | | // 归属库区ID |
| | |
| | | package com.zy.asrs.entity.digitaltwin; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class DtEquipmentVo { |
| | | |
| | | // 设备ID |
| | |
| | | // 1:成功;2:失败 |
| | | @JsonProperty("Success") |
| | | @JSONField(name = "Success") |
| | | private String Success; |
| | | private String success; |
| | | // 失败消息 |
| | | @JsonProperty("Message") |
| | | @JSONField(name = "Message") |
| | | private String Message; |
| | | private String message; |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | |
| | | |
| | | List<Double> overview(@Param("areaId")String areaId); |
| | | |
| | | List<DtOrderVo> recentOrder(@Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | List<DtOrderVo> recentOrder(@Param("startTime") Date startTime, @Param("endTime")Date endTime); |
| | | |
| | | List<DtInAndOutBoundVo> recentInBound(@Param("areaId")String areaId, @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | List<DtInAndOutBoundVo> recentInBound(@Param("areaId")String areaId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); |
| | | |
| | | List<DtInAndOutBoundVo> recentOutBound(@Param("areaId")String areaId, @Param("startTime")String startTime, @Param("endTime")String endTime); |
| | | List<DtInAndOutBoundVo> recentOutBound(@Param("areaId")String areaId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); |
| | | |
| | | List<DtDetainMatVo> recentDetainMat(@Param("areaId")String areaId, @Param("startTime")String startTime, |
| | | List<DtDetainMatVo> recentDetainMat(@Param("areaId")String areaId, @Param("startTime")Date startTime, |
| | | @Param("pageIndex")Integer pageIndex, @Param("pageSize")Integer pageSize); |
| | | } |
| | | } |
| | |
| | | * |
| | | */ |
| | | void locNumCount(); |
| | | |
| | | DtEquipmentVo equipment(String areaId); |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.OrderPakout; |
| | | import com.zy.asrs.entity.OrderDetlPakout; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.common.model.LocDto; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | OrderPakout selectOrderMoveStatus(); |
| | | OrderPakout selectOrderMoveStatusInitial(); |
| | | |
| | | R pakout(List<LocDto> locDtos); |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.entity.LocCount; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.digitaltwin.*; |
| | | import com.zy.asrs.mapper.DigitalTwinMapper; |
| | | import com.zy.asrs.mapper.LocCountMapper; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.DigitalTwinService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | |
| | | */ |
| | | public List<DtOrderVo> order(String startDate, String endDate) { |
| | | |
| | | String startTime; |
| | | String endTime; |
| | | Date startTime = new Date(); |
| | | Date endTime = new Date(); |
| | | if (startDate == null || endDate == null || startDate.isEmpty() || endDate.isEmpty()){ |
| | | Date now = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(now); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -7); |
| | | Date start = calendar.getTime(); |
| | | startTime = calendar.getTime(); |
| | | endTime = now; |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | endDate = sdf.format(now); |
| | | startDate = sdf.format(start); |
| | | } else { |
| | | SimpleDateFormat sdf = |
| | | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | |
| | | try { |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | startTime = startDate.substring(0, 4) + "-" + startDate.substring(4, 6) + "-" + startDate.substring(6, 8) + "00:00:00"; |
| | | endTime = endDate.substring(0, 4) + "-" + endDate.substring(4, 6) + "-" + endDate.substring(6, 8) + "00:00:00"; |
| | | List<DtOrderVo> dbOrder = digitalTwinMapper.recentOrder(startTime, endTime); |
| | | // 空日期补全 |
| | | for (DtOrderVo dtOrderVo : dbOrder) { |
| | |
| | | */ |
| | | public List<DtInAndOutBoundVo> inAndOutBound(String areaId, String startDate, String endDate) { |
| | | |
| | | List<DtInAndOutBoundVo> dtInAndOutBoundVos = new ArrayList<>(); |
| | | |
| | | String startTime; |
| | | String endTime; |
| | | Date startTime = new Date(); |
| | | Date endTime = new Date(); |
| | | if (startDate == null || endDate == null || startDate.isEmpty() || endDate.isEmpty()){ |
| | | Date now = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(now); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -7); |
| | | Date start = calendar.getTime(); |
| | | startTime = calendar.getTime(); |
| | | endTime = now; |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | endDate = sdf.format(now); |
| | | startDate = sdf.format(start); |
| | | } else { |
| | | SimpleDateFormat sdf = |
| | | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | |
| | | try { |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | startTime = startDate.substring(0, 4) + "-" + startDate.substring(4, 6) + "-" + startDate.substring(6, 8) + "00:00:00"; |
| | | endTime = endDate.substring(0, 4) + "-" + endDate.substring(4, 6) + "-" + endDate.substring(6, 8) + "00:00:00"; |
| | | |
| | | List<DtInAndOutBoundVo> dtInBoundVos = digitalTwinMapper.recentInBound(areaId, startTime, endTime); |
| | | List<DtInAndOutBoundVo> dtOutBoundVos = digitalTwinMapper.recentOutBound(areaId, startTime, endTime); |
| | | |
| | | // 格式整理 |
| | | List<DtInAndOutBoundVo> dtInAndOutBoundVos = new ArrayList<>(dtInBoundVos); |
| | | dtInAndOutBoundVos.addAll(dtOutBoundVos); |
| | | |
| | | return dtInAndOutBoundVos; |
| | | } |
| | |
| | | calendar.setTime(now); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -overDayNum); |
| | | Date start = calendar.getTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String startTime = sdf.format(start); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // Date startTime = sdf.parse(start); |
| | | |
| | | List<DtDetainMatVo> dbDetainMats = digitalTwinMapper.recentDetainMat(areaId, startTime, pageIndex, pageSize); |
| | | |
| | | return dbDetainMats; |
| | | return digitalTwinMapper.recentDetainMat(areaId, start, pageIndex, pageSize); |
| | | } |
| | | |
| | | @Resource |
| | | private LocMastService locMastService; |
| | | |
| | | /** |
| | | * 查询库存和库位详细信息 |
| | |
| | | * @return |
| | | */ |
| | | public List<DtLocDetailVo> warehouseDetail(String areaId) { |
| | | List<DtLocDetailVo> locDetailVos = new ArrayList<>(); |
| | | |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | |
| | | for (LocMast locMast : locMasts) { |
| | | DtLocDetailVo dtLocDetailVo = new DtLocDetailVo(); |
| | | dtLocDetailVo.setLocMast(locMast); |
| | | dtLocDetailVo.setLocNo(locMast.getLocNo()); |
| | | dtLocDetailVo.setLocSts(locMast.getLocSts()); |
| | | dtLocDetailVo.setRow1(locMast.getRow1()); |
| | | dtLocDetailVo.setBay1(locMast.getBay1()); |
| | | dtLocDetailVo.setLev1(locMast.getLev1()); |
| | | for (LocDetl locDetl : locDetls) { |
| | | List<LocDetl> locDetl1 = locDetls.parallelStream().filter(a -> a.getLocNo().equals(locDetl.getLocNo())).collect(Collectors.toList()); |
| | | if (locDetl1 != null && locDetl1.size() == 1) { |
| | | dtLocDetailVo.setLocDetl(locDetl1.get(0)); |
| | | dtLocDetailVo.setAreaId(locDetl.getAreaId()); |
| | | dtLocDetailVo.setAreaName(locDetl.getAreaName()); |
| | | } |
| | | } |
| | | locDetailVos.add(dtLocDetailVo); |
| | | } |
| | | |
| | | return locDetailVos; |
| | | List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<>()); |
| | | return locMastList.stream() |
| | | .map(loc -> { |
| | | DtLocDetailVo vo = new DtLocDetailVo(); |
| | | BeanUtils.copyProperties(loc, vo); |
| | | return vo; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | // List<DtLocDetailVo> locDetailVos = new ArrayList<>(); |
| | | // |
| | | // List<LocMast> locMasts = new ArrayList<>(); |
| | | // List<LocDetl> locDetls = new ArrayList<>(); |
| | | // |
| | | // for (LocMast locMast : locMasts) { |
| | | // DtLocDetailVo dtLocDetailVo = new DtLocDetailVo(); |
| | | // dtLocDetailVo.setLocMast(locMast); |
| | | // dtLocDetailVo.setLocNo(locMast.getLocNo()); |
| | | // dtLocDetailVo.setLocSts(locMast.getLocSts()); |
| | | // dtLocDetailVo.setRow1(locMast.getRow1()); |
| | | // dtLocDetailVo.setBay1(locMast.getBay1()); |
| | | // dtLocDetailVo.setLev1(locMast.getLev1()); |
| | | // for (LocDetl locDetl : locDetls) { |
| | | // List<LocDetl> locDetl1 = locDetls.parallelStream().filter(a -> a.getLocNo().equals(locDetl.getLocNo())).collect(Collectors.toList()); |
| | | // if (locDetl1 != null && locDetl1.size() == 1) { |
| | | // dtLocDetailVo.setLocDetl(locDetl1.get(0)); |
| | | // dtLocDetailVo.setAreaId(locDetl.getAreaId()); |
| | | // dtLocDetailVo.setAreaName(locDetl.getAreaName()); |
| | | // } |
| | | // } |
| | | // locDetailVos.add(dtLocDetailVo); |
| | | // } |
| | | // |
| | | // return locDetailVos; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | List<LocCount> locCounts; |
| | | if(areaId.isEmpty()){ |
| | | locCounts = locCountMapper.getByDate(Integer.parseInt(startDate), Integer.parseInt(endDate)); |
| | | } else { |
| | | locCounts = locCountMapper.getByAreaAndDate(areaId, Integer.parseInt(startDate), Integer.parseInt(endDate)); |
| | | } |
| | | // if(areaId.isEmpty()){ |
| | | locCounts = locCountMapper.getByDate(Integer.parseInt(startDate), Integer.parseInt(endDate)); |
| | | // } else { |
| | | // locCounts = locCountMapper.getByAreaAndDate(areaId, Integer.parseInt(startDate), Integer.parseInt(endDate)); |
| | | // } |
| | | |
| | | for (LocCount locCount : locCounts) { |
| | | String date = locCount.getDate().toString(); |
| | |
| | | * |
| | | */ |
| | | public void locNumCount() { |
| | | |
| | | List<LocCount> result = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | String date = sdf.format(new Date()); |
| | | |
| | | List<LocCount> totalLoc = locCountMapper.totalLoc(); |
| | | List<LocCount> useLoc = locCountMapper.useLoc(); |
| | | for (LocCount locCount : totalLoc) { |
| | | LocCount locCount1 = new LocCount(); |
| | | locCount1.setDate(Integer.valueOf(date)); |
| | | locCount1.setAreaId(locCount.getAreaId()); |
| | | locCount1.setLocNum(locCount1.getLocNum()); |
| | | for (LocCount locCount2 : useLoc) { |
| | | if(locCount1.getAreaId().equals(locCount2.getAreaId())){ |
| | | locCount1.setRemainNum(locCount1.getLocNum() - locCount2.getLocNum()); |
| | | } |
| | | } |
| | | result.add(locCount1); |
| | | } |
| | | |
| | | for (LocCount locCount : result) { |
| | | locCountMapper.insertOrUpdate(locCount); |
| | | } |
| | | LocCount locCount1 = new LocCount(); |
| | | locCount1.setDate(Integer.valueOf(date)); |
| | | locCount1.setLocNum(totalLoc.get(0).getLocNum()); |
| | | locCount1.setRemainNum(locCount1.getLocNum() - useLoc.get(0).getLocNum()); |
| | | |
| | | locCountMapper.insertOrUpdate(locCount1); |
| | | } |
| | | |
| | | @Resource |
| | | private BasCrnpService basCrnpService; |
| | | |
| | | @Override |
| | | public DtEquipmentVo equipment(String areaId) { |
| | | BasCrnp crnp = basCrnpService.selectOne(new EntityWrapper<>()); |
| | | return DtEquipmentVo.builder() |
| | | .equipmentId("1").equipmentName("堆垛机1").equipmentType(1) |
| | | .belongAreaId("C").belongAreaName("联结器库").verticalSpeed(Integer.valueOf(Cools.isEmpty(crnp.getCtlHp()) ? "0" : crnp.getCtlHp())) |
| | | .horizontalSpeed(Integer.valueOf( Cools.isEmpty(crnp.getCtlRest()) ? "0" : crnp.getCtlRest())).voltage(220).status(crnp.getCrnErr() == 0 ? 1 : 3).operateMethod(crnp.getCrnSts() == 3 ? 1 : 3).build(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | set.add(mesOutApplyItem.getTrayid()); |
| | | Mat mat = matService.selectByMatnr(mesOutApplyItem.getItemno()); |
| | | if (Cools.isEmpty(mat)) { |
| | | log.error("物料编号不存在: {}", mesOutApplyItem.getItemno()); |
| | | throw new CoolException("物料编号不存在: " + mesOutApplyItem.getItemno()); |
| | | } |
| | | OrderDetlPakout orderDetlPakout = new OrderDetlPakout(); |
| | | orderDetlPakout.setOrderId(orderPakout.getId()); |
| | | orderDetlPakout.setOrderNo(orderPakout.getOrderNo()); |
| | |
| | | Date now = new Date(); |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo); |
| | | task.setTaskType("ZX-AGV"); |
| | | //08-1是空托盘转序任务 |
| | | //08-2是物料转序任务 |
| | | task.setTaskType("ZX-AGV-"+transTask.getTransType()); |
| | | task.setWrkSts(301L);//301.AGV任务创建 |
| | | task.setIoType(3);//3.站到站 |
| | | task.setIoPri(10.00); |
| | |
| | | if ("Y".equals(allow.getStatus())) { |
| | | String TaskNo = allow.getTaskno(); |
| | | if(allow.getTaskno().contains("-")){ |
| | | TaskNo = allow.getTaskno().split("-")[0]; |
| | | TaskNo = allow.getTaskno().substring(0, allow.getTaskno().length() - 2); |
| | | } |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", TaskNo)); |
| | | if (Cools.isEmpty(task)) { |
| | |
| | | if ("Y".equals(allow.getStatus())) { |
| | | String TaskNo = allow.getTaskno(); |
| | | if(allow.getTaskno().contains("-")){ |
| | | TaskNo = allow.getTaskno().split("-")[0]; |
| | | TaskNo = allow.getTaskno().substring(0, allow.getTaskno().length() - 2); |
| | | } |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", TaskNo)); |
| | | if (Cools.isEmpty(task)) { |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | | import com.zy.asrs.entity.param.OpenOrderPakinParam; |
| | | import com.zy.asrs.entity.param.OpenOrderPakoutParam; |
| | | import com.zy.asrs.mapper.OrderDetlPakoutMapper; |
| | | import com.zy.asrs.mapper.OrderPakoutMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private OrderDetlPakoutServiceImpl orderDetlPakoutService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private StaDescService staDescService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Resource |
| | | private OrderPakoutService orderPakOutService; |
| | | |
| | | @Override |
| | | public OrderPakout selectByNo(String orderNo) { |
| | |
| | | return this.baseMapper.selectOrderMoveStatusInitial(); |
| | | } |
| | | |
| | | @Override |
| | | public R pakout(List<LocDto> locDtos) { |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | List<LocDto> locDtoArrayList = new ArrayList<>(); |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.getFrozen() != 1 && locDto.getFrozenLoc() != 1) { |
| | | locDtoArrayList.add(locDto); |
| | | } |
| | | } |
| | | locDtos = locDtoArrayList; |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse("库存/库位被冻结,请处理后出库!!!"); |
| | | } |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | if (!locDto.isLack()) { |
| | | lack = false; |
| | | break; |
| | | } |
| | | } |
| | | if (lack) { |
| | | return R.error("库存不足"); |
| | | } |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { |
| | | continue; |
| | | } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | assert dto != null; |
| | | dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | } else { |
| | | taskDtos.add(taskDto); |
| | | } |
| | | } |
| | | OrderPakout orderPakout = orderPakOutService.selectByNo(locDtos.get(0).getOrderNo()); |
| | | |
| | | //配盘出库单用, i=5时或者出库到最后时下发空板出库任务 |
| | | int i = 0; |
| | | //需要出库的托盘数量 |
| | | int size = taskDtos.size(); |
| | | //优先级 |
| | | int ioPri = 50; |
| | | //已下空板出库任务数量 |
| | | int j = 1; |
| | | // ----------------------------------------------------------------------------------------------- |
| | | for (TaskDto taskDto : taskDtos) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | workService.stockOut(staNo, taskDto, 9995L, ioPri); |
| | | ioPri--; |
| | | i++; |
| | | //配盘出库单使用,下发需要出的空板任务 |
| | | if (orderPakout.getDocType() == 11) { |
| | | if (i == size) { |
| | | for (; j <= orderPakout.getPayType(); j++) { |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", taskDto.getLocNo())); |
| | | Integer locType = Integer.valueOf(locMast1.getLocType2()); |
| | | //配盘 出库单出库区域时Q-L4时,出大托盘空板 |
| | | if(!Cools.isEmpty(orderPakout.getCstmrName())&&orderPakout.getCstmrName().equals("Q-L4")){ |
| | | locType = 2; |
| | | } |
| | | String bar = ""; |
| | | //具体待定 |
| | | // if(!Cools.isEmpty(orderPakout.getShipCode())&&orderPakout.getShipCode().equals("A01")){ |
| | | // bar = "A01"; |
| | | // } |
| | | LocMast locMast = new LocMast(); |
| | | if (Cools.isEmpty(bar)) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D").eq("loc_type2", locType).orderBy("row1",false)); |
| | | } else { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D").eq("loc_type2", locType).like("barcode", bar).orderBy("row1",false)); |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast)) { |
| | | return R.error("库存没有空板"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | EmptyPlateOutParam emptyPlateOutParam = new EmptyPlateOutParam(); |
| | | emptyPlateOutParam.setOutSite(303); |
| | | emptyPlateOutParam.setLocNos(new ArrayList<String>() {{ |
| | | add(locNo); |
| | | }}); |
| | | String agvSta = ""; |
| | | if (locMast.getLocType3() == 2) { |
| | | agvSta = "Z-LZP26"; |
| | | }else if(locType ==2){ |
| | | |
| | | } else { |
| | | agvSta = orderPakout.getCstmrName();//agv目标站点位置 |
| | | } |
| | | WrkMast wrkMast = workService.emptyPlateOut(emptyPlateOutParam, ioPri, agvSta); |
| | | ioPri--; |
| | | |
| | | } |
| | | } else if (i == 4) { |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", taskDto.getLocNo())); |
| | | Integer locType = Integer.valueOf(locMast1.getLocType2()); |
| | | //配盘 出库单出库区域时Q-L4时,出大托盘空板 |
| | | if(orderPakout.getCstmrName().equals("Q-L4")){ |
| | | locType = 2; |
| | | } |
| | | |
| | | String bar = ""; |
| | | if (!Cools.isEmpty(orderPakout.getShipCode()) && orderPakout.getShipCode().equals("A01")) { |
| | | bar = "A01"; |
| | | } |
| | | LocMast locMast = null; |
| | | if (Cools.isEmpty(bar)) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D").eq("loc_type2", locType).orderBy("row1",false)); |
| | | } else { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "D").eq("loc_type2", locType).like("barcode", bar).orderBy("row1",false)); |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast)) { |
| | | return R.error("库存没有空板"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |
| | | EmptyPlateOutParam emptyPlateOutParam = new EmptyPlateOutParam(); |
| | | emptyPlateOutParam.setOutSite(303); |
| | | emptyPlateOutParam.setLocNos(new ArrayList<String>() {{ |
| | | add(locNo); |
| | | }}); |
| | | String agvSta = ""; |
| | | if (locMast.getLocType3() == 2) { |
| | | agvSta = "Z-LZP26"; |
| | | }else if(locType ==2){ |
| | | |
| | | } else { |
| | | agvSta = orderPakout.getCstmrName();//agv目标站点位置 |
| | | } |
| | | WrkMast wrkMast = workService.emptyPlateOut(emptyPlateOutParam, ioPri, agvSta); |
| | | ioPri--; |
| | | j++; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.OrderPakoutService; |
| | | import com.zy.asrs.service.TaskService; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.service.impl.BasDevpServiceImpl; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private BasDevpServiceImpl basDevpService; |
| | | @Autowired |
| | | private OrderPakoutService orderPakoutService; |
| | | |
| | | /** |
| | | * 满板和空板出库任务,出到输送线后创建AGV搬运任务 |
| | |
| | | Task task1 = taskService.selectOne(new EntityWrapper<Task>() |
| | | .in("source_sta_no", wrkMast.getSourceStaNo(), wrkMast.getMemo()) |
| | | .in("sta_no", wrkMast.getSourceStaNo(), wrkMast.getMemo())); |
| | | if (Cools.isEmpty(task1)) { |
| | | |
| | | if (Cools.isEmpty(task1)) { |
| | | //生成AGV搬运出库任务 |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | Date date = new Date(); |
| | | String TaskNo = wrkMast.getWrkNo() + "aa" + date.getTime(); |
| | | String taskType = "AGV"; |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | |
| | | if (wrkMast.getIoType()!=110){ |
| | | if (wrkDetls != null && !Cools.isEmpty(wrkDetls.get(0).getOrderNo())){ |
| | | TaskNo = wrkDetls.get(0).getOrderNo(); |
| | | taskType = "KB-AGV"; |
| | | } |
| | | |
| | | }else{ |
| | | if (wrkDetls != null && !Cools.isEmpty(wrkDetls.get(0).getOrderNo())){ |
| | | OrderPakout orderPakout = orderPakoutService.selectByNo(wrkDetls.get(0).getOrderNo()); |
| | | if (orderPakout.getDocType()==11){ |
| | | taskType = "PP-AGV"; |
| | | }else if (orderPakout.getDocType()==12){ |
| | | taskType = "ZP-AGV"; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | task.setWrkNo(wrkMast.getWrkNo()) |
| | | .setTaskNo(TaskNo) |
| | | .setIoTime(date) |
| | | .setWrkSts(301L) // 工作状态:301.任务下发 |
| | | .setIoType(ioType) // 入出库状态: 3.站到站 4.站到区域 |
| | | .setTaskType("agv") |
| | | .setTaskType(taskType) |
| | | .setIoPri(10D) |
| | | .setFullPlt("Y") // 满板:Y |
| | | .setPicking("N") // 拣料 |
| | |
| | | } |
| | | |
| | | // 入库订单完成上报-领料单,原材料 |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | //@Scheduled(cron = "0/30 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | void inOrderCompleteReport() { |
| | | String erpReport = Parameter.get().getErpReport(); |
| | |
| | | } |
| | | } |
| | | |
| | | // 出库单上报 |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | // 装配单自动出库 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | // @Async("orderThreadPool") |
| | | void AutoOutOrderPinOut() throws InterruptedException { |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | |
| | | if (boo){ |
| | | continue; |
| | | } |
| | | R pakout = outController.pakout(locDtos); |
| | | R pakout = orderPakoutService.pakout(locDtos); |
| | | break; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.DigitalTwinService; |
| | | import com.zy.asrs.service.MesService; |
| | | import com.zy.asrs.service.TaskService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | @Resource |
| | | private MesService mesService; |
| | | // TODO:reporterTask() |
| | | @Resource |
| | | private DigitalTwinService digitalTwinService; |
| | | |
| | | @Scheduled(cron = "0 50 23 * * ?") |
| | | private void locNumCount() { |
| | | digitalTwinService.locNumCount(); |
| | | } |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void execute(){ |
| | |
| | | Boolean flag2 = false; |
| | | |
| | | if(stationProperties.getStation().contains(task.getStaNo())){ |
| | | taskType = "YLIN"; |
| | | taskType = "LJIN"; |
| | | flag1 = true; |
| | | } |
| | | if (stationProperties.getStation().contains(task.getSourceStaNo())){ |
| | | taskType = "YLOUT"; |
| | | taskType = "LJOUT"; |
| | | flag2 = true; |
| | | } |
| | | if(flag1&&flag2){ |
| | | taskType = "YLBOTH"; |
| | | if(flag1 && flag2){ |
| | | taskType = "LJBOTH"; |
| | | } |
| | | //AGV区域中无法用- |
| | | String StaNo = task.getStaNo(); |
| | |
| | | if (wrkMast != null) { |
| | | if (wrkMast.getIoType()==110&& wrkMast.getWrkSts()>12){ |
| | | wrkMast.setWrkSts(32L);//32.等待组托 |
| | | }else if (wrkMast.getIoType()==101){ |
| | | }else if (wrkMast.getIoType()==101 && wrkMast.getWrkSts()>12){ |
| | | wrkMast.setWrkSts(15L);//15.出库更新完成 |
| | | }else if (wrkMast.getIoType()==103 && wrkMast.getWrkSts()>12){ |
| | | wrkMast.setWrkSts(20L);//20.等待回库 |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | wrkMast.setOveMk("Y"); |
| | | wrkMastService.updateById(wrkMast); |
| | | task.setWrkSts(305L);//任务状态从304--》305 |
| | | task.setModiTime(new Date()); |
| | | taskService.updateById(task); |
| | | |
| | | //对转序搬运完成的任务结果反馈给mes |
| | | }else if(task.getTaskType().equals("ZX-AGV")){ |
| | | }else if(task.getTaskType().equals("ZX-AGV-08-1")||task.getTaskType().equals("ZX-AGV-08-2")){ |
| | | HashMap<String,Object> map = new HashMap<>(); |
| | | map.put("taskno", task.getTaskNo()); |
| | | String mesUrl = url+"AGVArrivalCompletedFit"; |
| | |
| | | |
| | | public static OrderDetl selectItem(boolean sign,String orderNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3){ |
| | | try{ |
| | | Object invoke = implement(OrderMethodVo.SELECT_ITEM2).invoke(getOrderInAndOutType(sign), orderNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3); |
| | | Method m = implement(OrderMethodVo.SELECT_ITEM2); |
| | | OrderInAndOutType t = getOrderInAndOutType(sign); |
| | | Object invoke = m.invoke(t, orderNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3); |
| | | return aOrderDetl(invoke); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getCause().getMessage()); |
| | |
| | | } |
| | | } |
| | | if (dto.getAnfme() > locDetl.getAnfme()) { |
| | | throw new CoolException("服务器内部错误"); |
| | | throw new CoolException(String.format( |
| | | "出库数量[%s]超过库存数量[%s],物料:%s,批次:%s", |
| | | dto.getAnfme(), locDetl.getAnfme(), |
| | | dto.getMatnr(), dto.getBatch() |
| | | )); |
| | | } |
| | | if (dto.getAnfme().equals(locDetl.getAnfme())) { |
| | | sameNumber++; |
| | |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("源站编号不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getSourceStaNo())||param.getBarcode().length()==8) { |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("托盘不能为空或者托盘码不为八位"); |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | |
| | | #mes对接 |
| | | mes: |
| | | |
| | | url: http://192.9.100.173:8088/prod-api/basicmodel/WmsFit/Api/ |
| | | url: http://172.26.160.5:80/dev-api/basicmodel/WmsFit/Api/ |
| | | #默认接口操作人员id |
| | | defaultUserId: 30 |
| | | |
| | |
| | | hik: |
| | | switch: true |
| | | url: http://172.26.11.98:80/rcs/rtas/ |
| | | station: 402,401,307,Z-LZL41,Z-LZL42 |
| | | |
| | | station: 402,401,307,Z-LVL10, Z-LVL11,Z-LVL12, Z-LVL13,Z-LVL14, Z-LVL15,Z-LVL16, Z-LVL17,Z-LVL18, Z-LVL19,Z-LVL05, Z-LVL06,Z-LVL07, Z-LVL08, Z-LVL09, Z-LZH19, Z-LZH20, Z-LZH21, Z-LZH22, Z-LZH23, Z-LZH24 |
| | | #华晓对接 |
| | | hx: |
| | | url: http://172.26.3.131:8300/api/robot/ |
| | |
| | | </select> |
| | | |
| | | <insert id="insertOrUpdate" parameterType="com.zy.asrs.entity.LocCount"> |
| | | IF EXISTS (SELECT date FROM asr_loc_count WHERE date = #{model.date} AND area_id = #{model.areaId}) |
| | | INSERT INTO asr_loc_count(date, area_id, loc_num, remain_num) |
| | | VALUES (#{model.date}, #{model.areaId}, #{model.locNum}, #{model.remainNum}) |
| | | IF EXISTS (SELECT 1 FROM asr_loc_count WHERE date = #{model.date}) |
| | | BEGIN |
| | | UPDATE asr_loc_count |
| | | SET loc_num = #{model.locNum}, |
| | | remain_num = #{model.remainNum} |
| | | WHERE date = #{model.date} |
| | | END |
| | | ELSE |
| | | UPDATE asr_loc_count SET loc_num = #{model.locNum}, remain_num = #{model.remainNum} |
| | | BEGIN |
| | | INSERT INTO asr_loc_count(date, area_id, loc_num, remain_num) |
| | | VALUES (#{model.date}, #{model.areaId}, #{model.locNum}, #{model.remainNum}) |
| | | END |
| | | </insert> |
| | | |
| | | <select id="totalLoc" resultType="com.zy.asrs.entity.LocCount"> |
| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.DigitalTwinMapper"> |
| | | |
| | | <resultMap id="dtOrderMap" type="com.zy.asrs.entity.digitaltwin.DtOrderVo"> |
| | | <constructor> |
| | | <arg column="orderDate" javaType="java.util.Date"/> |
| | | <arg column="orderNum" javaType="java.lang.Integer"/> |
| | | </constructor> |
| | | </resultMap> |
| | | |
| | | <!--总览:总库位、已用库位、今日库存、今日出库、今日入库--> |
| | | <select id="overview" resultType="Double"> |
| | | SELECT COUNT(*) FROM asr_loc_mast WHERE loc_sts != 'Z' |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | UNION ALL |
| | | SELECT COUNT(*) FROM asr_loc_mast WHERE loc_sts = 'F' or loc_sts = 'P' or loc_sts = 'Q' or loc_sts = 'R' or loc_sts = 'S' or loc_sts = 'X' |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | UNION ALL |
| | | SELECT ISNULL(SUM(anfme), 0) FROM asr_loc_detl |
| | | <if test="areaId != null"> |
| | | WHERE area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- WHERE area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | UNION ALL |
| | | SELECT ISNULL(SUM(anfme), 0) FROM asr_wrkin_view WHERE CONVERT(VARCHAR, io_time, 23) = CONVERT(VARCHAR, GETDATE(), 23) |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | UNION ALL |
| | | SELECT ISNULL(SUM(anfme), 0) FROM asr_wrkout_view WHERE CONVERT(VARCHAR, io_time, 23) = CONVERT(VARCHAR, GETDATE(), 23) |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | </select> |
| | | |
| | | <select id="recentOrder" resultType="com.zy.asrs.entity.digitaltwin.DtOrderVo"> |
| | |
| | | SELECT CONVERT(VARCHAR, io_time, 23) AS boundDate, SUM(anfme) AS inBoundNum |
| | | FROM asr_wrkin_view |
| | | WHERE io_time BETWEEN #{startTime} AND #{endTime} |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | GROUP BY CONVERT(VARCHAR, io_time, 23) |
| | | </select> |
| | | |
| | |
| | | SELECT CONVERT(VARCHAR, io_time, 23) AS boundDate, SUM(anfme) AS outBoundNum |
| | | FROM asr_wrkout_view |
| | | WHERE io_time BETWEEN #{startTime} AND #{endTime} |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | <!-- <if test="areaId != null">--> |
| | | <!-- and area_id = #{areaId}--> |
| | | <!-- </if>--> |
| | | GROUP BY CONVERT(VARCHAR, io_time, 23) |
| | | </select> |
| | | |
| | | <select id="recentDetainMat" resultType="com.zy.asrs.entity.digitaltwin.DtDetainMatVo"> |
| | | select |
| | | * |
| | | from ( |
| | | select |
| | | ROW_NUMBER() OVER(Order by t.io_time desc) as row , * |
| | | from ( |
| | | SELECT area_id AS belongAreaId, area_name AS belongAreaName, matnr AS matId, maktx AS matName, |
| | | loc_no AS lokId, '' AS lokName, |
| | | DATEDIFF(MINUTE, appe_time, GETDATE()) AS detainTime, appe_time AS inBoundTime |
| | | FROM asr_loc_detl WHERE appe_time < #{startTime} |
| | | <if test="areaId != null"> |
| | | and area_id = #{areaId} |
| | | </if> |
| | | ) t |
| | | ) a where 1=1 and a.row between ((#{pageIndex}-1)*#{pageSize}+1) and (#{pageIndex}*#{pageSize}) |
| | | SELECT * |
| | | FROM ( |
| | | SELECT |
| | | ROW_NUMBER() OVER(ORDER BY t.inBoundTime DESC) AS rownum, |
| | | t.* |
| | | FROM ( |
| | | SELECT |
| | | matnr AS matId, |
| | | maktx AS matName, |
| | | loc_no AS lokId, |
| | | '' AS lokName, |
| | | DATEDIFF(MINUTE, appe_time, GETDATE()) AS detainTime, |
| | | appe_time AS inBoundTime |
| | | FROM asr_loc_detl |
| | | WHERE appe_time <= #{startTime} |
| | | ) t |
| | | ) a |
| | | WHERE a.rownum BETWEEN ((#{pageIndex}-1)*#{pageSize}+1) AND (#{pageIndex}*#{pageSize}) |
| | | </select> |
| | | |
| | | </mapper> |