Commit b69ebef8045109d799290003ee5df40b1b841cf9

Authored by huhai
2 parents 068795cc e4b78a2b

Merge remote-tracking branch 'origin/develop' into develop

Showing 262 changed files with 8193 additions and 2336 deletions

Too many changes to show.

To preserve performance only 88 of 262 files are displayed.

.idea/workspace.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <project version="4">
3 3 <component name="ChangeListManager">
4   - <list default="true" id="baeae966-16bb-4f97-a411-22fe5a65cefd" name="Default Changelist" comment="修改入库首选项页面,规则">
  4 + <list default="true" id="baeae966-16bb-4f97-a411-22fe5a65cefd" name="Default Changelist" comment="">
5 5 <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/FilterConfigHeader/controller/FilterConfigHeaderController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/FilterConfigHeader/controller/FilterConfigHeaderController.java" afterDir="false" />
7   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/mapper/ContainerMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/mapper/ContainerMapper.java" afterDir="false" />
8   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/service/ContainerService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/service/ContainerService.java" afterDir="false" />
9   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java" afterDir="false" />
10   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/material/controller/MaterialController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/material/controller/MaterialController.java" afterDir="false" />
11   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java" afterDir="false" />
12   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java" afterDir="false" />
13   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java" afterDir="false" />
14   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java" afterDir="false" />
15   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiving/controller/ReceivingController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiving/controller/ReceivingController.java" afterDir="false" />
16   - <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java" afterDir="false" />
17   - <change beforePath="$PROJECT_DIR$/src/main/resources/mybatis/config/ContainerMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mybatis/config/ContainerMapper.xml" afterDir="false" />
  6 + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java" afterDir="false" />
  7 + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java" afterDir="false" />
  8 + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java" afterDir="false" />
18 9 <change beforePath="$PROJECT_DIR$/src/main/resources/templates/config/filterConfigHeader/add.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/config/filterConfigHeader/add.html" afterDir="false" />
19   - <change beforePath="$PROJECT_DIR$/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/config/filterConfigHeader/filterConfigHeader.html" afterDir="false" />
20   - <change beforePath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiptHeader/edit.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiptHeader/edit.html" afterDir="false" />
  10 + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/config/receiptType/add.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/config/receiptType/add.html" afterDir="false" />
  11 + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/config/statusFlowHeader/add.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/config/statusFlowHeader/add.html" afterDir="false" />
  12 + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html" afterDir="false" />
21 13 <change beforePath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html" afterDir="false" />
22   - <change beforePath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiving/receiving.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/receipt/receiving/receiving.html" afterDir="false" />
23 14 </list>
24 15 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
25 16 <option name="SHOW_DIALOG" value="false" />
... ... @@ -167,7 +158,17 @@
167 158 <serviceView>
168 159 <option name="contentProportion" value="0.1612554" />
169 160 <treeState>
170   - <expand />
  161 + <expand>
  162 + <path>
  163 + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
  164 + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@c531c3e8" type="7427dc5b:ServiceModel$ServiceGroupNode" />
  165 + </path>
  166 + <path>
  167 + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" />
  168 + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@c531c3e8" type="7427dc5b:ServiceModel$ServiceGroupNode" />
  169 + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@ef9dc71e" type="7427dc5b:ServiceModel$ServiceGroupNode" />
  170 + </path>
  171 + </expand>
171 172 <select />
172 173 </treeState>
173 174 </serviceView>
... ... @@ -270,7 +271,7 @@
270 271 <workItem from="1569745589865" duration="2739000" />
271 272 <workItem from="1569748443357" duration="438000" />
272 273 <workItem from="1569803438585" duration="13789000" />
273   - <workItem from="1570581146682" duration="827000" />
  274 + <workItem from="1570581146682" duration="9295000" />
274 275 </task>
275 276 <task id="LOCAL-00001" summary="修改添加物料时使用物料类别生成物料编码">
276 277 <created>1567664306836</created>
... ... @@ -503,7 +504,14 @@
503 504 <option name="project" value="LOCAL" />
504 505 <updated>1569743042718</updated>
505 506 </task>
506   - <option name="localTasksCounter" value="34" />
  507 + <task id="LOCAL-00034" summary="添加根据容器编码查找容器的方法&#10;配置规则添加自动添加模块类型&#10;添加是否自动生成临时容器">
  508 + <created>1570582333467</created>
  509 + <option name="number" value="00034" />
  510 + <option name="presentableId" value="LOCAL-00034" />
  511 + <option name="project" value="LOCAL" />
  512 + <updated>1570582333467</updated>
  513 + </task>
  514 + <option name="localTasksCounter" value="35" />
507 515 <servers />
508 516 </component>
509 517 <component name="TypeScriptGeneratedFilesManager">
... ... @@ -524,7 +532,6 @@
524 532 </component>
525 533 <component name="VcsManagerConfiguration">
526 534 <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
527   - <MESSAGE value="修改入库类型自动判断" />
528 535 <MESSAGE value="修改入库单页面" />
529 536 <MESSAGE value="修改入库单页面,入库单审核,质检页面后台跳转接口" />
530 537 <MESSAGE value="修改 入库收货,生成上架任务自动执行定位" />
... ... @@ -549,7 +556,8 @@
549 556 <MESSAGE value="修改容器新增时容器enable状态" />
550 557 <MESSAGE value="修改入库组盘页面中任务类型的显示问题&#10;修改任务完成不修改入库组盘状态的问题" />
551 558 <MESSAGE value="添加根据code查询物料" />
552   - <option name="LAST_COMMIT_MESSAGE" value="添加根据code查询物料" />
  559 + <MESSAGE value="添加根据容器编码查找容器的方法&#10;配置规则添加自动添加模块类型&#10;添加是否自动生成临时容器" />
  560 + <option name="LAST_COMMIT_MESSAGE" value="添加根据容器编码查找容器的方法&#10;配置规则添加自动添加模块类型&#10;添加是否自动生成临时容器" />
553 561 </component>
554 562 <component name="XDebuggerManager">
555 563 <breakpoint-manager>
... ... @@ -566,12 +574,12 @@
566 574 </line-breakpoint>
567 575 <line-breakpoint enabled="true" type="java-line">
568 576 <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java</url>
569   - <line>172</line>
  577 + <line>174</line>
570 578 <option name="timeStamp" value="28" />
571 579 </line-breakpoint>
572 580 <line-breakpoint enabled="true" type="java-line">
573 581 <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java</url>
574   - <line>618</line>
  582 + <line>631</line>
575 583 <option name="timeStamp" value="48" />
576 584 </line-breakpoint>
577 585 <line-breakpoint enabled="true" type="java-line">
... ... @@ -584,6 +592,16 @@
584 592 <line>84</line>
585 593 <option name="timeStamp" value="51" />
586 594 </line-breakpoint>
  595 + <line-breakpoint enabled="true" type="java-line">
  596 + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java</url>
  597 + <line>86</line>
  598 + <option name="timeStamp" value="57" />
  599 + </line-breakpoint>
  600 + <line-breakpoint enabled="true" type="java-line">
  601 + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java</url>
  602 + <line>145</line>
  603 + <option name="timeStamp" value="62" />
  604 + </line-breakpoint>
587 605 <line-breakpoint enabled="true" type="javascript">
588 606 <url>file://$PROJECT_DIR$/src/main/resources/templates/check/checkingRegister/checkingRegister.html</url>
589 607 <line>308</line>
... ...
src/main/java/com/huaheng/api/general/controller/ReceiptController.java 0 → 100644
  1 +package com.huaheng.api.general.controller;
  2 +
  3 +import com.huaheng.api.general.domain.Receipt;
  4 +import com.huaheng.api.general.service.ReceiptService;
  5 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  6 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  7 +import com.huaheng.framework.web.domain.AjaxResult;
  8 +import io.swagger.annotations.Api;
  9 +import io.swagger.annotations.ApiOperation;
  10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +import javax.annotation.Resource;
  13 +
  14 +/**
  15 + * Created by Enzo Cotter on 2019/11/4.
  16 + * @author mahuandong
  17 + */
  18 +@RestController
  19 +@RequestMapping("/api/receipt")
  20 +@Api(tags = {"basicData"}, description = "入库接口")
  21 +public class ReceiptController {
  22 +
  23 + @Resource
  24 + private ReceiptService receiptService;
  25 +
  26 + /**
  27 + * 入库单下发
  28 + */
  29 + @Log(title = "入库单下发", action = BusinessType.INSERT)
  30 + @PostMapping("/insertReceipt")
  31 + @ApiOperation("入库单下发接口")
  32 + @ResponseBody
  33 + public AjaxResult MaterialApi(@RequestBody Receipt receipt) {
  34 + System.out.println("————————开始接收入库单——————————");
  35 + System.out.println(receipt);
  36 + AjaxResult ajaxResult = receiptService.insertReceipt(receipt);
  37 + return ajaxResult;
  38 + }
  39 +
  40 +}
... ...
src/main/java/com/huaheng/api/general/domain/Receipt.java 0 → 100644
  1 +package com.huaheng.api.general.domain;
  2 +
  3 +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
  4 +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
  5 +import lombok.Data;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * Created by Enzo Cotter on 2019/11/4.
  11 + * @author mahuandong
  12 + */
  13 +@Data
  14 +public class Receipt {
  15 +
  16 + private ReceiptHeader receiptHeader;
  17 +
  18 + private List<ReceiptDetail> receiptDetails;
  19 +}
... ...
src/main/java/com/huaheng/api/general/service/ReceiptService.java 0 → 100644
  1 +package com.huaheng.api.general.service;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.api.general.domain.Receipt;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
  10 +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService;
  11 +import com.huaheng.pc.config.company.domain.Company;
  12 +import com.huaheng.pc.config.company.service.CompanyService;
  13 +import com.huaheng.pc.config.material.domain.Material;
  14 +import com.huaheng.pc.config.material.service.MaterialService;
  15 +import com.huaheng.pc.config.receiptType.domain.ReceiptType;
  16 +import com.huaheng.pc.config.receiptType.service.ReceiptTypeService;
  17 +import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader;
  18 +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService;
  19 +import com.huaheng.pc.config.supplier.domain.Supplier;
  20 +import com.huaheng.pc.config.supplier.service.SupplierService;
  21 +import com.huaheng.pc.config.warehouse.domain.Warehouse;
  22 +import com.huaheng.pc.config.warehouse.service.WarehouseService;
  23 +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail;
  24 +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService;
  25 +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
  26 +import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService;
  27 +import org.springframework.stereotype.Component;
  28 +import org.springframework.transaction.annotation.Transactional;
  29 +
  30 +import javax.annotation.Resource;
  31 +import java.math.BigDecimal;
  32 +import java.util.List;
  33 +
  34 +/**
  35 + * Created by Enzo Cotter on 2019/11/4.
  36 + * @author mahuandong
  37 + */
  38 +@Component
  39 +@Transactional(rollbackFor = Exception.class)
  40 +public class ReceiptService {
  41 +
  42 + @Resource
  43 + private ReceiptHeaderService receiptHeaderService;
  44 + @Resource
  45 + private ReceiptDetailService receiptDetailService;
  46 + @Resource
  47 + private ReceiptTypeService receiptTypeService;
  48 + @Resource
  49 + private WarehouseService warehouseService;
  50 + @Resource
  51 + private CompanyService companyService;
  52 + @Resource
  53 + private MaterialService materialService;
  54 + @Resource
  55 + private SupplierService supplierService;
  56 + @Resource
  57 + private FilterConfigDetailService filterConfigDetailService;
  58 + @Resource
  59 + private StatusFlowHeaderService statusFlowHeaderService;
  60 + /**
  61 + * 入库单下发
  62 + * @param receipt 入库单
  63 + * @return 是否下发成功
  64 + */
  65 + @Transactional(rollbackFor = Exception.class)
  66 + public AjaxResult insertReceipt(Receipt receipt){
  67 +
  68 + /* 0.step 获取入库头表,获取入库明细*/
  69 + ReceiptHeader receiptHeader = receipt.getReceiptHeader();
  70 + List<ReceiptDetail> receiptDetails = receipt.getReceiptDetails();
  71 + /* 1.step 校验入库单是否为空*/
  72 + if (receiptHeader == null || receiptDetails.isEmpty()){
  73 + throw new ServiceException("入库主单或入库子单为空");
  74 + }
  75 + /* 2.step 检查入库头表合法性*/
  76 + AjaxResult checkReceiptHeaderResult = checkReceiptHeader(receiptHeader);
  77 + if (checkReceiptHeaderResult.hasErr() ){
  78 + return AjaxResult.error(checkReceiptHeaderResult.getMsg());
  79 + }
  80 +
  81 + /* 3.step 检查入库明细合法性*/
  82 + AjaxResult checkReceiptDetailResult = checkReceiptDetail(receiptDetails);
  83 + if (checkReceiptDetailResult.hasErr() ){
  84 + return AjaxResult.error(checkReceiptDetailResult.getMsg());
  85 + }
  86 +
  87 + /* 4.step 计算入库明细总行数、总数量*/
  88 + BigDecimal totalQty = new BigDecimal(0);
  89 + for (ReceiptDetail receiptDetail: receiptDetails) {
  90 + totalQty.add(receiptDetail.getTotalQty());
  91 + }
  92 + receiptHeader.setTotalLines(receiptDetails.size());
  93 + receiptHeader.setTotalQty(totalQty);
  94 +
  95 + /* 5.step 保存的入库头表*/
  96 + if (!receiptHeaderService.save(receiptHeader)){
  97 + throw new ServiceException("保存入库头表失败");
  98 + }
  99 +
  100 + /* 6.step 保存入库明细*/
  101 + LambdaQueryWrapper<ReceiptHeader> lambda = Wrappers.lambdaQuery();
  102 + lambda.eq(ReceiptHeader::getWarehouseCode, receiptHeader.getWarehouseCode())
  103 + .eq(ReceiptHeader::getCode, receiptHeader.getCode());
  104 + receiptHeader = receiptHeaderService.getOne(lambda);
  105 + for (ReceiptDetail receiptDetail : receiptDetails) {
  106 + receiptDetail.setReceiptId(receiptHeader.getId());
  107 + receiptDetail.setReceiptCode(receiptHeader.getCode());
  108 + receiptDetail.setWarehouseCode(receiptHeader.getWarehouseCode());
  109 + receiptDetail.setCompanyCode(receiptHeader.getWarehouseCode());
  110 + Material material = materialService.findAllByCode(receiptDetail.getMaterialCode());
  111 + receiptDetail.setMaterialName(material.getName());
  112 + receiptDetail.setMaterialSpec(material.getSpec());
  113 + receiptDetail.setMaterialUnit(material.getUnit());
  114 + if (!receiptDetailService.save(receiptDetail)){
  115 + throw new ServiceException("保存入库明细失败");
  116 + }
  117 + }
  118 +
  119 + return AjaxResult.success("成功");
  120 + }
  121 +
  122 + /**
  123 + * 检查入库头表合法性
  124 + * @param receiptHeader 入库头表
  125 + * @return 检查结果
  126 + */
  127 + private AjaxResult checkReceiptHeader(ReceiptHeader receiptHeader){
  128 + /* 0.step 必填项是否为空*/
  129 + if (StringUtils.isEmpty(receiptHeader.getCode()) || StringUtils.isEmpty(receiptHeader.getCompanyCode()) ||
  130 + StringUtils.isEmpty(receiptHeader.getWarehouseCode()) || StringUtils.isEmpty(receiptHeader.getReceiptType())){
  131 + return AjaxResult.error("入库主单字段有误");
  132 + }
  133 +
  134 + /* 1.step 查询该单据编码是否已存在*/
  135 + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambda = Wrappers.lambdaQuery(receiptHeader);
  136 + if (receiptHeaderService.getOne(receiptHeaderLambda) != null){
  137 + return AjaxResult.error("该单据已存在:"+receiptHeader.getCode());
  138 + }
  139 +
  140 + /* 2.step 判断入库类型是否匹配*/
  141 + LambdaQueryWrapper<ReceiptType> receiptTypeLambda = Wrappers.lambdaQuery();
  142 + receiptTypeLambda.eq(ReceiptType::getCode, receiptHeader.getReceiptType());
  143 + if (receiptTypeService.getOne(receiptTypeLambda) == null){
  144 + return AjaxResult.error("没有对应的入库单类型");
  145 + }
  146 +
  147 + /* 3.step 判断仓库是否存在*/
  148 + LambdaQueryWrapper<Warehouse> warehouseLambda = Wrappers.lambdaQuery();
  149 + warehouseLambda.eq(Warehouse::getCode, receiptHeader.getWarehouseCode());
  150 + if (warehouseService.getOne(warehouseLambda) == null){
  151 + return AjaxResult.error("该仓库不存在");
  152 + }
  153 +
  154 + /* 4.step 判断货主是否存在*/
  155 + LambdaQueryWrapper<Company> companyLambda = Wrappers.lambdaQuery();
  156 + companyLambda.eq(Company::getCode, receiptHeader.getCompanyCode());
  157 + if (companyService.getOne(companyLambda) == null){
  158 + return AjaxResult.error("该货主不存在");
  159 + }
  160 +
  161 + return AjaxResult.success("");
  162 + }
  163 +
  164 + /**
  165 + * 检查入库明细合法性
  166 + * @param receiptDetails 入库明细
  167 + * @return 检查结果
  168 + */
  169 + private AjaxResult checkReceiptDetail(List<ReceiptDetail> receiptDetails){
  170 +
  171 + for (ReceiptDetail receiptDetail: receiptDetails) {
  172 + /* 0.step 判断必填字段是否为空且总数量不能为0*/
  173 + if (receiptDetail.getMaterialCode() == null ||
  174 + new BigDecimal(0).compareTo(receiptDetail.getTotalQty() != null ?
  175 + receiptDetail.getTotalQty() : new BigDecimal(0)) == 0 ){
  176 + return AjaxResult.error("入库明细字段有误");
  177 + }
  178 +
  179 + /* 1.step 判断供应商是否存在*/
  180 + if (receiptDetail.getSupplierCode() != null){
  181 + LambdaQueryWrapper<Supplier> supplierLambda = Wrappers.lambdaQuery();
  182 + supplierLambda.eq(Supplier::getCode, receiptDetail.getSupplierCode());
  183 + if (supplierService.getOne(supplierLambda) == null) {
  184 + return AjaxResult.error("供应商不存在");
  185 + }
  186 + }
  187 +
  188 + /* 2.step 判断定位规则是否存在*/
  189 + if (receiptDetail.getLocatingRule() != null){
  190 + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery();
  191 + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, receiptDetail.getLocatingRule())
  192 + .eq(FilterConfigDetail::getModuleType, "receipt")
  193 + .eq(FilterConfigDetail::getRecordType, "locationRule");
  194 + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda);
  195 + if (filterConfigDetail == null){
  196 + return AjaxResult.error(receiptDetail.getLocatingRule()+"定位规则不存在");
  197 + }
  198 + }
  199 +
  200 + /* 3.step 判断流程编码是否存在*/
  201 + if (receiptDetail.getStatusFlowCode() != null){
  202 + LambdaQueryWrapper<StatusFlowHeader> statusFlowHeaderLambda = Wrappers.lambdaQuery();
  203 + statusFlowHeaderLambda.eq(StatusFlowHeader::getCode, receiptDetail.getStatusFlowCode())
  204 + .eq(StatusFlowHeader::getModuleType, "receipt")
  205 + .eq(StatusFlowHeader::getRecordType, "receivingFlow");
  206 + StatusFlowHeader statusFlowHeader = statusFlowHeaderService.getOne(statusFlowHeaderLambda);
  207 + if (statusFlowHeader == null){
  208 + return AjaxResult.error(receiptDetail.getLocatingRule()+"该流程不存在");
  209 + }
  210 + }
  211 + }
  212 +
  213 + return AjaxResult.success("");
  214 + }
  215 +
  216 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
  5 +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**空出处理接口
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/api/WCS/v2")
  25 +public class EmptyOutHandle extends BaseController {
  26 +
  27 + @Resource
  28 + private EmptyOutHandleService emptyOutHandleService;
  29 +
  30 + @Log(title = "wcs空出处理", action = BusinessType.INSERT)
  31 + @PostMapping("/EmptyOutHandle")
  32 + @ApiOperation("wcs空出处理")
  33 + @ResponseBody
  34 + public AjaxResult EmptyOutHandle(@RequestBody WcsTask wcsTask)
  35 + {
  36 + AjaxResult ajaxResult =emptyOutHandleService.EmptyOutHandle(wcsTask) ;
  37 + return ajaxResult;
  38 + }
  39 +
  40 +
  41 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  4 +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
  5 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  6 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  7 +import com.huaheng.framework.web.controller.BaseController;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.springframework.web.bind.annotation.*;
  12 +
  13 +import javax.annotation.Resource;
  14 +
  15 +/**重入处理接口
  16 + * wcs向wms传递数据
  17 + * @author ricard
  18 + * @date 2019/10/11
  19 + *
  20 + */
  21 +
  22 +@RestController
  23 +@RequestMapping("/api/WCS/v2")
  24 +public class OverrideHandle extends BaseController {
  25 +
  26 + @Resource
  27 + private OverrideHandleService overrideHandleService;
  28 +
  29 + @Log(title = "wcs重入处理", action = BusinessType.INSERT)
  30 + @PostMapping("/OverrideHandle")
  31 + @ApiOperation("wcs重入处理")
  32 + @ResponseBody
  33 + public AjaxResult OverrideHandle(@RequestBody TaskFinishDomain taskFinishDomain)
  34 + {
  35 + AjaxResult ajaxResult =overrideHandleService.OverrideHandle(taskFinishDomain) ;
  36 + return ajaxResult;
  37 + }
  38 +
  39 +
  40 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**任务完成
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/api/WCS/v2")
  25 +public class TaskFinish extends BaseController {
  26 +
  27 + @Resource
  28 + private TaskFinishService taskFinishService;
  29 +
  30 + @Log(title = "wcs任务完成", action = BusinessType.INSERT)
  31 + @PostMapping("/TaskFinish")
  32 + @ApiOperation("wcs任务完成")
  33 + @ResponseBody
  34 + public AjaxResult TaskFinish(@RequestBody TaskFinishDomain taskFinishDomain)
  35 + {
  36 + AjaxResult ajaxResult =taskFinishService.completeTaskByWCS(taskFinishDomain) ;
  37 + return ajaxResult;
  38 + }
  39 +
  40 +
  41 +}
... ...
src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java 0 → 100644
  1 +package com.huaheng.api.wcs.controller;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
  5 +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService;
  6 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  7 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  8 +import com.huaheng.framework.web.controller.BaseController;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import io.swagger.annotations.Api;
  11 +import io.swagger.annotations.ApiOperation;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.annotation.Resource;
  15 +
  16 +/**仓位分配 接口
  17 + * wcs向wms传递数据
  18 + * @author ricard
  19 + * @date 2019/10/11
  20 + *
  21 + */
  22 +
  23 +@RestController
  24 +@RequestMapping("/api/WCS/v2")
  25 +public class WarecellAllocation extends BaseController {
  26 +
  27 + @Resource
  28 + private WarecellAllocationService warecellAllocationService;
  29 +
  30 + @Log(title = "wcs仓位分配", action = BusinessType.INSERT)
  31 + @PostMapping("/WarecellAllocation")
  32 + @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST")
  33 + @ResponseBody
  34 + public AjaxResult WarecellAllocation(@RequestBody WcsTask wcsTask)
  35 + {
  36 + AjaxResult ajaxResult =warecellAllocationService.WarecellAllocation(wcsTask) ;
  37 + return ajaxResult;
  38 + }
  39 +
  40 +
  41 +}
... ...
src/main/java/com/huaheng/api/wcs/domain/TaskDetails.java 0 → 100644
  1 +package com.huaheng.api.wcs.domain;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.math.BigDecimal;
  6 +
  7 +/**
  8 + * Created by Enzo Cotter on 2019/10/15.
  9 + */
  10 +@Data
  11 +public class TaskDetails {
  12 +
  13 + //关联行号,string (50),默认0 ",必填
  14 + private String referLineNo;
  15 +
  16 + //物料编码,string (50),默认0 ",必填
  17 + private String materialCode;
  18 +
  19 + //物料名称
  20 + private String materialName;
  21 +
  22 + //数量,float,默认“0” ,必填"
  23 + private BigDecimal qty;
  24 +
  25 + //单位,string(20),默认“PCS” ,必填"
  26 + private String unit;
  27 +}
... ...
src/main/java/com/huaheng/api/wcs/domain/TaskFinishDomain.java 0 → 100644
  1 +package com.huaheng.api.wcs.domain;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * 任务完成和重入实体类
  7 + * Created by Enzo Cotter on 2019/10/15.
  8 + */
  9 +@Data
  10 +public class TaskFinishDomain {
  11 +
  12 + //任务号
  13 + private String taskNo;
  14 +
  15 + //重入,int,1:重入 0:正常,必填
  16 + private Integer isDoubleIn;
  17 +
  18 + //空出,int,1:空出 0:正常,必填
  19 + private Integer isEmptyOut;
  20 +
  21 + //重入的库位编码,string (50),默认0,必填
  22 + private String redirectionLocationCode;
  23 +
  24 + //目的位置编码,string (50),默认0 ",必填
  25 + private String toLocationCode;
  26 +}
... ...
src/main/java/com/huaheng/api/wcs/domain/WcsTask.java 0 → 100644
  1 +package com.huaheng.api.wcs.domain;
  2 +
  3 +import lombok.Data;
  4 +
  5 +import java.io.Serializable;
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * wcs任务接口实体层
  10 + * @author ricard
  11 + * @date 2019/10/11
  12 + */
  13 +
  14 +@Data
  15 +public class WcsTask implements Serializable {
  16 + private static final long serialVersionUID = -8855840499538794854L;
  17 +
  18 + //任务号
  19 + private String taskNo;
  20 +
  21 + //前置任务
  22 + private String preTaskNo;
  23 +
  24 + //任务类型
  25 + private String taskType;
  26 +
  27 + //出库站台编码.默认‘0’
  28 + private String station;
  29 +
  30 + //平台
  31 + private String platform;
  32 +
  33 + //容器编码
  34 + private String containerCode;
  35 +
  36 + //来源口”,一般用于指定入库口,string (50),默认0,必填
  37 + private String fromPort;
  38 +
  39 + //目的口”,出库性质的任务必须填写,string (50),默认0,必填
  40 + private String toPort;
  41 +
  42 + //源位置库位编码
  43 + private String fromLocationCode;
  44 +
  45 + //目的位置库位编码
  46 + private String toLocationCode;
  47 +
  48 + //重入后再次分配的位置编码
  49 + private String locationCode;
  50 +
  51 + //优先级,int,默认100 ,数字越小优先级越高",必填
  52 + private Integer priority;
  53 +
  54 + //巷道
  55 + private String roadWay;
  56 +
  57 + //长
  58 + private String length;
  59 +
  60 + //宽
  61 + private String width;
  62 +
  63 + //高
  64 + private String height;
  65 +
  66 + //重
  67 + private String weight;
  68 +
  69 + //备注
  70 + private String remark;
  71 +
  72 + private List<TaskDetails> taskDetails;
  73 +}
... ...
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.emptyOutHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface EmptyOutHandleService {
  7 + //空出处理
  8 + AjaxResult EmptyOutHandle(WcsTask wcsTask);
  9 +}
... ...
src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.emptyOutHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.common.utils.StringUtils;
  5 +import com.huaheng.framework.web.domain.AjaxResult;
  6 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  7 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +
  12 +@Service
  13 +public class EmptyOutHandleServiceImpl implements EmptyOutHandleService {
  14 +
  15 +
  16 + @Autowired
  17 + private TaskHeaderService taskHeaderService;
  18 +
  19 + /**
  20 + * 空出处理
  21 + * 1、判断非空字段
  22 + * 2、根据任务号查找任务
  23 + * 3、修改该任务为空出,过后处理
  24 + * @param wcsTask
  25 + * @return
  26 + */
  27 + @Override
  28 + @Transactional
  29 + public AjaxResult EmptyOutHandle(WcsTask wcsTask) {
  30 +
  31 + //1、判断非空字段
  32 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  33 + return AjaxResult.error("任务号为空");
  34 + }
  35 +
  36 + //2、根据任务号查找任务
  37 + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(wcsTask.getTaskNo()));
  38 + if(taskHeader == null){
  39 + return AjaxResult.error("任务号错误,没有找到该任务");
  40 + }
  41 + if(taskHeader.getStatus() == 100){
  42 + return AjaxResult.error("任务已完成");
  43 + }
  44 +
  45 + //3、修改该任务为空出,过后处理
  46 + taskHeader.setExceptionCode("空托出库");
  47 + Boolean flag = taskHeaderService.updateById(taskHeader);
  48 + if(flag == false){
  49 + return AjaxResult.error("修改任务失败,空出处理失败");
  50 + }
  51 + return AjaxResult.success("空出处理成功");
  52 + }
  53 +}
