Explorar el Código

附件增加洗衣状态

xuhaifeng hace 9 meses
padre
commit
6de61d2d32
Se han modificado 16 ficheros con 658 adiciones y 215 borrados
  1. 320 111
      yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothItemController.java
  2. 1 2
      yiqi-common/src/main/java/com/yiqi/common/enums/ClothOrderFlowStatus.java
  3. 65 9
      yiqi-common/src/main/java/com/yiqi/order/domain/OrderClothAdjunct.java
  4. 3 0
      yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemFactoryQueryDTO.java
  5. 1 0
      yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemOutFactoryDTO.java
  6. 3 0
      yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemOutFactoryQueryDTO.java
  7. 73 28
      yiqi-common/src/main/java/com/yiqi/order/domain/vo/OrderClothItemVO.java
  8. 15 0
      yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothAdjunctService.java
  9. 8 0
      yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothItemFlowRecordService.java
  10. 10 0
      yiqi-core/src/main/java/com/yiqi/order/mapper/OrderClothAdjunctMapper.java
  11. 55 1
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothAdjunctServiceImpl.java
  12. 17 6
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemFlowRecordServiceImpl.java
  13. 61 56
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemServiceImpl.java
  14. 6 0
      yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothServiceImpl.java
  15. 19 0
      yiqi-core/src/main/resources/mapper/order/OrderClothAdjunctMapper.xml
  16. 1 2
      yiqi-core/src/main/resources/mapper/order/OrderClothItemMapper.xml

+ 320 - 111
yiqi-admin/src/main/java/com/yiqi/admin/controller/order/OrderClothItemController.java

@@ -8,6 +8,7 @@ import javax.validation.Valid;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.yiqi.common.exception.ServiceException;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -19,10 +20,7 @@ import com.yiqi.common.core.domain.BaseEntity;
 import com.yiqi.common.core.domain.R;
 import com.yiqi.common.enums.ClothOrderFlowStatus;
 import com.yiqi.common.enums.SourceType;
-import com.yiqi.common.utils.DateUtils;
-import com.yiqi.common.utils.EnumUtils;
-import com.yiqi.common.utils.SecurityUtils;
-import com.yiqi.common.utils.StringUtils;
+import com.yiqi.common.utils.*;
 import com.yiqi.core.domain.ClothHanger;
 import com.yiqi.core.domain.ClothHangerOrderRelation;
 import com.yiqi.core.service.IClothHangerOrderRelationService;
@@ -87,7 +85,7 @@ public class OrderClothItemController extends BaseController {
     @PostMapping(value = "saveOrderClothPics")
     @ApiOperation("保存衣服图片")
     public R saveOrderClothPics(@RequestParam @ApiParam("衣服图片集合,『,』分割")
-                                        String pics, @RequestParam @ApiParam("订单衣服ID") Long id) throws Exception {
+                                String pics, @RequestParam @ApiParam("订单衣服ID") Long id) throws Exception {
         OrderClothItem orderClothItem = orderClothItemService.getOne(new QueryWrapper<OrderClothItem>().lambda()
                 .eq(OrderClothItem::getId, id)
                 .eq(OrderClothItem::getOrgId, SecurityUtils.getLoginUser().getOrgId())
@@ -123,9 +121,11 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation("出厂")
     @PostMapping(value = "outFactory")
     public R outFactory(@RequestBody @Valid OrderClothItemOutFactoryDTO orderClothItemOutFactoryDTO) throws Exception {
-        orderClothItemService.outFactory(orderClothItemOutFactoryDTO);
-        orderClothItemFlowRecordService.addRecordBatch(orderClothItemService.list(new QueryWrapper<OrderClothItem>().lambda()
-                .in(OrderClothItem::getId, orderClothItemOutFactoryDTO.getIds())), ClothOrderFlowStatus.outFactory.getCode());
+        if (orderClothItemOutFactoryDTO.getClothType().equals("1")) {
+            orderClothItemService.outFactory(orderClothItemOutFactoryDTO);
+        } else {
+            orderClothAdjunctService.outFactory(orderClothItemOutFactoryDTO);
+        }
         return R.ok();
     }
 
@@ -142,24 +142,41 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation("工厂重洗衣服")
     @GetMapping(value = "rewashCloth")
     public R rewashCloth(@RequestParam @ApiParam("水洗唛") String washCode) throws Exception {
-        LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
-                .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
-//        lambdaQueryWrapper.ge(OrderClothItem::getFlowStatus, (flowStatus + 1));
-        OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
-        if (orderClothItem == null) {
-            throw new ServiceException("未查询到数据");
+        if (washCode.contains(OrderNoUtils.cloth_wash_code_header)) {
+            LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
+                    .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
+            OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
+            if (orderClothItem == null) {
+                throw new ServiceException("未查询到数据");
+            }
+            if (!ClothOrderFlowStatus.checkCloth.getCode().equals(orderClothItem.getFlowStatus())) {
+                throw new ServiceException("当前状态不可进行重洗删除,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+
+            orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
+                    .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.reWash.getCode())
+                    .eq(OrderClothItem::getWashCode, washCode));
+
+            //记录日志
+            orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.reWash.getCode());
         }
-        if (!ClothOrderFlowStatus.checkCloth.getCode().equals(orderClothItem.getFlowStatus())) {
-            throw new ServiceException("当前状态不可进行重洗删除,当前状态【"
-                    + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+        if (washCode.contains(OrderNoUtils.cloth_wash_adjust_code_header)) {
+            OrderClothAdjunct orderClothAdjunct = orderClothAdjunctService.selectOrderClothAdjunctByAdjunctNo(washCode);
+            if (orderClothAdjunct == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.checkCloth.getCode().equals(orderClothAdjunct.getFlowStatus())) {
+                throw new ServiceException("当前状态不可进行重洗删除,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothAdjunct.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            orderClothAdjunctService.update(new UpdateWrapper<OrderClothAdjunct>().lambda()
+                    .set(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.reWash.getCode())
+                    .eq(OrderClothAdjunct::getAdjunctNo, washCode));
+            orderClothItemFlowRecordService.addAdjunctRecord(orderClothAdjunct, ClothOrderFlowStatus.reWash.getCode());
         }
 
-        orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
-                .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.reWash.getCode())
-                .eq(OrderClothItem::getWashCode, washCode));
 
-        //记录日志
-        orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.reWash.getCode());
         return R.ok();
     }
 
@@ -167,23 +184,41 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation("工厂删除入厂")
     @GetMapping(value = "deleteInFactory")
     public R deleteInFactory(@RequestParam @ApiParam("水洗唛") String washCode) throws Exception {
-        LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
-                .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
-//        lambdaQueryWrapper.ge(OrderClothItem::getFlowStatus, (flowStatus + 1));
-        OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
-        if (orderClothItem == null) {
-            throw new ServiceException("未查询到数据");
+
+        if (washCode.contains(OrderNoUtils.cloth_wash_code_header)) {
+            LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
+                    .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
+            OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
+            if (orderClothItem == null) {
+                throw new ServiceException("未查询到数据");
+            }
+            if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothItem.getFlowStatus())) {
+                throw new ServiceException("当前状态不可进行入厂删除,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+
+            orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
+                    .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode())
+                    .eq(OrderClothItem::getWashCode, washCode));
+
+            orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.deleteInFactory.getCode());
         }
-        if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothItem.getFlowStatus())) {
-            throw new ServiceException("当前状态不可进行入厂删除,当前状态【"
-                    + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+        if (washCode.contains(OrderNoUtils.cloth_wash_adjust_code_header)) {
+            OrderClothAdjunct orderClothAdjunct = orderClothAdjunctService.selectOrderClothAdjunctByAdjunctNo(washCode);
+            if (orderClothAdjunct == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothAdjunct.getFlowStatus())) {
+                throw new ServiceException("当前状态不可进行入厂删除,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothAdjunct.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            orderClothAdjunctService.update(new UpdateWrapper<OrderClothAdjunct>().lambda()
+                    .set(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode())
+                    .eq(OrderClothAdjunct::getAdjunctNo, washCode));
+            orderClothItemFlowRecordService.addAdjunctRecord(orderClothAdjunct, ClothOrderFlowStatus.deleteInFactory.getCode());
         }
 
-        orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
-                .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode())
-                .eq(OrderClothItem::getWashCode, washCode));
 
-        orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.deleteInFactory.getCode());
         return R.ok();
     }
 
