zy-asrs-admin/src/components/orderDetl/edit.vue
@@ -156,6 +156,7 @@ const matChecked = ref([]); const matQueryList = ref(null); const matFetching = ref(false); const searchText = ref('') const matSelectList = ref([]); const addDetl = () => { openAddDetl.value = true; @@ -193,6 +194,7 @@ } const handleSearch = debounce(val => { searchText.value = val matQuery(val); }, 600) @@ -221,6 +223,7 @@ } matQuery(null); function matQuery(condition) { matFetching.value = true; post('/api/mat/page', { @@ -334,10 +337,10 @@ <a-modal v-model:open="openAddDetl" :title="formatMessage('component.orderDetl.edit.addDetl', '添加明细')" @ok="handleAddDetlOk" @cancel="handleAddDetlCancel"> <a-select v-model:value="matChecked" :options="matQueryList" mode="multiple" <a-select v-model:value="matChecked" :options="matQueryList" mode="multiple" :searchValue="searchText" :placeholder="formatMessage('component.orderDetl.edit.selectMat', '请选择物料')" @search="handleSearch" :filter-option="false" :not-found-content="matFetching ? undefined : null" @select="handleSelect" @deselect="handleDeselect"></a-select> :filter-option="false" :not-found-content="matFetching ? undefined : null" @select="handleSelect" allowClear @deselect="handleDeselect" ></a-select> </a-modal> </div> </template> zy-asrs-admin/src/views/out/order/index.vue
@@ -25,7 +25,5 @@ </script> <style> .col { color: ; } </style> zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/controller/OutStockController.java
@@ -7,6 +7,7 @@ import com.zy.asrs.wms.apis.wcs.entity.request.RfidSingalRequest; import com.zy.asrs.wms.apis.wcs.entity.request.TasksStatusCallbackParam; import com.zy.asrs.wms.apis.wcs.services.WcsApiService; import com.zy.asrs.wms.asrs.entity.param.BindPlatformParam; import com.zy.asrs.wms.asrs.service.PlatformService; import com.zy.asrs.wms.system.controller.BaseController; import io.netty.util.internal.StringUtil; @@ -24,6 +25,9 @@ @Autowired private WcsApiService wcsApiService; @Autowired private PlatformService platformService; /** @@ -137,7 +141,16 @@ return wcsApiService.getPlatforms(); } // /** // * 绑定订单与集货区关系 // * @param platform // * @return // */ // @PostMapping("/bind/shipping/platform") // public R bindShippingAndPlatform(@RequestBody BindPlatformParam platform) { // return platformService.bindShippingPlatform(platform); // } // } zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/entity/domain/WaveTaskDetl.java
@@ -43,6 +43,8 @@ */ private String batch; /** * 库存 */ zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WaveManagentServiceImpl.java
@@ -7,18 +7,12 @@ import com.zy.asrs.wms.apis.wcs.entity.domain.WaveTaskDetl; import com.zy.asrs.wms.apis.wcs.entity.response.SowSeeds; import com.zy.asrs.wms.apis.wcs.services.WaveManagentService; import com.zy.asrs.wms.asrs.entity.CacheSite; import com.zy.asrs.wms.asrs.entity.Order; import com.zy.asrs.wms.asrs.entity.OrderDetl; import com.zy.asrs.wms.asrs.entity.Task; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.dto.LargeScreenTaskDto; import com.zy.asrs.wms.asrs.entity.enums.OrderPickStatus; import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; import com.zy.asrs.wms.asrs.entity.param.WaveSeedReviewParam; import com.zy.asrs.wms.asrs.mapper.CacheSiteMapper; import com.zy.asrs.wms.asrs.mapper.OrderDetlMapper; import com.zy.asrs.wms.asrs.mapper.OrderMapper; import com.zy.asrs.wms.asrs.mapper.TaskMapper; import com.zy.asrs.wms.asrs.mapper.*; import com.zy.asrs.wms.asrs.service.TaskService; import com.zy.asrs.wms.asrs.service.WaveSeedService; import org.aspectj.weaver.ast.Or; @@ -39,6 +33,9 @@ private TaskService taskService; @Autowired private TaskMapper taskMapper; @Autowired private TaskTypeMapper taskTypeMapper; @Autowired private OrderMapper orderMapper; @Autowired @@ -69,8 +66,9 @@ @Override public R getTask() { List<LargeScreenTaskDto> taskDtos = taskMapper.getTaskIntegrateByTaskNo(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id)); return R.ok(taskDtos); List<LargeScreenTaskDto> taskDtos = taskMapper.getTaskIntegrateByTaskNo(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.WAVE_SEED.id).orderByAsc(Task::getUpdateTime).last("limit 1")); return R.ok(taskDtos); } @Override zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -169,8 +169,7 @@ } } else { //出库任务 if (callbackParam.getEventType().equals(EssTaskStatus.TASK_EVENT_TOTE_LOAD.event)) { //上报取箱状态 //TODO 定时器开启后,要删除 || task.getTaskType() == TaskStsType.GENERATE_OUT.id if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id || task.getTaskSts() == TaskStsType.GENERATE_OUT.id) { if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT.id ) { taskStsType = TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD; } else { String errMsg = "任务编号:" + task.getTaskNo() + "状态为不匹配," + "不能执行:" + TaskStsType.WCS_EXECUTE_OUT_TOTE_LOAD.desc + "任务"; @@ -197,7 +196,7 @@ } //更新出库状态及相关字段 taskService.update(new LambdaUpdateWrapper<Task>() boolean update = taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getRobotCode, callbackParam.getRobotCode()) .set(Task::getSysTaskCode, callbackParam.getSysTaskCode()) .set(Task::getTaskSts, taskStsType.id) @@ -205,6 +204,10 @@ .set(Task::getTaskDesc, callbackParam.getMessage()) .eq(Task::getBarcode, callbackParam.getContainerCode()) .eq(Task::getTaskNo, callbackParam.getTaskCode())); if (!update) { throw new CoolException("任务更新失败!!"); } } @@ -300,6 +303,7 @@ * @param request */ @Override @Transactional(rollbackFor = Exception.class) public void slapLightLogic(Map<String, Object> request) { String taskNo = request.get("taskNo").toString(); String orderNo = request.get("orderNo").toString(); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/dto/LargeScreenTaskDto.java
@@ -18,6 +18,11 @@ */ private String waveNo; /** * 任务类型 */ private String title; private Long id; /** * 拖盘码 @@ -28,6 +33,11 @@ */ private String taskNo; /** * 任务类型 */ private String taskType; /** * 任务状态 */ private Integer taskSts; zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/param/BindPlatformParam.java
@@ -7,8 +7,10 @@ private Long platformId; private String siteNo; private String waveId; private String orderNo; private String orderId; private String siteNo; } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java
@@ -1015,7 +1015,7 @@ List<OrderOutMergeParam> mergeParam = params.stream().filter(par -> { return !StringUtils.isNullOrEmpty(par.getLocNo()); }).collect(Collectors.toList()); //数据分类 1.平库数据 2. TUC数据 //数据分类 1.平库数据 2. CTU数据 Map<Long, List<OrderOutMergeParam>> listMap = mergeParam.stream().collect(Collectors.groupingBy(OrderOutMergeParam::getTypeId)); listMap.keySet().forEach(key -> { @@ -1198,6 +1198,10 @@ //锁定库存量 locDetl.setWorkQty(locDetl.getWorkQty() + outOder.getAnfme()); if (!locDetlService.updateById(locDetl)) { throw new CoolException("库存加锁失败!!"); } }); }); @@ -1338,7 +1342,7 @@ } @Transactional @Transactional(rollbackFor = Exception.class) public void cancelWave(List<Long> waveIds) { if (waveIds == null) { throw new CoolException("参数不能为空"); @@ -1361,6 +1365,14 @@ throw new CoolException("已存在任务,禁止取消波次"); } List<PickSheet> pickSheets = pickSheetService.list(new LambdaQueryWrapper<PickSheet>() .eq(PickSheet::getWaveNo, wave.getWaveNo()) .eq(PickSheet::getDeleted, 0) .eq(PickSheet::getStatus, 1)); if (!pickSheets.isEmpty()) { throw new CoolException("当前波次有拣货单存在!!"); } List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, wave.getId())); for (Order order : orders) { order.setWaveId(null); @@ -1373,17 +1385,17 @@ throw new CoolException("订单反写失败"); } CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, order.getId())); if (cacheSite == null) { throw new CoolException("缓存站不存在"); } cacheSite.setSiteStatus(CacheSiteStatusType.O.id); cacheSite.setOrderId(null); cacheSite.setOrderNo(null); cacheSite.setUpdateTime(new Date()); if (!cacheSiteService.updateById(cacheSite)) { throw new CoolException("缓存站清空失败"); } // CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, order.getId())); // if (cacheSite == null) { // throw new CoolException("缓存站不存在"); // } // cacheSite.setSiteStatus(CacheSiteStatusType.O.id); // cacheSite.setOrderId(null); // cacheSite.setOrderNo(null); // cacheSite.setUpdateTime(new Date()); // if (!cacheSiteService.updateById(cacheSite)) { // throw new CoolException("缓存站清空失败"); // } } waveDetlService.removeById(waveDetl.getId()); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/mapper/ViewLocDetlMapper.java
@@ -26,5 +26,5 @@ List<Map<String,Object>> listSuitableMat( @Param("param") List<FieldParam> param, @Param("sortParam") List<FieldSortParam> sortParam); List<Map<String, Object>> queryFlatStock(@Param("matnr") String matnr, @Param("batch") String batch,@Param("params") List<FieldParam> params); List<Map<String, Object>> queryFlatStock(@Param("matnr") String matnr, @Param("batch") String batch, @Param("params") List<FieldParam> params, @Param("typeId") Long id); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.enums.LocAreaTypeSts; import com.zy.asrs.wms.asrs.entity.enums.LocStsType; import com.zy.asrs.wms.asrs.entity.param.FieldParam; import com.zy.asrs.wms.asrs.entity.param.FieldSortParam; @@ -183,7 +184,7 @@ } @Override @Transactional @Transactional(rollbackFor = Exception.class) public void locDetlFreeze(LocDetlFreezeParam param) { if (param == null) { throw new CoolException("参数不能为空"); @@ -230,7 +231,7 @@ @Override public List<LocDetl> queryFlatStock(String matnr, String batch, List<FieldParam> params) { //获取平库中符合条件的库位 List<Map<String, Object>> list = viewLocDetlMapper.queryFlatStock(matnr, batch, params); List<Map<String, Object>> list = viewLocDetlMapper.queryFlatStock(matnr, batch, params, LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id); List<LocDetl> detls = new ArrayList<>(); list.forEach(action -> { LocDetl parseObject = JSONObject.parseObject(JSON.toJSONString(action), LocDetl.class); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.IService; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; @@ -17,7 +18,6 @@ import com.zy.asrs.wms.system.entity.Host; import com.zy.asrs.wms.system.service.HostService; import io.netty.util.internal.StringUtil; import org.aspectj.weaver.ast.Or; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -81,6 +81,12 @@ private WaveSeedLogService waveSeedLogService; @Autowired private OrderDetlLogService orderDetlLogService; @Autowired private PlatformDetlService platformDetlService; @Autowired private PlatformDetlLogService platformDetlLogService; @Override @@ -257,10 +263,11 @@ .eq(PickSheet::getDeleted, 0) .eq(PickSheet::getStatus, 1) ); BeanUtils.copyProperties(pickSheet, pickDetlDto); if (Objects.isNull(pickDetlDto)) { throw new CoolException("对象复制失败!!"); if (Objects.isNull(pickSheet)) { throw new CoolException("拣货单不存在!!"); } BeanUtils.copyProperties(pickSheet, pickDetlDto); List<PickSheetDetl> sheetDetls = pickSheetDetlService.list(new LambdaQueryWrapper<PickSheetDetl>() .eq(PickSheetDetl::getPickId, pickSheet.getId()) .eq(PickSheetDetl::getStatus, 1) @@ -300,8 +307,8 @@ throw new CoolException("数据错误!!"); } //更新锁定库存 BigDecimal workQty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme()); detl.setWorkQty(workQty.doubleValue()); // BigDecimal workQty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme()); detl.setWorkQty(0.0); //计算结果小于等于零,移出库存明细 BigDecimal qty = BigDecimal.valueOf(detl.getAnfme()).subtract(pickDetl.getAnfme()); detl.setAnfme(qty.doubleValue()); @@ -324,7 +331,7 @@ .set(Loc::getBarcode, null) .set(Loc::getUpdateTime, new Date()) .set(Loc::getLocStsId, LocStsType.O.val())); if (update) { if (!update) { throw new CoolException("库存更新失败!! "); } } @@ -442,6 +449,18 @@ if (params.isEmpty()) { throw new CoolException("发货单据明细为空,不可执行发货操作!!"); } //获取当前上传所有订单号 Set<String> orderNoSet = params.stream().map(ShippingOrderDetlDto::getOrderNo).collect(Collectors.toSet()); if (orderNoSet.isEmpty()) { throw new CoolException("主单信息不存在,请核对出库订单!!"); } List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getOrderNo, orderNoSet)); if (orderList.isEmpty()) { throw new CoolException("订单不存在!!"); } params.forEach(order -> { OrderDetl byId = orderDetlService.getById(order.getId()); if (Objects.isNull(byId)) { @@ -489,16 +508,6 @@ } }); //获取当前上传所有订单号 Set<String> orderNoSet = params.stream().map(ShippingOrderDetlDto::getOrderNo).collect(Collectors.toSet()); if (orderNoSet.isEmpty()) { throw new CoolException("主单信息不存在,请核对出库订单!!"); } List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getOrderNo, orderNoSet)); if (orderList.isEmpty()) { throw new CoolException("订单不存在!!"); } orderList.forEach(one -> { OrderLog orderLog = new OrderLog(); BeanUtils.copyProperties(one, orderLog); @@ -553,6 +562,23 @@ } } Set<Long> ordersSet = orderList.stream().map(Order::getId).collect(Collectors.toSet()); List<PlatformDetl> platDetls = platformDetlService.list(new LambdaQueryWrapper<PlatformDetl>().in(PlatformDetl::getOrderId, ordersSet)); if (platDetls.isEmpty()) { throw new CoolException("订单信息未进集货区!!"); } ArrayList<PlatformDetlLog> platformDetls = new ArrayList<>(); platDetls.forEach(plat -> { PlatformDetlLog detl = new PlatformDetlLog(); BeanUtils.copyProperties(plat, detl); detl.setId(null); platformDetls.add(detl); }); //集货区转历史档 if (!platformDetlLogService.saveBatch(platformDetls)) { throw new CoolException("集货区订单转历史档失败!!"); } return R.ok("发货完成!!"); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/PlatformServiceImpl.java
@@ -1,6 +1,7 @@ package com.zy.asrs.wms.asrs.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; @@ -11,6 +12,7 @@ import com.zy.asrs.wms.asrs.mapper.PlatformMapper; import com.zy.asrs.wms.asrs.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -18,6 +20,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; @Service("platformService") public class PlatformServiceImpl extends ServiceImpl<PlatformMapper, Platform> implements PlatformService { @@ -42,6 +45,8 @@ private WaveLogService waveLogService; @Autowired private WaveDetlLogService waveDetlLogService; @Autowired private WaveSeedService waveSeedService; @Override @Transactional(rollbackFor = Exception.class) @@ -169,7 +174,57 @@ } @Override @Transactional(rollbackFor = Exception.class) public R bindShippingPlatform(BindPlatformParam platform) { return null; if (Objects.isNull(platform.getPlatformId())) { throw new CoolException("集货区标识不能为空!!"); } if (Objects.isNull(platform.getOrderId())) { throw new CoolException("订单编码不能为空!!"); } if (Objects.isNull(platform.getWaveId())) { throw new CoolException("波次ID不能为空!!"); } Platform pl = this.getById(platform.getPlatformId()); if (Objects.isNull(pl)) { throw new CoolException("集货区不存在!!"); } List<WaveSeed> waveSeeds = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getWaveId, platform.getWaveId()).eq(WaveSeed::getOrderId, platform.getOrderId())); if (waveSeeds.isEmpty()) { throw new CoolException("分拣明细信息不存在,数据错误!!"); } ArrayList<PlatformDetl> detls = new ArrayList<>(); waveSeeds.forEach(waveSeed -> { PlatformDetl platformDetl = new PlatformDetl(); BeanUtils.copyProperties(waveSeed, platformDetl); platformDetl.setPlatformId(pl.getId()); platformDetl.setPlatformNo(pl.getPlatformNo()); List<PlatformDetl> list = platformDetlService.list(new LambdaQueryWrapper<PlatformDetl>().eq(PlatformDetl::getTaskDetlId, waveSeed.getTaskDetlId()).eq(PlatformDetl::getOrderDetlId, waveSeed.getOrderDetlId()).eq(PlatformDetl::getMatnr, waveSeed.getMatnr())); if (!list.isEmpty()) { throw new CoolException("订单已入集货区!!"); } detls.add(platformDetl); }); if (!platformDetlService.saveOrUpdateBatch(detls)) { throw new CoolException("集货区明细保存失败!!"); } List<CacheSite> list = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, platform.getOrderId())); if (list.isEmpty()) { throw new CoolException("订单未绑定播种库位,请完成拣货后,再打印订单!!"); } boolean update = cacheSiteService.update(new LambdaUpdateWrapper<CacheSite>() .eq(CacheSite::getOrderId, platform.getOrderId()) .set(CacheSite::getPlatformId, pl.getId()) .set(CacheSite::getPlatformNo, pl.getPlatformNo())); if (!update) { throw new CoolException("播种墙站点绑定集货区失败!!"); } return R.ok("绑定成功!!"); } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/WorkServiceImpl.java
@@ -90,7 +90,7 @@ @Override public Loc generateEmptyLoc(Long taskType, Integer locTypeHeight) { List<ShelvesRule> shelvesRules = shelvesRuleService.list(new LambdaQueryWrapper<ShelvesRule>().eq(ShelvesRule::getStatus, 1).orderByDesc(ShelvesRule::getCreateTime)); if(shelvesRules.isEmpty()) { if (shelvesRules.isEmpty()) { throw new CoolException("未配置上架规则"); } ShelvesRule shelvesRule = shelvesRules.get(0); @@ -114,7 +114,7 @@ } List<ShelvesRuleDetl> ruleDetls = shelvesRule.getRuleDetl$(); if(ruleDetls.isEmpty()) { if (ruleDetls.isEmpty()) { throw new CoolException("未配置上架规则明细"); } @@ -135,7 +135,7 @@ //获取库位 if (!suggestLoc.isEmpty()) { defaultLoc = locUtils.filterLoc(taskType, suggestLoc); if(defaultLoc != null) { if (defaultLoc != null) { return defaultLoc; } } @@ -147,7 +147,7 @@ //获取库位 if (!globalLoc.isEmpty()) { defaultLoc = locUtils.filterAllLoc(globalLoc); if(defaultLoc != null) { if (defaultLoc != null) { return defaultLoc; } } @@ -274,7 +274,7 @@ //生成库位 Loc loc = this.generateLoc(param.getTaskType(), param.getBarcode(), param.getLocTypeHeight()); if(loc == null) { if (loc == null) { throw new CoolException("没有空库位"); } @@ -316,7 +316,7 @@ taskDetl.setMatId(waitPakin.getDetl$().getMatId()); taskDetl.setMatnr(waitPakin.getDetl$().getMat$().getMatnr()); boolean taskDetlSave = taskDetlService.save(taskDetl); if(!taskDetlSave){ if (!taskDetlSave) { throw new CoolException("任务明细生成失败"); } @@ -329,7 +329,7 @@ taskDetlField.setDetlId(taskDetl.getId()); taskDetlField.setValue(orderDetlField.getValue()); boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); if(!taskDetlFieldSave){ if (!taskDetlFieldSave) { throw new CoolException("明细扩展生成失败"); } } @@ -338,26 +338,26 @@ waitPakin.setIoStatus(1); waitPakin.setUpdateTime(new Date()); boolean waitPakinUpdate = waitPakinService.updateById(waitPakin); if(!waitPakinUpdate){ if (!waitPakinUpdate) { throw new CoolException("组托通知档更新失败"); } //更新订单明细数据 OrderDetl orderDetl = orderDetlService.getById(taskDetl.getDetlId()); if(orderDetl == null){ if (orderDetl == null) { throw new CoolException("订单明细不存在"); } orderDetl.setWorkQty(orderDetl.getWorkQty() + taskDetl.getAnfme()); orderDetl.setUpdateTime(new Date()); boolean orderDetlUpdate = orderDetlService.updateById(orderDetl); if(!orderDetlUpdate){ if (!orderDetlUpdate) { throw new CoolException("订单明细更新失败"); } //获取订单 Order order = orderService.getById(taskDetl.getOrderId()); if(order == null){ if (order == null) { throw new CoolException("订单不存在"); } @@ -375,7 +375,7 @@ loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); if(!locUpdate){ if (!locUpdate) { throw new CoolException("库位状态更新失败"); } @@ -391,7 +391,7 @@ //生成库位 Loc loc = this.generateEmptyLoc(param.getTaskType(), param.getLocTypeHeight()); if(loc == null) { if (loc == null) { throw new CoolException("没有空库位"); } @@ -414,7 +414,7 @@ loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); if(!locUpdate){ if (!locUpdate) { throw new CoolException("库位状态更新失败"); } @@ -424,7 +424,7 @@ @Override public boolean completeTask(Long taskId) { Task task = taskService.getById(taskId); if(task == null){ if (task == null) { throw new CoolException("任务不存在"); } @@ -436,12 +436,12 @@ if (task.getTaskType() < 100) { //入库 task.setTaskSts(TaskStsType.COMPLETE_IN.id);//99.入库完成 }else { } else { //出库 TaskDetl taskDetl = taskDetls.get(0); //TODO 出库流程待确认,ESS取货后,输送线流转到扫码处状态 if (taskDetl.getWaveId() == null) { task.setTaskSts(TaskStsType.COMPLETE_OUT.id);//199.出库完成 }else { } else { task.setTaskSts(TaskStsType.WAVE_SEED.id);//198.播种中 } } @@ -458,7 +458,7 @@ @Transactional(rollbackFor = Exception.class) public boolean cancelTask(Long taskId) { Task task = taskService.getById(taskId); if(task == null){ if (task == null) { throw new CoolException("任务不存在"); } @@ -471,15 +471,15 @@ case 54://并板 case 57://盘点 loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc())); if(loc == null){ if (loc == null) { throw new CoolException("库位不存在"); } if(loc.getLocStsId() != LocStsType.S.val()){ if (loc.getLocStsId() != LocStsType.S.val()) { throw new CoolException("库位状态不处于S.入库预约"); } loc.setLocStsId(LocStsType.O.val()); loc.setUpdateTime(new Date()); if(!locService.updateById(loc)){ if (!locService.updateById(loc)) { throw new CoolException("库位状态变更失败"); } break; @@ -489,15 +489,15 @@ case 107://盘点 case 110://空板 loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); if(loc == null){ if (loc == null) { throw new CoolException("库位不存在"); } if(loc.getLocStsId() != LocStsType.R.val()){ if (loc.getLocStsId() != LocStsType.R.val()) { throw new CoolException("库位状态不处于R.出库预约"); } loc.setLocStsId(LocStsType.F.val()); loc.setUpdateTime(new Date()); if(!locService.updateById(loc)){ if (!locService.updateById(loc)) { throw new CoolException("库位状态变更失败"); } @@ -509,7 +509,7 @@ String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, taskDetl.getWaveId())); if(waveDetl == null){ if (waveDetl == null) { continue; } waveDetl.setWorkQty(waveDetl.getWorkQty() - taskDetl.getAnfme()); @@ -521,7 +521,7 @@ break; case 11://库位移转 Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); if(originLoc == null){ if (originLoc == null) { throw new CoolException("源库位不存在"); } if (originLoc.getLocStsId() != LocStsType.R.val()) { @@ -529,22 +529,22 @@ } loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc())); if(loc == null){ if (loc == null) { throw new CoolException("目标库位不存在"); } if(loc.getLocStsId() != LocStsType.S.val()){ if (loc.getLocStsId() != LocStsType.S.val()) { throw new CoolException("目标库位状态不处于S.入库预约"); } originLoc.setLocStsId(LocStsType.F.val()); originLoc.setUpdateTime(new Date()); if(!locService.updateById(originLoc)){ if (!locService.updateById(originLoc)) { throw new CoolException("库位状态变更失败"); } loc.setLocStsId(LocStsType.O.val()); loc.setUpdateTime(new Date()); if(!locService.updateById(loc)){ if (!locService.updateById(loc)) { throw new CoolException("库位状态变更失败"); } break; @@ -560,7 +560,7 @@ //删除任务 boolean removeTask = taskService.removeById(taskId); if(!removeTask){ if (!removeTask) { throw new CoolException("回滚任务失败"); } @@ -579,14 +579,14 @@ //入库回滚组托通知档 if (task.getTaskType() == 1) { WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getDetlId, taskDetl.getDetlId()).eq(WaitPakin::getBarcode, task.getBarcode())); if(waitPakin == null){ if (waitPakin == null) { throw new CoolException("组托通知档不存在"); } waitPakin.setIoStatus(0); waitPakin.setUpdateTime(new Date()); boolean updateWaitPakin = waitPakinService.updateById(waitPakin); if(!updateWaitPakin){ if (!updateWaitPakin) { throw new CoolException("组托通知档回滚失败"); } } @@ -602,7 +602,7 @@ //删除明细 boolean removeDetl = taskDetlService.removeById(taskDetl.getId()); if(!removeDetl){ if (!removeDetl) { throw new CoolException("回滚明细失败"); } @@ -619,7 +619,7 @@ //删除明细扩展 boolean removeField = taskDetlFieldService.removeById(detlField.getId()); if(!removeField){ if (!removeField) { throw new CoolException("回滚扩展明细失败"); } } @@ -633,7 +633,7 @@ @Transactional(rollbackFor = Exception.class) public boolean pickTask(Long taskId) { Task task = taskService.getById(taskId); if(task == null){ if (task == null) { throw new CoolException("任务不存在"); } @@ -647,21 +647,23 @@ //获取源库位 Loc originLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); if(originLoc == null){ if (originLoc == null) { throw new CoolException("源库位不存在"); } //获取源库位高度 LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId()).in(LocTypeBind::getTypeId, LocBindType.HEIGHT.list())); if(locTypeBind == null){ if (locTypeBind == null) { throw new CoolException("库位类型不存在"); } LocType locType = locTypeService.getById(locTypeBind.getTypeId()); if(locType == null){ if (locType == null) { throw new CoolException("库位类型不存在"); } LocTypeHeightType locTypeHeightType = LocTypeHeightType.get(locType.getFlag()); if(locTypeHeightType == null){ if (locTypeHeightType == null) { throw new CoolException("高低库位类型不存在"); } @@ -672,27 +674,30 @@ throw new CoolException("任务明细不存在"); } TaskDetl taskDetl = taskDetls.get(0); //生成新的库位 !important Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id); if(loc == null) { // Loc loc = this.generateLoc(taskType, taskDetl.getMatId(), taskDetl.getBatch(), taskDetl.getUniqueField(), locTypeHeightType.id); // if(loc == null) { // throw new CoolException("没有空库位"); // } Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getOriginLoc())); if (loc == null) { throw new CoolException("没有空库位"); } //102拣料此处需修改为WCS_CONTAINER_RECEIVE,定时任务查询后,自动下发入库任务至ESS task.setTaskSts(TaskStsType.WCS_CONTAINER_RECEIVE.id);//1.生成入库任务 task.setTaskType(taskType); task.setTargetLoc(loc.getLocNo()); //原库位变目标库位, 原站点变目标站点 //todo 需确认原站点为空,该怎么处理 task.setTargetLoc(task.getOriginLoc()); task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { throw new CoolException("拣料失败"); } //库位O => S //库位状态改为预约入库 R => S loc.setLocStsId(LocStsType.S.val()); loc.setUpdateTime(new Date()); boolean locUpdate = locService.updateById(loc); if(!locUpdate){ if (!locUpdate) { throw new CoolException("库位状态更新失败"); } @@ -700,7 +705,7 @@ } @Override @Transactional @Transactional(rollbackFor = Exception.class) public boolean locAdjust(LocAdjustParam param) { if (param == null) { throw new CoolException("参数不能为空"); @@ -792,7 +797,7 @@ throw new CoolException("目标库位不存在"); } if(targetLoc.getLocStsId() != LocStsType.O.val()){ if (targetLoc.getLocStsId() != LocStsType.O.val()) { throw new CoolException("目标库位非空状态"); } @@ -817,7 +822,7 @@ } List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, sourceLoc.getId())); if(locDetls.isEmpty()){ if (locDetls.isEmpty()) { throw new CoolException("源库位明细不存在"); } @@ -833,7 +838,7 @@ taskDetl.setMatId(locDetl.getMatId()); taskDetl.setMatnr(locDetl.getMatnr()); boolean taskDetlSave = taskDetlService.save(taskDetl); if(!taskDetlSave){ if (!taskDetlSave) { throw new CoolException("任务明细生成失败"); } @@ -846,7 +851,7 @@ taskDetlField.setDetlId(taskDetl.getId()); taskDetlField.setValue(locDetlField.getValue()); boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); if(!taskDetlFieldSave){ if (!taskDetlFieldSave) { throw new CoolException("明细扩展生成失败"); } } @@ -856,7 +861,7 @@ sourceLoc.setLocStsId(LocStsType.R.val()); sourceLoc.setUpdateTime(new Date()); boolean sourceLocUpdate = locService.updateById(sourceLoc); if(!sourceLocUpdate){ if (!sourceLocUpdate) { throw new CoolException("库位状态更新失败"); } @@ -864,7 +869,7 @@ targetLoc.setLocStsId(LocStsType.S.val()); targetLoc.setUpdateTime(new Date()); boolean targetLocUpdate = locService.updateById(targetLoc); if(!targetLocUpdate){ if (!targetLocUpdate) { throw new CoolException("库位状态更新失败"); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskLogTimer.java
@@ -73,7 +73,7 @@ if (taskDetls.isEmpty()) { throw new CoolException("任务明细不存在"); } else { //TODO 先更新订单,后删除任务明细。任务为53时,需更新明细。 } else { //任务类型为53,根据WaveId修改订单明细 for (TaskDetl taskDetl : taskDetls) { if (taskDetl.getDetlId() == null) { @@ -214,7 +214,7 @@ taskLog.setId(null); if (!taskLogService.save(taskLog)) { throw new CoolException("保存任务历史档失败"); } else { //fixme 历史任务档保存后,修改订单状态信息后,再删除任务档 } else { //更新订单信息 taskDetls.forEach(taskDetl -> { if (taskDetl.getDetlId() != null) { zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
@@ -9,7 +9,6 @@ import com.zy.asrs.wms.asrs.entity.enums.LocStsType; import com.zy.asrs.wms.asrs.entity.enums.TaskStsType; import com.zy.asrs.wms.asrs.service.*; import io.jsonwebtoken.lang.Collections; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -17,11 +16,8 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Slf4j @Component @@ -113,11 +109,12 @@ /** * // fixme 舍弃 * 1. 定时拉取需要执行回库任务列表数据, * 2. 删除原始库位明细,原始库位状态置成O.空库 * 3. */ @Scheduled(cron = "0/3 * * * * ? ") // @Scheduled(cron = "0/3 * * * * ? ") @Transactional(rollbackFor = Exception.class) public void rollbackStock() { //获取需要执行回库的任务,更新库存信息 @@ -328,7 +325,6 @@ //拣料再入库 private void executeTask53(Task task) { Long hostId = task.getHostId(); //fixme 将任务当前 Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId)); if (loc == null) { throw new CoolException("库位不存在"); @@ -351,37 +347,35 @@ throw new CoolException("任务明细不存在"); } //添加库存明细 //修改库存明细 for (TaskDetl taskDetl : taskDetls) { double anfme = taskDetl.getStock() - taskDetl.getAnfme(); if (anfme <= 0) { continue; } LocDetl locdetl = locDetlService.getOne(new LambdaQueryWrapper<LocDetl>() .eq(LocDetl::getLocId, loc.getId()) .eq(LocDetl::getBatch, taskDetl.getBatch()) .eq(LocDetl::getMatId, taskDetl.getMatId())); LocDetl locDetl = new LocDetl(); locDetl.setLocId(loc.getId()); locDetl.setLocNo(loc.getLocNo()); locDetl.setMatId(taskDetl.getMatId()); locDetl.setMatnr(taskDetl.getMat$().getMatnr()); locDetl.setOrderNo(taskDetl.getOrderNo()); locDetl.setBatch(taskDetl.getBatch()); locDetl.setAnfme(anfme); locDetl.setHostId(hostId); if (!locDetlService.save(locDetl)) { throw new CoolException("插入库存明细失败"); } List<LocDetlField> detlFields = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locdetl.getId()).eq(LocDetlField::getHostId, hostId)); if (!detlFields.isEmpty()) { if (!locDetlFieldService.removeBatchByIds(detlFields)) { throw new CoolException("删除明细扩展字段失败"); } } //添加库存明细扩展字段 List<TaskDetlField> detlFields = taskDetlFieldService.list(new LambdaQueryWrapper<TaskDetlField>().eq(TaskDetlField::getDetlId, taskDetl.getId()).eq(TaskDetlField::getHostId, hostId)); for (TaskDetlField detlField : detlFields) { LocDetlField locDetlField = new LocDetlField(); locDetlField.setDetlId(locDetl.getId()); locDetlField.setFieldId(detlField.getFieldId()); locDetlField.setName(detlField.getName()); locDetlField.setValue(detlField.getValue()); locDetlField.setHostId(hostId); if (!locDetlFieldService.save(locDetlField)) { throw new CoolException("插入明细扩展字段失败"); if (!locDetlService.removeById(locdetl)) { throw new CoolException("库存明细删除失败!!"); } } else { LocDetl locdetl = locDetlService.getOne(new LambdaQueryWrapper<LocDetl>() .eq(LocDetl::getLocId, loc.getId()) .eq(LocDetl::getBatch, taskDetl.getBatch()) .eq(LocDetl::getMatId, taskDetl.getMatId())); locdetl.setWorkQty(0.0); locdetl.setAnfme(anfme); if (!locDetlService.updateById(locdetl)) { throw new CoolException("库存明细更新失败!!"); } } } @@ -423,6 +417,11 @@ } } /** * 将原有库存明细删除 * 库存状态设置为空库状态 * @param task */ //拣料出库 private void executeTask103(Task task) { Long hostId = task.getHostId(); @@ -432,7 +431,7 @@ if (loc == null) { throw new CoolException("库位不存在"); } if (loc.getLocStsId() != LocStsType.R.val()) { if (loc.getLocStsId() != LocStsType.S.val()) { throw new CoolException("库位状态不处于R.出库预约"); } List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId()); zy-asrs-wms/src/main/resources/mapper/asrs/TaskMapper.xml
@@ -54,6 +54,9 @@ SELECT mt.task_no, mt.barcode, mt.task_type, mtt.title, mt.update_time, mtd.wave_no, SUM( mtd.anfme ) anfme, mt.id, @@ -61,6 +64,7 @@ FROM man_task mt INNER JOIN man_task_detl mtd ON mt.id = mtd.task_id INNER JOIN man_task_type mtt ON mt.task_type = mtt.id GROUP BY mt.task_no, mtd.wave_no zy-asrs-wms/src/main/resources/mapper/asrs/ViewLocDetlMapper.xml
@@ -92,7 +92,7 @@ view_man_loc_detl WHERE deleted = 0 AND type_id IN ( SELECT type_id FROM man_loc_area_type WHERE parent_id = 7 OR id = 7 ) AND type_id IN ( SELECT type_id FROM man_loc_area_type WHERE parent_id = #{typeId} OR id = #{typeId} ) ) t WHERE 1 = 1 <if test="matnr != null and matnr != ''">