... ...
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.overrideHandle;
  2 +
  3 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.framework.web.domain.AjaxResult;
  6 +
  7 +public interface OverrideHandleService {
  8 +
  9 + //重入处理
  10 + AjaxResult OverrideHandle(TaskFinishDomain taskFinishDomain);
  11 +}
... ...
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.overrideHandle;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  6 +import com.huaheng.api.wcs.domain.WcsTask;
  7 +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService;
  8 +import com.huaheng.common.exception.service.ServiceException;
  9 +import com.huaheng.common.utils.StringUtils;
  10 +import com.huaheng.common.utils.security.ShiroUtils;
  11 +import com.huaheng.framework.web.domain.AjaxResult;
  12 +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
  13 +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService;
  14 +import com.huaheng.pc.config.location.domain.Location;
  15 +import com.huaheng.pc.config.location.service.LocationService;
  16 +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail;
  17 +import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService;
  18 +import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader;
  19 +import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService;
  20 +import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
  21 +import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
  22 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  23 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
  24 +import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.stereotype.Service;
  26 +import org.springframework.transaction.annotation.Transactional;
  27 +
  28 +import javax.annotation.Resource;
  29 +import java.util.ArrayList;
  30 +import java.util.List;
  31 +
  32 +@Service
  33 +public class OverrideHandleServiceImpl implements OverrideHandleService {
  34 +
  35 +
  36 + @Autowired
  37 + private TaskHeaderService taskHeaderService;
  38 + @Autowired
  39 + private TaskDetailService taskDetailService;
  40 + @Autowired
  41 + private LocationService locationService;
  42 + @Autowired
  43 + private ReceiptContainerHeaderService receiptContainerHeaderService;
  44 + @Autowired
  45 + private ReceiptContainerDetailService receiptContainerDetailService;
  46 + @Resource
  47 + private WarecellAllocationService warecellAllocationService;
  48 + @Resource
  49 + private FilterConfigDetailService filterConfigDetailService;
  50 +
  51 + /**
  52 + * 重入处理
  53 + * 1、判断非空字段
  54 + * 2、根据任务号查找任务
  55 + * 3、修改任务目的库位,修改入库组盘的库位,修改库位状态
  56 + */
  57 +
  58 + @Override
  59 + @Transactional
  60 + public AjaxResult OverrideHandle(TaskFinishDomain taskFinishDomain) {
  61 + Boolean flag = true;
  62 +
  63 + //1、判断非空字段
  64 + if(StringUtils.isEmpty(taskFinishDomain.getTaskNo())){
  65 + return AjaxResult.error("任务号为空");
  66 + }
  67 + if(StringUtils.isEmpty(taskFinishDomain.getToLocationCode())){
  68 + return AjaxResult.error("目的库位为空");
  69 + }
  70 + if(StringUtils.isEmpty(taskFinishDomain.getRedirectionLocationCode())){
  71 + return AjaxResult.error("重入的库位编码为空");
  72 + }
  73 +
  74 +
  75 +
  76 + //2、根据任务号查找任务
  77 + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(taskFinishDomain.getTaskNo()));
  78 + if(taskHeader == null){
  79 + return AjaxResult.error("任务号错误,没有找到该任务");
  80 + }
  81 + if(taskHeader.getStatus() == 100){
  82 + return AjaxResult.error("任务已完成");
  83 + }
  84 +
  85 + //3、修改任务目的库位,修改入库组盘的库位,修改库位状态
  86 + //修改原来目的库位的状态
  87 + LambdaQueryWrapper<Location> locationLam = Wrappers.lambdaQuery();
  88 + locationLam.eq(Location::getCode,taskHeader.getToLocation())
  89 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
  90 + Location location = locationService.getOne(locationLam);
  91 + if(location == null){
  92 + return AjaxResult.error("此任务的原目的库位在系统中不存在");
  93 + }
  94 + location.setStatus("empty");
  95 + location.setContainerCode("");
  96 + flag = locationService.updateById(location);
  97 + if(flag == false){
  98 + return AjaxResult.error("修改此任务的原目的库位错误");
  99 + }
  100 +
  101 +
  102 + /**
  103 + * 查看新库位有两种情况
  104 + * 1、重入的库位由wcs提供
  105 + * 2、重入的库位由wms提供
  106 + */
  107 +
  108 + Location newlocation =new Location();
  109 + String code=ShiroUtils.getWarehouseCode();
  110 + //重入的库位由wcs提供
  111 + if(!taskFinishDomain.getRedirectionLocationCode().equals("0")) {
  112 + LambdaQueryWrapper<Location> locationLa = Wrappers.lambdaQuery();
  113 + locationLa.eq(Location::getCode, taskFinishDomain.getRedirectionLocationCode())
  114 + .eq(Location::getStatus,"empty")
  115 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
  116 + newlocation = locationService.getOne(locationLa);
  117 + if (newlocation == null) {
  118 + throw new ServiceException("新目的库位在系统中不存在或非空闲");
  119 + }
  120 + if(StringUtils.isNotEmpty(newlocation.getContainerCode())){
  121 + throw new ServiceException("新目的库位在系统中已经有容器");
  122 + }
  123 + }else {
  124 + //重入的库位由wms提供
  125 + //查询任务明细
  126 + LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery();
  127 + taskDetailLambda.eq(TaskDetail::getTaskId, taskFinishDomain.getTaskNo());
  128 + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda);
  129 + //查询入库组盘明细
  130 + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>();
  131 + for (TaskDetail taskDetail : taskDetailList) {
  132 + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId()));
  133 + }
  134 + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetailList.get(0).getReceiptContainerId());
  135 + String locatingRule = warecellAllocationService.taskPositioning(receiptContainerDetailList.get(0));
  136 +
  137 + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery();
  138 + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule);
  139 + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda);
  140 +
  141 + //根据定位规则查询库位编码
  142 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
  143 + locationLambda.last(filterConfigDetail.getStatement());
  144 + newlocation = locationService.getOne(locationLambda);
  145 + }
  146 +
  147 + //修改任务
  148 + taskHeader.setToLocation(newlocation.getCode());
  149 + taskHeader.setExceptionCode("重入处理");
  150 + flag = taskHeaderService.updateById(taskHeader);
  151 + if(flag == false){
  152 + throw new ServiceException("修改此任务错误");
  153 + }
  154 +
  155 + //修改子任务
  156 + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery();
  157 + taskDetailLam.eq(TaskDetail::getWarehouseCode,ShiroUtils.getWarehouseCode())
  158 + .eq(TaskDetail::getTaskId,taskHeader.getId());
  159 + List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLam);
  160 + List<TaskDetail> taskDetailList = new ArrayList<>();
  161 + if(taskDetails != null && taskDetails.size()> 0){
  162 + for(TaskDetail taskDetail : taskDetails){
  163 + taskDetail.setToLocation(newlocation.getCode());
  164 + taskDetailList.add(taskDetail);
  165 + }
  166 + flag = taskDetailService.updateBatchById(taskDetailList);
  167 + if(flag == false){
  168 + throw new ServiceException("修改此任务的明细错误");
  169 + }
  170 + }
  171 +
  172 + //修改入库组盘
  173 + if(taskHeader.getAllocationHeadId() == null){
  174 + throw new ServiceException("找不到此任务的组盘头id");
  175 + }
  176 + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(taskHeader.getAllocationHeadId());
  177 + if(receiptContainerHeader == null){
  178 + throw new ServiceException("找不到此任务的组盘头");
  179 + }
  180 + receiptContainerHeader.setToLocation(newlocation.getCode());
  181 + flag = receiptContainerHeaderService.updateById(receiptContainerHeader);
  182 + if(flag == false){
  183 + throw new ServiceException("修改此任务对应的组盘头错误");
  184 + }
  185 +
  186 + //修改入库组盘明细
  187 + LambdaQueryWrapper<ReceiptContainerDetail> lam = Wrappers.lambdaQuery();
  188 + lam.eq(ReceiptContainerDetail::getReceiptContainerId,receiptContainerHeader.getId())
  189 + .eq(ReceiptContainerDetail::getWarehouseCode,ShiroUtils.getWarehouseCode());
  190 + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lam);
  191 +
  192 + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>();
  193 + if(receiptContainerDetails != null && receiptContainerDetails.size()> 0){
  194 + for(ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){
  195 + receiptContainerDetail.setLocationCode(newlocation.getCode());
  196 + receiptContainerDetailList.add(receiptContainerDetail);
  197 + }
  198 + flag = receiptContainerDetailService.updateBatchById(receiptContainerDetailList);
  199 + if(flag == false){
  200 + throw new ServiceException("修改此任务的组盘明细错误");
  201 + }
  202 + }
  203 + return AjaxResult.success("重入处理成功");
  204 + }
  205 +}
