src/main/java/com/zy/asrs/controller/MobileController.java
@@ -60,6 +60,18 @@ @Resource private StaDescService staDescService; @PostMapping("/agv/collectionPakin/view") @ManagerAuth public R pdaAgvCollectionPakinView(@RequestBody CollectionPakinParams params){ return mobileService.collectionPakinView(params); } @PostMapping("/agv/collectionPakin/auth") @ManagerAuth public R pdaAgvCollectionPakin(@RequestBody CollectionPakinParams params){ return mobileService.collectionPakin(params, getUserId()); } @PostMapping("/agv/callEmptyCar") @ManagerAuth src/main/java/com/zy/asrs/controller/OpenController.java
@@ -1,21 +1,25 @@ package com.zy.asrs.controller; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.annotations.AppAuth; import com.core.common.*; import com.core.exception.CoolException; import com.zy.asrs.entity.Task; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.entity.param.*; import com.zy.asrs.service.OpenService; import com.zy.asrs.service.TaskService; import com.zy.asrs.service.WrkMastService; import com.zy.common.model.DetlDto; 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.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.*; /** * Created by vincent on 2022/4/8 @@ -33,6 +37,58 @@ @Autowired private OpenService openService; @Autowired private TaskService taskService; @PostMapping("/agvPickupComplete/agvCallback") @AppAuth(memo = "AGV取货完成接口") public Map<String, Object> agvPickupComplete(@RequestBody AgvTaskParam agvTaskParam, HttpServletRequest request) { // DecimalFormat df = new DecimalFormat("0000"); // String wrkNo = "Ctu"+df.format(param.getWrkNo())+date.getTime()/1000; String wrkNo = agvTaskParam.getTaskCode().substring(3,7); Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", Integer.parseInt(wrkNo))); if (Cools.isEmpty(task)) { log.error("未查询到任务号对应的数据"); } task.setWrkSts(0L); taskService.updateById(task); HashMap<String, Object> map = new HashMap<>(); map.put("code","0"); map.put("message","成功"); map.put("reqCode", ""); log.info("agv请求取货完成,wms任务号:"+ JSON.toJSONString(agvTaskParam)); return map; } @PostMapping("/agvTaskComplete/agvCallback") @AppAuth(memo = "AGV放货完成接口") public Map<String, Object> agvTaskComplete(@RequestBody AgvTaskParam agvTaskParam,HttpServletRequest request) { HashMap<String, Object> map = new HashMap<>(); String wrkNo = agvTaskParam.getTaskCode().substring(3,7); Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", Integer.parseInt(wrkNo))); if (Cools.isEmpty(task)) { log.error("未查询到任务号对应的数据"); } taskService.updateById(task); if (task.getIoType() < 100 ){ task.setWrkSts(4L); }else { task.setWrkSts(14L); } taskService.updateById(task); map.put("code","0"); map.put("message","成功"); map.put("reqCode", ""); return map; } @PostMapping("/order/matSync/default/v2") // @AppAuth(memo = "商品信息同步接口") public synchronized R syncMatInfoV2(@RequestHeader(required = false) String appkey, src/main/java/com/zy/asrs/entity/BasStationDetl.java
@@ -8,6 +8,8 @@ import com.zy.system.entity.User; import java.text.SimpleDateFormat; import java.util.Date; import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; import com.core.common.SpringUtils; import com.zy.system.service.UserService; @@ -22,6 +24,7 @@ @Data @TableName("agv_bas_station_detl") @Accessors(chain = true) public class BasStationDetl implements Serializable { private static final long serialVersionUID = 1L; src/main/java/com/zy/asrs/entity/param/AgvTaskParam.java
New file @@ -0,0 +1,14 @@ package com.zy.asrs.entity.param; import lombok.Data; @Data public class AgvTaskParam { private String taskCode; private String ctnrCode; private String stgBinCode; } src/main/java/com/zy/asrs/entity/param/CollectionPakinParams.java
New file @@ -0,0 +1,52 @@ package com.zy.asrs.entity.param; import lombok.Data; import java.math.BigDecimal; import java.util.List; @Data public class CollectionPakinParams { private String orgBarcode; private String tarBarcode; private String devNo; private List<CombMat> combMats; @Data public static class CombMat { private String orderNo; // 物料编号 private String matnr = ""; // 序列码 private String batch = ""; private String brand = ""; private String standby1 = ""; private String standby2 = ""; private String standby3 = ""; private String boxType1 = "1"; private String boxType2 = "1"; private String boxType3 = "1"; // 物料数量 private BigDecimal anfme; // 物料数量 private BigDecimal workQty; // 商品名称 private String maktx; // 规格 private String specs; private String threeCode; } } src/main/java/com/zy/asrs/service/MobileService.java
@@ -148,4 +148,8 @@ * @date 2025/12/9 15:04 */ void combInPub(CompleteParam combParam, Long userId); R collectionPakin(CollectionPakinParams params, Long userId); R collectionPakinView(CollectionPakinParams params); } src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1347,28 +1347,125 @@ } @Override // @Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class) public R collectionInCall(AgvCallParams params, Long userId) { if (Objects.isNull(params.getOrgSite())) { throw new CoolException("源站点不能为空!!"); } List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", params.getBarcode())); if (!tasks.isEmpty()) { throw new CoolException("托盘码已生成任务"); } BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getTarSite())); List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>() .in("loc_sts", LocStsType.LOC_STS_TYPE_O.type, LocStsType.LOC_STS_TYPE_D.type) .in("loc_sts", LocStsType.LOC_STS_TYPE_O.type) .eq("area_id", basAreas.getId())); if (locCaches.isEmpty()) { throw new CoolException("当前暂无空库位!!"); } generateAgvTask("agv", locCaches.get(0), params.getOrgSite(), params.getBarcode(), userId); BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getOrgSite())); if (Objects.isNull(station)) { throw new CoolException("源站点未检索到数据!!"); } generateSOEOInTask("agv", locCaches.get(0), params.getOrgSite(), station.getBarcode(), userId); return R.ok(); } @Transactional(rollbackFor = Exception.class) public void generateSOEOInTask(String type, LocCache loc, String orgSite, String barcode, Long userId) { List<BasStationDetl> basStationDetls = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite)); if (Objects.isNull(basStationDetls) || basStationDetls.isEmpty()) { throw new CoolException("站点信息不存在!!"); } List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode)); if (!tasks.isEmpty()) { throw new CoolException("托盘已在任务执行中.."); } // 获取工作号 int workNo = commonService.getWorkNo(WorkNoType.PICK.type); // 保存工作档 Task task = new Task(); task.setWrkNo(workNo) .setIoTime(new Date()) .setWrkSts(1L) // 工作状态:11.生成出库ID .setIoType(1) // 入出库状态: 11.库格移载 .setTaskType("agv") .setIoPri(10D) .setLocNo(loc.getLocNo()) // 目标库位 .setFullPlt("Y") // 满板:Y .setPicking("N") // 拣料 .setExitMk("N")// 退出 .setSourceStaNo(orgSite) .setEmptyMk(loc.getLocSts().equals("D") ? "Y" : "N")// 空板 .setBarcode(barcode)// 托盘码 .setLinkMis("N") .setAppeUser(userId) .setAppeTime(new Date()) .setModiUser(userId) .setModiTime(new Date()); if (!taskService.insert(task)) { throw new CoolException("保存工作档失败"); } for (BasStationDetl basStationDetl : basStationDetls) { TaskDetl wrkDetl = new TaskDetl(); BeanUtils.copyProperties(basStationDetl, wrkDetl); wrkDetl.setWrkNo(workNo) .setIoTime(new Date()) .setOrderNo(basStationDetl.getOrderNo()) .setAnfme(basStationDetl.getAnfme()) .setZpallet(basStationDetl.getBarcode()) .setBatch(basStationDetl.getBatch()) .setMatnr(basStationDetl.getMatnr()) .setMaktx(basStationDetl.getMaktx()) .setStandby1(basStationDetl.getStandby1()) .setAppeUser(userId) .setUnit(basStationDetl.getUnit()) .setModel(basStationDetl.getModel()) .setAppeTime(new Date()) .setModiUser(userId); //保存工作档明细 if (!taskDetlService.insert(wrkDetl)) { throw new CoolException("保存工作档明细失败"); } } // 修改目标库位状态 if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.入库预约 loc.setModiTime(new Date()); loc.setModiUser(userId); if (!locCacheService.updateById(loc)) { throw new CoolException("更新目标库位状态失败"); } } else { throw new CoolException("移转失败,目标库位状态:" + loc.getLocSts$()); } // 修改目标站点信息 BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite)); if (Objects.isNull(station)) { throw new CoolException("站点不存在!!"); } if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)) { station.setLocSts("R"); // S.入库预约 station.setBarcode(barcode); station.setModiTime(new Date()); station.setModiUser(userId); if (!basStationService.updateById(station)) { throw new CoolException("更新目标库位状态失败"); } } else { throw new CoolException("移转失败,目标库位状态:" + station.getLocSts()); } } /** @@ -1581,6 +1678,125 @@ generateCrnInTask(waitPakins, station, param.getLocType1(), userId); } @Override @Transactional(rollbackFor = Exception.class) public R collectionPakin(CollectionPakinParams params, Long userId) { List<BasStation> basStations = basStationService.selectList(new EntityWrapper<BasStation>().eq("barcode", params.getTarBarcode())); if (basStations.isEmpty() && Cools.isEmpty(params.getDevNo())) { throw new CoolException("请输入站点号"); } BasStation basStation = null; if (!basStations.isEmpty()) { basStation = basStations.get(0); }else { basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getDevNo())); } if (Cools.isEmpty(basStation)){ throw new CoolException("请输入正确的站点号"); } for (CollectionPakinParams.CombMat combMat : params.getCombMats()) { if (combMat.getWorkQty().compareTo(BigDecimal.ZERO) == 0) { continue; } OrderPakin orderPakin = orderPakinService.selectByNo(combMat.getOrderNo()); if (Cools.isEmpty(orderPakin)) { throw new CoolException("未找到备货入库单"); } UpdateDetailsOfPakin(orderPakin,combMat); BasStationDetl basStationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>() .eq("dev_no", basStation.getDevNo()) .eq("matnr", combMat.getMatnr()) .eq("batch", combMat.getBatch()) .eq("standby1", combMat.getStandby1()) ); if (Cools.isEmpty(basStationDetl)) { basStationDetl = new BasStationDetl(); Mat mat = matService.selectByMatnr(combMat.getMatnr()); BeanUtils.copyProperties(mat,basStationDetl); basStationDetl .setOrderNo(orderPakin.getOrderNo()) .setDevNo(basStation.getDevNo()) .setBarcode(params.getTarBarcode()) .setBatch(combMat.getBatch()) .setStandby1(combMat.getStandby1()) .setAnfme(combMat.getWorkQty().doubleValue()) ; if (!basStationDetlService.insert(basStationDetl)){ throw new CoolException("插入明细失败"); } }else { BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty()); basStationDetl.setAnfme(anfme.doubleValue()); if (!basStationDetlService.updateById(basStationDetl)){ throw new CoolException("更新明细数据失败"); } } } if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type) || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { basStation.setBarcode(params.getTarBarcode()); basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type); basStationService.updateById(basStation); } return R.ok(); } @Transactional(rollbackFor = Exception.class) public void UpdateDetailsOfPakin(OrderPakin orderPakin,CollectionPakinParams.CombMat combMat){ OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>() .eq("order_id", orderPakin.getId()) .eq("matnr", combMat.getMatnr()) .eq("batch", combMat.getBatch()) .eq("standby1", combMat.getStandby1()) ); if (Cools.isEmpty(orderDetlPakin)) { throw new CoolException("检索单据明细数据失败"); } if (orderDetlPakin.getWorkQty() >= orderDetlPakin.getAnfme()) { throw new CoolException("请勿超出订单明细数量"); } BigDecimal workQty = new BigDecimal(orderDetlPakin.getWorkQty().toString()).add(combMat.getWorkQty()); orderDetlPakin.setWorkQty(workQty.doubleValue()); if (!orderDetlPakinService.updateById(orderDetlPakin)){ throw new CoolException("更新单据明细数据失败"); } if (!orderPakin.getSettle().equals(2L)){ orderPakin.setSettle(2L); if (!orderPakinService.updateById(orderPakin)){ throw new CoolException("更新单据状态失败"); } } } @Override public R collectionPakinView(CollectionPakinParams params) { WrkMast wrkMast = wrkMastService.selectByBarcode(params.getOrgBarcode()); if (Cools.isEmpty(wrkMast)) { throw new CoolException("未找到任务"); } if (wrkMast.getIoType().equals(TaskIOType.ALL_OUT.type) && wrkMast.getIoType().equals(TaskIOType.PICK_OUT.type)){ throw new CoolException("人物类型错误"); } List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); if (Cools.isEmpty(wrkDetls)) { throw new CoolException("未找到任务明细"); } return R.ok(wrkDetls); } /** * 生成堆垛机入库任务 * src/main/java/com/zy/asrs/service/impl/OrderPakinServiceImpl.java
@@ -81,28 +81,28 @@ } if (complete) { // 出库订单重新整理明细 DocType docType = docTypeService.selectById(order.getDocType()); if (null != docType && docType.getPakout() == 1) { if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) { throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); } List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); for (WrkDetl wrkDetl : wrkDetls) { OrderDetlPakin orderDetl = new OrderDetlPakin(); orderDetl.sync(wrkDetl); orderDetl.setQty(orderDetl.getAnfme()); orderDetl.setOrderId(order.getId()); orderDetl.setOrderNo(orderNo); orderDetl.setStatus(1); orderDetl.setCreateTime(order.getCreateTime()); orderDetl.setCreateBy(order.getCreateBy()); orderDetl.setUpdateTime(order.getUpdateTime()); orderDetl.setUpdateBy(order.getUpdateBy()); if (!orderDetlService.insert(orderDetl)) { throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); } } } // DocType docType = docTypeService.selectById(order.getDocType()); // if (null != docType && docType.getPakout() == 1) { // if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakin>().eq("order_id", order.getId()))) { // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); // } // List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); // for (WrkDetl wrkDetl : wrkDetls) { // OrderDetlPakin orderDetl = new OrderDetlPakin(); // orderDetl.sync(wrkDetl); // orderDetl.setQty(orderDetl.getAnfme()); // orderDetl.setOrderId(order.getId()); // orderDetl.setOrderNo(orderNo); // orderDetl.setStatus(1); // orderDetl.setCreateTime(order.getCreateTime()); // orderDetl.setCreateBy(order.getCreateBy()); // orderDetl.setUpdateTime(order.getUpdateTime()); // orderDetl.setUpdateBy(order.getUpdateBy()); // if (!orderDetlService.insert(orderDetl)) { // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); // } // } // } if (!this.updateSettle(order.getId(), 4L, null)) { throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); src/main/java/com/zy/asrs/service/impl/OrderPakoutServiceImpl.java
@@ -81,28 +81,28 @@ } if (complete) { // 出库订单重新整理明细 DocType docType = docTypeService.selectById(order.getDocType()); if (null != docType && docType.getPakout() == 1) { if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); } List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); for (WrkDetl wrkDetl : wrkDetls) { OrderDetlPakout orderDetl = new OrderDetlPakout(); orderDetl.sync(wrkDetl); orderDetl.setQty(orderDetl.getAnfme()); orderDetl.setOrderId(order.getId()); orderDetl.setOrderNo(orderNo); orderDetl.setStatus(1); orderDetl.setCreateTime(order.getCreateTime()); orderDetl.setCreateBy(order.getCreateBy()); orderDetl.setUpdateTime(order.getUpdateTime()); orderDetl.setUpdateBy(order.getUpdateBy()); if (!orderDetlService.insert(orderDetl)) { throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); } } } // DocType docType = docTypeService.selectById(order.getDocType()); // if (null != docType && docType.getPakout() == 1) { // if (!orderDetlService.delete(new EntityWrapper<OrderDetlPakout>().eq("order_id", order.getId()))) { // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); // } // List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); // for (WrkDetl wrkDetl : wrkDetls) { // OrderDetlPakout orderDetl = new OrderDetlPakout(); // orderDetl.sync(wrkDetl); // orderDetl.setQty(orderDetl.getAnfme()); // orderDetl.setOrderId(order.getId()); // orderDetl.setOrderNo(orderNo); // orderDetl.setStatus(1); // orderDetl.setCreateTime(order.getCreateTime()); // orderDetl.setCreateBy(order.getCreateBy()); // orderDetl.setUpdateTime(order.getUpdateTime()); // orderDetl.setUpdateBy(order.getUpdateBy()); // if (!orderDetlService.insert(orderDetl)) { // throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); // } // } // } if (!this.updateSettle(order.getId(), 4L, null)) { throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -410,8 +410,8 @@ // 判断是否是盘点单 String orderNo = taskDto.getLocDtos().get(0).getOrderNo(); // OrderPakout orderPakout = orderPakOutService.selectByNo(orderNo); CheckOrder checkOrder = checkOrderService.selectOne(new EntityWrapper<CheckOrder>().eq("order_no", orderNo)); int ioType = checkOrder.getDocType() == 8 ? 107 : (taskDto.isAll() ? 101 : 103); int ioType = (taskDto.isAll() ? 101 : 103); if(ioType == 101){ boolean DiffQty = taskDto.getLocDtos().stream().allMatch(locDto -> locDetlService.selectOne(new EntityWrapper<LocDetl>() src/main/webapp/static/js/order/order.js
@@ -228,6 +228,7 @@ {type: 'numbers', title: '#'}, {field: 'matnr', title: '商品编码', width: 160}, {field: 'maktx', title: '商品名称', width: 200}, {field: 'standby1', title: '供应商代码', edit: true}, {field: 'batch', title: '批号', edit: true}, {field: 'specs', title: '规格'}, {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},