diff --git a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java index e65620b..cd50891 100644 --- a/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java +++ b/src/main/java/com/glxp/udi/admin/controller/inout/OrderController.java @@ -391,16 +391,17 @@ public class OrderController { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } - filterOrderDetailRequest.setPage(1); - filterOrderDetailRequest.setLimit(100); - List erpOrderEntities = orderDetailService.filterOrderDetails(filterOrderDetailRequest); - if (CollUtil.isNotEmpty(erpOrderEntities)) { - erpOrderEntities.forEach(erpOrderEntity -> { - erpOrderEntity.setReCount(erpOrderEntity.getCount()); - erpOrderEntity.setBatchNo(erpOrderEntity.getBatchNo()); + IPage page = orderDetailService.filterPage(filterOrderDetailRequest); + if (page.getRecords().size() > 0) { + page.getRecords().forEach(orderDetailEntity -> { + orderDetailEntity.setReCount(orderDetailEntity.getCount()); + orderDetailEntity.setBatchNo(orderDetailEntity.getBatchNo()); }); } - return ResultVOUtils.success(erpOrderEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(page.getTotal()); + pageSimpleResponse.setList(page.getRecords()); + return ResultVOUtils.success(pageSimpleResponse); } /** @@ -531,7 +532,7 @@ public class OrderController { if ((StrUtil.isNotBlank(product.getBatchNo()) && StrUtil.isNotBlank(code.getBatchNo()) && product.getBatchNo().equals(code.getBatchNo())) || (StrUtil.isBlank(product.getBatchNo()) && StrUtil.isBlank(code.getBatchNo()))) { WarehousetempEntity supplementCode = new WarehousetempEntity(); - BeanUtil.copyProperties(code, supplementCode,"id"); + BeanUtil.copyProperties(code, supplementCode, "id"); supplementCode.setFromCorpId(originOrder.getFromCorpId()); supplementCode.setFromCorp(originOrder.getFromCorp()); supplementCode.setLocStorageCode(originOrder.getLocStorageCode()); diff --git a/src/main/java/com/glxp/udi/admin/dao/product/StackCodeDao.java b/src/main/java/com/glxp/udi/admin/dao/product/StackCodeDao.java index ed388fd..0593522 100644 --- a/src/main/java/com/glxp/udi/admin/dao/product/StackCodeDao.java +++ b/src/main/java/com/glxp/udi/admin/dao/product/StackCodeDao.java @@ -48,4 +48,12 @@ public interface StackCodeDao extends BaseMapper { * @return */ List getExportData(@Param("orderId") String orderId); + + /** + * 根据垛ID查询条码 + * + * @param orderIdFk + * @return + */ + List selectListByOrderIdFk(@Param("orderIdFk") Integer orderIdFk); } diff --git a/src/main/java/com/glxp/udi/admin/dao/product/StackOrderDao.java b/src/main/java/com/glxp/udi/admin/dao/product/StackOrderDao.java index 3cc5ace..92e4f30 100644 --- a/src/main/java/com/glxp/udi/admin/dao/product/StackOrderDao.java +++ b/src/main/java/com/glxp/udi/admin/dao/product/StackOrderDao.java @@ -23,4 +23,13 @@ public interface StackOrderDao extends BaseMapper { * @param id */ void updateExportStatus(@Param("exportStatus") Integer exportStatus, @Param("id") Integer id); + + /** + * 根据垛号和客户ID,查询此垛的id + * + * @param orderId + * @param customerId + * @return + */ + Integer selectId(@Param("orderId") String orderId, @Param("customerId") Long customerId); } diff --git a/src/main/java/com/glxp/udi/admin/service/inout/OrderDetailService.java b/src/main/java/com/glxp/udi/admin/service/inout/OrderDetailService.java index 625ab00..b808dec 100644 --- a/src/main/java/com/glxp/udi/admin/service/inout/OrderDetailService.java +++ b/src/main/java/com/glxp/udi/admin/service/inout/OrderDetailService.java @@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.glxp.udi.admin.dao.inout.OrderDetailDao; import com.glxp.udi.admin.entity.inout.OrderDetailEntity; import com.glxp.udi.admin.req.inout.DeleteRequest; @@ -81,4 +83,21 @@ public class OrderDetailService { wrapper.eq("orderIdFk", orderId); return orderDetailDao.selectList(wrapper); } + + /** + * 分页查询单据详情 + * + * @param filterOrderDetailRequest + * @return + */ + public IPage filterPage(FilterOrderDetailRequest filterOrderDetailRequest) { + if (null == filterOrderDetailRequest.getPage() || null == filterOrderDetailRequest.getLimit()) { + filterOrderDetailRequest.setPage(1); + filterOrderDetailRequest.setLimit(100); + } + QueryWrapper wrapper = buildDetailQueryWrapper(filterOrderDetailRequest); + IPage page = new Page<>(filterOrderDetailRequest.getPage(), filterOrderDetailRequest.getLimit()); + return orderDetailDao.selectPage(page, wrapper); + } + } diff --git a/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java b/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java index a87d7ed..6ab254d 100644 --- a/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java +++ b/src/main/java/com/glxp/udi/admin/service/product/StackOrderService.java @@ -207,4 +207,16 @@ public class StackOrderService { public void updateExportStatus(Integer exportStatus, Integer id) { stackOrderDao.updateExportStatus(exportStatus, id); } + + /** + * 根据垛号,查询此垛的条码信息 + * + * @param orderId + * @param customerId + * @return + */ + public List getCodeList(String orderId, Long customerId) { + Integer id = stackOrderDao.selectId(orderId, customerId); + return stackCodeDao.selectListByOrderIdFk(id); + } } diff --git a/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java b/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java index dabd48c..e5537ac 100644 --- a/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java +++ b/src/main/java/com/glxp/udi/admin/thread/TransInoutService.java @@ -1,21 +1,18 @@ package com.glxp.udi.admin.thread; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.glxp.udi.admin.constant.ConstantStatus; import com.glxp.udi.admin.entity.basic.BussinessTypeEntity; import com.glxp.udi.admin.entity.inout.*; -import com.glxp.udi.admin.service.inout.OrderDetailService; -import com.glxp.udi.admin.service.inout.OrderService; -import com.glxp.udi.admin.service.inout.WarehouseService; -import com.glxp.udi.admin.service.inout.WarehouseTempService; +import com.glxp.udi.admin.entity.product.StackCode; import com.glxp.udi.admin.req.inout.OrderFilterRequest; import com.glxp.udi.admin.req.inout.PostOrderRequest; import com.glxp.udi.admin.service.basic.BussinessTypeService; import com.glxp.udi.admin.service.info.SetupService; -import com.glxp.udi.admin.service.inout.UdiInfoService; -import com.glxp.udi.admin.service.inout.UdiRelevanceService; -import com.glxp.udi.admin.service.inout.UnitMaintainService; +import com.glxp.udi.admin.service.inout.*; +import com.glxp.udi.admin.service.product.StackOrderService; import com.glxp.udi.admin.util.Constant; import com.glxp.udi.admin.util.CustomUtil; import com.glxp.udi.admin.util.GennerOrderUtils; @@ -58,6 +55,8 @@ public class TransInoutService { private InoutUtils inoutUtils; @Resource private GennerOrderUtils gennerOrderUtils; + @Resource + private StackOrderService stackOrderService; @Async public void transInout(OrderEntity orderEntity) { @@ -131,37 +130,90 @@ public class TransInoutService { } } + //判断是否是扫描的垛号 + boolean isDHCode = filterList.get(0).getCode().contains("DH"); + + //临时码表 for (WarehousetempEntity warehousetemp : filterList) { warehousetemp.setLocStorageCode(orderEntity.getLocStorageCode()); - String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService); - if (result == null) { - WarehouseEntity warehouseEntity = new WarehouseEntity(); - BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id"); - insertList.add(warehouseEntity); - } else { - tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); - tempEntity.setRemark(result); - orderService.updateOrder(tempEntity); - return; - } - - //产品是否可以使用单元入库 - UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(warehousetemp.getNameCode(), String.valueOf(warehousetemp.getCustomerId())); - if (null != udiInfoEntity) { - if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) { + if (isDHCode) { + //扫描的码为垛号码 + //查询此垛的条码,校验单码信息 + List codeList = stackOrderService.getCodeList(warehousetemp.getCode(), warehousetemp.getCustomerId()); + if (CollUtil.isEmpty(codeList)) { tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); - tempEntity.setRemark("udi码:" + warehousetemp.getCode() + "该产品不允许以使用单元入库"); + tempEntity.setRemark("垛号:" + warehousetemp.getCode() + " 无条码数据"); orderService.updateOrder(tempEntity); return; } - //todo 判断是否为有效码 + for (StackCode stackCode : codeList){ + WarehousetempEntity tempCode = new WarehousetempEntity(); + BeanUtil.copyProperties(warehousetemp, tempCode); + BeanUtil.copyProperties(stackCode, tempCode); + tempCode.setId(null); + //校验条码 + String result = inoutUtils.filterCode(warehouseService, tempCode, setupService); + if (result == null) { + WarehouseEntity warehouseEntity = new WarehouseEntity(); + BeanUtil.copyProperties(tempCode, warehouseEntity, "id"); + insertList.add(warehouseEntity); + } else { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark(result); + orderService.updateOrder(tempEntity); + return; + } + //产品是否可以使用单元入库 + UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(tempCode.getNameCode(), String.valueOf(warehousetemp.getCustomerId())); + if (null != udiInfoEntity) { + if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark("udi码:" + tempCode.getCode() + " 该产品不允许以使用单元入库"); + orderService.updateOrder(tempEntity); + return; + } + //todo 判断是否为有效码 + + } else { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark("udi码:" + tempCode.getCode() + " 该产品信息在耗材字典未维护!"); + orderService.updateOrder(tempEntity); + return; + } + } } else { - tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); - tempEntity.setRemark("udi码:" + warehousetemp.getCode() + "该产品信息在耗材字典未维护!"); - orderService.updateOrder(tempEntity); - return; + String result = inoutUtils.filterCode(warehouseService, warehousetemp, setupService); + if (result == null) { + WarehouseEntity warehouseEntity = new WarehouseEntity(); + BeanUtil.copyProperties(warehousetemp, warehouseEntity, "id"); + insertList.add(warehouseEntity); + } else { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark(result); + orderService.updateOrder(tempEntity); + return; + } + + //产品是否可以使用单元入库 + UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(warehousetemp.getNameCode(), String.valueOf(warehousetemp.getCustomerId())); + if (null != udiInfoEntity) { + if (udiInfoEntity.getIsUseDy() == 0 && udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY) { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark("udi码:" + warehousetemp.getCode() + " 该产品不允许以使用单元入库"); + orderService.updateOrder(tempEntity); + return; + } + + //todo 判断是否为有效码 + + } else { + tempEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL); + tempEntity.setRemark("udi码:" + warehousetemp.getCode() + " 该产品信息在耗材字典未维护!"); + orderService.updateOrder(tempEntity); + return; + } } } diff --git a/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java b/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java index bcd2789..f578b8b 100644 --- a/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java +++ b/src/main/java/com/glxp/udi/admin/util/inout/InoutUtils.java @@ -54,10 +54,12 @@ public class InoutUtils { if (CollUtil.isNotEmpty(warehouseEntityList)) { for (int i = 0; i < warehouseEntityList.size(); i++) { WarehouseEntity temp = warehouseEntityList.get(i); - if (temp.getAction().equals(TypeConstant.TYPE_CODE_DESTORY)) { //过滤已销毁的 + //过滤已销毁的 + if (temp.getAction().equals(TypeConstant.TYPE_CODE_DESTORY)) { return getErrMsg(temp); } - if (temp.getAction().equals(TypeConstant.TYPE_STOCK_CHECK)) { //过滤已盘点 + //过滤已盘点 + if (temp.getAction().equals(TypeConstant.TYPE_STOCK_CHECK)) { if (warehouseData.getAction().equals(TypeConstant.TYPE_STOCK_CHECK)) { return warehouseData.getCode() + "该码已盘点"; } diff --git a/src/main/resources/mybatis/mapper/product/StackCodeDao.xml b/src/main/resources/mybatis/mapper/product/StackCodeDao.xml index 39135e3..eeba10c 100644 --- a/src/main/resources/mybatis/mapper/product/StackCodeDao.xml +++ b/src/main/resources/mybatis/mapper/product/StackCodeDao.xml @@ -39,4 +39,10 @@ left join stack_order on stack_order.id = stack_code.orderIdFk where orderIdFk = #{orderId} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/product/StackOrderDao.xml b/src/main/resources/mybatis/mapper/product/StackOrderDao.xml index bb2bb55..0694159 100644 --- a/src/main/resources/mybatis/mapper/product/StackOrderDao.xml +++ b/src/main/resources/mybatis/mapper/product/StackOrderDao.xml @@ -8,6 +8,15 @@ - update stack_order set exportStatus = #{exportStatus} where id = #{id} + update stack_order + set exportStatus = #{exportStatus} + where id = #{id} + + \ No newline at end of file