... ...
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.stationInfo;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +
  5 +public interface StationInfoService {
  6 +
  7 + //站台信息查询
  8 + AjaxResult StationInfo(String station);
  9 +
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.stationInfo;
  2 +
  3 +
  4 +import com.alibaba.fastjson.JSON;
  5 +import com.huaheng.api.wcs.domain.WcsTask;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.common.utils.http.HttpUtils;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.config.address.service.AddressService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +@Service
  15 +public class StationInfoServiceImpl implements StationInfoService {
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 +
  20 + /**
  21 + * 站台信息查询
  22 + * 1、判断非空字段
  23 + * 2、实体转换
  24 + * 3、发送数据
  25 + * @param station
  26 + * @return
  27 + */
  28 + @Override
  29 + public AjaxResult StationInfo(String station) {
  30 +
  31 + //1、判断非空字段
  32 + if(StringUtils.isEmpty(station)){
  33 + return AjaxResult.error("站台为空");
  34 + }
  35 +
  36 + //2、实体转换
  37 + WcsTask wcsTask =new WcsTask();
  38 + wcsTask.setStation(station);
  39 +
  40 + //3、发送数据
  41 + String param="wcs";
  42 + String url=addressService.selectAddress(param)+"StationInfo";
  43 + String JsonParam = JSON.toJSONString(wcsTask);
  44 + String result = HttpUtils.bodypost(url, JsonParam);
  45 + if(StringUtils.isEmpty(result)){
  46 + throw new ServiceException("接口地址错误");
  47 + }
  48 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  49 + return ajaxResult;
  50 +
  51 + }
  52 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskAssignService;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  5 +
  6 +/**
  7 + * 任务下发接口Service层
  8 + * @author ricard
  9 + * @date 2019/10/11
  10 + *
  11 + */
  12 +public interface TaskAssignService {
  13 +
  14 + //wms下发任务给wcs
  15 + AjaxResult wcsTaskAssign(TaskHeader taskHeader);
  16 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskAssignService;
  2 +
  3 +
  4 +import com.alibaba.fastjson.JSON;
  5 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  6 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  7 +import com.huaheng.api.wcs.domain.TaskDetails;
  8 +import com.huaheng.api.wcs.domain.WcsTask;
  9 +import com.huaheng.common.exception.service.ServiceException;
  10 +import com.huaheng.common.utils.StringUtils;
  11 +import com.huaheng.common.utils.http.HttpUtils;
  12 +import com.huaheng.framework.web.domain.AjaxResult;
  13 +import com.huaheng.pc.config.address.service.AddressService;
  14 +import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
  15 +import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
  16 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.stereotype.Service;
  19 +import org.springframework.transaction.annotation.Transactional;
  20 +
  21 +import java.util.ArrayList;
  22 +import java.util.List;
  23 +
  24 +/**
  25 + * 任务下发接口ServiceImpl层
  26 + * @author ricard
  27 + * @date 2019/10/11
  28 + *
  29 + */
  30 +
  31 +@Service
  32 +public class TaskAssignServiceImpl implements TaskAssignService {
  33 +
  34 + @Autowired
  35 + private AddressService addressService;
  36 + @Autowired
  37 + private TaskDetailService taskDetailService;
  38 +
  39 +
  40 + public static String platform = "wms";
  41 +
  42 + //wms下发任务给wcs
  43 + /**
  44 + * 1、判断taskHeader是否为空
  45 + * 2、判断必填字段是否满足
  46 + * 3、转换实体
  47 + * 4、发送数据
  48 + *
  49 + * @param taskHeader
  50 + * @return
  51 + */
  52 + @Override
  53 + @Transactional
  54 + public AjaxResult wcsTaskAssign(TaskHeader taskHeader) {
  55 + //1、判断taskHeader是否为空
  56 + if(taskHeader == null){
  57 + throw new ServiceException("wms任务为空");
  58 + }
  59 +
  60 + //2、判断必填字段是否满足
  61 + if(taskHeader.getId() == null){
  62 + throw new ServiceException("wms任务号Id为空");
  63 + }
  64 + if(taskHeader.getTaskType() == null){
  65 + throw new ServiceException("wms任务类型为空");
  66 + }
  67 + if(StringUtils.isEmpty(taskHeader.getContainerCode())){
  68 + throw new ServiceException("wms任务中容器为空");
  69 + }
  70 +
  71 +
  72 + //入库性质的任务源库位不能为空
  73 + if(taskHeader.getTaskType()==100 || taskHeader.getTaskType()==200
  74 + || taskHeader.getTaskType()==500 || taskHeader.getTaskType()==800) {
  75 + if (taskHeader.getFromLocation() == null) {
  76 + throw new ServiceException("源库位为空");
  77 + }
  78 + }
  79 +
  80 + // 出库性质的任务目的库位不能为空
  81 + if(taskHeader.getTaskType()==300 || taskHeader.getTaskType()==400
  82 + || taskHeader.getTaskType()==600 || taskHeader.getTaskType()==700
  83 + || taskHeader.getTaskType()==800 || taskHeader.getTaskType()==900)
  84 + {
  85 + if (taskHeader.getToLocation() == null) {
  86 + throw new ServiceException("目的库位为空");
  87 + }
  88 + }
  89 +
  90 + //3、转换实体,初始化wcs任务实体
  91 + WcsTask wcsTask = new WcsTask();
  92 + wcsTask.setTaskNo(taskHeader.getId().toString());
  93 + wcsTask.setPreTaskNo("0");
  94 + wcsTask.setTaskType(taskHeader.getTaskType().toString());
  95 + wcsTask.setFromPort("1000");
  96 + wcsTask.setToPort("0");
  97 + wcsTask.setContainerCode(taskHeader.getContainerCode());
  98 + if(StringUtils.isEmpty(taskHeader.getFromLocation())){
  99 + wcsTask.setFromLocationCode("0");
  100 + }else {
  101 + wcsTask.setFromLocationCode(taskHeader.getFromLocation());
  102 + }
  103 + if(StringUtils.isEmpty(taskHeader.getToLocation())){
  104 + wcsTask.setToLocationCode("0");
  105 + }else {
  106 + wcsTask.setToLocationCode(taskHeader.getToLocation());
  107 + }
  108 + wcsTask.setPriority(100);
  109 + wcsTask.setRemark("0");
  110 + wcsTask.setPlatform(platform);
  111 +
  112 + //找到任务明细
  113 + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery();
  114 + taskDetailLam.eq(TaskDetail::getTaskId,taskHeader.getId());
  115 + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLam);
  116 + if(taskDetailList == null){
  117 + throw new ServiceException("没有子任务");
  118 + }
  119 + List<TaskDetails> taskDetails =new ArrayList<>();
  120 + for(TaskDetail item : taskDetailList){
  121 + TaskDetails details = new TaskDetails();
  122 + details.setMaterialCode(item.getMaterialCode());
  123 + details.setMaterialName(item.getMaterialName());
  124 + if(StringUtils.isEmpty(item.getMaterialUnit())){
  125 + details.setUnit("PCS");
  126 + }else {
  127 + details.setUnit(item.getMaterialUnit());
  128 + }
  129 + details.setQty(item.getQty());
  130 + details.setReferLineNo(item.getId().toString());
  131 + taskDetails.add(details);
  132 + }
  133 +
  134 + wcsTask.setTaskDetails(taskDetails);
  135 +
  136 + //4、发送数据
  137 + String param="wcs";
  138 + String url=addressService.selectAddress(param)+"TaskAssign";
  139 + String JsonParam = JSON.toJSONString(wcsTask);
  140 + System.out.println(JsonParam);
  141 + String result = HttpUtils.bodypost(url, JsonParam);
  142 + if(StringUtils.isEmpty(result)){
  143 + throw new ServiceException("接口地址错误");
  144 + }
  145 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  146 + if(ajaxResult.getCode()!=200){
  147 + throw new ServiceException(ajaxResult.getMsg());
  148 + }
  149 + return ajaxResult;
  150 + }
  151 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskCancel;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface TaskCancelService {
  7 +
  8 + //取消任务
  9 + AjaxResult TaskCance(Integer id);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskCancel;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.utils.StringUtils;
  7 +import com.huaheng.common.utils.http.HttpUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.config.address.service.AddressService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class TaskCancelServiceImpl implements TaskCancelService {
  15 +
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 +
  20 + /**取消任务
  21 + * 1、判断参数是否为空
  22 + * 2、转换实体
  23 + * 3、发送数据
  24 + * @param id
  25 + * @return
  26 + */
  27 + @Override
  28 + public AjaxResult TaskCance(Integer id) {
  29 +
  30 + //1、判断参数是否为空
  31 + if(id == null){
  32 + throw new ServiceException("任务号为空");
  33 + }
  34 +
  35 +
  36 + //2、转换实体
  37 + WcsTask wcsTask = new WcsTask();
  38 + wcsTask.setTaskNo(id.toString());
  39 +
  40 + //3、发送数据
  41 + String param="wcs";
  42 + String url=addressService.selectAddress(param)+"TaskCancel";
  43 + String JsonParam = JSON.toJSONString(wcsTask);
  44 + String result = HttpUtils.bodypost(url, JsonParam);
  45 + if(StringUtils.isEmpty(result)){
  46 + throw new ServiceException("接口地址错误");
  47 + }
  48 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  49 + return ajaxResult;
  50 + }
  51 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskFinish;
  2 +
  3 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +
  6 +public interface TaskFinishService {
  7 +
  8 + //任务完成
  9 + AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain);
  10 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskFinish;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.api.wcs.domain.TaskFinishDomain;
  6 +import com.huaheng.common.support.Convert;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  10 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +@Service
  15 +public class TaskFinishServiceImpl implements TaskFinishService {
  16 +
  17 + @Autowired
  18 + private TaskHeaderService taskHeaderService;
  19 +
  20 + //任务完成
  21 + @Override
  22 + public AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain) {
  23 + AjaxResult ajaxResult=new AjaxResult();
  24 + if(StringUtils.isEmpty(taskFinishDomain.getTaskNo())){
  25 + return AjaxResult.error("任务号为空");
  26 + }
  27 + if(taskFinishDomain.getIsEmptyOut() == 1){
  28 + LambdaQueryWrapper<TaskHeader> lam = Wrappers.lambdaQuery();
  29 + lam.eq(TaskHeader::getId,Integer.valueOf(taskFinishDomain.getTaskNo()));
  30 + TaskHeader taskHeader = taskHeaderService.getOne(lam);
  31 + if(taskHeader == null){
  32 + return AjaxResult.error("wms系统没有此任务号");
  33 + }
  34 + if(StringUtils.isEmpty(taskHeader.getExceptionCode())) {
  35 + taskHeader.setExceptionCode("空托出库");
  36 + Boolean flag = taskHeaderService.updateById(taskHeader);
  37 + if (flag == false) {
  38 + return AjaxResult.error("修改任务失败,空出处理失败");
  39 + }
  40 + }
  41 + return AjaxResult.success("成功");
  42 + }
  43 + try{
  44 + ajaxResult=taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskFinishDomain.getTaskNo()));
  45 + } catch (Exception e) {
  46 + e.printStackTrace();
  47 + }
  48 + return ajaxResult;
  49 + }
  50 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskInfo;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +
  5 +public interface TaskInfoService {
  6 +
  7 + //任务信息查询
  8 + AjaxResult TaskInfo(Integer id);
  9 +}
... ...
src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.taskInfo;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.huaheng.api.wcs.domain.WcsTask;
  5 +import com.huaheng.common.exception.service.ServiceException;
  6 +import com.huaheng.common.utils.StringUtils;
  7 +import com.huaheng.common.utils.http.HttpUtils;
  8 +import com.huaheng.framework.web.domain.AjaxResult;
  9 +import com.huaheng.pc.config.address.service.AddressService;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +@Service
  14 +public class TaskInfoServiceImpl implements TaskInfoService {
  15 +
  16 +
  17 + @Autowired
  18 + private AddressService addressService;
  19 + /**
  20 + * 任务信息查询
  21 + * 1、判断非空字段
  22 + * 2、实体转换
  23 + * 3、发送数据
  24 + *
  25 + * @param id
  26 + * @return
  27 + */
  28 + @Override
  29 + public AjaxResult TaskInfo(Integer id) {
  30 +
  31 + //1、判断非空字段
  32 + if(id == null){
  33 + return AjaxResult.error("任务号为空");
  34 + }
  35 +
  36 +
  37 + //2、实体转换
  38 + WcsTask wcsTask =new WcsTask();
  39 + wcsTask.setTaskNo(id.toString());
  40 +
  41 + //3、发送数据
  42 + String param="wcs";
  43 + String url=addressService.selectAddress(param)+"TaskInfo";
  44 + String JsonParam = JSON.toJSONString(wcsTask);
  45 + String result = HttpUtils.bodypost(url, JsonParam);
  46 + if(StringUtils.isEmpty(result)){
  47 + throw new ServiceException("接口地址错误");
  48 + }
  49 + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
  50 + return ajaxResult;
  51 + }
  52 +}
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.warecellAllocation;
  2 +
  3 +import com.huaheng.api.wcs.domain.WcsTask;
  4 +import com.huaheng.framework.web.domain.AjaxResult;
  5 +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail;
  6 +
  7 +public interface WarecellAllocationService {
  8 +
  9 + //仓位分配
  10 + AjaxResult WarecellAllocation(WcsTask wcsTask);
  11 +
  12 + String taskPositioning(ReceiptContainerDetail receiptContainerDetail);
  13 +}
... ...
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java 0 → 100644
  1 +package com.huaheng.api.wcs.service.warecellAllocation;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.api.wcs.domain.WcsTask;
  6 +import com.huaheng.common.exception.service.ServiceException;
  7 +import com.huaheng.common.utils.StringUtils;
  8 +import com.huaheng.common.utils.security.ShiroUtils;
  9 +import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
  11 +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService;
  12 +import com.huaheng.pc.config.configValue.domain.ConfigValue;
  13 +import com.huaheng.pc.config.configValue.service.ConfigValueService;
  14 +import com.huaheng.pc.config.location.domain.Location;
  15 +import com.huaheng.pc.config.location.service.LocationService;
  16 +import com.huaheng.pc.config.locationType.domain.LocationType;
  17 +import com.huaheng.pc.config.locationType.service.LocationTypeService;
  18 +import com.huaheng.pc.config.material.domain.Material;
  19 +import com.huaheng.pc.config.material.service.MaterialService;
  20 +import com.huaheng.pc.config.materialType.domain.MaterialType;
  21 +import com.huaheng.pc.config.materialType.service.MaterialTypeService;
  22 +import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference;
  23 +import com.huaheng.pc.config.receiptPreference.service.ReceiptPreferenceService;
  24 +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail;
  25 +import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService;
  26 +import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader;
  27 +import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService;
  28 +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService;
  29 +import com.huaheng.pc.task.taskDetail.domain.TaskDetail;
  30 +import com.huaheng.pc.task.taskDetail.service.TaskDetailService;
  31 +import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
  32 +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
  33 +import org.springframework.stereotype.Service;
  34 +
  35 +import javax.annotation.Resource;
  36 +import java.util.ArrayList;
  37 +import java.util.List;
  38 +import java.util.stream.Collectors;
  39 +
  40 +@Service
  41 +public class WarecellAllocationServiceImpl implements WarecellAllocationService {
  42 +
  43 + @Resource
  44 + private LocationTypeService locationTypeService;
  45 + @Resource
  46 + private LocationService locationService;
  47 + @Resource
  48 + private ConfigValueService configValueService;
  49 + @Resource
  50 + private ReceiptPreferenceService receiptPreferenceService;
  51 + @Resource
  52 + private FilterConfigDetailService filterConfigDetailService;
  53 + @Resource
  54 + private TaskDetailService taskDetailService;
  55 + @Resource
  56 + private TaskHeaderService taskHeaderService;
  57 + @Resource
  58 + private ReceiptContainerDetailService receiptContainerDetailService;
  59 + @Resource
  60 + private ReceiptContainerHeaderService receiptContainerHeaderService;
  61 + @Resource
  62 + private ReceiptDetailService receiptDetailService;
  63 + @Resource
  64 + private MaterialService materialService;
  65 + @Resource
  66 + private MaterialTypeService materialTypeService;
  67 +
  68 + /**
  69 + * 仓位分配
  70 + * 1、判断非空字段
  71 + * 2、实体转换
  72 + * 3、查询满足条件的库位类型
  73 + * @param wcsTask
  74 + * @return
  75 + */
  76 + @Override
  77 + public AjaxResult WarecellAllocation(WcsTask wcsTask) {
  78 +
  79 + //1、判断非空字段
  80 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){
  81 + return AjaxResult.error("任务号为空");
  82 + }
  83 + if(StringUtils.isEmpty(wcsTask.getRoadWay())){
  84 + return AjaxResult.error("巷道为空");
  85 + }
  86 + if(StringUtils.isNull(wcsTask.getLength())){
  87 + return AjaxResult.error("长为空");
  88 + }
  89 + if(StringUtils.isNull(wcsTask.getWidth())){
  90 + return AjaxResult.error("宽为空");
  91 + }
  92 + if(StringUtils.isNull(wcsTask.getHeight())){
  93 + return AjaxResult.error("高为空");
  94 + }
  95 + if(StringUtils.isNull(wcsTask.getWeight())){
  96 + return AjaxResult.error("重为空");
  97 + }
  98 +
  99 + //查询满足条件的库位类型
  100 + LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery();
  101 + lambdaQueryWrapper.gt(LocationType::getLength,wcsTask.getLength())
  102 + .gt(LocationType::getWidth, wcsTask.getWidth())
  103 + .gt(LocationType::getHeight, wcsTask.getHeight())
  104 + .gt(LocationType::getMaxWeight, wcsTask.getWidth());
  105 + List<LocationType> locationTypeList = locationTypeService.list(lambdaQueryWrapper);
  106 + List<String> codeList = new ArrayList<>();
  107 + for (LocationType locationType: locationTypeList) {
  108 + codeList.add(locationType.getCode());
  109 + }
  110 +
  111 + String locationCode = null;
  112 + //查询任务明细
  113 + LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery();
  114 + taskDetailLambda.eq(TaskDetail::getTaskId, wcsTask.getTaskNo());
  115 + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda);
  116 +
  117 + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>();
  118 + for (TaskDetail taskDetail : taskDetailList) {
  119 + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId()));
  120 + }
  121 + //去重
  122 + receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList());
  123 +
  124 + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) {
  125 + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId());
  126 +
  127 + String locatingRule = this.taskPositioning(receiptContainerDetail);
  128 +
  129 + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery();
  130 + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule);
  131 + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda);
  132 + String[] locatingRules = filterConfigDetail.getStatement().split("limit");
  133 +
  134 + //根据定位规则查询库位编码
  135 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
  136 + locationLambda.last(locatingRules[0]);
  137 + List<Location> locationList = locationService.list(locationLambda);
  138 +// locationList.stream().filter(location -> location.getLocationType().equals(locationTypeList.get(0)));
  139 + locationCode = filter(locationList, locationTypeList, wcsTask.getRoadWay());
  140 + if (StringUtils.isEmpty(locationCode)){
  141 + throw new ServiceException("没有库位可分配");
  142 + }
  143 +
  144 + if (StringUtils.isNotEmpty(locationCode)){
  145 + locationService.updateStatus(locationCode, "lock");
  146 + } else {
  147 + throw new ServiceException("定位失败,请检查定位规则是否正确");
  148 + }
  149 +
  150 + //更新库位编码到组盘头表
  151 + receiptContainerHeader.setToLocation(locationCode);
  152 + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)){
  153 + throw new ServiceException("更新库位失败");
  154 + }
  155 +
  156 + //把库位编码赋到该入库组盘头表下的所有明细
  157 + LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery();
  158 + lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId());
  159 + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda);
  160 + for (ReceiptContainerDetail receiptContainerDetail2: receiptContainerDetails) {
  161 + receiptContainerDetail2.setLocationCode(locationCode);
  162 + if (!receiptContainerDetailService.updateById(receiptContainerDetail2)){throw new ServiceException("更新库位编码到入库组盘明细");}
  163 + }
  164 +
  165 + }
  166 +
  167 + if (StringUtils.isNotEmpty(locationCode)){
  168 + //修改任务明细目标库位
  169 + for (TaskDetail taskDetail : taskDetailList) {
  170 + taskDetail.setToLocation(locationCode);
  171 + if (!taskDetailService.updateById(taskDetail)){ throw new ServiceException("更新任务明细目标库位失败");}
  172 + }
  173 +
  174 + TaskHeader taskHeader = taskHeaderService.getById(wcsTask.getTaskNo());
  175 +
  176 + taskHeader.setToLocation(locationCode);
  177 + if (!taskHeaderService.updateById(taskHeader)){throw new ServiceException("更新任务头表目标库位失败");}
  178 + WcsTask wcsTaskResult = new WcsTask();
  179 + wcsTaskResult.setToLocationCode(locationCode);
  180 + return AjaxResult.success(wcsTaskResult);
  181 + }
  182 +
  183 + return AjaxResult.error("错误");
  184 + }
  185 +
  186 + /**
  187 + * 库位筛选
  188 + * @param locationList 库位列表
  189 + * @param locationTypeList 库位类型列表
  190 + * @param roadway 巷道
  191 + * @return
  192 + */
  193 + public String filter(List<Location> locationList, List<LocationType> locationTypeList, String roadway){
  194 + List<String> codeList = locationTypeList.stream().map(t-> t.getCode()).collect(Collectors.toList());
  195 + List<Location> newLocation = locationList.stream().filter(t-> codeList.contains(t.getLocationType()) && t.getRoadway().equals(roadway)).collect(Collectors.toList());
  196 + if (newLocation.isEmpty()){
  197 + return null;
  198 + } else{
  199 + return newLocation.get(0).getCode();
  200 + }
  201 + }
  202 +
  203 + /**
  204 + * 定位
  205 + * @param receiptContainerDetail
  206 + * @return
  207 + */
  208 + @Override
  209 + public String taskPositioning(ReceiptContainerDetail receiptContainerDetail){
  210 + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId());
  211 + String locatingRule = receiptContainerHeader.getLocatingRule(); //定位规则
  212 + if (StringUtils.isEmpty(locatingRule)){
  213 + locatingRule = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()).getLocatingRule();
  214 + //入库单明细定位规则不为空时执行
  215 + if (StringUtils.isEmpty(locatingRule)){
  216 + //入库单明细为空时,查询物料表中是否含有定位规则
  217 + LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery();
  218 + materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode());
  219 + Material material = materialService.getOne(materialLambda);
  220 + locatingRule = material.getLocatingRule();
  221 +
  222 + if (StringUtils.isEmpty(locatingRule)){
  223 + //物料表中定位规则为空时,查询物料类别
  224 + LambdaQueryWrapper<MaterialType> materialTypeLambda = Wrappers.lambdaQuery();
  225 + materialTypeLambda.eq(MaterialType::getCode, material.getType());
  226 + MaterialType materialType = materialTypeService.getOne(materialTypeLambda);
  227 + locatingRule = materialType.getLocatingRule();
  228 + if (StringUtils.isEmpty(locatingRule)){
  229 + //物料类别中定位规则为空时,查询入库首选项
  230 + LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery();
  231 + configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode())
  232 + .eq(ConfigValue::getModuleType, "receipt")
  233 + .eq(ConfigValue::getRecordType, "入库首选项");
  234 + ConfigValue configValue = configValueService.getOne(configValueLambda);
  235 + LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery();
  236 + receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue());
  237 + ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda);
  238 + locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule();
  239 + }
  240 + }
  241 + }
  242 + }
  243 + //通过定位规则查找自定义sql
  244 + if (StringUtils.isEmpty(locatingRule)){
  245 + throw new ServiceException("未绑定定位规则");
  246 + }
  247 +
  248 + return locatingRule;
  249 + }
  250 +}
... ...
src/main/java/com/huaheng/common/constant/QuantityConstant.java 0 → 100644
  1 +package com.huaheng.common.constant;
  2 +
  3 +/**
  4 + * 数字自定义常量
  5 + *
  6 + * @author ricard
  7 + */
  8 +public class QuantityConstant {
  9 + /**
  10 + * 1、入库单状态
  11 + * 2、出库单状态
  12 + * 3、单据上传状态
  13 + * 4、入库组盘状态
  14 + * 5、出库组盘状态
  15 + * 6、任务类型
  16 + * 7、任务状态
  17 + * 8、波次状态
  18 + * 9、质检状态
  19 + * 10、盘点状态
  20 + * 11、库存交易类型
  21 + * 12、调整单状态
  22 + * 13、任务内部类型
  23 + * 14、质检单类型
  24 + */
  25 +
  26 + //1、入库单状态
  27 +
  28 + //新建
  29 + public static final Integer RECEIPT_HEADER_BUILD = 0;
  30 +
  31 + //等待审核
  32 + public static final Integer RECEIPT_HEADER_MODERATED = 5;
  33 +
  34 + //驳回
  35 + public static final Integer RECEIPT_HEADER_TURNDOWN = 10;
  36 +
  37 + //作废
  38 + public static final Integer RECEIPT_HEADER_OBSOLETE = 20;
  39 +
  40 + //订单池
  41 + public static final Integer RECEIPT_HEADER_POOL = 100;
  42 +
  43 + //入库预约
  44 + public static final Integer RECEIPT_HEADER_RESERVATION = 120;
  45 +
  46 + //入库到货
  47 + public static final Integer RECEIPT_HEADER_ARRIVAL = 150;
  48 +
  49 + //入库质检
  50 + public static final Integer RECEIPT_HEADER_CHECK = 180;
  51 +
  52 + //收货
  53 + public static final Integer RECEIPT_HEADER_RECEIVING = 200;
  54 +
  55 + //定位
  56 + public static final Integer RECEIPT_HEADER_POSITION = 240;
  57 +
  58 + //等待上架
  59 + public static final Integer RECEIPT_HEADER_WAIT = 280;
  60 +
  61 + //上架
  62 + public static final Integer RECEIPT_HEADER_SHELF = 300;
  63 +
  64 + //过账
  65 + public static final Integer RECEIPT_HEADER_POSTING = 800;
  66 +
  67 + //回传
  68 + public static final Integer RECEIPT_HEADER_RETURN = 900;
  69 +
  70 +
  71 +
  72 +
  73 +
  74 + //2、出库单状态
  75 +
  76 + //新建
  77 + public static final Integer SHIPMENT_HEADER_BUILD = 0;
  78 +
  79 + //订单池
  80 + public static final Integer SHIPMENT_HEADER_POOL = 100;
  81 +
  82 + //出库预约
  83 + public static final Integer SHIPMENT_HEADER_RESERVATION = 120;
  84 +
  85 + //订单分析
  86 + public static final Integer SHIPMENT_HEADER_ANALYSIS = 150;
  87 +
  88 + //波次
  89 + public static final Integer SHIPMENT_HEADER_WAVE = 200;
  90 +
  91 + //出库组盘
  92 + public static final Integer SHIPMENT_HEADER_GROUPDISK = 300;
  93 +
  94 + //拣货完成
  95 + public static final Integer SHIPMENT_HEADER_COMPLETED = 500;
  96 +
  97 + //发运
  98 + public static final Integer SHIPMENT_HEADER_SHIPPING = 800;
  99 +
  100 + //回传
  101 + public static final Integer SHIPMENT_HEADER_RETURN = 900;
  102 +
  103 +
  104 +
  105 +
  106 + //3、单据上传状态
  107 +
  108 + //未上传
  109 + public static final Integer UPLOAD_NOT = 0;
  110 +
  111 + //上传失败
  112 + public static final Integer UPLOAD_FAILED = 10;
  113 +
  114 + //上架完成
  115 + public static final Integer UPLOAD_SUCCESS = 20;
  116 +
  117 +
  118 +
  119 +
  120 + //4、入库组盘状态
  121 +
  122 + //新建
  123 + public static final Integer RECEIPT_CONTAINER_BUILD = 0;
  124 +
  125 + //生成任务
  126 + public static final Integer RECEIPT_CONTAINER_TASK= 10;
  127 +
  128 + //上架完成
  129 + public static final Integer RECEIPT_CONTAINER_FINISHED = 20;
  130 +
  131 + //复核完成
  132 + public static final Integer RECEIPT_CONTAINER_REVIEWSUCCESS = 30;
  133 +
  134 +
  135 +
  136 + //5、出库组盘状态
  137 +
  138 + //新建
  139 + public static final Integer SHIPMENT_CONTAINER_BUILD = 0;
  140 +
  141 + //生成任务
  142 + public static final Integer SHIPMENT_CONTAINER_TASK= 10;
  143 +
  144 + //拣货完成
  145 + public static final Integer SHIPMENT_CONTAINER_FINISHED = 20;
  146 +
  147 + //复核完成
  148 + public static final Integer SHIPMENT_CONTAINER_REVIEWSUCCESS = 30;
  149 +
  150 +
  151 +
  152 + //6、任务类型
  153 +
  154 + //整盘入库
  155 + public static final Integer TASK_TYPE_WHOLERECEIPT = 100;
  156 +
  157 + //补充入库
  158 + public static final Integer TASK_TYPE_SUPPLEMENTRECEIPT = 200;
  159 +
  160 + //整盘出库
  161 + public static final Integer TASK_TYPE_WHOLESHIPMENT = 300;
  162 +
  163 + //分拣出库
  164 + public static final Integer TASK_TYPE_SORTINGSHIPMENT = 400;
  165 +
  166 + //空容器入库
  167 + public static final Integer TASK_TYPE_EMPTYRECEIPT = 500;
  168 +
  169 + //空容器出库
  170 + public static final Integer TASK_TYPE_EMPTYSHIPMENT = 600;
  171 +
  172 + //盘点
  173 + public static final Integer TASK_TYPE_CYCLECOUNT = 700;
  174 +
  175 + //移库
  176 + public static final Integer TASK_TYPE_TRANSFER = 800;
  177 +
  178 + //出库查看
  179 + public static final Integer TASK_TYPE_VIEW = 900;
  180 +
  181 +
  182 +
  183 + //7、任务状态
  184 +
  185 + //生成任务
  186 + public static final Integer TASK_STATUS_BUILD = 1;
  187 +
  188 + //下达任务
  189 + public static final Integer TASK_STATUS_RELEASE = 10;
  190 +
  191 + //开始执行
  192 + public static final Integer TASK_STATUS_RUNNING = 20;
  193 +
  194 + //任务完成
  195 + public static final Integer TASK_STATUS_COMPLETED = 100;
  196 +
  197 +
  198 + //8、波次状态
  199 +
  200 + //新建波次
  201 + public static final Integer WAVE_STATUS_BUILD = 0;
  202 +
  203 + //开始波次
  204 + public static final Integer WAVE_STATUS_START = 100;
  205 +
  206 + //剔除不符合条件订单
  207 + public static final Integer WAVE_STATUS_EXCLUDE = 150;
  208 +
  209 + //指定分配规则
  210 + public static final Integer WAVE_STATUS_ASSIGN = 200;
  211 +
  212 + //分配库存
  213 + public static final Integer WAVE_STATUS_ALLOCATION = 300;
  214 +
  215 + //订单分组
  216 + public static final Integer WAVE_STATUS_GROUPING = 400;
  217 +
  218 + //创建货箱
  219 + public static final Integer WAVE_STATUS_CREATECONTAINER = 500;
  220 +
  221 + //生成任务
  222 + public static final Integer WAVE_STATUS_BUILDTASK = 600;
  223 +
  224 + //结束波次
  225 + public static final Integer WAVE_STATUS_END = 900;
  226 +
  227 + //失败
  228 + public static final Integer WAVE_STATUS_FAILED = 999;
  229 +
  230 +
  231 +
  232 + //9、质检状态
  233 +
  234 + //新建
  235 + public static final Integer CHECK_STATUS_BUILD = 0;
  236 +
  237 + //质检中
  238 + public static final Integer CHECK_STATUS_IN = 10;
  239 +
  240 + //质检完成
  241 + public static final Integer CHECK_STATUS_COMPLETED = 20;
  242 +
  243 +
  244 +
  245 + //10、盘点状态
  246 +
  247 + //新建
  248 + public static final Integer CYCLECOUNT_STATUS_BUILD = 1;
  249 +
  250 + //盘点任务生成
  251 + public static final Integer CYCLECOUNT_STATUS_BUILDTASK = 5;
  252 +
  253 + //执行中
  254 + public static final Integer CYCLECOUNT_STATUS_EXECUTING = 10;
  255 +
  256 + //已登记
  257 + public static final Integer CYCLECOUNT_STATUS_REGISTERED= 15;
  258 +
  259 + //审核
  260 + public static final Integer CYCLECOUNT_STATUS_REVIEW = 30;
  261 +
  262 + //关闭
  263 + public static final Integer CYCLECOUNT_STATUS_CLOSE = 99;
  264 +
  265 + //盘点完成
  266 + public static final Integer CYCLECOUNT_STATUS_COMPLETED = 100;
  267 +
  268 + //已生成调整单
  269 + public static final Integer CYCLECOUNT_STATUS_GENERATEADJUST = 101;
  270 +
  271 +
  272 +
  273 + //11、库存交易类型
  274 +
  275 + //入库
  276 + public static final Integer INVENTORY_TRANSACTION_RECEIPT = 10;
  277 +
  278 + //出库
  279 + public static final Integer INVENTORY_TRANSACTION_SHIPMENT = 20;
  280 +
  281 + //调整入
  282 + public static final Integer INVENTORY_TRANSACTION_ADJUSTINTO = 30;
  283 +
  284 + //调整出
  285 + public static final Integer INVENTORY_TRANSACTION_ADJUSTOUT = 40;
  286 +
  287 + //调整属性
  288 + public static final Integer INVENTORY_TRANSACTION_ADJUSTPROPERTIES = 50;
  289 +
  290 + //盘点
  291 + public static final Integer INVENTORY_TRANSACTION_CYCLECOUNT = 60;
  292 +
  293 + //移库入
  294 + public static final Integer INVENTORY_TRANSACTION_TRANSFERINTO = 70;
  295 +
  296 + //移库出
  297 + public static final Integer INVENTORY_TRANSACTION_TRANSFEROUT = 80;
  298 +
  299 +
  300 + //12、调整单状态
  301 +
  302 + //未批准
  303 + public static final Integer ADJUST_STATUS_NOAPPROVED = 0;
  304 +
  305 + //已批准
  306 + public static final Integer ADJUST_STATUS_APPROVED = 1;
  307 +
  308 + //待调整
  309 + public static final Integer ADJUST_STATUS_WAIT = 2;
  310 +
  311 + //已调整
  312 + public static final Integer ADJUST_STATUS_STOP = 3;
  313 +
  314 +
  315 + //13、任务内部类型
  316 +
  317 + //上架任务
  318 + public static final Integer TASK_INTENERTYPE_SHELF = 100;
  319 +
  320 + //拣货任务
  321 + public static final Integer TASK_INTENERTYPE_PICKING = 200;
  322 +
  323 + //补货任务
  324 + public static final Integer TASK_INTENERTYPE_SUPPLEMENT = 300;
  325 +
  326 + //工作任务
  327 + public static final Integer TASK_INTENERTYPE_WORK = 400;
  328 +
  329 + //质检任务
  330 + public static final Integer TASK_INTENERTYPE_CHECK = 500;
  331 +
  332 + //移库任务
  333 + public static final Integer TASK_INTENERTYPE_TRANSFER = 600;
  334 +
  335 + //盘点任务
  336 + public static final Integer TASK_INTENERTYPE_CYCLECOUNT = 700;
  337 +
  338 +
  339 +
  340 + //13、质检单类型
  341 +
  342 + //入库质检
  343 + public static final Integer CHECK_TYPE_RECEIPT = 100;
  344 +
  345 + //在库全检
  346 + public static final Integer CHECK_TYPE_FULL = 200;
  347 +
  348 + //在库抽检
  349 + public static final Integer CHECK_TYPE_SELECT = 300;
  350 +
  351 +
  352 +}
