Ver Fonte

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryMapper.java
#	sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java
xiaomi há 1 ano atrás
pai
commit
b6cf539c37
27 ficheiros alterados com 953 adições e 22 exclusões
  1. 72 0
      sd-business/src/main/java/com/sd/business/controller/craft/CraftProductionLineController.java
  2. 3 2
      sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java
  3. 5 0
      sd-business/src/main/java/com/sd/business/entity/bom/bo/BomBo.java
  4. 26 0
      sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineDto.java
  5. 17 0
      sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineProcessDto.java
  6. 17 0
      sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineProcessSelectDto.java
  7. 27 0
      sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineSelectDto.java
  8. 47 0
      sd-business/src/main/java/com/sd/business/entity/craft/po/CraftProductionLine.java
  9. 59 0
      sd-business/src/main/java/com/sd/business/entity/craft/po/CraftProductionLineProcess.java
  10. 22 0
      sd-business/src/main/java/com/sd/business/entity/craft/vo/CraftProductionLineProcessVo.java
  11. 21 0
      sd-business/src/main/java/com/sd/business/entity/craft/vo/CraftProductionLineVo.java
  12. 15 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityByWarehouseDto.java
  13. 10 0
      sd-business/src/main/java/com/sd/business/entity/order/vo/OrderSkuVo.java
  14. 26 0
      sd-business/src/main/java/com/sd/business/mapper/craft/CraftProductionLineMapper.java
  15. 26 0
      sd-business/src/main/java/com/sd/business/mapper/craft/CraftProductionLineProcessMapper.java
  16. 46 0
      sd-business/src/main/java/com/sd/business/service/craft/CraftProductionLineProcessService.java
  17. 46 0
      sd-business/src/main/java/com/sd/business/service/craft/CraftProductionLineService.java
  18. 57 0
      sd-business/src/main/java/com/sd/business/service/craft/impl/CraftProductionLineProcessServiceImpl.java
  19. 144 0
      sd-business/src/main/java/com/sd/business/service/craft/impl/CraftProductionLineServiceImpl.java
  20. 2 1
      sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java
  21. 9 7
      sd-business/src/main/java/com/sd/business/service/order/impl/OrderServiceImpl.java
  22. 18 0
      sd-business/src/main/resources/mapper/craft/CraftProductionLineMapper.xml
  23. 21 0
      sd-business/src/main/resources/mapper/craft/CraftProductionLineProcessMapper.xml
  24. 8 3
      sd-business/src/main/resources/mapper/inventory/InventoryMapper.xml
  25. 5 3
      sd-business/src/main/resources/mapper/sku/SkuSpecMapper.xml
  26. 186 0
      sd-starter/src/test/java/SyncSkuBootTest.java
  27. 18 6
      sd-wln/src/main/java/com/sd/wln/service/impl/WlnOrderServiceImpl.java

+ 72 - 0
sd-business/src/main/java/com/sd/business/controller/craft/CraftProductionLineController.java

