| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.core.common.R; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.zy.asrs.entity.LocChartPie; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.digitaltwin.*; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.DigitalTwinService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RequestMapping("/digitalTwin") |
| | | @RestController |
| | |
| | | |
| | | @Resource |
| | | private DigitalTwinService digitalTwinService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | | /** |
| | | * 数据总览 |
| | |
| | | @RequestParam(required = false) String endDate){ |
| | | |
| | | List<DtInAndOutBoundVo> inAndOutBoundVoList = digitalTwinService.inAndOutBound(areaId, startDate, endDate); |
| | | // |
| | | // DtInAndOutBoundVo dtInAndOutBoundVo = DtInAndOutBoundVo.builder() |
| | | // .boundDate("2025-10-22") |
| | | // .inBoundNum(237) |
| | | // .outBoundNum(487) |
| | | // .build(); |
| | | // DtInAndOutBoundVo dtInAndOutBoundVo2 = DtInAndOutBoundVo.builder() |
| | | // .boundDate("2025-10-23") |
| | | // .inBoundNum(187) |
| | | // .outBoundNum(287) |
| | | // .build(); |
| | | // List<DtInAndOutBoundVo> inAndOutBoundVoList = new ArrayList<>(); |
| | | // inAndOutBoundVoList.add(dtInAndOutBoundVo); |
| | | // inAndOutBoundVoList.add(dtInAndOutBoundVo2); |
| | | |
| | | return R.ok().add(inAndOutBoundVoList); |
| | | } |
| | |
| | | public R warehouseDetail(@RequestParam(required = false) String areaId){ |
| | | |
| | | return R.ok(digitalTwinService.warehouseDetail(areaId)); |
| | | // List<DtLocDetailVo> dtLocDetailVoList = new ArrayList<>(); |
| | | // DtLocDetailVo dtLocDetailVo = new DtLocDetailVo(); |
| | | // dtLocDetailVo.setLocNo("CA0100202"); |
| | | // dtLocDetailVo.setLocSts("O"); |
| | | // dtLocDetailVo.setAreaId(10010L); |
| | | // dtLocDetailVo.setAreaName("刀具库"); |
| | | // dtLocDetailVo.setRow1(1); |
| | | // dtLocDetailVo.setBay1(2); |
| | | // dtLocDetailVo.setLev1(2); |
| | | // |
| | | // LocMast locMast = new LocMast(); |
| | | // locMast.setLocNo("CA0100202"); |
| | | // locMast.setLocSts("O"); |
| | | // locMast.setRow1(1); |
| | | // locMast.setBay1(2); |
| | | // locMast.setLev1(2); |
| | | // dtLocDetailVo.setLocMast(locMast); |
| | | // |
| | | // LocDetl locDetl = new LocDetl(); |
| | | // locDetl.setLocNo("CA0100202"); |
| | | // locDetl.setAreaId(10010L); |
| | | // locDetl.setAreaName("刀具库"); |
| | | // locDetl.setMatnr("mat10001"); |
| | | // locDetl.setMaktx("刀把"); |
| | | // dtLocDetailVo.setLocDetl(locDetl); |
| | | // dtLocDetailVoList.add(dtLocDetailVo); |
| | | // |
| | | // |
| | | // DtLocDetailVo dtLocDetailVo2 = new DtLocDetailVo(); |
| | | // dtLocDetailVo2.setLocNo("CA0100202"); |
| | | // dtLocDetailVo2.setLocSts("O"); |
| | | // dtLocDetailVo2.setAreaId(10010L); |
| | | // dtLocDetailVo2.setAreaName("刀具库"); |
| | | // dtLocDetailVo2.setRow1(1); |
| | | // dtLocDetailVo2.setBay1(2); |
| | | // dtLocDetailVo2.setLev1(2); |
| | | // |
| | | // LocMast locMast2 = new LocMast(); |
| | | // locMast2.setLocNo("CA0100203"); |
| | | // locMast2.setLocSts("O"); |
| | | // locMast2.setRow1(1); |
| | | // locMast2.setBay1(2); |
| | | // locMast2.setLev1(3); |
| | | // dtLocDetailVo2.setLocMast(locMast2); |
| | | // |
| | | // LocDetl locDetl2 = new LocDetl(); |
| | | // locDetl2.setLocNo("CA0100203"); |
| | | // locDetl2.setAreaId(10010L); |
| | | // locDetl2.setAreaName("刀具库"); |
| | | // locDetl2.setMatnr("mat10001"); |
| | | // 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("刀把"); |
| | | // |
| | | //// List<LocDetl> locDetlList = new ArrayList<>(); |
| | | //// locDetlList.add(locDetl); |
| | | //// locDetlList.add(locDetl2); |
| | | |
| | | // return R.ok().add(dtLocDetailVoList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询所有库位状态和物料-二机床信息化数字孪生用 |
| | | */ |
| | | @RequestMapping(value = "/getAllLocations") |
| | | public R getAllLocations() { |
| | | return digitalTwinService.getAllLocations(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询在库数量等信息 |
| | | */ |
| | | @RequestMapping(value = "/getLocalInfo") |
| | | public LocChartPie getLocalInfo() { |
| | | |
| | | LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | |
| | | return locUseRate; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有库的库存明细 |
| | | */ |
| | | @RequestMapping(value = "/getLocalDetal") |
| | | public R getLocalDetal() throws IOException { |
| | | |
| | | return R.ok(digitalTwinService.getLocalDetal()); |
| | | } |
| | | } |
| | |
| | | List<LocDetl> list = locDetlService.selectList(wrapper); |
| | | List<AbnormalLocDetlParam> result = new ArrayList<>(); |
| | | |
| | | Page<LocDetl> groupLocDetl = locDetlService.getStockStatis2(toPage(1, 10000, param, LocDetl.class)); |
| | | for (LocDetl locDetl : groupLocDetl.getRecords()) { |
| | | // 使用完整的明细数据,而不是分组数据 |
| | | for (LocDetl locDetl : list) { |
| | | AbnormalLocDetlParam abnormalLocDetlParam = new AbnormalLocDetlParam(); |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>() |
| | | .eq("matnr", locDetl.getMatnr())); |
| | | if (Cools.isEmpty(mat)) { |
| | | continue; |
| | | } |
| | | if (!Cools.isEmpty(mat.getStoreMax()) || !Cools.isEmpty(mat.getStoreMin())) { |
| | | |
| | | // 设置基本信息(无论是否异常) |
| | | abnormalLocDetlParam.setStoreMax(mat.getStoreMax()); |
| | | abnormalLocDetlParam.setStoreMaxDate(mat.getStoreMaxDate()); |
| | | abnormalLocDetlParam.setStoreMin(mat.getStoreMin()); |
| | |
| | | abnormalLocDetlParam.setSpecs(mat.getSpecs()); |
| | | abnormalLocDetlParam.setBatch(locDetl.getBatch()); |
| | | |
| | | // SimpleDateFormat simple = new SimpleDateFormat("yyyyMMdd"); |
| | | // Date maxDate = simple.parse(locDetl.getBatch()); |
| | | // long time = maxDate.getTime(); |
| | | // Date now = new Date(); |
| | | // long time1 = now.getTime(); |
| | | // abnormalLocDetlParam.setNowTime((int) ((time1 - time) / (1000 * 60 * 60 * 24))); |
| | | // 设置导出需要的其他字段 |
| | | abnormalLocDetlParam.setLocNo(locDetl.getLocNo()); |
| | | abnormalLocDetlParam.setZpallet(locDetl.getZpallet()); |
| | | abnormalLocDetlParam.setOrderNo(locDetl.getOrderNo()); |
| | | abnormalLocDetlParam.setModiTime(locDetl.getModiTime()); |
| | | |
| | | if (!Cools.isEmpty(mat.getStoreMax()) && locDetl.getAnfme() > mat.getStoreMax()) { |
| | | result.add(abnormalLocDetlParam); |
| | | } else if (!Cools.isEmpty(mat.getStoreMin()) && locDetl.getAnfme() < mat.getStoreMin()) { |
| | | // 计算库龄(实际在库天数) |
| | | if (locDetl.getAppeTime() != null) { |
| | | long diff = System.currentTimeMillis() - locDetl.getAppeTime().getTime(); |
| | | int days = (int) (diff / (1000 * 60 * 60 * 24)); |
| | | abnormalLocDetlParam.setNowTime(days); |
| | | } |
| | | |
| | | // 确保所有字段都有值,避免空值导致导出异常 |
| | | if (abnormalLocDetlParam.getLocNo() == null) abnormalLocDetlParam.setLocNo(""); |
| | | if (abnormalLocDetlParam.getZpallet() == null) abnormalLocDetlParam.setZpallet(""); |
| | | if (abnormalLocDetlParam.getOrderNo() == null) abnormalLocDetlParam.setOrderNo(""); |
| | | if (abnormalLocDetlParam.getSpecs() == null) abnormalLocDetlParam.setSpecs(""); |
| | | |
| | | // 总是添加到结果列表 |
| | | result.add(abnormalLocDetlParam); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok(exportSupport(result, fields)); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/locDetl/selectOwner/list/auth") |
| | | @ManagerAuth |
| | | public R selectOwnerlist(@RequestParam(defaultValue = "1")Integer curr, |
| | |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else if (entry.getKey().equals("loc_no")) { |
| | | wrapper.like(entry.getKey(), val); |
| | | } else { |
| | | } else if (entry.getKey().equals("barcode")) { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | else { |
| | | if (entry.getKey().equals("loc_type1")) { |
| | | sign = true; |
| | | } |
| | |
| | | locNoStr = split[1]; |
| | | picPath += "_" + locNoStr; |
| | | } |
| | | picList.add("http://" + WCS_URL + "/image/" + picPath + "-1.jpg"); |
| | | picList.add("http://" + WCS_URL + "/image/" + picPath + "-2.jpg"); |
| | | picList.add("http://172.26.1.189:8080//" + picPath + ".jpg"); |
| | | picList.add("http://172.26.1.189:8080//" + picPath + ".jpg"); |
| | | |
| | | LocPicDto locPicDto = new LocPicDto(); |
| | | locPicDto.setLocNo(locNoStr); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.CanFin; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.mes.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.service.MesService; |
| | | import com.zy.asrs.service.MobileService; |
| | | import com.zy.asrs.service.TaskService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Slf4j |
| | |
| | | |
| | | @Resource |
| | | private MesService mesService; |
| | | |
| | | @Autowired |
| | | private MobileService mobileService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | | log.info("{}接口被访问;appkey:{};请求数据:{}", request.getRequestURI(), appkey, JSON.toJSONString(obj)); |
| | |
| | | // 物料信息同步 |
| | | @PostMapping("/api/mes/synMatInfo") |
| | | @AppAuth(memo = "物料信息同步") |
| | | public MesReturn synMatInfo(@RequestHeader(required = false) String appkey,@RequestBody MesMatRecvForm param, HttpServletRequest request){ |
| | | auth(appkey, param, request); |
| | | // public MesReturn synMatInfo(@RequestHeader(required = false) String appkey, @RequestBody List<MesMatRecvForm> params, HttpServletRequest request){ |
| | | public MesReturn synMatInfo(@RequestHeader(required = false) String appkey, @RequestBody MesMatRecvForm params, HttpServletRequest request){ |
| | | auth(appkey, params, request); |
| | | MesReturn mesReturn = new MesReturn(); |
| | | try { |
| | | mesReturn = mesService.matInfoAndInBound(param); |
| | | // for (MesMatRecvForm param : params){ |
| | | // mesReturn = mesService.matInfoAndInBound(param); |
| | | // } |
| | | mesReturn = mesService.matInfoAndInBound(params); |
| | | } catch (Exception e) { |
| | | log.error(String.valueOf(e)); |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("物料信息同步失败"); |
| | | } |
| | |
| | | return mesService.queryInventory(itemno,orderNo); |
| | | } |
| | | |
| | | @PostMapping("/api/mes/pauseAGV") |
| | | public MesReturn AGVPause(@RequestBody JSONObject param) throws IOException { |
| | | MesReturn mesReturn = new MesReturn(); |
| | | int AGVType; |
| | | if (param.containsKey("zoneCode")){ |
| | | param.put("mapCode", "BB"); |
| | | param.put("invoke", "FREEZE"); |
| | | AGVType = 1; |
| | | /** |
| | | * MES调用PDA的AGV订单入库接口 |
| | | * @param combParam |
| | | * @return |
| | | */ |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | log.info("=============== MES下发组托订单 ==============="); |
| | | log.info("{}", combParam); |
| | | log.info("=============== MES下发组托订单 ==============="); |
| | | if (combParam.getUserId() != null && !combParam.getUserId().equals(null)){ |
| | | mobileService.comb(combParam, combParam.getUserId()); |
| | | }else { |
| | | AGVType = 2; |
| | | mobileService.comb(combParam, getUserId()); |
| | | } |
| | | if (mesService.AGVPause(param, AGVType) == 1){ |
| | | mesReturn.setSuccess("1"); |
| | | mesReturn.setMessage("成功"); |
| | | return mesReturn; |
| | | }else { |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("失败"); |
| | | return mesReturn; |
| | | } |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | /** |
| | | * MES调用PDA的补空板 |
| | | * |
| | | * @param locNo 目标站点 |
| | | * @param size 托盘大小 1:小托盘 2:大托盘 |
| | | * @return |
| | | */ |
| | | @PostMapping("/callEmptyBinOutBound") |
| | | public synchronized R callEmptyBinOutBound(@RequestParam(required = false) String locNo |
| | | , @RequestParam(required = false) String size |
| | | , @RequestParam(required = false) String palletFormat |
| | | , @RequestParam(required = false) String agvTaskNo) { |
| | | if (Cools.isEmpty(locNo) || Cools.isEmpty(size)) { |
| | | return R.error("站点或者大小不能为空"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 110).eq("memo", locNo)); |
| | | if (wrkMast != null) { |
| | | return R.error("该站点="+locNo+"已经有空板出库任务,为了不堵塞堆垛机接驳站点,禁止下发多个空板出库任务"); |
| | | } |
| | | return mobileService.callEmptyBinOutBound(locNo, size, palletFormat, agvTaskNo, 9995L); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 空板回库或者拣料回库 |
| | | * |
| | | * @param sourceStaNo |
| | | * @param staNo |
| | | * @return |
| | | */ |
| | | @RequestMapping("/AGVStartReturn") |
| | | public synchronized R AGVStartReturn(@RequestParam(required = false) String sourceStaNo |
| | | , @RequestParam(required = false) String staNo |
| | | , @RequestParam(required = false) String taskNo) { |
| | | if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) { |
| | | return R.error("源站点和托盘码不能为空"); |
| | | } |
| | | List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("source_sta_no", sourceStaNo).eq("barcode", staNo)); |
| | | if (tasks.size() > 0) { |
| | | return R.error("该托盘="+staNo+"已经存在搬运任务,请不要重复下发"); |
| | | } |
| | | |
| | | String barcode = staNo.substring(0,1); |
| | | if(barcode.equals("3")){ |
| | | taskNo = "307"; |
| | | }else if(barcode.equals("4")){ |
| | | taskNo = "402"; |
| | | }else if(barcode.equals("5")){ |
| | | taskNo = "401"; |
| | | } |
| | | |
| | | R r = R.ok(); |
| | | //生成AGV搬运出库任务 |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | Date date = new Date(); |
| | | String TaskNo = 555555 + "aa" + date.getTime(); |
| | | task.setWrkNo((int) date.getTime()) |
| | | .setTaskNo(TaskNo) |
| | | .setIoTime(date) |
| | | .setWrkSts(301L) // 工作状态:301.任务下发 |
| | | .setIoType(3) // 入出库状态: 3.站到站 4.站到区域 |
| | | .setTaskType("agv") |
| | | .setIoPri(10D) |
| | | .setFullPlt("Y") // 满板:Y |
| | | .setPicking("N") // 拣料 |
| | | .setExitMk("N")// 退出 |
| | | .setStaNo(taskNo) |
| | | .setSourceStaNo(sourceStaNo)//agv取货站点 |
| | | .setEmptyMk("N")// 空板 |
| | | .setBarcode(staNo)// 托盘码 |
| | | .setLinkMis("N") |
| | | .setAppeUser(9945L) |
| | | .setAppeTime(date) |
| | | .setModiUser(9945L) |
| | | .setModiTime(date); |
| | | if (taskService.insert(task)) { |
| | | Date now = new Date(); |
| | | CanFin canFin = new CanFin(); |
| | | canFin.setAgvType("agv-in"); |
| | | canFin.setInNo(TaskNo); |
| | | canFin.setApplyTime(now); |
| | | canFinMapper.insert(canFin); |
| | | }else{ |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | return r; |
| | | } |
| | | @PostMapping("/api/mes/pauseAGV") |
| | | public MesReturn AGVPause(@RequestBody JSONObject param){ |
| | | MesReturn mesReturn = new MesReturn(); |
| | | |
| | | String type = "STOP"; |
| | | if (param.getString("type") != null){ |
| | | type = "START"; |
| | | } |
| | | |
| | | switch (mesService.AGVPause(param, type)){ |
| | | case 1: |
| | | mesReturn.setSuccess("1"); |
| | | mesReturn.setMessage("AGV暂停或启动成功"); |
| | | return mesReturn; |
| | | case 2: |
| | | mesReturn.setSuccess("1"); |
| | | mesReturn.setMessage("海康AGV暂停或启动成功"); |
| | | return mesReturn; |
| | | case 3: |
| | | mesReturn.setSuccess("1"); |
| | | mesReturn.setMessage("华晓AGV暂停或启动成功"); |
| | | return mesReturn; |
| | | case 4: |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("AGV暂停或启动调用失败"); |
| | | return mesReturn; |
| | | } |
| | | mesReturn.setSuccess("2"); |
| | | mesReturn.setMessage("AGV暂停或启动调用失败"); |
| | | return mesReturn; |
| | | } |
| | | } |
| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.entity.result.MobileAdjustResult; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.OrderDetlPakinServiceImpl; |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | @Resource |
| | | private StaDescService staDescService; |
| | |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | |
| | | if (combParam.getUserId() != null && !combParam.getUserId().equals(null)){ |
| | | mobileService.comb(combParam, combParam.getUserId()); |
| | | }else { |
| | | mobileService.comb(combParam, getUserId()); |
| | | } |
| | | |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | |
| | | .setAppeTime(date) |
| | | .setModiUser(9945L) |
| | | .setModiTime(date); |
| | | if (!taskService.insert(task)) { |
| | | if (taskService.insert(task)) { |
| | | Date now = new Date(); |
| | | CanFin canFin = new CanFin(); |
| | | canFin.setAgvType("agv-in"); |
| | | canFin.setInNo(TaskNo); |
| | | canFin.setApplyTime(now); |
| | | canFinMapper.insert(canFin); |
| | | }else{ |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | return r; |
| | | return R.error("下发失败"); |
| | | } |
| | | |
| | | @RequestMapping("/orderIn") |
| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.OrderDomainParam; |
| | | import com.zy.asrs.entity.result.WrkTraceVo; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | @RequestMapping(value = "/order/nav/list/auth") |
| | | @ManagerAuth |
| | |
| | | @ManagerAuth(memo = "手动删除订单") |
| | | @Transactional |
| | | public R delete(@RequestParam Long orderId){ |
| | | OrderPakout orderPakout = orderService.selectOne(new EntityWrapper<OrderPakout>() |
| | | .eq("id", orderId)); |
| | | CanFin deleteCanFin = new CanFin(); |
| | | deleteCanFin.setOutNo(orderPakout.getOrderNo()); |
| | | List<CanFin> canFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true) |
| | | .isNotNull("out_no")); |
| | | if (!canFinList.isEmpty()){ |
| | | for (CanFin canFin : canFinList){ |
| | | if (canFin.getOutNo().equals(deleteCanFin.getOutNo())){ |
| | | canFinMapper.deleteById(canFin.getId()); |
| | | } |
| | | } |
| | | } |
| | | List<CanFin> newCanFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true)); |
| | | if (!newCanFinList.isEmpty()){ |
| | | CanFin firstCanFin = newCanFinList.get(0); |
| | | firstCanFin.setTaskStatus("canout"); |
| | | canFinMapper.updateById(firstCanFin); |
| | | } |
| | | orderService.remove(orderId); |
| | | // Order order = orderService.selectById(orderId); |
| | | // if (order != null) { |
| | |
| | | } |
| | | String bar = ""; |
| | | //具体待定 |
| | | // if(!Cools.isEmpty(orderPakout.getShipCode())&&orderPakout.getShipCode().equals("A01")){ |
| | | // bar = "A01"; |
| | | // } |
| | | if(!Cools.isEmpty(orderPakout.getShipCode())){ |
| | | bar = orderPakout.getShipCode(); |
| | | } |
| | | LocMast locMast = new LocMast(); |
| | | if (Cools.isEmpty(bar)) { |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.CanFin; |
| | | import com.zy.asrs.entity.Task; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.service.TaskService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | @RequestMapping(value = "/task/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | taskService.completeWrkMast(workNo, getUserId()); |
| | | return R.ok("工作档已完成"); |
| | | } else if (type == 2) { |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>() |
| | | .eq("wrk_no", workNo)); |
| | | if (task != null){ |
| | | CanFin deleteCanFin = new CanFin(); |
| | | deleteCanFin.setInNo(task.getTaskNo()); |
| | | List<CanFin> canFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true) |
| | | .isNotNull("in_no")); |
| | | if (!canFinList.isEmpty()){ |
| | | for (CanFin canFin : canFinList){ |
| | | if (canFin.getInNo().equals(deleteCanFin.getInNo())){ |
| | | canFinMapper.deleteById(canFin.getId()); |
| | | } |
| | | } |
| | | } |
| | | List<CanFin> newCanFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true)); |
| | | if (!newCanFinList.isEmpty()){ |
| | | CanFin firstCanFin = newCanFinList.get(0); |
| | | firstCanFin.setTaskStatus("canout"); |
| | | canFinMapper.updateById(firstCanFin); |
| | | } |
| | | } |
| | | taskService.cancelWrkMast(workNo, getUserId()); |
| | | return R.ok("工作档已取消"); |
| | | } else if (type == 3) { |
| New file |
| | |
| | | package com.zy.asrs.entity.digitaltwin; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author pang.jiabao |
| | | * @description 查询所有库位状态和物料-二机床信息化数字孪生用 |
| | | * @createDate 2026/1/26 11:13 |
| | | */ |
| | | @Data |
| | | public class AllLocationsVo { |
| | | |
| | | // 库位号 |
| | | private String locNo; |
| | | |
| | | // 库位状态,O空库位(英文不是数字);F 在库;D 空板;P 出库中;R 出库预约;S 入库预约;其他 其他; |
| | | private String locSts; |
| | | |
| | | private List<LocDetl> locDetls = new ArrayList<>(); |
| | | |
| | | @Data |
| | | public static class LocDetl { |
| | | |
| | | @ApiModelProperty(value = "商品编号") |
| | | private String matnr; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String maktx; |
| | | |
| | | private Double anfme; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("can_fin") |
| | | public class CanFin { |
| | | |
| | | /** |
| | | * 主键编号 |
| | | */ |
| | | @ApiModelProperty(value= "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 入库单号 |
| | | */ |
| | | @TableField("in_no") |
| | | private String inNo; |
| | | |
| | | /** |
| | | * 出库号 |
| | | * */ |
| | | @TableField("out_no") |
| | | private String outNo; |
| | | |
| | | /** |
| | | * 插入时间 |
| | | */ |
| | | @TableField("apply_time") |
| | | private Date applyTime; |
| | | |
| | | /** |
| | | * 任务类型 |
| | | */ |
| | | @TableField("task_type") |
| | | private String taskType; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
| | | @TableField("task_status") |
| | | private String taskStatus; |
| | | |
| | | /** |
| | | * 出库类型 |
| | | */ |
| | | @TableField("out_type") |
| | | private String outType; |
| | | |
| | | /** |
| | | * agv类型 |
| | | */ |
| | | @TableField("agv_type") |
| | | private String agvType; |
| | | } |
| | |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 是否是pda发的 |
| | | */ |
| | | @ApiModelProperty(value= "是否是PDA发的任务") |
| | | @TableField("is_PDA") |
| | | private String isPda; |
| | | |
| | | |
| | | public Task() {} |
| | | |
| | | public String getYmd$(){ |
| | |
| | | // @NotNull |
| | | @JsonProperty("qty") |
| | | @JSONField(name = "qty") |
| | | private Integer qty; |
| | | private Double qty; |
| | | |
| | | // 零件二维码 |
| | | @JsonProperty("ItemBarcode") |
| | |
| | | @JSONField(name = "TuoPanId") |
| | | private String TuoPanId; |
| | | |
| | | private String isPDA; |
| | | } |
| | |
| | | */ |
| | | private Integer nowTime; |
| | | |
| | | |
| | | /** |
| | | * 库龄(天),对应前端的 storeDate 字段 |
| | | */ |
| | | public Integer getStoreDate() { |
| | | return this.nowTime; |
| | | } |
| | | public String getLocNo$() { |
| | | LocMastService service = SpringUtils.getBean(LocMastService.class); |
| | | LocMast locMast = service.selectById(this.locNo); |
| | |
| | | |
| | | private List<CombMat> combMats; |
| | | |
| | | private Long userId; // 新增字段 |
| | | |
| | | @Data |
| | | public static class CombMat { |
| | | |
| New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.zy.asrs.entity.CanFin; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CanFinMapper extends BaseMapper<CanFin> { |
| | | |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Date; |
| | |
| | | @Param("modiTimeEnd") Date modiTimeEnd); |
| | | |
| | | |
| | | @Update("update asr_wrk_detl_log set io_time = #{ioTime} where wrk_no = #{workNo}") |
| | | int updateIoTime(@Param("workNo") Integer workNo, @Param("ioTime") Date ioTime); |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.digitaltwin.*; |
| | | import com.zy.asrs.entity.digitaltwin.AllLocationsVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface DigitalTwinService { |
| | | |
| | |
| | | void locNumCount(); |
| | | |
| | | DtEquipmentVo equipment(String areaId); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询所有库位状态和物料-二机床信息化数字孪生用 |
| | | */ |
| | | R getAllLocations(); |
| | | |
| | | |
| | | List<Map<String, Object>> getLocalDetal(); |
| | | } |
| | |
| | | |
| | | MesReturn queryInventory(String itemno,String orderNo); |
| | | |
| | | int AGVPause(JSONObject params, int AGVType); |
| | | int AGVPause(JSONObject params, String Type); |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.OrderPakout; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | 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.entity.digitaltwin.AllLocationsVo; |
| | | import com.zy.asrs.mapper.DigitalTwinMapper; |
| | | import com.zy.asrs.mapper.LocCountMapper; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.DigitalTwinService; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | |
| | | private DigitalTwinMapper digitalTwinMapper; |
| | | @Resource |
| | | private LocCountMapper locCountMapper; |
| | | @Autowired |
| | | private LocDetlMapper locDetlMapper; |
| | | |
| | | /** |
| | | * 总览:总库位、已用库位、剩余库位、今日出库、今日入库、剩余库位 |
| | |
| | | endTime = now; |
| | | |
| | | } else { |
| | | SimpleDateFormat sdf = |
| | | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | |
| | | SimpleDateFormat sdf; |
| | | try { |
| | | // 尝试解析yyyyMMdd格式 |
| | | if (startDate.length() == 8 && endDate.length() == 8) { |
| | | sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | // 设置结束时间为当天的23:59:59.999 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(endTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar.set(Calendar.MINUTE, 59); |
| | | calendar.set(Calendar.SECOND, 59); |
| | | calendar.set(Calendar.MILLISECOND, 999); |
| | | endTime = calendar.getTime(); |
| | | } else { |
| | | // 尝试解析yyyy-MM-dd HH:mm:ss.SSS格式 |
| | | sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | // 解析失败时使用默认的7天时间范围 |
| | | Date now = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(now); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -7); |
| | | startTime = calendar.getTime(); |
| | | endTime = now; |
| | | } |
| | | } |
| | | List<DtOrderVo> dbOrder = digitalTwinMapper.recentOrder(startTime, endTime); |
| | |
| | | endTime = now; |
| | | |
| | | } else { |
| | | SimpleDateFormat sdf = |
| | | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | |
| | | SimpleDateFormat sdf; |
| | | try { |
| | | // 尝试解析yyyyMMdd格式 |
| | | if (startDate.length() == 8 && endDate.length() == 8) { |
| | | sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | // 设置结束时间为当天的23:59:59.999 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(endTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar.set(Calendar.MINUTE, 59); |
| | | calendar.set(Calendar.SECOND, 59); |
| | | calendar.set(Calendar.MILLISECOND, 999); |
| | | endTime = calendar.getTime(); |
| | | } else { |
| | | // 尝试解析yyyy-MM-dd HH:mm:ss.SSS格式 |
| | | sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | startTime = sdf.parse(startDate); |
| | | endTime = sdf.parse(endDate); |
| | | } |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | // 解析失败时使用默认的7天时间范围 |
| | | Date now = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(now); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -7); |
| | | startTime = calendar.getTime(); |
| | | endTime = now; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // endregion |
| | | |
| | | // endregion |
| | | @Resource |
| | | private LocDetlService locDetlService; |
| | | |
| | | @Override |
| | | public R getAllLocations() { |
| | | List<AllLocationsVo> allLocationsVos = new ArrayList<>(); |
| | | List<LocMast> locMastList = locMastService.selectList(new EntityWrapper<>()); |
| | | locMastList.forEach(locMast -> { |
| | | AllLocationsVo allLocationsVo = new AllLocationsVo(); |
| | | allLocationsVo.setLocNo(locMast.getLocNo()); |
| | | String locSts = locMast.getLocSts(); |
| | | allLocationsVo.setLocSts(locSts); |
| | | // 有库存 |
| | | if (locSts.equals("F") || locSts.equals("P") || locSts.equals("Q") || locSts.equals("R")) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", locMast.getLocNo())); |
| | | if (!locDetls.isEmpty()) { |
| | | List<AllLocationsVo.LocDetl> locDetlList = locDetls.stream().map(locDetl -> { |
| | | AllLocationsVo.LocDetl locDetl1 = new AllLocationsVo.LocDetl(); |
| | | BeanUtils.copyProperties(locDetl, locDetl1); |
| | | return locDetl1; |
| | | } |
| | | ).collect(Collectors.toList()); |
| | | allLocationsVo.setLocDetls(locDetlList); |
| | | } |
| | | } |
| | | allLocationsVos.add(allLocationsVo); |
| | | }); |
| | | return R.ok(allLocationsVos); |
| | | } |
| | | |
| | | |
| | | public List<Map<String, Object>> getLocalDetal() { |
| | | List<LocDetl> locDetls = locDetlMapper.selectList(new EntityWrapper<>()); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | |
| | | for (LocDetl locDetl : locDetls) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("zpallet", locDetl.getZpallet()); |
| | | item.put("anfme", locDetl.getAnfme()); |
| | | item.put("matnr", locDetl.getMatnr()); |
| | | item.put("maktx", locDetl.getMaktx()); |
| | | result.add(item); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import com.zy.asrs.entity.mes.*; |
| | | import com.zy.asrs.entity.rcs.*; |
| | | import com.zy.asrs.mapper.AgvInfoMapper; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.mapper.MatItemBarcodeMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.sql.Time; |
| | | import java.text.ParseException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | |
| | | // region MES接口 |
| | |
| | | newTag.setUpdateBy(defaultUserId); |
| | | newTag.setUpdateTime(now); |
| | | |
| | | if (!tagService.insert(newTag)) |
| | | if (!tagService.insert(newTag)){ |
| | | log.error("插入tag失败"); |
| | | return -1; |
| | | } |
| | | tagId = newTag.getId(); |
| | | } else { |
| | | tagId = tag.getId(); |
| | |
| | | newMat.setUpdateTime(now); |
| | | newMat.setStatus(1); |
| | | if (mat == null) { |
| | | if (!matService.insert(newMat)) |
| | | if (!matService.insert(newMat)){ |
| | | log.error("插入失败"); |
| | | return -2; |
| | | } |
| | | } |
| | | } else { |
| | | log.error("tagId小于0"); |
| | | return -1; |
| | | } |
| | | |
| | |
| | | |
| | | // 校验订单是否重复 |
| | | OrderPakin order = orderPakinService.selectByNo(entry.getKey()); |
| | | // 如果单据不存在则添加;如果单据存在,作业中无法修改,反之则修改单据 |
| | | OrderPakin orderPakin; |
| | | |
| | | // 如果单据不存在则添加;如果单据存在且settle为1则追加明细;如果settle为6则删除后重新生成;作业中无法修改 |
| | | if (!Cools.isEmpty(order)) { |
| | | if (order.getSettle() > 1L) { |
| | | if (order.getSettle() > 1L && order.getSettle() < 6L) { |
| | | throw new CoolException(entry.getKey() + "正在出库,无法修改单据"); |
| | | } |
| | | } else if (order.getSettle() == 6L) { |
| | | orderPakinService.remove(order.getId()); |
| | | orderPakin = null; |
| | | } else if (order.getSettle() == 1L) { |
| | | orderPakin = order; |
| | | } else { |
| | | orderPakin = null; |
| | | } |
| | | } else { |
| | | orderPakin = null; |
| | | } |
| | | |
| | | // 生成订单 |
| | | // 生成订单或更新订单 |
| | | JSONObject newMemo = new JSONObject(); |
| | | newMemo.put("sourceNo", matRecvForm.getSourceNo()); |
| | | newMemo.put("sourceName", matRecvForm.getSourceName()); |
| | |
| | | newMemo.put("itemdata", list); |
| | | |
| | | |
| | | // 生成订单 |
| | | OrderPakin orderPakin = new OrderPakin(); |
| | | // 如果订单不存在或已删除,则生成新订单 |
| | | if (orderPakin == null) { |
| | | orderPakin = new OrderPakin(); |
| | | orderPakin.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | orderPakin.setOrderNo(entry.getKey()); |
| | | orderPakin.setOrderTime(DateUtils.convert(now)); |
| | |
| | | orderPakin.setStatus(1); |
| | | orderPakin.setCreateBy(defaultUserId); |
| | | orderPakin.setCreateTime(now); |
| | | orderPakin.setUpdateBy(defaultUserId); |
| | | orderPakin.setUpdateTime(now); |
| | | orderPakin.setMemo(JSONObject.toJSONString(newMemo)); //为出库完成反馈保存 |
| | | orderPakin.setMemo(JSONObject.toJSONString(newMemo)); |
| | | orderPakin.setPakinPakoutStatus(1); |
| | | orderPakinService.insert(orderPakin); |
| | | } else { |
| | | // 更新订单的memo和更新时间 |
| | | orderPakin.setMemo(JSONObject.toJSONString(newMemo)); |
| | | orderPakin.setUpdateBy(defaultUserId); |
| | | orderPakin.setUpdateTime(now); |
| | | orderPakinService.updateById(orderPakin); |
| | | } |
| | | if (list != null && !list.isEmpty()) { |
| | | for (MesMatInfo mesMatInfo : list) { |
| | | |
| | |
| | | OrderDetlPakin orderDetlPakin = new OrderDetlPakin(); |
| | | orderDetlPakin.setOrderId(orderPakin.getId()); |
| | | orderDetlPakin.setOrderNo(orderPakin.getOrderNo()); |
| | | orderDetlPakin.setAnfme(Double.valueOf(mesMatInfo.getQty())); |
| | | orderDetlPakin.setAnfme(mesMatInfo.getQty()); |
| | | orderDetlPakin.setQty(0.0); |
| | | orderDetlPakin.setMatnr(mat.getMatnr()); |
| | | orderDetlPakin.setMaktx(mat.getMaktx()); |
| | |
| | | if (docType == null) { |
| | | return 0; |
| | | } |
| | | |
| | | //生成出库单 |
| | | if (docType.getPakout() == 1) { |
| | | long settle = 1; |
| | |
| | | orderPakout.setMemo(JSONObject.toJSONString(mesCallOutApply)); |
| | | orderPakout.setPakinPakoutStatus(2); |
| | | orderPakout.setCstmrName(mesCallOutApply.getStationId());//agv目标站点 |
| | | /* |
| | | // 查询can_fin表中apply_time最新的记录 |
| | | List<CanFin> canFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", false) |
| | | ); |
| | | if (!canFinList.isEmpty()) { |
| | | CanFin firstCanFin = canFinList.get(0); |
| | | if (firstCanFin.getAgvType().equals("agv-in-out")) { |
| | | // 只修改需要更新的字段 |
| | | if (firstCanFin.getOutNo() == null){ |
| | | firstCanFin.setOutType("waiting"); |
| | | firstCanFin.setOutNo(mesCallOutApply.getOrderNo()); |
| | | // 确保其他字段保持不变 |
| | | canFinMapper.updateById(firstCanFin); |
| | | log.info("已更新can_fin表最早记录的out_no,ID:{},出库单号:{}", |
| | | firstCanFin.getId(), mesCallOutApply.getOrderNo()); |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | |
| | | if (!orderPakoutService.insert(orderPakout)) { |
| | | log.error("MES保存出库订单(叫料)主档失败"); |
| | | throw new CoolException("保存出库订单(叫料)主档失败"); |
| | | } |
| | | |
| | | if (mesCallOutApply.getTransType().equals("装配出库单")){ |
| | | CanFin canFin = new CanFin(); |
| | | Date time = now; |
| | | canFin.setAgvType("agv-out"); |
| | | canFin.setOutNo(mesCallOutApply.getOrderNo()); |
| | | List<CanFin> canFinList = canFinMapper.selectList(new EntityWrapper<>()); |
| | | if (canFinList.isEmpty()){ |
| | | canFin.setTaskStatus("canout"); |
| | | }else { |
| | | canFin.setTaskStatus("waiting"); |
| | | } |
| | | canFin.setApplyTime(time); |
| | | canFinMapper.insert(canFin); |
| | | } |
| | | |
| | | Set<String> set = new HashSet<>(); |
| | | // 生成明细 |
| | | if (mesCallOutApply.getItemdata() != null && !mesCallOutApply.getItemdata().isEmpty()) { |
| | |
| | | //有多少种不同的配盘号 只有配盘出库单需要知道 |
| | | if (mesCallOutApply.getTransType().equals("配盘出库单")) { |
| | | orderPakout.setPayType(set.size()); |
| | | String shipCode = mesCallOutApply.getItemdata().get(0).getTrayid().split("-")[2]; |
| | | String orderNo = mesCallOutApply.getOrderNo(); |
| | | String shipCode = orderNo.substring(orderNo.lastIndexOf("-") + 1); |
| | | orderPakout.setShipCode(shipCode);//区域 是否是特殊托盘 |
| | | orderPakoutService.updateById(orderPakout); |
| | | } |
| | |
| | | task.setPltType(transTask.getAgvFactory());//华晓AGV |
| | | task.setPacked(transTask.getRackNumber());//料架号 |
| | | task.setCtnType(1); |
| | | task.setIsPda(transTask.getIsPDA()); |
| | | |
| | | if (taskService.insert(task)) { |
| | | if (transTask.getNextStationId().equals("307")){ |
| | | CanFin canFin = new CanFin(); |
| | | Date time = now; |
| | | // canFin.setAgvType("agv-in-out"); |
| | | canFin.setAgvType("agv-in"); |
| | | canFin.setInNo(transTask.getTaskno()); |
| | | canFin.setTaskStatus("waiting"); |
| | | canFin.setApplyTime(time); |
| | | canFinMapper.insert(canFin); |
| | | } |
| | | result.put("Success", "1"); |
| | | result.put("Message", "任务接收成功"); |
| | | |
| | |
| | | mesReturn.setSuccess("2"); |
| | | |
| | | if ("Y".equals(allow.getStatus())) { |
| | | String TaskNo = allow.getTaskno(); |
| | | if(allow.getTaskno().contains("-")){ |
| | | TaskNo = allow.getTaskno().substring(0, allow.getTaskno().length() - 2); |
| | | |
| | | // 修改后的逻辑:有"-"则去掉最后一个"-"及后面内容,没有则保持原样 |
| | | String taskNo = allow.getTaskno(); |
| | | if (taskNo.contains("-")) { |
| | | taskNo = allow.getTaskno().substring(0, taskNo.lastIndexOf("-")); |
| | | } |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", TaskNo)); |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", taskNo)); |
| | | if (Cools.isEmpty(task)) { |
| | | mesReturn.setMessage("没有找个该任务编号=" + allow.getTaskno() + "的AGV移动任务"); |
| | | } else { |
| | |
| | | mesReturn.setSuccess("2"); |
| | | |
| | | if ("Y".equals(allow.getStatus())) { |
| | | String TaskNo = allow.getTaskno(); |
| | | if(allow.getTaskno().contains("-")){ |
| | | TaskNo = allow.getTaskno().substring(0, allow.getTaskno().length() - 2); |
| | | // 修改后的逻辑:有"-"则去掉最后一个"-"及后面内容,没有则保持原样 |
| | | String taskNo = allow.getTaskno(); |
| | | if (taskNo.contains("-")) { |
| | | taskNo = allow.getTaskno().substring(0, taskNo.lastIndexOf("-")); |
| | | } |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", TaskNo)); |
| | | Task task = taskService.selectOne(new EntityWrapper<Task>().eq("task_no", taskNo)); |
| | | if (Cools.isEmpty(task)) { |
| | | mesReturn.setMessage("没有找个该任务编号=" + TaskNo + "的AGV移动任务"); |
| | | mesReturn.setMessage("没有找个该任务编号=" + taskNo + "的AGV移动任务"); |
| | | } else { |
| | | //查看申请站点的是海康还是华晓 |
| | | //海康 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int AGVPause(JSONObject params, int AGVType){ |
| | | MesReturn mesReturn = new MesReturn(); |
| | | public int AGVPause(JSONObject mesInfo, String Type){ |
| | | |
| | | String hik_url = "api/robot/controller/zone/pause"; |
| | | String hx_url = ""; |
| | | String URL = ""; |
| | | if (AGVType == 1){ |
| | | URL = HIK_URL + hik_url; |
| | | }else { |
| | | URL = HX_URL + hx_url; |
| | | } |
| | | int i = HikPersonIn(mesInfo, Type); |
| | | int j = HxPersonIn(mesInfo, Type); |
| | | |
| | | String response = RcsServiceImpl.sendPost(URL, JSONObject.toJSONString(params)); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (!StringUtils.isEmpty(response) && jsonObject.getString("code").equals("SUCCESS")) { |
| | | if (i == 1){ |
| | | if (j == 1){ |
| | | return 1; |
| | | }else |
| | | return 2; |
| | | }else { |
| | | if (j == 1){ |
| | | return 3; |
| | | }else |
| | | return 4; |
| | | } |
| | | } |
| | | |
| | | //人员入侵系统海康实现方法 |
| | | public int HikPersonIn(JSONObject param, String Type) { |
| | | String hik_blockUrl = "api/robot/controller/zone/blockade"; |
| | | String hik_pauseUrl = "api/robot/controller/zone/pause"; |
| | | |
| | | String BLOCK_URL = HIK_URL + hik_blockUrl; |
| | | String PAUSE_URL = HIK_URL + hik_pauseUrl; |
| | | |
| | | JSONObject rcsBlock = new JSONObject(); |
| | | JSONObject rcsPause = new JSONObject(); |
| | | |
| | | rcsBlock.put("mapCode", "BB"); |
| | | rcsPause.put("mapCode", "BB"); |
| | | |
| | | rcsBlock.put("zoneCode", param.getString("AreaCode")); |
| | | rcsPause.put("zoneCode", param.getString("AreaCode")); |
| | | |
| | | if (Type.equals("STOP")){ |
| | | rcsBlock.put("invoke", "BLOCKADE"); |
| | | rcsPause.put("invoke","FREEZE"); |
| | | } |
| | | if (Type.equals("START")){ |
| | | rcsBlock.put("invoke", "OPENUP"); |
| | | rcsPause.put("invoke","RUN"); |
| | | } |
| | | |
| | | String blockResponse = RcsServiceImpl.sendPost(BLOCK_URL, JSONObject.toJSONString(rcsBlock)); |
| | | String PauseResponse = RcsServiceImpl.sendPost(PAUSE_URL, JSONObject.toJSONString(rcsPause)); |
| | | JSONObject blockJsonObject = JSON.parseObject(blockResponse); |
| | | JSONObject pauseJsonObject = JSON.parseObject(PauseResponse); |
| | | if (!StringUtils.isEmpty(blockResponse) && (blockJsonObject.getString("code").equals("SUCCESS"))) { |
| | | if (!StringUtils.isEmpty(PauseResponse) && (pauseJsonObject.getString("code").equals("SUCCESS"))) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | //直接返回,不需要信息 |
| | | return 0; |
| | | } |
| | | |
| | | //人员入侵系统华晓实现方法 |
| | | public int HxPersonIn(JSONObject param, String Type) { |
| | | JSONObject rcsPause = new JSONObject(); |
| | | |
| | | String hx_url = "controller/notify/isstop"; |
| | | String URL = HX_URL + hx_url; |
| | | |
| | | rcsPause.put("agvno", 0); |
| | | rcsPause.put("areaNo", param.getString("AreaCode")); |
| | | |
| | | if (Type.equals("STOP")) |
| | | rcsPause.put("action", "stop"); |
| | | |
| | | if (Type.equals("START")) |
| | | rcsPause.put("action", "start"); |
| | | |
| | | if (Type.equals("STOP")){ |
| | | for (int i = 0; i < 10; i++){ |
| | | String response = RcsServiceImpl.sendPost(URL, JSONObject.toJSONString(rcsPause)); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (!StringUtils.isEmpty(response) && (jsonObject.getString("code").equals("SUCCESS") || jsonObject.getInteger("code") == 200)) { |
| | | return 1; |
| | | }else |
| | | return 0; |
| | | } |
| | | } |
| | | if (Type.equals("START")){ |
| | | String response = RcsServiceImpl.sendPost(URL, JSONObject.toJSONString(rcsPause)); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (!StringUtils.isEmpty(response) && (jsonObject.getString("code").equals("SUCCESS") || jsonObject.getInteger("code") == 200)) { |
| | | return 1; |
| | | }else |
| | | return 0; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | // endregion |
| | |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.enums.CommonEnum; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | @Autowired |
| | | private AdjDetlService adjDetlService; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void comb(CombParam param, Long userId) { |
| | | public void |
| | | comb(CombParam param, Long userId) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!detlDto.getStandby1().isEmpty() && detlDto.getStandby1() != null && !detlDto.getStandby1().equals("")){ |
| | | waitPakin.setStandby1(detls.getStandby1());//配盘号 |
| | | } |
| | | |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | |
| | | // Date date1 = now; |
| | | // CanFin canFin = new CanFin(); |
| | | // canFin.setApplyTime(date1); |
| | | // canFin.setAgvType("agv-in"); |
| | | // canFinMapper.insert(canFin); |
| | | |
| | | Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo).collect(Collectors.toSet()); |
| | | stringSet.forEach(orderNo -> { |
| | |
| | | // 生成工作档 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKOUT.type); |
| | | WrkMast wrkMast = new WrkMast(); |
| | | if (agvTaskNo!=null){ |
| | | wrkMast.setUserNo(agvTaskNo); |
| | | }else { |
| | | Date date = new Date(); |
| | | wrkMast.setUserNo(staNo + "aa" + date.getTime()); |
| | | } |
| | | wrkMast.setWrkNo(workNo); |
| | | wrkMast.setIoTime(now); |
| | | wrkMast.setWrkSts(11L); // 工作状态:11.生成出库ID |
| | |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setUserNo(agvTaskNo); |
| | | wrkMast.setUserNo(String.valueOf(agvTaskNo)); |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setMemo(staNo); |
| | | wrkMastService.insert(wrkMast); |
| | | CanFin canFin = new CanFin(); |
| | | canFin.setAgvType("agv-out"); |
| | | canFin.setApplyTime(now); |
| | | canFinMapper.insert(canFin); |
| | | |
| | | // 更新库位状态 |
| | | if (locMast.getLocSts().equals("D")) { |
| | |
| | | |
| | | String robotTaskCode = rcsReporterTask.getRobotTaskCode(); |
| | | String singleRobotCode = rcsReporterTask.getSingleRobotCode(); |
| | | String[] split = robotTaskCode.split("-"); |
| | | robotTaskCode = split[0]; |
| | | |
| | | // 修改后的逻辑:有"-"则去掉最后一个"-"及后面内容,没有则保持原样 |
| | | if (robotTaskCode.contains("-")) { |
| | | robotTaskCode = robotTaskCode.substring(0, robotTaskCode.lastIndexOf("-")); |
| | | } |
| | | |
| | | //华晓AGV状态反馈,及申请 |
| | | if(Cools.isEmpty(rcsReporterTask.getExtra())){ |
| | | if(Cools.isEmpty(rcsReporterTask.getMethod())){ |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.WrkDetlLogMapper; |
| | | import com.zy.asrs.entity.WrkDetlLog; |
| | | import com.zy.asrs.service.WrkDetlLogService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | |
| | | @Service("wrkDetlLogService") |
| | | public class WrkDetlLogServiceImpl extends ServiceImpl<WrkDetlLogMapper, WrkDetlLog> implements WrkDetlLogService { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Override |
| | | public boolean save(Integer workNo) { |
| | | return this.baseMapper.save(workNo) > 0; |
| | | WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>() |
| | | .eq("wrk_no", workNo)); |
| | | int result = this.baseMapper.save(workNo); |
| | | if (result > 0 && mast != null && mast.getIoTime() != null) { |
| | | this.baseMapper.updateIoTime(workNo, mast.getIoTime()); |
| | | } |
| | | return result > 0; |
| | | } |
| | | |
| | | @Override |
| | |
| | | Date now = new Date(); |
| | | WrkMastLog wrkMastLog = new WrkMastLog(); |
| | | wrkMastLog.setWrkNo(mast.getWrkNo()); |
| | | wrkMastLog.setIoTime(now); |
| | | wrkMastLog.setIoTime(mast.getIoTime()); |
| | | wrkMastLog.setWrkSts(Math.toIntExact(mast.getWrkSts())); |
| | | wrkMastLog.setIoType(mast.getIoType()); |
| | | wrkMastLog.setIoPri(mast.getIoPri()); // 优先级 |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.mes.MesReturn; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | 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.service.impl.RcsServiceImpl; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.AGVTaskReportHandler; |
| | | import org.slf4j.Logger; |
| | |
| | | private BasDevpServiceImpl basDevpService; |
| | | @Autowired |
| | | private OrderPakoutService orderPakoutService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | @Value("${mes.url}") |
| | | private String MES_URL; |
| | | |
| | | /** |
| | | * 满板和空板出库任务,出到输送线后创建AGV搬运任务 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | private void createAGVTask() { |
| | | try { |
| | | Thread.sleep(50); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (!switchErpReportOld) { |
| | | return; |
| | | } |
| | |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | |
| | | if (wrkMast.getIoType()==110){ |
| | | if (wrkMast == null){ |
| | | if (TaskNo == null){ |
| | | TaskNo = 55555 + "aa" + date.getTime(); |
| | | } |
| | | taskType = "ZX-AGV-08-1"; |
| | |
| | | }else if (orderPakout.getDocType()==12){ |
| | | taskType = "ZP-AGV"; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (!taskService.insert(task)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } else { |
| | | if (!wrkMast.getBarcode().isEmpty() && !wrkMast.getMemo().isEmpty()) { |
| | | JSONObject map = new JSONObject(); |
| | | map.put("orderNo", TaskNo); |
| | | map.put("barCode", wrkMast.getBarcode()); |
| | | map.put("staNo", wrkMast.getStaNo()); |
| | | log.info("本次出库托盘:{}, 目标站{}", wrkMast.getBarcode(), wrkMast.getMemo()); |
| | | String url = "ReceiveFinishedPalletCode"; |
| | | String URL = MES_URL + url; |
| | | String response = RcsServiceImpl.sendPost(URL, JSONObject.toJSONString(map)); |
| | | if (!StringUtils.isEmpty(response) && response.contains("Success")){ |
| | | MesReturn mesReturn = JSONObject.parseObject(response, MesReturn.class); |
| | | if("1".equals(mesReturn.getSuccess())) { |
| | | log.info("上报完成 ==> 本次出库托盘:{}, 目标站{}", wrkMast.getBarcode(), wrkMast.getMemo()); |
| | | }else { |
| | | log.error("上报失败 ==> 本次出库托盘:{}, 目标站{}", wrkMast.getBarcode(), wrkMast.getMemo()); |
| | | } |
| | | } |
| | | } |
| | | wrkMast.setWrkSts(31L);//31.AGV搬运任务创建成功 |
| | | wrkMast.setModiTime(date); |
| | | wrkMastService.updateById(wrkMast); |
| | |
| | | /** |
| | | * AGV 任务下发接口,定时给AGV下发任务 |
| | | */ |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | private void execute() { |
| | | try { |
| | | Thread.sleep(50); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (!switchErpReportOld) { |
| | | return; |
| | | } |
| | |
| | | List<Task> wrkSts = taskService.selectList(new EntityWrapper<Task>().eq("wrk_sts", 301).orderBy("appe_time")); |
| | | if (wrkSts != null && !wrkSts.isEmpty()) { |
| | | for (Task task : wrkSts) { |
| | | |
| | | if (task.getStaNo().equals("307") && !task.getTaskType().equals("AGV补空料架")){ |
| | | //筛选全部还未完成的出库任务 |
| | | List<OrderPakout> orderPakouts = orderPakoutService.selectList(new EntityWrapper<OrderPakout>() |
| | | .in("settle", 1, 2) // 1表示还未开始,2表示正在执行 |
| | | .eq("doc_type", 12) |
| | | .orderBy("order_time", true)); |
| | | if (!orderPakouts.isEmpty()) { |
| | | //获取第一条入库单 |
| | | OrderPakout orderPakout = orderPakouts.get(0); |
| | | // 如果第一条还未开始的出库任务时间早于第一条未完成的入库任务时间,跳过,不执行 |
| | | if (orderPakout.getCreateTime().getTime() < task.getWrkDate().getTime()){ |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // List<CanFin> canFinList = canFinMapper.selectList(new EntityWrapper<CanFin>() |
| | | // .orderBy("apply_time", true) |
| | | // ); |
| | | // if (!canFinList.isEmpty()) { |
| | | // CanFin firstCanFin = canFinList.get(0); |
| | | // // 检查 InNo 是否为空 |
| | | // if (firstCanFin.getInNo() != null) { |
| | | // // 检查当前任务是否与转序任务相关 |
| | | // if (task.getStaNo().equals("307")){ |
| | | // List<WrkMast> wrkMasts1 = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | // .in("io_type", 1, 10)); |
| | | // BasDevp basDevp = basDevpService.checkSiteStatus(Integer.parseInt(task.getStaNo())); |
| | | // if (basDevp.getWrkNo() != 0 || !wrkMasts1.isEmpty()){ |
| | | // continue; |
| | | // } |
| | | // } |
| | | // } |
| | | // if (firstCanFin.getOutNo() != null){ |
| | | // if (!task.getSourceStaNo().equals("307")){ |
| | | // if (!task.getTaskType().equals("AGV补空料架")){ |
| | | // continue; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //查询是否有正在作业的源站和目标站有一样的agv搬运任务 |
| | | //如果有则跳过本次agv搬运任务下发 |
| | | Task task1 = taskService.selectOne(new EntityWrapper<Task>() |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasErrLog; |
| | | import com.zy.asrs.entity.mes.MesReturn; |
| | | import com.zy.asrs.service.BasErrLogService; |
| | | import com.zy.asrs.service.impl.RcsServiceImpl; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.ErrorStockHandler; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | | */ |
| | | @Component |
| | | public class ErrorStockScheduler { |
| | | |
| | | @Value("${mes.url}") |
| | | public String MES_URL; |
| | | |
| | | @Autowired |
| | | private BasErrLogService basErrLogService; |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(ErrorStockScheduler.class); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每日故障信息上报 |
| | | */ |
| | | @Scheduled(cron = "0 0 20 * * ? ") |
| | | public void faultReport() { |
| | | // 获取今天的开始时间 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | Date todayStart = calendar.getTime(); |
| | | |
| | | // 获取今天的结束时间 |
| | | calendar.set(Calendar.HOUR_OF_DAY, 23); |
| | | calendar.set(Calendar.MINUTE, 59); |
| | | calendar.set(Calendar.SECOND, 59); |
| | | calendar.set(Calendar.MILLISECOND, 999); |
| | | Date todayEnd = calendar.getTime(); |
| | | |
| | | List<BasErrLog> basErrLogs = basErrLogService.selectList( |
| | | new EntityWrapper<BasErrLog>() |
| | | .between("create_time", todayStart, todayEnd) |
| | | .orderBy("create_time", false) |
| | | ); |
| | | |
| | | int totalCount = basErrLogs.size(); |
| | | long totalTime = 0; |
| | | |
| | | for (BasErrLog basErrLog : basErrLogs) { |
| | | if (basErrLog.getStartTime() != null && basErrLog.getEndTime() != null) { |
| | | totalTime += basErrLog.getEndTime().getTime() - basErrLog.getStartTime().getTime(); |
| | | } |
| | | } |
| | | |
| | | JSONObject params = new JSONObject(); |
| | | params.put("totalCount", totalCount); |
| | | params.put("totalTime", totalTime / 1000); |
| | | |
| | | String url = "ErrorLogReport"; |
| | | String URL = MES_URL + url; |
| | | String response = RcsServiceImpl.sendPost(URL, JSONObject.toJSONString(params)); |
| | | if (!StringUtils.isEmpty(response) && response.contains("Success")){ |
| | | MesReturn mesReturn = JSONObject.parseObject(response, MesReturn.class); |
| | | if("1".equals(mesReturn.getSuccess())) { |
| | | log.info("上报完成 ==> 故障次数:{}, 总时长:{}", totalCount, totalTime); |
| | | }else { |
| | | log.error("上报失败 ==> 故障次数:{}, 总时长:{}", totalCount, totalTime); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.controller.OutController; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.mes.*; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.RcsServiceImpl; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Resource |
| | | private OrderPakinService orderPakinService; |
| | | @Resource |
| | |
| | | |
| | | @Autowired |
| | | private OutController outController; |
| | | |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | |
| | | @Scheduled(cron = "0 0 1 * * ? ") |
| | | public void clearApiLog() { |
| | |
| | | } |
| | | |
| | | // 装配单自动出库 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "* * * * * ? ") |
| | | // @Async("orderThreadPool") |
| | | void AutoOutOrderPinOut() throws InterruptedException { |
| | | String erpReport = Parameter.get().getErpReport(); |
| | | if (!Cools.isEmpty(erpReport) && erpReport.equals("true")) { |
| | | //筛选还没执行的出库任务 |
| | | List<OrderPakout> orderPakouts = orderPakoutService.selectList(new EntityWrapper<OrderPakout>() |
| | | .eq("settle", 1) |
| | | .eq("doc_type", 12) |
| | |
| | | return; |
| | | } |
| | | for (OrderPakout orderPakout : orderPakouts) { |
| | | // //筛选全部还未执行的入库任务 |
| | | // List<Task> wrkSts = taskService.selectList(new EntityWrapper<Task>() |
| | | // .eq("sta_no", "307") |
| | | // .in("wrk_sts", 301,202) |
| | | // .orderBy("wrk_date", true) |
| | | // ); |
| | | // if (!wrkSts.isEmpty()) { |
| | | // //获取第一条入库单 |
| | | // Task task = wrkSts.get(0); |
| | | // // 如果第一条还未开始的出库任务时间晚于第一条未完成的入库任务时间,跳过,不执行 |
| | | // if (orderPakout.getCreateTime().getTime() > task.getWrkDate().getTime()){ |
| | | // continue; |
| | | // } |
| | | // } |
| | | |
| | | String sourceNo = orderPakout.getCstmrName(); |
| | | List<Task> tasks = taskService.selectList(new EntityWrapper<Task>() |
| | | .eq("source_sta_no", sourceNo) |
| | | .in("wrk_sts", 301, 302, 303)); |
| | | if (!tasks.isEmpty() && tasks != null){ |
| | | continue; |
| | | } |
| | | |
| | | // // 查询can_fin表中相同单号的内容 |
| | | // List<CanFin> conntOut = canFinMapper.selectList( |
| | | // new EntityWrapper<CanFin>() |
| | | // .eq("out_no", orderPakout.getOrderNo()) |
| | | // ); |
| | | // if (!conntOut.isEmpty()) { |
| | | // // 检查是否满足继续执行的条件:agv_type为agv-in-out且task_type为canout |
| | | // boolean canContinue = false; |
| | | // for (CanFin canFin : conntOut) { |
| | | //// if ("agv-in-out".equals(canFin.getAgvType()) && "canout".equals(canFin.getTaskStatus())) { |
| | | // if ("agv-out".equals(canFin.getAgvType()) && "canout".equals(canFin.getTaskStatus())) { |
| | | // log.info("can_fin表有满足条件的记录,执行出库单:{}", orderPakout.getOrderNo()); |
| | | // canContinue = true; |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (!canContinue) { |
| | | // // 不满足条件,跳过出库单 |
| | | // continue; |
| | | // } |
| | | // } |
| | | |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | Boolean boo = false; |
| | | |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasErrLog; |
| | | 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; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.WorkMastHandler; |
| | | import org.slf4j.Logger; |
| | |
| | | @Resource |
| | | private DigitalTwinService digitalTwinService; |
| | | |
| | | /** |
| | | * 定时统计每天剩余库存 |
| | | */ |
| | | @Scheduled(cron = "0 50 23 * * ?") |
| | | private void locNumCount() { |
| | | digitalTwinService.locNumCount(); |
| | |
| | | |
| | | |
| | | public ReturnT<String> start(Task task) { |
| | | String taskType = "NB1"; |
| | | String SourceStaNoType = "SITE"; |
| | | String TargetStaNoType = "SITE"; |
| | | //给agv下发的任务类型,默认站到站 |
| | |
| | | }else if(task.getIoType()==5){ |
| | | SourceStaNoType = "ZONE"; |
| | | } |
| | | String taskType = "PP"; |
| | | Boolean flag1 = false; |
| | | Boolean flag2 = false; |
| | | Boolean cpFlag1 = false; |
| | | Boolean cpFlag2 = false; |
| | | if(stationProperties.getStation().contains(task.getStaNo())){ |
| | | if (task.getStaNo().equals("Z-LVL18")){ |
| | | taskType = "LJCPIN"; |
| | | cpFlag1 = true; |
| | | }else { |
| | | taskType = "LJIN"; |
| | | flag1 = true; |
| | | } |
| | | } |
| | | if (stationProperties.getStation().contains(task.getSourceStaNo())){ |
| | | if (task.getSourceStaNo().equals("Z-LVL18")){ |
| | | cpFlag2 = true; |
| | | taskType = "LJCPOUT"; |
| | | }else{ |
| | | taskType = "LJOUT"; |
| | | flag2 = true; |
| | | } |
| | | } |
| | | if(flag1 && flag2){ |
| | | taskType = "LJBOTH"; |
| | | } |
| | | if (cpFlag1 && cpFlag2){ |
| | | taskType = "LJCPBOTH"; |
| | | if (task.getStaNo().equals("Z-LVL18")){ |
| | | taskType = "LJCPIN"; |
| | | } |
| | | if (task.getSourceStaNo().equals("Z-LVL18")){ |
| | | taskType = "LJCPOUT"; |
| | | } |
| | | if (task.getSourceStaNo().equals("Z-LVL20")||task.getSourceStaNo().equals("Z-LVL21")||task.getSourceStaNo().equals("Z-LVL22")|| |
| | | task.getSourceStaNo().equals("Z-LVL23")||task.getSourceStaNo().equals("Z-LVL24")||task.getSourceStaNo().equals("Z-LVL25")|| |
| | | task.getSourceStaNo().equals("Z-LVL26")||task.getSourceStaNo().equals("Z-LVL27")||task.getSourceStaNo().equals("Z-LVL28")|| |
| | | task.getSourceStaNo().equals("Z-LVL29")||task.getSourceStaNo().equals("Z-LVL30")||task.getSourceStaNo().equals("Z-LVL31")){ |
| | | taskType = "HKCPIN"; |
| | | } |
| | | if (task.getStaNo().equals("Z-LVL20")||task.getStaNo().equals("Z-LVL21")||task.getStaNo().equals("Z-LVL22")|| |
| | | task.getStaNo().equals("Z-LVL23")||task.getStaNo().equals("Z-LVL24")||task.getStaNo().equals("Z-LVL25")|| |
| | | task.getStaNo().equals("Z-LVL26")||task.getStaNo().equals("Z-LVL27")||task.getStaNo().equals("Z-LVL28")|| |
| | | task.getStaNo().equals("Z-LVL29")||task.getStaNo().equals("Z-LVL30")||task.getStaNo().equals("Z-LVL31") |
| | | ){ |
| | | taskType = "HKCPOUT"; |
| | | } |
| | | if (task.getIsPda() != null && task.getIsPda().equals("Y")){ |
| | | taskType = "NB1"; |
| | | } |
| | | //AGV区域中无法用- |
| | | String StaNo = task.getStaNo(); |
| | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.mes.MesReturn; |
| | | import com.zy.asrs.enums.LocStsType; |
| | | import com.zy.asrs.mapper.CanFinMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private TaskDetlService taskDetlService; |
| | | @Autowired |
| | | private BasStationServiceImpl basStationService; |
| | | |
| | | @Autowired |
| | | private OrderPakoutService orderPakoutService; |
| | | @Autowired |
| | | private CanFinMapper canFinMapper; |
| | | @Value("${mes.url}") |
| | | private String url; |
| | | |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("更新入库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getLocNo() + "]"); |
| | | } |
| | | // 将waitPakin表中的数据标记为已处理 |
| | | if (wrkMast.getIoType() == 1) { // 全板入库 |
| | | Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode()); |
| | | WaitPakin setParam = new WaitPakin(); |
| | | setParam.setStatus("N"); |
| | | setParam.setModiTime(new Date()); |
| | | waitPakinService.update(setParam, wrapper); |
| | | log.info("更新库存成功!托盘码:{}", wrkMast.getBarcode()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | if (wrkMast.getStaNo().equals("307")){ |
| | | try{ |
| | | CanFin canFin = new CanFin(); |
| | | List<CanFin> canFinList = canFinMapper.selectList( |
| | | new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true) |
| | | ); |
| | | if (canFinList != null){ |
| | | CanFin firstCanFin = canFinList.get(0); |
| | | if (firstCanFin.getAgvType().equals("agv-in")){ |
| | | // if (firstCanFin.getAgvType().equals("agv-in-out")){ |
| | | canFinMapper.deleteById(firstCanFin.getId()); |
| | | |
| | | if (canFinList.size() > 1){ |
| | | CanFin firstCanFin1 = canFinList.get(1); |
| | | firstCanFin1.setTaskStatus("canout"); |
| | | log.info("can_fin表已更新,入库单状态{}", firstCanFin1.getOutType()); |
| | | canFinMapper.updateById(firstCanFin1); |
| | | } |
| | | } |
| | | // else if(firstCanFin.getAgvType().equals("agv-in")){ |
| | | // canFinMapper.deleteById(firstCanFin.getId()); |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("本次入库没有任务单"); |
| | | } |
| | | } |
| | | return SUCCESS; |
| | | } |
| | | |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg("更新出库完成状态失败; [workNo=" + wrkMast.getWrkNo() + "],[locNo=" + wrkMast.getSourceLocNo() + "]"); |
| | | } |
| | | // 检查配盘单是否已完成 |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo())); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (!Cools.isEmpty(wrkDetl.getOrderNo())) { |
| | | OrderInAndOutUtil.checkComplete(Boolean.FALSE, wrkDetl.getOrderNo()); |
| | | break; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | |
| | | if (wrkMast.getStaNo().equals("307")){ |
| | | try{ |
| | | List<CanFin> firstCanFinList = canFinMapper.selectList( |
| | | new EntityWrapper<CanFin>() |
| | | .orderBy("apply_time", true) |
| | | ); |
| | | CanFin firstCanfin = firstCanFinList.get(0); |
| | | if (firstCanfin.getOutNo() != null && firstCanfin.getAgvType().equals("agv-out")){ |
| | | log.info("can_fin表已更新,出库单{}已删除",firstCanfin.getOutNo()); |
| | | canFinMapper.deleteById(firstCanfin.getId()); |
| | | } |
| | | if (firstCanfin.getOutNo() == null && firstCanfin.getAgvType().equals("agv-out")){ |
| | | log.info("can_fin表已更新,出库任务已删除,当前出库无任务单"); |
| | | canFinMapper.deleteById(firstCanfin.getId()); |
| | | } |
| | | if (firstCanFinList.size() > 1){ |
| | | CanFin secondCanFin = firstCanFinList.get(1); |
| | | secondCanFin.setTaskStatus("canout"); |
| | | canFinMapper.updateById(secondCanFin); |
| | | } |
| | | // else { |
| | | // OrderPakout isOut = orderPakoutService.selectOne( |
| | | // new EntityWrapper<OrderPakout>() |
| | | // .eq("settle", 2L) |
| | | // .eq("doc_type", 12L)); |
| | | // String outOrderNo = isOut.getOrderNo(); |
| | | // List<CanFin> canFinList = canFinMapper.selectList( |
| | | // new EntityWrapper<CanFin>() |
| | | // .eq("agv_type", "agv-in-out") |
| | | // .orderBy("apply_time", true) |
| | | // ); |
| | | // if (canFinList != null){ |
| | | // CanFin firstCanFin = canFinList.get(0); |
| | | // |
| | | // OrderPakout isOut = orderPakoutService.selectOne( |
| | | // new EntityWrapper<OrderPakout>() |
| | | // .eq("orderNo", firstCanFin.getOutNo())); |
| | | // |
| | | // String outOrderNo = isOut.getOrderNo(); |
| | | // if (outOrderNo.equals(firstCanFin.getOutNo())){ |
| | | // log.info("can_fin表已更新,转序出库单{}已删除", firstCanFin.getOutNo()); |
| | | // canFinMapper.deleteById(firstCanFin.getId()); |
| | | // }else { |
| | | // log.info("未找到该出库单,can_fin表未更新"); |
| | | // } |
| | | // List<CanFin> canFinList1 = canFinMapper.selectList( |
| | | // new EntityWrapper<CanFin>() |
| | | // .eq("agv_type", "agv-in-out") |
| | | // .orderBy("apply_time", true)); |
| | | // if (!canFinList1.isEmpty()){ |
| | | // CanFin firstCanFin2 = canFinList.get(0); |
| | | // firstCanFin2.setTaskType("Y"); |
| | | // log.info("can_fin表已更新,转序出库单可以转序", firstCanFin2.getOutNo()); |
| | | // canFinMapper.updateById(firstCanFin2); |
| | | // } |
| | | // } |
| | | // } |
| | | } catch (Exception e) { |
| | | log.error("本次出库没有任务单"); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | return SUCCESS; |
| | | } |
| | | |
| | |
| | | map.put("StationId", task.getSourceStaNo()); |
| | | String mesUrl = url+"AGVArrivalCompletedFit"; |
| | | String response = RcsServiceImpl.sendPost(mesUrl, JSONObject.toJSONString(map)); |
| | | log.info("AGV任务完成转发MES"); |
| | | if (!StringUtils.isEmpty(response) && response.contains("Success")){ |
| | | MesReturn mesReturn = JSONObject.parseObject(response, MesReturn.class); |
| | | if("1".equals(mesReturn.getSuccess())) { |
| | | log.info("AGV任务完成转发MES成功"); |
| | | task.setWrkSts(305L);//任务状态从304--》305 |
| | | task.setModiTime(new Date()); |
| | | taskService.updateById(task); |
| | | }else { |
| | | log.error("AGV任务完成转发MES失败"); |
| | | return new ReturnT<>(500, mesReturn.getMessage()); |
| | | } |
| | | } |
| | | }else { |
| | | task.setWrkSts(305L);//任务状态从304--》305 |
| | | task.setModiTime(new Date()); |
| | | taskService.updateById(task); |
| | | } |
| | | }else { |
| | | task.setWrkSts(305L);//任务状态从304--》305 |
| | |
| | | User user = userService.selectById(userLogin.getUserId()); |
| | | // String deToken = Cools.deTokn(token, user.getPassword()); |
| | | // long timestamp = Long.parseLong(deToken.substring(0, 13)); |
| | | // 15分钟后过期 |
| | | if (System.currentTimeMillis() - userLogin.getCreateTime().getTime() > 900000){ |
| | | // 一小时后过期 |
| | | if (System.currentTimeMillis() - userLogin.getCreateTime().getTime() > 3600000){ |
| | | Http.response(response, BaseRes.DENIED); |
| | | return false; |
| | | } |
| | |
| | | @Order(2) |
| | | public class LogAspect { |
| | | |
| | | private final List<String> logApiList = Stream.of("digitalTwin", "api/mes", "api/robot") |
| | | private final List<String> logApiList = Stream.of("api/mes", "api/robot") |
| | | .collect(Collectors.toList()); |
| | | |
| | | public LogAspect() { |
| | |
| | | } |
| | | |
| | | Short locType1 = 1; |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "O").eq("loc_type1", locType1).orderBy("lev1").orderBy("bay1").orderBy("row1")); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", locType1) |
| | | .orderBy("lev1") |
| | | .orderBy("bay1") |
| | | .orderBy("row1")); |
| | | if (locMast == null) { |
| | | log.error("入库请求库位失败:无库位" + locType1); |
| | | throw new CoolException("入库请求库位失败:无库位" + locType1); |
| | |
| | | package com.zy.common.web; |
| | | |
| | | import com.alibaba.excel.util.StringUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.mes.MesReturn; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | | import com.zy.asrs.entity.result.FindLocNoAttributeVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.RcsServiceImpl; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.StartupDto; |
| | |
| | | import com.zy.common.web.param.SearchLocParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | @Value("${mes.url}") |
| | | public String MES_URL; |
| | | |
| | | // TODO:称重、拍照上报存储,CTU料箱运转 |
| | | |
| | | @PostMapping("/pakin/loc/v1") |
| | |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("源站编号不能为空"); |
| | | } |
| | | if (Cools.isEmpty(param.getSourceStaNo())) { |
| | | return R.error("托盘不能为空或者托盘码不为八位"); |
| | | if (Cools.isEmpty(param.getBarcode()) || param.getBarcode().equals("00000000")) { |
| | | return R.error(".托盘码不能为空或者托盘码为0"); |
| | | } |
| | | if (param.getSourceStaNo() == 301 || param.getSourceStaNo() == 304){ |
| | | String url = "CameraPictureRecognition"; |
| | | |
| | | // return R.error("配盘不正确"); |
| | | // String URL = MES_URL + url; |
| | | // String URL = "172.26.160.74:8080/basicmodel/WmsFit/Api/CameraPictureRecognition"; |
| | | // try{ |
| | | // String response = RcsServiceImpl.sendPost(url, JSONObject.toJSONString(param)); |
| | | // if (!StringUtils.isEmpty(response) && response.contains("Success")) { |
| | | // MesReturn mesReturn = JSONObject.parseObject(response, MesReturn.class); |
| | | // if ("2".equals(mesReturn.getSuccess())) { |
| | | // return R.error("配盘不正确"); |
| | | // }else { |
| | | // log.info("配盘正确,允许入库"); |
| | | // } |
| | | // } |
| | | // } catch (Exception e) { |
| | | // return R.error("MES地址连接超时"); |
| | | // } |
| | | |
| | | } |
| | | List<WaitPakin> waitPakins = null; |
| | | if (param.getIoType() == 1) { |
| | |
| | | } |
| | | //查看是否有相关的AGV搬运任务存在 |
| | | List<Task> tasks = taskService.selectList(new EntityWrapper<Task>() |
| | | .eq("task_type", "AGV补空料架") |
| | | .andNew() |
| | | .in("sta_no", wrkMast.getStaNo(),wrkMast.getMemo()) |
| | | .or() |
| | | .in("source_sta_no", wrkMast.getStaNo(),wrkMast.getMemo())); |
| | |
| | | |
| | | LicenseVerify licenseVerify = new LicenseVerify(); |
| | | //安装证书 |
| | | // LicenseContent install = licenseVerify.install(param); |
| | | LicenseContent install = licenseVerify.install(param); |
| | | |
| | | logger.info("++++++++ 许可证加载结束 ++++++++"); |
| | | |
| | | logger.info("++++++++ 许可证加载标记,搜索修改 ++++++++"); |
| | | licenseTimer.setSystemSupport(true); |
| | | licenseTimer.setLicenseDays(9999); |
| | | return true; |
| | | // licenseTimer.setSystemSupport(true); |
| | | // licenseTimer.setLicenseDays(9999); |
| | | // return true; |
| | | |
| | | // licenseTimer.setSystemSupport(install!=null); |
| | | // |
| | | // if (install != null) { |
| | | // Date start = new Date(); |
| | | // Date end = install.getNotAfter(); |
| | | // Long starTime = start.getTime(); |
| | | // Long endTime = end.getTime(); |
| | | // Long num = endTime - starTime;//时间戳相差的毫秒数 |
| | | // int day = (int) (num / 24 / 60 / 60 / 1000); |
| | | // licenseTimer.setLicenseDays(day); |
| | | // } |
| | | // |
| | | // |
| | | // return install != null; |
| | | licenseTimer.setSystemSupport(install!=null); |
| | | |
| | | if (install != null) { |
| | | Date start = new Date(); |
| | | Date end = install.getNotAfter(); |
| | | Long starTime = start.getTime(); |
| | | Long endTime = end.getTime(); |
| | | Long num = endTime - starTime;//时间戳相差的毫秒数 |
| | | int day = (int) (num / 24 / 60 / 60 / 1000); |
| | | licenseTimer.setLicenseDays(day); |
| | | } |
| | | |
| | | |
| | | return install != null; |
| | | } catch (Exception e) { |
| | | return false; |
| | | } |
| | |
| | | |
| | | private static int LICENSE_DAYS = 0;//许可证天数 |
| | | |
| | | //每天晚上11点更新系统激活状态 |
| | | @Scheduled(cron = "0 0 23 * * ? ") |
| | | //每天13点更新系统激活状态 |
| | | @Scheduled(cron = "0 0 20 * * ? ") |
| | | public void timer() { |
| | | // System.out.println(SYSTEM_SUPPORT); |
| | | //验证许可证是否有效 |
| | |
| | | /** |
| | | * token有效期时间 |
| | | */ |
| | | private Integer tokenExpire = 1000 * 30 * 60; |
| | | private Integer tokenExpire = 1000 * 60 * 60 * 5; |
| | | /** |
| | | * token数量限制 |
| | | */ |
| | |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | username: sa |
| | | password: sa@123 |
| | | url: jdbc:sqlserver://172.26.11.80:1433;databasename=jnejc-ljqwms |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=jnejc-ljqwms |
| | | # username: sa |
| | | # password: Skyouc#23 |
| | | # url: jdbc:sqlserver://192.168.4.24:1433;databasename=jsxswms |
| | |
| | | |
| | | #License相关配置 |
| | | license: |
| | | subject: jnejc-ljqasrs |
| | | subject: jnejc-hkwms |
| | | publicAlias: publicCert |
| | | storePass: public_zhongyang_123456789 |
| | | licensePath: license.lic |
| | |
| | | # 双深 |
| | | doubleDeep: true |
| | | # 双深库位排号 |
| | | doubleLocs: 1,4,5,8,9,12,13,16 |
| | | doubleLocs: 3,8,9,12,13,16 |
| | | # 一个堆垛机负责的货架排数 |
| | | groupCount: 4 |
| | | # 左深库位排号 |
| | | doubleLocsLeft: 1,5,9,13 |
| | | doubleLocsLeft: 3,9,13 |
| | | # 右深库位排号 |
| | | doubleLocsRight: 4,8,12,16 |
| | | doubleLocsRight: 8,12,16 |
| | | # wms参数配置 |
| | | wms-parameter: |
| | | # 自动补空板功能开关 |
| | |
| | | |
| | | #mes对接 |
| | | mes: |
| | | |
| | | url: http://172.26.160.5:80/dev-api/basicmodel/WmsFit/Api/ |
| | | url: http://192.9.100.173:8088/prod-api/basicmodel/WmsFit/Api/ |
| | | # url: http://172.26.160.73:8080/basicmodel/WmsFit/Api/ |
| | | # url: http://172.26.160.5:8080/basicmodel/WmsFit/Api/ |
| | | #默认接口操作人员id |
| | | defaultUserId: 30 |
| | | |
| | |
| | | </appender> |
| | | |
| | | <!-- 日志保存路径 --> |
| | | <property name="LOG_PATH" value="D:/wmslogs/jg" /> |
| | | <property name="LOG_PATH" value="D:/ljqwmslogs/ljq" /> |
| | | |
| | | <!--info级别--> |
| | | <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | |
| | | |
| | | </resultMap> |
| | | <select id="selectToBeCompleteData" resultType="com.zy.asrs.entity.Task"> |
| | | select * from agv_task where wrk_sts = 304 order by upd_mk,error_time,io_time,wrk_no |
| | | select * from agv_task where wrk_sts = 305 order by upd_mk,error_time,io_time,wrk_no |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/css/common.css" media="all"> |
| | | <style> |
| | | html { |
| | | height: 100%; |
| | | padding: 10px; |
| | | background-color: #f1f1f1; |
| | | box-sizing: border-box; |
| | | } |
| | | body { |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | box-shadow: 0 0 3px rgba(0,0,0,.3); |
| | | } |
| | | |
| | | .function-area { |
| | | padding: 20px 50px; |
| | | } |
| | | .function-btn { |
| | | font-size: 16px; |
| | | padding: 1px 2px; |
| | | width: 100px; |
| | | height: 50px; |
| | | border-color: #2b425b; |
| | | border-radius: 4px; |
| | | border-width: 2px; |
| | | background: none; |
| | | border-style: solid; |
| | | transition: 0.4s; |
| | | cursor: pointer; |
| | | letter-spacing: 1.5px; |
| | | } |
| | | .function-btn:hover { |
| | | background-color: #2b425b; |
| | | color: #fff; |
| | | } |
| | | |
| | | .layui-layer-page .layui-layer-content { |
| | | position: relative; |
| | | overflow: visible !important; |
| | | } |
| | | |
| | | #mat-query { |
| | | display: none; |
| | | } |
| | | |
| | | #staNoSpan { |
| | | text-align: center; |
| | | display: inline-block; |
| | | width: 100px; |
| | | font-size: 13px; |
| | | } |
| | | .layui-btn-container .layui-form-select { |
| | | display: inline-block; |
| | | width: 150px; |
| | | height: 30px; |
| | | } |
| | | .layui-btn-container .layui-form-select.layui-form-selected { |
| | | display: inline-block; |
| | | width: 150px; |
| | | } |
| | | .layui-btn-container .layui-select-title input { |
| | | font-size: 13px; |
| | | } |
| | | .layui-btn-container .layui-anim.layui-anim-upbit dd { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | #btn-comb { |
| | | margin-left: 60px; |
| | | display: none; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | | <!-- 功能区 --> |
| | | <div class="function-area"> |
| | | <button id="mat-query" class="function-btn">提取商品</button> |
| | | </div> |
| | | |
| | | <hr> |
| | | |
| | | <!-- 表格 --> |
| | | <div style="padding-bottom: 5px; margin-bottom: 45px"> |
| | | |
| | | <!-- 头部 --> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-form"> |
| | | <div class="layui-btn-container"> |
| | | <!-- 1.选择入库口 --> |
| | | <span id="staNoSpan">入库口:</span> |
| | | <select id="putSiteSelect" lay-verify="required"> |
| | | <option value="">请选择站点</option> |
| | | </select> |
| | | <!-- 2.启动入库 --> |
| | | <button class="layui-btn layui-btn-normal layui-btn-lg" id="btn-comb" lay-event="comb" style="">启动入库</button> |
| | | |
| | | </div> |
| | | </div> |
| | | </script> |
| | | |
| | | <!-- 行 --> |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">移除</a> |
| | | </script> |
| | | |
| | | <table class="layui-table" id="chooseData" lay-filter="chooseData"></table> |
| | | </div> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script> |
| | | <script type="text/javascript" src="../../static/js/pakStore/pakStore.js" charset="utf-8"></script> |
| | | |
| | | <script type="text/template" id="putSiteSelectTemplate"> |
| | | {{#each data}} |
| | | <option value="{{this}}">{{this}}</option> |
| | | {{/each}} |
| | | </script> |
| | | </body> |
| | | </html> |
| | | |