... ...
src/main/java/com/huaheng/pc/check/checkDetail/service/CheckDetailService.java
... ... @@ -2,6 +2,7 @@ package com.huaheng.pc.check.checkDetail.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.constant.QuantityConstant;
5 6 import com.huaheng.common.exception.service.ServiceException;
6 7 import com.huaheng.common.support.Convert;
7 8 import com.huaheng.common.utils.security.ShiroUtils;
... ... @@ -58,7 +59,7 @@ public class CheckDetailService extends ServiceImpl&lt;CheckDetailMapper, CheckDeta
58 59 checkDetail.setCheckBy(ShiroUtils.getLoginName());
59 60 checkDetail.setCheckAt(new Date());
60 61  
61   - checkDetail.setStatus("20");
  62 + checkDetail.setStatus((QuantityConstant.CHECK_STATUS_COMPLETED).toString());
62 63 checkDetail.setLastUpdated(new Date());
63 64 checkDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
64 65 if (!this.updateById(checkDetail)){
... ... @@ -71,7 +72,7 @@ public class CheckDetailService extends ServiceImpl&lt;CheckDetailMapper, CheckDeta
71 72 //判断头表下所有明细是否全部完成
72 73 boolean result = false;
73 74 for (CheckDetail checkDetail1 : checkDetails){
74   - if ("20".equals(checkDetail1.getStatus())){
  75 + if ((QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail1.getStatus())){
75 76 result = true;
76 77 } else {
77 78 result = false;
... ... @@ -80,7 +81,7 @@ public class CheckDetailService extends ServiceImpl&lt;CheckDetailMapper, CheckDeta
80 81 if (result){
81 82 CheckHeader checkHeader = new CheckHeader();
82 83 checkHeader.setId(checkDetail.getCheckHeaderId());
83   - checkHeader.setStatus("30");
  84 + checkHeader.setStatus((QuantityConstant.CHECK_STATUS_COMPLETED).toString());
84 85 if ( !checkHeaderService.updateById(checkHeader)){
85 86 throw new ServiceException("质检头表更新失败");
86 87 }
... ...
src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java
... ... @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7 import com.fasterxml.jackson.databind.ser.Serializers;
  8 +import com.huaheng.common.constant.QuantityConstant;
8 9 import com.huaheng.common.support.Convert;
9 10 import com.huaheng.common.utils.StringUtils;
10 11 import com.huaheng.common.utils.security.ShiroUtils;
... ... @@ -84,7 +85,9 @@ public class CheckingRegisterController extends BaseController {
84 85 PageDomain pageDomain = TableSupport.buildPageRequest();
85 86 Integer pageNum = pageNumber;
86 87 Integer pageSize = pageDomain.getPageSize();
87   - boolean isDetailNull;
  88 + boolean isDetailNull; //质检明细是否存在标识
  89 +
  90 + //判断质检单明细标号是否存在,不存在显示所有质检报告
88 91 if (StringUtils.isNotNull(checkingRegister.getCheckDetailId())){
89 92 isDetailNull = true;
90 93 if (checkingRegister.getCheckDetailId() == 0){
... ... @@ -128,10 +131,12 @@ public class CheckingRegisterController extends BaseController {
128 131 IPage<CheckingRegister> iPage = checkingRegisterService.page(page, lambdaQueryWrapper);
129 132 if (isDetailNull){
130 133 if (iPage.getTotal() == 0){
  134 + //空list
131 135 List emptyList = checkingRegisterService.emptyList(checkingRegister.getCheckDetailId());
132 136 return getMpDataTable(emptyList, Long.valueOf(emptyList.size()));
133 137 }
134   - if (!"20".equals(checkDetail.getStatus())){
  138 + if (!(QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail.getStatus())){
  139 + //未完成质检list
135 140 List notCompleteList = checkingRegisterService.notCompleteList(checkingRegister.getCheckDetailId());
136 141 return getMpDataTable(notCompleteList, Long.valueOf(notCompleteList.size()));
137 142 }
... ... @@ -141,10 +146,12 @@ public class CheckingRegisterController extends BaseController {
141 146 List<CheckingRegister> list = checkingRegisterService.list(lambdaQueryWrapper);
142 147 if (isDetailNull){
143 148 if (list.size() == 0){
  149 + //空list
144 150 List emptyList = checkingRegisterService.emptyList(checkingRegister.getCheckDetailId());
145 151 return getMpDataTable(emptyList, Long.valueOf(emptyList.size()));
146 152 }
147   - if (!"20".equals(checkDetail.getStatus())){
  153 + if (!(QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail.getStatus())){
  154 + //未完成质检list
148 155 List notCompleteList = checkingRegisterService.notCompleteList(checkingRegister.getCheckDetailId());
149 156 return getMpDataTable(notCompleteList, Long.valueOf(notCompleteList.size()));
150 157 }
... ...
src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java
... ... @@ -64,7 +64,7 @@ public class CheckingRegisterService extends ServiceImpl&lt;CheckingRegisterMapper,
64 64 */
65 65 public List<CheckingRegister> emptyList(Integer checkDetailId){
66 66 List<CheckingRegister> list = new ArrayList<>();
67   - List<DictData> dictDataList = dictDataService.selectDictDataByType("inventoryStatus");
  67 + List<DictData> dictDataList = dictDataService.selectDictDataByType("inventorySts");
68 68 CheckDetail checkDetail = checkDetailService.getById(checkDetailId);
69 69 for (DictData dictData: dictDataList){
70 70 CheckingRegister checkingRegister1 = new CheckingRegister();
... ...
src/main/java/com/huaheng/pc/config/FilterConfigDetail/controller/FilterConfigDetailController.java
... ... @@ -123,6 +123,7 @@ public class FilterConfigDetailController extends BaseController {
123 123 }
124 124 filterConfigDetail.setModuleType(configHeader.getModuleType());
125 125 filterConfigDetail.setRecordType(configHeader.getRecordType());
  126 + filterConfigDetail.setFilterCode(configHeader.getFilterCode());
126 127 filterConfigDetail.setWarehouseCode(ShiroUtils.getWarehouseCode());
127 128 filterConfigDetail.setCreatedBy(ShiroUtils.getLoginName());
128 129 filterConfigDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
... ...
src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java
... ... @@ -78,9 +78,9 @@ public class FilterConfigDetail implements Serializable {
78 78 @ApiModelProperty(value="全SQL")
79 79 private String statement;
80 80  
81   - @TableField(value = "sqll")
  81 + @TableField(value = "statements")
82 82 @ApiModelProperty(value="后续分组排序")
83   - private String sqll;
  83 + private String statements;
84 84  
85 85 /**
86 86 * 是否系统创建
... ...
src/main/java/com/huaheng/pc/config/FilterConfigDetail/mapper/FilterConfigDetailMapper.java
... ... @@ -2,6 +2,14 @@ package com.huaheng.pc.config.FilterConfigDetail.mapper;
2 2  
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
  5 +import org.apache.ibatis.annotations.Param;
5 6  
6 7 public interface FilterConfigDetailMapper extends BaseMapper<FilterConfigDetail> {
  8 +
  9 + //复制规则配置明细
  10 + int filterConfigDetailCopy(@Param("code") String code, @Param("newCode") String newCode);
  11 +
  12 + //修改规则配置明细headerId
  13 + int updateHeaderId(@Param("code") String code);
  14 +
7 15 }
8 16 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/FilterConfigHeader/mapper/FilterConfigHeaderMapper.java
... ... @@ -2,6 +2,10 @@ package com.huaheng.pc.config.FilterConfigHeader.mapper;
2 2  
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.FilterConfigHeader.domain.FilterConfigHeader;
  5 +import org.apache.ibatis.annotations.Param;
5 6  
6 7 public interface FilterConfigHeaderMapper extends BaseMapper<FilterConfigHeader> {
  8 +
  9 + //复制规则配置主表
  10 + int filterConfigHeaderCopy(@Param("code") String code, @Param("newCode") String newCode);
7 11 }
8 12 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java
... ... @@ -3,16 +3,25 @@ package com.huaheng.pc.config.FilterConfigHeader.service;
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.huaheng.common.exception.service.ServiceException;
6 7 import com.huaheng.common.utils.security.ShiroUtils;
  8 +import com.huaheng.pc.config.FilterConfigDetail.mapper.FilterConfigDetailMapper;
7 9 import com.huaheng.pc.config.FilterConfigHeader.domain.FilterConfigHeader;
8 10 import com.huaheng.pc.config.FilterConfigHeader.mapper.FilterConfigHeaderMapper;
9 11 import org.springframework.stereotype.Service;
10 12  
  13 +import javax.annotation.Resource;
11 14 import java.util.List;
12 15  
13 16 @Service("filterConfigHeaderService")
14 17 public class FilterConfigHeaderService extends ServiceImpl<FilterConfigHeaderMapper, FilterConfigHeader> {
15 18  
  19 + @Resource
  20 + private FilterConfigHeaderMapper filterConfigHeaderMapper;
  21 +
  22 + @Resource
  23 + private FilterConfigDetailMapper filterConfigDetailMapper;
  24 +
16 25  
17 26 //根据模块和类型查找具体规则
18 27 public List<FilterConfigHeader> getFilterConfigHeaderService(String moduleType,String recordType){
... ... @@ -22,4 +31,28 @@ public class FilterConfigHeaderService extends ServiceImpl&lt;FilterConfigHeaderMap
22 31 .eq(FilterConfigHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
23 32 return this.list(lam);
24 33 }
  34 +
  35 +
  36 + //复制规则配置
  37 + public Boolean filterConfigCopy(String code,String newCode){
  38 + int i = 0;
  39 + //复制规则配置主表
  40 + i = filterConfigHeaderMapper.filterConfigHeaderCopy(code,newCode);
  41 + if(i < 1){
  42 + throw new ServiceException("复制菜单数据失败");
  43 + }
  44 +
  45 + //复制规则配置明细
  46 + i = filterConfigDetailMapper.filterConfigDetailCopy(code,newCode);
  47 + if(i < 1){
  48 + throw new ServiceException("复制菜单数据失败");
  49 + }
  50 +
  51 + //修改规则配置明细headerId
  52 + i = filterConfigDetailMapper.updateHeaderId(newCode);
  53 + if(i < 1){
  54 + throw new ServiceException("复制菜单数据失败");
  55 + }
  56 + return true;
  57 + }
25 58 }
... ...
src/main/java/com/huaheng/pc/config/address/controller/AddressController.java 0 → 100644
  1 +package com.huaheng.pc.config.address.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7 +import com.huaheng.common.support.Convert;
  8 +import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.security.ShiroUtils;
  10 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  11 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  12 +import com.huaheng.framework.web.controller.BaseController;
  13 +import com.huaheng.framework.web.domain.AjaxResult;
  14 +import com.huaheng.framework.web.page.PageDomain;
  15 +import com.huaheng.framework.web.page.TableDataInfo;
  16 +import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.config.address.domain.Address;
  18 +import com.huaheng.pc.config.address.service.AddressService;
  19 +import com.huaheng.pc.config.carrier.domain.Carrier;
  20 +import com.huaheng.pc.config.carrier.service.CarrierService;
  21 +import io.swagger.annotations.ApiOperation;
  22 +import io.swagger.annotations.ApiParam;
  23 +import org.apache.shiro.authz.annotation.RequiresPermissions;
  24 +import org.springframework.stereotype.Controller;
  25 +import org.springframework.ui.ModelMap;
  26 +import org.springframework.web.bind.annotation.*;
  27 +
  28 +import javax.annotation.Resource;
  29 +import java.util.ArrayList;
  30 +import java.util.List;
  31 +
  32 +/**
  33 + * 接口地址
  34 + */
  35 +@Controller
  36 +@RequestMapping("/config/address")
  37 +public class AddressController extends BaseController {
  38 +
  39 + private String prefix = "config/address";
  40 +
  41 + @Resource
  42 + private AddressService addressService;
  43 +
  44 + @RequiresPermissions("config:address:view")
  45 + @GetMapping()
  46 + public String address() {
  47 + return prefix + "/address";
  48 + }
  49 +
  50 + /**
  51 + * 查询接口地址
  52 + */
  53 + @RequiresPermissions("config:address:list")
  54 + @Log(title = "配置-接口地址", operating = "查看接口地址", action = BusinessType.GRANT)
  55 + @PostMapping("/list")
  56 + @ResponseBody
  57 + public TableDataInfo list(Address address) {
  58 + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery();
  59 + PageDomain pageDomain = TableSupport.buildPageRequest();
  60 + Integer pageNum = pageDomain.getPageNum();
  61 + Integer pageSize = pageDomain.getPageSize();
  62 + lambdaQueryWrapper
  63 + .eq(StringUtils.isNotEmpty(address.getParam()), Address::getParam, address.getParam())
  64 + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode());
  65 +
  66 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
  67 + /*使用分页查询*/
  68 + Page<Address> page = new Page<>(pageNum, pageSize);
  69 + IPage<Address> iPage = addressService.page(page, lambdaQueryWrapper);
  70 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  71 + } else {
  72 + List<Address> list = addressService.list(lambdaQueryWrapper);
  73 + return getDataTable(list);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 新增接口地址
  79 + */
  80 + @GetMapping("/add")
  81 + public String add() {
  82 + return prefix + "/add";
  83 + }
  84 +
  85 + /**
  86 + * 新增保存接口地址
  87 + */
  88 + @RequiresPermissions("config:address:add")
  89 + @Log(title = "通用-接口地址", operating = "新增接口地址", action = BusinessType.INSERT)
  90 + @PostMapping("/add")
  91 + @ResponseBody
  92 + public AjaxResult addSave(Address address) {
  93 + address.setWarehouseCode(ShiroUtils.getWarehouseCode());
  94 + return toAjax(addressService.save(address));
  95 + }
  96 +
  97 + /**
  98 + * 修改接口地址
  99 + */
  100 + @GetMapping("/edit/{id}")
  101 + public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
  102 + mmap.put("address", addressService.getById(id));
  103 + return prefix + "/edit";
  104 + }
  105 +
  106 + /**
  107 + * 修改保存接口地址
  108 + */
  109 + @RequiresPermissions("config:address:edit")
  110 + @Log(title = "配置-接口地址", operating = "修改接口地址", action = BusinessType.UPDATE)
  111 + @PostMapping("/edit")
  112 + @ResponseBody
  113 + public AjaxResult editSave(Address address) {
  114 + return toAjax(addressService.updateById(address));
  115 + }
  116 +
  117 + /**
  118 + * 删除接口地址
  119 + */
  120 + @RequiresPermissions("config:address:remove")
  121 + @Log(title = "配置-接口地址", operating = "删除接口地址", action = BusinessType.DELETE)
  122 + @PostMapping( "/remove")
  123 + @ResponseBody
  124 + public AjaxResult remove(String ids) {
  125 + if (StringUtils.isEmpty(ids)){
  126 + return AjaxResult.error("id不能为空");
  127 + }
  128 + List<Integer> list = new ArrayList<>();
  129 + for (Integer id : Convert.toIntArray(ids)) {
  130 + list.add(id);
  131 + }
  132 + return toAjax(addressService.removeByIds(list));
  133 + }
  134 +}
... ...
src/main/java/com/huaheng/pc/config/address/domain/Address.java 0 → 100644
  1 +package com.huaheng.pc.config.address.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import io.swagger.annotations.ApiModel;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import lombok.Data;
  10 +
  11 +import java.io.Serializable;
  12 +
  13 +/**
  14 + * 接口地址
  15 + */
  16 +@ApiModel(value="com.huaheng.pc.config.address.domain.Address")
  17 +@Data
  18 +@TableName(value = "address")
  19 +public class Address implements Serializable {
  20 + /**
  21 + * 内部号
  22 + */
  23 + @TableId(value = "id", type = IdType.AUTO)
  24 + @ApiModelProperty(value="内部号")
  25 + private Integer id;
  26 +
  27 +
  28 + /**
  29 + * 仓库代码
  30 + */
  31 + @TableField(value = "warehouseCode")
  32 + @ApiModelProperty(value="仓库代码")
  33 + private String warehouseCode;
  34 +
  35 + /**
  36 + * 参数
  37 + */
  38 + @TableField(value = "param")
  39 + @ApiModelProperty(value="参数")
  40 + private String param;
  41 +
  42 + /**
  43 + * 接口地址
  44 + */
  45 + @TableField(value = "url")
  46 + @ApiModelProperty(value="接口地址")
  47 + private String url;
  48 +
  49 + public Integer getId() {
  50 + return id;
  51 + }
  52 +
  53 + public void setId(Integer id) {
  54 + this.id = id;
  55 + }
  56 +
  57 + public String getWarehouseCode() {
  58 + return warehouseCode;
  59 + }
  60 +
  61 + public void setWarehouseCode(String warehouseCode) {
  62 + this.warehouseCode = warehouseCode;
  63 + }
  64 +
  65 + public String getParam() {
  66 + return param;
  67 + }
  68 +
  69 + public void setParam(String param) {
  70 + this.param = param;
  71 + }
  72 +
  73 + public String getUrl() {
  74 + return url;
  75 + }
  76 +
  77 + public void setUrl(String url) {
  78 + this.url = url;
  79 + }
  80 +}
0 81 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java 0 → 100644
  1 +package com.huaheng.pc.config.address.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.config.address.domain.Address;
  5 +
  6 +public interface AddressMapper extends BaseMapper<Address> {
  7 +}
0 8 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/address/service/AddressService.java 0 → 100644
  1 +package com.huaheng.pc.config.address.service;
  2 +
  3 +import com.baomidou.mybatisplus.extension.service.IService;
  4 +import com.huaheng.pc.config.address.domain.Address;
  5 +
  6 +public interface AddressService extends IService<Address>{
  7 +
  8 +
  9 + String selectAddress(String param);
  10 +
  11 + /**
  12 + * 复制地址表
  13 + * @param warehouseCode 原仓库编码
  14 + * @param newWarehouseCode 新仓库编码
  15 + * @return 是否复制成功
  16 + */
  17 + Boolean addressCopy(String warehouseCode, String newWarehouseCode);
  18 +}
... ...
src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java 0 → 100644
  1 +package com.huaheng.pc.config.address.service;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.Wrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7 +import com.huaheng.common.exception.service.ServiceException;
  8 +import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.security.ShiroUtils;
  10 +import com.huaheng.pc.config.address.domain.Address;
  11 +import com.huaheng.pc.config.address.mapper.AddressMapper;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.List;
  15 +
  16 +@Service
  17 +public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
  18 +
  19 + @Override
  20 + public String selectAddress(String param) {
  21 + if(StringUtils.isEmpty(param)){
  22 + throw new ServiceException("参数为空");
  23 + }
  24 +
  25 + LambdaQueryWrapper<Address> addressLam = Wrappers.lambdaQuery();
  26 + addressLam.eq(Address::getParam,param)
  27 + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode());
  28 + Address address=this.getOne(addressLam);
  29 + if(address == null){
  30 + throw new ServiceException("参数错误,系统没有此参数对应的地址");
  31 + }
  32 + if(StringUtils.isEmpty(address.getUrl())){
  33 + throw new ServiceException("地址为空");
  34 + }
  35 + return address.getUrl();
  36 + }
  37 +
  38 + /**
  39 + * 复制地址表
  40 + * @param warehouseCode 原仓库编码
  41 + * @param newWarehouseCode 新仓库编码
  42 + * @return 是否复制成功
  43 + */
  44 + @Override
  45 + public Boolean addressCopy(String warehouseCode, String newWarehouseCode) {
  46 + log.trace("开始复制地址表");
  47 + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery();
  48 + lambdaQueryWrapper.eq(Address::getWarehouseCode, newWarehouseCode);
  49 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  50 + log.error("该仓库已存在");
  51 + return false;
  52 + }
  53 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  54 + lambdaQueryWrapper.eq(Address::getWarehouseCode, warehouseCode);
  55 + List<Address> addressList = this.list(lambdaQueryWrapper);
  56 +
  57 + for ( Address address : addressList) {
  58 + address.setId(null);
  59 + address.setWarehouseCode(newWarehouseCode);
  60 + }
  61 +
  62 + if ( this.saveBatch(addressList) ){
  63 + log.trace("复制地址表成功,新仓库编码是:"+newWarehouseCode);
  64 + return true;
  65 + } else {
  66 + return false;
  67 + }
  68 + }
  69 +}
... ...
src/main/java/com/huaheng/pc/config/company/mapper/CompanyMapper.java
... ... @@ -12,5 +12,6 @@ public interface CompanyMapper extends BaseMapper&lt;Company&gt; {
12 12  
13 13 List<Company> selectByWarehouseCode(Company company);
14 14  
  15 + List<Company> selectListEntityByEqual(Company condition);
15 16  
16 17 }
17 18 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/company/service/CompanyService.java
... ... @@ -18,4 +18,7 @@ public interface CompanyService extends IService&lt;Company&gt;{
18 18 public AjaxResult updateCompany(Company company);
19 19  
20 20 public List<Map<String, Object>> getCode();
  21 +
  22 + List<Company> selectListEntityByEqual(Company condition);
  23 +
21 24 }
... ...
src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
... ... @@ -100,10 +100,16 @@ public class CompanyServiceImpl extends ServiceImpl&lt;CompanyMapper, Company&gt; impl
100 100 return AjaxResult.success("更新成功!");
101 101 }
102 102  
  103 + @Override
103 104 public List<Map<String, Object>> getCode(){
104 105 LambdaQueryWrapper<Company> lambda = Wrappers.lambdaQuery();
105 106 lambda.select(Company::getCode, Company::getId, Company::getName)
106 107 .eq(Company::getWarehouseCode, ShiroUtils.getWarehouseCode());
107 108 return this.listMaps(lambda);
108 109 }
  110 +
  111 + @Override
  112 + public List<Company> selectListEntityByEqual(Company condition) {
  113 + return companyMapper.selectListEntityByEqual(condition);
  114 + }
109 115 }
... ...
src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java
... ... @@ -16,6 +16,8 @@ import com.huaheng.framework.web.page.TableDataInfo;
16 16 import com.huaheng.framework.web.page.TableSupport;
17 17 import com.huaheng.pc.config.configValue.domain.ConfigValue;
18 18 import com.huaheng.pc.config.configValue.service.ConfigValueService;
  19 +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
  20 +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService;
19 21 import io.swagger.annotations.Api;
20 22 import io.swagger.annotations.ApiOperation;
21 23 import io.swagger.annotations.ApiParam;
... ... @@ -35,6 +37,8 @@ public class ConfigValueController extends BaseController {
35 37  
36 38 @Resource
37 39 private ConfigValueService configValueService;
  40 + @Resource
  41 + private CycleCountPreferenceService cycleCountPreferenceService;
38 42  
39 43 private String prefix = "config/configValue";
40 44  
... ... @@ -96,6 +100,20 @@ public class ConfigValueController extends BaseController {
96 100 @PostMapping("/add")
97 101 @ResponseBody
98 102 public AjaxResult addSave(ConfigValue configValue) {
  103 + //检测盘点首选项是否停用
  104 + if(configValue.getRecordType().equals("cycleCountPreference")){
  105 + CycleCountPreference cycleCountPreferenceTemp = new CycleCountPreference();
  106 + cycleCountPreferenceTemp.setCode(configValue.getIdentifier());
  107 + cycleCountPreferenceTemp.setWarehouseCode(configValue.getWarehouseCode());
  108 + LambdaQueryWrapper<CycleCountPreference> preferenceLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountPreferenceTemp);
  109 + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(preferenceLambdaQueryWrapper);
  110 + if(cycleCountPreference == null){
  111 + return AjaxResult.error("盘点首选项编码错误,没有该条首选项!");
  112 + }
  113 + if(cycleCountPreference.getEnable() == false){
  114 + return AjaxResult.error("不能添加已停用的盘点首选项!");
  115 + }
  116 + }
99 117 configValue.setWarehouseCode(ShiroUtils.getWarehouseCode());
100 118 configValue.setCreatedBy(ShiroUtils.getLoginName());
101 119 configValue.setLastUpdatedBy(ShiroUtils.getLoginName());
... ...
src/main/java/com/huaheng/pc/config/configValue/service/ConfigValueService.java
1 1 package com.huaheng.pc.config.configValue.service;
2 2  
3   -import org.springframework.stereotype.Service;
4   -import javax.annotation.Resource;
5   -import java.util.List;
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 6 import com.huaheng.pc.config.configValue.domain.ConfigValue;
8 7 import com.huaheng.pc.config.configValue.mapper.ConfigValueMapper;
  8 +import org.springframework.stereotype.Service;
  9 +
  10 +import java.util.List;
9 11 @Service
10 12 public class ConfigValueService extends ServiceImpl<ConfigValueMapper, ConfigValue> {
11 13  
  14 + /**
  15 + * 复制系统参数配置表
  16 + * @param warehouseCode 原仓库编码
  17 + * @param newWarehouseCode 新仓库编码
  18 + * @return 是否复制成功
  19 + */
  20 + public boolean configValueCopy(String warehouseCode, String newWarehouseCode){
  21 + log.trace("开始复制系统参数配置表");
  22 + LambdaQueryWrapper<ConfigValue> lambdaQueryWrapper = Wrappers.lambdaQuery();
  23 + lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, newWarehouseCode);
  24 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  25 + log.error(newWarehouseCode+"仓库已存在");
  26 + return false;
  27 + }
  28 +
  29 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  30 + lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, warehouseCode);
  31 + List<ConfigValue> configValueList = this.list(lambdaQueryWrapper);
  32 +
  33 + for ( ConfigValue configValue : configValueList) {
  34 + configValue.setId(null);
  35 + configValue.setWarehouseCode(newWarehouseCode);
  36 + }
  37 +
  38 + if ( this.saveBatch(configValueList) ){
  39 + log.trace("复制系统参数配置表成功,新仓库编码是:"+newWarehouseCode);
  40 + return true;
  41 + } else {
  42 + return false;
  43 + }
  44 + }
12 45 }
... ...
src/main/java/com/huaheng/pc/config/configWarning/controller/ConfigWarningController.java 0 → 100644
  1 +package com.huaheng.pc.config.configWarning.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7 +import com.huaheng.common.support.Convert;
  8 +import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.security.ShiroUtils;
  10 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  11 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  12 +import com.huaheng.framework.web.controller.BaseController;
  13 +import com.huaheng.framework.web.domain.AjaxResult;
  14 +import com.huaheng.framework.web.page.PageDomain;
  15 +import com.huaheng.framework.web.page.TableDataInfo;
  16 +import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.config.company.service.CompanyService;
  18 +import com.huaheng.pc.config.configWarning.domain.ConfigWarning;
  19 +import com.huaheng.pc.config.configWarning.service.ConfigWarningService;
  20 +import io.swagger.annotations.Api;
  21 +import io.swagger.annotations.ApiOperation;
  22 +import io.swagger.annotations.ApiParam;
  23 +import org.apache.shiro.authz.annotation.RequiresPermissions;
  24 +import org.springframework.stereotype.Controller;
  25 +import org.springframework.ui.ModelMap;
  26 +import org.springframework.web.bind.annotation.*;
  27 +
  28 +import javax.annotation.Resource;
  29 +import java.util.ArrayList;
  30 +import java.util.Arrays;
  31 +import java.util.List;
  32 +
  33 +/**
  34 + * Created by Enzo Cotter on 2019/11/11.
  35 + * @author mahuandong
  36 + */
  37 +
  38 +@Api(tags = "预警配置")
  39 +@Controller
  40 +@RequestMapping("/config/configWarning")
  41 +public class ConfigWarningController extends BaseController {
  42 +
  43 + @Resource
  44 + private ConfigWarningService configWarningService;
  45 + @Resource
  46 + private CompanyService companyService;
  47 +
  48 + private String prefix = "/config/configWarning";
  49 +
  50 + @RequiresPermissions("config:configWarning:view")
  51 + @GetMapping()
  52 + public String configWarning() {
  53 + return prefix + "/configWarning";
  54 + }
  55 +
  56 + /**
  57 + * 查询预警配置
  58 + */
  59 + @ApiOperation(value="查看预警配置列表",
  60 + notes="根据编码、物料编码、仓库编码、 货主编码、创建时间获取库位的详细信息",
  61 + httpMethod = "POST")
  62 + @RequiresPermissions("config:configWarning:list")
  63 + @Log(title = "配置-预警配置", operating = "查看预警配置列表", action = BusinessType.GRANT)
  64 + @PostMapping("/list")
  65 + @ResponseBody
  66 + public TableDataInfo list(
  67 + @ApiParam(name="location",value="编码、物料编码、仓库编码、 货主编码、 类型") ConfigWarning configWarning,
  68 + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin,
  69 + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) {
  70 + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery();
  71 + PageDomain pageDomain = TableSupport.buildPageRequest();
  72 + Integer pageNum = pageDomain.getPageNum();
  73 + Integer pageSize = pageDomain.getPageSize();
  74 + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), ConfigWarning::getCreated, createdBegin)
  75 + .lt(StringUtils.isNotEmpty(createdEnd), ConfigWarning::getCreated, createdEnd)
  76 + .eq(StringUtils.isNotEmpty(configWarning.getCode()), ConfigWarning::getCode, configWarning.getCode())
  77 + .eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode())
  78 + .eq(StringUtils.isNotEmpty(configWarning.getCompanyCode()), ConfigWarning::getCompanyCode, configWarning.getCompanyCode())
  79 + .eq(StringUtils.isNotEmpty(configWarning.getMaterialCode()), ConfigWarning::getMaterialCode, configWarning.getMaterialCode())
  80 + .eq(StringUtils.isNotEmpty(configWarning.getMaterialName()), ConfigWarning::getMaterialName, configWarning.getMaterialName())
  81 + .like(StringUtils.isNotEmpty(configWarning.getEmail()), ConfigWarning::getEmail, configWarning.getEmail())
  82 + .eq(StringUtils.isNotEmpty(configWarning.getType()), ConfigWarning::getType, configWarning.getType());
  83 +
  84 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
  85 + /*使用分页查询*/
  86 + Page<ConfigWarning> page = new Page<>(pageNum, pageSize);
  87 + IPage<ConfigWarning> iPage = configWarningService.page(page, lambdaQueryWrapper);
  88 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  89 + } else {
  90 + List<ConfigWarning> list = configWarningService.list(lambdaQueryWrapper);
  91 + return getDataTable(list);
  92 + }
  93 + }
  94 +
  95 + /**
  96 + * 新增预警配置
  97 + */
  98 + @GetMapping("/add")
  99 + public String add(ModelMap modelMap) {
  100 + modelMap.put("list",companyService.list());
  101 + return prefix + "/add";
  102 + }
  103 +
  104 + /**
  105 + * 新增保存预警配置
  106 + */
  107 + @ApiOperation(value="新增预警配置", notes="新增预警配置", httpMethod = "POST")
  108 + @RequiresPermissions("config:configWarning:add")
  109 + @Log(title = "配置-预警配置", operating = "新增预警配置", action = BusinessType.INSERT)
  110 + @PostMapping("/add")
  111 + @ResponseBody
  112 + public AjaxResult addSave(ConfigWarning configWarning) {
  113 + return configWarningService.saveConfigWarning(configWarning);
  114 + }
  115 +
  116 + /**
  117 + * 修改预警配置
  118 + */
  119 + @GetMapping("/edit/{id}")
  120 + public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
  121 + ConfigWarning configWarning = configWarningService.getById(id);
  122 + mmap.put("configWarning", configWarning);
  123 + mmap.put("list",companyService.list());
  124 + return prefix + "/edit";
  125 + }
  126 +
  127 + /**
  128 + * 修改保存预警配置
  129 + */
  130 + @ApiOperation(value="修改预警配置", notes="修改预警配置", httpMethod = "POST")
  131 + @RequiresPermissions("config:configWarning:edit")
  132 + @Log(title = "配置-预警配置", operating = "修改预警配置", action = BusinessType.UPDATE)
  133 + @PostMapping("/edit")
  134 + @ResponseBody
  135 + public AjaxResult editSave(
  136 + @ApiParam(name = "Container", value = "预警配置实体", required = true) ConfigWarning configWarning) {
  137 + return configWarningService.updateConfigWarning(configWarning);
  138 + }
  139 +
  140 + /**
  141 + * 删除预警配置
  142 + */
  143 + @ApiOperation(value="删除预警配置", notes="根据id批量删除预警配置,参数示例1,2,3", httpMethod = "POST")
  144 + @RequiresPermissions("config:configWarning:remove")
  145 + @Log(title = "配置-预警配置", operating = "删除预警配置", action = BusinessType.DELETE)
  146 + @PostMapping( "/remove")
  147 + @ResponseBody
  148 + public AjaxResult remove(String ids) {
  149 + if (StringUtils.isEmpty(ids)){
  150 + return AjaxResult.error("id不能为空");
  151 + }
  152 + List<Integer> list = new ArrayList<>(Arrays.asList(Convert.toIntArray(ids)));
  153 +
  154 + return toAjax(configWarningService.removeByIds(list));
  155 + }
  156 +}
... ...
src/main/java/com/huaheng/pc/config/configWarning/domain/ConfigWarning.java 0 → 100644
  1 +package com.huaheng.pc.config.configWarning.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import io.swagger.annotations.ApiModel;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import java.io.Serializable;
  10 +import java.math.BigDecimal;
  11 +import java.util.Date;
  12 +import lombok.Data;
  13 +
  14 +/**
  15 + * Created by Enzo Cotter on 2019/11/11.
  16 + */
  17 +
  18 +@ApiModel(value = "com-huaheng-pc-config-configWarning-domain-ConfigWarning")
  19 +@Data
  20 +@TableName(value = "config_warning")
  21 +public class ConfigWarning implements Serializable {
  22 + @TableId(value = "id", type = IdType.INPUT)
  23 + @ApiModelProperty(value = "null")
  24 + private Integer id;
  25 +
  26 + /**
  27 + * 编码
  28 + */
  29 + @TableId(value = "code", type = IdType.INPUT)
  30 + @ApiModelProperty(value = "编码")
  31 + private String code;
  32 +
  33 + /**
  34 + * 类型
  35 + */
  36 + @TableField(value = "type")
  37 + @ApiModelProperty(value = "类型")
  38 + private String type;
  39 +
  40 + /**
  41 + * 仓库编码
  42 + */
  43 + @TableField(value = "warehouseCode")
  44 + @ApiModelProperty(value = "仓库编码")
  45 + private String warehouseCode;
  46 +
  47 + /**
  48 + * 货主编码
  49 + */
  50 + @TableField(value = "companyCode")
  51 + @ApiModelProperty(value = "货主编码")
  52 + private String companyCode;
  53 +
  54 + /**
  55 + * 物料编码
  56 + */
  57 + @TableField(value = "materialCode")
  58 + @ApiModelProperty(value = "物料编码")
  59 + private String materialCode;
  60 +
  61 + /**
  62 + * 物料名称
  63 + */
  64 + @TableField(value = "materialName")
  65 + @ApiModelProperty(value = "物料名称")
  66 + private String materialName;
  67 +
  68 + /**
  69 + * 物料规格
  70 + */
  71 + @TableField(value = "materialSpec")
  72 + @ApiModelProperty(value = "物料规格")
  73 + private String materialSpec;
  74 +
  75 + /**
  76 + * 物料单位
  77 + */
  78 + @TableField(value = "materialUnit")
  79 + @ApiModelProperty(value = "物料单位")
  80 + private String materialUnit;
  81 +
  82 + /**
  83 + * 最大
  84 + */
  85 + @TableField(value = "max")
  86 + @ApiModelProperty(value = "最大")
  87 + private BigDecimal max;
  88 +
  89 + /**
  90 + * 最小
  91 + */
  92 + @TableField(value = "min")
  93 + @ApiModelProperty(value = "最小")
  94 + private BigDecimal min;
  95 +
  96 + /**
  97 + * 备注
  98 + */
  99 + @TableField(value = "remark")
  100 + @ApiModelProperty(value = "备注")
  101 + private String remark;
  102 +
  103 + /**
  104 + * 创建时间
  105 + */
  106 + @TableField(value = "created")
  107 + @ApiModelProperty(value = "创建时间")
  108 + private Date created;
  109 +
  110 + /**
  111 + * 创建人
  112 + */
  113 + @TableField(value = "createdBy")
  114 + @ApiModelProperty(value = "创建人")
  115 + private String createdBy;
  116 +
  117 + /**
  118 + * 更新时间
  119 + */
  120 + @TableField(value = "lastUpdated")
  121 + @ApiModelProperty(value = "更新时间")
  122 + private Date lastUpdated;
  123 +
  124 + /**
  125 + * 更新人
  126 + */
  127 + @TableField(value = "lastUpdatedBy")
  128 + @ApiModelProperty(value = "更新人")
  129 + private String lastUpdatedBy;
  130 +
  131 + @TableField(value = "email")
  132 + @ApiModelProperty(value = "null")
  133 + private String email;
  134 +
  135 + private static final long serialVersionUID = 1L;
  136 +}
0 137 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/configWarning/mapper/ConfigWarningMapper.java 0 → 100644
  1 +package com.huaheng.pc.config.configWarning.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.config.configWarning.domain.ConfigWarning;
  5 +
  6 +/**
  7 + * Created by Enzo Cotter on 2019/11/11.
  8 + */
  9 +
  10 +public interface ConfigWarningMapper extends BaseMapper<ConfigWarning> {
  11 +}
0 12 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/configWarning/service/ConfigWarningService.java 0 → 100644
  1 +package com.huaheng.pc.config.configWarning.service;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.utils.security.ShiroUtils;
  6 +import com.huaheng.framework.web.domain.AjaxResult;
  7 +import com.huaheng.pc.config.location.domain.Location;
  8 +import com.huaheng.pc.config.location.service.LocationService;
  9 +import com.huaheng.pc.config.material.domain.Material;
  10 +import com.huaheng.pc.config.material.service.MaterialService;
  11 +import com.huaheng.pc.config.sendMail.domain.SendMail;
  12 +import com.huaheng.pc.config.sendMail.service.MailService;
  13 +import com.huaheng.pc.config.sendMail.service.SendMailService;
  14 +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
  15 +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
  16 +import com.huaheng.pc.system.user.domain.User;
  17 +import com.huaheng.pc.system.user.service.IUserService;
  18 +import com.huaheng.pc.system.user.service.UserServiceImpl;
  19 +import org.aspectj.weaver.loadtime.Aj;
  20 +import org.springframework.stereotype.Service;
  21 +import javax.annotation.Resource;
  22 +import java.math.BigDecimal;
  23 +import java.util.ArrayList;
  24 +import java.util.Date;
  25 +import java.util.List;
  26 +import java.util.Map;
  27 +
  28 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  29 +import com.huaheng.pc.config.configWarning.domain.ConfigWarning;
  30 +import com.huaheng.pc.config.configWarning.mapper.ConfigWarningMapper;
  31 +import org.springframework.transaction.annotation.Transactional;
  32 +
  33 +/**
  34 + * Created by Enzo Cotter on 2019/11/11.
  35 + */
  36 +
  37 +@Service
  38 +public class ConfigWarningService extends ServiceImpl<ConfigWarningMapper, ConfigWarning> {
  39 +
  40 + @Resource
  41 + private MaterialService materialService;
  42 + @Resource
  43 + private SendMailService sendMailService;
  44 + @Resource
  45 + private InventoryDetailService inventoryDetailService;
  46 + @Resource
  47 + private MailService mailService;
  48 + @Resource
  49 + private LocationService locationService;
  50 +
  51 + /**
  52 + * 保存预警配置
  53 + * @param configWarning
  54 + * @return
  55 + */
  56 + @Transactional(rollbackFor = SecurityException.class)
  57 + public AjaxResult saveConfigWarning(ConfigWarning configWarning){
  58 + /* 设置仓库编码*/
  59 + configWarning.setWarehouseCode(ShiroUtils.getWarehouseCode());
  60 +
  61 + /* 设置物料信息*/
  62 + if (configWarning.getMaterialCode() != null){
  63 + Material material = materialService.findAllByCode(configWarning.getMaterialCode());
  64 + configWarning.setMaterialName(material.getName());
  65 + configWarning.setMaterialSpec(material.getSpec());
  66 + configWarning.setMaterialUnit(material.getUnit());
  67 + }
  68 +
  69 + /* 设置创建人、更新人*/
  70 + configWarning.setCreatedBy(ShiroUtils.getLoginName());
  71 + configWarning.setLastUpdatedBy(ShiroUtils.getLoginName());
  72 +
  73 + /* 保存*/
  74 + if (!save(configWarning)){
  75 + throw new SecurityException("保存配置信息失败");
  76 + }
  77 + return AjaxResult.success("");
  78 + }
  79 +
  80 + /**
  81 + * 保存预警配置
  82 + * @param configWarning
  83 + * @return
  84 + */
  85 + @Transactional(rollbackFor = SecurityException.class)
  86 + public AjaxResult updateConfigWarning(ConfigWarning configWarning){
  87 +
  88 + /* 设置物料信息*/
  89 + if (configWarning.getMaterialCode() != null){
  90 + Material material = materialService.findAllByCode(configWarning.getMaterialCode());
  91 + configWarning.setMaterialName(material.getName());
  92 + configWarning.setMaterialSpec(material.getSpec());
  93 + configWarning.setMaterialUnit(material.getUnit());
  94 + }
  95 +
  96 + /* 设置更新人*/
  97 + configWarning.setLastUpdatedBy(ShiroUtils.getLoginName());
  98 +
  99 + if (!updateById(configWarning)){
  100 + throw new SecurityException("修改配置信息失败");
  101 + }
  102 + return AjaxResult.success("");
  103 + }
  104 +
  105 + /**
  106 + * 物料预警
  107 + * @param map 任务明细
  108 + */
  109 + public void materialWarning(String materialCode, String materialName){
  110 + /* 查询预警配置*/
  111 + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery();
  112 + lambdaQueryWrapper.eq(ConfigWarning::getMaterialCode, materialCode)
  113 + .eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode())
  114 + .eq(ConfigWarning::getType, 0);
  115 + ConfigWarning configWarning = this.getOne(lambdaQueryWrapper);
  116 +
  117 + /* 当预警配置存在时*/
  118 + if (configWarning != null) {
  119 + String[] emailArray = configWarning.getEmail().split(";");
  120 + /* 收件人*/
  121 + String[] to = {emailArray[0]};
  122 + /* 抄送人*/
  123 + List<String> ccList = new ArrayList<>();
  124 + for (int i = 1; i < emailArray.length; i++) {
  125 + ccList.add(emailArray[i]);
  126 + }
  127 + String[] cc = ccList.toArray(new String[0]);
  128 +
  129 + InventoryDetail inventoryDetail = new InventoryDetail();
  130 + inventoryDetail.setWarehouseCode(ShiroUtils.getWarehouseCode());
  131 + inventoryDetail.setMaterialCode(materialCode);
  132 + inventoryDetail.setInventorySts("good");
  133 + inventoryDetail.setCompanyCode(configWarning.getCompanyCode());
  134 + BigDecimal sum = inventoryDetailService.getSumQty(inventoryDetail);
  135 + SendMail sendMail = new SendMail();
  136 + sendMail.setWarehouseCode(ShiroUtils.getWarehouseCode());
  137 + sendMail.setCompanyCode(configWarning.getCompanyCode());
  138 + sendMail.setType(0);
  139 + sendMail.setEmail(configWarning.getEmail());
  140 + sendMail.setAlarmTime(new Date());
  141 + if (sum.compareTo(configWarning.getMax()) == 1) {
  142 + sendMail.setTitle(materialName + "超过最大库存");
  143 + sendMail.setBody(materialName + "超过最大库存,当前数量为" + sum);
  144 + if (!sendMailService.save(sendMail)) {
  145 + throw new SecurityException("保存失败");
  146 + }
  147 + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc);
  148 + sendMail.setEnable(resultMail);
  149 + if (!sendMailService.updateById(sendMail)) {
  150 + throw new SecurityException("更新失败");
  151 + }
  152 + } else if (sum.compareTo(configWarning.getMin()) == -1) {
  153 + sendMail.setTitle(materialName + "低于最低库存");
  154 + sendMail.setBody(materialName + "低于最低库存,当前数量为" + sum);
  155 + if (!sendMailService.save(sendMail)) {
  156 + throw new SecurityException("保存失败");
  157 + }
  158 + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc);
  159 + sendMail.setEnable(resultMail);
  160 + if (!sendMailService.updateById(sendMail)) {
  161 + throw new SecurityException("更新失败");
  162 + }
  163 + }
  164 + }
  165 + }
  166 +
  167 + /**
  168 + * 空库位剩余数量预警
  169 + */
  170 + public void emptyLocationWarning(){
  171 + /* 查询预警配置*/
  172 + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery();
  173 + lambdaQueryWrapper.eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode())
  174 + .eq(ConfigWarning::getType, 1);
  175 + ConfigWarning configWarning = this.getOne(lambdaQueryWrapper);
  176 + /* 当预警配置存在时*/
  177 + if (configWarning != null) {
  178 + String[] emailArray = configWarning.getEmail().split(";");
  179 + /* 收件人*/
  180 + String[] to = {emailArray[0]};
  181 + /* 抄送人*/
  182 + List<String> ccList = new ArrayList<>();
  183 + for (int i = 1; i < emailArray.length; i++) {
  184 + ccList.add(emailArray[i]);
  185 + }
  186 + String[] cc = ccList.toArray(new String[0]);
  187 +
  188 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
  189 + locationLambda.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
  190 + .eq(Location::getStatus, "empty");
  191 + BigDecimal sum = new BigDecimal(locationService.list(locationLambda).size());
  192 + SendMail sendMail = new SendMail();
  193 + sendMail.setWarehouseCode(ShiroUtils.getWarehouseCode());
  194 + sendMail.setType(1);
  195 + sendMail.setEmail(configWarning.getEmail());
  196 + sendMail.setAlarmTime(new Date());
  197 + if (sum.compareTo(configWarning.getMin()) == -1) {
  198 + sendMail.setTitle("空库位剩余"+sum+"个");
  199 + sendMail.setBody("空库位剩余"+sum+"个");
  200 + if (!sendMailService.save(sendMail)) {
  201 + throw new SecurityException("保存失败");
  202 + }
  203 + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc);
  204 + sendMail.setEnable(resultMail);
  205 + if (!sendMailService.updateById(sendMail)) {
  206 + throw new SecurityException("更新失败");
  207 + }
  208 + }
  209 + }
  210 + }
  211 +}
  212 +