@@ -0,0 +1,72 @@
+package com.sd.business.controller.craft;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineSelectDto;
+import com.sd.business.entity.craft.vo.CraftProductionLineVo;
+import com.sd.business.service.craft.CraftProductionLineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 工艺_产线 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@RestController
+@RequestMapping("/craftProductionLine")
+public class CraftProductionLineController {
+
+    @Autowired
+    private CraftProductionLineService craftProductionLineService;
+
+    /**
+     * 工艺_产线分页
+     */
+    @PostMapping("/page")
+    public Page<CraftProductionLineVo> page(@RequestBody CraftProductionLineSelectDto dto) {
+        return craftProductionLineService.getPage(dto);
+    }
+
+    /**
+     * 工艺_产线明细
+     */
+    @PostMapping("/detail")
+    public CraftProductionLineVo detail(@RequestBody BaseSelectDto dto) {
+        return craftProductionLineService.detail(dto.getId());
+    }
+
+    /**
+     * 工艺_产线新增
+     */
+    @PostMapping("/add")
+    public void add(@Validated @RequestBody CraftProductionLineDto craftProductionLineDto) {
+        craftProductionLineService.add(craftProductionLineDto);
+    }
+
+    /**
+     * 工艺_产线编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody CraftProductionLineDto craftProductionLineDto) {
+        craftProductionLineService.edit(craftProductionLineDto);
+    }
+
+    /**
+     * 工艺_产线删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        craftProductionLineService.delete(dto.getId());
+    }
+
+}

+ 3 - 2
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java

@@ -2,6 +2,7 @@ package com.sd.business.controller.inventory;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
+import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
 import com.sd.business.entity.inventory.vo.InventoryVo;
 import com.sd.business.entity.inventory.vo.QuantityByDepartmentVo;
 import com.sd.business.entity.inventory.vo.QuantityByWarehouseVo;
@@ -43,8 +44,8 @@ public class InventoryController {
      * 根据仓库获取库存数量
      */
     @PostMapping("/getQuantityByWarehouse")
-    public List<QuantityByWarehouseVo> getQuantityByWarehouse() {
-        return inventoryService.getQuantityByWarehouse();
+    public List<QuantityByWarehouseVo> getQuantityByWarehouse(@RequestBody QuantityByWarehouseDto dto) {
+        return inventoryService.getQuantityByWarehouse(dto);
     }
 
     /**

+ 5 - 0
sd-business/src/main/java/com/sd/business/entity/bom/bo/BomBo.java

@@ -39,4 +39,9 @@ public class BomBo {
      */
     private BigDecimal externalSellingPrice;
 
+    /**
+     * 分类父id
+     */
+    private Long classifyParentId;
+
 }

+ 26 - 0
sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineDto.java

@@ -0,0 +1,26 @@
+package com.sd.business.entity.craft.dto;
+
+import com.sd.business.entity.craft.po.CraftProductionLine;
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * 工艺_产线新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineDto extends CraftProductionLine {
+
+    @Valid
+    @NotNull(message = "产线明细不能为空")
+    private List<CraftProductionLineProcess> craftProductionLineProcessList;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineProcessDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.craft.dto;
+
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 工艺_产线工序关联新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineProcessDto extends CraftProductionLineProcess {
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineProcessSelectDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.craft.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 工艺_产线工序关联列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineProcessSelectDto extends BaseSelectDto {
+
+}

+ 27 - 0
sd-business/src/main/java/com/sd/business/entity/craft/dto/CraftProductionLineSelectDto.java

@@ -0,0 +1,27 @@
+package com.sd.business.entity.craft.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 工艺_产线列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineSelectDto extends BaseSelectDto {
+
+    /**
+     * 产线编码
+     */
+    private String code;
+
+    /**
+     * 产线名称
+     */
+    private String name;
+
+}

+ 47 - 0
sd-business/src/main/java/com/sd/business/entity/craft/po/CraftProductionLine.java

@@ -0,0 +1,47 @@
+package com.sd.business.entity.craft.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ * 工艺_产线
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+@TableName("craft_production_line")
+public class CraftProductionLine extends BasePo {
+
+    /**
+     * 产线编码
+     */
+    @NotBlank(message = "产线编码不能为空")
+    private String code;
+
+    /**
+     * 产线名称
+     */
+    @NotBlank(message = "产线名称不能为空")
+    private String name;
+
+    /**
+     * 是否批量模式:1是 0否
+     */
+    @NotNull(message = "是否批量模式不能为空")
+    private Integer batchMode;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 59 - 0
sd-business/src/main/java/com/sd/business/entity/craft/po/CraftProductionLineProcess.java

@@ -0,0 +1,59 @@
+package com.sd.business.entity.craft.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ * 工艺_产线工序关联
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+@TableName("craft_production_line_process")
+public class CraftProductionLineProcess extends BasePo {
+
+    /**
+     * 工艺_产线id
+     */
+    private Long craftProductionLineId;
+
+    /**
+     * 工艺_工序id
+     */
+    @NotNull(message = "工序id不能为空")
+    private Long craftProcessId;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 设备id
+     */
+    private Long equipmentId;
+
+    /**
+     * rfidIp
+     */
+    private String rfidIp;
+
+    /**
+     * rfid通道
+     */
+    private String rfidPassage;
+
+    /**
+     * 接口地址
+     */
+    private String interfaceAddress;
+
+}

+ 22 - 0
sd-business/src/main/java/com/sd/business/entity/craft/vo/CraftProductionLineProcessVo.java

@@ -0,0 +1,22 @@
+package com.sd.business.entity.craft.vo;
+
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 工艺_产线工序关联列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineProcessVo extends CraftProductionLineProcess {
+
+    /**
+     * 工序名称
+     */
+    private String craftProcessName;
+
+}

+ 21 - 0
sd-business/src/main/java/com/sd/business/entity/craft/vo/CraftProductionLineVo.java

@@ -0,0 +1,21 @@
+package com.sd.business.entity.craft.vo;
+
+import com.sd.business.entity.craft.po.CraftProductionLine;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 工艺_产线列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Getter
+@Setter
+public class CraftProductionLineVo extends CraftProductionLine {
+
+    private List<CraftProductionLineProcessVo> craftProductionLineProcessList;
+
+}

+ 15 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityByWarehouseDto.java

@@ -0,0 +1,15 @@
+package com.sd.business.entity.inventory.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class QuantityByWarehouseDto {
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+}

+ 10 - 0
sd-business/src/main/java/com/sd/business/entity/order/vo/OrderSkuVo.java

@@ -34,6 +34,16 @@ public class OrderSkuVo extends OrderSku {
     private String code;
 
     /**
+     * bom品名
+     */
+    private String bomName;
+
+    /**
+     * bom品号
+     */
+    private String bomCode;
+
+    /**
      * 包材配件
      */
     private List<OrderSkuBomVo> orderSkuBomList;

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/craft/CraftProductionLineMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.craft;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.craft.po.CraftProductionLine;
+import com.sd.business.entity.craft.vo.CraftProductionLineVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 工艺_产线 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+public interface CraftProductionLineMapper extends BaseMapper<CraftProductionLine> {
+
+    /**
+     * 工艺_产线分页
+     */
+    Page<CraftProductionLineVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<CraftProductionLine> wrapper);
+
+}

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/craft/CraftProductionLineProcessMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.craft;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import com.sd.business.entity.craft.vo.CraftProductionLineProcessVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 工艺_产线工序关联 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+public interface CraftProductionLineProcessMapper extends BaseMapper<CraftProductionLineProcess> {
+
+    /**
+     * 工艺_产线工序关联分页
+     */
+    Page<CraftProductionLineProcessVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<CraftProductionLineProcess> wrapper);
+
+}

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/craft/CraftProductionLineProcessService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.craft;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.craft.dto.CraftProductionLineProcessDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineProcessSelectDto;
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import com.sd.business.entity.craft.vo.CraftProductionLineProcessVo;
+
+
+/**
+ * <p>
+ * 工艺_产线工序关联 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+public interface CraftProductionLineProcessService extends BaseService<CraftProductionLineProcess> {
+
+    /**
+     * 工艺_产线工序关联分页
+     */
+    Page<CraftProductionLineProcessVo> getPage(CraftProductionLineProcessSelectDto dto);
+
+    /**
+     * 工艺_产线工序关联明细
+     */
+    CraftProductionLineProcessVo detail(Long id);
+
+    /**
+     * 工艺_产线工序关联新增
+     */
+    void add(CraftProductionLineProcessDto craftProductionLineProcessDto);
+
+    /**
+     * 工艺_产线工序关联编辑
+     */
+    void edit(CraftProductionLineProcessDto craftProductionLineProcessDto);
+
+    /**
+     * 工艺_产线工序关联删除
+     */
+    void delete(Long id);
+
+}

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/craft/CraftProductionLineService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.craft;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.craft.dto.CraftProductionLineDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineSelectDto;
+import com.sd.business.entity.craft.po.CraftProductionLine;
+import com.sd.business.entity.craft.vo.CraftProductionLineVo;
+
+
+/**
+ * <p>
+ * 工艺_产线 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+public interface CraftProductionLineService extends BaseService<CraftProductionLine> {
+
+    /**
+     * 工艺_产线分页
+     */
+    Page<CraftProductionLineVo> getPage(CraftProductionLineSelectDto dto);
+
+    /**
+     * 工艺_产线明细
+     */
+    CraftProductionLineVo detail(Long id);
+
+    /**
+     * 工艺_产线新增
+     */
+    void add(CraftProductionLineDto craftProductionLineDto);
+
+    /**
+     * 工艺_产线编辑
+     */
+    void edit(CraftProductionLineDto craftProductionLineDto);
+
+    /**
+     * 工艺_产线删除
+     */
+    void delete(Long id);
+
+}

+ 57 - 0
sd-business/src/main/java/com/sd/business/service/craft/impl/CraftProductionLineProcessServiceImpl.java

@@ -0,0 +1,57 @@
+package com.sd.business.service.craft.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.craft.dto.CraftProductionLineProcessDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineProcessSelectDto;
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import com.sd.business.entity.craft.vo.CraftProductionLineProcessVo;
+import com.sd.business.mapper.craft.CraftProductionLineProcessMapper;
+import com.sd.business.service.craft.CraftProductionLineProcessService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 工艺_产线工序关联 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Service
+public class CraftProductionLineProcessServiceImpl extends ServiceImpl<CraftProductionLineProcessMapper, CraftProductionLineProcess> implements CraftProductionLineProcessService {
+
+    @Override
+    public Page<CraftProductionLineProcessVo> getPage(CraftProductionLineProcessSelectDto dto) {
+        IWrapper<CraftProductionLineProcess> wrapper = getWrapper();
+        wrapper.orderByDesc("cplp", CraftProductionLineProcess::getId);
+        Page<CraftProductionLineProcessVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public CraftProductionLineProcessVo detail(Long id) {
+        CraftProductionLineProcess CraftProductionLineProcess = this.getById(id);
+        CraftProductionLineProcessVo result = BeanUtil.toBean(CraftProductionLineProcess, CraftProductionLineProcessVo.class);
+        return result;
+    }
+
+    @Override
+    public void add(CraftProductionLineProcessDto craftProductionLineProcessDto) {
+        this.save(craftProductionLineProcessDto);
+    }
+
+    @Override
+    public void edit(CraftProductionLineProcessDto craftProductionLineProcessDto) {
+        this.updateById(craftProductionLineProcessDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 144 - 0
sd-business/src/main/java/com/sd/business/service/craft/impl/CraftProductionLineServiceImpl.java

@@ -0,0 +1,144 @@
+package com.sd.business.service.craft.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.BaseIdPo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.craft.dto.CraftProductionLineDto;
+import com.sd.business.entity.craft.dto.CraftProductionLineSelectDto;
+import com.sd.business.entity.craft.po.CraftProductionLine;
+import com.sd.business.entity.craft.po.CraftProductionLineProcess;
+import com.sd.business.entity.craft.vo.CraftProductionLineProcessVo;
+import com.sd.business.entity.craft.vo.CraftProductionLineVo;
+import com.sd.business.mapper.craft.CraftProductionLineMapper;
+import com.sd.business.service.craft.CraftProcessService;
+import com.sd.business.service.craft.CraftProductionLineProcessService;
+import com.sd.business.service.craft.CraftProductionLineService;
+import com.sd.framework.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 工艺_产线 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-26
+ */
+@Service
+public class CraftProductionLineServiceImpl extends ServiceImpl<CraftProductionLineMapper, CraftProductionLine> implements CraftProductionLineService {
+
+    @Autowired
+    private CraftProductionLineProcessService craftProductionLineProcessService;
+
+    @Autowired
+    private CraftProcessService craftProcessService;
+
+    @Override
+    public Page<CraftProductionLineVo> getPage(CraftProductionLineSelectDto dto) {
+        IWrapper<CraftProductionLine> wrapper = getWrapper();
+        wrapper.orderByDesc("cpl", CraftProductionLine::getId);
+        wrapper.like("cpl", CraftProductionLine::getCode, dto.getCode());
+        wrapper.like("cpl", CraftProductionLine::getName, dto.getName());
+        Page<CraftProductionLineVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<CraftProductionLineVo> records = page.getRecords();
+        if (records.size() == 0) {
+            return page;
+        }
+
+        // 获取产线明细
+        List<Long> craftProductionLineIdList = records.stream().map(BaseIdPo::getId).collect(Collectors.toList());
+        List<CraftProductionLineProcess> tempCraftProductionLineProcessList = craftProductionLineProcessService.list(q -> q
+                .in(CraftProductionLineProcess::getCraftProductionLineId, craftProductionLineIdList)
+                .orderByAsc(CraftProductionLineProcess::getSort)
+        );
+        List<CraftProductionLineProcessVo> craftProductionLineProcessList =
+                BeanUtil.copyToList(tempCraftProductionLineProcessList, CraftProductionLineProcessVo.class);
+
+        // 赋值工序名称
+        craftProcessService.attributeAssign(
+                craftProductionLineProcessList,
+                CraftProductionLineProcess::getCraftProcessId,
+                (item, craftProcess) -> item.setCraftProcessName(craftProcess.getName()));
+
+        // 赋值产线明细
+        Map<Long, List<CraftProductionLineProcessVo>> craftProductionLineProcessMap = craftProductionLineProcessList
+                .stream().collect(Collectors.groupingBy(CraftProductionLineProcess::getCraftProductionLineId));
+        records.forEach(item -> item.setCraftProductionLineProcessList(
+                craftProductionLineProcessMap.getOrDefault(item.getId(), Collections.emptyList())));
+
+        return page;
+    }
+
+    @Override
+    public CraftProductionLineVo detail(Long id) {
+        CraftProductionLine craftProductionLine = this.getById(id);
+        Assert.notNull(craftProductionLine, "未知产线");
+        CraftProductionLineVo result = BeanUtil.toBean(craftProductionLine, CraftProductionLineVo.class);
+
+        // 获取产线明细
+        List<CraftProductionLineProcess> tempCraftProductionLineProcessList = craftProductionLineProcessService.list(q -> q
+                .eq(CraftProductionLineProcess::getCraftProductionLineId, id)
+                .orderByAsc(CraftProductionLineProcess::getSort)
+        );
+        List<CraftProductionLineProcessVo> craftProductionLineProcessList =
+                BeanUtil.copyToList(tempCraftProductionLineProcessList, CraftProductionLineProcessVo.class);
+
+        // 赋值工序名称
+        craftProcessService.attributeAssign(
+                craftProductionLineProcessList,
+                CraftProductionLineProcess::getCraftProcessId,
+                (item, craftProcess) -> item.setCraftProcessName(craftProcess.getName()));
+
+        // 赋值产线明细
+        result.setCraftProductionLineProcessList(craftProductionLineProcessList);
+
+        return result;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void add(CraftProductionLineDto dto) {
+        this.save(dto);
+
+        List<CraftProductionLineProcess> craftProductionLineProcessList = dto.getCraftProductionLineProcessList();
+        for (int i = 0; i < craftProductionLineProcessList.size(); i++) {
+            CraftProductionLineProcess craftProductionLineProcess = craftProductionLineProcessList.get(i);
+            craftProductionLineProcess.setCraftProductionLineId(dto.getId());
+            craftProductionLineProcess.setSort(i + 1);
+        }
+        craftProductionLineProcessService.saveBatch(craftProductionLineProcessList);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(CraftProductionLineDto dto) {
+        this.updateById(dto);
+
+        List<CraftProductionLineProcess> craftProductionLineProcessList = dto.getCraftProductionLineProcessList();
+        for (int i = 0; i < craftProductionLineProcessList.size(); i++) {
+            CraftProductionLineProcess craftProductionLineProcess = craftProductionLineProcessList.get(i);
+            craftProductionLineProcess.setCraftProductionLineId(dto.getId());
+            craftProductionLineProcess.setSort(i + 1);
+        }
+        craftProductionLineProcessService.editLinked(craftProductionLineProcessList,
+                CraftProductionLineProcess::getCraftProductionLineId, dto.getId());
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+        craftProductionLineProcessService.remove(q -> q.eq(CraftProductionLineProcess::getCraftProductionLineId, id));
+    }
+
+}

+ 2 - 1
sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.service.BaseService;
 import com.sd.business.entity.inventory.bo.InOutFun;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
+import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
 import com.sd.business.entity.inventory.po.Inventory;
 import com.sd.business.entity.inventory.vo.InventoryVo;
 import com.sd.business.entity.inventory.vo.QuantityByDepartmentVo;
@@ -30,7 +31,7 @@ public interface InventoryService extends BaseService<Inventory> {
     /**
      * 根据仓库获取库存数量
      */
-    List<QuantityByWarehouseVo> getQuantityByWarehouse();
+    List<QuantityByWarehouseVo> getQuantityByWarehouse(QuantityByWarehouseDto dto);
 
     /**
      * 根据事业部获取库存数量

+ 9 - 7
sd-business/src/main/java/com/sd/business/service/order/impl/OrderServiceImpl.java

@@ -111,10 +111,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
         List<OrderSkuVo> orderSkuList = BeanUtil.copyToList(tempOrderSkuList, OrderSkuVo.class);
         skuSpecService.attributeAssign(orderSkuList, OrderSkuVo::getSkuSpecId, (item, skuSpec) -> {
             item.setBomSpecId(skuSpec.getBomSpecId());
+            item.setName(skuSpec.getName());
+            item.setCode(skuSpec.getCode());
         });
         bomSpecService.attributeAssign(orderSkuList, OrderSkuVo::getBomSpecId, (item, bomSpec) -> {
-            item.setName(bomSpec.getName());
-            item.setCode(bomSpec.getCode());
+            item.setBomName(bomSpec.getName());
+            item.setBomCode(bomSpec.getCode());
         });
         result.setOrderSkuList(orderSkuList);
 
@@ -240,19 +242,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
             String chargeItem = priceBillingStandardDetail.getChargeItem();
             BigDecimal chargePrice = ObjectUtil.defaultIfNull(priceBillingStandardDetail.getChargePrice(), BigDecimal.ZERO);
             switch (chargeItem) {
-                case "3":
+                case "40":
                     skuSpecPriceVo.setPackingLabor(chargePrice);
                     break;
-                case "4":
+                case "50":
                     skuSpecPriceVo.setLssueFee(chargePrice);
                     break;
-                case "5":
+                case "60":
                     skuSpecPriceVo.setDeliveryMaterialsFee(chargePrice);
                     break;
                 default:
                     if (Objects.equals(chargeItem, skuSpec.getMachinedPanel())
-                            && priceBillingStandardDetail.getSectionMin().compareTo(dto.getQuantity()) >= 0
-                            && priceBillingStandardDetail.getSectionMax().compareTo(dto.getQuantity()) < 0) {
+                            && dto.getQuantity().compareTo(priceBillingStandardDetail.getSectionMin()) >= 0
+                            && dto.getQuantity().compareTo(priceBillingStandardDetail.getSectionMax()) < 0) {
                         skuSpecPriceVo.setCustomProcessingFee(chargePrice);
                     }
             }

+ 18 - 0
sd-business/src/main/resources/mapper/craft/CraftProductionLineMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sd.business.mapper.craft.CraftProductionLineMapper">
+    <select id="getPage" resultType="com.sd.business.entity.craft.vo.CraftProductionLineVo">
+        select cpl.id,
+               cpl.code,
+               cpl.name,
+               cpl.batch_mode,
+               cpl.remark,
+               cpl.create_user,
+               cpl.create_time,
+               cpl.update_user,
+               cpl.update_time
+        from craft_production_line cpl
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 21 - 0
sd-business/src/main/resources/mapper/craft/CraftProductionLineProcessMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sd.business.mapper.craft.CraftProductionLineProcessMapper">
+    <select id="getPage" resultType="com.sd.business.entity.craft.vo.CraftProductionLineProcessVo">
+        select cplp.id,
+               cplp.craft_production_line_id,
+               cplp.craft_process_id,
+               cplp.sort,
+               cplp.equipment_id,
+               cplp.rfid_ip,
+               cplp.rfid_passage,
+               cplp.interface_address,
+               cplp.create_user,
+               cplp.create_time,
+               cplp.update_user,
+               cplp.update_time
+        from craft_production_line_process cplp
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 8 - 3
sd-business/src/main/resources/mapper/inventory/InventoryMapper.xml

@@ -23,10 +23,15 @@
 
     <select id="getQuantityByWarehouse" resultType="com.sd.business.entity.inventory.vo.QuantityByWarehouseVo">
         select sum(ifnull(i.quantity, 0)) inventoryQuantity,
-               w.id                       warehouseId,
-               w.name                     warehouseName
+        w.id warehouseId,
+        w.name warehouseName
         from inventory i
-                 left join warehouse w on i.warehouse_id = w.id
+        left join warehouse w on i.warehouse_id = w.id
+        <where>
+            <if test="departmentId neq null">
+                i.department_id = #{departmentId}
+            </if>
+        </where>
         group by w.id
         order by w.id
     </select>

+ 5 - 3
sd-business/src/main/resources/mapper/sku/SkuSpecMapper.xml

@@ -24,15 +24,17 @@
     </select>
 
     <select id="getBomBoList" resultType="com.sd.business.entity.bom.bo.BomBo">
-        SELECT ss.id skuSpecId,
+        SELECT ss.id        skuSpecId,
                ss.machined_panel,
-               bs.id bomSpecId,
+               bs.id        bomSpecId,
                bs.internal_selling_price,
                bs.external_selling_price,
-               b.id  bomId
+               b.id         bomId,
+               bc.parent_id classifyParentId
         FROM sku_spec ss
                  INNER JOIN bom_spec bs ON ss.bom_spec_id = bs.id
                  INNER JOIN bom b ON bs.bom_id = b.id
+                 LEFT JOIN bom_classify bc on b.bom_classify_id = bc.id
             ${ew.customSqlSegment}
     </select>
 

+ 186 - 0
sd-starter/src/test/java/SyncSkuBootTest.java

@@ -0,0 +1,186 @@
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
+import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.fjhx.file.entity.FileInfo;
+import com.fjhx.file.service.FileInfoService;
+import com.obs.services.ObsClient;
+import com.ruoyi.common.constant.BaseSourceConstant;
+import com.ruoyi.common.core.domain.BaseIdPo;
+import com.sd.SdApplication;
+import com.sd.business.entity.bom.po.BomSpec;
+import com.sd.business.entity.sku.po.SkuSpec;
+import com.sd.business.service.bom.BomSpecService;
+import com.sd.business.service.sku.SkuSpecService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.sql.DataSource;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = SdApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
+public class SyncSkuBootTest {
+    private static final Map<String, Long> classifyIdMap = new HashMap<>();
+    private static final String oldUrlPrefix = "http://www.printmat.cn:8181/file/";
+
+    static {
+        classifyIdMap.put("1001", 1682221249268375554L);
+        classifyIdMap.put("1002", 1682221303530086402L);
+        classifyIdMap.put("1003", 1681220168933445634L);
+        classifyIdMap.put("1004", 1682221651040755714L);
+        classifyIdMap.put("1005", 1682221201491058690L);
+        classifyIdMap.put("1006", 1682221712801882114L);
+        classifyIdMap.put("1008", 1682221581453058049L);
+        classifyIdMap.put("1009", 1682221453145104386L);
+        classifyIdMap.put("1010", 1682221356147630081L);
+        classifyIdMap.put("1011", 1682221409847304194L);
+        classifyIdMap.put("1609478435019689985", 1682221078014943234L);
+        classifyIdMap.put("1609485052385693697", 1682221128782798850L);
+        classifyIdMap.put("1615229747095150593", 1682221528948760578L);
+        classifyIdMap.put("1636175301891383297", 1682221760906354690L);
+        classifyIdMap.put("1636175375388172289", 1682221804409675778L);
+    }
+
+    @Value("${obs.ak}")
+    private String ak;
+    @Value("${obs.sk}")
+    private String sk;
+    @Value("${obs.endPoint}")
+    private String endPoint;
+    @Value("${obs.url}")
+    private String url;
+    @Value("${obs.bucketName}")
+    private String bucketName;
+    @Value("${spring.profiles.active}")
+    private String active;
+    @Value("${ruoyi.name}")
+    private String name;
+
+    @Autowired
+    private DataSource dataSource;
+    @Autowired
+    private FileInfoService fileInfoService;
+    @Autowired
+    private SkuSpecService skuSpecService;
+    @Autowired
+    private BomSpecService bomSpecService;
+
+    @DSTransactional
+    @Test
+    public void test() {
+        DynamicRoutingDataSource dynamicRoutingDataSource = (DynamicRoutingDataSource) dataSource;
+        DataSource sdDataSource = dynamicRoutingDataSource.getDataSource("business");
+
+        Map<String, Long> bomSpecIdMap = bomSpecService.mapKV(BomSpec::getOldId, BaseIdPo::getId, null);
+
+        Map<String, Long> stringLongMap = skuSpecService.mapKV(SkuSpec::getCode, BaseIdPo::getId, null);
+
+        String sql = "SELECT\n" +
+                "\tp.spec_code code,\n" +
+                "\tp.weight netWeight,\n" +
+                "\tp.length length,\n" +
+                "\tp.width width,\n" +
+                "\tp.height height,\n" +
+                "\tp.processing_layout machinedPanel,\n" +
+                "\ts.bom_color_id bomSpecId\n" +
+                "FROM\n" +
+                "\tt_sd_product_color p\n" +
+                "\tLEFT JOIN t_sd_product_color_bom s on p.id = s.product_color_id";
+
+        List<Map<String, Object>> list = new JdbcTemplate(sdDataSource).queryForList(sql);
+
+        for (Map<String, Object> map : list) {
+            Object bomSpecIdObj = map.get("bomSpecId");
+            if (bomSpecIdObj == null) {
+                continue;
+            }
+            String bomSpecId = bomSpecIdObj.toString();
+            if (StrUtil.isBlank(bomSpecId)) {
+                continue;
+            }
+            map.put("bomSpecId", bomSpecIdMap.get(bomSpecId));
+        }
+        List<SkuSpec> skuSpecList = BeanUtil.copyToList(list, SkuSpec.class);
+
+
+        for (SkuSpec skuSpec : skuSpecList) {
+            String code = skuSpec.getCode();
+            Long id = stringLongMap.get(code);
+            skuSpec.setId(id);
+        }
+
+        skuSpecList = skuSpecList.stream().filter(item -> ObjectUtil.isNotNull(item.getId())).collect(Collectors.toList());
+
+        skuSpecService.updateBatchById(skuSpecList);
+
+        System.out.println();
+    }
+
+    private String uploadFile(String fileUrl, Long businessId) {
+        if (StrUtil.isBlank(fileUrl)) {
+            return StringPool.EMPTY;
+        }
+
+        String objectKey = getFileName(fileUrl);
+        byte[] bytes = HttpUtil.downloadBytes(oldUrlPrefix + fileUrl);
+        InputStream inputStream = new ByteArrayInputStream(bytes);
+        getObsClient().putObject(bucketName, objectKey, inputStream);
+
+        FileInfo fileInfo = new FileInfo();
+        fileInfo.setFileUrl(objectKey);
+        fileInfo.setFileName(FileUtil.getName(fileUrl));
+        fileInfo.setBusinessId(businessId);
+        fileInfo.setBusinessType(0);
+        fileInfoService.save(fileInfo);
+        return url + objectKey;
+    }
+
+    private void removeFile(List<Long> businessIdList) {
+        if (ObjectUtil.isEmpty(businessIdList)) {
+            return;
+        }
+        DynamicDataSourceContextHolder.push(BaseSourceConstant.BASE);
+        List<FileInfo> fileInfoList = fileInfoService.list(q -> q.in(FileInfo::getBusinessId, businessIdList));
+        if (fileInfoList.size() == 0) {
+            DynamicDataSourceContextHolder.poll();
+            return;
+        }
+        fileInfoList.forEach(item -> {
+            getObsClient().deleteObject(bucketName, item.getFileUrl());
+            fileInfoService.removeById(item.getId());
+        });
+        DynamicDataSourceContextHolder.poll();
+    }
+
+    private String getFileName(String fileUrl) {
+        String fileName = FileUtil.getName(fileUrl);
+        String suffix = FileUtil.getSuffix(fileName);
+        return new StringJoiner("/")
+                .add(name)
+                .add(active)
+                .add(DateUtil.format(new Date(), "yyyy/MM/dd"))
+                .add(IdUtil.fastSimpleUUID() + (ObjectUtil.isEmpty(suffix) ? "" : "." + suffix))
+                .toString();
+    }
+
+    private ObsClient getObsClient() {
+        return new ObsClient(ak, sk, endPoint);
+    }
+
+}

+ 18 - 6
sd-wln/src/main/java/com/sd/wln/service/impl/WlnOrderServiceImpl.java

@@ -424,7 +424,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
                 assignedPackagingMaterialCost(orderSku, saveOrderSkuBomList);
 
                 // 赋值其他价格
-                assignedOtherPrice(orderSku, orderInfo.getDepartmentId(),
+                assignedOtherPrice(orderSku, orderInfo.getDepartmentId(), bomBoMap,
                         departmentIdPriceBillingStandardIdMap, priceBillingStandardMap, skuSpecMap);
 
                 // 添加订单金额
@@ -463,6 +463,7 @@ public class WlnOrderServiceImpl implements WlnOrderService {
      */
     private void assignedOtherPrice(OrderSku orderSku,
                                     Long departmentId,
+                                    Map<Long, BomBo> bomBoMap,
                                     Map<Long, Long> departmentIdPriceBillingStandardIdMap,
                                     Map<Long, List<PriceBillingStandardDetail>> priceBillingStandardMap,
                                     Map<String, SkuSpec> skuSpecMap) {
@@ -472,6 +473,17 @@ public class WlnOrderServiceImpl implements WlnOrderService {
         orderSku.setDeliveryMaterialsFee(BigDecimal.ZERO);
         orderSku.setPackingLabor(BigDecimal.ZERO);
 
+        // 没绑定bom规格,不赋值价格
+        BomBo bomBo = bomBoMap.get(orderSku.getSkuSpecId());
+        if (bomBo == null) {
+            return;
+        }
+
+        // 如果bom规格不为主材,不赋值价格
+        if (ObjectUtil.notEqual(bomBo.getClassifyParentId(), 1L)) {
+            return;
+        }
+
         // 获取加工计费标准id
         Long priceBillingStandardId = departmentIdPriceBillingStandardIdMap.get(departmentId);
         if (priceBillingStandardId == null) {
@@ -490,21 +502,21 @@ public class WlnOrderServiceImpl implements WlnOrderService {
             BigDecimal chargePrice = ObjectUtil.defaultIfNull(priceBillingStandardDetail.getChargePrice(), BigDecimal.ZERO);
 
             switch (chargeItem) {
-                case "3":
+                case "40":
                     orderSku.setPackingLabor(chargePrice);
                     break;
-                case "4":
+                case "50":
                     orderSku.setLssueFee(chargePrice);
                     break;
-                case "5":
+                case "60":
                     orderSku.setDeliveryMaterialsFee(chargePrice);
                     break;
                 default:
                     SkuSpec skuSpec = skuSpecMap.get(orderSku.getWlnSkuSpecId());
                     if (skuSpec != null
                             && Objects.equals(chargeItem, skuSpec.getMachinedPanel())
-                            && priceBillingStandardDetail.getSectionMin().compareTo(orderSku.getQuantity()) >= 0
-                            && priceBillingStandardDetail.getSectionMax().compareTo(orderSku.getQuantity()) < 0) {
+                            && orderSku.getQuantity().compareTo(priceBillingStandardDetail.getSectionMin()) >= 0
+                            && orderSku.getQuantity().compareTo(priceBillingStandardDetail.getSectionMax()) < 0) {
                         orderSku.setCustomProcessingFee(chargePrice);
                     }
             }