@@ -191,44 +226,71 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation("工厂衣服入厂")
     @GetMapping(value = "inFactory")
     public R<OrderClothItemVO> inFactory(@RequestParam @ApiParam("水洗唛") String washCode) throws Exception {
-
-        LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
-                .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
-//        lambdaQueryWrapper.ge(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.waitingForWash);
-        OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
-        if (orderClothItem == null) {
-            throw new ServiceException("未查询到数据");
-        }
-        if (!ClothOrderFlowStatus.waitingForWash.getCode().equals(orderClothItem.getFlowStatus())) {
-            throw new ServiceException("该衣服已入厂,无法重复添加,当前状态【"
-                    + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
-        }
-
         OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
-        BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
-        orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctService.list(new QueryWrapper<OrderClothAdjunct>()
-                .lambda().eq(OrderClothAdjunct::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothColors(orderClothColorService.list(new QueryWrapper<OrderClothColor>()
-                .lambda().eq(OrderClothColor::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothCrafts(orderClothCraftService.list(new QueryWrapper<OrderClothCraft>()
-                .lambda().eq(OrderClothCraft::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothFlaws(orderClothFlawService.list(new QueryWrapper<OrderClothFlaw>()
-                .lambda().eq(OrderClothFlaw::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothTypes(orderClothTypeService.list(new QueryWrapper<OrderClothType>()
-                .lambda().eq(OrderClothType::getOrderClothId, orderClothItem.getId())));
+        OrderClothItem orderClothItem = null;
+        if (washCode.contains(OrderNoUtils.cloth_wash_code_header)) {
+            LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
+                    .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
+            orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
+            if (orderClothItem == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.waitingForWash.getCode().equals(orderClothItem.getFlowStatus())) {
+                throw new ServiceException("该衣服已入厂,无法重复添加,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+            orderClothItemVO.setIsAdjunct("N");
+            orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctService.list(new QueryWrapper<OrderClothAdjunct>()
+                    .lambda().eq(OrderClothAdjunct::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothColors(orderClothColorService.list(new QueryWrapper<OrderClothColor>()
+                    .lambda().eq(OrderClothColor::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothCrafts(orderClothCraftService.list(new QueryWrapper<OrderClothCraft>()
+                    .lambda().eq(OrderClothCraft::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothFlaws(orderClothFlawService.list(new QueryWrapper<OrderClothFlaw>()
+                    .lambda().eq(OrderClothFlaw::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothTypes(orderClothTypeService.list(new QueryWrapper<OrderClothType>()
+                    .lambda().eq(OrderClothType::getOrderClothId, orderClothItem.getId())));
+            orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
+                    .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.inFactory.getCode())
+                    .set(OrderClothItem::getInFactoryTime, DateUtils.getNowDate())
+                    .set(OrderClothItem::getInFactoryById, AuthHolder.userId())
+                    .set(OrderClothItem::getInFactoryBy, AuthHolder.nickName())
+                    .eq(OrderClothItem::getWashCode, washCode)
+                    .eq(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode()));
+            //添加记录
+            orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.inFactory.getCode());
+        }
+        if (washCode.contains(OrderNoUtils.cloth_wash_adjust_code_header)) {
+            OrderClothAdjunct orderClothAdjunct = orderClothAdjunctService.selectOrderClothAdjunctByAdjunctNo(washCode);
+            if (orderClothAdjunct == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.waitingForWash.getCode().equals(orderClothAdjunct.getFlowStatus())) {
+                throw new ServiceException("该衣服附件已入厂,无法重复添加,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothAdjunct.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            orderClothItem = orderClothItemService.selectOrderClothItemById(orderClothAdjunct.getOrderClothId());
+            BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+            orderClothItemVO.setIsAdjunct("Y");
+            orderClothItemVO.setWashCode(orderClothAdjunct.getAdjunctNo());
+            orderClothItemVO.setClothItemName("【附件】" + orderClothItemVO.getClothItemName() + " * " + orderClothAdjunct.getAdjunctName());
+            orderClothItemVO.setOrderClothAdjuncts(Arrays.asList(orderClothAdjunct));
+
+            orderClothAdjunctService.update(new UpdateWrapper<OrderClothAdjunct>().lambda()
+                    .set(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.inFactory.getCode())
+                    .set(OrderClothAdjunct::getInFactoryTime, DateUtils.getNowDate())
+                    .set(OrderClothAdjunct::getInFactoryById, AuthHolder.userId())
+                    .set(OrderClothAdjunct::getInFactoryBy, AuthHolder.nickName())
+                    .eq(OrderClothAdjunct::getAdjunctNo, washCode)
+                    .eq(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode()));
+            //添加记录
+            orderClothItemFlowRecordService.addAdjunctRecord(orderClothAdjunct, ClothOrderFlowStatus.inFactory.getCode());
+        }
         orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
                 .eq(SysOrg::getId, orderClothItemVO.getOrgId())
                 .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());
         orderClothItemVO.setFlowStatus(ClothOrderFlowStatus.inFactory.getCode());
-        orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
-                .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.inFactory.getCode())
-                .set(OrderClothItem::getInFactoryTime, DateUtils.getNowDate())
-                .set(OrderClothItem::getInFactoryById, AuthHolder.userId())
-                .set(OrderClothItem::getInFactoryBy, AuthHolder.nickName())
-                .eq(OrderClothItem::getWashCode, washCode)
-                .eq(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.waitingForWash.getCode()));
-
-        orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.inFactory.getCode());
         return R.ok(orderClothItemVO);
     }
 
@@ -237,48 +299,110 @@ public class OrderClothItemController extends BaseController {
     @GetMapping(value = "checkCloth")
     public R<OrderClothItemVO> checkCloth(@RequestParam @ApiParam("水洗唛") String washCode) throws Exception {
 
-        LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
-                .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
-        lambdaQueryWrapper.ge(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.inFactory.getCode());
-        OrderClothItem orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
-        if (orderClothItem == null) {
-            throw new ServiceException("未查询到数据");
-        }
-        if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothItem.getFlowStatus()) && !ClothOrderFlowStatus.reWash.getCode().equals(orderClothItem.getFlowStatus())) {
-            throw new ServiceException("该衣服已检查,无法再次操作,当前状态【"
-                    + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
-        }
-
         OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
-        BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
-        orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctService.list(new QueryWrapper<OrderClothAdjunct>()
-                .lambda().eq(OrderClothAdjunct::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothColors(orderClothColorService.list(new QueryWrapper<OrderClothColor>()
-                .lambda().eq(OrderClothColor::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothCrafts(orderClothCraftService.list(new QueryWrapper<OrderClothCraft>()
-                .lambda().eq(OrderClothCraft::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothFlaws(orderClothFlawService.list(new QueryWrapper<OrderClothFlaw>()
-                .lambda().eq(OrderClothFlaw::getOrderClothId, orderClothItem.getId())));
-        orderClothItemVO.setOrderClothTypes(orderClothTypeService.list(new QueryWrapper<OrderClothType>()
-                .lambda().eq(OrderClothType::getOrderClothId, orderClothItem.getId())));
+        OrderClothItem orderClothItem = null;
+        if (washCode.contains(OrderNoUtils.cloth_wash_code_header)) {
+            LambdaQueryWrapper<OrderClothItem> lambdaQueryWrapper = new QueryWrapper<OrderClothItem>().lambda()
+                    .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId()).eq(OrderClothItem::getWashCode, washCode);
+            orderClothItem = orderClothItemService.getOne(lambdaQueryWrapper);
+            if (orderClothItem == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothItem.getFlowStatus())) {
+                throw new ServiceException("该衣服已检查,无法再次操作,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothItem.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+            orderClothItemVO.setIsAdjunct("N");
+            orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctService.list(new QueryWrapper<OrderClothAdjunct>()
+                    .lambda().eq(OrderClothAdjunct::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothColors(orderClothColorService.list(new QueryWrapper<OrderClothColor>()
+                    .lambda().eq(OrderClothColor::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothCrafts(orderClothCraftService.list(new QueryWrapper<OrderClothCraft>()
+                    .lambda().eq(OrderClothCraft::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothFlaws(orderClothFlawService.list(new QueryWrapper<OrderClothFlaw>()
+                    .lambda().eq(OrderClothFlaw::getOrderClothId, orderClothItem.getId())));
+            orderClothItemVO.setOrderClothTypes(orderClothTypeService.list(new QueryWrapper<OrderClothType>()
+                    .lambda().eq(OrderClothType::getOrderClothId, orderClothItem.getId())));
+            orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
+                    .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode())
+                    .set(OrderClothItem::getCheckClothTime, DateUtils.getNowDate())
+                    .set(OrderClothItem::getCheckClothById, AuthHolder.userId())
+                    .set(OrderClothItem::getCheckClothBy, AuthHolder.nickName())
+                    .eq(OrderClothItem::getWashCode, washCode));
+            //添加记录
+            orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.checkCloth.getCode());
+        }
+        if (washCode.contains(OrderNoUtils.cloth_wash_adjust_code_header)) {
+            OrderClothAdjunct orderClothAdjunct = orderClothAdjunctService.selectOrderClothAdjunctByAdjunctNo(washCode);
+            if (orderClothAdjunct == null) {
+                throw new ServiceException("未查询到衣物");
+            }
+            if (!ClothOrderFlowStatus.inFactory.getCode().equals(orderClothAdjunct.getFlowStatus())) {
+                throw new ServiceException("该衣服附件已检查,无法再次操作,当前状态【"
+                        + EnumUtils.getEnumByType(orderClothAdjunct.getFlowStatus(), ClothOrderFlowStatus.class).getInfo() + "】");
+            }
+            orderClothItem = orderClothItemService.selectOrderClothItemById(orderClothAdjunct.getOrderClothId());
+            BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+            orderClothItemVO.setIsAdjunct("Y");
+            orderClothItemVO.setWashCode(orderClothAdjunct.getAdjunctNo());
+            orderClothItemVO.setClothItemName("【附件】" + orderClothItemVO.getClothItemName() + " * " + orderClothAdjunct.getAdjunctName());
+            orderClothItemVO.setOrderClothAdjuncts(Arrays.asList(orderClothAdjunct));
+
+            orderClothAdjunctService.update(new UpdateWrapper<OrderClothAdjunct>().lambda()
+                    .set(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode())
+                    .set(OrderClothAdjunct::getCheckClothTime, DateUtils.getNowDate())
+                    .set(OrderClothAdjunct::getCheckClothById, AuthHolder.userId())
+                    .set(OrderClothAdjunct::getCheckClothBy, AuthHolder.nickName())
+                    .eq(OrderClothAdjunct::getAdjunctNo, washCode));
+            //添加记录
+            orderClothItemFlowRecordService.addAdjunctRecord(orderClothAdjunct, ClothOrderFlowStatus.checkCloth.getCode());
+        }
         orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
                 .eq(SysOrg::getId, orderClothItemVO.getOrgId())
                 .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());
         orderClothItemVO.setFlowStatus(ClothOrderFlowStatus.checkCloth.getCode());
-        orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
-                .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode())
-                .set(OrderClothItem::getCheckClothTime, DateUtils.getNowDate())
-                .set(OrderClothItem::getCheckClothById, AuthHolder.userId())
-                .set(OrderClothItem::getCheckClothBy, AuthHolder.nickName())
-                .eq(OrderClothItem::getWashCode, washCode));
-
-        orderClothItemFlowRecordService.addRecord(orderClothItem, ClothOrderFlowStatus.checkCloth.getCode());
         return R.ok(orderClothItemVO);
     }
 
     @PostMapping(value = "findOutFactoryPageByFlowStatus")
     @ApiOperation("根据洗衣状态查询出厂衣服列表")
     public R<Page<OrderClothItemVO>> findOutFactoryPageByFlowStatus(@RequestBody @Valid OrderClothItemOutFactoryQueryDTO orderClothItemOutFactoryQueryDTO) throws Exception {
+        if (orderClothItemOutFactoryQueryDTO.getClothType().equals("2")) {
+            LambdaQueryWrapper<OrderClothAdjunct> queryWrapper = new QueryWrapper<OrderClothAdjunct>().lambda()
+                    .eq(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode());
+            queryWrapper.eq(OrderClothAdjunct::getFactoryId, SecurityUtils.getLoginUser().getOrgId());
+            if (orderClothItemOutFactoryQueryDTO.getOrgId() != null) {
+                queryWrapper.eq(OrderClothAdjunct::getStoreId, orderClothItemOutFactoryQueryDTO.getOrgId());
+            }
+            if (StringUtils.isNotEmpty(orderClothItemOutFactoryQueryDTO.getWashCode())) {
+                queryWrapper.like(OrderClothAdjunct::getAdjunctNo, orderClothItemOutFactoryQueryDTO.getWashCode());
+            }
+            Page<OrderClothAdjunct> page = orderClothAdjunctService.page(
+                    new Page<>(orderClothItemOutFactoryQueryDTO.getPageNum()
+                            , orderClothItemOutFactoryQueryDTO.getPageSize())
+                    , queryWrapper);
+            //查询附件
+            List<OrderClothItemVO> orderClothItemVOS = new ArrayList<>();
+            for (OrderClothAdjunct orderClothAdjunct : page.getRecords()) {
+                OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
+                OrderClothItem orderClothItem = orderClothItemService.selectOrderClothItemById(orderClothAdjunct.getOrderClothId());
+                BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+                orderClothItemVO.setIsAdjunct("Y");
+                orderClothItemVO.setId(orderClothAdjunct.getId());
+                orderClothItemVO.setWashCode(orderClothAdjunct.getAdjunctNo());
+                orderClothItemVO.setClothItemName("【附件】" + orderClothItemVO.getClothItemName() + " * " + orderClothAdjunct.getAdjunctName());
+                orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
+                        .eq(SysOrg::getId, orderClothItemVO.getOrgId())
+                        .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());
+                orderClothItemVO.setFlowStatus(orderClothAdjunct.getFlowStatus());
+                orderClothItemVOS.add(orderClothItemVO);
+            }
+            Page<OrderClothItemVO> orderClothItemVOPage = new Page<>();
+            orderClothItemVOPage.setRecords(orderClothItemVOS);
+            orderClothItemVOPage.setTotal(page.getTotal());
+            return R.ok(orderClothItemVOPage);
+        }
         LambdaQueryWrapper<OrderClothItem> queryWrapper = new QueryWrapper<OrderClothItem>().lambda()
                 .eq(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode());
         queryWrapper.eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId());
@@ -300,9 +424,9 @@ public class OrderClothItemController extends BaseController {
             return R.ok(orderClothItemVOPage);
         }
         Set<Long> orderClothItemIds = page.getRecords().stream().map(OrderClothItem::getId).collect(Collectors.toSet());
-        Map<Long, List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
-                        new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId, orderClothItemIds))
-                .stream().collect(Collectors.groupingBy(OrderClothAdjunct::getOrderClothId));
+//        Map<Long, List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
+//                        new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId, orderClothItemIds))
+//                .stream().collect(Collectors.groupingBy(OrderClothAdjunct::getOrderClothId));
         Map<Long, List<OrderClothColor>> orderClothColorMap = orderClothColorService.list(
                         new QueryWrapper<OrderClothColor>().lambda().in(OrderClothColor::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothColor::getOrderClothId));
@@ -320,11 +444,14 @@ public class OrderClothItemController extends BaseController {
         for (OrderClothItem record : page.getRecords()) {
             OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
             BeanUtils.copyProperties(record, orderClothItemVO);
-            orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctMap.get(record.getId()));
+//            orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctMap.get(record.getId()));
             orderClothItemVO.setOrderClothColors(orderClothColorMap.get(record.getId()));
             orderClothItemVO.setOrderClothCrafts(orderClothCraftMap.get(record.getId()));
             orderClothItemVO.setOrderClothFlaws(orderClothFlawMap.get(record.getId()));
             orderClothItemVO.setOrderClothTypes(orderClothTypeMap.get(record.getId()));
+            orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
+                    .eq(SysOrg::getId, orderClothItemVO.getOrgId())
+                    .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());
             orderClothItemVOS.add(orderClothItemVO);
         }
 
@@ -338,6 +465,93 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation("查询工厂衣服记录")
     public TableDataInfo findFactoryClothPage(OrderClothItemFactoryQueryDTO orderClothItemFactoryQueryDTO) throws Exception {
         startPage();
+        if (orderClothItemFactoryQueryDTO.getClothType()!=null && orderClothItemFactoryQueryDTO.getClothType().equals("2")) {
+            LambdaQueryWrapper<OrderClothAdjunct> queryWrapper = new QueryWrapper<OrderClothAdjunct>().lambda()
+                    .eq(OrderClothAdjunct::getFactoryId, SecurityUtils.getLoginUser().getOrgId());
+            if (StringUtils.isNotEmpty(orderClothItemFactoryQueryDTO.getFlowStatus())) {
+                switch (EnumUtils.getEnumByType(orderClothItemFactoryQueryDTO.getFlowStatus(), ClothOrderFlowStatus.class)) {
+                    case inFactory: {
+                        queryWrapper.isNotNull(OrderClothAdjunct::getInFactoryById);
+                        break;
+                    }
+                    case outFactory: {
+                        queryWrapper.isNotNull(OrderClothAdjunct::getOutFactoryById);
+                        break;
+                    }
+                    case checkCloth: {
+                        queryWrapper.isNotNull(OrderClothAdjunct::getCheckClothById);
+                        break;
+                    }
+                    default: {
+                        throw new ServiceException("流程状态查询不正确");
+                    }
+                }
+            }
+            if (StringUtils.isNotEmpty(orderClothItemFactoryQueryDTO.getClothName())) {
+                queryWrapper.like(OrderClothAdjunct::getAdjunctName, orderClothItemFactoryQueryDTO.getClothName());
+            }
+            if (orderClothItemFactoryQueryDTO.getBeginTime() != null) {
+                queryWrapper.ge(OrderClothAdjunct::getCreateTime, orderClothItemFactoryQueryDTO.getBeginTime());
+            }
+            if (orderClothItemFactoryQueryDTO.getEndTime() != null) {
+                queryWrapper.lt(OrderClothAdjunct::getCreateTime, DateUtils.addDays(orderClothItemFactoryQueryDTO.getEndTime(), 1));
+            }
+            if (orderClothItemFactoryQueryDTO.getBeginInFactoryTime() != null) {
+                queryWrapper.ge(OrderClothAdjunct::getInFactoryTime, orderClothItemFactoryQueryDTO.getBeginInFactoryTime());
+            }
+            if (orderClothItemFactoryQueryDTO.getEndInFactoryTime() != null) {
+                queryWrapper.lt(OrderClothAdjunct::getInFactoryTime, DateUtils.addDays(orderClothItemFactoryQueryDTO.getEndInFactoryTime(), 1));
+            }
+            if (orderClothItemFactoryQueryDTO.getBeginOutFactoryTime() != null) {
+                queryWrapper.ge(OrderClothAdjunct::getOutFactoryTime, orderClothItemFactoryQueryDTO.getBeginOutFactoryTime());
+            }
+            if (orderClothItemFactoryQueryDTO.getEndOutFactoryTime() != null) {
+                queryWrapper.lt(OrderClothAdjunct::getOutFactoryTime, DateUtils.addDays(orderClothItemFactoryQueryDTO.getEndOutFactoryTime(), 1));
+            }
+            if (orderClothItemFactoryQueryDTO.getBeginCheckClothTime() != null) {
+                queryWrapper.ge(OrderClothAdjunct::getCheckClothTime, orderClothItemFactoryQueryDTO.getBeginCheckClothTime());
+            }
+            if (orderClothItemFactoryQueryDTO.getEndCheckClothTime() != null) {
+                queryWrapper.lt(OrderClothAdjunct::getCheckClothTime, DateUtils.addDays(orderClothItemFactoryQueryDTO.getEndCheckClothTime(), 1));
+            }
+            if (orderClothItemFactoryQueryDTO.getInFactoryById() != null) {
+                queryWrapper.eq(OrderClothAdjunct::getInFactoryById, orderClothItemFactoryQueryDTO.getInFactoryById());
+            }
+            if (orderClothItemFactoryQueryDTO.getOutFactoryById() != null) {
+                queryWrapper.eq(OrderClothAdjunct::getOutFactoryById, orderClothItemFactoryQueryDTO.getOutFactoryById());
+            }
+            if (orderClothItemFactoryQueryDTO.getCheckClothById() != null) {
+                queryWrapper.eq(OrderClothAdjunct::getCheckClothById, orderClothItemFactoryQueryDTO.getCheckClothById());
+            }
+            if (StringUtils.isNotEmpty(orderClothItemFactoryQueryDTO.getWashCode())) {
+                queryWrapper.eq(OrderClothAdjunct::getAdjunctNo, orderClothItemFactoryQueryDTO.getWashCode());
+            }
+            if (orderClothItemFactoryQueryDTO.getOrgId() != null) {
+                queryWrapper.eq(OrderClothAdjunct::getStoreId, orderClothItemFactoryQueryDTO.getOrgId());
+            }
+            queryWrapper.orderByDesc(BaseEntity::getCreateTime);
+
+            List<OrderClothAdjunct> itemList = orderClothAdjunctService.list(queryWrapper);
+
+            //查询附件
+            List<OrderClothItemVO> orderClothItemVOS = new ArrayList<>();
+            for (OrderClothAdjunct orderClothAdjunct : itemList) {
+                OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
+                OrderClothItem orderClothItem = orderClothItemService.selectOrderClothItemById(orderClothAdjunct.getOrderClothId());
+                BeanUtils.copyProperties(orderClothItem, orderClothItemVO);
+                orderClothItemVO.setIsAdjunct("Y");
+                orderClothItemVO.setId(orderClothAdjunct.getId());
+                orderClothItemVO.setWashCode(orderClothAdjunct.getAdjunctNo());
+                orderClothItemVO.setClothItemName("【附件】" + orderClothItemVO.getClothItemName() + " * " + orderClothAdjunct.getAdjunctName());
+                orderClothItemVO.setOrgName(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
+                        .eq(SysOrg::getId, orderClothItemVO.getOrgId())
+                        .eq(SysOrg::getSourceType, orderClothItemVO.getSourceType()), false).getName());
+                orderClothItemVO.setFlowStatus(orderClothAdjunct.getFlowStatus());
+                orderClothItemVOS.add(orderClothItemVO);
+            }
+            return getDataTable(orderClothItemVOS, new PageInfo(itemList).getTotal());
+        }
+
         LambdaQueryWrapper<OrderClothItem> queryWrapper = new QueryWrapper<OrderClothItem>().lambda()
                 .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId());
         if (StringUtils.isNotEmpty(orderClothItemFactoryQueryDTO.getFlowStatus())) {
@@ -405,8 +619,6 @@ public class OrderClothItemController extends BaseController {
         queryWrapper.orderByDesc(BaseEntity::getCreateTime);
 
         List<OrderClothItem> itemList = orderClothItemService.list(queryWrapper);
-
-
         LambdaQueryWrapper<SysOrg> sysOrgLambdaQueryWrapper = new QueryWrapper<SysOrg>().lambda();
         if (itemList.stream().filter(orderClothItemVO -> SourceType.FACTORY.getCode()
                 .equals(orderClothItemVO.getSourceType())).collect(Collectors.toSet()).size() > 0) {
@@ -423,18 +635,16 @@ public class OrderClothItemController extends BaseController {
                             .map(OrderClothItem::getOrgId).collect(Collectors.toSet())));
         }
         List<SysOrg> sysOrgs = sysOrgService.list(sysOrgLambdaQueryWrapper);
-        Map<Long, SysOrg> factoryOrgMap = sysOrgs.stream().filter(sysOrg -> SourceType.FACTORY.getCode()
-                .equals(sysOrg.getSourceType())).collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
         Map<Long, SysOrg> storeOrgMap = sysOrgs.stream().filter(sysOrg -> SourceType.STORE.getCode()
                 .equals(sysOrg.getSourceType())).collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
         List<OrderClothItemVO> itemVOList = new ArrayList<>();
         for (OrderClothItem record : itemList) {
             OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
             BeanUtils.copyProperties(record, orderClothItemVO);
-            if (SourceType.FACTORY.getCode().equals(record.getSourceType())) {
-                orderClothItemVO.setOrgName(factoryOrgMap.get(record.getOrgId()).getName());
-            } else {
+            if(storeOrgMap.get(record.getOrgId())!=null){
                 orderClothItemVO.setOrgName(storeOrgMap.get(record.getOrgId()).getName());
+            }else{
+                orderClothItemVO.setOrgName("--");
             }
             itemVOList.add(orderClothItemVO);
 
@@ -756,7 +966,6 @@ public class OrderClothItemController extends BaseController {
     @ApiOperation(value = "重洗衣服")
     public AjaxResult reFlowCloth(@RequestParam Long orderClothItemId) {
         orderClothItemService.reFlowCloth(orderClothItemId);
-
         clothHangerOrderRelationService.remove(new QueryWrapper<ClothHangerOrderRelation>().lambda()
                 .eq(ClothHangerOrderRelation::getOrderClothItemId, orderClothItemId));
         return toAjax(true);

+ 1 - 2
yiqi-common/src/main/java/com/yiqi/common/enums/ClothOrderFlowStatus.java

@@ -11,9 +11,8 @@ public enum ClothOrderFlowStatus implements CodeEnum{
     checkCloth("2", "已检查"),
     outFactory("3", "已出厂"),
     hangering("4", "上挂中"),
-
     hasTake("5","已取衣"),
-    reWash("100", "重洗"),
+    reWash("100", "工厂重洗"),
     deleteInFactory("101","删除入厂"),
     refund("102","撤单"),
     ;

+ 65 - 9
yiqi-common/src/main/java/com/yiqi/order/domain/OrderClothAdjunct.java

@@ -3,6 +3,7 @@ package com.yiqi.order.domain;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.yiqi.common.annotation.Excel;
@@ -11,6 +12,8 @@ import io.swagger.annotations.ApiModelProperty;
 import com.yiqi.common.core.domain.BaseEntity;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 订单衣服附件对象 order_cloth_adjunct
  *
@@ -20,11 +23,12 @@ import lombok.Data;
 @ApiModel("订单衣服附件")
 @TableName("order_cloth_adjunct")
 @Data
-public class OrderClothAdjunct extends BaseEntity
-{
-    private static final long serialVersionUID=1L;
+public class OrderClothAdjunct extends BaseEntity {
+    private static final long serialVersionUID = 1L;
 
-    /** 主键ID */
+    /**
+     * 主键ID
+     */
     @ApiModelProperty("主键ID")
     @JsonSerialize(using = ToStringSerializer.class)
     @TableId(type = IdType.AUTO)
@@ -37,23 +41,32 @@ public class OrderClothAdjunct extends BaseEntity
     @ApiModelProperty("附件编号")
     private String adjunctNo;
 
-    /** 附件ID */
+
+    /**
+     * 附件ID
+     */
     @Excel(name = "附件ID")
     @ApiModelProperty("附件ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long adjunctId;
 
-    /** 附件名称 */
+    /**
+     * 附件名称
+     */
     @Excel(name = "附件名称")
     @ApiModelProperty("附件名称")
     private String adjunctName;
 
-    /** 订单ID */
+    /**
+     * 订单ID
+     */
     @ApiModelProperty("订单ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long orderId;
 
-    /** 订单衣服ID */
+    /**
+     * 订单衣服ID
+     */
     @Excel(name = "订单衣服ID")
     @ApiModelProperty("订单衣服ID")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -63,7 +76,50 @@ public class OrderClothAdjunct extends BaseEntity
     @ApiModelProperty("洗衣状态(0=待入厂,1=已入厂,2=已检查,3=已出厂,4=已上挂,5=已取衣,6=已到店、待送衣,7=送衣中,8=已送达、待评价,9=已完成,100=重洗,101=删除入厂,102=撤单)")
     private String flowStatus;
 
-    /** 附件数量 */
+    @ApiModelProperty("工厂ID")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long factoryId;
+
+    @ApiModelProperty("门店ID")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long storeId;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @ApiModelProperty("入厂时间")
+    private Date inFactoryTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @ApiModelProperty("检查时间")
+    private Date checkClothTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @ApiModelProperty("出厂时间")
+    private Date outFactoryTime;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty("入厂人员id")
+    private Long inFactoryById;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty("出厂人员id")
+    private Long outFactoryById;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty("检查人员id")
+    private Long checkClothById;
+
+    @ApiModelProperty("入厂人员")
+    private String inFactoryBy;
+
+    @ApiModelProperty("出厂人员")
+    private String outFactoryBy;
+
+    @ApiModelProperty("检查人员")
+    private String checkClothBy;
+
+    /**
+     * 附件数量
+     */
     @Excel(name = "附件数量")
     @ApiModelProperty("附件数量")
     private Integer num;

+ 3 - 0
yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemFactoryQueryDTO.java

@@ -17,6 +17,9 @@ import java.util.Date;
 @Data
 public class OrderClothItemFactoryQueryDTO implements Serializable {
 
+    @ApiModelProperty("衣服类型 1:普通衣服 2:衣服附件")
+    private String clothType;
+
     @ApiModelProperty("衣服状态,(1=入厂,2=检查,3=出厂)")
     private String flowStatus;
 

+ 1 - 0
yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemOutFactoryDTO.java

@@ -6,6 +6,7 @@ import java.util.List;
 
 @Data
 public class OrderClothItemOutFactoryDTO {
+    private String clothType;
     private List<Long> ids;
 
 }

+ 3 - 0
yiqi-common/src/main/java/com/yiqi/order/domain/dto/OrderClothItemOutFactoryQueryDTO.java

@@ -13,4 +13,7 @@ public class OrderClothItemOutFactoryQueryDTO extends PageVO {
     @ApiModelProperty("衣服编码")
     private String washCode;
 
+    @ApiModelProperty("衣服类型 1:普通衣服 2:衣服附件")
+    private String clothType;
+
 }

+ 73 - 28
yiqi-common/src/main/java/com/yiqi/order/domain/vo/OrderClothItemVO.java

@@ -26,16 +26,25 @@ import java.util.List;
  * @date 2023-10-06
  */
 @Data
-public class OrderClothItemVO extends BaseEntity
-{
-    private static final long serialVersionUID=1L;
+public class OrderClothItemVO extends BaseEntity {
+    private static final long serialVersionUID = 1L;
 
-    /** 主键ID */
+    /**
+     * 主键ID
+     */
     @ApiModelProperty("主键ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long id;
 
-    /** 订单ID */
+    /**
+     * 是否附件
+     */
+    @ApiModelProperty("是否是附件")
+    private String isAdjunct;
+
+    /**
+     * 订单ID
+     */
     @Excel(name = "订单ID")
     @ApiModelProperty("订单ID")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -44,7 +53,9 @@ public class OrderClothItemVO extends BaseEntity
     @ApiModelProperty("订单编号")
     private String orderNo;
 
-    /** 门店/工厂ID */
+    /**
+     * 门店/工厂ID
+     */
     @Excel(name = "门店/工厂ID")
     @ApiModelProperty("门店/工厂ID")
     @JsonSerialize(using = ToStringSerializer.class)
@@ -54,24 +65,32 @@ public class OrderClothItemVO extends BaseEntity
 
     private Long appUserId;
 
-    /** 来源类型 */
+    /**
+     * 来源类型
+     */
     @Excel(name = "来源类型")
     @ApiModelProperty("来源类型")
     private String sourceType;
 
-    /** 工厂ID */
+    /**
+     * 工厂ID
+     */
     @Excel(name = "工厂ID")
     @ApiModelProperty("工厂ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long factoryId;
 
-    /** 衣服ID */
+    /**
+     * 衣服ID
+     */
     @Excel(name = "衣服ID")
     @ApiModelProperty("衣服ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long clothItemId;
 
-    /** 衣服名称 */
+    /**
+     * 衣服名称
+     */
     @Excel(name = "衣服名称")
     @ApiModelProperty("衣服名称")
     private String clothItemName;
@@ -82,28 +101,38 @@ public class OrderClothItemVO extends BaseEntity
     @ApiModelProperty("衣服品牌名称")
     private String clothBrandName;
 
-    /** 洗衣速度ID */
+    /**
+     * 洗衣速度ID
+     */
     @Excel(name = "洗衣速度ID")
     @ApiModelProperty("洗衣速度ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long clothSpeedId;
 
-    /** 洗衣速度名称 */
+    /**
+     * 洗衣速度名称
+     */
     @Excel(name = "洗衣速度名称")
     @ApiModelProperty("洗衣速度名称")
     private String clothSpeedName;
 
-    /** 价格倍数 */
+    /**
+     * 价格倍数
+     */
     @Excel(name = "价格倍数")
     @ApiModelProperty("价格倍数")
     private BigDecimal clothMultiple;
 
-    /** 洗衣天数 */
+    /**
+     * 洗衣天数
+     */
     @Excel(name = "洗衣天数")
     @ApiModelProperty("洗衣天数")
     private Integer clothWashDayNum;
 
-    /** 衣服单价 */
+    /**
+     * 衣服单价
+     */
     @Excel(name = "衣服单价")
     @ApiModelProperty("衣服单价")
     private BigDecimal price;
@@ -119,44 +148,60 @@ public class OrderClothItemVO extends BaseEntity
     @ApiModelProperty("折后支付价格")
     private BigDecimal payPrice;
 
-    /** 洗衣方式ID */
+    /**
+     * 洗衣方式ID
+     */
     @Excel(name = "洗衣方式ID")
     @ApiModelProperty("洗衣方式ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long clothWashModeId;
 
-    /** 洗衣方式名称 */
+    /**
+     * 洗衣方式名称
+     */
     @Excel(name = "洗衣方式名称")
     @ApiModelProperty("洗衣方式名称")
     private String clothWashModeName;
 
-    /** 照片 */
+    /**
+     * 照片
+     */
     @Excel(name = "照片")
     @ApiModelProperty("照片")
     private String pics;
 
-    /** 水洗唛 */
+    /**
+     * 水洗唛
+     */
     @Excel(name = "水洗唛")
     @ApiModelProperty("水洗唛")
     private String washCode;
 
-    /** 挂架ID */
+    /**
+     * 挂架ID
+     */
     @Excel(name = "挂架ID")
     @ApiModelProperty("挂架ID")
     @JsonSerialize(using = ToStringSerializer.class)
     private Long clothHangerId;
 
-    /** 挂架位置code */
+    /**
+     * 挂架位置code
+     */
     @Excel(name = "挂架位置code")
     @ApiModelProperty("挂架位置code")
     private String clothHangerCode;
 
-    /** 是否保值 */
+    /**
+     * 是否保值
+     */
     @Excel(name = "是否保值")
     @ApiModelProperty("是否保值")
     private String isHedging;
 
-    /** 保值价格 */
+    /**
+     * 保值价格
+     */
     @Excel(name = "保值价格")
     @ApiModelProperty("保值价格")
     private BigDecimal hedgingPrice;
@@ -167,23 +212,23 @@ public class OrderClothItemVO extends BaseEntity
     @ApiModelProperty("洗衣状态")
     private String flowStatus;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("预计取衣时间")
     private Date planSendClothTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("入厂时间")
     private Date inFactoryTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("检查时间")
     private Date checkClothTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("出厂时间")
     private Date outFactoryTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("取衣时间")
     private Date takeClothTime;
 

+ 15 - 0
yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothAdjunctService.java

@@ -3,6 +3,8 @@ package com.yiqi.order.service;
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yiqi.order.domain.OrderClothAdjunct;
+import com.yiqi.order.domain.dto.OrderClothItemOutFactoryDTO;
+import com.yiqi.order.domain.dto.OrderClothItemOutFactoryQueryDTO;
 
 /**
  * 订单衣服附件Service接口
@@ -59,6 +61,19 @@ public interface IOrderClothAdjunctService extends IService<OrderClothAdjunct> {
      */
     public int deleteOrderClothAdjunctById(Long id);
 
+    /**
+     * 根据附件编号查询
+     * @param adjunctNo
+     * @return
+     */
+    OrderClothAdjunct selectOrderClothAdjunctByAdjunctNo(String adjunctNo);
 
+    /**
+     * 根据订单衣服查询
+     * @param orderClothItemOutFactoryQueryDTO
+     * @return
+     */
+    List<OrderClothAdjunct> queryWaitFactoryOrderClothAdjunctList(OrderClothItemOutFactoryQueryDTO orderClothItemOutFactoryQueryDTO);
 
+    void outFactory(OrderClothItemOutFactoryDTO orderClothItemOutFactoryDTO);
 }

+ 8 - 0
yiqi-common/src/main/java/com/yiqi/order/service/IOrderClothItemFlowRecordService.java

@@ -2,6 +2,7 @@ package com.yiqi.order.service;
 
 import java.util.List;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.yiqi.order.domain.OrderClothAdjunct;
 import com.yiqi.order.domain.OrderClothItem;
 import com.yiqi.order.domain.OrderClothItemFlowRecord;
 
@@ -17,4 +18,11 @@ public interface IOrderClothItemFlowRecordService extends IService<OrderClothIte
 
 
     public void addRecord(OrderClothItem orderClothItem,String flowStatus);
+
+    /**
+     * 添加附件记录
+     * @param orderClothAdjunct
+     * @param flowStatus
+     */
+    public void addAdjunctRecord(OrderClothAdjunct orderClothAdjunct, String flowStatus);
 }

+ 10 - 0
yiqi-core/src/main/java/com/yiqi/order/mapper/OrderClothAdjunctMapper.java

@@ -2,6 +2,7 @@ package com.yiqi.order.mapper;
 
 import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yiqi.order.domain.dto.OrderClothItemOutFactoryQueryDTO;
 import org.apache.ibatis.annotations.Mapper;
 import com.yiqi.order.domain.OrderClothAdjunct;
 
@@ -60,4 +61,13 @@ public interface OrderClothAdjunctMapper extends BaseMapper<OrderClothAdjunct> {
      * @return 结果
      */
     public int deleteOrderClothAdjunctByIds(Long[] ids);
+
+    OrderClothAdjunct selectOrderClothAdjunctByAdjunctNo(String adjunctNo);
+
+    /**
+     * 查询待出厂的订单衣服附件列表
+     * @param orderClothItemOutFactoryQueryDTO
+     * @return
+     */
+    List<OrderClothAdjunct> queryWaitFactoryOrderClothAdjunctList(OrderClothItemOutFactoryQueryDTO orderClothItemOutFactoryQueryDTO);
 }

+ 55 - 1
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothAdjunctServiceImpl.java

@@ -1,8 +1,19 @@
 package com.yiqi.order.service.impl;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.yiqi.common.core.domain.AuthHolder;
+import com.yiqi.common.enums.ClothOrderFlowStatus;
+import com.yiqi.common.exception.ServiceException;
 import com.yiqi.common.utils.DateUtils;
 import com.yiqi.common.utils.SecurityUtils;
+import com.yiqi.common.utils.StringUtils;
+import com.yiqi.order.domain.OrderClothItem;
+import com.yiqi.order.domain.dto.OrderClothItemOutFactoryDTO;
+import com.yiqi.order.domain.dto.OrderClothItemOutFactoryQueryDTO;
+import com.yiqi.order.service.IOrderClothItemFlowRecordService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.yiqi.order.mapper.OrderClothAdjunctMapper;
@@ -17,7 +28,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date 2023-10-06
  */
 @Service
-public class OrderClothAdjunctServiceImpl extends ServiceImpl<OrderClothAdjunctMapper,OrderClothAdjunct> implements IOrderClothAdjunctService {
+public class OrderClothAdjunctServiceImpl extends ServiceImpl<OrderClothAdjunctMapper, OrderClothAdjunct> implements IOrderClothAdjunctService {
+
+    @Autowired
+    private IOrderClothItemFlowRecordService orderClothItemFlowRecordService;
 
     /**
      * 查询订单衣服附件
@@ -87,6 +101,46 @@ public class OrderClothAdjunctServiceImpl extends ServiceImpl<OrderClothAdjunctM
         return baseMapper.deleteOrderClothAdjunctById(id);
     }
 
+    @Override
+    public OrderClothAdjunct selectOrderClothAdjunctByAdjunctNo(String adjunctNo) {
+        return baseMapper.selectOrderClothAdjunctByAdjunctNo(adjunctNo);
+    }
 
+    @Override
+    public List<OrderClothAdjunct> queryWaitFactoryOrderClothAdjunctList(OrderClothItemOutFactoryQueryDTO orderClothItemOutFactoryQueryDTO) {
+        return baseMapper.queryWaitFactoryOrderClothAdjunctList(orderClothItemOutFactoryQueryDTO);
+    }
 
+    @Override
+    public void outFactory(OrderClothItemOutFactoryDTO orderClothItemOutFactoryDTO) {
+        /**
+         * 先进行验证,如果这批ID里,有状态不符合的,查出来
+         */
+        List<OrderClothAdjunct> orderClothItems = list(new QueryWrapper<OrderClothAdjunct>().lambda()
+                .in(OrderClothAdjunct::getId, orderClothItemOutFactoryDTO.getIds())
+                .ne(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode()));
+        if (orderClothItems.size() > 0) {
+            String errorMsg = "";
+            for (OrderClothAdjunct orderClothItem : orderClothItems) {
+                errorMsg += (StringUtils.isEmpty(errorMsg)
+                        ? ("衣服编号" + orderClothItem.getAdjunctNo()) : ("," + orderClothItem.getAdjunctNo()));
+            }
+            errorMsg += "洗衣状态不正确,请重新选择";
+            throw new ServiceException(errorMsg);
+        }
+        update(new UpdateWrapper<OrderClothAdjunct>().lambda()
+                .set(OrderClothAdjunct::getFlowStatus
+                        , ClothOrderFlowStatus.outFactory.getCode())
+                .set(OrderClothAdjunct::getOutFactoryTime, DateUtils.getNowDate())
+                .set(OrderClothAdjunct::getOutFactoryById, AuthHolder.userId())
+                .set(OrderClothAdjunct::getOutFactoryBy, AuthHolder.nickName())
+                .in(OrderClothAdjunct::getId, orderClothItemOutFactoryDTO.getIds())
+                .eq(OrderClothAdjunct::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode()));
+        //添加记录
+        List<OrderClothAdjunct> orderClothAdjunctList = list(new QueryWrapper<OrderClothAdjunct>().lambda()
+                .in(OrderClothAdjunct::getId, orderClothItemOutFactoryDTO.getIds()));
+        for (OrderClothAdjunct orderClothAdjunct : orderClothAdjunctList) {
+            orderClothItemFlowRecordService.addAdjunctRecord(orderClothAdjunct, ClothOrderFlowStatus.outFactory.getCode());
+        }
+    }
 }

+ 17 - 6
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemFlowRecordServiceImpl.java

@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.yiqi.common.enums.ClothOrderFlowStatus;
 import com.yiqi.common.utils.DateUtils;
 import com.yiqi.common.utils.EnumUtils;
+import com.yiqi.common.utils.OrderNoUtils;
 import com.yiqi.common.utils.SecurityUtils;
+import com.yiqi.order.domain.OrderClothAdjunct;
 import com.yiqi.order.domain.OrderClothItem;
 import com.yiqi.order.service.IOrderClothItemService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,14 +26,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date 2023-12-05
  */
 @Service
-public class OrderClothItemFlowRecordServiceImpl extends ServiceImpl<OrderClothItemFlowRecordMapper,OrderClothItemFlowRecord>
+public class OrderClothItemFlowRecordServiceImpl extends ServiceImpl<OrderClothItemFlowRecordMapper, OrderClothItemFlowRecord>
         implements IOrderClothItemFlowRecordService {
 
-    @Autowired
-    private IOrderClothItemService orderClothItemService;
-
-
-
     @Override
     public void addRecordBatch(List<OrderClothItem> orderClothItems, String flowStatus) {
         List<OrderClothItemFlowRecord> orderClothItemFlowRecords = new ArrayList<>();
@@ -64,4 +61,18 @@ public class OrderClothItemFlowRecordServiceImpl extends ServiceImpl<OrderClothI
         save(orderClothItemFlowRecord);
     }
 
+    @Override
+    public void addAdjunctRecord(OrderClothAdjunct orderClothAdjunct, String flowStatus) {
+        OrderClothItemFlowRecord orderClothItemFlowRecord = new OrderClothItemFlowRecord();
+        orderClothItemFlowRecord.buildCreateData();
+        orderClothItemFlowRecord.setOrderId(orderClothAdjunct.getOrderId());
+        orderClothItemFlowRecord.setOrderClothItemId(orderClothAdjunct.getOrderClothId());
+        orderClothItemFlowRecord.setFlowStatus(flowStatus);
+        orderClothItemFlowRecord.setFlowStatusName("附件" + EnumUtils.getEnumByType(flowStatus, ClothOrderFlowStatus.class).getInfo());
+        orderClothItemFlowRecord.setWashCode(orderClothAdjunct.getAdjunctNo());
+        orderClothItemFlowRecord.setClothId(orderClothAdjunct.getOrderClothId());
+        save(orderClothItemFlowRecord);
+    }
+
+
 }

+ 61 - 56
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothItemServiceImpl.java

@@ -37,7 +37,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  * @date 2023-10-06
  */
 @Service
-public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,OrderClothItem> implements IOrderClothItemService {
+public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper, OrderClothItem> implements IOrderClothItemService {
     @Autowired
     private IOrderClothItemService orderClothItemService;
     @Autowired
@@ -56,45 +56,47 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
     private ISysOrgService sysOrgService;
     @Autowired
     private IAppUserService appUserService;
+    @Autowired
+    private IOrderClothItemFlowRecordService orderClothItemFlowRecordService;
 
     @Override
     public OrderClothItemCountStatisticVO getUnFinishedOrderClothCountGroupByStatus() {
-        return baseMapper.getUnFinishedOrderClothCountGroupByStatus(SecurityUtils.getLoginUser().getOrgId(),SecurityUtils.getLoginUser().getSourceType());
+        return baseMapper.getUnFinishedOrderClothCountGroupByStatus(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType());
     }
 
     @Override
     public OrderClothItemTimeoutCountStatisticVO getTimeoutOrderClothCountGroupByStatus() {
         return baseMapper.getTimeoutOrderClothCountGroupByStatus(SecurityUtils.getLoginUser().getOrgId()
-                ,SecurityUtils.getLoginUser().getSourceType(),DateUtils.addDays(DateUtils.getNowDate(),-3)
-                ,DateUtils.addDays(DateUtils.getNowDate(),-5));
+                , SecurityUtils.getLoginUser().getSourceType(), DateUtils.addDays(DateUtils.getNowDate(), -3)
+                , DateUtils.addDays(DateUtils.getNowDate(), -5));
     }
 
     @Override
     public List<OrderClothItemVO> buildWeAppOrderClothItemDetail(List<OrderClothItem> orderClothItems) {
-        if(orderClothItems.size() == 0){
+        if (orderClothItems.size() == 0) {
             return new ArrayList<>();
         }
         Set<Long> orderClothItemIds = orderClothItems.stream().map(OrderClothItem::getId).collect(Collectors.toSet());
-        Map<Long,List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
-                new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
+                        new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothAdjunct::getOrderClothId));
-        Map<Long,List<OrderClothColor>> orderClothColorMap = orderClothColorService.list(
-                new QueryWrapper<OrderClothColor>().lambda().in(OrderClothColor::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothColor>> orderClothColorMap = orderClothColorService.list(
+                        new QueryWrapper<OrderClothColor>().lambda().in(OrderClothColor::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothColor::getOrderClothId));
-        Map<Long,List<OrderClothCraft>> orderClothCraftMap = orderClothCraftService.list(
-                new QueryWrapper<OrderClothCraft>().lambda().in(OrderClothCraft::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothCraft>> orderClothCraftMap = orderClothCraftService.list(
+                        new QueryWrapper<OrderClothCraft>().lambda().in(OrderClothCraft::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothCraft::getOrderClothId));
-        Map<Long,List<OrderClothFlaw>> orderClothFlawMap = orderClothFlawService.list(
-                new QueryWrapper<OrderClothFlaw>().lambda().in(OrderClothFlaw::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothFlaw>> orderClothFlawMap = orderClothFlawService.list(
+                        new QueryWrapper<OrderClothFlaw>().lambda().in(OrderClothFlaw::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothFlaw::getOrderClothId));
-        Map<Long,List<OrderClothType>> orderClothTypeMap = orderClothTypeService.list(
-                new QueryWrapper<OrderClothType>().lambda().in(OrderClothType::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothType>> orderClothTypeMap = orderClothTypeService.list(
+                        new QueryWrapper<OrderClothType>().lambda().in(OrderClothType::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothType::getOrderClothId));
 
         List<OrderClothItemVO> orderClothItemVOS = new ArrayList<>();
         for (OrderClothItem record : orderClothItems) {
             OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
-            BeanUtils.copyProperties(record,orderClothItemVO);
+            BeanUtils.copyProperties(record, orderClothItemVO);
             orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctMap.get(record.getId()));
             orderClothItemVO.setOrderClothColors(orderClothColorMap.get(record.getId()));
             orderClothItemVO.setOrderClothCrafts(orderClothCraftMap.get(record.getId()));
@@ -109,27 +111,27 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
     public List<OrderClothItemVO> buildOrderClothItemDetail(List<OrderClothItem> orderClothItems) {
         List<OrderClothItemVO> orderClothItemVOS = buildWeAppOrderClothItemDetail(orderClothItems);
 
-        if(orderClothItems.size() == 0){
+        if (orderClothItems.size() == 0) {
             return new ArrayList<>();
         }
-        Map<Long, AppUser> appUserMap = appUserService.list(new QueryWrapper<AppUser>().lambda().in(AppUser::getId,orderClothItems.stream()
-                .map(OrderClothItem::getAppUserId).collect(Collectors.toSet()))).stream().collect(Collectors.toMap(AppUser::getId,AppUser -> AppUser));
+        Map<Long, AppUser> appUserMap = appUserService.list(new QueryWrapper<AppUser>().lambda().in(AppUser::getId, orderClothItems.stream()
+                .map(OrderClothItem::getAppUserId).collect(Collectors.toSet()))).stream().collect(Collectors.toMap(AppUser::getId, AppUser -> AppUser));
         Map<Long, ClothHanger> clothHangerMap = new HashMap<>();
-        if(orderClothItems.stream()
+        if (orderClothItems.stream()
                 .filter(orderClothItem -> orderClothItem.getClothHangerId() != null)
                 .map(OrderClothItem::getClothHangerId)
-                .collect(Collectors.toSet()).size() > 0){
+                .collect(Collectors.toSet()).size() > 0) {
             clothHangerMap = clothHangerService.list(new QueryWrapper<ClothHanger>().lambda()
-                    .in(ClothHanger::getId,orderClothItems.stream()
-                            .filter(orderClothItem -> orderClothItem.getClothHangerId() != null)
-                            .map(OrderClothItem::getClothHangerId)
-                            .collect(Collectors.toSet()))).stream()
-                    .collect(Collectors.toMap(ClothHanger::getId,ClothHanger -> ClothHanger));
+                            .in(ClothHanger::getId, orderClothItems.stream()
+                                    .filter(orderClothItem -> orderClothItem.getClothHangerId() != null)
+                                    .map(OrderClothItem::getClothHangerId)
+                                    .collect(Collectors.toSet()))).stream()
+                    .collect(Collectors.toMap(ClothHanger::getId, ClothHanger -> ClothHanger));
         }
         for (OrderClothItemVO orderClothItemVO : orderClothItemVOS) {
             orderClothItemVO.setAppUserName(appUserMap.get(orderClothItemVO.getAppUserId()).getRealName());
             orderClothItemVO.setAppUserPhoneNumber(appUserMap.get(orderClothItemVO.getAppUserId()).getPhoneNumber());
-            if(clothHangerMap.containsKey(orderClothItemVO.getClothHangerId())){
+            if (clothHangerMap.containsKey(orderClothItemVO.getClothHangerId())) {
                 orderClothItemVO.setClothHanger(clothHangerMap.get(orderClothItemVO.getClothHangerId()));
             }
         }
@@ -142,27 +144,30 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
          * 先进行验证,如果这批ID里,有状态不符合的,查出来
          */
         List<OrderClothItem> orderClothItems = list(new QueryWrapper<OrderClothItem>().lambda()
-                .in(OrderClothItem::getId,orderClothItemOutFactoryDTO.getIds())
+                .in(OrderClothItem::getId, orderClothItemOutFactoryDTO.getIds())
                 .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId())
-                .ne(OrderClothItem::getFlowStatus,ClothOrderFlowStatus.checkCloth.getCode()));
-        if(orderClothItems.size() > 0){
+                .ne(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode()));
+        if (orderClothItems.size() > 0) {
             String errorMsg = "";
             for (OrderClothItem orderClothItem : orderClothItems) {
                 errorMsg += (StringUtils.isEmpty(errorMsg)
-                        ?("衣服编号"+ orderClothItem.getWashCode()):("," + orderClothItem.getWashCode()));
+                        ? ("衣服编号" + orderClothItem.getWashCode()) : ("," + orderClothItem.getWashCode()));
             }
             errorMsg += "洗衣状态不正确,请重新选择";
             throw new ServiceException(errorMsg);
         }
 
         update(new UpdateWrapper<OrderClothItem>().lambda().set(OrderClothItem::getFlowStatus
-                , ClothOrderFlowStatus.outFactory.getCode())
-                .set(OrderClothItem::getOutFactoryTime,DateUtils.getNowDate())
-                .set(OrderClothItem::getOutFactoryById,AuthHolder.userId())
-                .set(OrderClothItem::getOutFactoryBy,AuthHolder.nickName())
-                .in(OrderClothItem::getId,orderClothItemOutFactoryDTO.getIds())
+                        , ClothOrderFlowStatus.outFactory.getCode())
+                .set(OrderClothItem::getOutFactoryTime, DateUtils.getNowDate())
+                .set(OrderClothItem::getOutFactoryById, AuthHolder.userId())
+                .set(OrderClothItem::getOutFactoryBy, AuthHolder.nickName())
+                .in(OrderClothItem::getId, orderClothItemOutFactoryDTO.getIds())
                 .eq(OrderClothItem::getFactoryId, SecurityUtils.getLoginUser().getOrgId())
-                .eq(OrderClothItem::getFlowStatus,ClothOrderFlowStatus.checkCloth.getCode()));
+                .eq(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.checkCloth.getCode()));
+
+        orderClothItemFlowRecordService.addRecordBatch(orderClothItemService.list(new QueryWrapper<OrderClothItem>().lambda()
+                .in(OrderClothItem::getId, orderClothItemOutFactoryDTO.getIds())), ClothOrderFlowStatus.outFactory.getCode());
     }
 
     /**
@@ -173,7 +178,7 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
      */
     @Override
     public OrderClothItem selectOrderClothItemById(Long id) {
-        return baseMapper.selectOrderClothItemById(id);
+        return baseMapper.selectById(id);
     }
 
     /**
@@ -241,23 +246,23 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
         LambdaQueryWrapper<OrderClothItem> queryWrapper = new QueryWrapper<OrderClothItem>().lambda()
                 .eq(OrderClothItem::getOrgId, SecurityUtils.getLoginUser().getOrgId())
                 .eq(OrderClothItem::getSourceType, SecurityUtils.getLoginUser().getSourceType());
-        if(orderClothHangerDTO.getFlowStatus() != null){
+        if (orderClothHangerDTO.getFlowStatus() != null) {
             queryWrapper.eq(OrderClothItem::getFlowStatus, orderClothHangerDTO.getFlowStatus());
-        }else {
+        } else {
             queryWrapper.in(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.hangering.getCode(), ClothOrderFlowStatus.outFactory.getCode());
         }
-        if(orderClothHangerDTO.getWashCode() != null){
+        if (orderClothHangerDTO.getWashCode() != null) {
             queryWrapper.eq(OrderClothItem::getWashCode, orderClothHangerDTO.getWashCode());
         }
-        if(orderClothHangerDTO.getOrderNo() != null){
+        if (orderClothHangerDTO.getOrderNo() != null) {
             queryWrapper.eq(OrderClothItem::getOrderNo, orderClothHangerDTO.getOrderNo());
         }
 
         Page<OrderClothItem> page = orderClothItemService.page(
                 new Page<>(orderClothHangerDTO.getPageNum()
-                        ,orderClothHangerDTO.getPageSize())
-                ,queryWrapper);
-        if(page.getRecords().size() == 0){
+                        , orderClothHangerDTO.getPageSize())
+                , queryWrapper);
+        if (page.getRecords().size() == 0) {
             Page<OrderClothItemVO> orderClothItemVOPage = new Page<>();
             orderClothItemVOPage.setRecords(new ArrayList<>());
             orderClothItemVOPage.setTotal(page.getTotal());
@@ -265,26 +270,26 @@ public class OrderClothItemServiceImpl extends ServiceImpl<OrderClothItemMapper,
         }
 
         Set<Long> orderClothItemIds = page.getRecords().stream().map(OrderClothItem::getId).collect(Collectors.toSet());
-        Map<Long,List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
-                        new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothAdjunct>> orderClothAdjunctMap = orderClothAdjunctService.list(
+                        new QueryWrapper<OrderClothAdjunct>().lambda().in(OrderClothAdjunct::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothAdjunct::getOrderClothId));
-        Map<Long,List<OrderClothColor>> orderClothColorMap = orderClothColorService.list(
-                        new QueryWrapper<OrderClothColor>().lambda().in(OrderClothColor::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothColor>> orderClothColorMap = orderClothColorService.list(
+                        new QueryWrapper<OrderClothColor>().lambda().in(OrderClothColor::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothColor::getOrderClothId));
-        Map<Long,List<OrderClothCraft>> orderClothCraftMap = orderClothCraftService.list(
-                        new QueryWrapper<OrderClothCraft>().lambda().in(OrderClothCraft::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothCraft>> orderClothCraftMap = orderClothCraftService.list(
+                        new QueryWrapper<OrderClothCraft>().lambda().in(OrderClothCraft::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothCraft::getOrderClothId));
-        Map<Long,List<OrderClothFlaw>> orderClothFlawMap = orderClothFlawService.list(
-                        new QueryWrapper<OrderClothFlaw>().lambda().in(OrderClothFlaw::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothFlaw>> orderClothFlawMap = orderClothFlawService.list(
+                        new QueryWrapper<OrderClothFlaw>().lambda().in(OrderClothFlaw::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothFlaw::getOrderClothId));
-        Map<Long,List<OrderClothType>> orderClothTypeMap = orderClothTypeService.list(
-                        new QueryWrapper<OrderClothType>().lambda().in(OrderClothType::getOrderClothId,orderClothItemIds))
+        Map<Long, List<OrderClothType>> orderClothTypeMap = orderClothTypeService.list(
+                        new QueryWrapper<OrderClothType>().lambda().in(OrderClothType::getOrderClothId, orderClothItemIds))
                 .stream().collect(Collectors.groupingBy(OrderClothType::getOrderClothId));
 
         List<OrderClothItemVO> orderClothItemVOS = new ArrayList<>();
         for (OrderClothItem record : page.getRecords()) {
             OrderClothItemVO orderClothItemVO = new OrderClothItemVO();
-            BeanUtils.copyProperties(record,orderClothItemVO);
+            BeanUtils.copyProperties(record, orderClothItemVO);
             orderClothItemVO.setOrderClothAdjuncts(orderClothAdjunctMap.get(record.getId()));
             orderClothItemVO.setOrderClothColors(orderClothColorMap.get(record.getId()));
             orderClothItemVO.setOrderClothCrafts(orderClothCraftMap.get(record.getId()));

+ 6 - 0
yiqi-core/src/main/java/com/yiqi/order/service/impl/OrderClothServiceImpl.java

@@ -826,7 +826,10 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
                         orderClothAdjunct.setAdjunctName(orderClothAdjunctDTO.getAdjunctName() + (j + 1));
                         orderClothAdjunct.setAdjunctNo(orderNoUtils.getClothWashAdjustCode());
                         orderClothAdjunct.setOrderId(orderCloth.getId());
+                        orderClothAdjunct.setFlowStatus(ClothOrderFlowStatus.waitingForWash.getCode());
                         orderClothAdjunct.setNum(1);
+                        orderClothAdjunct.setFactoryId(orderCloth.getFactoryId());
+                        orderClothAdjunct.setStoreId(orderCloth.getOrgId());
                         orderClothAdjunct.setOrderClothId(orderClothItems.get(i).getId());
                         orderClothAdjunct.buildCreateData();
                         orderClothAdjuncts.add(orderClothAdjunct);
@@ -836,6 +839,9 @@ public class OrderClothServiceImpl extends ServiceImpl<OrderClothMapper, OrderCl
                     BeanUtils.copyProperties(orderClothAdjunctDTO, orderClothAdjunct);
                     orderClothAdjunct.setAdjunctNo(orderNoUtils.getClothWashAdjustCode());
                     orderClothAdjunct.setOrderId(orderCloth.getId());
+                    orderClothAdjunct.setStoreId(orderCloth.getOrgId());
+                    orderClothAdjunct.setFactoryId(orderCloth.getFactoryId());
+                    orderClothAdjunct.setFlowStatus(ClothOrderFlowStatus.waitingForWash.getCode());
                     orderClothAdjunct.setOrderClothId(orderClothItems.get(i).getId());
                     orderClothAdjunct.buildCreateData();
                     orderClothAdjuncts.add(orderClothAdjunct);

+ 19 - 0
yiqi-core/src/main/resources/mapper/order/OrderClothAdjunctMapper.xml

@@ -42,6 +42,25 @@
         <include refid="selectOrderClothAdjunctVo"/>
         where id = #{id}
     </select>
+    <select id="selectOrderClothAdjunctByAdjunctNo" resultType="com.yiqi.order.domain.OrderClothAdjunct"
+            parameterType="java.lang.String">
+        select *
+        from order_cloth_adjunct
+        where adjunct_no = #{adjunctNo}
+    </select>
+
+    <select id="queryWaitFactoryOrderClothAdjunctList" resultType="com.yiqi.order.domain.OrderClothAdjunct"
+            parameterType="com.yiqi.order.domain.dto.OrderClothItemOutFactoryQueryDTO">
+        select ad.*
+        from order_cloth_adjunct ad left join order_cloth_item oi on ad.order_cloth_id = oi.id
+        where ad.flow_status = '2'
+        <if test="orgId != null">
+            and oi.org_id = #{orgId}
+        </if>
+        <if test="washCode != null">
+            and ad.adjunct_no = #{washCode}
+        </if>
+    </select>
 
     <insert id="insertOrderClothAdjunct" parameterType="OrderClothAdjunct" useGeneratedKeys="true"
             keyProperty="id">

+ 1 - 2
yiqi-core/src/main/resources/mapper/order/OrderClothItemMapper.xml

@@ -46,8 +46,7 @@
 
 
     <sql id="selectOrderClothItemVo">
-        select id, order_id, order_no, wash_code, app_user_id, org_id, source_type, factory_id, flow_status, cloth_item_id, cloth_item_name, cloth_brand_id, cloth_brand_name, cloth_speed_id, cloth_speed_name, cloth_multiple, cloth_wash_day_num, price, special_price, total_price, cloth_wash_mode_id, cloth_wash_mode_name, pics, cloth_problem, cloth_hanger_id, cloth_hanger_code, is_hedging, hedging_price, send_cloth_time, create_by_id, create_by, create_time, update_by_id, update_by, update_time, remark, is_custom_price
-        from order_cloth_item
+        select * from order_cloth_item
     </sql>
 
     <select id="selectOrderClothItemList" parameterType="OrderClothItem" resultMap="OrderClothItemResult">