... ...
src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeService.java
... ... @@ -11,7 +11,15 @@ import java.util.Map;
11 11 @Service("containerType")
12 12 public interface ContainerTypeService extends IService<ContainerType>{
13 13  
14   - public Boolean checkConfig(String code);
  14 + Boolean checkConfig(String code);
15 15  
16   - public List<Map<String, Object>> getCode();
  16 + List<Map<String, Object>> getCode();
  17 +
  18 + /**
  19 + * 复制容器类型表
  20 + * @param warehouseCode 原仓库编码
  21 + * @param newWarehouseCode 新仓库编码
  22 + * @return 是否复制成功
  23 + */
  24 + boolean containerTypeCopy(String warehouseCode, String newWarehouseCode);
17 25 }
... ...
src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeServiceImpl.java
... ... @@ -4,14 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.huaheng.common.utils.security.ShiroUtils;
6 6 import org.springframework.stereotype.Service;
7   -import javax.annotation.Resource;
  7 +
8 8 import java.util.List;
9 9 import java.util.Map;
10 10  
11 11 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12 12 import com.huaheng.pc.config.containerType.domain.ContainerType;
13 13 import com.huaheng.pc.config.containerType.mapper.ContainerTypeMapper;
14   -import com.huaheng.pc.config.containerType.service.ContainerTypeService;
  14 +
