diff --git a/ant-design-vue-jeecg/src/views/system/config/ZoneList.vue b/ant-design-vue-jeecg/src/views/system/config/ZoneList.vue index 73a9135..34c3ac6 100644 --- a/ant-design-vue-jeecg/src/views/system/config/ZoneList.vue +++ b/ant-design-vue-jeecg/src/views/system/config/ZoneList.vue @@ -90,6 +90,12 @@ </a-tag> </span> + <span slot="type_dictText" slot-scope="type_dictText"> + <a-tag :key="type_dictText" :color="getStatusColor(type_dictText)"> + {{ type_dictText }} + </a-tag> + </span> + <template slot="htmlSlot" slot-scope="text"> <div v-html="text"></div> </template> @@ -173,6 +179,12 @@ export default { dataIndex: 'name' }, { + title: '类型', + align: 'center', + dataIndex: 'type_dictText', + scopedSlots: {customRender: 'type_dictText'} + }, + { title: '包含库位类型', align: 'center', dataIndex: 'locationTypeCodes', @@ -229,6 +241,12 @@ export default { } }, methods: { + getStatusColor(status) { + const colors = { + default: 'blue' + }; + return colors[status] || colors.default; + }, initDictConfig() { }, getSuperFieldList() { diff --git a/ant-design-vue-jeecg/src/views/system/config/modules/LocationForm.vue b/ant-design-vue-jeecg/src/views/system/config/modules/LocationForm.vue index 3d2d88e..7c464be 100644 --- a/ant-design-vue-jeecg/src/views/system/config/modules/LocationForm.vue +++ b/ant-design-vue-jeecg/src/views/system/config/modules/LocationForm.vue @@ -158,9 +158,6 @@ export default { rowFlag: [ {required: true, message: '请输入内外侧!'}, ], - materialAreaCode: [ - {required: true, message: '请输入物料分区存放!'}, - ], enable: [ {required: true, message: '请输入是否可用!'}, ], diff --git a/ant-design-vue-jeecg/src/views/system/config/modules/ZoneForm.vue b/ant-design-vue-jeecg/src/views/system/config/modules/ZoneForm.vue index 86f91f7..ba8b30e 100644 --- a/ant-design-vue-jeecg/src/views/system/config/modules/ZoneForm.vue +++ b/ant-design-vue-jeecg/src/views/system/config/modules/ZoneForm.vue @@ -14,6 +14,11 @@ </a-form-model-item> </a-col> <a-col :span="24"> + <a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> + <j-dict-select-tag type="list" v-model="model.type" dictCode="zoneType" placeholder="请选择类型"/> + </a-form-model-item> + </a-col> + <a-col :span="24"> <a-form-model-item label="绑定的库位类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationTypeCode"> <j-select-multiple v-model="model.locationTypeCode" @@ -65,6 +70,9 @@ export default { name: [ {required: true, message: '请输入名称!'}, ], + type: [ + {required: true, message: '请输入类型!'}, + ], }, url: { add: "/config/zone/add", diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java index 1373bad..ab5f37d 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/controller/AcsController.java @@ -1,12 +1,10 @@ package org.jeecg.modules.wms.api.acs.controller; -import java.util.Map; - import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.wms.api.acs.entity.AcsStatus; +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; import org.jeecg.modules.wms.api.acs.service.IAcsService; import org.jeecg.modules.wms.config.address.service.IAddressService; import org.jeecg.modules.wms.framework.controller.HuahengBaseController; @@ -14,13 +12,8 @@ import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; import org.jeecg.utils.support.ApiLogger; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; -import cn.monitor4all.logRecord.annotation.OperationLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -38,14 +31,6 @@ public class AcsController extends HuahengBaseController { @Resource private IAddressService addressService; -// @PassApiAuthentication -// @ApiLogger(apiName = "API接口第三方Token校验测试", from = "TEST") -// @ResponseBody -// @PostMapping(value = "/testTokenCheck") -// public Result<?> testTokenCheck(@RequestBody Map<String, String> paramMap, HttpServletRequest request) { -// return Result.ok(); -// } - @PostMapping("/notifyAGVTask") @ResponseBody @ApiOperation("更新AGV状态") @@ -75,4 +60,33 @@ public class AcsController extends HuahengBaseController { return result; } + @PostMapping("/agvWarecell") + @ResponseBody + @ApiOperation("分配AGV库位") + @ApiLogger(apiName = "分配AGV库位", from = "ACS") + public Result agvWarecell(@RequestBody AgvWarecell agvWarecell) { + if (agvWarecell == null) { + return Result.error("分配AGV库位,数据为空"); + } + String warehouseCode = agvWarecell.getWarehouseCode(); + String taskNo = agvWarecell.getTaskNo(); + String zoneCode = agvWarecell.getZoneCode(); + if (StringUtils.isEmpty(warehouseCode)) { + return Result.error("仓位分配, 仓库号为空"); + } + if (StringUtils.isEmpty(taskNo)) { + return Result.error("仓位分配, 任务号为空"); + } + if (StringUtils.isEmpty(zoneCode)) { + return Result.error("仓位分配, 目的区域为空"); + } + String lockKey = warehouseCode + zoneCode; + Result result = handleMultiProcess("agvWarecell", lockKey, new MultiProcessListener() { + @Override + public Result<?> doProcess() { + return acsService.warecellAllocation(agvWarecell); + } + }); + return result; + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/entity/AgvWarecell.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/entity/AgvWarecell.java new file mode 100644 index 0000000..c08b5df --- /dev/null +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/entity/AgvWarecell.java @@ -0,0 +1,56 @@ +package org.jeecg.modules.wms.api.acs.entity; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AgvWarecell { + + /** + * 任务号 + */ + @ApiModelProperty(value = "任务号", required = true) + private String taskNo; + + /** + * 仓库编号 + */ + @ApiModelProperty(value = "仓库编号", required = true) + private String warehouseCode; + + /** + * 区域 + */ + @ApiModelProperty(value = "区域", required = true) + private String zoneCode; + + /** + * 长度 + */ + @ApiModelProperty(value = "长度") + private String length; + + /** + * 宽度 + */ + @ApiModelProperty(value = "宽度") + private String width; + + /** + * 高度 + */ + @ApiModelProperty(value = "高度") + private String height; + + /** + * 重量 + */ + @ApiModelProperty(value = "重量") + private String weight; + + /** + * 起始站点 + */ + @ApiModelProperty(value = "起始站点") + private String fromPortCode; +} diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/IAcsService.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/IAcsService.java index 03744b7..97d8e39 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/IAcsService.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/IAcsService.java @@ -1,6 +1,7 @@ package org.jeecg.modules.wms.api.acs.service; import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; public interface IAcsService { @@ -12,4 +13,11 @@ public interface IAcsService { Result updateAGVTask(AgvTask agvTask); Result notifyAGVTask(String taskNo, String carNo, int status); + + /** + * 仓位分配 + * @param agvWarecell + * @return + */ + Result warecellAllocation(AgvWarecell agvWarecell); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java index fc8376c..7a35a12 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/acs/service/impl/AcsServiceImpl.java @@ -1,23 +1,52 @@ package org.jeecg.modules.wms.api.acs.service.impl; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + import javax.annotation.Resource; import org.jeecg.common.api.vo.Result; import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.wms.api.acs.entity.AgvEntity; +import org.jeecg.modules.wms.api.acs.entity.AgvWarecell; import org.jeecg.modules.wms.api.acs.service.IAcsService; +import org.jeecg.modules.wms.api.wcs.entity.WcsTask; +import org.jeecg.modules.wms.api.wcs.service.LocationAllocationService; import org.jeecg.modules.wms.config.address.service.IAddressService; +import org.jeecg.modules.wms.config.container.entity.Container; +import org.jeecg.modules.wms.config.container.service.IContainerService; +import org.jeecg.modules.wms.config.containerType.entity.ContainerType; +import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; import org.jeecg.modules.wms.config.location.entity.Location; import org.jeecg.modules.wms.config.location.service.ILocationService; +import org.jeecg.modules.wms.config.locationHigh.entity.LocationHigh; +import org.jeecg.modules.wms.config.locationHigh.service.ILocationHighService; +import org.jeecg.modules.wms.config.locationType.entity.LocationType; +import org.jeecg.modules.wms.config.locationType.service.ILocationTypeService; +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; +import org.jeecg.modules.wms.config.zone.entity.Zone; +import org.jeecg.modules.wms.config.zone.service.IZoneService; import org.jeecg.modules.wms.task.agvTask.entity.AgvTask; import org.jeecg.modules.wms.task.agvTask.service.IAgvTaskService; +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; +import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; import org.jeecg.utils.OkHttpUtils; import org.jeecg.utils.StringUtils; import org.jeecg.utils.constant.QuantityConstant; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; + +import lombok.extern.slf4j.Slf4j; +/** + * @author 游杰 + */ +@Slf4j @Service public class AcsServiceImpl implements IAcsService { @@ -27,6 +56,22 @@ public class AcsServiceImpl implements IAcsService { private IAgvTaskService agvTaskService; @Resource private IAddressService addressService; + @Resource + private IZoneService zoneService; + @Resource + private ITaskHeaderService taskHeaderService; + @Resource + private IContainerService containerService; + @Resource + private IContainerTypeService containerTypeService; + @Resource + private ILocationTypeService locationTypeService; + @Resource + private ILocationHighService locationHighService; + @Resource + private IParameterConfigurationService parameterConfigurationService; + @Resource + private LocationAllocationService locationAllocationService; @Override public Result executeAGVTask(AgvTask agvTask) { @@ -136,4 +181,129 @@ public class AcsServiceImpl implements IAcsService { } return Result.ok("更新任务信息成功"); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Result warecellAllocation(AgvWarecell agvWarecell) { + String warehouseCode = agvWarecell.getWarehouseCode(); + String zoneCode = agvWarecell.getZoneCode(); + String height = agvWarecell.getHeight(); + String taskNo = agvWarecell.getTaskNo(); + String fromPortCode = agvWarecell.getFromPortCode(); + + Zone zone = zoneService.getZoneByCode(zoneCode, warehouseCode); + if (zone == null) { + return Result.error("分配库位时,没有找到库区"); + } + if (StringUtils.isEmpty(fromPortCode)) { + return Result.error("分配库位时,起始站台为空"); + } + TaskHeader taskHeader = taskHeaderService.getById(taskNo); + if (taskHeader == null) { + return Result.error("分配库位时,根据任务号没有找到任务"); + } + if (taskHeader.getStatus() == QuantityConstant.TASK_STATUS_COMPLETED) { + return Result.error("分配库位时,任务已经完成不能再分库位"); + } + int taskType = taskHeader.getTaskType(); + if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT || taskType == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT + || taskType == QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT) { + return Result.error("分配库位时,整出类型的任务不需要分配库位"); + } + String containerCode = taskHeader.getContainerCode(); + if (StringUtils.isEmpty(containerCode)) { + return Result.error("分配库位时,任务托盘为空"); + } + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if (container == null) { + return Result.error("分配库位时,没有找到容器" + containerCode); + } + String containerTypeCode = container.getContainerTypeCode(); + if (StringUtils.isEmpty(containerTypeCode)) { + return Result.error("分配库位时,任务托盘没有库位类型,托盘号为" + containerCode); + } + ContainerType containerType = containerTypeService.getContainerTypeByCode(containerTypeCode, warehouseCode); + if (containerType == null) { + return Result.error("分配库位时,托盘类型为空,托盘类型值为" + containerTypeCode); + } + List<String> locationTypeCodes = containerType.getLocationTypes(); + // 查询满足条件的库位类型 + LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationTypeLambdaQueryWrapper.in(LocationType::getCode, locationTypeCodes).eq(LocationType::getWarehouseCode, warehouseCode); + List<LocationType> locationTypeList = locationTypeService.list(locationTypeLambdaQueryWrapper); + if (locationTypeList.size() == 0) { + return Result.error("分配库位时,没有找到库位类型"); + } + int highHeight = Float.valueOf(height).intValue(); + List<String> locationTypeCodeList = locationTypeList.stream().map(t -> t.getCode()).collect(Collectors.toList()); + LambdaQueryWrapper<LocationHigh> locationHighLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationHighLambdaQueryWrapper.eq(LocationHigh::getHighLevel, highHeight).in(LocationHigh::getLocationTypeCode, locationTypeCodeList) + .eq(LocationHigh::getZoneCode, zoneCode); + LocationHigh locationHigh = locationHighService.getOne(locationHighLambdaQueryWrapper); + if (locationHigh == null) { + return Result.error("分配库位时,高度不匹配,WCS给的高度值" + highHeight + "不在WMS系统配置范围内"); + } + int high = locationHigh.getHigh(); + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION, zoneCode); + if (StringUtils.isEmpty(value)) { + return Result.error("分配库位时, 未绑定定位规则"); + } + int allocationRule = Integer.parseInt(value); + String materialAreaCode = null; + + String locationCode = + locationAllocationService.allocation(allocationRule, locationTypeCodeList, high, zoneCode, null, warehouseCode, containerCode, materialAreaCode, null); + if (StringUtils.isEmpty(locationCode)) { + return Result.error("分配库位时,没有库位可分配"); + } + + boolean success = locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); + if (!success) { + throw new JeecgBootException("分配库位时,更新库位状态失败"); + } + if (StringUtils.isNotEmpty(taskHeader.getToLocationCode()) && !locationCode.equals(taskHeader.getToLocationCode())) { + success = locationService.updateStatus(taskHeader.getToLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if (!success) { + throw new JeecgBootException("分配库位时,更新之前分配的库位状态失败"); + } + } + + Location location = locationService.getLocationByCode(locationCode, warehouseCode); + + int agvTaskId = taskHeader.getId(); + if (agvTaskId != 0) { + AgvTask agvTask = new AgvTask(); + agvTask.setWarehouseCode(warehouseCode); + agvTask.setZoneCode(zoneCode); + agvTask.setTaskType(QuantityConstant.AGV_TYPE_TAKE_AND_RELEASE); + agvTask.setStatus(QuantityConstant.AGV_TASK_STATUS_BUILD); + agvTask.setContainerCode(containerCode); + agvTask.setFromPort(fromPortCode); + agvTask.setToPort(locationCode); + agvTask.setPriority(10); + Result result = agvTaskService.addAgvTask(agvTask, warehouseCode); + if (!result.isSuccess()) { + throw new JeecgBootException("完成分配库位, 新增AGV任务失败"); + } + agvTaskId = agvTask.getId(); + } + + taskHeader = new TaskHeader(); + taskHeader.setId(Integer.parseInt(taskNo)); + taskHeader.setZoneCode(location.getZoneCode()); + taskHeader.setAgvTaskId(agvTaskId); + taskHeader.setRoadWay(location.getRoadWay()); + taskHeader.setAllocationTime(new Date()); + taskHeader.setWeight(Integer.parseInt(agvWarecell.getWeight())); + taskHeader.setToLocationCode(locationCode); + if (!taskHeaderService.updateById(taskHeader)) { + throw new JeecgBootException("更新任务头表目标库位失败"); + } + + WcsTask wcsTask = new WcsTask(); + wcsTask.setToLocationCode(locationCode); + + log.info("完成分配库位,任务号:" + taskNo + ", 库位编码:" + locationCode); + return Result.OK(wcsTask); + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java index d861005..d5ec161 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/agvcall/controller/AgvCallController.java @@ -1,6 +1,9 @@ package org.jeecg.modules.wms.api.agvcall.controller; +import javax.annotation.Resource; + import org.jeecg.modules.wms.framework.controller.HuahengBaseController; +import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,4 +17,7 @@ import io.swagger.annotations.Api; @Api(tags = "AGV接口") public class AgvCallController extends HuahengBaseController { + @Resource + private IReceiveService receiveService; + } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WarecellDomain.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WarecellDomain.java index f89333b..75201fa 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WarecellDomain.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/entity/WarecellDomain.java @@ -60,4 +60,5 @@ public class WarecellDomain { */ @ApiModelProperty(value = "可用巷道") private List<Integer> roadWays; + } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java index 22522da..e834e5e 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java @@ -121,7 +121,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService for (Integer roadWay : roadWays) { LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) - .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode) .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING) .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId); @@ -141,7 +141,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService // 优先找外侧库位 LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) - .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).eq(Location::getRowFlag, QuantityConstant.ROW_OUT) .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING) .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId); @@ -161,7 +161,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService if (locationList.size() == 0) { locationLambda = Wrappers.lambdaQuery(); locationLambda.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) - .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).eq(Location::getRowFlag, QuantityConstant.ROW_IN) .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING) .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId); @@ -201,7 +201,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService for (Integer roadWay : roadWays) { LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) - .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode) .in(Location::getLocationTypeCode, locationTypeCodeList).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING) .orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer).orderByAsc(true, Location::getId); @@ -220,7 +220,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService Integer roadWay = locationAllocationService.getRoadWay(roadWays, materialCode, zoneCode, warehouseCode); LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) - .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) + .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).in(Location::getLocationTypeCode, locationTypeCodeList) .eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING).orderByAsc(true, Location::getHigh).orderByAsc(true, Location::getLayer) .orderByAsc(true, Location::getId); diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/entity/Zone.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/entity/Zone.java index c34fa7d..51f35bb 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/entity/Zone.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/zone/entity/Zone.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; +import org.jeecg.common.aspect.annotation.Dict; import org.jeecgframework.poi.excel.annotation.Excel; import com.baomidou.mybatisplus.annotation.IdType; @@ -50,6 +51,7 @@ public class Zone implements Serializable { /** 类型 */ @Excel(name = "类型", width = 15) @ApiModelProperty(value = "类型") + @Dict(dicCode = "zoneType") private String type; /** 仓库编码 */ diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java index 858b6d5..e462a60 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java @@ -12,7 +12,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jeecg.common.api.vo.Result; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.exception.JeecgBootException; @@ -359,4 +358,5 @@ public class ReceiveHeaderController extends JeecgController<ReceiveHeader, IRec Result result = receiveDetailService.receive(receiveList, warehouseCode); return result; } + } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java index 90e3587..26fbd57 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java @@ -207,4 +207,26 @@ public class ReceiveController extends HuahengBaseController { }); return result; } + + /** + * 组盘 + * @return + */ + @AutoLog("入库单-AGV入库") + @ApiOperation(value = "入库单-AGV入库", notes = "入库单-AGV入库") + @PostMapping("/agvReceipt") + @ResponseBody + public Result agvReceipt(@RequestBody List<Receive> receiveList, HttpServletRequest req) { + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); + String lockKey = warehouseCode; + Result result = handleMultiProcess("agvReceipt", lockKey, new MultiProcessListener() { + @Override + public Result<?> doProcess() { + Result result = receiveService.receivingAndCreateTask(receiveList, warehouseCode); + + return result; + } + }); + return result; + } } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/domain/Receive.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/domain/Receive.java index cbbfa41..3505ada 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/domain/Receive.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/domain/Receive.java @@ -36,4 +36,5 @@ public class Receive implements Serializable { private String toLocationCode; + private String fromPortCode; } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java index ba61d33..24c3325 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java @@ -122,6 +122,7 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> impl } else { return Result.error(result.getMessage()); } + } /** diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/agvTask/service/impl/AgvTaskServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/agvTask/service/impl/AgvTaskServiceImpl.java index 6900a18..59b32a0 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/agvTask/service/impl/AgvTaskServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/agvTask/service/impl/AgvTaskServiceImpl.java @@ -50,12 +50,14 @@ public class AgvTaskServiceImpl extends ServiceImpl<AgvTaskMapper, AgvTask> impl if (StringUtils.isEmpty(containerCode)) { return Result.error("生成AGV任务,容器号不能为空"); } - Container containerByCode = containerService.getContainerByCode(containerCode, warehouseCode); - if (containerByCode == null) { + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if (container == null) { return Result.error("生成AGV任务,容器号:" + containerCode + "未找到"); } - if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode)) { - throw new JeecgBootException("生成AGV任务,锁定容器失败:" + containerCode); + if (!container.getStatus().equals(QuantityConstant.STATUS_CONTAINER_LOCK)) { + if (!containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode)) { + throw new JeecgBootException("生成AGV任务,锁定容器失败:" + containerCode); + } } agvTask.setWarehouseCode(warehouseCode); agvTask.setTaskType(QuantityConstant.AGV_TYPE_TAKE_AND_RELEASE); @@ -103,38 +105,46 @@ public class AgvTaskServiceImpl extends ServiceImpl<AgvTaskMapper, AgvTask> impl String toPort = agvTask.getToPort(); String warehouseCode = agvTask.getWarehouseCode(); String containerCode = agvTask.getContainerCode(); - Location fromLocation = locationService.getLocationByCode(fromPort, warehouseCode); - if (fromLocation != null) { - success = locationService.updateContainerCodeAndStatus(fromPort, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + Container container = containerService.getContainerByCode(containerCode, warehouseCode); + if (container == null) { + throw new JeecgBootException("完成AGV任务时,根据容器编码没有找到容器"); + } + TaskHeader taskHeader = taskHeaderService.getTaskHeaderByAgvTaskId(agvTask.getId()); + if (taskHeader == null) { + Location fromLocation = locationService.getLocationByCode(fromPort, warehouseCode); + if (fromLocation != null) { + success = + locationService.updateContainerCodeAndStatus(fromPort, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if (!success) { + throw new JeecgBootException("完成AGV任务时,更新起始库位数据失败"); + } + } else { + fromPort = QuantityConstant.EMPTY_STRING; + } + Location toLocation = locationService.getLocationByCode(toPort, warehouseCode); + if (toLocation != null) { + success = locationService.updateContainerCodeAndStatus(toPort, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + if (!success) { + throw new JeecgBootException("完成AGV任务时,更新终点库位数据失败"); + } + } else { + toPort = QuantityConstant.EMPTY_STRING; + } + success = containerService.updateLocationCodeAndStatus(containerCode, toPort, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); if (!success) { - throw new JeecgBootException("完成AGV任务时,更新起始库位数据失败"); + throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); } } else { - fromPort = QuantityConstant.EMPTY_STRING; - } - Location toLocation = locationService.getLocationByCode(toPort, warehouseCode); - if (toLocation != null) { - success = locationService.updateContainerCodeAndStatus(toPort, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); + success = containerService.updateLocationCode(containerCode, toPort, warehouseCode); if (!success) { - throw new JeecgBootException("完成AGV任务时,更新终点库位数据失败"); + throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); } - } else { - toPort = QuantityConstant.EMPTY_STRING; - } - Container container = containerService.getContainerByCode(containerCode, warehouseCode); - if (container == null) { - throw new JeecgBootException("完成AGV任务时,根据容器编码没有找到容器"); - } - success = containerService.updateLocationCodeAndStatus(containerCode, toPort, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); - if (!success) { - throw new JeecgBootException("完成AGV任务时,更新容器数据失败"); } agvTask.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); success = updateById(agvTask); if (!success) { throw new JeecgBootException("完成AGV任务时, 更新AGV任务失败"); } - TaskHeader taskHeader = taskHeaderService.getTaskHeaderByAgvTaskId(taskId); if (taskHeader != null) { Result result = taskHeaderService.completeTaskByWMS(taskHeader.getId(), false); if (!result.isSuccess()) { diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java index 2788d50..7c63aac 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java @@ -910,6 +910,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: result = taskHeaderService.cancelShipmentTask(taskHeader); + break; case QuantityConstant.TASK_TYPE_CYCLECOUNT: result = taskHeaderService.updateCycleCountDetailByEnableStatus(taskHeader); break; @@ -2777,8 +2778,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea public Result updateCycleCountDetailByEnableStatus(TaskHeader taskHeader) { log.info("开始取消盘点任务"); LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); - cycleCountDetailLambdaQueryWrapper.eq(CycleCountDetail::getContainerCode, taskHeader.getContainerCode()) - .ne(CycleCountDetail::getEnableStatus, QuantityConstant.SHIPMENT_RECEIVE_SUCCESS); + cycleCountDetailLambdaQueryWrapper.eq(CycleCountDetail::getContainerCode, taskHeader.getContainerCode()).ne(CycleCountDetail::getEnableStatus, + QuantityConstant.SHIPMENT_RECEIVE_SUCCESS); CycleCountDetail cycleCountDetail = cycleCountDetailService.getOne(cycleCountDetailLambdaQueryWrapper); if (cycleCountDetail == null) { throw new JeecgBootException("取消盘点任务,没有找到盘点明细");