15 15 @Service("containerType")
16 16 public class ContainerTypeServiceImpl extends ServiceImpl<ContainerTypeMapper, ContainerType> implements ContainerTypeService{
17 17  
... ... @@ -33,4 +33,37 @@ public class ContainerTypeServiceImpl extends ServiceImpl&lt;ContainerTypeMapper, C
33 33 return result;
34 34 }
35 35  
  36 + /**
  37 + * 复制容器类型表
  38 + *
  39 + * @param warehouseCode 原仓库编码
  40 + * @param newWarehouseCode 新仓库编码
  41 + * @return 是否复制成功
  42 + */
  43 + @Override
  44 + public boolean containerTypeCopy(String warehouseCode, String newWarehouseCode) {
  45 + log.trace("开始复制容器类型表");
  46 + LambdaQueryWrapper<ContainerType> lambdaQueryWrapper = Wrappers.lambdaQuery();
  47 + lambdaQueryWrapper.eq(ContainerType::getWarehouseCode, newWarehouseCode);
  48 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  49 + log.error(newWarehouseCode+"仓库已存在");
  50 + return false;
  51 + }
  52 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  53 + lambdaQueryWrapper.eq(ContainerType::getWarehouseCode, warehouseCode);
  54 + List<ContainerType> containerTypeList = this.list(lambdaQueryWrapper);
  55 +
  56 + for ( ContainerType configValue : containerTypeList) {
  57 + configValue.setId(null);
  58 + configValue.setWarehouseCode(newWarehouseCode);
  59 + }
  60 +
  61 + if ( this.saveBatch(containerTypeList) ){
  62 + log.trace("复制容器类型成功,新仓库编码是:"+newWarehouseCode);
  63 + return true;
  64 + } else {
  65 + return false;
  66 + }
  67 + }
  68 +
36 69 }
... ...
src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java
... ... @@ -14,12 +14,10 @@ import com.huaheng.framework.web.domain.AjaxResult;
14 14 import com.huaheng.framework.web.page.PageDomain;
15 15 import com.huaheng.framework.web.page.TableDataInfo;
16 16 import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.config.configValue.domain.ConfigValue;
  18 +import com.huaheng.pc.config.configValue.service.ConfigValueService;
17 19 import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
18 20 import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService;
19   -import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference;
20   -import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
21   -import io.swagger.annotations.ApiOperation;
22   -import io.swagger.annotations.ApiParam;
23 21 import org.apache.shiro.authz.annotation.RequiresPermissions;
24 22 import org.springframework.stereotype.Controller;
25 23 import org.springframework.ui.ModelMap;
... ... @@ -36,10 +34,14 @@ public class cycleCountPreferenceController extends BaseController {
36 34  
37 35 @Resource
38 36 private CycleCountPreferenceService cycleCountPreferenceService;
  37 + @Resource
  38 + private ConfigValueService configValueService;
39 39  
40 40  
41 41 private String prefix = "config/cycleCountPreference";
42 42  
  43 +
  44 + @RequiresPermissions("config:cycleCountPreference:view")
43 45 @GetMapping()
44 46 public String cyclecountHeader()
45 47 {
... ... @@ -49,7 +51,7 @@ public class cycleCountPreferenceController extends BaseController {
49 51 /**
50 52 * 查询盘点单主列表
51 53 */
52   - //@RequiresPermissions("inventory:cycleCount:list")
  54 + @RequiresPermissions("config:cycleCountPreference:list")
53 55 @PostMapping("/list")
54 56 @Log(title = "配置-库存配置",operating = "盘点首选项", action = BusinessType.GRANT)
55 57 @ResponseBody
... ... @@ -65,9 +67,11 @@ public class cycleCountPreferenceController extends BaseController {
65 67 .le(StringUtils.isNotEmpty(createdEnd), CycleCountPreference::getCreated, createdEnd)//创建时间范围
66 68 .eq(CycleCountPreference::getWarehouseCode, ShiroUtils.getWarehouseCode()) //仓库
67 69 .eq(StringUtils.isNotEmpty(cycleCountPreference.getCode()), CycleCountPreference::getCode, cycleCountPreference.getCode())//首选项编码
68   - .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLocation()),CycleCountPreference::getPromptLocation,cycleCountPreference.getPromptLocation())//提示货位
  70 +
  71 + /*.eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLocation()),CycleCountPreference::getPromptLocation,cycleCountPreference.getPromptLocation())//提示货位
69 72 .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLpn()),CycleCountPreference::getPromptLpn,cycleCountPreference.getPromptLpn())//提示PLN
70 73 .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptItem()),CycleCountPreference::getPromptItem,cycleCountPreference.getPromptItem())//提示物料
  74 + */
71 75 .eq(StringUtils.isNotEmpty(cycleCountPreference.getLastUpdatedBy()),CycleCountPreference::getLastUpdatedBy,cycleCountPreference.getLastUpdatedBy())//更新人
72 76 .eq(StringUtils.isNotEmpty(cycleCountPreference.getCreatedBy()),CycleCountPreference::getCreatedBy,cycleCountPreference.getCreatedBy())//创建人
73 77  
... ... @@ -96,17 +100,15 @@ public class cycleCountPreferenceController extends BaseController {
96 100 /**
97 101 * 新增保存盘点首选项
98 102 */
99   - //@RequiresPermissions("config:receiptPreference:add")
  103 + @RequiresPermissions("config:cycleCountPreference:add")
100 104 @Log(title = "配置-盘点首选项", operating = "新增盘点首选项", action = BusinessType.INSERT)
101 105 @PostMapping("/addSave")
102 106 @ResponseBody
103 107 public AjaxResult addSave(CycleCountPreference cycleCountPreference) {
104   - cycleCountPreference.setWarehouseCode(ShiroUtils.getWarehouseCode());
105   - cycleCountPreference.setCreatedBy(ShiroUtils.getLoginName());
106   - cycleCountPreference.setCreated(new Date());
107   - cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName());
108   -
109   - return toAjax(cycleCountPreferenceService.save(cycleCountPreference));
  108 + if(cycleCountPreference == null){
  109 + return AjaxResult.error("新增数据不能为空!");
  110 + }
  111 + return cycleCountPreferenceService.addSave(cycleCountPreference);
110 112 }
111 113  
112 114 /**
... ... @@ -121,11 +123,24 @@ public class cycleCountPreferenceController extends BaseController {
121 123 /**
122 124 * 修改保存盘点首选项
123 125 */
124   - //@RequiresPermissions("config:receiptPreference:edit")
  126 + @RequiresPermissions("config:cycleCountPreference:edit")
125 127 @Log(title = "通用-盘点首选项", operating = "修改盘点首选项", action = BusinessType.UPDATE)
126 128 @PostMapping("/edit")
127 129 @ResponseBody
128 130 public AjaxResult editSave(CycleCountPreference cycleCountPreference) {
  131 + //不允许在被配置默认使用的情况先停用首选项
  132 + if(cycleCountPreference.getEnable() == false){
  133 + ConfigValue configValueTemp = new ConfigValue();
  134 + configValueTemp.setModuleType("cyclecount");
  135 + configValueTemp.setWarehouseCode(cycleCountPreference.getWarehouseCode());
  136 + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValueTemp);
  137 + ConfigValue configValue = configValueService.getOne(configValueLambdaQueryWrapper);
  138 + if(configValue != null){
  139 + if(configValue.getIdentifier().equals(cycleCountPreference.getCode())){
  140 + return AjaxResult.error("该盘点首选项为系统配置默认选项,请删除系统配置中的选项再停用,修改失败!");
  141 + }
  142 + }
  143 + }
129 144 cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName());
130 145 cycleCountPreference.setLastUpdated(new Date());
131 146 return toAjax(cycleCountPreferenceService.updateById(cycleCountPreference));
... ... @@ -134,7 +149,7 @@ public class cycleCountPreferenceController extends BaseController {
134 149 /**
135 150 * 删除盘点首选项
136 151 */
137   - //@RequiresPermissions("config:receiptPreference:remove")
  152 + @RequiresPermissions("config:cycleCountPreference:remove")
138 153 @Log(title = "通用-盘点首选项", operating = "删除盘点首选项", action = BusinessType.DELETE)
139 154 @PostMapping( "/remove")
140 155 @ResponseBody
... ... @@ -144,6 +159,18 @@ public class cycleCountPreferenceController extends BaseController {
144 159 }
145 160 List<Integer> list = new ArrayList<>();
146 161 for (Integer id : Convert.toIntArray(ids)) {
  162 + //校验该首选项是否在使用
  163 + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getById(id);
  164 + ConfigValue configValueTemp = new ConfigValue();
  165 + configValueTemp.setModuleType("cyclecount");
  166 + configValueTemp.setWarehouseCode(cycleCountPreference.getWarehouseCode());
  167 + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValueTemp);
  168 + ConfigValue configValue = configValueService.getOne(configValueLambdaQueryWrapper);
  169 + if(configValue != null){
  170 + if(configValue.getIdentifier().equals(cycleCountPreference.getCode())){
  171 + return AjaxResult.error("该盘点首选项为系统配置默认选项,请删除系统配置中的选项再删除,删除失败!");
  172 + }
  173 + }
147 174 list.add(id);
148 175 }
149 176 return toAjax(cycleCountPreferenceService.removeByIds(list));
... ...
src/main/java/com/huaheng/pc/config/cycleCountPreference/domain/CycleCountPreference.java
... ... @@ -48,41 +48,41 @@ public class CycleCountPreference implements Serializable {
48 48 */
49 49 @TableField(value = "promptLocation")
50 50 @ApiModelProperty(value="系统提示货位")
51   - private String promptLocation;
  51 + private Boolean promptLocation;
52 52  
53 53 /**
54   - * 系统提示LPN
  54 + * 系统提示容器
55 55 */
56 56 @TableField(value = "promptLpn")
57   - @ApiModelProperty(value="系统提示LPN")
58   - private String promptLpn;
  57 + @ApiModelProperty(value="系统提示容器")
  58 + private Boolean promptLpn;
59 59  
60 60 /**
61 61 * 系统提示物料
62 62 */
63 63 @TableField(value = "promptItem")
64 64 @ApiModelProperty(value="系统提示物料")
65   - private String promptItem;
  65 + private Boolean promptItem;
66 66  
67 67 /**
68 68 * 显示库存数量
69 69 */
70 70 @TableField(value = "promptQuantity")
71 71 @ApiModelProperty(value="显示库存数量")
72   - private Integer promptQuantity;
  72 + private Boolean promptQuantity;
73 73  
74 74 /**
75 75 * 允许添加库存
76 76 */
77 77 @TableField(value = "allowAddNewInventory")
78 78 @ApiModelProperty(value="允许添加库存")
79   - private Integer allowAddNewInventory;
  79 + private Boolean allowAddNewInventory;
80 80  
81 81 /**
82 82 * 有效
83 83 */
84   - @TableField(value = "Enable")
85   - @ApiModelProperty(value="有效")
  84 + @TableField(value = "enable")
  85 + @ApiModelProperty(value="是否有效")
86 86 private Boolean enable;
87 87  
88 88 /**
... ... @@ -153,7 +153,7 @@ public class CycleCountPreference implements Serializable {
153 153 */
154 154 @TableField(value = "countByPiece")
155 155 @ApiModelProperty(value="RF逐件盘点")
156   - private Integer countByPiece;
  156 + private Boolean countByPiece;
157 157  
158 158 private static final long serialVersionUID = 1L;
159 159 }
160 160 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/cycleCountPreference/service/CycleCountPreferenceService.java
1 1 package com.huaheng.pc.config.cycleCountPreference.service;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.utils.security.ShiroUtils;
  6 +import com.huaheng.framework.web.domain.AjaxResult;
  7 +import com.huaheng.pc.config.containerType.domain.ContainerType;
  8 +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
  9 +import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService;
  10 +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
3 11 import org.springframework.stereotype.Service;
4 12 import javax.annotation.Resource;
  13 +import java.text.SimpleDateFormat;
  14 +import java.util.Date;
5 15 import java.util.List;
6 16 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 17 import com.huaheng.pc.config.cycleCountPreference.mapper.CycleCountPreferenceMapper;
8 18 import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
  19 +import org.springframework.transaction.annotation.Transactional;
  20 +
9 21 @Service
10 22 public class CycleCountPreferenceService extends ServiceImpl<CycleCountPreferenceMapper, CycleCountPreference> {
11 23  
  24 + /**
  25 + *新增盘点首选项
  26 + * @param cycleCountPreference
  27 + * @return
  28 + */
  29 + @Transactional
  30 + public AjaxResult addSave (CycleCountPreference cycleCountPreference){
  31 +
  32 + cycleCountPreference.setCode(newCode());
  33 + cycleCountPreference.setWarehouseCode(ShiroUtils.getWarehouseCode());
  34 + cycleCountPreference.setCreatedBy(ShiroUtils.getLoginName());
  35 + cycleCountPreference.setCreated(new Date());
  36 + cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName());
  37 + this.save(cycleCountPreference);
  38 + return AjaxResult.success("新增完成!");
  39 + }
  40 +
  41 +
  42 + /**
  43 + * 自动生成盘点首选项Code
  44 + * 使用特定字段和ID组合成Code
  45 + */
  46 + public String newCode(){
  47 + //先查询前一个ID生成当前的数字,再拼接
  48 + String code = null;
  49 + Date now = new Date();
  50 + SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
  51 + LambdaQueryWrapper<CycleCountPreference> lambda = Wrappers.lambdaQuery();
  52 + lambda.select(CycleCountPreference::getCode)
  53 + .orderByDesc(CycleCountPreference::getId).last("Limit 1");
  54 + // code = ccp + 日期 + (排序号 + 1)
  55 + String maxCode = null;
  56 + CycleCountPreference cycleCountPreference = this.getOne(lambda);
  57 + if ( cycleCountPreference != null){
  58 + maxCode = this.getOne(lambda).getCode();
  59 + }
  60 + if (maxCode != null && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) {
  61 + Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5 ));
  62 + code = "ccp" + df.format(now) + String.format("%05d", Count + 1);
  63 + } else {
  64 + code = "ccp" + df.format(now) +"00001";
  65 + }
  66 + return code;
  67 + }
  68 +
  69 + /**
  70 + * 复制盘点首选项表
  71 + *
  72 + * @param warehouseCode 原仓库编码
  73 + * @param newWarehouseCode 新仓库编码
  74 + * @return 是否复制成功
  75 + */
  76 + public boolean cycleCountPreferenceCopy(String warehouseCode, String newWarehouseCode) {
  77 + log.trace("开始复盘点首选项表");
  78 + LambdaQueryWrapper<CycleCountPreference> lambdaQueryWrapper = Wrappers.lambdaQuery();
  79 + lambdaQueryWrapper.eq(CycleCountPreference::getWarehouseCode, newWarehouseCode);
  80 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  81 + log.error(newWarehouseCode+"仓库已存在");
  82 + return false;
  83 + }
  84 +
  85 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  86 + lambdaQueryWrapper.eq(CycleCountPreference::getWarehouseCode, warehouseCode);
  87 + List<CycleCountPreference> cycleCountPreferenceList = this.list(lambdaQueryWrapper);
  88 +
  89 + for ( CycleCountPreference countPreference : cycleCountPreferenceList) {
  90 + countPreference.setId(null);
  91 + countPreference.setWarehouseCode(newWarehouseCode);
  92 + }
  93 +
  94 + if ( this.saveBatch(cycleCountPreferenceList) ){
  95 + log.trace("复制盘点首选项表成功,新仓库编码是:"+newWarehouseCode);
  96 + return true;
  97 + } else {
  98 + return false;
  99 + }
  100 + }
  101 +
  102 +
  103 +
  104 +
  105 +
  106 +
  107 +
  108 +
12 109 }
... ...
src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
... ... @@ -15,16 +15,25 @@ import com.huaheng.framework.web.page.PageDomain;
15 15 import com.huaheng.framework.web.page.TableDataInfo;
16 16 import com.huaheng.framework.web.page.TableSupport;
17 17 import com.huaheng.pc.config.location.domain.Location;
  18 +import com.huaheng.pc.config.location.domain.LocationStatus;
18 19 import com.huaheng.pc.config.location.service.LocationService;
  20 +import com.huaheng.pc.config.material.domain.Material;
  21 +import com.huaheng.pc.config.material.service.MaterialService;
  22 +import com.huaheng.pc.config.materialType.service.MaterialTypeService;
  23 +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
  24 +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
  25 +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader;
19 26 import io.swagger.annotations.Api;
20 27 import io.swagger.annotations.ApiOperation;
21 28 import io.swagger.annotations.ApiParam;
  29 +import io.swagger.models.auth.In;
22 30 import org.apache.shiro.authz.annotation.RequiresPermissions;
23 31 import org.springframework.stereotype.Controller;
24 32 import org.springframework.ui.ModelMap;
25 33 import org.springframework.web.bind.annotation.*;
26 34  
27 35 import javax.annotation.Resource;
  36 +import java.util.ArrayList;
28 37 import java.util.List;
29 38  
30 39 @Api(tags={"库位操作类"})
... ... @@ -36,6 +45,10 @@ public class LocationController extends BaseController {
36 45  
37 46 @Resource
38 47 private LocationService locationService;
  48 + @Resource
  49 + private InventoryDetailService inventoryDetailService;
  50 + @Resource
  51 + private MaterialService materialService;
39 52  
40 53 @RequiresPermissions("config:location:view")
41 54 @GetMapping()
... ... @@ -89,6 +102,21 @@ public class LocationController extends BaseController {
89 102 }
90 103  
91 104 /**
  105 + * 查询库位列表
  106 + */
  107 + @Log(title = "通用-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
  108 + @PostMapping("/getAllLocation")
  109 + @ResponseBody
  110 + public AjaxResult getAllLocation(String type) {
  111 + if (StringUtils.isEmpty(type)) {
  112 + return AjaxResult.error("type不能为空");
  113 + }
  114 +
  115 + return AjaxResult.success(locationService.getAllLocation(type));
  116 + }
  117 +
  118 +
  119 + /**
92 120 * 新增库位
93 121 */
94 122 @GetMapping("/add")
... ... @@ -123,7 +151,7 @@ public class LocationController extends BaseController {
123 151 /**
124 152 * 批量新增保存库位
125 153 */
126   - @RequiresPermissions("config:location:add")
  154 + @RequiresPermissions("config:location:addBatch")
127 155 @ApiOperation(value="新增库位", notes="批量新增库位", httpMethod = "POST")
128 156 @Log(title = "通用-库位管理", operating = "新增库位", action = BusinessType.INSERT)
129 157 @PostMapping("/addBatchSave")
... ... @@ -163,8 +191,9 @@ public class LocationController extends BaseController {
163 191 @PostMapping( "/remove")
164 192 @ResponseBody
165 193 public AjaxResult remove(String ids) {
166   - if (StringUtils.isEmpty(ids))
  194 + if (StringUtils.isEmpty(ids)){
167 195 return AjaxResult.error("id不能为空");
  196 + }
168 197 for (Integer id : Convert.toIntArray(ids)) {
169 198 Location location = locationService.getById(id);
170 199 if (StringUtils.isEmpty(location.getContainerCode())) {
... ... @@ -178,4 +207,108 @@ public class LocationController extends BaseController {
178 207 }
179 208 return AjaxResult.success("删除成功!");
180 209 }
  210 +
  211 + /**
  212 + * 查询库位列表
  213 + */
  214 + @Log(title = "通用-库位管理", operating = "查看库位列表", action = BusinessType.GRANT)
  215 + @PostMapping("/getLocationInfo")
  216 + @ResponseBody
  217 + public AjaxResult getLocationInfo(String type, String row, String line, String layer, String grid) {
  218 + if (StringUtils.isEmpty(type)) {
  219 + return AjaxResult.error("type不能为空");
  220 + }
  221 +
  222 + /* 查询库位信息*/
  223 + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
  224 + locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row)
  225 + .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line)
  226 + .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer)
  227 + .eq(Location::getIGrid, 1)
  228 + .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type)
  229 + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
  230 + .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type);
  231 + List<Location> locations = locationService.list(locationLambdaQueryWrapper);
  232 + List<Location> locationList = new ArrayList<>();
  233 +
  234 + /* 查询库存明细*/
  235 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery();
  236 + inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
  237 + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda);
  238 +
  239 + LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery();
  240 + materialLambda.eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode());
  241 + List<Material> materialList = materialService.list(materialLambda);
  242 +
  243 + for(Location location1 : locations) {
  244 + InventoryDetail inventoryDetail = null;
  245 + String materialName = null;
  246 + for (InventoryDetail inventoryDetail2: inventoryDetailList) {
  247 + if (location1.getCode().equals(inventoryDetail2.getLocationCode())){
  248 + inventoryDetail = inventoryDetail2;
  249 + }
  250 + }
  251 + if (inventoryDetail != null){
  252 + for (Material material : materialList) {
  253 + if (material.getCode().equals(inventoryDetail.getMaterialCode())){
  254 + materialName = material.getName();
  255 + break;
  256 + }
  257 + }
  258 + }
  259 +
  260 + int userDef3 = 0;
  261 + String status = location1.getStatus();
  262 + String containerCode = location1.getContainerCode();
  263 + if (status.equals("empty")) {
  264 + if(StringUtils.isEmpty(containerCode)) {
  265 + userDef3 = LocationStatus.IDLE_EMPTY_LOCATION;
  266 + } else {
  267 + if(inventoryDetail == null) {
  268 + userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER;
  269 + } else {
  270 + location1.setMaterialName(materialName);
  271 + location1.setMaterialCode(inventoryDetail.getMaterialCode());
  272 + location1.setBatch(inventoryDetail.getBatch());
  273 + location1.setQty(String.valueOf(inventoryDetail.getQty()));
  274 + userDef3 = LocationStatus.IDLE_FULL_CONTAINER;
  275 + }
  276 + }
  277 + } else if(status.equals("lock")) {
  278 + if(StringUtils.isEmpty(containerCode)) {
  279 + userDef3 = LocationStatus.LOCK_EMPTY_LOCATION;
  280 + } else {
  281 + if(inventoryDetail == null) {
  282 + userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER;
  283 + } else {
  284 + location1.setMaterialName(materialName);
  285 + location1.setMaterialCode(inventoryDetail.getMaterialCode());
  286 + location1.setBatch(inventoryDetail.getBatch());
  287 + location1.setQty(String.valueOf(inventoryDetail.getQty()));
  288 + userDef3 = LocationStatus.LOCK_FULL_CONTAINER;
  289 + }
  290 + }
  291 + }
  292 +
  293 + if (location1.getDeleted()) {
  294 + if(StringUtils.isEmpty(containerCode)) {
  295 + userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION;
  296 + } else {
  297 + if(inventoryDetail == null) {
  298 + userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER;
  299 + } else {
  300 + location1.setMaterialName(materialName);
  301 + location1.setMaterialCode(inventoryDetail.getMaterialCode());
  302 + location1.setBatch(inventoryDetail.getBatch());
  303 + location1.setQty(String.valueOf(inventoryDetail.getQty()));
  304 + userDef3 = LocationStatus.DISABLE_FULL_CONTAINER;
  305 + }
  306 + }
  307 + }
  308 +
  309 + location1.setUserDef3(String.valueOf(userDef3));
  310 + locationList.add(location1);
  311 + }
  312 + return AjaxResult.success(locations);
  313 + }
181 314 }
... ...
src/main/java/com/huaheng/pc/config/location/domain/Location.java
... ... @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
7 7 import java.io.Serializable;
8 8 import java.util.Date;
9 9 import lombok.Data;
  10 +import org.springframework.transaction.annotation.Transactional;
10 11  
11 12 @Data
12 13 @TableName(value = "location")
... ... @@ -72,6 +73,12 @@ public class Location implements Serializable {
72 73 private Integer iGrid;
73 74  
74 75 /**
  76 + * 巷道
  77 + */
  78 + @TableField(value = "roadway")
  79 + private String roadway;
  80 +
  81 + /**
75 82 * 名称
76 83 */
77 84 @TableField(value = "name")
... ... @@ -173,57 +180,14 @@ public class Location implements Serializable {
173 180 @TableField(value = "deleted")
174 181 private Boolean deleted;
175 182  
176   - private static final long serialVersionUID = 1L;
177   -
178   - public static final String COL_CODE = "code";
179   -
180   - public static final String COL_WAREHOUSECODE = "warehouseCode";
181   -
182   - public static final String COL_ZONECODE = "zoneCode";
183   -
184   - public static final String COL_LOCATIONTYPE = "locationType";
185   -
186   - public static final String COL_CONTAINERCODE = "containerCode";
187   -
188   - public static final String COL_IROW = "iRow";
189   -
190   - public static final String COL_ICOLUMN = "iColumn";
191   -
192   - public static final String COL_ILAYER = "iLayer";
193   -
194   - public static final String COL_IGRID = "iGrid";
195 183  
196   - public static final String COL_NAME = "name";
  184 + private transient String materialCode;
197 185  
198   - public static final String COL_ENABLE = "enable";
  186 + private transient String materialName;
199 187  
200   - public static final String COL_LASTCYCLECOUNTDATE = "lastCycleCountDate";
  188 + private transient String batch;
201 189  
202   - public static final String COL_CREATED = "created";
  190 + private transient String qty;
203 191  
204   - public static final String COL_CREATEDBY = "createdBy";
205   -
206   - public static final String COL_LASTUPDATED = "lastUpdated";
207   -
208   - public static final String COL_LASTUPDATEDBY = "lastUpdatedBy";
209   -
210   - public static final String COL_VERSION = "version";
211   -
212   - public static final String COL_USERDEF1 = "userDef1";
213   -
214   - public static final String COL_USERDEF2 = "userDef2";
215   -
216   - public static final String COL_USERDEF3 = "userDef3";
217   -
218   - public static final String COL_USERDEF4 = "userDef4";
219   -
220   - public static final String COL_USERDEF5 = "userDef5";
221   -
222   - public static final String COL_USERDEF6 = "userDef6";
223   -
224   - public static final String COL_USERDEF7 = "userDef7";
225   -
226   - public static final String COL_USERDEF8 = "userDef8";
227   -
228   - public static final String COL_SYSTEMCREATED = "systemCreated";
  192 + private static final long serialVersionUID = 1L;
229 193 }
230 194 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/location/domain/LocationInfo.java 0 → 100644
  1 +package com.huaheng.pc.config.location.domain;
  2 +
  3 +import lombok.Data;
  4 +
  5 +/**
  6 + * Created by Enzo Cotter on 2019/10/25.
  7 + */
  8 +@Data
  9 +public class LocationInfo {
  10 + private long maxRow;
  11 + private long maxLine;
  12 + private long maxLayer;
  13 + private long maxGrid;
  14 +}
... ...
src/main/java/com/huaheng/pc/config/location/domain/LocationStatus.java 0 → 100644
  1 +package com.huaheng.pc.config.location.domain;
  2 +
  3 +/**
  4 + * Created by Enzo Cotter on 2019/10/25.
  5 + */
  6 +public class LocationStatus {
  7 +
  8 + public static final int IDLE_EMPTY_LOCATION = 1; //空柜空闲
  9 + public static final int IDLE_EMPTY_CONTAINER = 2; //空盘空闲
  10 + public static final int IDLE_HALF_CONTAINER = 3; //半盘空闲
  11 + public static final int IDLE_FULL_CONTAINER = 4; //满盘空闲
  12 + public static final int LOCK_EMPTY_LOCATION = 5; //空柜锁定
  13 + public static final int LOCK_EMPTY_CONTAINER = 6; //空盘锁定
  14 + public static final int LOCK_HALF_CONTAINER = 7; //半盘锁定
  15 + public static final int LOCK_FULL_CONTAINER = 8; //满盘锁定
  16 + public static final int DISABLE_EMPTY_LOCATION = 9; //空柜禁用
  17 + public static final int DISABLE_EMPTY_CONTAINER = 10; //空盘禁用
  18 + public static final int DISABLE_HALF_CONTAINER = 11; //半盘禁用
  19 + public static final int DISABLE_FULL_CONTAINER = 12; //满盘禁用
  20 +}
... ...
src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java
... ... @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.location.domain.Location;
5 5 import org.apache.ibatis.annotations.Param;
6 6  
  7 +import java.util.LinkedHashMap;
  8 +import java.util.List;
  9 +
7 10 public interface LocationMapper extends BaseMapper<Location> {
8 11  
9 12 void updateStatus(@Param("warehouseCode") String warehouseCode, @Param("code") String code, @Param("status") String status);
... ... @@ -11,4 +14,9 @@ public interface LocationMapper extends BaseMapper&lt;Location&gt; {
11 14 void updateContainerCodeAndStatus(@Param("warehouseCode") String warehouseCode, @Param("locationCode") String locationCode, @Param("containerCode") String containerCode, @Param("status") String status);
12 15  
13 16 Location position(String locatingRule);
  17 +
  18 + Location getAllLocation(@Param("warehouseCode") String warehouseCode, @Param("type") String type);
  19 +
  20 + //库位利用率
  21 + List<LinkedHashMap<String, Object>> getLocationProp();
14 22 }
15 23 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationService.java
... ... @@ -3,6 +3,11 @@ package com.huaheng.pc.config.location.service;
3 3 import com.huaheng.framework.web.domain.AjaxResult;
4 4 import com.huaheng.pc.config.location.domain.Location;
5 5 import com.baomidou.mybatisplus.extension.service.IService;
  6 +import com.huaheng.pc.config.location.domain.LocationInfo;
  7 +
  8 +import java.util.LinkedHashMap;
  9 +import java.util.List;
  10 +
6 11 public interface LocationService extends IService<Location>{
7 12  
8 13 AjaxResult addsave(Location location);
... ... @@ -15,4 +20,8 @@ public interface LocationService extends IService&lt;Location&gt;{
15 20  
16 21 void updateContainerCodeAndStatus(String locationCode, String containerCode, String status);
17 22  
  23 + LocationInfo getAllLocation(String type);
  24 +
  25 + //库位利用率
  26 + List<LinkedHashMap<String, Object>> getLocationProp();
18 27 }
... ...
src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
... ... @@ -7,6 +7,7 @@ import com.huaheng.common.exception.service.ServiceException;
7 7 import com.huaheng.common.utils.StringUtils;
8 8 import com.huaheng.common.utils.security.ShiroUtils;
9 9 import com.huaheng.framework.web.domain.AjaxResult;
  10 +import com.huaheng.pc.config.location.domain.LocationInfo;
10 11 import com.huaheng.pc.config.locationType.domain.LocationType;
11 12 import com.huaheng.pc.config.locationType.service.LocationTypeService;
12 13 import com.huaheng.pc.config.zone.domain.Zone;
... ... @@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
15 16 import javax.annotation.Resource;
16 17 import java.text.MessageFormat;
17 18 import java.util.ArrayList;
  19 +import java.util.LinkedHashMap;
18 20 import java.util.List;
19 21 import java.util.Map;
20 22  
... ... @@ -73,13 +75,18 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
73 75 return AjaxResult.success("新增库位成功");
74 76 }
75 77  
  78 + /**
  79 + * 批量新增库位
  80 + * @param location
  81 + * @return boolean
  82 + */
76 83 @Override
77 84 public boolean insertLocation(Location location) {
78 85 /* 判断库位类型编码是否存在*/
79   - LambdaQueryWrapper<LocationType> typelambda = Wrappers.lambdaQuery();
80   - typelambda.eq(LocationType::getCode,location.getLocationType())
  86 + LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery();
  87 + typeLambda.eq(LocationType::getCode,location.getLocationType())
81 88 .select(LocationType::getCode);
82   - List<Map<String, Object>> list = locationTypeService.listMaps(typelambda);
  89 + List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda);
83 90 if (list.size() < 1){
84 91 throw new ServiceException("库位类型编码不存在");
85 92 }
... ... @@ -97,7 +104,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
97 104 if(!location.getZoneCode().equals(location.getLocationType())){
98 105 throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
99 106 }
100   - String prefix = location.getLocationType().substring(1);
  107 +
101 108 List<Location> locations = new ArrayList<>();
102 109 for (int i=1; i<=location.getIRow().intValue(); i++) {
103 110 for (int j=1; j<=location.getIColumn().intValue(); j++) {
... ... @@ -109,6 +116,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
109 116 param.setIColumn(j);
110 117 param.setILayer(k);
111 118 param.setIGrid(m);
  119 + param.setRoadway(location.getRoadway());
112 120 param.setZoneCode(location.getZoneCode());
113 121 param.setLocationType(location.getLocationType());
114 122 param.setStatus(location.getStatus());
... ... @@ -116,11 +124,12 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
116 124 param.setCreatedBy(ShiroUtils.getLoginName());
117 125 param.setLastUpdatedBy(ShiroUtils.getLoginName());
118 126 String code = MessageFormat.format("{0}{1}-{2}-{3}-{4}",
119   - prefix,
  127 + location.getLocationType(),
120 128 String.format("%02d", i),
121 129 String.format("%02d", j),
122 130 String.format("%02d", k),
123 131 String.format("%02d", m));
  132 + //查询该库位编码是否存在
124 133 LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
125 134 queryWrapper.eq(Location::getCode,code)
126 135 .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
... ... @@ -133,8 +142,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
133 142 }
134 143 }
135 144 }
136   - Boolean result = locationService.saveBatch(locations);
137   - return result;
  145 + return locationService.saveBatch(locations);
138 146 }
139 147  
140 148 @Override
... ... @@ -149,6 +157,7 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
149 157 * @param locatingRule
150 158 * @return
151 159 */
  160 + @Override
152 161 public String position(String locatingRule){
153 162 return locationMapper.position(locatingRule).getCode();
154 163 }
... ... @@ -158,9 +167,28 @@ public class LocationServiceImpl extends ServiceImpl&lt;LocationMapper, Location&gt; i
158 167 * */
159 168 @Override
160 169 public void updateContainerCodeAndStatus(String locationCode, String containerCode, String status) {
161   - if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode))
  170 + if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) {
162 171 locationMapper.updateContainerCodeAndStatus(ShiroUtils.getWarehouseCode(), locationCode, containerCode, status);
  172 + }
163 173 }
164 174  
  175 + @Override
  176 + public LocationInfo getAllLocation(String type) {
  177 + if (StringUtils.isNotEmpty(type)) {
  178 + Location location = locationMapper.getAllLocation(ShiroUtils.getWarehouseCode(), type);
  179 + LocationInfo locationInfo = new LocationInfo();
  180 + locationInfo.setMaxRow(location.getIRow());
  181 + locationInfo.setMaxLine(location.getIColumn());
  182 + locationInfo.setMaxLayer(location.getILayer());
  183 + locationInfo.setMaxGrid(location.getIGrid());
  184 + return locationInfo;
  185 + }
  186 + return null;
  187 + }
  188 +
  189 + @Override
  190 + public List<LinkedHashMap<String, Object>> getLocationProp() {
  191 + return locationMapper.getLocationProp();
  192 + }
165 193  
166 194 }
... ...
src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeService.java
... ... @@ -8,5 +8,13 @@ import java.util.Map;
8 8  
9 9 public interface LocationTypeService extends IService<LocationType>{
10 10  
11   - public List<Map<String, Object>> getLocationPrefix();
  11 + List<Map<String, Object>> getLocationPrefix();
  12 +
  13 + /**
  14 + * 复制库位类型表
  15 + * @param warehouseCode 原仓库编码
  16 + * @param newWarehouseCode 新仓库编码
  17 + * @return 是否复制成功
  18 + */
  19 + boolean locationTypeCopy(String warehouseCode, String newWarehouseCode);
12 20 }
... ...
src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
... ... @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import com.huaheng.common.utils.security.ShiroUtils;
  7 +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
7 8 import com.huaheng.pc.config.locationType.domain.LocationType;
8 9 import com.huaheng.pc.config.locationType.mapper.LocationTypeMapper;
9 10 import org.springframework.stereotype.Service;
... ... @@ -14,10 +15,45 @@ import java.util.Map;
14 15 @Service("locationType")
15 16 public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, LocationType> implements LocationTypeService{
16 17  
  18 + @Override
17 19 public List<Map<String, Object>> getLocationPrefix(){
18 20 LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery();
19 21 lambdaQueryWrapper.eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode())
20 22 .eq(LocationType::getEnable, true);
21 23 return this.listMaps(lambdaQueryWrapper);
22 24 }
  25 +
  26 + /**
  27 + * 复制库位类型表
  28 + *
  29 + * @param warehouseCode 原仓库编码
  30 + * @param newWarehouseCode 新仓库编码
  31 + * @return 是否复制成功
  32 + */
  33 + @Override
  34 + public boolean locationTypeCopy(String warehouseCode, String newWarehouseCode) {
  35 + log.trace("开始复盘点首选项表");
  36 + LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery();
  37 + lambdaQueryWrapper.eq(LocationType::getWarehouseCode, newWarehouseCode);
  38 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  39 + log.error(newWarehouseCode+"仓库已存在");
  40 + return false;
  41 + }
  42 +
  43 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  44 + lambdaQueryWrapper.eq(LocationType::getWarehouseCode, warehouseCode);
  45 + List<LocationType> locationTypeList = this.list(lambdaQueryWrapper);
  46 +
  47 + for ( LocationType locationType : locationTypeList) {
  48 + locationType.setId(null);
  49 + locationType.setWarehouseCode(newWarehouseCode);
  50 + }
  51 +
  52 + if ( this.saveBatch(locationTypeList) ){
  53 + log.trace("复制盘点首选项表成功,新仓库编码是:"+newWarehouseCode);
  54 + return true;
  55 + } else {
  56 + return false;
  57 + }
  58 + }
23 59 }
... ...
src/main/java/com/huaheng/pc/config/receiptPreference/service/ReceiptPreferenceService.java
1 1 package com.huaheng.pc.config.receiptPreference.service;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference;
3 6 import org.springframework.stereotype.Service;
4 7 import javax.annotation.Resource;
5 8 import java.util.List;
... ... @@ -9,4 +12,36 @@ import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference;
9 12 @Service
10 13 public class ReceiptPreferenceService extends ServiceImpl<ReceiptPreferenceMapper, ReceiptPreference> {
11 14  
  15 + /**
  16 + * 复制盘点首选项表
  17 + *
  18 + * @param warehouseCode 原仓库编码
  19 + * @param newWarehouseCode 新仓库编码
  20 + * @return 是否复制成功
  21 + */
  22 + public boolean receiptPreferenceCopy(String warehouseCode, String newWarehouseCode) {
  23 + log.trace("开始入库首选项表");
  24 + LambdaQueryWrapper<ReceiptPreference> lambdaQueryWrapper = Wrappers.lambdaQuery();
  25 + lambdaQueryWrapper.eq(ReceiptPreference::getWarehouseCode, newWarehouseCode);
  26 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  27 + log.error(newWarehouseCode+"仓库已存在");
  28 + return false;
  29 + }
  30 +
  31 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  32 + lambdaQueryWrapper.eq(ReceiptPreference::getWarehouseCode, warehouseCode);
  33 + List<ReceiptPreference> receiptPreferenceList = this.list(lambdaQueryWrapper);
  34 +
  35 + for ( ReceiptPreference receiptPreference : receiptPreferenceList) {
  36 + receiptPreference.setId(null);
  37 + receiptPreference.setWarehouseCode(newWarehouseCode);
  38 + }
  39 +
  40 + if ( this.saveBatch(receiptPreferenceList) ){
  41 + log.trace("复制入库首选项表成功,新仓库编码是:"+newWarehouseCode);
  42 + return true;
  43 + } else {
  44 + return false;
  45 + }
  46 + }
12 47 }
... ...
src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java
... ... @@ -5,5 +5,11 @@ import com.huaheng.pc.config.receiptType.domain.ReceiptType;
5 5  
6 6 public interface ReceiptTypeService extends IService<ReceiptType>{
7 7  
8   -
  8 + /**
  9 + * 复制入库类型表
  10 + * @param warehouseCode 原仓库编码
  11 + * @param newWarehouseCode 新仓库编码
  12 + * @return 是否复制成功
  13 + */
  14 + Boolean receiptTypeCopy(String warehouseCode, String newWarehouseCode);
9 15 }
... ...
src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java
... ... @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6 import com.huaheng.common.utils.security.ShiroUtils;
  7 +import com.huaheng.pc.config.address.domain.Address;
7 8 import com.huaheng.pc.config.receiptType.domain.ReceiptType;
8 9 import com.huaheng.pc.config.receiptType.mapper.ReceiptTypeMapper;
9 10 import org.springframework.stereotype.Service;
... ... @@ -20,4 +21,38 @@ public class ReceiptTypeServiceImpl extends ServiceImpl&lt;ReceiptTypeMapper, Recei
20 21 .in(ReceiptType::getCompanyCode, ShiroUtils.getCompanyCodeList());
21 22 return this.listMaps(lambdaQueryWrapper);
22 23 }
  24 +
  25 + /**
  26 + * 复制入库类型表
  27 + *
  28 + * @param warehouseCode 原仓库编码
  29 + * @param newWarehouseCode 新仓库编码
  30 + * @return 是否复制成功
  31 + */
  32 + @Override
  33 + public Boolean receiptTypeCopy(String warehouseCode, String newWarehouseCode) {
  34 + log.trace("开始复制入库类型表");
  35 + LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery();
  36 + lambdaQueryWrapper.eq(ReceiptType::getWarehouseCode, newWarehouseCode);
  37 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  38 + log.error("该仓库已存在");
  39 + return false;
  40 + }
  41 +
  42 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  43 + lambdaQueryWrapper.eq(ReceiptType::getWarehouseCode, warehouseCode);
  44 + List<ReceiptType> receiptTypeList = this.list(lambdaQueryWrapper);
  45 +
  46 + for ( ReceiptType receiptType : receiptTypeList) {
  47 + receiptType.setId(null);
  48 + receiptType.setWarehouseCode(newWarehouseCode);
  49 + }
  50 +
  51 + if ( this.saveBatch(receiptTypeList) ){
  52 + log.trace("复制入库类型成功,新仓库编码是:"+newWarehouseCode);
  53 + return true;
  54 + } else {
  55 + return false;
  56 + }
  57 + }
23 58 }
... ...
src/main/java/com/huaheng/pc/config/sendMail/domain/SendMail.java
... ... @@ -10,6 +10,9 @@ import java.io.Serializable;
10 10 import java.util.Date;
11 11 import lombok.Data;
12 12  
  13 +/**
  14 + * @author mahuandong
  15 + */
13 16 @ApiModel(value="com.huaheng.pc.config.sendMail.domain.SendMail")
14 17 @Data
15 18 @TableName(value = "send_mail")
... ...
src/main/java/com/huaheng/pc/config/sendMail/domain/SendMailText.java deleted
src/main/java/com/huaheng/pc/config/sendMail/service/MailService.java
... ... @@ -12,6 +12,7 @@ public interface MailService {
12 12 * @param subject 主题
13 13 * @param content 内容
14 14 * @param cc 抄送
  15 + * @return 是否发送成功
15 16 */
16 17 Boolean sendSimpleMail(String[] to, String subject, String content, String[] cc);
17 18 /**
... ... @@ -20,6 +21,7 @@ public interface MailService {
20 21 * @param subject 主题
21 22 * @param content 内容(可以包含<html>等标签)
22 23 * @param cc 抄送
  24 + * @return 是否发送成功
23 25 */
24 26 Boolean sendHtmlMail(String[] to, String subject, String content, String[] cc);
25 27 /**
... ... @@ -29,6 +31,7 @@ public interface MailService {
29 31 * @param content 内容
30 32 * @param filePath 附件路径
31 33 * @param cc 抄送
  34 + * @return 是否发送成功
32 35 */
33 36 Boolean sendAttachmentMail(String[] to, String subject, String content, String filePath, String[] cc);
34 37 /**
... ... @@ -39,6 +42,7 @@ public interface MailService {
39 42 * @param rscPath 图片路径
40 43 * @param rscId 图片ID,用于在<img>标签中使用,从而显示图片
41 44 * @param cc 抄送邮箱
  45 + * @return 是否发送成功
42 46 */
43 47 Boolean sendInlineResourceMail(String[] to, String subject, String content, String rscPath, String rscId, String[] cc);
44 48 }
... ...
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java
... ... @@ -12,4 +12,12 @@ public interface ShipmentPreferenceService extends IService&lt;ShipmentPreference&gt;{
12 12 //查看出库此操作是否符合出库首选项的出库流程
13 13 List<ShipmentHeader> checkShipmentProcess(String ids, Integer status,String code);
14 14  
  15 + /**
  16 + * 复制出库首选项表
  17 + * @param warehouseCode 原仓库编码
  18 + * @param newWarehouseCode 新仓库编码
  19 + * @return 是否复制成功
  20 + */
  21 + boolean shipmentPreferenceCopy(String warehouseCode, String newWarehouseCode);
  22 +
15 23 }
... ...
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java
... ... @@ -109,4 +109,38 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl&lt;ShipmentPreferenc
109 109  
110 110 return shipmentHeaderList;
111 111 }
  112 +
  113 + /**
  114 + * 复制出库首选项表
  115 + *
  116 + * @param warehouseCode 原仓库编码
  117 + * @param newWarehouseCode 新仓库编码
  118 + * @return 是否复制成功
  119 + */
  120 + @Override
  121 + public boolean shipmentPreferenceCopy(String warehouseCode, String newWarehouseCode) {
  122 + log.trace("开始复制出库首选项表");
  123 + LambdaQueryWrapper<ShipmentPreference> lambdaQueryWrapper = Wrappers.lambdaQuery();
  124 + lambdaQueryWrapper.eq(ShipmentPreference::getWarehouseCode, newWarehouseCode);
  125 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  126 + log.error("该仓库已存在");
  127 + return false;
  128 + }
  129 +
  130 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  131 + lambdaQueryWrapper.eq(ShipmentPreference::getWarehouseCode, warehouseCode);
  132 + List<ShipmentPreference> shipmentPreferenceList = this.list(lambdaQueryWrapper);
  133 +
  134 + for ( ShipmentPreference shipmentPreference : shipmentPreferenceList) {
  135 + shipmentPreference.setId(null);
  136 + shipmentPreference.setWarehouseCode(newWarehouseCode);
  137 + }
  138 +
  139 + if ( this.saveBatch(shipmentPreferenceList) ){
  140 + log.trace("复制出库首选项成功,新仓库编码是:"+newWarehouseCode);
  141 + return true;
  142 + } else {
  143 + return false;
  144 + }
  145 + }
112 146 }
... ...
src/main/java/com/huaheng/pc/config/shipmentType/config/shipmentTypeController.java renamed to src/main/java/com/huaheng/pc/config/shipmentType/controller/shipmentTypeController.java
1   -package com.huaheng.pc.config.shipmentType.config;
  1 +package com.huaheng.pc.config.shipmentType.controller;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.metadata.IPage;
... ...
src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeService.java
... ... @@ -5,5 +5,11 @@ import com.huaheng.pc.config.shipmentType.domain.ShipmentType;
5 5  
6 6 public interface ShipmentTypeService extends IService<ShipmentType>{
7 7  
8   -
  8 + /**
  9 + * 复制出库类型表
  10 + * @param warehouseCode 原仓库编码
  11 + * @param newWarehouseCode 新仓库编码
  12 + * @return 是否复制成功
  13 + */
  14 + boolean ShipmentTypeCopy(String warehouseCode, String newWarehouseCode);
9 15 }
... ...
src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java
1 1 package com.huaheng.pc.config.shipmentType.service;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
3 5 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6 +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference;
4 7 import com.huaheng.pc.config.shipmentType.domain.ShipmentType;
5 8 import com.huaheng.pc.config.shipmentType.mapper.ShipmentTypeMapper;
6 9 import org.springframework.stereotype.Service;
7 10  
  11 +import java.util.List;
  12 +
8 13 @Service
9 14 public class ShipmentTypeServiceImpl extends ServiceImpl<ShipmentTypeMapper, ShipmentType> implements ShipmentTypeService {
10 15  
  16 + /**
  17 + * 复制出库首选项表
  18 + *
  19 + * @param warehouseCode 原仓库编码
  20 + * @param newWarehouseCode 新仓库编码
  21 + * @return 是否复制成功
  22 + */
  23 + @Override
  24 + public boolean ShipmentTypeCopy(String warehouseCode, String newWarehouseCode) {
  25 + log.trace("开始复制出库类型表");
  26 + LambdaQueryWrapper<ShipmentType> lambdaQueryWrapper = Wrappers.lambdaQuery();
  27 + lambdaQueryWrapper.eq(ShipmentType::getWarehouseCode, newWarehouseCode);
  28 + if (!this.list(lambdaQueryWrapper).isEmpty()){
  29 + log.error("该仓库已存在");
  30 + return false;
  31 + }
  32 +
  33 + lambdaQueryWrapper = Wrappers.lambdaQuery();
  34 + lambdaQueryWrapper.eq(ShipmentType::getWarehouseCode, warehouseCode);
  35 + List<ShipmentType> shipmentTypeList = this.list(lambdaQueryWrapper);
  36 +
  37 + for ( ShipmentType shipmentType : shipmentTypeList) {
  38 + shipmentType.setId(null);
  39 + shipmentType.setWarehouseCode(newWarehouseCode);
  40 + }
  41 +
  42 + if ( this.saveBatch(shipmentTypeList) ){
  43 + log.trace("复制出库类型成功,新仓库编码是:"+newWarehouseCode);
  44 + return true;
  45 + } else {
  46 + return false;
  47 + }
  48 + }
11 49 }
... ...
src/main/java/com/huaheng/pc/config/station/controller/stationController.java 0 → 100644
  1 +package com.huaheng.pc.config.station.controller;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.metadata.IPage;
  5 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  6 +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  7 +import com.huaheng.common.support.Convert;
  8 +import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.security.ShiroUtils;
  10 +import com.huaheng.framework.aspectj.lang.annotation.Log;
  11 +import com.huaheng.framework.aspectj.lang.constant.BusinessType;
  12 +import com.huaheng.framework.web.controller.BaseController;
  13 +import com.huaheng.framework.web.domain.AjaxResult;
  14 +import com.huaheng.framework.web.page.PageDomain;
  15 +import com.huaheng.framework.web.page.TableDataInfo;
  16 +import com.huaheng.framework.web.page.TableSupport;
  17 +import com.huaheng.pc.config.station.domain.Station;
  18 +import com.huaheng.pc.config.station.service.StationService;
  19 +import io.swagger.annotations.ApiParam;
  20 +import org.apache.shiro.authz.annotation.RequiresPermissions;
  21 +import org.springframework.stereotype.Controller;
  22 +import org.springframework.ui.ModelMap;
  23 +import org.springframework.web.bind.annotation.*;
  24 +
  25 +import javax.annotation.Resource;
  26 +import java.util.ArrayList;
  27 +import java.util.Arrays;
  28 +import java.util.List;
  29 +
  30 +/**
  31 + * Created by Enzo Cotter on 2019/10/14.
  32 + */
  33 +@Controller
  34 +@RequestMapping("/config/station")
  35 +public class stationController extends BaseController {
  36 +
  37 + @Resource
  38 + private StationService stationService;
  39 +
  40 + private String prefix = "config/station";
  41 +
  42 + @RequiresPermissions("config:station:view")
  43 + @GetMapping()
  44 + public String station() {
  45 + return prefix + "/station";
  46 + }
  47 +
  48 + /**
  49 + * 查询出库类型
  50 + */
  51 + @RequiresPermissions("config:station:list")
  52 + @Log(title = "配置-站台",operating = "站台列表", action = BusinessType.GRANT)
  53 + @PostMapping("/list")
  54 + @ResponseBody
  55 + public TableDataInfo list(@ApiParam(name="shipmentType",value="编码、类型") Station station,
  56 + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin,
  57 + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) {
  58 + LambdaQueryWrapper<Station> lambdaQueryWrapper = Wrappers.lambdaQuery();
  59 + PageDomain pageDomain = TableSupport.buildPageRequest();
  60 + Integer pageNum = pageDomain.getPageNum();
  61 + Integer pageSize = pageDomain.getPageSize();
  62 + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Station::getCreated, createdBegin)
  63 + .lt(StringUtils.isNotEmpty(createdEnd), Station::getCreated, createdEnd)
  64 + .eq(StringUtils.isNotEmpty(station.getCode()), Station::getCode, station.getCode())
  65 + .eq(StringUtils.isNotEmpty(station.getType()), Station::getType, station.getType())
  66 + .eq(Station::getWarehouseCode, ShiroUtils.getWarehouseCode());
  67 +
  68 + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
  69 + /*使用分页查询*/
  70 + Page<Station> page = new Page<>(pageNum, pageSize);
  71 + IPage<Station> iPage = stationService.page(page, lambdaQueryWrapper);
  72 + return getMpDataTable(iPage.getRecords(), iPage.getTotal());
  73 + } else {
  74 + List<Station> list = stationService.list(lambdaQueryWrapper);
  75 + return getDataTable(list);
  76 + }
  77 + }
  78 +
  79 + /**
  80 + * 新增站台
  81 + */
  82 + @GetMapping("/add")
  83 + public String add() {
  84 + return prefix + "/add";
  85 + }
  86 +
  87 + /**
  88 + * 新增保存站台
  89 + */
  90 + @RequiresPermissions("config:station:add")
  91 + @Log(title = "配置-站台",operating = "新增站台", action = BusinessType.INSERT)
  92 + @PostMapping("/add")
  93 + @ResponseBody
  94 + public AjaxResult addSave(Station station) {
  95 + station.setWarehouseCode(ShiroUtils.getWarehouseCode());
  96 + return toAjax(stationService.save(station));
  97 + }
  98 +
  99 + /**
  100 + * 修改站台
  101 + */
  102 + @GetMapping("/edit/{id}")
  103 + public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
  104 + Station station = stationService.getById(id);
  105 + mmap.put("station", station);
  106 + return prefix + "/edit";
  107 + }
  108 +
  109 + /**
  110 + * 修改保存站台
  111 + */
  112 + @RequiresPermissions("config:station:edit")
  113 + @Log(title = "配置-站台",operating = "修改站台", action = BusinessType.UPDATE)
  114 + @PostMapping("/edit")
  115 + @ResponseBody
  116 + public AjaxResult editSave(Station station) {
  117 + station.setLastUpdatedBy(ShiroUtils.getLoginName());
  118 + return toAjax(stationService.updateById(station));
  119 + }
  120 +
  121 + /**
  122 + * 删除出库
  123 + */
  124 + @RequiresPermissions("config:station:remove")
  125 + @Log(title = "配置-站台",operating = "删除站台", action = BusinessType.DELETE)
  126 + @PostMapping( "/remove")
  127 + @ResponseBody
  128 + public AjaxResult remove(String ids) {
  129 + if (StringUtils.isEmpty(ids)) {
  130 + return AjaxResult.error("id不能为空");
  131 + }
  132 + List<Integer> list = new ArrayList<>(Arrays.asList(Convert.toIntArray(ids)));
  133 + return toAjax(stationService.removeByIds(list));
  134 + }
  135 +
  136 +}
... ...
src/main/java/com/huaheng/pc/config/station/domain/Station.java 0 → 100644
  1 +package com.huaheng.pc.config.station.domain;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.IdType;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableId;
  6 +import com.baomidou.mybatisplus.annotation.TableName;
  7 +import io.swagger.annotations.ApiModel;
  8 +import io.swagger.annotations.ApiModelProperty;
  9 +import java.io.Serializable;
  10 +import java.util.Date;
  11 +import lombok.Data;
  12 +
  13 +/**
  14 + * Created by Enzo Cotter on 2019/10/11.
  15 + */
  16 +
  17 +@ApiModel(value="com.huaheng.pc.config.station.domain.Station")
  18 +@Data
  19 +@TableName(value = "station")
  20 +public class Station implements Serializable {
  21 + @TableId(value = "id", type = IdType.INPUT)
  22 + @ApiModelProperty(value="null")
  23 + private Integer id;
  24 +
  25 + /**
  26 + * 编码
  27 + */
  28 + @TableField(value = "code")
  29 + @ApiModelProperty(value="编码")
  30 + private String code;
  31 +
  32 + /**
  33 + * 类型
  34 + */
  35 + @TableField(value = "type")
  36 + @ApiModelProperty(value="类型")
  37 + private String type;
  38 +
  39 + /**
  40 + * 状态
  41 + */
  42 + @TableField(value = "status")
  43 + @ApiModelProperty(value="状态")
  44 + private Integer status;
  45 +
  46 + /**
  47 + * 仓库编码
  48 + */
  49 + @TableField(value = "warehouseCode")
  50 + @ApiModelProperty(value="仓库编码")
  51 + private String warehouseCode;
  52 +
  53 + /**
  54 + * 创建时间
  55 + */
  56 + @TableField(value = "created")
  57 + @ApiModelProperty(value="创建时间")
  58 + private Date created;
  59 +
  60 + /**
  61 + * 创建者
  62 + */
  63 + @TableField(value = "createdBy")
  64 + @ApiModelProperty(value="创建者")
  65 + private String createdBy;
  66 +
  67 + /**
  68 + * 更新时间
  69 + */
  70 + @TableField(value = "lastUpdated")
  71 + @ApiModelProperty(value="更新时间")
  72 + private Date lastUpdated;
  73 +
  74 + /**
  75 + * 更新者
  76 + */
  77 + @TableField(value = "lastUpdatedBy")
  78 + @ApiModelProperty(value="更新者")
  79 + private String lastUpdatedBy;
  80 +
  81 + private static final long serialVersionUID = 1L;
  82 +}
0 83 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/station/mapper/StationMapper.java 0 → 100644
  1 +package com.huaheng.pc.config.station.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.config.station.domain.Station;
  5 +
  6 +/**
  7 + * Created by Enzo Cotter on 2019/10/11.
  8 + */
  9 +
  10 +public interface StationMapper extends BaseMapper<Station> {
  11 +}
0 12 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/station/service/StationService.java 0 → 100644
  1 +package com.huaheng.pc.config.station.service;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import java.util.List;
  6 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7 +import com.huaheng.pc.config.station.domain.Station;
  8 +import com.huaheng.pc.config.station.mapper.StationMapper;
  9 +/**
  10 + * Created by Enzo Cotter on 2019/10/11.
  11 + */
  12 +
  13 +@Service
  14 +public class StationService extends ServiceImpl<StationMapper, Station> {
  15 +
  16 +}
... ...
src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowDetailController.java
... ... @@ -96,6 +96,7 @@ public class StatusFlowDetailController extends BaseController {
96 96 StatusFlowHeader statusFlowHeader = statusFlowHeaderService.getById(headerId);
97 97 mmap.put("headerId",headerId);
98 98 mmap.put("headerCode", statusFlowHeader.getCode());
  99 + mmap.put("moduleType", statusFlowHeader.getModuleType());
99 100 return prefix + "/add";
100 101 }
101 102  
... ...
src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java
... ... @@ -82,8 +82,9 @@ public class StatusFlowHeaderController extends BaseController {
82 82 /**
83 83 * 新增流程
84 84 */
85   - @GetMapping("/add")
86   - public String add() {
  85 + @GetMapping("/add/{type}")
  86 + public String add(@PathVariable("type") String type, ModelMap modelMap) {
  87 + modelMap.put("moduleType", type);
87 88 return prefix + "/add";
88 89 }
89 90  
... ...
src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowDetailMapper.java
... ... @@ -2,6 +2,13 @@ package com.huaheng.pc.config.statusFlow.mapper;
2 2  
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail;
  5 +import org.apache.ibatis.annotations.Param;
5 6  
6 7 public interface StatusFlowDetailMapper extends BaseMapper<StatusFlowDetail> {
  8 +
  9 + //复制流程明细
  10 + int statusFlowDetailCopy(@Param("code") String code, @Param("newCode") String newCode);
  11 +
  12 + //修改流程明细headerId
  13 + int updateHeaderId(@Param("code") String code);
7 14 }
8 15 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowHeaderMapper.java
... ... @@ -2,6 +2,10 @@ package com.huaheng.pc.config.statusFlow.mapper;
2 2  
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader;
  5 +import org.apache.ibatis.annotations.Param;
5 6  
6 7 public interface StatusFlowHeaderMapper extends BaseMapper<StatusFlowHeader> {
  8 +
  9 + //复制流程主表
  10 + int statusFlowHeaderCopy(@Param("code") String code, @Param("newCode") String newCode);
7 11 }
8 12 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowDetailService.java
... ... @@ -2,6 +2,7 @@ package com.huaheng.pc.config.statusFlow.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.utils.security.ShiroUtils;
5 6 import org.springframework.stereotype.Service;
6 7 import javax.annotation.Resource;
7 8 import java.util.List;
... ... @@ -16,7 +17,8 @@ public class StatusFlowDetailService extends ServiceImpl&lt;StatusFlowDetailMapper,
16 17 public List<StatusFlowDetail> queryStatusFlowDetail(String headerCode){
17 18 LambdaQueryWrapper<StatusFlowDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
18 19 lambdaQueryWrapper.orderByAsc(StatusFlowDetail::getSequence)
19   - .eq(StatusFlowDetail::getHeaderCode, headerCode);
  20 + .eq(StatusFlowDetail::getHeaderCode, headerCode)
  21 + .eq(StatusFlowDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
20 22 return this.list(lambdaQueryWrapper);
21 23 }
22 24 }
... ...
src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java
... ... @@ -2,19 +2,27 @@ package com.huaheng.pc.config.statusFlow.service;
2 2  
3 3 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.huaheng.common.exception.service.ServiceException;
5 6 import com.huaheng.common.utils.security.ShiroUtils;
6   -import org.springframework.aop.aspectj.AspectJPrecedenceInformation;
  7 +import com.huaheng.pc.config.statusFlow.mapper.StatusFlowDetailMapper;
7 8 import org.springframework.stereotype.Service;
8 9 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 10 import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader;
10 11 import com.huaheng.pc.config.statusFlow.mapper.StatusFlowHeaderMapper;
11 12  
  13 +import javax.annotation.Resource;
12 14 import java.util.List;
13 15 import java.util.Map;
14 16  
15 17 @Service("StatusFlow")
16 18 public class StatusFlowHeaderService extends ServiceImpl<StatusFlowHeaderMapper, StatusFlowHeader> {
17 19  
  20 + @Resource
  21 + private StatusFlowHeaderMapper statusFlowHeaderMapper;
  22 + @Resource
  23 + private StatusFlowDetailMapper statusFlowDetailMapper;
  24 +
  25 +
18 26 public List<Map<String, Object>> flowList(String recordType){
19 27 LambdaQueryWrapper<StatusFlowHeader> lambda = Wrappers.lambdaQuery();
20 28 lambda.select(StatusFlowHeader::getCode, StatusFlowHeader::getName)
... ... @@ -30,4 +38,28 @@ public class StatusFlowHeaderService extends ServiceImpl&lt;StatusFlowHeaderMapper,
30 38 .eq(StatusFlowHeader::getWarehouseCode, ShiroUtils.getWarehouseCode());
31 39 return this.list(lambda);
32 40 }
  41 +
  42 +
  43 + //复制流程
  44 + public Boolean statusFlowCopy(String code,String newCode){
  45 + int i = 0;
  46 + //复制流程主表
  47 + i = statusFlowHeaderMapper.statusFlowHeaderCopy(code,newCode);
  48 + if(i < 1){
  49 + throw new ServiceException("复制菜单数据失败");
  50 + }
  51 +
  52 + //复制流程明细
  53 + i = statusFlowDetailMapper.statusFlowDetailCopy(code,newCode);
  54 + if(i < 1){
  55 + throw new ServiceException("复制菜单数据失败");
  56 + }
  57 +
  58 + //修改流程明细headerId
  59 + i = statusFlowDetailMapper.updateHeaderId(newCode);
  60 + if(i < 1){
  61 + throw new ServiceException("复制菜单数据失败");
  62 + }
  63 + return true;
  64 + }
33 65 }
... ...
src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
... ... @@ -158,4 +158,24 @@ public class WareHouseController extends BaseController {
158 158 }
159 159 return AjaxResult.success("删除成功!");
160 160 }
  161 +
  162 + /**
  163 + * 修改保存仓库
  164 + */
  165 + @RequiresPermissions("config:warehouse:copy")
  166 + @Log(title = "通用-仓库管理", operating = "复制仓库", action = BusinessType.INSERT)
  167 + @GetMapping("/copy")
  168 + public String copy(String newWarehouseCode) {
  169 + return prefix+"/copy";
  170 + }
  171 + /**
  172 + * 修改保存仓库
  173 + */
  174 + @RequiresPermissions("config:warehouse:copy")
  175 + @Log(title = "通用-仓库管理", operating = "复制仓库", action = BusinessType.INSERT)
  176 + @PostMapping("/copySave")
  177 + @ResponseBody
  178 + public AjaxResult copySave(String newWarehouseCode) {
  179 + return toAjax(warehouseService.warehouseCopy(ShiroUtils.getWarehouseCode(), newWarehouseCode));
  180 + }
161 181 }
... ...
src/main/java/com/huaheng/pc/config/warehouse/mapper/WarehouseMapper.java
... ... @@ -3,6 +3,7 @@ package com.huaheng.pc.config.warehouse.mapper;
3 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4 import com.huaheng.pc.config.warehouse.domain.Warehouse;
5 5 import com.huaheng.pc.system.user.domain.SysUserWarehouse;
  6 +import org.apache.ibatis.annotations.Param;
6 7  
7 8 import java.util.List;
8 9  
... ... @@ -13,4 +14,9 @@ public interface WarehouseMapper extends BaseMapper&lt;Warehouse&gt; {
13 14 public List<Warehouse> selectWarehouseByUserId(Integer userId);
14 15  
15 16 public List<Warehouse> selectWarehouseAll();
  17 +
  18 + int companyCopy(@Param("warehouseCode") String warehouseCode, @Param("newWarehouseCode")String newWarehouseCode);
  19 +
  20 + List<Warehouse> selectListEntityByEqual(Warehouse condition);
  21 +
16 22 }
17 23 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseService.java
... ... @@ -10,8 +10,17 @@ public interface WarehouseService extends IService&lt;Warehouse&gt;{
10 10  
11 11 List<Map<String,Object>> getWarehouseList(Integer id);
12 12  
13   - public List<Warehouse> selectWarehouseByUserId(Integer userId);
  13 + List<Warehouse> selectWarehouseByUserId(Integer userId);
14 14  
  15 + /**
  16 + * 复制仓库
  17 + * @param warehouseCode 仓库编码
  18 + * @param newWarehouseCode 新仓库编码
  19 + */
  20 + Boolean warehouseCopy(String warehouseCode, String newWarehouseCode);
  21 +
  22 +
  23 + List<Warehouse> selectListEntityByEqual(Warehouse condition);
15 24  
16 25  
17 26 }
... ...