diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e71cca9..c0560c6 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,25 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> - <list default="true" id="baeae966-16bb-4f97-a411-22fe5a65cefd" name="Default Changelist" comment="修改入库首选项页面,规则"> + <list default="true" id="baeae966-16bb-4f97-a411-22fe5a65cefd" name="Default Changelist" comment=""> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> - <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" /> + <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" /> + <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" /> + <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" /> <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" /> - <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" /> - <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" /> + <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" /> + <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" /> + <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" /> <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" /> - <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" /> </list> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="SHOW_DIALOG" value="false" /> @@ -167,7 +158,17 @@ <serviceView> <option name="contentProportion" value="0.1612554" /> <treeState> - <expand /> + <expand> + <path> + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@c531c3e8" type="7427dc5b:ServiceModel$ServiceGroupNode" /> + </path> + <path> + <item name="services root" type="e789fda9:ObjectUtils$Sentinel" /> + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@c531c3e8" type="7427dc5b:ServiceModel$ServiceGroupNode" /> + <item name="com.intellij.execution.services.ServiceModel$ServiceGroupNode@ef9dc71e" type="7427dc5b:ServiceModel$ServiceGroupNode" /> + </path> + </expand> <select /> </treeState> </serviceView> @@ -270,7 +271,7 @@ <workItem from="1569745589865" duration="2739000" /> <workItem from="1569748443357" duration="438000" /> <workItem from="1569803438585" duration="13789000" /> - <workItem from="1570581146682" duration="827000" /> + <workItem from="1570581146682" duration="9295000" /> </task> <task id="LOCAL-00001" summary="修改添加物料时使用物料类别生成物料编码"> <created>1567664306836</created> @@ -503,7 +504,14 @@ <option name="project" value="LOCAL" /> <updated>1569743042718</updated> </task> - <option name="localTasksCounter" value="34" /> + <task id="LOCAL-00034" summary="添加根据容器编码查找容器的方法 配置规则添加自动添加模块类型 添加是否自动生成临时容器"> + <created>1570582333467</created> + <option name="number" value="00034" /> + <option name="presentableId" value="LOCAL-00034" /> + <option name="project" value="LOCAL" /> + <updated>1570582333467</updated> + </task> + <option name="localTasksCounter" value="35" /> <servers /> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -524,7 +532,6 @@ </component> <component name="VcsManagerConfiguration"> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> - <MESSAGE value="修改入库类型自动判断" /> <MESSAGE value="修改入库单页面" /> <MESSAGE value="修改入库单页面,入库单审核,质检页面后台跳转接口" /> <MESSAGE value="修改 入库收货,生成上架任务自动执行定位" /> @@ -549,7 +556,8 @@ <MESSAGE value="修改容器新增时容器enable状态" /> <MESSAGE value="修改入库组盘页面中任务类型的显示问题 修改任务完成不修改入库组盘状态的问题" /> <MESSAGE value="添加根据code查询物料" /> - <option name="LAST_COMMIT_MESSAGE" value="添加根据code查询物料" /> + <MESSAGE value="添加根据容器编码查找容器的方法 配置规则添加自动添加模块类型 添加是否自动生成临时容器" /> + <option name="LAST_COMMIT_MESSAGE" value="添加根据容器编码查找容器的方法 配置规则添加自动添加模块类型 添加是否自动生成临时容器" /> </component> <component name="XDebuggerManager"> <breakpoint-manager> @@ -566,12 +574,12 @@ </line-breakpoint> <line-breakpoint enabled="true" type="java-line"> <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java</url> - <line>172</line> + <line>174</line> <option name="timeStamp" value="28" /> </line-breakpoint> <line-breakpoint enabled="true" type="java-line"> <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java</url> - <line>618</line> + <line>631</line> <option name="timeStamp" value="48" /> </line-breakpoint> <line-breakpoint enabled="true" type="java-line"> @@ -584,6 +592,16 @@ <line>84</line> <option name="timeStamp" value="51" /> </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java</url> + <line>86</line> + <option name="timeStamp" value="57" /> + </line-breakpoint> + <line-breakpoint enabled="true" type="java-line"> + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java</url> + <line>145</line> + <option name="timeStamp" value="62" /> + </line-breakpoint> <line-breakpoint enabled="true" type="javascript"> <url>file://$PROJECT_DIR$/src/main/resources/templates/check/checkingRegister/checkingRegister.html</url> <line>308</line> diff --git a/src/main/java/com/huaheng/api/general/controller/ReceiptController.java b/src/main/java/com/huaheng/api/general/controller/ReceiptController.java new file mode 100644 index 0000000..d847f6a --- /dev/null +++ b/src/main/java/com/huaheng/api/general/controller/ReceiptController.java @@ -0,0 +1,40 @@ +package com.huaheng.api.general.controller; + +import com.huaheng.api.general.domain.Receipt; +import com.huaheng.api.general.service.ReceiptService; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * Created by Enzo Cotter on 2019/11/4. + * @author mahuandong + */ +@RestController +@RequestMapping("/api/receipt") +@Api(tags = {"basicData"}, description = "入库接口") +public class ReceiptController { + + @Resource + private ReceiptService receiptService; + + /** + * 入库单下发 + */ + @Log(title = "入库单下发", action = BusinessType.INSERT) + @PostMapping("/insertReceipt") + @ApiOperation("入库单下发接口") + @ResponseBody + public AjaxResult MaterialApi(@RequestBody Receipt receipt) { + System.out.println("————————开始接收入库单——————————"); + System.out.println(receipt); + AjaxResult ajaxResult = receiptService.insertReceipt(receipt); + return ajaxResult; + } + +} diff --git a/src/main/java/com/huaheng/api/general/domain/Receipt.java b/src/main/java/com/huaheng/api/general/domain/Receipt.java new file mode 100644 index 0000000..ab37cd9 --- /dev/null +++ b/src/main/java/com/huaheng/api/general/domain/Receipt.java @@ -0,0 +1,19 @@ +package com.huaheng.api.general.domain; + +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; +import lombok.Data; + +import java.util.List; + +/** + * Created by Enzo Cotter on 2019/11/4. + * @author mahuandong + */ +@Data +public class Receipt { + + private ReceiptHeader receiptHeader; + + private List<ReceiptDetail> receiptDetails; +} diff --git a/src/main/java/com/huaheng/api/general/service/ReceiptService.java b/src/main/java/com/huaheng/api/general/service/ReceiptService.java new file mode 100644 index 0000000..44cf3f3 --- /dev/null +++ b/src/main/java/com/huaheng/api/general/service/ReceiptService.java @@ -0,0 +1,216 @@ +package com.huaheng.api.general.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.general.domain.Receipt; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; +import com.huaheng.pc.config.company.domain.Company; +import com.huaheng.pc.config.company.service.CompanyService; +import com.huaheng.pc.config.material.domain.Material; +import com.huaheng.pc.config.material.service.MaterialService; +import com.huaheng.pc.config.receiptType.domain.ReceiptType; +import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; +import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader; +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService; +import com.huaheng.pc.config.supplier.domain.Supplier; +import com.huaheng.pc.config.supplier.service.SupplierService; +import com.huaheng.pc.config.warehouse.domain.Warehouse; +import com.huaheng.pc.config.warehouse.service.WarehouseService; +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; +import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.List; + +/** + * Created by Enzo Cotter on 2019/11/4. + * @author mahuandong + */ +@Component +@Transactional(rollbackFor = Exception.class) +public class ReceiptService { + + @Resource + private ReceiptHeaderService receiptHeaderService; + @Resource + private ReceiptDetailService receiptDetailService; + @Resource + private ReceiptTypeService receiptTypeService; + @Resource + private WarehouseService warehouseService; + @Resource + private CompanyService companyService; + @Resource + private MaterialService materialService; + @Resource + private SupplierService supplierService; + @Resource + private FilterConfigDetailService filterConfigDetailService; + @Resource + private StatusFlowHeaderService statusFlowHeaderService; + /** + * 入库单下发 + * @param receipt 入库单 + * @return 是否下发成功 + */ + @Transactional(rollbackFor = Exception.class) + public AjaxResult insertReceipt(Receipt receipt){ + + /* 0.step 获取入库头表,获取入库明细*/ + ReceiptHeader receiptHeader = receipt.getReceiptHeader(); + List<ReceiptDetail> receiptDetails = receipt.getReceiptDetails(); + /* 1.step 校验入库单是否为空*/ + if (receiptHeader == null || receiptDetails.isEmpty()){ + throw new ServiceException("入库主单或入库子单为空"); + } + /* 2.step 检查入库头表合法性*/ + AjaxResult checkReceiptHeaderResult = checkReceiptHeader(receiptHeader); + if (checkReceiptHeaderResult.hasErr() ){ + return AjaxResult.error(checkReceiptHeaderResult.getMsg()); + } + + /* 3.step 检查入库明细合法性*/ + AjaxResult checkReceiptDetailResult = checkReceiptDetail(receiptDetails); + if (checkReceiptDetailResult.hasErr() ){ + return AjaxResult.error(checkReceiptDetailResult.getMsg()); + } + + /* 4.step 计算入库明细总行数、总数量*/ + BigDecimal totalQty = new BigDecimal(0); + for (ReceiptDetail receiptDetail: receiptDetails) { + totalQty.add(receiptDetail.getTotalQty()); + } + receiptHeader.setTotalLines(receiptDetails.size()); + receiptHeader.setTotalQty(totalQty); + + /* 5.step 保存的入库头表*/ + if (!receiptHeaderService.save(receiptHeader)){ + throw new ServiceException("保存入库头表失败"); + } + + /* 6.step 保存入库明细*/ + LambdaQueryWrapper<ReceiptHeader> lambda = Wrappers.lambdaQuery(); + lambda.eq(ReceiptHeader::getWarehouseCode, receiptHeader.getWarehouseCode()) + .eq(ReceiptHeader::getCode, receiptHeader.getCode()); + receiptHeader = receiptHeaderService.getOne(lambda); + for (ReceiptDetail receiptDetail : receiptDetails) { + receiptDetail.setReceiptId(receiptHeader.getId()); + receiptDetail.setReceiptCode(receiptHeader.getCode()); + receiptDetail.setWarehouseCode(receiptHeader.getWarehouseCode()); + receiptDetail.setCompanyCode(receiptHeader.getWarehouseCode()); + Material material = materialService.findAllByCode(receiptDetail.getMaterialCode()); + receiptDetail.setMaterialName(material.getName()); + receiptDetail.setMaterialSpec(material.getSpec()); + receiptDetail.setMaterialUnit(material.getUnit()); + if (!receiptDetailService.save(receiptDetail)){ + throw new ServiceException("保存入库明细失败"); + } + } + + return AjaxResult.success("成功"); + } + + /** + * 检查入库头表合法性 + * @param receiptHeader 入库头表 + * @return 检查结果 + */ + private AjaxResult checkReceiptHeader(ReceiptHeader receiptHeader){ + /* 0.step 必填项是否为空*/ + if (StringUtils.isEmpty(receiptHeader.getCode()) || StringUtils.isEmpty(receiptHeader.getCompanyCode()) || + StringUtils.isEmpty(receiptHeader.getWarehouseCode()) || StringUtils.isEmpty(receiptHeader.getReceiptType())){ + return AjaxResult.error("入库主单字段有误"); + } + + /* 1.step 查询该单据编码是否已存在*/ + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambda = Wrappers.lambdaQuery(receiptHeader); + if (receiptHeaderService.getOne(receiptHeaderLambda) != null){ + return AjaxResult.error("该单据已存在:"+receiptHeader.getCode()); + } + + /* 2.step 判断入库类型是否匹配*/ + LambdaQueryWrapper<ReceiptType> receiptTypeLambda = Wrappers.lambdaQuery(); + receiptTypeLambda.eq(ReceiptType::getCode, receiptHeader.getReceiptType()); + if (receiptTypeService.getOne(receiptTypeLambda) == null){ + return AjaxResult.error("没有对应的入库单类型"); + } + + /* 3.step 判断仓库是否存在*/ + LambdaQueryWrapper<Warehouse> warehouseLambda = Wrappers.lambdaQuery(); + warehouseLambda.eq(Warehouse::getCode, receiptHeader.getWarehouseCode()); + if (warehouseService.getOne(warehouseLambda) == null){ + return AjaxResult.error("该仓库不存在"); + } + + /* 4.step 判断货主是否存在*/ + LambdaQueryWrapper<Company> companyLambda = Wrappers.lambdaQuery(); + companyLambda.eq(Company::getCode, receiptHeader.getCompanyCode()); + if (companyService.getOne(companyLambda) == null){ + return AjaxResult.error("该货主不存在"); + } + + return AjaxResult.success(""); + } + + /** + * 检查入库明细合法性 + * @param receiptDetails 入库明细 + * @return 检查结果 + */ + private AjaxResult checkReceiptDetail(List<ReceiptDetail> receiptDetails){ + + for (ReceiptDetail receiptDetail: receiptDetails) { + /* 0.step 判断必填字段是否为空且总数量不能为0*/ + if (receiptDetail.getMaterialCode() == null || + new BigDecimal(0).compareTo(receiptDetail.getTotalQty() != null ? + receiptDetail.getTotalQty() : new BigDecimal(0)) == 0 ){ + return AjaxResult.error("入库明细字段有误"); + } + + /* 1.step 判断供应商是否存在*/ + if (receiptDetail.getSupplierCode() != null){ + LambdaQueryWrapper<Supplier> supplierLambda = Wrappers.lambdaQuery(); + supplierLambda.eq(Supplier::getCode, receiptDetail.getSupplierCode()); + if (supplierService.getOne(supplierLambda) == null) { + return AjaxResult.error("供应商不存在"); + } + } + + /* 2.step 判断定位规则是否存在*/ + if (receiptDetail.getLocatingRule() != null){ + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, receiptDetail.getLocatingRule()) + .eq(FilterConfigDetail::getModuleType, "receipt") + .eq(FilterConfigDetail::getRecordType, "locationRule"); + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); + if (filterConfigDetail == null){ + return AjaxResult.error(receiptDetail.getLocatingRule()+"定位规则不存在"); + } + } + + /* 3.step 判断流程编码是否存在*/ + if (receiptDetail.getStatusFlowCode() != null){ + LambdaQueryWrapper<StatusFlowHeader> statusFlowHeaderLambda = Wrappers.lambdaQuery(); + statusFlowHeaderLambda.eq(StatusFlowHeader::getCode, receiptDetail.getStatusFlowCode()) + .eq(StatusFlowHeader::getModuleType, "receipt") + .eq(StatusFlowHeader::getRecordType, "receivingFlow"); + StatusFlowHeader statusFlowHeader = statusFlowHeaderService.getOne(statusFlowHeaderLambda); + if (statusFlowHeader == null){ + return AjaxResult.error(receiptDetail.getLocatingRule()+"该流程不存在"); + } + } + } + + return AjaxResult.success(""); + } + +} diff --git a/src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java b/src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java new file mode 100644 index 0000000..e93e298 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/controller/EmptyOutHandle.java @@ -0,0 +1,41 @@ +package com.huaheng.api.wcs.controller; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService; +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/**空出处理接口 + * wcs向wms传递数据 + * @author ricard + * @date 2019/10/11 + * + */ + +@RestController +@RequestMapping("/api/WCS/v2") +public class EmptyOutHandle extends BaseController { + + @Resource + private EmptyOutHandleService emptyOutHandleService; + + @Log(title = "wcs空出处理", action = BusinessType.INSERT) + @PostMapping("/EmptyOutHandle") + @ApiOperation("wcs空出处理") + @ResponseBody + public AjaxResult EmptyOutHandle(@RequestBody WcsTask wcsTask) + { + AjaxResult ajaxResult =emptyOutHandleService.EmptyOutHandle(wcsTask) ; + return ajaxResult; + } + + +} diff --git a/src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java b/src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java new file mode 100644 index 0000000..c778985 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/controller/OverrideHandle.java @@ -0,0 +1,40 @@ +package com.huaheng.api.wcs.controller; + +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/**重入处理接口 + * wcs向wms传递数据 + * @author ricard + * @date 2019/10/11 + * + */ + +@RestController +@RequestMapping("/api/WCS/v2") +public class OverrideHandle extends BaseController { + + @Resource + private OverrideHandleService overrideHandleService; + + @Log(title = "wcs重入处理", action = BusinessType.INSERT) + @PostMapping("/OverrideHandle") + @ApiOperation("wcs重入处理") + @ResponseBody + public AjaxResult OverrideHandle(@RequestBody TaskFinishDomain taskFinishDomain) + { + AjaxResult ajaxResult =overrideHandleService.OverrideHandle(taskFinishDomain) ; + return ajaxResult; + } + + +} diff --git a/src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java b/src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java new file mode 100644 index 0000000..1806259 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/controller/TaskFinish.java @@ -0,0 +1,41 @@ +package com.huaheng.api.wcs.controller; + +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.api.wcs.service.taskFinish.TaskFinishService; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/**任务完成 + * wcs向wms传递数据 + * @author ricard + * @date 2019/10/11 + * + */ + +@RestController +@RequestMapping("/api/WCS/v2") +public class TaskFinish extends BaseController { + + @Resource + private TaskFinishService taskFinishService; + + @Log(title = "wcs任务完成", action = BusinessType.INSERT) + @PostMapping("/TaskFinish") + @ApiOperation("wcs任务完成") + @ResponseBody + public AjaxResult TaskFinish(@RequestBody TaskFinishDomain taskFinishDomain) + { + AjaxResult ajaxResult =taskFinishService.completeTaskByWCS(taskFinishDomain) ; + return ajaxResult; + } + + +} diff --git a/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java b/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java new file mode 100644 index 0000000..9dcbb1c --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java @@ -0,0 +1,41 @@ +package com.huaheng.api.wcs.controller; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService; +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/**仓位分配 接口 + * wcs向wms传递数据 + * @author ricard + * @date 2019/10/11 + * + */ + +@RestController +@RequestMapping("/api/WCS/v2") +public class WarecellAllocation extends BaseController { + + @Resource + private WarecellAllocationService warecellAllocationService; + + @Log(title = "wcs仓位分配", action = BusinessType.INSERT) + @PostMapping("/WarecellAllocation") + @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST") + @ResponseBody + public AjaxResult WarecellAllocation(@RequestBody WcsTask wcsTask) + { + AjaxResult ajaxResult =warecellAllocationService.WarecellAllocation(wcsTask) ; + return ajaxResult; + } + + +} diff --git a/src/main/java/com/huaheng/api/wcs/domain/TaskDetails.java b/src/main/java/com/huaheng/api/wcs/domain/TaskDetails.java new file mode 100644 index 0000000..d92a09a --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/domain/TaskDetails.java @@ -0,0 +1,27 @@ +package com.huaheng.api.wcs.domain; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * Created by Enzo Cotter on 2019/10/15. + */ +@Data +public class TaskDetails { + + //关联行号,string (50),默认0 ",必填 + private String referLineNo; + + //物料编码,string (50),默认0 ",必填 + private String materialCode; + + //物料名称 + private String materialName; + + //数量,float,默认“0” ,必填" + private BigDecimal qty; + + //单位,string(20),默认“PCS” ,必填" + private String unit; +} diff --git a/src/main/java/com/huaheng/api/wcs/domain/TaskFinishDomain.java b/src/main/java/com/huaheng/api/wcs/domain/TaskFinishDomain.java new file mode 100644 index 0000000..2ba3544 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/domain/TaskFinishDomain.java @@ -0,0 +1,26 @@ +package com.huaheng.api.wcs.domain; + +import lombok.Data; + +/** + * 任务完成和重入实体类 + * Created by Enzo Cotter on 2019/10/15. + */ +@Data +public class TaskFinishDomain { + + //任务号 + private String taskNo; + + //重入,int,1:重入 0:正常,必填 + private Integer isDoubleIn; + + //空出,int,1:空出 0:正常,必填 + private Integer isEmptyOut; + + //重入的库位编码,string (50),默认0,必填 + private String redirectionLocationCode; + + //目的位置编码,string (50),默认0 ",必填 + private String toLocationCode; +} diff --git a/src/main/java/com/huaheng/api/wcs/domain/WcsTask.java b/src/main/java/com/huaheng/api/wcs/domain/WcsTask.java new file mode 100644 index 0000000..3176255 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/domain/WcsTask.java @@ -0,0 +1,73 @@ +package com.huaheng.api.wcs.domain; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * wcs任务接口实体层 + * @author ricard + * @date 2019/10/11 + */ + +@Data +public class WcsTask implements Serializable { + private static final long serialVersionUID = -8855840499538794854L; + + //任务号 + private String taskNo; + + //前置任务 + private String preTaskNo; + + //任务类型 + private String taskType; + + //出库站台编码.默认‘0’ + private String station; + + //平台 + private String platform; + + //容器编码 + private String containerCode; + + //来源口”,一般用于指定入库口,string (50),默认0,必填 + private String fromPort; + + //目的口”,出库性质的任务必须填写,string (50),默认0,必填 + private String toPort; + + //源位置库位编码 + private String fromLocationCode; + + //目的位置库位编码 + private String toLocationCode; + + //重入后再次分配的位置编码 + private String locationCode; + + //优先级,int,默认100 ,数字越小优先级越高",必填 + private Integer priority; + + //巷道 + private String roadWay; + + //长 + private String length; + + //宽 + private String width; + + //高 + private String height; + + //重 + private String weight; + + //备注 + private String remark; + + private List<TaskDetails> taskDetails; +} diff --git a/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java b/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java new file mode 100644 index 0000000..069839a --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleService.java @@ -0,0 +1,9 @@ +package com.huaheng.api.wcs.service.emptyOutHandle; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.framework.web.domain.AjaxResult; + +public interface EmptyOutHandleService { + //空出处理 + AjaxResult EmptyOutHandle(WcsTask wcsTask); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java new file mode 100644 index 0000000..ff615fb --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java @@ -0,0 +1,53 @@ +package com.huaheng.api.wcs.service.emptyOutHandle; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class EmptyOutHandleServiceImpl implements EmptyOutHandleService { + + + @Autowired + private TaskHeaderService taskHeaderService; + + /** + * 空出处理 + * 1、判断非空字段 + * 2、根据任务号查找任务 + * 3、修改该任务为空出,过后处理 + * @param wcsTask + * @return + */ + @Override + @Transactional + public AjaxResult EmptyOutHandle(WcsTask wcsTask) { + + //1、判断非空字段 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ + return AjaxResult.error("任务号为空"); + } + + //2、根据任务号查找任务 + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(wcsTask.getTaskNo())); + if(taskHeader == null){ + return AjaxResult.error("任务号错误,没有找到该任务"); + } + if(taskHeader.getStatus() == 100){ + return AjaxResult.error("任务已完成"); + } + + //3、修改该任务为空出,过后处理 + taskHeader.setExceptionCode("空托出库"); + Boolean flag = taskHeaderService.updateById(taskHeader); + if(flag == false){ + return AjaxResult.error("修改任务失败,空出处理失败"); + } + return AjaxResult.success("空出处理成功"); + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java new file mode 100644 index 0000000..af4a31b --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleService.java @@ -0,0 +1,11 @@ +package com.huaheng.api.wcs.service.overrideHandle; + +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.framework.web.domain.AjaxResult; + +public interface OverrideHandleService { + + //重入处理 + AjaxResult OverrideHandle(TaskFinishDomain taskFinishDomain); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java new file mode 100644 index 0000000..91f2b1e --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java @@ -0,0 +1,205 @@ +package com.huaheng.api.wcs.service.overrideHandle; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.api.wcs.service.warecellAllocation.WarecellAllocationService; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; +import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; +import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; +import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; +import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service +public class OverrideHandleServiceImpl implements OverrideHandleService { + + + @Autowired + private TaskHeaderService taskHeaderService; + @Autowired + private TaskDetailService taskDetailService; + @Autowired + private LocationService locationService; + @Autowired + private ReceiptContainerHeaderService receiptContainerHeaderService; + @Autowired + private ReceiptContainerDetailService receiptContainerDetailService; + @Resource + private WarecellAllocationService warecellAllocationService; + @Resource + private FilterConfigDetailService filterConfigDetailService; + + /** + * 重入处理 + * 1、判断非空字段 + * 2、根据任务号查找任务 + * 3、修改任务目的库位,修改入库组盘的库位,修改库位状态 + */ + + @Override + @Transactional + public AjaxResult OverrideHandle(TaskFinishDomain taskFinishDomain) { + Boolean flag = true; + + //1、判断非空字段 + if(StringUtils.isEmpty(taskFinishDomain.getTaskNo())){ + return AjaxResult.error("任务号为空"); + } + if(StringUtils.isEmpty(taskFinishDomain.getToLocationCode())){ + return AjaxResult.error("目的库位为空"); + } + if(StringUtils.isEmpty(taskFinishDomain.getRedirectionLocationCode())){ + return AjaxResult.error("重入的库位编码为空"); + } + + + + //2、根据任务号查找任务 + TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(taskFinishDomain.getTaskNo())); + if(taskHeader == null){ + return AjaxResult.error("任务号错误,没有找到该任务"); + } + if(taskHeader.getStatus() == 100){ + return AjaxResult.error("任务已完成"); + } + + //3、修改任务目的库位,修改入库组盘的库位,修改库位状态 + //修改原来目的库位的状态 + LambdaQueryWrapper<Location> locationLam = Wrappers.lambdaQuery(); + locationLam.eq(Location::getCode,taskHeader.getToLocation()) + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); + Location location = locationService.getOne(locationLam); + if(location == null){ + return AjaxResult.error("此任务的原目的库位在系统中不存在"); + } + location.setStatus("empty"); + location.setContainerCode(""); + flag = locationService.updateById(location); + if(flag == false){ + return AjaxResult.error("修改此任务的原目的库位错误"); + } + + + /** + * 查看新库位有两种情况 + * 1、重入的库位由wcs提供 + * 2、重入的库位由wms提供 + */ + + Location newlocation =new Location(); + String code=ShiroUtils.getWarehouseCode(); + //重入的库位由wcs提供 + if(!taskFinishDomain.getRedirectionLocationCode().equals("0")) { + LambdaQueryWrapper<Location> locationLa = Wrappers.lambdaQuery(); + locationLa.eq(Location::getCode, taskFinishDomain.getRedirectionLocationCode()) + .eq(Location::getStatus,"empty") + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); + newlocation = locationService.getOne(locationLa); + if (newlocation == null) { + throw new ServiceException("新目的库位在系统中不存在或非空闲"); + } + if(StringUtils.isNotEmpty(newlocation.getContainerCode())){ + throw new ServiceException("新目的库位在系统中已经有容器"); + } + }else { + //重入的库位由wms提供 + //查询任务明细 + LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery(); + taskDetailLambda.eq(TaskDetail::getTaskId, taskFinishDomain.getTaskNo()); + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda); + //查询入库组盘明细 + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); + for (TaskDetail taskDetail : taskDetailList) { + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId())); + } + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetailList.get(0).getReceiptContainerId()); + String locatingRule = warecellAllocationService.taskPositioning(receiptContainerDetailList.get(0)); + + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule); + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); + + //根据定位规则查询库位编码 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); + locationLambda.last(filterConfigDetail.getStatement()); + newlocation = locationService.getOne(locationLambda); + } + + //修改任务 + taskHeader.setToLocation(newlocation.getCode()); + taskHeader.setExceptionCode("重入处理"); + flag = taskHeaderService.updateById(taskHeader); + if(flag == false){ + throw new ServiceException("修改此任务错误"); + } + + //修改子任务 + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery(); + taskDetailLam.eq(TaskDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()) + .eq(TaskDetail::getTaskId,taskHeader.getId()); + List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLam); + List<TaskDetail> taskDetailList = new ArrayList<>(); + if(taskDetails != null && taskDetails.size()> 0){ + for(TaskDetail taskDetail : taskDetails){ + taskDetail.setToLocation(newlocation.getCode()); + taskDetailList.add(taskDetail); + } + flag = taskDetailService.updateBatchById(taskDetailList); + if(flag == false){ + throw new ServiceException("修改此任务的明细错误"); + } + } + + //修改入库组盘 + if(taskHeader.getAllocationHeadId() == null){ + throw new ServiceException("找不到此任务的组盘头id"); + } + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(taskHeader.getAllocationHeadId()); + if(receiptContainerHeader == null){ + throw new ServiceException("找不到此任务的组盘头"); + } + receiptContainerHeader.setToLocation(newlocation.getCode()); + flag = receiptContainerHeaderService.updateById(receiptContainerHeader); + if(flag == false){ + throw new ServiceException("修改此任务对应的组盘头错误"); + } + + //修改入库组盘明细 + LambdaQueryWrapper<ReceiptContainerDetail> lam = Wrappers.lambdaQuery(); + lam.eq(ReceiptContainerDetail::getReceiptContainerId,receiptContainerHeader.getId()) + .eq(ReceiptContainerDetail::getWarehouseCode,ShiroUtils.getWarehouseCode()); + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lam); + + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); + if(receiptContainerDetails != null && receiptContainerDetails.size()> 0){ + for(ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ + receiptContainerDetail.setLocationCode(newlocation.getCode()); + receiptContainerDetailList.add(receiptContainerDetail); + } + flag = receiptContainerDetailService.updateBatchById(receiptContainerDetailList); + if(flag == false){ + throw new ServiceException("修改此任务的组盘明细错误"); + } + } + return AjaxResult.success("重入处理成功"); + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java b/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java new file mode 100644 index 0000000..342ebf7 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoService.java @@ -0,0 +1,10 @@ +package com.huaheng.api.wcs.service.stationInfo; + +import com.huaheng.framework.web.domain.AjaxResult; + +public interface StationInfoService { + + //站台信息查询 + AjaxResult StationInfo(String station); + +} diff --git a/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java new file mode 100644 index 0000000..4292c3e --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/stationInfo/StationInfoServiceImpl.java @@ -0,0 +1,52 @@ +package com.huaheng.api.wcs.service.stationInfo; + + +import com.alibaba.fastjson.JSON; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.http.HttpUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.address.service.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class StationInfoServiceImpl implements StationInfoService { + + @Autowired + private AddressService addressService; + + /** + * 站台信息查询 + * 1、判断非空字段 + * 2、实体转换 + * 3、发送数据 + * @param station + * @return + */ + @Override + public AjaxResult StationInfo(String station) { + + //1、判断非空字段 + if(StringUtils.isEmpty(station)){ + return AjaxResult.error("站台为空"); + } + + //2、实体转换 + WcsTask wcsTask =new WcsTask(); + wcsTask.setStation(station); + + //3、发送数据 + String param="wcs"; + String url=addressService.selectAddress(param)+"StationInfo"; + String JsonParam = JSON.toJSONString(wcsTask); + String result = HttpUtils.bodypost(url, JsonParam); + if(StringUtils.isEmpty(result)){ + throw new ServiceException("接口地址错误"); + } + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); + return ajaxResult; + + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java new file mode 100644 index 0000000..bddee07 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignService.java @@ -0,0 +1,16 @@ +package com.huaheng.api.wcs.service.taskAssignService; + +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; + +/** + * 任务下发接口Service层 + * @author ricard + * @date 2019/10/11 + * + */ +public interface TaskAssignService { + + //wms下发任务给wcs + AjaxResult wcsTaskAssign(TaskHeader taskHeader); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java new file mode 100644 index 0000000..bde0822 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java @@ -0,0 +1,151 @@ +package com.huaheng.api.wcs.service.taskAssignService; + + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.wcs.domain.TaskDetails; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.http.HttpUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.address.service.AddressService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * 任务下发接口ServiceImpl层 + * @author ricard + * @date 2019/10/11 + * + */ + +@Service +public class TaskAssignServiceImpl implements TaskAssignService { + + @Autowired + private AddressService addressService; + @Autowired + private TaskDetailService taskDetailService; + + + public static String platform = "wms"; + + //wms下发任务给wcs + /** + * 1、判断taskHeader是否为空 + * 2、判断必填字段是否满足 + * 3、转换实体 + * 4、发送数据 + * + * @param taskHeader + * @return + */ + @Override + @Transactional + public AjaxResult wcsTaskAssign(TaskHeader taskHeader) { + //1、判断taskHeader是否为空 + if(taskHeader == null){ + throw new ServiceException("wms任务为空"); + } + + //2、判断必填字段是否满足 + if(taskHeader.getId() == null){ + throw new ServiceException("wms任务号Id为空"); + } + if(taskHeader.getTaskType() == null){ + throw new ServiceException("wms任务类型为空"); + } + if(StringUtils.isEmpty(taskHeader.getContainerCode())){ + throw new ServiceException("wms任务中容器为空"); + } + + + //入库性质的任务源库位不能为空 + if(taskHeader.getTaskType()==100 || taskHeader.getTaskType()==200 + || taskHeader.getTaskType()==500 || taskHeader.getTaskType()==800) { + if (taskHeader.getFromLocation() == null) { + throw new ServiceException("源库位为空"); + } + } + + // 出库性质的任务目的库位不能为空 + if(taskHeader.getTaskType()==300 || taskHeader.getTaskType()==400 + || taskHeader.getTaskType()==600 || taskHeader.getTaskType()==700 + || taskHeader.getTaskType()==800 || taskHeader.getTaskType()==900) + { + if (taskHeader.getToLocation() == null) { + throw new ServiceException("目的库位为空"); + } + } + + //3、转换实体,初始化wcs任务实体 + WcsTask wcsTask = new WcsTask(); + wcsTask.setTaskNo(taskHeader.getId().toString()); + wcsTask.setPreTaskNo("0"); + wcsTask.setTaskType(taskHeader.getTaskType().toString()); + wcsTask.setFromPort("1000"); + wcsTask.setToPort("0"); + wcsTask.setContainerCode(taskHeader.getContainerCode()); + if(StringUtils.isEmpty(taskHeader.getFromLocation())){ + wcsTask.setFromLocationCode("0"); + }else { + wcsTask.setFromLocationCode(taskHeader.getFromLocation()); + } + if(StringUtils.isEmpty(taskHeader.getToLocation())){ + wcsTask.setToLocationCode("0"); + }else { + wcsTask.setToLocationCode(taskHeader.getToLocation()); + } + wcsTask.setPriority(100); + wcsTask.setRemark("0"); + wcsTask.setPlatform(platform); + + //找到任务明细 + LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery(); + taskDetailLam.eq(TaskDetail::getTaskId,taskHeader.getId()); + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLam); + if(taskDetailList == null){ + throw new ServiceException("没有子任务"); + } + List<TaskDetails> taskDetails =new ArrayList<>(); + for(TaskDetail item : taskDetailList){ + TaskDetails details = new TaskDetails(); + details.setMaterialCode(item.getMaterialCode()); + details.setMaterialName(item.getMaterialName()); + if(StringUtils.isEmpty(item.getMaterialUnit())){ + details.setUnit("PCS"); + }else { + details.setUnit(item.getMaterialUnit()); + } + details.setQty(item.getQty()); + details.setReferLineNo(item.getId().toString()); + taskDetails.add(details); + } + + wcsTask.setTaskDetails(taskDetails); + + //4、发送数据 + String param="wcs"; + String url=addressService.selectAddress(param)+"TaskAssign"; + String JsonParam = JSON.toJSONString(wcsTask); + System.out.println(JsonParam); + String result = HttpUtils.bodypost(url, JsonParam); + if(StringUtils.isEmpty(result)){ + throw new ServiceException("接口地址错误"); + } + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); + if(ajaxResult.getCode()!=200){ + throw new ServiceException(ajaxResult.getMsg()); + } + return ajaxResult; + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java b/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java new file mode 100644 index 0000000..5bf9238 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelService.java @@ -0,0 +1,10 @@ +package com.huaheng.api.wcs.service.taskCancel; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.framework.web.domain.AjaxResult; + +public interface TaskCancelService { + + //取消任务 + AjaxResult TaskCance(Integer id); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java new file mode 100644 index 0000000..027dd51 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskCancel/TaskCancelServiceImpl.java @@ -0,0 +1,51 @@ +package com.huaheng.api.wcs.service.taskCancel; + +import com.alibaba.fastjson.JSON; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.http.HttpUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.address.service.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TaskCancelServiceImpl implements TaskCancelService { + + + @Autowired + private AddressService addressService; + + /**取消任务 + * 1、判断参数是否为空 + * 2、转换实体 + * 3、发送数据 + * @param id + * @return + */ + @Override + public AjaxResult TaskCance(Integer id) { + + //1、判断参数是否为空 + if(id == null){ + throw new ServiceException("任务号为空"); + } + + + //2、转换实体 + WcsTask wcsTask = new WcsTask(); + wcsTask.setTaskNo(id.toString()); + + //3、发送数据 + String param="wcs"; + String url=addressService.selectAddress(param)+"TaskCancel"; + String JsonParam = JSON.toJSONString(wcsTask); + String result = HttpUtils.bodypost(url, JsonParam); + if(StringUtils.isEmpty(result)){ + throw new ServiceException("接口地址错误"); + } + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); + return ajaxResult; + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java b/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java new file mode 100644 index 0000000..8eb2bc1 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishService.java @@ -0,0 +1,10 @@ +package com.huaheng.api.wcs.service.taskFinish; + +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.framework.web.domain.AjaxResult; + +public interface TaskFinishService { + + //任务完成 + AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java new file mode 100644 index 0000000..6355658 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskFinish/TaskFinishServiceImpl.java @@ -0,0 +1,50 @@ +package com.huaheng.api.wcs.service.taskFinish; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.wcs.domain.TaskFinishDomain; +import com.huaheng.common.support.Convert; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TaskFinishServiceImpl implements TaskFinishService { + + @Autowired + private TaskHeaderService taskHeaderService; + + //任务完成 + @Override + public AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain) { + AjaxResult ajaxResult=new AjaxResult(); + if(StringUtils.isEmpty(taskFinishDomain.getTaskNo())){ + return AjaxResult.error("任务号为空"); + } + if(taskFinishDomain.getIsEmptyOut() == 1){ + LambdaQueryWrapper<TaskHeader> lam = Wrappers.lambdaQuery(); + lam.eq(TaskHeader::getId,Integer.valueOf(taskFinishDomain.getTaskNo())); + TaskHeader taskHeader = taskHeaderService.getOne(lam); + if(taskHeader == null){ + return AjaxResult.error("wms系统没有此任务号"); + } + if(StringUtils.isEmpty(taskHeader.getExceptionCode())) { + taskHeader.setExceptionCode("空托出库"); + Boolean flag = taskHeaderService.updateById(taskHeader); + if (flag == false) { + return AjaxResult.error("修改任务失败,空出处理失败"); + } + } + return AjaxResult.success("成功"); + } + try{ + ajaxResult=taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskFinishDomain.getTaskNo())); + } catch (Exception e) { + e.printStackTrace(); + } + return ajaxResult; + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java b/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java new file mode 100644 index 0000000..9fc8089 --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoService.java @@ -0,0 +1,9 @@ +package com.huaheng.api.wcs.service.taskInfo; + +import com.huaheng.framework.web.domain.AjaxResult; + +public interface TaskInfoService { + + //任务信息查询 + AjaxResult TaskInfo(Integer id); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java new file mode 100644 index 0000000..16977bc --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/taskInfo/TaskInfoServiceImpl.java @@ -0,0 +1,52 @@ +package com.huaheng.api.wcs.service.taskInfo; + +import com.alibaba.fastjson.JSON; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.http.HttpUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.address.service.AddressService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TaskInfoServiceImpl implements TaskInfoService { + + + @Autowired + private AddressService addressService; + /** + * 任务信息查询 + * 1、判断非空字段 + * 2、实体转换 + * 3、发送数据 + * + * @param id + * @return + */ + @Override + public AjaxResult TaskInfo(Integer id) { + + //1、判断非空字段 + if(id == null){ + return AjaxResult.error("任务号为空"); + } + + + //2、实体转换 + WcsTask wcsTask =new WcsTask(); + wcsTask.setTaskNo(id.toString()); + + //3、发送数据 + String param="wcs"; + String url=addressService.selectAddress(param)+"TaskInfo"; + String JsonParam = JSON.toJSONString(wcsTask); + String result = HttpUtils.bodypost(url, JsonParam); + if(StringUtils.isEmpty(result)){ + throw new ServiceException("接口地址错误"); + } + AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class); + return ajaxResult; + } +} diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java new file mode 100644 index 0000000..5527afd --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationService.java @@ -0,0 +1,13 @@ +package com.huaheng.api.wcs.service.warecellAllocation; + +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; + +public interface WarecellAllocationService { + + //仓位分配 + AjaxResult WarecellAllocation(WcsTask wcsTask); + + String taskPositioning(ReceiptContainerDetail receiptContainerDetail); +} diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java new file mode 100644 index 0000000..c874a1e --- /dev/null +++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java @@ -0,0 +1,250 @@ +package com.huaheng.api.wcs.service.warecellAllocation; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.wcs.domain.WcsTask; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; +import com.huaheng.pc.config.configValue.domain.ConfigValue; +import com.huaheng.pc.config.configValue.service.ConfigValueService; +import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.config.locationType.domain.LocationType; +import com.huaheng.pc.config.locationType.service.LocationTypeService; +import com.huaheng.pc.config.material.domain.Material; +import com.huaheng.pc.config.material.service.MaterialService; +import com.huaheng.pc.config.materialType.domain.MaterialType; +import com.huaheng.pc.config.materialType.service.MaterialTypeService; +import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference; +import com.huaheng.pc.config.receiptPreference.service.ReceiptPreferenceService; +import com.huaheng.pc.receipt.receiptContainerDetail.domain.ReceiptContainerDetail; +import com.huaheng.pc.receipt.receiptContainerDetail.service.ReceiptContainerDetailService; +import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader; +import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class WarecellAllocationServiceImpl implements WarecellAllocationService { + + @Resource + private LocationTypeService locationTypeService; + @Resource + private LocationService locationService; + @Resource + private ConfigValueService configValueService; + @Resource + private ReceiptPreferenceService receiptPreferenceService; + @Resource + private FilterConfigDetailService filterConfigDetailService; + @Resource + private TaskDetailService taskDetailService; + @Resource + private TaskHeaderService taskHeaderService; + @Resource + private ReceiptContainerDetailService receiptContainerDetailService; + @Resource + private ReceiptContainerHeaderService receiptContainerHeaderService; + @Resource + private ReceiptDetailService receiptDetailService; + @Resource + private MaterialService materialService; + @Resource + private MaterialTypeService materialTypeService; + + /** + * 仓位分配 + * 1、判断非空字段 + * 2、实体转换 + * 3、查询满足条件的库位类型 + * @param wcsTask + * @return + */ + @Override + public AjaxResult WarecellAllocation(WcsTask wcsTask) { + + //1、判断非空字段 + if(StringUtils.isEmpty(wcsTask.getTaskNo())){ + return AjaxResult.error("任务号为空"); + } + if(StringUtils.isEmpty(wcsTask.getRoadWay())){ + return AjaxResult.error("巷道为空"); + } + if(StringUtils.isNull(wcsTask.getLength())){ + return AjaxResult.error("长为空"); + } + if(StringUtils.isNull(wcsTask.getWidth())){ + return AjaxResult.error("宽为空"); + } + if(StringUtils.isNull(wcsTask.getHeight())){ + return AjaxResult.error("高为空"); + } + if(StringUtils.isNull(wcsTask.getWeight())){ + return AjaxResult.error("重为空"); + } + + //查询满足条件的库位类型 + LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.gt(LocationType::getLength,wcsTask.getLength()) + .gt(LocationType::getWidth, wcsTask.getWidth()) + .gt(LocationType::getHeight, wcsTask.getHeight()) + .gt(LocationType::getMaxWeight, wcsTask.getWidth()); + List<LocationType> locationTypeList = locationTypeService.list(lambdaQueryWrapper); + List<String> codeList = new ArrayList<>(); + for (LocationType locationType: locationTypeList) { + codeList.add(locationType.getCode()); + } + + String locationCode = null; + //查询任务明细 + LambdaQueryWrapper<TaskDetail> taskDetailLambda = Wrappers.lambdaQuery(); + taskDetailLambda.eq(TaskDetail::getTaskId, wcsTask.getTaskNo()); + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambda); + + List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); + for (TaskDetail taskDetail : taskDetailList) { + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId())); + } + //去重 + receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); + + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetailList) { + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); + + String locatingRule = this.taskPositioning(receiptContainerDetail); + + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery(); + filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule); + FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda); + String[] locatingRules = filterConfigDetail.getStatement().split("limit"); + + //根据定位规则查询库位编码 + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); + locationLambda.last(locatingRules[0]); + List<Location> locationList = locationService.list(locationLambda); +// locationList.stream().filter(location -> location.getLocationType().equals(locationTypeList.get(0))); + locationCode = filter(locationList, locationTypeList, wcsTask.getRoadWay()); + if (StringUtils.isEmpty(locationCode)){ + throw new ServiceException("没有库位可分配"); + } + + if (StringUtils.isNotEmpty(locationCode)){ + locationService.updateStatus(locationCode, "lock"); + } else { + throw new ServiceException("定位失败,请检查定位规则是否正确"); + } + + //更新库位编码到组盘头表 + receiptContainerHeader.setToLocation(locationCode); + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)){ + throw new ServiceException("更新库位失败"); + } + + //把库位编码赋到该入库组盘头表下的所有明细 + LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); + lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId()); + List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); + for (ReceiptContainerDetail receiptContainerDetail2: receiptContainerDetails) { + receiptContainerDetail2.setLocationCode(locationCode); + if (!receiptContainerDetailService.updateById(receiptContainerDetail2)){throw new ServiceException("更新库位编码到入库组盘明细");} + } + + } + + if (StringUtils.isNotEmpty(locationCode)){ + //修改任务明细目标库位 + for (TaskDetail taskDetail : taskDetailList) { + taskDetail.setToLocation(locationCode); + if (!taskDetailService.updateById(taskDetail)){ throw new ServiceException("更新任务明细目标库位失败");} + } + + TaskHeader taskHeader = taskHeaderService.getById(wcsTask.getTaskNo()); + + taskHeader.setToLocation(locationCode); + if (!taskHeaderService.updateById(taskHeader)){throw new ServiceException("更新任务头表目标库位失败");} + WcsTask wcsTaskResult = new WcsTask(); + wcsTaskResult.setToLocationCode(locationCode); + return AjaxResult.success(wcsTaskResult); + } + + return AjaxResult.error("错误"); + } + + /** + * 库位筛选 + * @param locationList 库位列表 + * @param locationTypeList 库位类型列表 + * @param roadway 巷道 + * @return + */ + public String filter(List<Location> locationList, List<LocationType> locationTypeList, String roadway){ + List<String> codeList = locationTypeList.stream().map(t-> t.getCode()).collect(Collectors.toList()); + List<Location> newLocation = locationList.stream().filter(t-> codeList.contains(t.getLocationType()) && t.getRoadway().equals(roadway)).collect(Collectors.toList()); + if (newLocation.isEmpty()){ + return null; + } else{ + return newLocation.get(0).getCode(); + } + } + + /** + * 定位 + * @param receiptContainerDetail + * @return + */ + @Override + public String taskPositioning(ReceiptContainerDetail receiptContainerDetail){ + ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); + String locatingRule = receiptContainerHeader.getLocatingRule(); //定位规则 + if (StringUtils.isEmpty(locatingRule)){ + locatingRule = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()).getLocatingRule(); + //入库单明细定位规则不为空时执行 + if (StringUtils.isEmpty(locatingRule)){ + //入库单明细为空时,查询物料表中是否含有定位规则 + LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery(); + materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode()); + Material material = materialService.getOne(materialLambda); + locatingRule = material.getLocatingRule(); + + if (StringUtils.isEmpty(locatingRule)){ + //物料表中定位规则为空时,查询物料类别 + LambdaQueryWrapper<MaterialType> materialTypeLambda = Wrappers.lambdaQuery(); + materialTypeLambda.eq(MaterialType::getCode, material.getType()); + MaterialType materialType = materialTypeService.getOne(materialTypeLambda); + locatingRule = materialType.getLocatingRule(); + if (StringUtils.isEmpty(locatingRule)){ + //物料类别中定位规则为空时,查询入库首选项 + LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery(); + configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(ConfigValue::getModuleType, "receipt") + .eq(ConfigValue::getRecordType, "入库首选项"); + ConfigValue configValue = configValueService.getOne(configValueLambda); + LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery(); + receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue()); + ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda); + locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule(); + } + } + } + } + //通过定位规则查找自定义sql + if (StringUtils.isEmpty(locatingRule)){ + throw new ServiceException("未绑定定位规则"); + } + + return locatingRule; + } +} diff --git a/src/main/java/com/huaheng/common/constant/QuantityConstant.java b/src/main/java/com/huaheng/common/constant/QuantityConstant.java new file mode 100644 index 0000000..252a0fe --- /dev/null +++ b/src/main/java/com/huaheng/common/constant/QuantityConstant.java @@ -0,0 +1,352 @@ +package com.huaheng.common.constant; + +/** + * 数字自定义常量 + * + * @author ricard + */ +public class QuantityConstant { + /** + * 1、入库单状态 + * 2、出库单状态 + * 3、单据上传状态 + * 4、入库组盘状态 + * 5、出库组盘状态 + * 6、任务类型 + * 7、任务状态 + * 8、波次状态 + * 9、质检状态 + * 10、盘点状态 + * 11、库存交易类型 + * 12、调整单状态 + * 13、任务内部类型 + * 14、质检单类型 + */ + + //1、入库单状态 + + //新建 + public static final Integer RECEIPT_HEADER_BUILD = 0; + + //等待审核 + public static final Integer RECEIPT_HEADER_MODERATED = 5; + + //驳回 + public static final Integer RECEIPT_HEADER_TURNDOWN = 10; + + //作废 + public static final Integer RECEIPT_HEADER_OBSOLETE = 20; + + //订单池 + public static final Integer RECEIPT_HEADER_POOL = 100; + + //入库预约 + public static final Integer RECEIPT_HEADER_RESERVATION = 120; + + //入库到货 + public static final Integer RECEIPT_HEADER_ARRIVAL = 150; + + //入库质检 + public static final Integer RECEIPT_HEADER_CHECK = 180; + + //收货 + public static final Integer RECEIPT_HEADER_RECEIVING = 200; + + //定位 + public static final Integer RECEIPT_HEADER_POSITION = 240; + + //等待上架 + public static final Integer RECEIPT_HEADER_WAIT = 280; + + //上架 + public static final Integer RECEIPT_HEADER_SHELF = 300; + + //过账 + public static final Integer RECEIPT_HEADER_POSTING = 800; + + //回传 + public static final Integer RECEIPT_HEADER_RETURN = 900; + + + + + + //2、出库单状态 + + //新建 + public static final Integer SHIPMENT_HEADER_BUILD = 0; + + //订单池 + public static final Integer SHIPMENT_HEADER_POOL = 100; + + //出库预约 + public static final Integer SHIPMENT_HEADER_RESERVATION = 120; + + //订单分析 + public static final Integer SHIPMENT_HEADER_ANALYSIS = 150; + + //波次 + public static final Integer SHIPMENT_HEADER_WAVE = 200; + + //出库组盘 + public static final Integer SHIPMENT_HEADER_GROUPDISK = 300; + + //拣货完成 + public static final Integer SHIPMENT_HEADER_COMPLETED = 500; + + //发运 + public static final Integer SHIPMENT_HEADER_SHIPPING = 800; + + //回传 + public static final Integer SHIPMENT_HEADER_RETURN = 900; + + + + + //3、单据上传状态 + + //未上传 + public static final Integer UPLOAD_NOT = 0; + + //上传失败 + public static final Integer UPLOAD_FAILED = 10; + + //上架完成 + public static final Integer UPLOAD_SUCCESS = 20; + + + + + //4、入库组盘状态 + + //新建 + public static final Integer RECEIPT_CONTAINER_BUILD = 0; + + //生成任务 + public static final Integer RECEIPT_CONTAINER_TASK= 10; + + //上架完成 + public static final Integer RECEIPT_CONTAINER_FINISHED = 20; + + //复核完成 + public static final Integer RECEIPT_CONTAINER_REVIEWSUCCESS = 30; + + + + //5、出库组盘状态 + + //新建 + public static final Integer SHIPMENT_CONTAINER_BUILD = 0; + + //生成任务 + public static final Integer SHIPMENT_CONTAINER_TASK= 10; + + //拣货完成 + public static final Integer SHIPMENT_CONTAINER_FINISHED = 20; + + //复核完成 + public static final Integer SHIPMENT_CONTAINER_REVIEWSUCCESS = 30; + + + + //6、任务类型 + + //整盘入库 + public static final Integer TASK_TYPE_WHOLERECEIPT = 100; + + //补充入库 + public static final Integer TASK_TYPE_SUPPLEMENTRECEIPT = 200; + + //整盘出库 + public static final Integer TASK_TYPE_WHOLESHIPMENT = 300; + + //分拣出库 + public static final Integer TASK_TYPE_SORTINGSHIPMENT = 400; + + //空容器入库 + public static final Integer TASK_TYPE_EMPTYRECEIPT = 500; + + //空容器出库 + public static final Integer TASK_TYPE_EMPTYSHIPMENT = 600; + + //盘点 + public static final Integer TASK_TYPE_CYCLECOUNT = 700; + + //移库 + public static final Integer TASK_TYPE_TRANSFER = 800; + + //出库查看 + public static final Integer TASK_TYPE_VIEW = 900; + + + + //7、任务状态 + + //生成任务 + public static final Integer TASK_STATUS_BUILD = 1; + + //下达任务 + public static final Integer TASK_STATUS_RELEASE = 10; + + //开始执行 + public static final Integer TASK_STATUS_RUNNING = 20; + + //任务完成 + public static final Integer TASK_STATUS_COMPLETED = 100; + + + //8、波次状态 + + //新建波次 + public static final Integer WAVE_STATUS_BUILD = 0; + + //开始波次 + public static final Integer WAVE_STATUS_START = 100; + + //剔除不符合条件订单 + public static final Integer WAVE_STATUS_EXCLUDE = 150; + + //指定分配规则 + public static final Integer WAVE_STATUS_ASSIGN = 200; + + //分配库存 + public static final Integer WAVE_STATUS_ALLOCATION = 300; + + //订单分组 + public static final Integer WAVE_STATUS_GROUPING = 400; + + //创建货箱 + public static final Integer WAVE_STATUS_CREATECONTAINER = 500; + + //生成任务 + public static final Integer WAVE_STATUS_BUILDTASK = 600; + + //结束波次 + public static final Integer WAVE_STATUS_END = 900; + + //失败 + public static final Integer WAVE_STATUS_FAILED = 999; + + + + //9、质检状态 + + //新建 + public static final Integer CHECK_STATUS_BUILD = 0; + + //质检中 + public static final Integer CHECK_STATUS_IN = 10; + + //质检完成 + public static final Integer CHECK_STATUS_COMPLETED = 20; + + + + //10、盘点状态 + + //新建 + public static final Integer CYCLECOUNT_STATUS_BUILD = 1; + + //盘点任务生成 + public static final Integer CYCLECOUNT_STATUS_BUILDTASK = 5; + + //执行中 + public static final Integer CYCLECOUNT_STATUS_EXECUTING = 10; + + //已登记 + public static final Integer CYCLECOUNT_STATUS_REGISTERED= 15; + + //审核 + public static final Integer CYCLECOUNT_STATUS_REVIEW = 30; + + //关闭 + public static final Integer CYCLECOUNT_STATUS_CLOSE = 99; + + //盘点完成 + public static final Integer CYCLECOUNT_STATUS_COMPLETED = 100; + + //已生成调整单 + public static final Integer CYCLECOUNT_STATUS_GENERATEADJUST = 101; + + + + //11、库存交易类型 + + //入库 + public static final Integer INVENTORY_TRANSACTION_RECEIPT = 10; + + //出库 + public static final Integer INVENTORY_TRANSACTION_SHIPMENT = 20; + + //调整入 + public static final Integer INVENTORY_TRANSACTION_ADJUSTINTO = 30; + + //调整出 + public static final Integer INVENTORY_TRANSACTION_ADJUSTOUT = 40; + + //调整属性 + public static final Integer INVENTORY_TRANSACTION_ADJUSTPROPERTIES = 50; + + //盘点 + public static final Integer INVENTORY_TRANSACTION_CYCLECOUNT = 60; + + //移库入 + public static final Integer INVENTORY_TRANSACTION_TRANSFERINTO = 70; + + //移库出 + public static final Integer INVENTORY_TRANSACTION_TRANSFEROUT = 80; + + + //12、调整单状态 + + //未批准 + public static final Integer ADJUST_STATUS_NOAPPROVED = 0; + + //已批准 + public static final Integer ADJUST_STATUS_APPROVED = 1; + + //待调整 + public static final Integer ADJUST_STATUS_WAIT = 2; + + //已调整 + public static final Integer ADJUST_STATUS_STOP = 3; + + + //13、任务内部类型 + + //上架任务 + public static final Integer TASK_INTENERTYPE_SHELF = 100; + + //拣货任务 + public static final Integer TASK_INTENERTYPE_PICKING = 200; + + //补货任务 + public static final Integer TASK_INTENERTYPE_SUPPLEMENT = 300; + + //工作任务 + public static final Integer TASK_INTENERTYPE_WORK = 400; + + //质检任务 + public static final Integer TASK_INTENERTYPE_CHECK = 500; + + //移库任务 + public static final Integer TASK_INTENERTYPE_TRANSFER = 600; + + //盘点任务 + public static final Integer TASK_INTENERTYPE_CYCLECOUNT = 700; + + + + //13、质检单类型 + + //入库质检 + public static final Integer CHECK_TYPE_RECEIPT = 100; + + //在库全检 + public static final Integer CHECK_TYPE_FULL = 200; + + //在库抽检 + public static final Integer CHECK_TYPE_SELECT = 300; + + +} diff --git a/src/main/java/com/huaheng/pc/check/checkDetail/service/CheckDetailService.java b/src/main/java/com/huaheng/pc/check/checkDetail/service/CheckDetailService.java index ba3888a..9a520a9 100644 --- a/src/main/java/com/huaheng/pc/check/checkDetail/service/CheckDetailService.java +++ b/src/main/java/com/huaheng/pc/check/checkDetail/service/CheckDetailService.java @@ -2,6 +2,7 @@ package com.huaheng.pc.check.checkDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.security.ShiroUtils; @@ -58,7 +59,7 @@ public class CheckDetailService extends ServiceImpl<CheckDetailMapper, CheckDeta checkDetail.setCheckBy(ShiroUtils.getLoginName()); checkDetail.setCheckAt(new Date()); - checkDetail.setStatus("20"); + checkDetail.setStatus((QuantityConstant.CHECK_STATUS_COMPLETED).toString()); checkDetail.setLastUpdated(new Date()); checkDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); if (!this.updateById(checkDetail)){ @@ -71,7 +72,7 @@ public class CheckDetailService extends ServiceImpl<CheckDetailMapper, CheckDeta //判断头表下所有明细是否全部完成 boolean result = false; for (CheckDetail checkDetail1 : checkDetails){ - if ("20".equals(checkDetail1.getStatus())){ + if ((QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail1.getStatus())){ result = true; } else { result = false; @@ -80,7 +81,7 @@ public class CheckDetailService extends ServiceImpl<CheckDetailMapper, CheckDeta if (result){ CheckHeader checkHeader = new CheckHeader(); checkHeader.setId(checkDetail.getCheckHeaderId()); - checkHeader.setStatus("30"); + checkHeader.setStatus((QuantityConstant.CHECK_STATUS_COMPLETED).toString()); if ( !checkHeaderService.updateById(checkHeader)){ throw new ServiceException("质检头表更新失败"); } diff --git a/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java b/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java index 7752a5d..8b7b16c 100644 --- a/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java +++ b/src/main/java/com/huaheng/pc/check/checkingRegister/controller/CheckingRegisterController.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.ser.Serializers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; @@ -84,7 +85,9 @@ public class CheckingRegisterController extends BaseController { PageDomain pageDomain = TableSupport.buildPageRequest(); Integer pageNum = pageNumber; Integer pageSize = pageDomain.getPageSize(); - boolean isDetailNull; + boolean isDetailNull; //质检明细是否存在标识 + + //判断质检单明细标号是否存在,不存在显示所有质检报告 if (StringUtils.isNotNull(checkingRegister.getCheckDetailId())){ isDetailNull = true; if (checkingRegister.getCheckDetailId() == 0){ @@ -128,10 +131,12 @@ public class CheckingRegisterController extends BaseController { IPage<CheckingRegister> iPage = checkingRegisterService.page(page, lambdaQueryWrapper); if (isDetailNull){ if (iPage.getTotal() == 0){ + //空list List emptyList = checkingRegisterService.emptyList(checkingRegister.getCheckDetailId()); return getMpDataTable(emptyList, Long.valueOf(emptyList.size())); } - if (!"20".equals(checkDetail.getStatus())){ + if (!(QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail.getStatus())){ + //未完成质检list List notCompleteList = checkingRegisterService.notCompleteList(checkingRegister.getCheckDetailId()); return getMpDataTable(notCompleteList, Long.valueOf(notCompleteList.size())); } @@ -141,10 +146,12 @@ public class CheckingRegisterController extends BaseController { List<CheckingRegister> list = checkingRegisterService.list(lambdaQueryWrapper); if (isDetailNull){ if (list.size() == 0){ + //空list List emptyList = checkingRegisterService.emptyList(checkingRegister.getCheckDetailId()); return getMpDataTable(emptyList, Long.valueOf(emptyList.size())); } - if (!"20".equals(checkDetail.getStatus())){ + if (!(QuantityConstant.CHECK_STATUS_COMPLETED).toString().equals(checkDetail.getStatus())){ + //未完成质检list List notCompleteList = checkingRegisterService.notCompleteList(checkingRegister.getCheckDetailId()); return getMpDataTable(notCompleteList, Long.valueOf(notCompleteList.size())); } diff --git a/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java b/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java index 7519ba3..6d13404 100644 --- a/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java +++ b/src/main/java/com/huaheng/pc/check/checkingRegister/service/CheckingRegisterService.java @@ -64,7 +64,7 @@ public class CheckingRegisterService extends ServiceImpl<CheckingRegisterMapper, */ public List<CheckingRegister> emptyList(Integer checkDetailId){ List<CheckingRegister> list = new ArrayList<>(); - List<DictData> dictDataList = dictDataService.selectDictDataByType("inventoryStatus"); + List<DictData> dictDataList = dictDataService.selectDictDataByType("inventorySts"); CheckDetail checkDetail = checkDetailService.getById(checkDetailId); for (DictData dictData: dictDataList){ CheckingRegister checkingRegister1 = new CheckingRegister(); diff --git a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/controller/FilterConfigDetailController.java b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/controller/FilterConfigDetailController.java index c2e9e30..e2559ad 100644 --- a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/controller/FilterConfigDetailController.java +++ b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/controller/FilterConfigDetailController.java @@ -123,6 +123,7 @@ public class FilterConfigDetailController extends BaseController { } filterConfigDetail.setModuleType(configHeader.getModuleType()); filterConfigDetail.setRecordType(configHeader.getRecordType()); + filterConfigDetail.setFilterCode(configHeader.getFilterCode()); filterConfigDetail.setWarehouseCode(ShiroUtils.getWarehouseCode()); filterConfigDetail.setCreatedBy(ShiroUtils.getLoginName()); filterConfigDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); diff --git a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java index a37b6fa..25258c7 100644 --- a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java +++ b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/domain/FilterConfigDetail.java @@ -78,9 +78,9 @@ public class FilterConfigDetail implements Serializable { @ApiModelProperty(value="全SQL") private String statement; - @TableField(value = "sqll") + @TableField(value = "statements") @ApiModelProperty(value="后续分组排序") - private String sqll; + private String statements; /** * 是否系统创建 diff --git a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/mapper/FilterConfigDetailMapper.java b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/mapper/FilterConfigDetailMapper.java index 470bf8b..6f73b84 100644 --- a/src/main/java/com/huaheng/pc/config/FilterConfigDetail/mapper/FilterConfigDetailMapper.java +++ b/src/main/java/com/huaheng/pc/config/FilterConfigDetail/mapper/FilterConfigDetailMapper.java @@ -2,6 +2,14 @@ package com.huaheng.pc.config.FilterConfigDetail.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; +import org.apache.ibatis.annotations.Param; public interface FilterConfigDetailMapper extends BaseMapper<FilterConfigDetail> { + + //复制规则配置明细 + int filterConfigDetailCopy(@Param("code") String code, @Param("newCode") String newCode); + + //修改规则配置明细headerId + int updateHeaderId(@Param("code") String code); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/FilterConfigHeader/mapper/FilterConfigHeaderMapper.java b/src/main/java/com/huaheng/pc/config/FilterConfigHeader/mapper/FilterConfigHeaderMapper.java index b4391a1..831d0aa 100644 --- a/src/main/java/com/huaheng/pc/config/FilterConfigHeader/mapper/FilterConfigHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/config/FilterConfigHeader/mapper/FilterConfigHeaderMapper.java @@ -2,6 +2,10 @@ package com.huaheng.pc.config.FilterConfigHeader.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.FilterConfigHeader.domain.FilterConfigHeader; +import org.apache.ibatis.annotations.Param; public interface FilterConfigHeaderMapper extends BaseMapper<FilterConfigHeader> { + + //复制规则配置主表 + int filterConfigHeaderCopy(@Param("code") String code, @Param("newCode") String newCode); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java b/src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java index d9e7ad6..5de586f 100644 --- a/src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java +++ b/src/main/java/com/huaheng/pc/config/FilterConfigHeader/service/FilterConfigHeaderService.java @@ -3,16 +3,25 @@ package com.huaheng.pc.config.FilterConfigHeader.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.pc.config.FilterConfigDetail.mapper.FilterConfigDetailMapper; import com.huaheng.pc.config.FilterConfigHeader.domain.FilterConfigHeader; import com.huaheng.pc.config.FilterConfigHeader.mapper.FilterConfigHeaderMapper; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.util.List; @Service("filterConfigHeaderService") public class FilterConfigHeaderService extends ServiceImpl<FilterConfigHeaderMapper, FilterConfigHeader> { + @Resource + private FilterConfigHeaderMapper filterConfigHeaderMapper; + + @Resource + private FilterConfigDetailMapper filterConfigDetailMapper; + //根据模块和类型查找具体规则 public List<FilterConfigHeader> getFilterConfigHeaderService(String moduleType,String recordType){ @@ -22,4 +31,28 @@ public class FilterConfigHeaderService extends ServiceImpl<FilterConfigHeaderMap .eq(FilterConfigHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); return this.list(lam); } + + + //复制规则配置 + public Boolean filterConfigCopy(String code,String newCode){ + int i = 0; + //复制规则配置主表 + i = filterConfigHeaderMapper.filterConfigHeaderCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //复制规则配置明细 + i = filterConfigDetailMapper.filterConfigDetailCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //修改规则配置明细headerId + i = filterConfigDetailMapper.updateHeaderId(newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + return true; + } } diff --git a/src/main/java/com/huaheng/pc/config/address/controller/AddressController.java b/src/main/java/com/huaheng/pc/config/address/controller/AddressController.java new file mode 100644 index 0000000..322f7db --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/address/controller/AddressController.java @@ -0,0 +1,134 @@ +package com.huaheng.pc.config.address.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huaheng.common.support.Convert; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.framework.web.page.PageDomain; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.framework.web.page.TableSupport; +import com.huaheng.pc.config.address.domain.Address; +import com.huaheng.pc.config.address.service.AddressService; +import com.huaheng.pc.config.carrier.domain.Carrier; +import com.huaheng.pc.config.carrier.service.CarrierService; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 接口地址 + */ +@Controller +@RequestMapping("/config/address") +public class AddressController extends BaseController { + + private String prefix = "config/address"; + + @Resource + private AddressService addressService; + + @RequiresPermissions("config:address:view") + @GetMapping() + public String address() { + return prefix + "/address"; + } + + /** + * 查询接口地址 + */ + @RequiresPermissions("config:address:list") + @Log(title = "配置-接口地址", operating = "查看接口地址", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(Address address) { + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery(); + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + lambdaQueryWrapper + .eq(StringUtils.isNotEmpty(address.getParam()), Address::getParam, address.getParam()) + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode()); + + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ + /*使用分页查询*/ + Page<Address> page = new Page<>(pageNum, pageSize); + IPage<Address> iPage = addressService.page(page, lambdaQueryWrapper); + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + } else { + List<Address> list = addressService.list(lambdaQueryWrapper); + return getDataTable(list); + } + } + + /** + * 新增接口地址 + */ + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增保存接口地址 + */ + @RequiresPermissions("config:address:add") + @Log(title = "通用-接口地址", operating = "新增接口地址", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Address address) { + address.setWarehouseCode(ShiroUtils.getWarehouseCode()); + return toAjax(addressService.save(address)); + } + + /** + * 修改接口地址 + */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { + mmap.put("address", addressService.getById(id)); + return prefix + "/edit"; + } + + /** + * 修改保存接口地址 + */ + @RequiresPermissions("config:address:edit") + @Log(title = "配置-接口地址", operating = "修改接口地址", action = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(Address address) { + return toAjax(addressService.updateById(address)); + } + + /** + * 删除接口地址 + */ + @RequiresPermissions("config:address:remove") + @Log(title = "配置-接口地址", operating = "删除接口地址", action = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) { + if (StringUtils.isEmpty(ids)){ + return AjaxResult.error("id不能为空"); + } + List<Integer> list = new ArrayList<>(); + for (Integer id : Convert.toIntArray(ids)) { + list.add(id); + } + return toAjax(addressService.removeByIds(list)); + } +} diff --git a/src/main/java/com/huaheng/pc/config/address/domain/Address.java b/src/main/java/com/huaheng/pc/config/address/domain/Address.java new file mode 100644 index 0000000..5ee9376 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/address/domain/Address.java @@ -0,0 +1,80 @@ +package com.huaheng.pc.config.address.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 接口地址 + */ +@ApiModel(value="com.huaheng.pc.config.address.domain.Address") +@Data +@TableName(value = "address") +public class Address implements Serializable { + /** + * 内部号 + */ + @TableId(value = "id", type = IdType.AUTO) + @ApiModelProperty(value="内部号") + private Integer id; + + + /** + * 仓库代码 + */ + @TableField(value = "warehouseCode") + @ApiModelProperty(value="仓库代码") + private String warehouseCode; + + /** + * 参数 + */ + @TableField(value = "param") + @ApiModelProperty(value="参数") + private String param; + + /** + * 接口地址 + */ + @TableField(value = "url") + @ApiModelProperty(value="接口地址") + private String url; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getParam() { + return param; + } + + public void setParam(String param) { + this.param = param; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java b/src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java new file mode 100644 index 0000000..3410a16 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/address/mapper/AddressMapper.java @@ -0,0 +1,7 @@ +package com.huaheng.pc.config.address.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huaheng.pc.config.address.domain.Address; + +public interface AddressMapper extends BaseMapper<Address> { +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/address/service/AddressService.java b/src/main/java/com/huaheng/pc/config/address/service/AddressService.java new file mode 100644 index 0000000..b36471d --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/address/service/AddressService.java @@ -0,0 +1,18 @@ +package com.huaheng.pc.config.address.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.huaheng.pc.config.address.domain.Address; + +public interface AddressService extends IService<Address>{ + + + String selectAddress(String param); + + /** + * 复制地址表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + Boolean addressCopy(String warehouseCode, String newWarehouseCode); +} diff --git a/src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java b/src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java new file mode 100644 index 0000000..9d36f2f --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/address/service/AddressServiceImpl.java @@ -0,0 +1,69 @@ +package com.huaheng.pc.config.address.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.pc.config.address.domain.Address; +import com.huaheng.pc.config.address.mapper.AddressMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService { + + @Override + public String selectAddress(String param) { + if(StringUtils.isEmpty(param)){ + throw new ServiceException("参数为空"); + } + + LambdaQueryWrapper<Address> addressLam = Wrappers.lambdaQuery(); + addressLam.eq(Address::getParam,param) + .eq(Address::getWarehouseCode, ShiroUtils.getWarehouseCode()); + Address address=this.getOne(addressLam); + if(address == null){ + throw new ServiceException("参数错误,系统没有此参数对应的地址"); + } + if(StringUtils.isEmpty(address.getUrl())){ + throw new ServiceException("地址为空"); + } + return address.getUrl(); + } + + /** + * 复制地址表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public Boolean addressCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复制地址表"); + LambdaQueryWrapper<Address> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(Address::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error("该仓库已存在"); + return false; + } + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(Address::getWarehouseCode, warehouseCode); + List<Address> addressList = this.list(lambdaQueryWrapper); + + for ( Address address : addressList) { + address.setId(null); + address.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(addressList) ){ + log.trace("复制地址表成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } +} diff --git a/src/main/java/com/huaheng/pc/config/company/mapper/CompanyMapper.java b/src/main/java/com/huaheng/pc/config/company/mapper/CompanyMapper.java index 7682c74..175ab49 100644 --- a/src/main/java/com/huaheng/pc/config/company/mapper/CompanyMapper.java +++ b/src/main/java/com/huaheng/pc/config/company/mapper/CompanyMapper.java @@ -12,5 +12,6 @@ public interface CompanyMapper extends BaseMapper<Company> { List<Company> selectByWarehouseCode(Company company); + List<Company> selectListEntityByEqual(Company condition); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/company/service/CompanyService.java b/src/main/java/com/huaheng/pc/config/company/service/CompanyService.java index acc50e6..ebf6edc 100644 --- a/src/main/java/com/huaheng/pc/config/company/service/CompanyService.java +++ b/src/main/java/com/huaheng/pc/config/company/service/CompanyService.java @@ -18,4 +18,7 @@ public interface CompanyService extends IService<Company>{ public AjaxResult updateCompany(Company company); public List<Map<String, Object>> getCode(); + + List<Company> selectListEntityByEqual(Company condition); + } diff --git a/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java b/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java index 0beb960..11159fb 100644 --- a/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java @@ -100,10 +100,16 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl return AjaxResult.success("更新成功!"); } + @Override public List<Map<String, Object>> getCode(){ LambdaQueryWrapper<Company> lambda = Wrappers.lambdaQuery(); lambda.select(Company::getCode, Company::getId, Company::getName) .eq(Company::getWarehouseCode, ShiroUtils.getWarehouseCode()); return this.listMaps(lambda); } + + @Override + public List<Company> selectListEntityByEqual(Company condition) { + return companyMapper.selectListEntityByEqual(condition); + } } diff --git a/src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java b/src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java index 8afc2d8..7d64aff 100644 --- a/src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java +++ b/src/main/java/com/huaheng/pc/config/configValue/controller/ConfigValueController.java @@ -16,6 +16,8 @@ import com.huaheng.framework.web.page.TableDataInfo; import com.huaheng.framework.web.page.TableSupport; import com.huaheng.pc.config.configValue.domain.ConfigValue; import com.huaheng.pc.config.configValue.service.ConfigValueService; +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -35,6 +37,8 @@ public class ConfigValueController extends BaseController { @Resource private ConfigValueService configValueService; + @Resource + private CycleCountPreferenceService cycleCountPreferenceService; private String prefix = "config/configValue"; @@ -96,6 +100,20 @@ public class ConfigValueController extends BaseController { @PostMapping("/add") @ResponseBody public AjaxResult addSave(ConfigValue configValue) { + //检测盘点首选项是否停用 + if(configValue.getRecordType().equals("cycleCountPreference")){ + CycleCountPreference cycleCountPreferenceTemp = new CycleCountPreference(); + cycleCountPreferenceTemp.setCode(configValue.getIdentifier()); + cycleCountPreferenceTemp.setWarehouseCode(configValue.getWarehouseCode()); + LambdaQueryWrapper<CycleCountPreference> preferenceLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountPreferenceTemp); + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(preferenceLambdaQueryWrapper); + if(cycleCountPreference == null){ + return AjaxResult.error("盘点首选项编码错误,没有该条首选项!"); + } + if(cycleCountPreference.getEnable() == false){ + return AjaxResult.error("不能添加已停用的盘点首选项!"); + } + } configValue.setWarehouseCode(ShiroUtils.getWarehouseCode()); configValue.setCreatedBy(ShiroUtils.getLoginName()); configValue.setLastUpdatedBy(ShiroUtils.getLoginName()); diff --git a/src/main/java/com/huaheng/pc/config/configValue/service/ConfigValueService.java b/src/main/java/com/huaheng/pc/config/configValue/service/ConfigValueService.java index 83b113a..fb70d79 100644 --- a/src/main/java/com/huaheng/pc/config/configValue/service/ConfigValueService.java +++ b/src/main/java/com/huaheng/pc/config/configValue/service/ConfigValueService.java @@ -1,12 +1,45 @@ package com.huaheng.pc.config.configValue.service; -import org.springframework.stereotype.Service; -import javax.annotation.Resource; -import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.config.configValue.domain.ConfigValue; import com.huaheng.pc.config.configValue.mapper.ConfigValueMapper; +import org.springframework.stereotype.Service; + +import java.util.List; @Service public class ConfigValueService extends ServiceImpl<ConfigValueMapper, ConfigValue> { + /** + * 复制系统参数配置表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + public boolean configValueCopy(String warehouseCode, String newWarehouseCode){ + log.trace("开始复制系统参数配置表"); + LambdaQueryWrapper<ConfigValue> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error(newWarehouseCode+"仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, warehouseCode); + List<ConfigValue> configValueList = this.list(lambdaQueryWrapper); + + for ( ConfigValue configValue : configValueList) { + configValue.setId(null); + configValue.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(configValueList) ){ + log.trace("复制系统参数配置表成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/configWarning/controller/ConfigWarningController.java b/src/main/java/com/huaheng/pc/config/configWarning/controller/ConfigWarningController.java new file mode 100644 index 0000000..f6be30b --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/configWarning/controller/ConfigWarningController.java @@ -0,0 +1,156 @@ +package com.huaheng.pc.config.configWarning.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huaheng.common.support.Convert; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.framework.web.page.PageDomain; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.framework.web.page.TableSupport; +import com.huaheng.pc.config.company.service.CompanyService; +import com.huaheng.pc.config.configWarning.domain.ConfigWarning; +import com.huaheng.pc.config.configWarning.service.ConfigWarningService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Created by Enzo Cotter on 2019/11/11. + * @author mahuandong + */ + +@Api(tags = "预警配置") +@Controller +@RequestMapping("/config/configWarning") +public class ConfigWarningController extends BaseController { + + @Resource + private ConfigWarningService configWarningService; + @Resource + private CompanyService companyService; + + private String prefix = "/config/configWarning"; + + @RequiresPermissions("config:configWarning:view") + @GetMapping() + public String configWarning() { + return prefix + "/configWarning"; + } + + /** + * 查询预警配置 + */ + @ApiOperation(value="查看预警配置列表", + notes="根据编码、物料编码、仓库编码、 货主编码、创建时间获取库位的详细信息", + httpMethod = "POST") + @RequiresPermissions("config:configWarning:list") + @Log(title = "配置-预警配置", operating = "查看预警配置列表", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list( + @ApiParam(name="location",value="编码、物料编码、仓库编码、 货主编码、 类型") ConfigWarning configWarning, + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery(); + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), ConfigWarning::getCreated, createdBegin) + .lt(StringUtils.isNotEmpty(createdEnd), ConfigWarning::getCreated, createdEnd) + .eq(StringUtils.isNotEmpty(configWarning.getCode()), ConfigWarning::getCode, configWarning.getCode()) + .eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(StringUtils.isNotEmpty(configWarning.getCompanyCode()), ConfigWarning::getCompanyCode, configWarning.getCompanyCode()) + .eq(StringUtils.isNotEmpty(configWarning.getMaterialCode()), ConfigWarning::getMaterialCode, configWarning.getMaterialCode()) + .eq(StringUtils.isNotEmpty(configWarning.getMaterialName()), ConfigWarning::getMaterialName, configWarning.getMaterialName()) + .like(StringUtils.isNotEmpty(configWarning.getEmail()), ConfigWarning::getEmail, configWarning.getEmail()) + .eq(StringUtils.isNotEmpty(configWarning.getType()), ConfigWarning::getType, configWarning.getType()); + + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ + /*使用分页查询*/ + Page<ConfigWarning> page = new Page<>(pageNum, pageSize); + IPage<ConfigWarning> iPage = configWarningService.page(page, lambdaQueryWrapper); + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + } else { + List<ConfigWarning> list = configWarningService.list(lambdaQueryWrapper); + return getDataTable(list); + } + } + + /** + * 新增预警配置 + */ + @GetMapping("/add") + public String add(ModelMap modelMap) { + modelMap.put("list",companyService.list()); + return prefix + "/add"; + } + + /** + * 新增保存预警配置 + */ + @ApiOperation(value="新增预警配置", notes="新增预警配置", httpMethod = "POST") + @RequiresPermissions("config:configWarning:add") + @Log(title = "配置-预警配置", operating = "新增预警配置", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(ConfigWarning configWarning) { + return configWarningService.saveConfigWarning(configWarning); + } + + /** + * 修改预警配置 + */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { + ConfigWarning configWarning = configWarningService.getById(id); + mmap.put("configWarning", configWarning); + mmap.put("list",companyService.list()); + return prefix + "/edit"; + } + + /** + * 修改保存预警配置 + */ + @ApiOperation(value="修改预警配置", notes="修改预警配置", httpMethod = "POST") + @RequiresPermissions("config:configWarning:edit") + @Log(title = "配置-预警配置", operating = "修改预警配置", action = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave( + @ApiParam(name = "Container", value = "预警配置实体", required = true) ConfigWarning configWarning) { + return configWarningService.updateConfigWarning(configWarning); + } + + /** + * 删除预警配置 + */ + @ApiOperation(value="删除预警配置", notes="根据id批量删除预警配置,参数示例1,2,3", httpMethod = "POST") + @RequiresPermissions("config:configWarning:remove") + @Log(title = "配置-预警配置", operating = "删除预警配置", action = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) { + if (StringUtils.isEmpty(ids)){ + return AjaxResult.error("id不能为空"); + } + List<Integer> list = new ArrayList<>(Arrays.asList(Convert.toIntArray(ids))); + + return toAjax(configWarningService.removeByIds(list)); + } +} diff --git a/src/main/java/com/huaheng/pc/config/configWarning/domain/ConfigWarning.java b/src/main/java/com/huaheng/pc/config/configWarning/domain/ConfigWarning.java new file mode 100644 index 0000000..75c57ab --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/configWarning/domain/ConfigWarning.java @@ -0,0 +1,136 @@ +package com.huaheng.pc.config.configWarning.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; + +/** + * Created by Enzo Cotter on 2019/11/11. + */ + +@ApiModel(value = "com-huaheng-pc-config-configWarning-domain-ConfigWarning") +@Data +@TableName(value = "config_warning") +public class ConfigWarning implements Serializable { + @TableId(value = "id", type = IdType.INPUT) + @ApiModelProperty(value = "null") + private Integer id; + + /** + * 编码 + */ + @TableId(value = "code", type = IdType.INPUT) + @ApiModelProperty(value = "编码") + private String code; + + /** + * 类型 + */ + @TableField(value = "type") + @ApiModelProperty(value = "类型") + private String type; + + /** + * 仓库编码 + */ + @TableField(value = "warehouseCode") + @ApiModelProperty(value = "仓库编码") + private String warehouseCode; + + /** + * 货主编码 + */ + @TableField(value = "companyCode") + @ApiModelProperty(value = "货主编码") + private String companyCode; + + /** + * 物料编码 + */ + @TableField(value = "materialCode") + @ApiModelProperty(value = "物料编码") + private String materialCode; + + /** + * 物料名称 + */ + @TableField(value = "materialName") + @ApiModelProperty(value = "物料名称") + private String materialName; + + /** + * 物料规格 + */ + @TableField(value = "materialSpec") + @ApiModelProperty(value = "物料规格") + private String materialSpec; + + /** + * 物料单位 + */ + @TableField(value = "materialUnit") + @ApiModelProperty(value = "物料单位") + private String materialUnit; + + /** + * 最大 + */ + @TableField(value = "max") + @ApiModelProperty(value = "最大") + private BigDecimal max; + + /** + * 最小 + */ + @TableField(value = "min") + @ApiModelProperty(value = "最小") + private BigDecimal min; + + /** + * 备注 + */ + @TableField(value = "remark") + @ApiModelProperty(value = "备注") + private String remark; + + /** + * 创建时间 + */ + @TableField(value = "created") + @ApiModelProperty(value = "创建时间") + private Date created; + + /** + * 创建人 + */ + @TableField(value = "createdBy") + @ApiModelProperty(value = "创建人") + private String createdBy; + + /** + * 更新时间 + */ + @TableField(value = "lastUpdated") + @ApiModelProperty(value = "更新时间") + private Date lastUpdated; + + /** + * 更新人 + */ + @TableField(value = "lastUpdatedBy") + @ApiModelProperty(value = "更新人") + private String lastUpdatedBy; + + @TableField(value = "email") + @ApiModelProperty(value = "null") + private String email; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/configWarning/mapper/ConfigWarningMapper.java b/src/main/java/com/huaheng/pc/config/configWarning/mapper/ConfigWarningMapper.java new file mode 100644 index 0000000..e0bf519 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/configWarning/mapper/ConfigWarningMapper.java @@ -0,0 +1,11 @@ +package com.huaheng.pc.config.configWarning.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huaheng.pc.config.configWarning.domain.ConfigWarning; + +/** + * Created by Enzo Cotter on 2019/11/11. + */ + +public interface ConfigWarningMapper extends BaseMapper<ConfigWarning> { +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/configWarning/service/ConfigWarningService.java b/src/main/java/com/huaheng/pc/config/configWarning/service/ConfigWarningService.java new file mode 100644 index 0000000..419d20f --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/configWarning/service/ConfigWarningService.java @@ -0,0 +1,212 @@ +package com.huaheng.pc.config.configWarning.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.config.material.domain.Material; +import com.huaheng.pc.config.material.service.MaterialService; +import com.huaheng.pc.config.sendMail.domain.SendMail; +import com.huaheng.pc.config.sendMail.service.MailService; +import com.huaheng.pc.config.sendMail.service.SendMailService; +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; +import com.huaheng.pc.system.user.domain.User; +import com.huaheng.pc.system.user.service.IUserService; +import com.huaheng.pc.system.user.service.UserServiceImpl; +import org.aspectj.weaver.loadtime.Aj; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.pc.config.configWarning.domain.ConfigWarning; +import com.huaheng.pc.config.configWarning.mapper.ConfigWarningMapper; +import org.springframework.transaction.annotation.Transactional; + +/** + * Created by Enzo Cotter on 2019/11/11. + */ + +@Service +public class ConfigWarningService extends ServiceImpl<ConfigWarningMapper, ConfigWarning> { + + @Resource + private MaterialService materialService; + @Resource + private SendMailService sendMailService; + @Resource + private InventoryDetailService inventoryDetailService; + @Resource + private MailService mailService; + @Resource + private LocationService locationService; + + /** + * 保存预警配置 + * @param configWarning + * @return + */ + @Transactional(rollbackFor = SecurityException.class) + public AjaxResult saveConfigWarning(ConfigWarning configWarning){ + /* 设置仓库编码*/ + configWarning.setWarehouseCode(ShiroUtils.getWarehouseCode()); + + /* 设置物料信息*/ + if (configWarning.getMaterialCode() != null){ + Material material = materialService.findAllByCode(configWarning.getMaterialCode()); + configWarning.setMaterialName(material.getName()); + configWarning.setMaterialSpec(material.getSpec()); + configWarning.setMaterialUnit(material.getUnit()); + } + + /* 设置创建人、更新人*/ + configWarning.setCreatedBy(ShiroUtils.getLoginName()); + configWarning.setLastUpdatedBy(ShiroUtils.getLoginName()); + + /* 保存*/ + if (!save(configWarning)){ + throw new SecurityException("保存配置信息失败"); + } + return AjaxResult.success(""); + } + + /** + * 保存预警配置 + * @param configWarning + * @return + */ + @Transactional(rollbackFor = SecurityException.class) + public AjaxResult updateConfigWarning(ConfigWarning configWarning){ + + /* 设置物料信息*/ + if (configWarning.getMaterialCode() != null){ + Material material = materialService.findAllByCode(configWarning.getMaterialCode()); + configWarning.setMaterialName(material.getName()); + configWarning.setMaterialSpec(material.getSpec()); + configWarning.setMaterialUnit(material.getUnit()); + } + + /* 设置更新人*/ + configWarning.setLastUpdatedBy(ShiroUtils.getLoginName()); + + if (!updateById(configWarning)){ + throw new SecurityException("修改配置信息失败"); + } + return AjaxResult.success(""); + } + + /** + * 物料预警 + * @param map 任务明细 + */ + public void materialWarning(String materialCode, String materialName){ + /* 查询预警配置*/ + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ConfigWarning::getMaterialCode, materialCode) + .eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(ConfigWarning::getType, 0); + ConfigWarning configWarning = this.getOne(lambdaQueryWrapper); + + /* 当预警配置存在时*/ + if (configWarning != null) { + String[] emailArray = configWarning.getEmail().split(";"); + /* 收件人*/ + String[] to = {emailArray[0]}; + /* 抄送人*/ + List<String> ccList = new ArrayList<>(); + for (int i = 1; i < emailArray.length; i++) { + ccList.add(emailArray[i]); + } + String[] cc = ccList.toArray(new String[0]); + + InventoryDetail inventoryDetail = new InventoryDetail(); + inventoryDetail.setWarehouseCode(ShiroUtils.getWarehouseCode()); + inventoryDetail.setMaterialCode(materialCode); + inventoryDetail.setInventorySts("good"); + inventoryDetail.setCompanyCode(configWarning.getCompanyCode()); + BigDecimal sum = inventoryDetailService.getSumQty(inventoryDetail); + SendMail sendMail = new SendMail(); + sendMail.setWarehouseCode(ShiroUtils.getWarehouseCode()); + sendMail.setCompanyCode(configWarning.getCompanyCode()); + sendMail.setType(0); + sendMail.setEmail(configWarning.getEmail()); + sendMail.setAlarmTime(new Date()); + if (sum.compareTo(configWarning.getMax()) == 1) { + sendMail.setTitle(materialName + "超过最大库存"); + sendMail.setBody(materialName + "超过最大库存,当前数量为" + sum); + if (!sendMailService.save(sendMail)) { + throw new SecurityException("保存失败"); + } + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc); + sendMail.setEnable(resultMail); + if (!sendMailService.updateById(sendMail)) { + throw new SecurityException("更新失败"); + } + } else if (sum.compareTo(configWarning.getMin()) == -1) { + sendMail.setTitle(materialName + "低于最低库存"); + sendMail.setBody(materialName + "低于最低库存,当前数量为" + sum); + if (!sendMailService.save(sendMail)) { + throw new SecurityException("保存失败"); + } + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc); + sendMail.setEnable(resultMail); + if (!sendMailService.updateById(sendMail)) { + throw new SecurityException("更新失败"); + } + } + } + } + + /** + * 空库位剩余数量预警 + */ + public void emptyLocationWarning(){ + /* 查询预警配置*/ + LambdaQueryWrapper<ConfigWarning> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ConfigWarning::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(ConfigWarning::getType, 1); + ConfigWarning configWarning = this.getOne(lambdaQueryWrapper); + /* 当预警配置存在时*/ + if (configWarning != null) { + String[] emailArray = configWarning.getEmail().split(";"); + /* 收件人*/ + String[] to = {emailArray[0]}; + /* 抄送人*/ + List<String> ccList = new ArrayList<>(); + for (int i = 1; i < emailArray.length; i++) { + ccList.add(emailArray[i]); + } + String[] cc = ccList.toArray(new String[0]); + + LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); + locationLambda.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(Location::getStatus, "empty"); + BigDecimal sum = new BigDecimal(locationService.list(locationLambda).size()); + SendMail sendMail = new SendMail(); + sendMail.setWarehouseCode(ShiroUtils.getWarehouseCode()); + sendMail.setType(1); + sendMail.setEmail(configWarning.getEmail()); + sendMail.setAlarmTime(new Date()); + if (sum.compareTo(configWarning.getMin()) == -1) { + sendMail.setTitle("空库位剩余"+sum+"个"); + sendMail.setBody("空库位剩余"+sum+"个"); + if (!sendMailService.save(sendMail)) { + throw new SecurityException("保存失败"); + } + boolean resultMail = mailService.sendSimpleMail(to, sendMail.getTitle(), sendMail.getBody(), cc); + sendMail.setEnable(resultMail); + if (!sendMailService.updateById(sendMail)) { + throw new SecurityException("更新失败"); + } + } + } + } +} + diff --git a/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeService.java b/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeService.java index efea8cc..ee95121 100644 --- a/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeService.java +++ b/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeService.java @@ -11,7 +11,15 @@ import java.util.Map; @Service("containerType") public interface ContainerTypeService extends IService<ContainerType>{ - public Boolean checkConfig(String code); + Boolean checkConfig(String code); - public List<Map<String, Object>> getCode(); + List<Map<String, Object>> getCode(); + + /** + * 复制容器类型表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + boolean containerTypeCopy(String warehouseCode, String newWarehouseCode); } diff --git a/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeServiceImpl.java b/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeServiceImpl.java index e679029..38c1059 100644 --- a/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/containerType/service/ContainerTypeServiceImpl.java @@ -4,14 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.huaheng.common.utils.security.ShiroUtils; import org.springframework.stereotype.Service; -import javax.annotation.Resource; + import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.config.containerType.domain.ContainerType; import com.huaheng.pc.config.containerType.mapper.ContainerTypeMapper; -import com.huaheng.pc.config.containerType.service.ContainerTypeService; + @Service("containerType") public class ContainerTypeServiceImpl extends ServiceImpl<ContainerTypeMapper, ContainerType> implements ContainerTypeService{ @@ -33,4 +33,37 @@ public class ContainerTypeServiceImpl extends ServiceImpl<ContainerTypeMapper, C return result; } + /** + * 复制容器类型表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public boolean containerTypeCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复制容器类型表"); + LambdaQueryWrapper<ContainerType> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ContainerType::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error(newWarehouseCode+"仓库已存在"); + return false; + } + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ContainerType::getWarehouseCode, warehouseCode); + List<ContainerType> containerTypeList = this.list(lambdaQueryWrapper); + + for ( ContainerType configValue : containerTypeList) { + configValue.setId(null); + configValue.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(containerTypeList) ){ + log.trace("复制容器类型成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } + } diff --git a/src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java b/src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java index 6769def..8388a66 100644 --- a/src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java +++ b/src/main/java/com/huaheng/pc/config/cycleCountPreference/controller/cycleCountPreferenceController.java @@ -14,12 +14,10 @@ import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.framework.web.page.PageDomain; import com.huaheng.framework.web.page.TableDataInfo; import com.huaheng.framework.web.page.TableSupport; +import com.huaheng.pc.config.configValue.domain.ConfigValue; +import com.huaheng.pc.config.configValue.service.ConfigValueService; import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; -import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference; -import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -36,10 +34,14 @@ public class cycleCountPreferenceController extends BaseController { @Resource private CycleCountPreferenceService cycleCountPreferenceService; + @Resource + private ConfigValueService configValueService; private String prefix = "config/cycleCountPreference"; + + @RequiresPermissions("config:cycleCountPreference:view") @GetMapping() public String cyclecountHeader() { @@ -49,7 +51,7 @@ public class cycleCountPreferenceController extends BaseController { /** * 查询盘点单主列表 */ - //@RequiresPermissions("inventory:cycleCount:list") + @RequiresPermissions("config:cycleCountPreference:list") @PostMapping("/list") @Log(title = "配置-库存配置",operating = "盘点首选项", action = BusinessType.GRANT) @ResponseBody @@ -65,9 +67,11 @@ public class cycleCountPreferenceController extends BaseController { .le(StringUtils.isNotEmpty(createdEnd), CycleCountPreference::getCreated, createdEnd)//创建时间范围 .eq(CycleCountPreference::getWarehouseCode, ShiroUtils.getWarehouseCode()) //仓库 .eq(StringUtils.isNotEmpty(cycleCountPreference.getCode()), CycleCountPreference::getCode, cycleCountPreference.getCode())//首选项编码 - .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLocation()),CycleCountPreference::getPromptLocation,cycleCountPreference.getPromptLocation())//提示货位 + + /*.eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLocation()),CycleCountPreference::getPromptLocation,cycleCountPreference.getPromptLocation())//提示货位 .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptLpn()),CycleCountPreference::getPromptLpn,cycleCountPreference.getPromptLpn())//提示PLN .eq(StringUtils.isNotEmpty(cycleCountPreference.getPromptItem()),CycleCountPreference::getPromptItem,cycleCountPreference.getPromptItem())//提示物料 + */ .eq(StringUtils.isNotEmpty(cycleCountPreference.getLastUpdatedBy()),CycleCountPreference::getLastUpdatedBy,cycleCountPreference.getLastUpdatedBy())//更新人 .eq(StringUtils.isNotEmpty(cycleCountPreference.getCreatedBy()),CycleCountPreference::getCreatedBy,cycleCountPreference.getCreatedBy())//创建人 @@ -96,17 +100,15 @@ public class cycleCountPreferenceController extends BaseController { /** * 新增保存盘点首选项 */ - //@RequiresPermissions("config:receiptPreference:add") + @RequiresPermissions("config:cycleCountPreference:add") @Log(title = "配置-盘点首选项", operating = "新增盘点首选项", action = BusinessType.INSERT) @PostMapping("/addSave") @ResponseBody public AjaxResult addSave(CycleCountPreference cycleCountPreference) { - cycleCountPreference.setWarehouseCode(ShiroUtils.getWarehouseCode()); - cycleCountPreference.setCreatedBy(ShiroUtils.getLoginName()); - cycleCountPreference.setCreated(new Date()); - cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName()); - - return toAjax(cycleCountPreferenceService.save(cycleCountPreference)); + if(cycleCountPreference == null){ + return AjaxResult.error("新增数据不能为空!"); + } + return cycleCountPreferenceService.addSave(cycleCountPreference); } /** @@ -121,11 +123,24 @@ public class cycleCountPreferenceController extends BaseController { /** * 修改保存盘点首选项 */ - //@RequiresPermissions("config:receiptPreference:edit") + @RequiresPermissions("config:cycleCountPreference:edit") @Log(title = "通用-盘点首选项", operating = "修改盘点首选项", action = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(CycleCountPreference cycleCountPreference) { + //不允许在被配置默认使用的情况先停用首选项 + if(cycleCountPreference.getEnable() == false){ + ConfigValue configValueTemp = new ConfigValue(); + configValueTemp.setModuleType("cyclecount"); + configValueTemp.setWarehouseCode(cycleCountPreference.getWarehouseCode()); + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValueTemp); + ConfigValue configValue = configValueService.getOne(configValueLambdaQueryWrapper); + if(configValue != null){ + if(configValue.getIdentifier().equals(cycleCountPreference.getCode())){ + return AjaxResult.error("该盘点首选项为系统配置默认选项,请删除系统配置中的选项再停用,修改失败!"); + } + } + } cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName()); cycleCountPreference.setLastUpdated(new Date()); return toAjax(cycleCountPreferenceService.updateById(cycleCountPreference)); @@ -134,7 +149,7 @@ public class cycleCountPreferenceController extends BaseController { /** * 删除盘点首选项 */ - //@RequiresPermissions("config:receiptPreference:remove") + @RequiresPermissions("config:cycleCountPreference:remove") @Log(title = "通用-盘点首选项", operating = "删除盘点首选项", action = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody @@ -144,6 +159,18 @@ public class cycleCountPreferenceController extends BaseController { } List<Integer> list = new ArrayList<>(); for (Integer id : Convert.toIntArray(ids)) { + //校验该首选项是否在使用 + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getById(id); + ConfigValue configValueTemp = new ConfigValue(); + configValueTemp.setModuleType("cyclecount"); + configValueTemp.setWarehouseCode(cycleCountPreference.getWarehouseCode()); + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValueTemp); + ConfigValue configValue = configValueService.getOne(configValueLambdaQueryWrapper); + if(configValue != null){ + if(configValue.getIdentifier().equals(cycleCountPreference.getCode())){ + return AjaxResult.error("该盘点首选项为系统配置默认选项,请删除系统配置中的选项再删除,删除失败!"); + } + } list.add(id); } return toAjax(cycleCountPreferenceService.removeByIds(list)); diff --git a/src/main/java/com/huaheng/pc/config/cycleCountPreference/domain/CycleCountPreference.java b/src/main/java/com/huaheng/pc/config/cycleCountPreference/domain/CycleCountPreference.java index 048d7bb..35df40b 100644 --- a/src/main/java/com/huaheng/pc/config/cycleCountPreference/domain/CycleCountPreference.java +++ b/src/main/java/com/huaheng/pc/config/cycleCountPreference/domain/CycleCountPreference.java @@ -48,41 +48,41 @@ public class CycleCountPreference implements Serializable { */ @TableField(value = "promptLocation") @ApiModelProperty(value="系统提示货位") - private String promptLocation; + private Boolean promptLocation; /** - * 系统提示LPN + * 系统提示容器 */ @TableField(value = "promptLpn") - @ApiModelProperty(value="系统提示LPN") - private String promptLpn; + @ApiModelProperty(value="系统提示容器") + private Boolean promptLpn; /** * 系统提示物料 */ @TableField(value = "promptItem") @ApiModelProperty(value="系统提示物料") - private String promptItem; + private Boolean promptItem; /** * 显示库存数量 */ @TableField(value = "promptQuantity") @ApiModelProperty(value="显示库存数量") - private Integer promptQuantity; + private Boolean promptQuantity; /** * 允许添加库存 */ @TableField(value = "allowAddNewInventory") @ApiModelProperty(value="允许添加库存") - private Integer allowAddNewInventory; + private Boolean allowAddNewInventory; /** * 有效 */ - @TableField(value = "Enable") - @ApiModelProperty(value="有效") + @TableField(value = "enable") + @ApiModelProperty(value="是否有效") private Boolean enable; /** @@ -153,7 +153,7 @@ public class CycleCountPreference implements Serializable { */ @TableField(value = "countByPiece") @ApiModelProperty(value="RF逐件盘点") - private Integer countByPiece; + private Boolean countByPiece; private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/cycleCountPreference/service/CycleCountPreferenceService.java b/src/main/java/com/huaheng/pc/config/cycleCountPreference/service/CycleCountPreferenceService.java index 3419a05..f0585c3 100644 --- a/src/main/java/com/huaheng/pc/config/cycleCountPreference/service/CycleCountPreferenceService.java +++ b/src/main/java/com/huaheng/pc/config/cycleCountPreference/service/CycleCountPreferenceService.java @@ -1,12 +1,109 @@ package com.huaheng.pc.config.cycleCountPreference.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.containerType.domain.ContainerType; +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; +import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.Date; import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.config.cycleCountPreference.mapper.CycleCountPreferenceMapper; import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; +import org.springframework.transaction.annotation.Transactional; + @Service public class CycleCountPreferenceService extends ServiceImpl<CycleCountPreferenceMapper, CycleCountPreference> { + /** + *新增盘点首选项 + * @param cycleCountPreference + * @return + */ + @Transactional + public AjaxResult addSave (CycleCountPreference cycleCountPreference){ + + cycleCountPreference.setCode(newCode()); + cycleCountPreference.setWarehouseCode(ShiroUtils.getWarehouseCode()); + cycleCountPreference.setCreatedBy(ShiroUtils.getLoginName()); + cycleCountPreference.setCreated(new Date()); + cycleCountPreference.setLastUpdatedBy(ShiroUtils.getLoginName()); + this.save(cycleCountPreference); + return AjaxResult.success("新增完成!"); + } + + + /** + * 自动生成盘点首选项Code + * 使用特定字段和ID组合成Code + */ + public String newCode(){ + //先查询前一个ID生成当前的数字,再拼接 + String code = null; + Date now = new Date(); + SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); + LambdaQueryWrapper<CycleCountPreference> lambda = Wrappers.lambdaQuery(); + lambda.select(CycleCountPreference::getCode) + .orderByDesc(CycleCountPreference::getId).last("Limit 1"); + // code = ccp + 日期 + (排序号 + 1) + String maxCode = null; + CycleCountPreference cycleCountPreference = this.getOne(lambda); + if ( cycleCountPreference != null){ + maxCode = this.getOne(lambda).getCode(); + } + if (maxCode != null && maxCode.substring(maxCode.length() - 13, maxCode.length() - 5).equals(df.format(now))) { + Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5 )); + code = "ccp" + df.format(now) + String.format("%05d", Count + 1); + } else { + code = "ccp" + df.format(now) +"00001"; + } + return code; + } + + /** + * 复制盘点首选项表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + public boolean cycleCountPreferenceCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复盘点首选项表"); + LambdaQueryWrapper<CycleCountPreference> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(CycleCountPreference::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error(newWarehouseCode+"仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(CycleCountPreference::getWarehouseCode, warehouseCode); + List<CycleCountPreference> cycleCountPreferenceList = this.list(lambdaQueryWrapper); + + for ( CycleCountPreference countPreference : cycleCountPreferenceList) { + countPreference.setId(null); + countPreference.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(cycleCountPreferenceList) ){ + log.trace("复制盘点首选项表成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } + + + + + + + + } diff --git a/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java b/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java index e26903c..e874571 100644 --- a/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java +++ b/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java @@ -15,16 +15,25 @@ import com.huaheng.framework.web.page.PageDomain; import com.huaheng.framework.web.page.TableDataInfo; import com.huaheng.framework.web.page.TableSupport; import com.huaheng.pc.config.location.domain.Location; +import com.huaheng.pc.config.location.domain.LocationStatus; import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.config.material.domain.Material; +import com.huaheng.pc.config.material.service.MaterialService; +import com.huaheng.pc.config.materialType.service.MaterialTypeService; +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import io.swagger.models.auth.In; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; @Api(tags={"库位操作类"}) @@ -36,6 +45,10 @@ public class LocationController extends BaseController { @Resource private LocationService locationService; + @Resource + private InventoryDetailService inventoryDetailService; + @Resource + private MaterialService materialService; @RequiresPermissions("config:location:view") @GetMapping() @@ -89,6 +102,21 @@ public class LocationController extends BaseController { } /** + * 查询库位列表 + */ + @Log(title = "通用-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) + @PostMapping("/getAllLocation") + @ResponseBody + public AjaxResult getAllLocation(String type) { + if (StringUtils.isEmpty(type)) { + return AjaxResult.error("type不能为空"); + } + + return AjaxResult.success(locationService.getAllLocation(type)); + } + + + /** * 新增库位 */ @GetMapping("/add") @@ -123,7 +151,7 @@ public class LocationController extends BaseController { /** * 批量新增保存库位 */ - @RequiresPermissions("config:location:add") + @RequiresPermissions("config:location:addBatch") @ApiOperation(value="新增库位", notes="批量新增库位", httpMethod = "POST") @Log(title = "通用-库位管理", operating = "新增库位", action = BusinessType.INSERT) @PostMapping("/addBatchSave") @@ -163,8 +191,9 @@ public class LocationController extends BaseController { @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { - if (StringUtils.isEmpty(ids)) + if (StringUtils.isEmpty(ids)){ return AjaxResult.error("id不能为空"); + } for (Integer id : Convert.toIntArray(ids)) { Location location = locationService.getById(id); if (StringUtils.isEmpty(location.getContainerCode())) { @@ -178,4 +207,108 @@ public class LocationController extends BaseController { } return AjaxResult.success("删除成功!"); } + + /** + * 查询库位列表 + */ + @Log(title = "通用-库位管理", operating = "查看库位列表", action = BusinessType.GRANT) + @PostMapping("/getLocationInfo") + @ResponseBody + public AjaxResult getLocationInfo(String type, String row, String line, String layer, String grid) { + if (StringUtils.isEmpty(type)) { + return AjaxResult.error("type不能为空"); + } + + /* 查询库位信息*/ + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); + locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getIRow, row) + .eq(StringUtils.isNotEmpty(line), Location::getIColumn, line) + .eq(StringUtils.isNotEmpty(layer), Location::getILayer, layer) + .eq(Location::getIGrid, 1) + .eq(StringUtils.isNotEmpty(type), Location::getLocationType, type) + .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(StringUtils.isNotEmpty(type), Location::getZoneCode, type); + List<Location> locations = locationService.list(locationLambdaQueryWrapper); + List<Location> locationList = new ArrayList<>(); + + /* 查询库存明细*/ + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambda = Wrappers.lambdaQuery(); + inventoryDetailLambda.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda); + + LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery(); + materialLambda.eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()); + List<Material> materialList = materialService.list(materialLambda); + + for(Location location1 : locations) { + InventoryDetail inventoryDetail = null; + String materialName = null; + for (InventoryDetail inventoryDetail2: inventoryDetailList) { + if (location1.getCode().equals(inventoryDetail2.getLocationCode())){ + inventoryDetail = inventoryDetail2; + } + } + if (inventoryDetail != null){ + for (Material material : materialList) { + if (material.getCode().equals(inventoryDetail.getMaterialCode())){ + materialName = material.getName(); + break; + } + } + } + + int userDef3 = 0; + String status = location1.getStatus(); + String containerCode = location1.getContainerCode(); + if (status.equals("empty")) { + if(StringUtils.isEmpty(containerCode)) { + userDef3 = LocationStatus.IDLE_EMPTY_LOCATION; + } else { + if(inventoryDetail == null) { + userDef3 = LocationStatus.IDLE_EMPTY_CONTAINER; + } else { + location1.setMaterialName(materialName); + location1.setMaterialCode(inventoryDetail.getMaterialCode()); + location1.setBatch(inventoryDetail.getBatch()); + location1.setQty(String.valueOf(inventoryDetail.getQty())); + userDef3 = LocationStatus.IDLE_FULL_CONTAINER; + } + } + } else if(status.equals("lock")) { + if(StringUtils.isEmpty(containerCode)) { + userDef3 = LocationStatus.LOCK_EMPTY_LOCATION; + } else { + if(inventoryDetail == null) { + userDef3 = LocationStatus.LOCK_EMPTY_CONTAINER; + } else { + location1.setMaterialName(materialName); + location1.setMaterialCode(inventoryDetail.getMaterialCode()); + location1.setBatch(inventoryDetail.getBatch()); + location1.setQty(String.valueOf(inventoryDetail.getQty())); + userDef3 = LocationStatus.LOCK_FULL_CONTAINER; + } + } + } + + if (location1.getDeleted()) { + if(StringUtils.isEmpty(containerCode)) { + userDef3 = LocationStatus.DISABLE_EMPTY_LOCATION; + } else { + if(inventoryDetail == null) { + userDef3 = LocationStatus.DISABLE_EMPTY_CONTAINER; + } else { + location1.setMaterialName(materialName); + location1.setMaterialCode(inventoryDetail.getMaterialCode()); + location1.setBatch(inventoryDetail.getBatch()); + location1.setQty(String.valueOf(inventoryDetail.getQty())); + userDef3 = LocationStatus.DISABLE_FULL_CONTAINER; + } + } + } + + location1.setUserDef3(String.valueOf(userDef3)); + locationList.add(location1); + } + return AjaxResult.success(locations); + } } diff --git a/src/main/java/com/huaheng/pc/config/location/domain/Location.java b/src/main/java/com/huaheng/pc/config/location/domain/Location.java index 65c1a0f..40d44c4 100644 --- a/src/main/java/com/huaheng/pc/config/location/domain/Location.java +++ b/src/main/java/com/huaheng/pc/config/location/domain/Location.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import lombok.Data; +import org.springframework.transaction.annotation.Transactional; @Data @TableName(value = "location") @@ -72,6 +73,12 @@ public class Location implements Serializable { private Integer iGrid; /** + * 巷道 + */ + @TableField(value = "roadway") + private String roadway; + + /** * 名称 */ @TableField(value = "name") @@ -173,57 +180,14 @@ public class Location implements Serializable { @TableField(value = "deleted") private Boolean deleted; - private static final long serialVersionUID = 1L; - - public static final String COL_CODE = "code"; - - public static final String COL_WAREHOUSECODE = "warehouseCode"; - - public static final String COL_ZONECODE = "zoneCode"; - - public static final String COL_LOCATIONTYPE = "locationType"; - - public static final String COL_CONTAINERCODE = "containerCode"; - - public static final String COL_IROW = "iRow"; - - public static final String COL_ICOLUMN = "iColumn"; - - public static final String COL_ILAYER = "iLayer"; - - public static final String COL_IGRID = "iGrid"; - public static final String COL_NAME = "name"; + private transient String materialCode; - public static final String COL_ENABLE = "enable"; + private transient String materialName; - public static final String COL_LASTCYCLECOUNTDATE = "lastCycleCountDate"; + private transient String batch; - public static final String COL_CREATED = "created"; + private transient String qty; - public static final String COL_CREATEDBY = "createdBy"; - - public static final String COL_LASTUPDATED = "lastUpdated"; - - public static final String COL_LASTUPDATEDBY = "lastUpdatedBy"; - - public static final String COL_VERSION = "version"; - - public static final String COL_USERDEF1 = "userDef1"; - - public static final String COL_USERDEF2 = "userDef2"; - - public static final String COL_USERDEF3 = "userDef3"; - - public static final String COL_USERDEF4 = "userDef4"; - - public static final String COL_USERDEF5 = "userDef5"; - - public static final String COL_USERDEF6 = "userDef6"; - - public static final String COL_USERDEF7 = "userDef7"; - - public static final String COL_USERDEF8 = "userDef8"; - - public static final String COL_SYSTEMCREATED = "systemCreated"; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/location/domain/LocationInfo.java b/src/main/java/com/huaheng/pc/config/location/domain/LocationInfo.java new file mode 100644 index 0000000..09a24f6 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/location/domain/LocationInfo.java @@ -0,0 +1,14 @@ +package com.huaheng.pc.config.location.domain; + +import lombok.Data; + +/** + * Created by Enzo Cotter on 2019/10/25. + */ +@Data +public class LocationInfo { + private long maxRow; + private long maxLine; + private long maxLayer; + private long maxGrid; +} diff --git a/src/main/java/com/huaheng/pc/config/location/domain/LocationStatus.java b/src/main/java/com/huaheng/pc/config/location/domain/LocationStatus.java new file mode 100644 index 0000000..67e0371 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/location/domain/LocationStatus.java @@ -0,0 +1,20 @@ +package com.huaheng.pc.config.location.domain; + +/** + * Created by Enzo Cotter on 2019/10/25. + */ +public class LocationStatus { + + public static final int IDLE_EMPTY_LOCATION = 1; //空柜空闲 + public static final int IDLE_EMPTY_CONTAINER = 2; //空盘空闲 + public static final int IDLE_HALF_CONTAINER = 3; //半盘空闲 + public static final int IDLE_FULL_CONTAINER = 4; //满盘空闲 + public static final int LOCK_EMPTY_LOCATION = 5; //空柜锁定 + public static final int LOCK_EMPTY_CONTAINER = 6; //空盘锁定 + public static final int LOCK_HALF_CONTAINER = 7; //半盘锁定 + public static final int LOCK_FULL_CONTAINER = 8; //满盘锁定 + public static final int DISABLE_EMPTY_LOCATION = 9; //空柜禁用 + public static final int DISABLE_EMPTY_CONTAINER = 10; //空盘禁用 + public static final int DISABLE_HALF_CONTAINER = 11; //半盘禁用 + public static final int DISABLE_FULL_CONTAINER = 12; //满盘禁用 +} diff --git a/src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java b/src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java index 9a08203..e69bc74 100644 --- a/src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java +++ b/src/main/java/com/huaheng/pc/config/location/mapper/LocationMapper.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.location.domain.Location; import org.apache.ibatis.annotations.Param; +import java.util.LinkedHashMap; +import java.util.List; + public interface LocationMapper extends BaseMapper<Location> { void updateStatus(@Param("warehouseCode") String warehouseCode, @Param("code") String code, @Param("status") String status); @@ -11,4 +14,9 @@ public interface LocationMapper extends BaseMapper<Location> { void updateContainerCodeAndStatus(@Param("warehouseCode") String warehouseCode, @Param("locationCode") String locationCode, @Param("containerCode") String containerCode, @Param("status") String status); Location position(String locatingRule); + + Location getAllLocation(@Param("warehouseCode") String warehouseCode, @Param("type") String type); + + //库位利用率 + List<LinkedHashMap<String, Object>> getLocationProp(); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/location/service/LocationService.java b/src/main/java/com/huaheng/pc/config/location/service/LocationService.java index 6500a7f..8d1f352 100644 --- a/src/main/java/com/huaheng/pc/config/location/service/LocationService.java +++ b/src/main/java/com/huaheng/pc/config/location/service/LocationService.java @@ -3,6 +3,11 @@ package com.huaheng.pc.config.location.service; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.config.location.domain.Location; import com.baomidou.mybatisplus.extension.service.IService; +import com.huaheng.pc.config.location.domain.LocationInfo; + +import java.util.LinkedHashMap; +import java.util.List; + public interface LocationService extends IService<Location>{ AjaxResult addsave(Location location); @@ -15,4 +20,8 @@ public interface LocationService extends IService<Location>{ void updateContainerCodeAndStatus(String locationCode, String containerCode, String status); + LocationInfo getAllLocation(String type); + + //库位利用率 + List<LinkedHashMap<String, Object>> getLocationProp(); } diff --git a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java index d616478..930e16a 100644 --- a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java @@ -7,6 +7,7 @@ import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.location.domain.LocationInfo; import com.huaheng.pc.config.locationType.domain.LocationType; import com.huaheng.pc.config.locationType.service.LocationTypeService; import com.huaheng.pc.config.zone.domain.Zone; @@ -15,6 +16,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -73,13 +75,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i return AjaxResult.success("新增库位成功"); } + /** + * 批量新增库位 + * @param location + * @return boolean + */ @Override public boolean insertLocation(Location location) { /* 判断库位类型编码是否存在*/ - LambdaQueryWrapper<LocationType> typelambda = Wrappers.lambdaQuery(); - typelambda.eq(LocationType::getCode,location.getLocationType()) + LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery(); + typeLambda.eq(LocationType::getCode,location.getLocationType()) .select(LocationType::getCode); - List<Map<String, Object>> list = locationTypeService.listMaps(typelambda); + List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda); if (list.size() < 1){ throw new ServiceException("库位类型编码不存在"); } @@ -97,7 +104,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i if(!location.getZoneCode().equals(location.getLocationType())){ throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配"); } - String prefix = location.getLocationType().substring(1); + List<Location> locations = new ArrayList<>(); for (int i=1; i<=location.getIRow().intValue(); i++) { for (int j=1; j<=location.getIColumn().intValue(); j++) { @@ -109,6 +116,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i param.setIColumn(j); param.setILayer(k); param.setIGrid(m); + param.setRoadway(location.getRoadway()); param.setZoneCode(location.getZoneCode()); param.setLocationType(location.getLocationType()); param.setStatus(location.getStatus()); @@ -116,11 +124,12 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i param.setCreatedBy(ShiroUtils.getLoginName()); param.setLastUpdatedBy(ShiroUtils.getLoginName()); String code = MessageFormat.format("{0}{1}-{2}-{3}-{4}", - prefix, + location.getLocationType(), String.format("%02d", i), String.format("%02d", j), String.format("%02d", k), String.format("%02d", m)); + //查询该库位编码是否存在 LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery(); queryWrapper.eq(Location::getCode,code) .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode()); @@ -133,8 +142,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i } } } - Boolean result = locationService.saveBatch(locations); - return result; + return locationService.saveBatch(locations); } @Override @@ -149,6 +157,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i * @param locatingRule * @return */ + @Override public String position(String locatingRule){ return locationMapper.position(locatingRule).getCode(); } @@ -158,9 +167,28 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i * */ @Override public void updateContainerCodeAndStatus(String locationCode, String containerCode, String status) { - if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) + if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) { locationMapper.updateContainerCodeAndStatus(ShiroUtils.getWarehouseCode(), locationCode, containerCode, status); + } } + @Override + public LocationInfo getAllLocation(String type) { + if (StringUtils.isNotEmpty(type)) { + Location location = locationMapper.getAllLocation(ShiroUtils.getWarehouseCode(), type); + LocationInfo locationInfo = new LocationInfo(); + locationInfo.setMaxRow(location.getIRow()); + locationInfo.setMaxLine(location.getIColumn()); + locationInfo.setMaxLayer(location.getILayer()); + locationInfo.setMaxGrid(location.getIGrid()); + return locationInfo; + } + return null; + } + + @Override + public List<LinkedHashMap<String, Object>> getLocationProp() { + return locationMapper.getLocationProp(); + } } diff --git a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeService.java b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeService.java index 19cc6e6..89774f6 100644 --- a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeService.java +++ b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeService.java @@ -8,5 +8,13 @@ import java.util.Map; public interface LocationTypeService extends IService<LocationType>{ - public List<Map<String, Object>> getLocationPrefix(); + List<Map<String, Object>> getLocationPrefix(); + + /** + * 复制库位类型表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + boolean locationTypeCopy(String warehouseCode, String newWarehouseCode); } diff --git a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java index dcd856b..8633ff2 100644 --- a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; import com.huaheng.pc.config.locationType.domain.LocationType; import com.huaheng.pc.config.locationType.mapper.LocationTypeMapper; import org.springframework.stereotype.Service; @@ -14,10 +15,45 @@ import java.util.Map; @Service("locationType") public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, LocationType> implements LocationTypeService{ + @Override public List<Map<String, Object>> getLocationPrefix(){ LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode()) .eq(LocationType::getEnable, true); return this.listMaps(lambdaQueryWrapper); } + + /** + * 复制库位类型表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public boolean locationTypeCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复盘点首选项表"); + LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(LocationType::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error(newWarehouseCode+"仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(LocationType::getWarehouseCode, warehouseCode); + List<LocationType> locationTypeList = this.list(lambdaQueryWrapper); + + for ( LocationType locationType : locationTypeList) { + locationType.setId(null); + locationType.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(locationTypeList) ){ + log.trace("复制盘点首选项表成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/receiptPreference/service/ReceiptPreferenceService.java b/src/main/java/com/huaheng/pc/config/receiptPreference/service/ReceiptPreferenceService.java index 348f181..96ea6e8 100644 --- a/src/main/java/com/huaheng/pc/config/receiptPreference/service/ReceiptPreferenceService.java +++ b/src/main/java/com/huaheng/pc/config/receiptPreference/service/ReceiptPreferenceService.java @@ -1,5 +1,8 @@ package com.huaheng.pc.config.receiptPreference.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @@ -9,4 +12,36 @@ import com.huaheng.pc.config.receiptPreference.domain.ReceiptPreference; @Service public class ReceiptPreferenceService extends ServiceImpl<ReceiptPreferenceMapper, ReceiptPreference> { + /** + * 复制盘点首选项表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + public boolean receiptPreferenceCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始入库首选项表"); + LambdaQueryWrapper<ReceiptPreference> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ReceiptPreference::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error(newWarehouseCode+"仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ReceiptPreference::getWarehouseCode, warehouseCode); + List<ReceiptPreference> receiptPreferenceList = this.list(lambdaQueryWrapper); + + for ( ReceiptPreference receiptPreference : receiptPreferenceList) { + receiptPreference.setId(null); + receiptPreference.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(receiptPreferenceList) ){ + log.trace("复制入库首选项表成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java b/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java index dfd7911..3ae092b 100644 --- a/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java +++ b/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeService.java @@ -5,5 +5,11 @@ import com.huaheng.pc.config.receiptType.domain.ReceiptType; public interface ReceiptTypeService extends IService<ReceiptType>{ - + /** + * 复制入库类型表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + Boolean receiptTypeCopy(String warehouseCode, String newWarehouseCode); } diff --git a/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java b/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java index a991e93..08d10c3 100644 --- a/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/receiptType/service/ReceiptTypeServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.pc.config.address.domain.Address; import com.huaheng.pc.config.receiptType.domain.ReceiptType; import com.huaheng.pc.config.receiptType.mapper.ReceiptTypeMapper; import org.springframework.stereotype.Service; @@ -20,4 +21,38 @@ public class ReceiptTypeServiceImpl extends ServiceImpl<ReceiptTypeMapper, Recei .in(ReceiptType::getCompanyCode, ShiroUtils.getCompanyCodeList()); return this.listMaps(lambdaQueryWrapper); } + + /** + * 复制入库类型表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public Boolean receiptTypeCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复制入库类型表"); + LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ReceiptType::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error("该仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ReceiptType::getWarehouseCode, warehouseCode); + List<ReceiptType> receiptTypeList = this.list(lambdaQueryWrapper); + + for ( ReceiptType receiptType : receiptTypeList) { + receiptType.setId(null); + receiptType.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(receiptTypeList) ){ + log.trace("复制入库类型成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMail.java b/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMail.java index f704d2b..fcd51ee 100644 --- a/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMail.java +++ b/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMail.java @@ -10,6 +10,9 @@ import java.io.Serializable; import java.util.Date; import lombok.Data; +/** + * @author mahuandong + */ @ApiModel(value="com.huaheng.pc.config.sendMail.domain.SendMail") @Data @TableName(value = "send_mail") diff --git a/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMailText.java b/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMailText.java deleted file mode 100644 index e69de29..0000000 --- a/src/main/java/com/huaheng/pc/config/sendMail/domain/SendMailText.java +++ /dev/null diff --git a/src/main/java/com/huaheng/pc/config/sendMail/service/MailService.java b/src/main/java/com/huaheng/pc/config/sendMail/service/MailService.java index 39bc97d..48a4805 100644 --- a/src/main/java/com/huaheng/pc/config/sendMail/service/MailService.java +++ b/src/main/java/com/huaheng/pc/config/sendMail/service/MailService.java @@ -12,6 +12,7 @@ public interface MailService { * @param subject 主题 * @param content 内容 * @param cc 抄送 + * @return 是否发送成功 */ Boolean sendSimpleMail(String[] to, String subject, String content, String[] cc); /** @@ -20,6 +21,7 @@ public interface MailService { * @param subject 主题 * @param content 内容(可以包含<html>等标签) * @param cc 抄送 + * @return 是否发送成功 */ Boolean sendHtmlMail(String[] to, String subject, String content, String[] cc); /** @@ -29,6 +31,7 @@ public interface MailService { * @param content 内容 * @param filePath 附件路径 * @param cc 抄送 + * @return 是否发送成功 */ Boolean sendAttachmentMail(String[] to, String subject, String content, String filePath, String[] cc); /** @@ -39,6 +42,7 @@ public interface MailService { * @param rscPath 图片路径 * @param rscId 图片ID,用于在<img>标签中使用,从而显示图片 * @param cc 抄送邮箱 + * @return 是否发送成功 */ Boolean sendInlineResourceMail(String[] to, String subject, String content, String rscPath, String rscId, String[] cc); } diff --git a/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java b/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java index 293c66a..9485450 100644 --- a/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java +++ b/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceService.java @@ -12,4 +12,12 @@ public interface ShipmentPreferenceService extends IService<ShipmentPreference>{ //查看出库此操作是否符合出库首选项的出库流程 List<ShipmentHeader> checkShipmentProcess(String ids, Integer status,String code); + /** + * 复制出库首选项表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + boolean shipmentPreferenceCopy(String warehouseCode, String newWarehouseCode); + } diff --git a/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java b/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java index cda6380..c8ba0e7 100644 --- a/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java @@ -109,4 +109,38 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc return shipmentHeaderList; } + + /** + * 复制出库首选项表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public boolean shipmentPreferenceCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复制出库首选项表"); + LambdaQueryWrapper<ShipmentPreference> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ShipmentPreference::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error("该仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ShipmentPreference::getWarehouseCode, warehouseCode); + List<ShipmentPreference> shipmentPreferenceList = this.list(lambdaQueryWrapper); + + for ( ShipmentPreference shipmentPreference : shipmentPreferenceList) { + shipmentPreference.setId(null); + shipmentPreference.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(shipmentPreferenceList) ){ + log.trace("复制出库首选项成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/shipmentType/config/shipmentTypeController.java b/src/main/java/com/huaheng/pc/config/shipmentType/controller/shipmentTypeController.java index a91e7b1..7327902 100644 --- a/src/main/java/com/huaheng/pc/config/shipmentType/config/shipmentTypeController.java +++ b/src/main/java/com/huaheng/pc/config/shipmentType/controller/shipmentTypeController.java @@ -1,4 +1,4 @@ -package com.huaheng.pc.config.shipmentType.config; +package com.huaheng.pc.config.shipmentType.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; diff --git a/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeService.java b/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeService.java index a5ba810..4f16056 100644 --- a/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeService.java +++ b/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeService.java @@ -5,5 +5,11 @@ import com.huaheng.pc.config.shipmentType.domain.ShipmentType; public interface ShipmentTypeService extends IService<ShipmentType>{ - + /** + * 复制出库类型表 + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + boolean ShipmentTypeCopy(String warehouseCode, String newWarehouseCode); } diff --git a/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java b/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java index 9a5cdf8..2302a20 100644 --- a/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/shipmentType/service/ShipmentTypeServiceImpl.java @@ -1,11 +1,49 @@ package com.huaheng.pc.config.shipmentType.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; import com.huaheng.pc.config.shipmentType.domain.ShipmentType; import com.huaheng.pc.config.shipmentType.mapper.ShipmentTypeMapper; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class ShipmentTypeServiceImpl extends ServiceImpl<ShipmentTypeMapper, ShipmentType> implements ShipmentTypeService { + /** + * 复制出库首选项表 + * + * @param warehouseCode 原仓库编码 + * @param newWarehouseCode 新仓库编码 + * @return 是否复制成功 + */ + @Override + public boolean ShipmentTypeCopy(String warehouseCode, String newWarehouseCode) { + log.trace("开始复制出库类型表"); + LambdaQueryWrapper<ShipmentType> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ShipmentType::getWarehouseCode, newWarehouseCode); + if (!this.list(lambdaQueryWrapper).isEmpty()){ + log.error("该仓库已存在"); + return false; + } + + lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ShipmentType::getWarehouseCode, warehouseCode); + List<ShipmentType> shipmentTypeList = this.list(lambdaQueryWrapper); + + for ( ShipmentType shipmentType : shipmentTypeList) { + shipmentType.setId(null); + shipmentType.setWarehouseCode(newWarehouseCode); + } + + if ( this.saveBatch(shipmentTypeList) ){ + log.trace("复制出库类型成功,新仓库编码是:"+newWarehouseCode); + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/huaheng/pc/config/station/controller/stationController.java b/src/main/java/com/huaheng/pc/config/station/controller/stationController.java new file mode 100644 index 0000000..fef29bd --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/station/controller/stationController.java @@ -0,0 +1,136 @@ +package com.huaheng.pc.config.station.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huaheng.common.support.Convert; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.framework.web.page.PageDomain; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.framework.web.page.TableSupport; +import com.huaheng.pc.config.station.domain.Station; +import com.huaheng.pc.config.station.service.StationService; +import io.swagger.annotations.ApiParam; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * Created by Enzo Cotter on 2019/10/14. + */ +@Controller +@RequestMapping("/config/station") +public class stationController extends BaseController { + + @Resource + private StationService stationService; + + private String prefix = "config/station"; + + @RequiresPermissions("config:station:view") + @GetMapping() + public String station() { + return prefix + "/station"; + } + + /** + * 查询出库类型 + */ + @RequiresPermissions("config:station:list") + @Log(title = "配置-站台",operating = "站台列表", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(@ApiParam(name="shipmentType",value="编码、类型") Station station, + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { + LambdaQueryWrapper<Station> lambdaQueryWrapper = Wrappers.lambdaQuery(); + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Station::getCreated, createdBegin) + .lt(StringUtils.isNotEmpty(createdEnd), Station::getCreated, createdEnd) + .eq(StringUtils.isNotEmpty(station.getCode()), Station::getCode, station.getCode()) + .eq(StringUtils.isNotEmpty(station.getType()), Station::getType, station.getType()) + .eq(Station::getWarehouseCode, ShiroUtils.getWarehouseCode()); + + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ + /*使用分页查询*/ + Page<Station> page = new Page<>(pageNum, pageSize); + IPage<Station> iPage = stationService.page(page, lambdaQueryWrapper); + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + } else { + List<Station> list = stationService.list(lambdaQueryWrapper); + return getDataTable(list); + } + } + + /** + * 新增站台 + */ + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增保存站台 + */ + @RequiresPermissions("config:station:add") + @Log(title = "配置-站台",operating = "新增站台", action = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(Station station) { + station.setWarehouseCode(ShiroUtils.getWarehouseCode()); + return toAjax(stationService.save(station)); + } + + /** + * 修改站台 + */ + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { + Station station = stationService.getById(id); + mmap.put("station", station); + return prefix + "/edit"; + } + + /** + * 修改保存站台 + */ + @RequiresPermissions("config:station:edit") + @Log(title = "配置-站台",operating = "修改站台", action = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(Station station) { + station.setLastUpdatedBy(ShiroUtils.getLoginName()); + return toAjax(stationService.updateById(station)); + } + + /** + * 删除出库 + */ + @RequiresPermissions("config:station:remove") + @Log(title = "配置-站台",operating = "删除站台", action = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) { + if (StringUtils.isEmpty(ids)) { + return AjaxResult.error("id不能为空"); + } + List<Integer> list = new ArrayList<>(Arrays.asList(Convert.toIntArray(ids))); + return toAjax(stationService.removeByIds(list)); + } + +} diff --git a/src/main/java/com/huaheng/pc/config/station/domain/Station.java b/src/main/java/com/huaheng/pc/config/station/domain/Station.java new file mode 100644 index 0000000..0b935bf --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/station/domain/Station.java @@ -0,0 +1,82 @@ +package com.huaheng.pc.config.station.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * Created by Enzo Cotter on 2019/10/11. + */ + +@ApiModel(value="com.huaheng.pc.config.station.domain.Station") +@Data +@TableName(value = "station") +public class Station implements Serializable { + @TableId(value = "id", type = IdType.INPUT) + @ApiModelProperty(value="null") + private Integer id; + + /** + * 编码 + */ + @TableField(value = "code") + @ApiModelProperty(value="编码") + private String code; + + /** + * 类型 + */ + @TableField(value = "type") + @ApiModelProperty(value="类型") + private String type; + + /** + * 状态 + */ + @TableField(value = "status") + @ApiModelProperty(value="状态") + private Integer status; + + /** + * 仓库编码 + */ + @TableField(value = "warehouseCode") + @ApiModelProperty(value="仓库编码") + private String warehouseCode; + + /** + * 创建时间 + */ + @TableField(value = "created") + @ApiModelProperty(value="创建时间") + private Date created; + + /** + * 创建者 + */ + @TableField(value = "createdBy") + @ApiModelProperty(value="创建者") + private String createdBy; + + /** + * 更新时间 + */ + @TableField(value = "lastUpdated") + @ApiModelProperty(value="更新时间") + private Date lastUpdated; + + /** + * 更新者 + */ + @TableField(value = "lastUpdatedBy") + @ApiModelProperty(value="更新者") + private String lastUpdatedBy; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/station/mapper/StationMapper.java b/src/main/java/com/huaheng/pc/config/station/mapper/StationMapper.java new file mode 100644 index 0000000..bc6daa8 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/station/mapper/StationMapper.java @@ -0,0 +1,11 @@ +package com.huaheng.pc.config.station.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.huaheng.pc.config.station.domain.Station; + +/** + * Created by Enzo Cotter on 2019/10/11. + */ + +public interface StationMapper extends BaseMapper<Station> { +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/station/service/StationService.java b/src/main/java/com/huaheng/pc/config/station/service/StationService.java new file mode 100644 index 0000000..700a323 --- /dev/null +++ b/src/main/java/com/huaheng/pc/config/station/service/StationService.java @@ -0,0 +1,16 @@ +package com.huaheng.pc.config.station.service; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.pc.config.station.domain.Station; +import com.huaheng.pc.config.station.mapper.StationMapper; +/** + * Created by Enzo Cotter on 2019/10/11. + */ + +@Service +public class StationService extends ServiceImpl<StationMapper, Station> { + +} diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowDetailController.java b/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowDetailController.java index 15d6296..e12233c 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowDetailController.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowDetailController.java @@ -96,6 +96,7 @@ public class StatusFlowDetailController extends BaseController { StatusFlowHeader statusFlowHeader = statusFlowHeaderService.getById(headerId); mmap.put("headerId",headerId); mmap.put("headerCode", statusFlowHeader.getCode()); + mmap.put("moduleType", statusFlowHeader.getModuleType()); return prefix + "/add"; } diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java b/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java index 5ea4dab..e76b4c5 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/controller/StatusFlowHeaderController.java @@ -82,8 +82,9 @@ public class StatusFlowHeaderController extends BaseController { /** * 新增流程 */ - @GetMapping("/add") - public String add() { + @GetMapping("/add/{type}") + public String add(@PathVariable("type") String type, ModelMap modelMap) { + modelMap.put("moduleType", type); return prefix + "/add"; } diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowDetailMapper.java b/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowDetailMapper.java index cd578d2..b23db2a 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowDetailMapper.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowDetailMapper.java @@ -2,6 +2,13 @@ package com.huaheng.pc.config.statusFlow.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; +import org.apache.ibatis.annotations.Param; public interface StatusFlowDetailMapper extends BaseMapper<StatusFlowDetail> { + + //复制流程明细 + int statusFlowDetailCopy(@Param("code") String code, @Param("newCode") String newCode); + + //修改流程明细headerId + int updateHeaderId(@Param("code") String code); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowHeaderMapper.java b/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowHeaderMapper.java index 3023ea1..2d75c28 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/mapper/StatusFlowHeaderMapper.java @@ -2,6 +2,10 @@ package com.huaheng.pc.config.statusFlow.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader; +import org.apache.ibatis.annotations.Param; public interface StatusFlowHeaderMapper extends BaseMapper<StatusFlowHeader> { + + //复制流程主表 + int statusFlowHeaderCopy(@Param("code") String code, @Param("newCode") String newCode); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowDetailService.java b/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowDetailService.java index 5108b8d..2fdd1ee 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowDetailService.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowDetailService.java @@ -2,6 +2,7 @@ package com.huaheng.pc.config.statusFlow.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.security.ShiroUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @@ -16,7 +17,8 @@ public class StatusFlowDetailService extends ServiceImpl<StatusFlowDetailMapper, public List<StatusFlowDetail> queryStatusFlowDetail(String headerCode){ LambdaQueryWrapper<StatusFlowDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.orderByAsc(StatusFlowDetail::getSequence) - .eq(StatusFlowDetail::getHeaderCode, headerCode); + .eq(StatusFlowDetail::getHeaderCode, headerCode) + .eq(StatusFlowDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); return this.list(lambdaQueryWrapper); } } diff --git a/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java b/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java index 4c5fbad..6d84c76 100644 --- a/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java +++ b/src/main/java/com/huaheng/pc/config/statusFlow/service/StatusFlowHeaderService.java @@ -2,19 +2,27 @@ package com.huaheng.pc.config.statusFlow.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; -import org.springframework.aop.aspectj.AspectJPrecedenceInformation; +import com.huaheng.pc.config.statusFlow.mapper.StatusFlowDetailMapper; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.config.statusFlow.domain.StatusFlowHeader; import com.huaheng.pc.config.statusFlow.mapper.StatusFlowHeaderMapper; +import javax.annotation.Resource; import java.util.List; import java.util.Map; @Service("StatusFlow") public class StatusFlowHeaderService extends ServiceImpl<StatusFlowHeaderMapper, StatusFlowHeader> { + @Resource + private StatusFlowHeaderMapper statusFlowHeaderMapper; + @Resource + private StatusFlowDetailMapper statusFlowDetailMapper; + + public List<Map<String, Object>> flowList(String recordType){ LambdaQueryWrapper<StatusFlowHeader> lambda = Wrappers.lambdaQuery(); lambda.select(StatusFlowHeader::getCode, StatusFlowHeader::getName) @@ -30,4 +38,28 @@ public class StatusFlowHeaderService extends ServiceImpl<StatusFlowHeaderMapper, .eq(StatusFlowHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); return this.list(lambda); } + + + //复制流程 + public Boolean statusFlowCopy(String code,String newCode){ + int i = 0; + //复制流程主表 + i = statusFlowHeaderMapper.statusFlowHeaderCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //复制流程明细 + i = statusFlowDetailMapper.statusFlowDetailCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //修改流程明细headerId + i = statusFlowDetailMapper.updateHeaderId(newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + return true; + } } diff --git a/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java b/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java index a206a49..8fbe3b7 100644 --- a/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java +++ b/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java @@ -158,4 +158,24 @@ public class WareHouseController extends BaseController { } return AjaxResult.success("删除成功!"); } + + /** + * 修改保存仓库 + */ + @RequiresPermissions("config:warehouse:copy") + @Log(title = "通用-仓库管理", operating = "复制仓库", action = BusinessType.INSERT) + @GetMapping("/copy") + public String copy(String newWarehouseCode) { + return prefix+"/copy"; + } + /** + * 修改保存仓库 + */ + @RequiresPermissions("config:warehouse:copy") + @Log(title = "通用-仓库管理", operating = "复制仓库", action = BusinessType.INSERT) + @PostMapping("/copySave") + @ResponseBody + public AjaxResult copySave(String newWarehouseCode) { + return toAjax(warehouseService.warehouseCopy(ShiroUtils.getWarehouseCode(), newWarehouseCode)); + } } diff --git a/src/main/java/com/huaheng/pc/config/warehouse/mapper/WarehouseMapper.java b/src/main/java/com/huaheng/pc/config/warehouse/mapper/WarehouseMapper.java index bc9c6be..0ac4e66 100644 --- a/src/main/java/com/huaheng/pc/config/warehouse/mapper/WarehouseMapper.java +++ b/src/main/java/com/huaheng/pc/config/warehouse/mapper/WarehouseMapper.java @@ -3,6 +3,7 @@ package com.huaheng.pc.config.warehouse.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.warehouse.domain.Warehouse; import com.huaheng.pc.system.user.domain.SysUserWarehouse; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -13,4 +14,9 @@ public interface WarehouseMapper extends BaseMapper<Warehouse> { public List<Warehouse> selectWarehouseByUserId(Integer userId); public List<Warehouse> selectWarehouseAll(); + + int companyCopy(@Param("warehouseCode") String warehouseCode, @Param("newWarehouseCode")String newWarehouseCode); + + List<Warehouse> selectListEntityByEqual(Warehouse condition); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseService.java b/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseService.java index 458094f..68905b5 100644 --- a/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseService.java +++ b/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseService.java @@ -10,8 +10,17 @@ public interface WarehouseService extends IService<Warehouse>{ List<Map<String,Object>> getWarehouseList(Integer id); - public List<Warehouse> selectWarehouseByUserId(Integer userId); + List<Warehouse> selectWarehouseByUserId(Integer userId); + /** + * 复制仓库 + * @param warehouseCode 仓库编码 + * @param newWarehouseCode 新仓库编码 + */ + Boolean warehouseCopy(String warehouseCode, String newWarehouseCode); + + + List<Warehouse> selectListEntityByEqual(Warehouse condition); } diff --git a/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseServiceImpl.java b/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseServiceImpl.java index 4f284db..1d2d1b9 100644 --- a/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseServiceImpl.java +++ b/src/main/java/com/huaheng/pc/config/warehouse/service/WarehouseServiceImpl.java @@ -3,11 +3,29 @@ package com.huaheng.pc.config.warehouse.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.pc.config.FilterConfigHeader.service.FilterConfigHeaderService; +import com.huaheng.pc.config.address.service.AddressService; +import com.huaheng.pc.config.configValue.service.ConfigValueService; +import com.huaheng.pc.config.containerType.service.ContainerTypeService; +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; +import com.huaheng.pc.config.locationType.service.LocationTypeService; +import com.huaheng.pc.config.receiptPreference.service.ReceiptPreferenceService; +import com.huaheng.pc.config.receiptType.service.ReceiptTypeService; +import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; +import com.huaheng.pc.config.shipmentType.service.ShipmentTypeService; +import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService; import com.huaheng.pc.config.warehouse.domain.Warehouse; import com.huaheng.pc.config.warehouse.mapper.WarehouseMapper; import com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany; import com.huaheng.pc.config.warehouseCompany.service.WarehouseCompanyService; +import com.huaheng.pc.config.waveMaster.service.WaveMasterService; +import com.huaheng.pc.system.dict.service.IDictTypeService; +import com.huaheng.pc.system.menu.service.IMenuService; +import com.huaheng.pc.system.role.service.IRoleService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; @@ -17,9 +35,39 @@ import java.util.Map; public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService { @Resource + private AddressService addressService; + @Resource + private ConfigValueService configValueService; + @Resource + private ContainerTypeService containerTypeService; + @Resource + private CycleCountPreferenceService cycleCountPreferenceService; + @Resource + private LocationTypeService locationTypeService; + @Resource + private ReceiptPreferenceService receiptPreferenceService; + @Resource + private ReceiptTypeService receiptTypeService; + @Resource + private ShipmentPreferenceService shipmentPreferenceService; + @Resource + private ShipmentTypeService shipmentTypeService; + @Resource private WarehouseMapper warehouseMapper; @Resource private WarehouseCompanyService warehouseCompanyService; + @Autowired + private IRoleService roleService; + @Autowired + private IDictTypeService dictTypeService; + @Autowired + private IMenuService menuService; + @Autowired + private FilterConfigHeaderService filterConfigHeaderService; + @Autowired + private StatusFlowHeaderService statusFlowHeaderService; + @Autowired + private WaveMasterService waveMasterService; @Override public List<Map<String, Object>> getWarehouseList(Integer id) { @@ -31,7 +79,7 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse List<Map<String, Object>> warehouseList = warehouseMapper.selectMaps(lambdaQueryWrapper); LambdaQueryWrapper<WarehouseCompany> lambdaQueryWrapper1 = Wrappers.lambdaQuery(); - lambdaQueryWrapper1.select(WarehouseCompany::getCompanyCode) + lambdaQueryWrapper1.select(WarehouseCompany::getCompanyCode, WarehouseCompany::getWarehouseCode) .eq(WarehouseCompany::getCompanyId,id); List<Map<String, Object>> warehouseCompanies = warehouseCompanyService.listMaps(lambdaQueryWrapper1); @@ -67,4 +115,83 @@ public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse return warehouses; } + /** + * 复制仓库 + * @param warehouseCode 仓库编码 + * @param newWarehouseCode 新仓库编码 + */ + @Override + @Transactional + public Boolean warehouseCopy(String warehouseCode, String newWarehouseCode) { + /* 复制地址表*/ + if (!addressService.addressCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制地址表失败"); + } + /* 复制系统参数配置表*/ + if (!configValueService.configValueCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制系统参数配置表失败"); + } + /* 复制容器类型表*/ + if (!containerTypeService.containerTypeCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制容器类型表失败"); + } + /* 复制库位类型表*/ + if (!locationTypeService.locationTypeCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制库位类型表失败"); + } + /* 复制盘点首选项表*/ + if (!cycleCountPreferenceService.cycleCountPreferenceCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制盘点首选项表失败"); + } + /* 复制入库首选项*/ + if (!receiptPreferenceService.receiptPreferenceCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制入库首选项表失败"); + } + /* 复制出库首选项*/ + if (!shipmentPreferenceService.shipmentPreferenceCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制出库首选项表失败"); + } + /* 复制入库类型*/ + if (!receiptTypeService.receiptTypeCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制入库类型表失败"); + } + /* 复制出库类型*/ + if (!shipmentTypeService.ShipmentTypeCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制出库类型表失败"); + } + /* 复制仓库货主关系*/ + if (warehouseMapper.companyCopy(warehouseCode, newWarehouseCode) < 1){ + throw new ServiceException("复制仓库货主关系表失败"); + } + /* 复制角色*/ + if (!roleService.roleCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制角色表失败"); + } + /* 复制字典数据*/ + if (!dictTypeService.dictTypeCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制字典数据表失败"); + } + /* 复制菜单*/ + if (!menuService.menuCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制菜单表失败"); + } + /* 复制流程*/ + if (!statusFlowHeaderService.statusFlowCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制流程表失败"); + } + /* 复制规则配置*/ + if (!filterConfigHeaderService.filterConfigCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制规则配置表失败"); + } + /* 复制波次配置*/ + if (!waveMasterService.waveMasterCopy(warehouseCode, newWarehouseCode)){ + throw new ServiceException("复制波次配置表失败"); + } + return true; + } + + @Override + public List<Warehouse> selectListEntityByEqual(Warehouse condition) { + return warehouseMapper.selectListEntityByEqual(condition); + } } diff --git a/src/main/java/com/huaheng/pc/config/waveFlowDetail/controller/WaveFlowDetailController.java b/src/main/java/com/huaheng/pc/config/waveFlowDetail/controller/WaveFlowDetailController.java index 62765fd..8f57b76 100644 --- a/src/main/java/com/huaheng/pc/config/waveFlowDetail/controller/WaveFlowDetailController.java +++ b/src/main/java/com/huaheng/pc/config/waveFlowDetail/controller/WaveFlowDetailController.java @@ -50,9 +50,9 @@ public class WaveFlowDetailController extends BaseController { @RequiresPermissions("config:waveFlowDetail:view") - @GetMapping("/list/{id}") - public String waveFlowDetail(@PathVariable("id")Integer id, ModelMap mmap) { - mmap.put("headerId",id); + @GetMapping("/list/{headerId}") + public String waveFlowDetail(@PathVariable("id")Integer headerId, ModelMap mmap) { + mmap.put("headerId",headerId); return prefix + "/waveFlowDetail"; } diff --git a/src/main/java/com/huaheng/pc/config/waveFlowDetail/mapper/WaveFlowDetailMapper.java b/src/main/java/com/huaheng/pc/config/waveFlowDetail/mapper/WaveFlowDetailMapper.java index 9a28317..3edcf7c 100644 --- a/src/main/java/com/huaheng/pc/config/waveFlowDetail/mapper/WaveFlowDetailMapper.java +++ b/src/main/java/com/huaheng/pc/config/waveFlowDetail/mapper/WaveFlowDetailMapper.java @@ -2,6 +2,13 @@ package com.huaheng.pc.config.waveFlowDetail.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.waveFlowDetail.domain.WaveFlowDetail; +import org.apache.ibatis.annotations.Param; public interface WaveFlowDetailMapper extends BaseMapper<WaveFlowDetail> { + + //复制波次流程明细 + int waveFlowDetailCopy(@Param("code") String code, @Param("newCode") String newCode); + + //修改波次流程明细headerId + int updateHeaderId(@Param("code") String code); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/waveFlowHeader/mapper/WaveFlowHeaderMapper.java b/src/main/java/com/huaheng/pc/config/waveFlowHeader/mapper/WaveFlowHeaderMapper.java index cbeecec..455a483 100644 --- a/src/main/java/com/huaheng/pc/config/waveFlowHeader/mapper/WaveFlowHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/config/waveFlowHeader/mapper/WaveFlowHeaderMapper.java @@ -2,6 +2,11 @@ package com.huaheng.pc.config.waveFlowHeader.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.waveFlowHeader.domain.WaveFlowHeader; +import org.apache.ibatis.annotations.Param; public interface WaveFlowHeaderMapper extends BaseMapper<WaveFlowHeader> { + + //复制波次流程主表 + int waveFlowHeaderCopy(@Param("code") String code, @Param("newCode") String newCode); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/waveMaster/mapper/WaveMasterMapper.java b/src/main/java/com/huaheng/pc/config/waveMaster/mapper/WaveMasterMapper.java index d789f23..5250f63 100644 --- a/src/main/java/com/huaheng/pc/config/waveMaster/mapper/WaveMasterMapper.java +++ b/src/main/java/com/huaheng/pc/config/waveMaster/mapper/WaveMasterMapper.java @@ -2,6 +2,10 @@ package com.huaheng.pc.config.waveMaster.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.config.waveMaster.domain.WaveMaster; +import org.apache.ibatis.annotations.Param; public interface WaveMasterMapper extends BaseMapper<WaveMaster> { + + //复制波次配置 + int waveMasterCopy(@Param("code") String code, @Param("newCode") String newCode); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/config/waveMaster/service/WaveMasterService.java b/src/main/java/com/huaheng/pc/config/waveMaster/service/WaveMasterService.java index ee2ad9b..6a38c5e 100644 --- a/src/main/java/com/huaheng/pc/config/waveMaster/service/WaveMasterService.java +++ b/src/main/java/com/huaheng/pc/config/waveMaster/service/WaveMasterService.java @@ -1,11 +1,56 @@ package com.huaheng.pc.config.waveMaster.service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.exception.service.ServiceException; +import com.huaheng.pc.config.waveFlowDetail.domain.WaveFlowDetail; +import com.huaheng.pc.config.waveFlowDetail.mapper.WaveFlowDetailMapper; +import com.huaheng.pc.config.waveFlowHeader.domain.WaveFlowHeader; +import com.huaheng.pc.config.waveFlowHeader.mapper.WaveFlowHeaderMapper; import com.huaheng.pc.config.waveMaster.domain.WaveMaster; import com.huaheng.pc.config.waveMaster.mapper.WaveMasterMapper; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + @Service public class WaveMasterService extends ServiceImpl<WaveMasterMapper, WaveMaster> { + @Resource + private WaveMasterMapper waveMasterMapper; + @Resource + private WaveFlowHeaderMapper waveFlowHeaderMapper; + @Resource + private WaveFlowDetailMapper waveFlowDetailMapper; + + + + //复制波次配置 + public Boolean waveMasterCopy(String code,String newCode){ + int i = 0; + //复制波次配置 + i = waveMasterMapper.waveMasterCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //复制波次流程主表 + i = waveFlowHeaderMapper.waveFlowHeaderCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //复制波次流程明细 + i = waveFlowDetailMapper.waveFlowDetailCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + + //修改波次流程明细headerId + i = waveFlowDetailMapper.updateHeaderId(newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + return true; + } + } diff --git a/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java b/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java index b5c33b9..aed5c23 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustDetail/controller/adjustDetailController.java @@ -38,8 +38,6 @@ public class adjustDetailController extends BaseController { @Resource - private AdjustHeaderService adjustHeaderService; - @Resource private AdjustHeaderMapper adjustHeaderMapper; @Resource private AdjustDetailService adjustDetailService; @@ -49,7 +47,7 @@ public class adjustDetailController extends BaseController { private String prefix = "inventory/adjustDetail"; - //@RequiresPermissions("inventory:cycleCount:view") + @RequiresPermissions("inventory:adjustDetail:view") @GetMapping() public String adjustHeader() { @@ -60,7 +58,7 @@ public class adjustDetailController extends BaseController { /** * 查询调整单主列表 */ - //@RequiresPermissions("inventory:cycleCount:list") + @RequiresPermissions("inventory:adjustDetail:list") @PostMapping("/list") @Log(title = "库存-调整",operating = "查看调整明细单", action = BusinessType.GRANT) @ResponseBody @@ -121,7 +119,7 @@ public class adjustDetailController extends BaseController { /** * 保存新增调整明细 */ - //@RequiresPermissions("inventory:cyclecountDetail:add") + @RequiresPermissions("inventory:adjustDetail:add") @Log(title = "库存-盘点", operating = "新增盘点补货明细", action = BusinessType.INSERT) @PostMapping("/addAdjust") @ResponseBody @@ -150,7 +148,7 @@ public class adjustDetailController extends BaseController { * 调整数量,调整库存状态 * 调整插入库存 */ - //@RequiresPermissions("inventory:cyclecountAdjustDetail:addAdjust") + @RequiresPermissions("inventory:adjustDetail:addAdjust") @Log(title = "库存-调整单", operating = "调整单调整库存差异,调整数量", action = BusinessType.UPDATE) @PostMapping("/adjustEdit") @ResponseBody @@ -167,6 +165,10 @@ public class adjustDetailController extends BaseController { if(StringUtils.isEmpty(adjustDetailEdit.getAgreeBy()) || adjustDetailEdit.getStatus() < 1 ){ return AjaxResult.error("单据未审批不允许调整"); } + //不能重复调整 + if(adjustDetailEdit.getStatus() >= 3){ + return AjaxResult.error("不能重复调整!"); + } adjustDetailService.updateAdjustDetail(adjustDetailEdit); } return AjaxResult.success("调整下发成功!"); @@ -177,6 +179,7 @@ public class adjustDetailController extends BaseController { * @param ids * @return */ + @RequiresPermissions("inventory:adjustDetail:adjustAgree") @Log(title = "库存-调整单", operating = "调整审批", action = BusinessType.OTHER) @PostMapping("/adjustAgree") @ResponseBody @@ -199,7 +202,7 @@ public class adjustDetailController extends BaseController { /** * 删除调整单明细 */ - //@RequiresPermissions("inventory:cyclecountDetail:remove") + @RequiresPermissions("inventory:adjustDetail:remove") @Log(title = "库存-调整", operating = "删除调整单明细", action = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody @@ -212,7 +215,6 @@ public class adjustDetailController extends BaseController { return AjaxResult.error("单据状态不允许删除"); } adjustDetailService.removeById(id); - return AjaxResult.success("删除成功!"); } diff --git a/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java index efefe05..0ea378d 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustDetail/service/AdjustDetailServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.inventory.adjustDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -45,6 +46,8 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj @Resource private CycleCountDetailService cycleCountDetailService; @Resource + private AdjustHeaderService adjustHeaderService; + @Resource private MaterialService materialService; @Resource private CheckDetailService checkDetailService; @@ -72,10 +75,14 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj @Transactional @Override public AjaxResult addDetails(AdjustDetail adjustDetail) { - //数据直接插入表里 - //查询主单据 - + //查询主单据 + AdjustHeader adjustHeader = new AdjustHeader(); + adjustHeader.setCode(adjustDetail.getAdjustCode()); + adjustHeader.setWarehouseCode(adjustDetail.getWarehouseCode()); + adjustHeader.setCompanyCode(adjustDetail.getCompanyCode()); + LambdaQueryWrapper<AdjustHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(adjustHeader); + adjustHeader = adjustHeaderService.getOne(lambdaQueryWrapper); //检查库存 if((adjustDetail.getInventoryDetailId()) != null){ InventoryDetail inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); @@ -83,6 +90,11 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj return AjaxResult.error("没有该条库存明细"); } } + //明细单据的上层单编码需要和主单一直,主单空值则不判断 + if(StringUtils.isNotEmpty(adjustHeader.getCycleCountCode()) || StringUtils.isNotEmpty(adjustHeader.getCheckCode())){ + adjustDetail.setCycleCountCode(adjustHeader.getCycleCountCode()); + adjustDetail.setCheckCode(adjustHeader.getCheckCode()); + } //检查盘点单 if(StringUtils.isNotEmpty(adjustDetail.getCycleCountCode())){ CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(adjustDetail.getCheckDetailId()); @@ -103,17 +115,16 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj if(!material.getName().equals(adjustDetail.getMaterialName())){ return AjaxResult.error("物料名称错误!"); } - }else{ return AjaxResult.error("物料编码错误!"); } + adjustDetail.setProblemType(adjustHeader.getProblemType());//调整类型 adjustDetail.setMaterialUnit(material.getUnit()); adjustDetail.setMaterialSpec(material.getSpec()); adjustDetail.setCreated(new Date()); adjustDetail.setCreatedBy(ShiroUtils.getLoginName()); adjustDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); adjustDetail.setLastUpdated(new Date()); - this.saveOrUpdate(adjustDetail); return AjaxResult.success("新增调整明细成功!"); @@ -157,7 +168,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj AjaxResult.error("该单据已调整,不允许再次调整!" ); } //查询调整的库存明细 - InventoryDetail inventoryDetail = new InventoryDetail(); + InventoryDetail inventoryDetail; //调整单中不带库存明细时不查询 if(adjustDetail.getInventoryDetailId() != null) { inventoryDetail = inventoryDetailService.getById(adjustDetail.getInventoryDetailId()); @@ -166,23 +177,16 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj return AjaxResult.error("调整单和所调整库存的库位容器不符,前检查数据"); } //验证该条库存是不是正在使用,验证库存明细 - /*Location location = new Location(); + Location location = new Location(); location.setCode(inventoryDetail.getLocationCode()); location.setWarehouseCode(inventoryDetail.getWarehouseCode()); LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(location); location = locationService.getOne(lambdaQueryWrapper); if (!location.getStatus().equals("empty")) { return AjaxResult.error (inventoryDetail.getId() + "库存非空闲,请等待其他任务完成再进行调整!"); - }*/ - - //判断调整哪一个属性值 - /*以下方法有待验证讨论,BigDecimal传入null,如何避免传入0?*/ - - //把BigDecimal类型转换成String再判断null - - String toQtyString = adjustDetail.getToQty().toString(); //调整后库存 - String gapQtyString = adjustDetail.getGapQty().toString(); //调整变动数量 - if (StringUtils.isNotEmpty(toQtyString) || StringUtils.isNotEmpty(gapQtyString)) { + } + //判断调整库存状态还是数量 + if (adjustDetail.getToQty() != null || adjustDetail.getGapQty() != null) { //调整数量 updateAdjustDetailNumber(adjustDetail, inventoryDetail); } @@ -240,24 +244,25 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj inventoryDetail.setQty(adjustDetail.getToQty());//调整后的数量 inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); inventoryDetail.setLastUpdated(new Date()); - inventoryDetailService.saveOrUpdate(inventoryDetail); - - } + Boolean j = inventoryDetailService.saveOrUpdate(inventoryDetail); + if(j == false){ + throw new SecurityException("调整修改库存失败!"); + } } //写入库存交易记录 InventoryTransaction inventoryTransaction = new InventoryTransaction(); inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); - inventoryTransaction.setTransactionType(40); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTOUT ); inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); inventoryTransaction.setTaskQty(adjustDetail.getGapQty()); inventoryTransaction.setInventorySts(inventoryDetail.getInventorySts()); - inventoryTransaction.setReferCode(inventoryDetail.getReferCode()); - inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId()); + inventoryTransaction.setReferCode(adjustDetail.getAdjustCode()); + inventoryTransaction.setReferDetailId(adjustDetail.getId().toString()); inventoryTransaction.setBatch(inventoryDetail.getBatch()); inventoryTransaction.setLot(inventoryDetail.getLot()); inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo()); @@ -281,8 +286,10 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj // inventoryTransaction.setBillCode(); inventoryTransaction.setBillDetailId(inventoryDetail.getReceiptDetailId()); inventoryTransaction.setSupplierCode(inventoryDetail.getSupplierCode()); - inventoryTransactionService.saveOrUpdate(inventoryTransaction); - + Boolean k = inventoryTransactionService.saveOrUpdate(inventoryTransaction); + if(k == false){ + throw new SecurityException("调整单库存交易生成失败!"); + } } /** @@ -295,26 +302,27 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj //修改库存的状态 inventoryDetail.setInventorySts(adjustDetail.getToInventorySts());//修改为调整库存 + inventoryDetail.setExpirationDate(adjustDetail.getExpirationDate()); inventoryDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); inventoryDetail.setLastUpdated(new Date()); inventoryDetailService.saveOrUpdate(inventoryDetail); - //写入库存交易,库存交易2条一条出,一条入 + //写入库存交易,2条一条出,一条入 //调整出 InventoryTransaction inventoryTransaction = new InventoryTransaction(); inventoryTransaction.setWarehouseCode(inventoryDetail.getWarehouseCode()); inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); - inventoryTransaction.setTransactionType(40); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTOUT ); inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); inventoryTransaction.setMaterialUnit(inventoryDetail.getMaterialUnit()); inventoryTransaction.setTaskQty(BigDecimal.ZERO);//数量不变 inventoryTransaction.setInventorySts(adjustDetail.getFromInventorySts());//状态 - inventoryTransaction.setReferCode(inventoryDetail.getReferCode()); - inventoryTransaction.setReferDetailId(inventoryDetail.getReferDetailId()); + inventoryTransaction.setReferCode(adjustDetail.getAdjustCode()); + inventoryTransaction.setReferDetailId(adjustDetail.getId().toString()); inventoryTransaction.setBatch(inventoryDetail.getBatch()); inventoryTransaction.setLot(inventoryDetail.getLot()); inventoryTransaction.setProjectNo(inventoryDetail.getProjectNo()); @@ -339,15 +347,15 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj inventoryTransaction2.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction2.setLocationCode(inventoryDetail.getLocationCode()); inventoryTransaction2.setContainerCode(inventoryDetail.getContainerCode()); - inventoryTransaction2.setTransactionType(30); + inventoryTransaction2.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTINTO); inventoryTransaction2.setMaterialCode(inventoryDetail.getMaterialCode()); inventoryTransaction2.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction2.setMaterialSpec(inventoryDetail.getMaterialSpec()); inventoryTransaction2.setMaterialUnit(inventoryDetail.getMaterialUnit()); inventoryTransaction2.setTaskQty(BigDecimal.ZERO);//数量不变 inventoryTransaction2.setInventorySts(inventoryDetail.getInventorySts());//状态 - inventoryTransaction2.setReferCode(inventoryDetail.getReferCode()); - inventoryTransaction2.setReferDetailId(inventoryDetail.getReferDetailId()); + inventoryTransaction.setReferCode(adjustDetail.getAdjustCode()); + inventoryTransaction.setReferDetailId(adjustDetail.getId().toString()); inventoryTransaction2.setBatch(inventoryDetail.getBatch()); inventoryTransaction2.setLot(inventoryDetail.getLot()); inventoryTransaction2.setProjectNo(inventoryDetail.getProjectNo()); @@ -448,7 +456,7 @@ public class AdjustDetailServiceImpl extends ServiceImpl<AdjustDetailMapper, Adj inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); - inventoryTransaction.setTransactionType(30); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTINTO); inventoryTransaction.setMaterialCode(inventoryDetail.getMaterialCode()); inventoryTransaction.setMaterialName(inventoryDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(inventoryDetail.getMaterialSpec()); diff --git a/src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java b/src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java index e22e29b..b8fe927 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustHeader/controller/adjustHeaderController.java @@ -44,7 +44,7 @@ public class adjustHeaderController extends BaseController { private String prefix = "inventory/adjustHeader"; - //@RequiresPermissions("inventory:cycleCount:view") + @RequiresPermissions("inventory:adjustHeader:view") @GetMapping() public String adjustHeader() { @@ -55,7 +55,7 @@ public class adjustHeaderController extends BaseController { /** * 查询调整单主列表 */ - //@RequiresPermissions("inventory:cycleCount:list") + @RequiresPermissions("inventory:adjustHeader:list") @PostMapping("/list") @Log(title = "库存-调整",operating = "查看调整主单", action = BusinessType.GRANT) @ResponseBody @@ -101,7 +101,7 @@ public class adjustHeaderController extends BaseController { /** * 新增保存调整单主 */ - //@RequiresPermissions("inventory:cycleCount:add") + @RequiresPermissions("inventory:adjustHeader:add") @Log(title = "库存-调整",operating = "新增调整主单", action = BusinessType.INSERT) @PostMapping("/addsave") @ResponseBody @@ -114,7 +114,7 @@ public class adjustHeaderController extends BaseController { /** * 删除调整单主 */ - //@RequiresPermissions("inventory:cycleCount:remove") + @RequiresPermissions("inventory:adjustHeader:remove") @Log(title = "库存-调整",operating = "删除调整主单", action = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody @@ -124,7 +124,7 @@ public class adjustHeaderController extends BaseController { return AjaxResult.error("id不能为空"); for (Integer id : Convert.toIntArray(ids)) { - AjaxResult result = adjustHeaderService.delete(id); + AjaxResult result = adjustHeaderService.deleteHeader(id); if(result.code!=200){ return result; } @@ -136,7 +136,7 @@ public class adjustHeaderController extends BaseController { * 调整单打印 * @return */ - //@RequiresPermissions("inventory:cyclecountAdjust:report") + @RequiresPermissions("inventory:adjustHeader:report") @GetMapping("/report/{id}") public String report(@PathVariable("id") Integer id, ModelMap mmap) { diff --git a/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderService.java b/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderService.java index 4c4635c..3b2e13e 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderService.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderService.java @@ -11,7 +11,7 @@ public interface AdjustHeaderService extends IService<AdjustHeader> { String createCode(); - AjaxResult delete(Integer id); + AjaxResult deleteHeader(Integer id); AjaxResult addSave(AdjustHeader adjustHeader); diff --git a/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java index 9e1a1b6..2ecae01 100644 --- a/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/adjustHeader/service/AdjustHeaderServiceImpl.java @@ -1,9 +1,13 @@ package com.huaheng.pc.inventory.adjustHeader.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.warehouse.domain.Warehouse; import com.huaheng.pc.inventory.adjustDetail.domain.AdjustDetail; +import com.huaheng.pc.inventory.adjustDetail.service.AdjustDetailService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.inventory.adjustHeader.domain.AdjustHeader; @@ -13,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.List; @Service public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, AdjustHeader> implements AdjustHeaderService { @@ -20,7 +25,8 @@ public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, Adj @Resource private AdjustHeaderMapper adjustHeaderMapper; - + @Resource + private AdjustDetailService adjustDetailService; @@ -48,22 +54,29 @@ public class AdjustHeaderServiceImpl extends ServiceImpl<AdjustHeaderMapper, Adj } /** - * 删除 - * 空缺 + * 调整主单删除 * @param id * @return */ + @Transactional @Override - public AjaxResult delete(Integer id) { + public AjaxResult deleteHeader(Integer id) { AdjustHeader adjustHeader = this.getById(id); if(adjustHeader == null){ return AjaxResult.error("id为"+id.toString()+"的调整单不存在出,操作中止"); } - - //批量删除子单据 + //判断该主单下有没又存在子单,没有直接删除主单,有则不能删除 AdjustDetail temp = new AdjustDetail(); temp.setAdjustCode(adjustHeader.getCode()); + temp.setCompanyCode(adjustHeader.getCompanyCode()); + temp.setWarehouseCode(adjustHeader.getWarehouseCode()); + LambdaQueryWrapper<AdjustDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(temp); + List<AdjustDetail> adjustDetails = adjustDetailService.list(lambdaQueryWrapper); + if(adjustDetails.size() > 0){ + throw new SecurityException("该主单存在明细,无法删除,操作失败!"); + } + adjustHeaderMapper.deleteById(id); //直接删主单 return AjaxResult.success("删除成功"); } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java index a8fce46..7050705 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java @@ -109,10 +109,14 @@ public class CycleCountDetailController extends BaseController { //分页查询 Page<CycleCountDetail> page = new Page<>(pageNum, pageSize); IPage<CycleCountDetail> iPage = cycleCountDetailService.page(page, lambdaQueryWrapper); - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + //根据盘点首选项确定显示字段 + List<CycleCountDetail> ipages = cycleCountDetailService.preferenceRealize(iPage.getRecords()) ; + return getMpDataTable(ipages, iPage.getTotal()); } else { List<CycleCountDetail> list = cycleCountDetailService.list(lambdaQueryWrapper); - return getDataTable(list); + //根据盘点首选项确定显示字段 + List<CycleCountDetail> cycleCountDetails = cycleCountDetailService.preferenceRealize(list) ; + return getDataTable(cycleCountDetails); } } //空List @@ -148,9 +152,12 @@ public class CycleCountDetailController extends BaseController { @Log(title = "库存-盘点", operating = "新增盘点补货明细", action = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(String cycleCountHeadCode, Integer[] inventoryDetailIdIds) + public AjaxResult addSave(String cycleCountHeadCode, Integer[] inventoryDetailIds) { - return cycleCountDetailService.addDetails(cycleCountHeadCode,inventoryDetailIdIds); + if(inventoryDetailIds == null){ + return AjaxResult.error("盘点的库存ID不能为空!"); + } + return cycleCountDetailService.addDetails(cycleCountHeadCode,inventoryDetailIds); } /** @@ -226,6 +233,7 @@ public class CycleCountDetailController extends BaseController { @PostMapping("/confirmGapQty") @ResponseBody public AjaxResult confirmGapQty(Integer detailId, BigDecimal qty){ + return cycleCountDetailService.confirmGapQty(detailId,qty); } @@ -238,7 +246,9 @@ public class CycleCountDetailController extends BaseController { @PostMapping("/createCyclecountWithGapQty") @ResponseBody public AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode){ - + if(StringUtils.isEmpty(cycleCountHeadCode)){ + return AjaxResult.error("需要复盘的盘点单编码不能为空!"); + } return cycleCountDetailService.createCyclecountWithGapQty(cycleCountHeadCode); } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/domain/CycleCountDetail.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/domain/CycleCountDetail.java index f3cdad0..2990643 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/domain/CycleCountDetail.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/domain/CycleCountDetail.java @@ -287,6 +287,12 @@ public class CycleCountDetail implements Serializable { @ApiModelProperty(value = "盘点主单号") private String cycleCountHeadCode; + /** + *盘点首选项编码 + */ + @TableField(value = "preferenceCode") + @ApiModelProperty(value = "盘点首选项编码") + private String preferenceCode; @@ -587,6 +593,14 @@ public class CycleCountDetail implements Serializable { this.gapQty = gapQty; } + public String getPreferenceCode() { + return preferenceCode; + } + + public void setPreferenceCode(String preferenceCode) { + this.preferenceCode = preferenceCode; + } + /** * 获取失败原因 * diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java index b2df118..8087e81 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailService.java @@ -3,8 +3,10 @@ package com.huaheng.pc.inventory.cycleCountDetail.service; import com.baomidou.mybatisplus.extension.service.IService; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; +import org.apache.poi.ss.formula.functions.T; import java.math.BigDecimal; +import java.util.List; public interface CycleCountDetailService extends IService<CycleCountDetail> { @@ -14,7 +16,7 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { AjaxResult createCycleCountTaskByHeadId(String cycleCountHeadCode); - AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId); + AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutDetailId); AjaxResult confirmGapQty(Integer detailId, BigDecimal qty); @@ -22,7 +24,7 @@ public interface CycleCountDetailService extends IService<CycleCountDetail> { AjaxResult createCyclecountWithGapQty(String cycleCountHeadCode); - + List<CycleCountDetail> preferenceRealize (List<CycleCountDetail> cycleCoutDetailList); } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java index d3b5d7c..bfbed10 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java @@ -3,10 +3,15 @@ package com.huaheng.pc.inventory.cycleCountDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.configValue.domain.ConfigValue; +import com.huaheng.pc.config.configValue.service.ConfigValueService; +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; import com.huaheng.pc.config.location.domain.Location; import com.huaheng.pc.config.location.service.LocationService; import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; @@ -43,13 +48,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap private TaskHeaderService taskHeaderService; @Resource private TaskDetailService taskDetailService; - - - - - - - + @Resource + private ConfigValueService configValueService; + @Resource + private CycleCountPreferenceService cycleCountPreferenceService; /** @@ -74,7 +76,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode()); LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper); - if(cycleCountHeader.getStatusCyc() < 10 ){ + if(cycleCountHeader.getStatusCyc() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){ //主单状态小于10则修改 cycleCountHeader.setStatusCyc(status); //主单状态 cycleCountHeaderService.saveOrUpdate(cycleCountHeader); @@ -102,9 +104,19 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap if(cyclecountHeader==null){ return AjaxResult.error("盘点主单据不存在"); } - if(cyclecountHeader.getStatusCyc() > 1){ + if(cyclecountHeader.getStatusCyc() > QuantityConstant.CYCLECOUNT_STATUS_BUILD){ return AjaxResult.error("盘点单非新建状态,无法再添加明细"); } + //默认盘点配置,首选项 + ConfigValue configValue = new ConfigValue(); + configValue.setModuleType("cyclecount"); + configValue.setWarehouseCode(ShiroUtils.getWarehouseCode()); + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValue); + configValue = configValueService.getOne(configValueLambdaQueryWrapper); + if(configValue == null){ + throw new SecurityException("请先在配置中添加盘点配置"); + } + String preferenceCode = configValue.getIdentifier(); //获取已经存在的明细 CycleCountDetail cycleCountDetail = new CycleCountDetail(); cycleCountDetail.setWarehouseCode(cyclecountHeader.getWarehouseCode()); @@ -122,16 +134,16 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap } //查询该条库存明细 InventoryDetail inventoryDetail = inventoryDetailService.getById(inventoryDetailId); - //写入盘点明细 CycleCountDetail ccd = new CycleCountDetail(); + ccd.setPreferenceCode(preferenceCode); ccd.setCycleCountHeadCode(cyclecountHeader.getCode()); ccd.setInventoryDetailId(inventoryDetailId); ccd.setWarehouseCode(inventoryDetail.getWarehouseCode()); ccd.setCompanyCode(inventoryDetail.getCompanyCode()); ccd.setInventorySts(inventoryDetail.getInventorySts()); ccd.setCountId(inventoryDetail.getId()); - ccd.setEnableStatus(5); + //ccd.setEnableStatus(1); ccd.setLocationCode(inventoryDetail.getLocationCode()); ccd.setContainerCode(inventoryDetail.getContainerCode()); ccd.setMaterialCode(inventoryDetail.getMaterialCode()); @@ -184,7 +196,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap int count = 0; int countErr = 0; for(CycleCountDetail item:list){ - if(item.getEnableStatus() < 5 && item.getTaskHeaderId() == null){ + if(item.getEnableStatus() < QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK && item.getTaskHeaderId() == null){ AjaxResult result = this.createCycleCoutTaskByDetailId(item.getId()); if(result.getCode()==200){ count++; @@ -193,7 +205,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap } } } - String msg = ""; + String msg = null; if(count==list.size()){ msg="全部生成成功"; } else if (count <= 0 && countErr <= 0){ @@ -206,17 +218,17 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap /** * 生成单条盘点任务 - * @param cycleCoutdetailId + * @param cycleCoutDetailId * @return */ @Override @Transactional - public AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId) { + public AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutDetailId) { /*任务主表中存在库位,在盘点明细中生成任务时,不同的容器生成不同的主任务*/ //在盘点单生成任务并执行后,同一容器的物料仍然可以生成任务,否则任务已完成则无法添加任务100 //检查状态不为100的任务,在有和下发的盘点单容器相同的任务时,把该条明细的任务写入到当前相同容器的任务里 - CycleCountDetail cycleCountDetail = this.getById(cycleCoutdetailId); + CycleCountDetail cycleCountDetail = this.getById(cycleCoutDetailId); if(cycleCountDetail == null ){ return AjaxResult.error("盘点明细ID错误,没有该条明细"); } @@ -226,20 +238,20 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(temp); Location loc = locationService.getOne(lambdaQueryWrapper); if(!loc.getStatus().equals("empty")){ - return AjaxResult.error(cycleCountDetail.getLocationCode()+"状态非空闲,操作失败"); + return AjaxResult.error(cycleCountDetail.getLocationCode()+"库位不在空闲状态,请先完成其他任务,操作失败!"); } if(StringUtils.isEmpty(loc.getContainerCode())){ - return AjaxResult.error(cycleCountDetail.getLocationCode()+"没有托盘,操作失败"); + return AjaxResult.error(cycleCountDetail.getLocationCode()+"库位中没有容器,操作失败!"); } //查询任务头和明细有相同容器,没有就新增任务头和明细 LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); taskHeaderLambdaQueryWrapper - .lt(TaskHeader::getStatus,100) + .lt(TaskHeader::getStatus,QuantityConstant.TASK_STATUS_COMPLETED) .eq(TaskHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) .eq(TaskHeader::getCompanyCode,cycleCountDetail.getCompanyCode()) - .eq(TaskHeader::getInternalTaskType,700) - .eq(TaskHeader::getTaskType,700) + .eq(TaskHeader::getInternalTaskType,QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT) + .eq(TaskHeader::getTaskType,QuantityConstant.TASK_TYPE_CYCLECOUNT) .eq(TaskHeader::getContainerCode,cycleCountDetail.getContainerCode());//容器 List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); @@ -249,10 +261,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap //存在相同容器的主任务直接加入该条主任务的明细 task.setWarehouseCode(ShiroUtils.getWarehouseCode()); task.setCompanyCode(cycleCountDetail.getCompanyCode()); - task.setInternalTaskType(700); - task.setTaskType(700); + task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT); + task.setTaskType(QuantityConstant.TASK_TYPE_CYCLECOUNT); task.setContainerCode(cycleCountDetail.getContainerCode()); - task.setStatus(0); + task.setStatus(QuantityConstant.TASK_STATUS_BUILD); task.setFromLocation(cycleCountDetail.getLocationCode()); task.setToLocation(cycleCountDetail.getLocationCode()); task.setCreated(new Date()); @@ -309,7 +321,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap //cycleCountDetail.setTaskHeaderId(task.getId()); cycleCountDetail.setLastUpdated(new Date()); cycleCountDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); - cycleCountDetail.setEnableStatus(5); + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK); cycleCountDetail.setTaskHeaderId(task.getId()); cycleCountDetail.setTaskDetailId(taskDetail.getId()); this.saveOrUpdate(cycleCountDetail); @@ -320,7 +332,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode()); LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cycleCountHeader); cycleCountHeader = cycleCountHeaderService.getOne(lamb); - cycleCountHeader.setStatusCyc(5); + cycleCountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_BUILDTASK); cycleCountHeaderService.saveOrUpdate(cycleCountHeader); return AjaxResult.success("盘点任务生成成功"); } @@ -343,10 +355,10 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap LambdaQueryWrapper<CycleCountHeader> cycleCountHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountHeader); cycleCountHeader = cycleCountHeaderService.getOne(cycleCountHeaderLambdaQueryWrapper); //主单 //任务执行后再实盘登记 - if(cyclecountDetail.getEnableStatus() < 10){ + if(cyclecountDetail.getEnableStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){ return AjaxResult.error("盘点任务未执行不能登记数量!"); } - if(cyclecountDetail.getEnableStatus() == 100){ + if(cyclecountDetail.getEnableStatus() == QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){ return AjaxResult.error("盘点任务完成后不能再登记数量!"); } if(cycleCountHeader == null){ @@ -363,13 +375,13 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap if (inventoryDetail == null) { return AjaxResult.error("没有对应库存信息,请重建盘点单"); } - if(qty.compareTo(inventoryDetail.getTaskQty()) < 0){ + /*if(qty.compareTo(inventoryDetail.getTaskQty()) < 0){ return AjaxResult.error("登记数量不能小于任务分配数量"); - } + }*/ } cyclecountDetail.setCountedQty(qty); cyclecountDetail.setGapQty(qty.subtract(cyclecountDetail.getSystemQty())); - cyclecountDetail.setEnableStatus(15); + cyclecountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED); cyclecountDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); cyclecountDetail.setLastUpdated(new Date()); this.saveOrUpdate(cyclecountDetail); @@ -390,7 +402,6 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap public AjaxResult createCyclecountWithGapQty(String cycleCountHeaderCode) { /*找出实盘登记中数量有差异的,重新生成盘点单*/ - CycleCountHeader cycleCountHeader = new CycleCountHeader(); cycleCountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); cycleCountHeader.setCode(cycleCountHeaderCode); @@ -409,22 +420,30 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap if(countHeader != null){ return AjaxResult.error("该单据已生成复盘单,请勿重复生成!"); } + //没有盘点明细或明细都没有差异时不生成复盘单 + CycleCountDetail cycleCountDetail = new CycleCountDetail(); - cycleCountDetail.setTaskHeaderId(cycleCountHeader.getId()); + cycleCountDetail.setCycleCountHeadCode(cycleCountHeaderCode); cycleCountDetail.setWarehouseCode(cycleCountHeader.getWarehouseCode()); cycleCountDetail.setCompanyCode(cycleCountHeader.getCompanyCode()); - LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountDetail); List<CycleCountDetail> cycleCountDetails = this.list(cycleCountDetailLambdaQueryWrapper);//明细 if(cycleCountDetails.size() == 0){ - throw new SecurityException("没有明细!"); + throw new SecurityException("没有盘点明细条目,操作失败!"); } //生成复盘盘点主单 - cycleCountHeader.setCode(cycleCountHeaderService.createCode()); - cycleCountHeader.setRound(cycleCountHeader.getRound() + 1);//盘点轮次+1 - cycleCountHeader.setCreated(new Date()); - cycleCountHeader.setCreatedBy(ShiroUtils.getLoginName()); - cycleCountHeader.setSourceCode(cycleCountHeaderCode);//源盘点单号 - if(!cycleCountHeaderService.saveOrUpdate(cycleCountHeader)){ + CycleCountHeader cycleCountHeader1 = new CycleCountHeader(); + String cycleCountHeaderCode1 = cycleCountHeaderService.createCode(); + cycleCountHeader1.setCode(cycleCountHeaderCode1); + cycleCountHeader1.setCompanyCode(cycleCountHeader.getCompanyCode()); + cycleCountHeader1.setWarehouseCode(cycleCountHeader.getWarehouseCode()); + cycleCountHeader1.setRound(cycleCountHeader.getRound() + 1);//盘点轮次+1 + cycleCountHeader1.setCountType(cycleCountHeader.getCountType()); + cycleCountHeader1.setCreated(new Date()); + cycleCountHeader1.setCreatedBy(ShiroUtils.getLoginName()); + cycleCountHeader1.setLastUpdatedBy(ShiroUtils.getLoginName()); + cycleCountHeader1.setSourceCode(cycleCountHeaderCode);//源盘点单号 + if(!cycleCountHeaderService.saveOrUpdate(cycleCountHeader1)){ throw new ServiceException("复盘主单生成失败!"); } //获取差异数量不为零的子单重新再生成盘点单 @@ -433,28 +452,83 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap //getGapQty不能为null默认值为0 int f = item.getGapQty().compareTo(BigDecimal.ZERO); if(f > 0){ + item.setCycleCountHeadCode(cycleCountHeaderCode1); item.setCountedQty(null); item.setGapQty(BigDecimal.ZERO); + item.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILD); item.setCreatedBy(ShiroUtils.getLoginName()); item.setCreated(new Date()); cycleCountDetailList.add(item); } - } if(cycleCountDetailList.size() == 0){ - throw new SecurityException("该单据没有符合复盘条件的明细!"); + throw new SecurityException("该主单据没有符合复盘条件的明细!"); } - if(!this.saveBatch(cycleCountDetailList)){ + Boolean j = this.saveBatch(cycleCountDetailList); + if(j == false ){ throw new ServiceException("复盘明细子单生成失败"); } + return AjaxResult.success("生成复盘单成功!"); } + /** + * 盘点首选项实现 + * @param cycleCoutDetailList + * @return + */ + @Transactional + @Override + public List<CycleCountDetail> preferenceRealize(List<CycleCountDetail> cycleCoutDetailList) { + List<CycleCountDetail> cycs = new ArrayList<>(); + /*根据当前明细条目的盘点首选Code,取出显示要求,再根据显示要求隐藏或显示字段*/ + + /*//配置表 + ConfigValue configValue = new ConfigValue(); + configValue.setModuleType("cyclecount"); + configValue.setWarehouseCode(ShiroUtils.getWarehouseCode()); + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper = Wrappers.lambdaQuery(configValue); + ConfigValue value = configValueService.getOne(configValueLambdaQueryWrapper); + if(value == null){ + throw new SecurityException("请先在配置中添加盘点配置"); + }*/ + //取出preference的数据来判断字段 + for(CycleCountDetail item:cycleCoutDetailList){ + //盘点首选项 + CycleCountPreference temp = new CycleCountPreference(); + temp.setCode(item.getPreferenceCode()); + temp.setWarehouseCode(item.getWarehouseCode()); + LambdaQueryWrapper<CycleCountPreference> cycleCountPreferenceLambdaQuery = Wrappers.lambdaQuery(temp); + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(cycleCountPreferenceLambdaQuery); + if(cycleCountPreference == null){ + throw new SecurityException("没有对应的盘点首选项!"); + } + //判断字段 + if(cycleCountPreference.getPromptLocation() == false){ + //库位 + item.setLocationCode(""); + } + if(cycleCountPreference.getPromptLpn() == false){ + //容器 + item.setContainerCode(""); + } + if(cycleCountPreference.getPromptItem() == false){ + //物料 + item.setMaterialCode(""); + item.setMaterialName(""); + item.setMaterialUnit(""); + item.setMaterialSpec(""); + } + if(cycleCountPreference.getPromptQuantity() == false){ + //系统数量 + item.setSystemQty(null); + } + cycs.add(item); + } - - - + return cycs; + } } diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java index b8fb449..e6bf6f7 100644 --- a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.inventory.cycleCountHeader.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -64,12 +65,11 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap temp.setCompanyCode(cyclecountHeader.getCompanyCode()); LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(temp); List<CycleCountDetail> list = cycleCountDetailService.list(lam); - //当有子单的状态为100时触发主单的完成状态 //100状态只有全部完成才写入主单 - long count100 = list.stream().filter(t->t.getEnableStatus() == 100).count(); + long count100 = list.stream().filter(t->t.getEnableStatus() == QuantityConstant.CYCLECOUNT_STATUS_COMPLETED).count(); //明细已完成的条数 if(count100 == list.size() ){ - cyclecountHeader.setStatusCyc(100); + cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); this.saveOrUpdate(cyclecountHeader); } //有任何子单没有完成则主单不修改为100 @@ -87,25 +87,6 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap } } - /* if( count ==0){ - //说明子单据都还没有开始盘点 - cyclecountHeader.setStatus(0); - }else */ - /* if(count == list.size()){ - //说明盘点完成 - long count2 = list.stream().filter(t->t.getGapQty().compareTo(BigDecimal.ZERO) != 0).count(); - if(count2 > 0){ - //说明有差异 - cyclecountHeader.setStatusCyc(30); - }else{ - //说明无差异 - cyclecountHeader.setStatusCyc(40); - } - }else{ - //说明盘点中 - cyclecountHeader.setStatusCyc(20); - }*/ - // this.saveOrUpdate(cyclecountHeader); } /** @@ -150,8 +131,8 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap CycleCountDetail temp = new CycleCountDetail(); temp.setWarehouseCode(ShiroUtils.getWarehouseCode()); temp.setCycleCountHeadCode(cyclecountHeader.getCode()); - LambdaQueryWrapper lm = Wrappers.lambdaQuery(temp); - cycleCountDetailService.remove(lm); + LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper= Wrappers.lambdaQuery(temp); + cycleCountDetailService.remove(cycleCountDetailLambdaQueryWrapper); cycleCountHeaderMapper.deleteById(id); return AjaxResult.success("盘点主单和明细删除成功"); @@ -169,12 +150,10 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap //查询该条盘点单头 id CycleCountHeader cyclecountHeader = cycleCountHeaderMapper.selectById(id); - - if(cyclecountHeader.getStatusCyc() >= 35){ + if(cyclecountHeader.getStatusCyc() < QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){ //查询是否已生成差异单 - throw new ServiceException("该条盘点单无法生成调整单,请检查状态!"); + throw new ServiceException("该条盘点单无法生成调整单,必须为盘点任务完成,请检查状态!"); } - AdjustHeader adjustHeader = new AdjustHeader(); adjustHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());//仓库 adjustHeader.setCode(adjustHeaderService.createCode());//生成差异单号 @@ -197,6 +176,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap //AdjustHeader adjust = adjustHeaderService.getById(adjustHeader.getId()); //循环明细条目,查找符合条件的数据写入调整单明细 AdjustDetail adjustDetail = new AdjustDetail(); + List<AdjustDetail> adjustDetails = new ArrayList<>(); for(CycleCountDetail item:cycleCountDetailList){ //BigDecimal的比较 .compareTo(BigDecimal.ZERO) != 0 @@ -224,14 +204,16 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap adjustDetail.setCreated(new Date()); adjustDetail.setCreatedBy(ShiroUtils.getLoginName()); //adjustDetail.setStatus(0);//状态 - - adjustDetailService.save(adjustDetail); + adjustDetails.add(adjustDetail); + //adjustDetailService.save(adjustDetail); } - } - + if(adjustDetails.size() == 0 ){ + throw new SecurityException("该盘点单没有差异数据条目,无法生成调整单!"); + } + adjustDetailService.saveBatch(adjustDetails); //修改盘点主单状态为已生成差异单 - cyclecountHeader.setStatusCyc(35); + cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_GENERATEADJUST); this.saveOrUpdate(cyclecountHeader); return AjaxResult.success("差异调整及明细单生成完毕!"); diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/controller/AdminInventoryController.java b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/controller/AdminInventoryController.java new file mode 100644 index 0000000..31411df --- /dev/null +++ b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/controller/AdminInventoryController.java @@ -0,0 +1,65 @@ +package com.huaheng.pc.inventory.inventoryDetail.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +/** + * 库存 信息操作处理 + * + * @author ricard + * @date 2019-05-13 + */ +@Controller +@RequestMapping("/admin/inventory") +public class AdminInventoryController extends BaseController { + + private String prefix = "admin/inventory"; + + @Autowired + private InventoryDetailService inventoryService; + +// @RequiresPermissions("admin:inventory:view") + @GetMapping() + public String inventory() + { + return prefix + "/inventory"; + } + + /** + * 查询库存列表 + */ +// @RequiresPermissions("admin:inventory:list") + @Log(title = "库存-库存查看",operating = "查看库存列表", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(InventoryDetail inventoryDetail) + { + LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(inventoryDetail.getWarehouseCode()),InventoryDetail::getWarehouseCode,inventoryDetail.getWarehouseCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getCompanyCode()),InventoryDetail::getCompanyCode,inventoryDetail.getCompanyCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getLocationCode()),InventoryDetail::getLocationCode,inventoryDetail.getLocationCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getContainerCode()),InventoryDetail::getContainerCode,inventoryDetail.getContainerCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialCode()),InventoryDetail::getMaterialCode,inventoryDetail.getMaterialCode()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getInventorySts()),InventoryDetail::getInventorySts,inventoryDetail.getInventorySts()) + .eq(StringUtils.isNotEmpty(inventoryDetail.getSupplierCode()),InventoryDetail::getSupplierCode,inventoryDetail.getSupplierCode()); + startPage(); + List<InventoryDetail> list =inventoryService.list(lambdaQueryWrapper); + return getDataTable(list); + } +} diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/mapper/InventoryDetailMapper.java b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/mapper/InventoryDetailMapper.java index 52da6f2..8777d87 100644 --- a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/mapper/InventoryDetailMapper.java +++ b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/mapper/InventoryDetailMapper.java @@ -2,8 +2,10 @@ package com.huaheng.pc.inventory.inventoryDetail.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; +import org.apache.ibatis.annotations.Param; import java.math.BigDecimal; +import java.util.LinkedHashMap; import java.util.List; public interface InventoryDetailMapper extends BaseMapper<InventoryDetail> { @@ -12,4 +14,21 @@ public interface InventoryDetailMapper extends BaseMapper<InventoryDetail> { BigDecimal getSumQty(InventoryDetail inventoryDetail); + //仓库维度显示库龄 + String getWarehouseInventoryStatus(@Param("warehouseCode") String warehouseCode, @Param("a")Integer a, @Param("b")Integer b); + + //仓库维度显示库龄 + String getWarehouseInventoryStatuss(@Param("warehouseCode") String warehouseCode,@Param("a")Integer a); + + //货主维度显示库龄 + String getCompanyInventoryStatus(@Param("companyCode") String companyCode,@Param("a")Integer a,@Param("b")Integer b); + + //货主维度显示库龄 + String getCompanyInventoryStatuss(@Param("companyCode") String companyCode,@Param("a")Integer a); + + //仓库维度显示库存分布 + List<LinkedHashMap<String, Object>> getWarehouseInventoryProp(@Param("warehouseCode") String warehouseCode); + + //货主维度显示库存分布 + List<LinkedHashMap<String, Object>> getCompanyInventoryProp(@Param("companyCode") String companyCode); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java index 77adfb0..8bb4ab1 100644 --- a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java +++ b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java @@ -8,6 +8,7 @@ import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; +import java.util.LinkedHashMap; import java.util.List; public interface InventoryDetailService extends IService<InventoryDetail> { @@ -23,6 +24,23 @@ public interface InventoryDetailService extends IService<InventoryDetail> { //求一种物料的库存之和 BigDecimal getSumQty(InventoryDetail inventoryDetail); + //仓库维度显示库龄 + String getWarehouseInventoryStatus(String warehouseCode,Integer a,Integer b); + + String getWarehouseInventoryStatuss(String warehouseCode,Integer a); + + //货主维度显示库龄 + String getCompanyInventoryStatus( String companyCode,Integer a,Integer b); + + //货主维度显示库龄 + String getCompanyInventoryStatuss( String companyCode,Integer a); + + //仓库维度显示库存分布 + List<LinkedHashMap<String, Object>> getWarehouseInventoryProp(String warehouseCode); + + //货主维度显示库存分布 + List<LinkedHashMap<String, Object>> getCompanyInventoryProp(String companyCode); + } diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java index 579b1ba..c0ef118 100644 --- a/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.inventory.inventoryDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; @@ -92,10 +93,10 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(inventoryDetail.getWarehouseCode()); taskHeader.setCompanyCode(inventoryDetail.getCompanyCode()); - taskHeader.setInternalTaskType(200); - taskHeader.setTaskType(900); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_PICKING); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_VIEW); taskHeader.setContainerCode(inventoryDetail.getContainerCode()); - taskHeader.setStatus(0); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(inventoryDetail.getLocationCode()); taskHeader.setToLocation(inventoryDetail.getLocationCode()); taskHeader.setCreated(new Date()); @@ -130,17 +131,11 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe @Override public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail, String sqll, ShipmentPreference shipmentPreference) { - if(shipmentPreference.getAllowQcCheckResult() == false) { - sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + - "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + - "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + - "and inventorySts='" + shipmentDetail.getInventorySts() + "'\n"+ sqll; + if(shipmentPreference.getAllowQcCheckResult() == true) { + sql = sql +"'" + shipmentDetail.getId() + "' \n"+ sqll; }else { - sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + - "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + - "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + - "and inventorySts='" + shipmentDetail.getInventorySts() + "'\n"+ - "and qcCheck=1\n"+ sqll; + sql = sql +"'" + shipmentDetail.getId() + "' \n"+ + "and i.qcCheck=1\n"+ sqll; } return inventoryDetailMapper.selectBysql(sql); } @@ -184,9 +179,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe CheckHeader checkHeader = new CheckHeader(); //判断入库单明细与该单已选中质检的库存明细比较,得出质检单的类型 if(inventoryDetailList.size()>inventoryDetails.size()){ - checkHeader.setType("300"); + checkHeader.setType(QuantityConstant.CHECK_TYPE_SELECT.toString()); }else { - checkHeader.setType("200"); + checkHeader.setType(QuantityConstant.CHECK_TYPE_FULL.toString()); } //生成质检单号code @@ -202,7 +197,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe checkHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); checkHeader.setReferCode(code); checkHeader.setEnable(1); - checkHeader.setStatus("0"); + checkHeader.setStatus(QuantityConstant.CHECK_STATUS_BUILD.toString()); checkHeader.setCreatedBy(ShiroUtils.getLoginName()); Boolean flag=checkHeaderService.save(checkHeader); if(flag == false){ @@ -217,7 +212,7 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe checkDetail.setCheckHeaderId(checkHeader.getId()); checkDetail.setCheckCode(checkCode); checkDetail.setInventoryDetailId(item.getId()); - checkDetail.setStatus("0"); + checkDetail.setStatus(QuantityConstant.CHECK_STATUS_BUILD.toString()); checkDetail.setCreatedBy(ShiroUtils.getLoginName()); checkDetail.setCreated(new Date()); checkDetail.setLastUpdatedBy(null); @@ -248,6 +243,35 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe return inventoryDetailMapper.getSumQty(inventoryDetail); } + @Override + public String getWarehouseInventoryStatus(String warehouseCode, Integer a, Integer b) { + return inventoryDetailMapper.getWarehouseInventoryStatus(warehouseCode,a,b); + } + + @Override + public String getWarehouseInventoryStatuss(String warehouseCode,Integer a) { + return inventoryDetailMapper.getWarehouseInventoryStatuss(warehouseCode,a); + } + + @Override + public String getCompanyInventoryStatus(String companyCode,Integer a,Integer b) { + return inventoryDetailMapper.getCompanyInventoryStatus(companyCode,a,b); + } + + @Override + public String getCompanyInventoryStatuss(String companyCode,Integer a) { + return inventoryDetailMapper.getCompanyInventoryStatuss(companyCode,a); + } + + @Override + public List<LinkedHashMap<String, Object>> getWarehouseInventoryProp(String warehouseCode) { + return inventoryDetailMapper.getWarehouseInventoryProp(warehouseCode); + } + + @Override + public List<LinkedHashMap<String, Object>> getCompanyInventoryProp(String companyCode) { + return inventoryDetailMapper.getCompanyInventoryProp(companyCode); + } } diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java index d05234a..2f1052f 100644 --- a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java +++ b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java @@ -210,8 +210,8 @@ public class InventoryHeaderController extends BaseController @ResponseBody public TableDataInfo listEmptyContainer(String containerCode, String locationCode) { - containerCode = containerCode==null?"":containerCode.trim(); - locationCode = locationCode==null?"":locationCode.trim(); + containerCode = containerCode == null?"":containerCode.trim(); + locationCode = locationCode == null?"":locationCode.trim(); startPage(); List<Location> list = containerService.getEmptyContainerInLocation(containerCode,locationCode,ShiroUtils.getWarehouseCode()); return getDataTable(list); diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java index 849ba97..671dd47 100644 --- a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.inventory.inventoryHeader.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; @@ -120,10 +121,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(loc.getWarehouseCode()); taskHeader.setCompanyCode("空容器");//货主 - taskHeader.setInternalTaskType(100); //入库内部类型都给100 - taskHeader.setTaskType(500); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); //入库内部类型都给100 + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYRECEIPT); taskHeader.setContainerCode(container.getCode()); - taskHeader.setStatus(1); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(""); taskHeader.setToLocation(loc.getCode()); taskHeader.setCreated(new Date()); @@ -199,10 +200,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(loc.getWarehouseCode()); taskHeader.setCompanyCode("空容器");//货主 - taskHeader.setInternalTaskType(200); //出库内部类型都给200 - taskHeader.setTaskType(600); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_PICKING); //出库内部类型都给200 + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT); taskHeader.setContainerCode(container.getCode()); - taskHeader.setStatus(1); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(sourceLocation); taskHeader.setToLocation(""); taskHeader.setCreated(new Date()); @@ -272,10 +273,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(loc.getWarehouseCode()); taskHeader.setCompanyCode("空容器");//货主 - taskHeader.setInternalTaskType(200); //出库内部类型都给200 - taskHeader.setTaskType(900); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_PICKING); //出库内部类型都给200 + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_VIEW); taskHeader.setContainerCode(container.getCode()); - taskHeader.setStatus(1); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(location); taskHeader.setToLocation(location); taskHeader.setCreated(new Date()); diff --git a/src/main/java/com/huaheng/pc/monitor/locationstatus/controller/LocationStatusController.java b/src/main/java/com/huaheng/pc/monitor/locationstatus/controller/LocationStatusController.java new file mode 100644 index 0000000..a629e7f --- /dev/null +++ b/src/main/java/com/huaheng/pc/monitor/locationstatus/controller/LocationStatusController.java @@ -0,0 +1,25 @@ +package com.huaheng.pc.monitor.locationstatus.controller; + +import com.huaheng.framework.web.controller.BaseController; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Created by Enzo Cotter on 2019/10/25. + */ +@Controller +@RequestMapping("/monitor/locationstatus") +public class LocationStatusController extends BaseController { + + private String prefix = "monitor/locationstatus"; + + @RequiresPermissions("locationstatus:bill:view") + @GetMapping() + public String locationStatus() + { + return prefix + "/locationstatus"; + } + +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java b/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java index 322490d..e73692b 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptContainerDetail/service/ReceiptContainerDetailServiceImpl.java @@ -3,6 +3,7 @@ package com.huaheng.pc.receipt.receiptContainerDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -54,7 +55,7 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai for (Integer id : idList){ ReceiptContainerDetail receiptContainerDetail = this.getById(id); //如果已生成任务不允许撤销 - if (receiptContainerDetail.getStatus() < 10){ + if (receiptContainerDetail.getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK){ //回滚入库单明细收货数量 ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); receiptDetail.setOpenQty(receiptDetail.getOpenQty().subtract(receiptContainerDetail.getQty())); @@ -84,8 +85,8 @@ public class ReceiptContainerDetailServiceImpl extends ServiceImpl<ReceiptContai if (containerDetailList.size() == 0){ ReceiptHeader receiptHeader = new ReceiptHeader(); receiptHeader.setId(receiptContainerDetail.getReceiptId()); - receiptHeader.setFirstStatus(200); - receiptHeader.setLastStatus(200); + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); if (!receiptHeaderService.updateById(receiptHeader)){ throw new ServiceException("回滚头表状态失败"); } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java index 820e4bd..16818f7 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java @@ -37,6 +37,10 @@ import java.util.Arrays; import java.util.Comparator; import java.util.List; +/** + * 入库组盘头表控制 + * @author mahuaheng + */ @Controller @RequestMapping("/receipt/receiptContainerHeader") public class ReceiptContainerHeaderController extends BaseController { @@ -155,8 +159,10 @@ public class ReceiptContainerHeaderController extends BaseController { LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); - for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails) - receivingService.position(receiptContainerDetail); + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails){ + receivingService.position(receiptContainerDetail); + } + } return AjaxResult.success("定位成功"); } @@ -177,8 +183,9 @@ public class ReceiptContainerHeaderController extends BaseController { LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery(); lambda.eq(ReceiptContainerDetail::getReceiptContainerId, idList.get(i)); List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda); - for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails) + for (ReceiptContainerDetail receiptContainerDetail : receiptContainerDetails) { receivingService.cancelPosition(receiptContainerDetail); + } } return AjaxResult.success("取消定位成功"); } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/domain/ReceiptContainerHeader.java b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/domain/ReceiptContainerHeader.java index eaa2e5b..bc1dc27 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/domain/ReceiptContainerHeader.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/domain/ReceiptContainerHeader.java @@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + import java.io.Serializable; import java.util.Date; @ApiModel(value="com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHeader") @TableName(value = "receipt_container_header") +@Data public class ReceiptContainerHeader implements Serializable { /** * ID @@ -208,563 +211,13 @@ public class ReceiptContainerHeader implements Serializable { @ApiModelProperty(value="状态") private Short status; - private static final long serialVersionUID = 1L; - - public static final String COL_WAREHOUSECODE = "warehouseCode"; - - public static final String COL_COMPANYCODE = "companyCode"; - - public static final String COL_CONTAINERCODE = "containerCode"; - - public static final String COL_CONTAINERTYPE = "containerType"; - - public static final String COL_TASKTYPE = "taskType"; - - public static final String COL_WEIGHT = "weight"; - - public static final String COL_PROJECTNO = "projectNo"; - - public static final String COL_LOCATINGRULE = "locatingRule"; - - public static final String COL_FROMLOCATION = "fromLocation"; - - public static final String COL_TOLOCATION = "toLocation"; - - public static final String COL_WAVEID = "waveId"; - - public static final String COL_TASKCREATED = "taskCreated"; - - public static final String COL_CREATED = "created"; - - public static final String COL_CREATEDBY = "createdBy"; - - public static final String COL_LASTUPDATED = "lastUpdated"; - - public static final String COL_LASTUPDATEDBY = "lastUpdatedBy"; - - public static final String COL_VERSION = "version"; - - public static final String COL_USERDEF1 = "userDef1"; - - public static final String COL_USERDEF2 = "userDef2"; - - public static final String COL_USERDEF3 = "userDef3"; - - public static final String COL_USERDEF4 = "userDef4"; - - public static final String COL_USERDEF5 = "userDef5"; - - public static final String COL_USERDEF6 = "userDef6"; - - public static final String COL_USERDEF7 = "userDef7"; - - public static final String COL_USERDEF8 = "userDef8"; - - public static final String COL_PROCESSSTAMP = "processStamp"; - - public static final String COL_STATUS = "status"; - - /** - * 获取ID - * - * @return id - ID - */ - public Integer getId() { - return this.id; - } - - /** - * 设置ID - * - * @param id ID - */ - public void setId(Integer id) { - this.id = id; - } - - /** - * 获取仓库 - * - * @return warehouseCode - 仓库 - */ - public String getWarehouseCode() { - return warehouseCode; - } - - /** - * 设置仓库 - * - * @param warehouseCode 仓库 - */ - public void setWarehouseCode(String warehouseCode) { - this.warehouseCode = warehouseCode; - } - - /** - * 获取货主 - * - * @return companyCode - 货主 - */ - public String getCompanyCode() { - return companyCode; - } - - /** - * 设置货主 - * - * @param companyCode 货主 - */ - public void setCompanyCode(String companyCode) { - this.companyCode = companyCode; - } - - /** - * 获取容器号 - * - * @return containerCode - 容器号 - */ - public String getContainerCode() { - return containerCode; - } - - /** - * 设置容器号 - * - * @param containerCode 容器号 - */ - public void setContainerCode(String containerCode) { - this.containerCode = containerCode; - } - - /** - * 获取容器类型 - * - * @return containerType - 容器类型 - */ - public String getContainerType() { - return containerType; - } - - /** - * 设置容器类型 - * - * @param containerType 容器类型 - */ - public void setContainerType(String containerType) { - this.containerType = containerType; - } - - /** - * 获取任务类型 - * - * @return taskType - 任务类型 - */ - public String getTaskType() { - return taskType; - } - - /** - * 设置任务类型 - * - * @param taskType 任务类型 - */ - public void setTaskType(String taskType) { - this.taskType = taskType; - } - - /** - * 获取重量 - * - * @return weight - 重量 - */ - public String getWeight() { - return weight; - } - - /** - * 设置重量 - * - * @param weight 重量 - */ - public void setWeight(String weight) { - this.weight = weight; - } - - /** - * 获取项目号 - * - * @return projectNo - 项目号 - */ - public String getProjectNo() { - return projectNo; - } - - /** - * 设置项目号 - * - * @param projectNo 项目号 - */ - public void setProjectNo(String projectNo) { - this.projectNo = projectNo; - } - - /** - * 获取定位规则 - * - * @return locatingRule - 定位规则 - */ - public String getLocatingRule() { - return locatingRule; - } - - /** - * 设置定位规则 - * - * @param locatingRule 定位规则 - */ - public void setLocatingRule(String locatingRule) { - this.locatingRule = locatingRule; - } - - /** - * 获取从库位 - * - * @return fromLocation - 从库位 - */ - public String getFromLocation() { - return fromLocation; - } - - /** - * 设置从库位 - * - * @param fromLocation 从库位 - */ - public void setFromLocation(String fromLocation) { - this.fromLocation = fromLocation; - } - - /** - * 获取目标库位 - * - * @return toLocation - 目标库位 - */ - public String getToLocation() { - return toLocation; - } - - /** - * 设置目标库位 - * - * @param toLocation 目标库位 - */ - public void setToLocation(String toLocation) { - this.toLocation = toLocation; - } - - /** - * 获取波次号 - * - * @return waveId - 波次号 - */ - public Integer getWaveId() { - return waveId; - } - /** - * 设置波次号 - * - * @param waveId 波次号 + * 站台 */ - public void setWaveId(Integer waveId) { - this.waveId = waveId; - } + @TableField(value = "recvDock") + @ApiModelProperty(value="站台") + private String recvDock; - /** - * 获取任务已创建 - * - * @return taskCreated - 任务已创建 - */ - public Integer getTaskCreated() { - return taskCreated; - } - - /** - * 设置任务已创建 - * - * @param taskCreated 任务已创建 - */ - public void setTaskCreated(Integer taskCreated) { - this.taskCreated = taskCreated; - } - - /** - * 获取创建时间 - * - * @return created - 创建时间 - */ - public Date getCreated() { - return created; - } - - /** - * 设置创建时间 - * - * @param created 创建时间 - */ - public void setCreated(Date created) { - this.created = created; - } - - /** - * 获取创建用户 - * - * @return createdBy - 创建用户 - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * 设置创建用户 - * - * @param createdBy 创建用户 - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * 获取创建时间 - * - * @return lastUpdated - 创建时间 - */ - public Date getLastUpdated() { - return lastUpdated; - } - - /** - * 设置创建时间 - * - * @param lastUpdated 创建时间 - */ - public void setLastUpdated(Date lastUpdated) { - this.lastUpdated = lastUpdated; - } - - /** - * 获取更新用户 - * - * @return lastUpdatedBy - 更新用户 - */ - public String getLastUpdatedBy() { - return lastUpdatedBy; - } - - /** - * 设置更新用户 - * - * @param lastUpdatedBy 更新用户 - */ - public void setLastUpdatedBy(String lastUpdatedBy) { - this.lastUpdatedBy = lastUpdatedBy; - } - - /** - * 获取数据版本 - * - * @return version - 数据版本 - */ - public Integer getVersion() { - return version; - } - - /** - * 设置数据版本 - * - * @param version 数据版本 - */ - public void setVersion(Integer version) { - this.version = version; - } - - /** - * 获取自定义字段1 - * - * @return userDef1 - 自定义字段1 - */ - public String getUserDef1() { - return userDef1; - } - - /** - * 设置自定义字段1 - * - * @param userDef1 自定义字段1 - */ - public void setUserDef1(String userDef1) { - this.userDef1 = userDef1; - } - - /** - * 获取自定义字段2 - * - * @return userDef2 - 自定义字段2 - */ - public String getUserDef2() { - return userDef2; - } - - /** - * 设置自定义字段2 - * - * @param userDef2 自定义字段2 - */ - public void setUserDef2(String userDef2) { - this.userDef2 = userDef2; - } - - /** - * 获取自定义字段3 - * - * @return userDef3 - 自定义字段3 - */ - public String getUserDef3() { - return userDef3; - } - - /** - * 设置自定义字段3 - * - * @param userDef3 自定义字段3 - */ - public void setUserDef3(String userDef3) { - this.userDef3 = userDef3; - } - - /** - * 获取自定义字段4 - * - * @return userDef4 - 自定义字段4 - */ - public String getUserDef4() { - return userDef4; - } - - /** - * 设置自定义字段4 - * - * @param userDef4 自定义字段4 - */ - public void setUserDef4(String userDef4) { - this.userDef4 = userDef4; - } - - /** - * 获取自定义字段5 - * - * @return userDef5 - 自定义字段5 - */ - public String getUserDef5() { - return userDef5; - } - - /** - * 设置自定义字段5 - * - * @param userDef5 自定义字段5 - */ - public void setUserDef5(String userDef5) { - this.userDef5 = userDef5; - } - - /** - * 获取自定义字段6 - * - * @return userDef6 - 自定义字段6 - */ - public String getUserDef6() { - return userDef6; - } - - /** - * 设置自定义字段6 - * - * @param userDef6 自定义字段6 - */ - public void setUserDef6(String userDef6) { - this.userDef6 = userDef6; - } - - /** - * 获取自定义字段7 - * - * @return userDef7 - 自定义字段7 - */ - public String getUserDef7() { - return userDef7; - } - - /** - * 设置自定义字段7 - * - * @param userDef7 自定义字段7 - */ - public void setUserDef7(String userDef7) { - this.userDef7 = userDef7; - } - - /** - * 获取自定义字段8 - * - * @return userDef8 - 自定义字段8 - */ - public String getUserDef8() { - return userDef8; - } - - /** - * 设置自定义字段8 - * - * @param userDef8 自定义字段8 - */ - public void setUserDef8(String userDef8) { - this.userDef8 = userDef8; - } - - /** - * 获取处理标记 - * - * @return processStamp - 处理标记 - */ - public String getProcessStamp() { - return processStamp; - } - - /** - * 设置处理标记 - * - * @param processStamp 处理标记 - */ - public void setProcessStamp(String processStamp) { - this.processStamp = processStamp; - } - - /** - * 获取状态 - * - * @return status - 状态 - */ - public Short getStatus() { - return status; - } + private static final long serialVersionUID = 1L; - /** - * 设置状态 - * - * @param status 状态 - */ - public void setStatus(Short status) { - this.status = status; - } } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java index 438186c..3625114 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptContainerHeader/service/ReceiptContainerHeaderServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -74,7 +75,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai if (taskType == 1){ //创建临时容器 containerCode = createContainer(); - taskType = 100; + taskType = QuantityConstant.TASK_TYPE_WHOLERECEIPT; }else { if (taskType == 0){ throw new ServiceException("容器状态未知"); } } @@ -87,7 +88,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai //根据容器编码查询组盘表头记录 LambdaQueryWrapper<ReceiptContainerHeader> lambda = Wrappers.lambdaQuery(); lambda.eq(ReceiptContainerHeader::getContainerCode, containerCode) - .eq(ReceiptContainerHeader::getStatus, 0); + .eq(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_CONTAINER_BUILD); List<ReceiptContainerHeader> list = this.list(lambda); ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); @@ -111,7 +112,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai } } else { receiptContainerHeader = list.get(0); - if (receiptContainerHeader.getStatus() > 9 && receiptContainerHeader.getStatus() < 20){ + if (receiptContainerHeader.getStatus() >= QuantityConstant.RECEIPT_CONTAINER_TASK && receiptContainerHeader.getStatus() < QuantityConstant.RECEIPT_CONTAINER_FINISHED){ throw new ServiceException("容器已经生成任务,不能放物料了!"); } } @@ -130,8 +131,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai receiptContainerDetailAdd(receiptContainerHeaders.get(0).getId(), receiptDetail, qty, containerCode, locationCode); //如果单据数量等于已收数量,更新入库详情状态和入库单状态 - if (receiptDetail.getTotalQty() == receiptDetail.getOpenQty()){ - receiptDetail.setProcessStamp("200"); + if (receiptDetail.getTotalQty().compareTo(receiptDetail.getOpenQty()) == 0){ + if (StringUtils.isNotEmpty(locationCode)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POSITION.toString()); + } else { + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_RECEIVING.toString()); + } if (!receiptDetailService.updateById(receiptDetail)){ throw new ServiceException("更新入库详情处理标记失败"); } @@ -155,7 +160,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai public Boolean cancelByIds(List<Integer> ids) { for (Integer id : ids) { //如果已生成任务则不允许取消组盘 - if (this.getById(id).getStatus() < 10){ + if (this.getById(id).getStatus() < QuantityConstant.RECEIPT_CONTAINER_TASK){ //根据组盘头表id查询组盘明细表 LambdaQueryWrapper<ReceiptContainerDetail> containerDetailLambda = Wrappers.lambdaQuery(); containerDetailLambda.eq(ReceiptContainerDetail::getReceiptContainerId, id); @@ -178,8 +183,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai if (containerDetailList == null){ ReceiptHeader receiptHeader = new ReceiptHeader(); receiptHeader.setId(receiptContainerDetail.getReceiptId()); - receiptHeader.setFirstStatus(200); - receiptHeader.setLastStatus(200); + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RECEIVING); receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); if (!receiptHeaderService.updateById(receiptHeader)){ throw new ServiceException("回滚头表状态失败"); } @@ -214,7 +219,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai lambdaQueryWrapper.eq(Material::getCode, materialCode); Material material = materialService.getOne(lambdaQueryWrapper); if (material.getAutoGenSerialNum() == 0){ - return 1; //需自动生成容器编码 + return 1; + //需自动生成容器编码 } else { throw new ServiceException("容器不能为空"); } @@ -231,15 +237,15 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai //检查该容器编码是否已存任务 LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); lambdaQueryWrapper.eq(TaskHeader::getContainerCode, containerCode) - .lt(TaskHeader::getStatus, 100) + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) .eq(TaskHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()); - if (taskHeaderService.count(lambdaQueryWrapper) > 0) + if (taskHeaderService.count(lambdaQueryWrapper) > 0){ throw new ServiceException("容器已经存在任务,请更换容器"); - + } if ("empty".equals(container.getStatus())){ - return 100; + return QuantityConstant.TASK_TYPE_WHOLERECEIPT; }else if ("some".equals(container.getStatus())) { - return 200; + return QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT; } else if ("full".equals(container.getStatus())) { throw new ServiceException("该容器已满,请更换容器"); } @@ -257,10 +263,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai Boolean checkLocationCode(String locationCode, String containerCode, Integer taskType) { //如果选了库位,就要校验库位和已经组盘的库位是否一致,避免重入库 if (StringUtils.isEmpty(locationCode)) { - if ("200".equals(locationCode)) + if (QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT.equals(locationCode)) { throw new ServiceException("补充入库,必须填写库位"); - else + } else { return true; + } } //查询组盘头表 @@ -272,10 +279,11 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai ReceiptContainerHeader receiptContainerHeader = this.getOne(lambda); if (receiptContainerHeader != null) { - if (receiptContainerHeader.getToLocation().equals(locationCode)) + if (receiptContainerHeader.getToLocation().equals(locationCode)) { return true; - else - throw new ServiceException("容器(" + containerCode + ")对应的库位是:" + receiptContainerHeader.getToLocation()); + } else { + throw new ServiceException("已存在组盘,组盘头id是"+receiptContainerHeader.getId()+"容器(" + containerCode + ")对应的库位是:" + receiptContainerHeader.getToLocation()); + } } LambdaQueryWrapper<Location> lambdaLocation = Wrappers.lambdaQuery(); @@ -283,20 +291,23 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai .eq(Location::getDeleted, false) .eq(Location::getCode, locationCode); Location location = locationService.getOne(lambdaLocation); - if (location == null) + if (location == null) { throw new ServiceException("库位不存在!"); - if (location.getStatus().equals("empty") == false) + } + if (!"empty".equals(location.getStatus()) ) { throw new ServiceException("库位不是空闲状态!"); - if ("100".equals(taskType)) { - if (com.huaheng.common.utils.StringUtils.isNotEmpty(location.getContainerCode())) + } + if (QuantityConstant.TASK_TYPE_WHOLERECEIPT.equals(taskType)) { + if (com.huaheng.common.utils.StringUtils.isNotEmpty(location.getContainerCode())) { throw new ServiceException("库位(" + containerCode + ")有容器(" + location.getContainerCode() + "),不能整盘入库!"); + } } - if("200".equals(taskType)) { - if (com.huaheng.common.utils.StringUtils.isEmpty(location.getContainerCode())) + if(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT.equals(taskType)) { + if (com.huaheng.common.utils.StringUtils.isEmpty(location.getContainerCode())){ throw new ServiceException("库位(" + locationCode + ")没有容器,不能补充入库!"); - else - if (location.getContainerCode().equals(containerCode) == false) + } else if (!location.getContainerCode().equals(containerCode)) { throw new ServiceException("库位(" + containerCode + ")对应的容器是:" + location.getContainerCode()+ ",请重选库位!"); + } } LambdaQueryWrapper<Location> lambdaQueryWrapper = Wrappers.lambdaQuery(); diff --git a/src/main/java/com/huaheng/pc/receipt/receiptDetail/controller/AdminReceiptDetailController.java b/src/main/java/com/huaheng/pc/receipt/receiptDetail/controller/AdminReceiptDetailController.java new file mode 100644 index 0000000..906e251 --- /dev/null +++ b/src/main/java/com/huaheng/pc/receipt/receiptDetail/controller/AdminReceiptDetailController.java @@ -0,0 +1,59 @@ +package com.huaheng.pc.receipt.receiptDetail.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 入库明细 信息操作处理 + * + * @author huaheng + * @date 2019-05-21 + */ +@Controller +@RequestMapping("/admin/receiptDetail") +public class AdminReceiptDetailController extends BaseController +{ + private String prefix = "admin/receiptDetail"; + + @Autowired + private ReceiptDetailService receiptDetailService; + + + @GetMapping("/{receiptId}/{receiptCode}") + public String receiptDetail(@PathVariable("receiptId") String receiptId, @PathVariable("receiptCode") String receiptCode, ModelMap mmap) + { + mmap.put("receiptId", receiptId); + mmap.put("receiptCode", receiptCode); + return prefix + "/receiptDetail"; + } + + /** + * 查询入库明细列表 + */ + @Log(title = "入库-入库单", operating = "查看入库单明细", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ReceiptDetail receiptDetail) + { + startPage(); + LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(StringUtils.isNotNull(receiptDetail.getReceiptId()), ReceiptDetail::getReceiptId, receiptDetail.getReceiptId()); + List<ReceiptDetail> list = receiptDetailService.list(lambdaQueryWrapper) ; + return getDataTable(list); + } + +} diff --git a/src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java b/src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java index ddce569..a384875 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptDetail/domain/ReceiptDetail.java @@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; + +import io.swagger.annotations.ApiParam; import lombok.Data; @ApiModel(value = "com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail") @@ -341,4 +343,11 @@ public class ReceiptDetail implements Serializable { @ApiModelProperty(value = "是否删除") private Boolean deleted; + /** + * 流程编码 + */ + @TableField(value = "statusFlowCode") + @ApiModelProperty(value = "流程编码") + private String statusFlowCode; + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/receipt/receiptDetail/mapper/ReceiptDetailMapper.java b/src/main/java/com/huaheng/pc/receipt/receiptDetail/mapper/ReceiptDetailMapper.java index 4bec201..7688a6c 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptDetail/mapper/ReceiptDetailMapper.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptDetail/mapper/ReceiptDetailMapper.java @@ -2,6 +2,18 @@ package com.huaheng.pc.receipt.receiptDetail.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; + +import java.util.List; public interface ReceiptDetailMapper extends BaseMapper<ReceiptDetail> { + + //获取7天内的入库量 + List<TaskDetail> getReceiptQtyLast7Days(); + + //以仓库维度获取入库量 + List<TaskDetail> getWarehouseReceipt(); + + //以货主维度获取入库量 + List<TaskDetail> getCompanyReceipt(); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java b/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java index 659362e..41018d2 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailService.java @@ -3,6 +3,10 @@ package com.huaheng.pc.receipt.receiptDetail.service; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; import com.baomidou.mybatisplus.extension.service.IService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; + +import java.util.List; + public interface ReceiptDetailService extends IService<ReceiptDetail>{ AjaxResult saveReceiptDetaial(ReceiptDetail receiptDetail); @@ -25,4 +29,13 @@ public interface ReceiptDetailService extends IService<ReceiptDetail>{ void updateReceiptHeaderLastStatus(Integer id); AjaxResult approval(String ids, Integer approval); + + //获取7天内的入库量 + List<TaskDetail> getReceiptQtyLast7Days(); + + //以仓库维度获取入库量 + List<TaskDetail> getWarehouseReceipt(); + + //以货主维度获取入库量 + List<TaskDetail> getCompanyReceipt(); } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java b/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java index 6b1643d..79c7c51 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java @@ -2,11 +2,16 @@ package com.huaheng.pc.receipt.receiptDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.check.checkHeader.domain.CheckHeader; +import com.huaheng.pc.check.checkHeader.service.CheckHeaderService; +import com.huaheng.pc.config.configValue.domain.ConfigValue; +import com.huaheng.pc.config.configValue.service.ConfigValueService; import com.huaheng.pc.config.material.domain.Material; import com.huaheng.pc.config.material.service.MaterialService; import com.huaheng.pc.config.materialType.domain.MaterialType; @@ -21,14 +26,13 @@ import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; import com.huaheng.pc.system.dict.domain.DictData; import com.huaheng.pc.system.dict.service.IDictDataService; -import org.aspectj.weaver.loadtime.Aj; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; import com.huaheng.pc.receipt.receiptDetail.mapper.ReceiptDetailMapper; -import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; import org.springframework.transaction.annotation.Transactional; @Service @@ -48,6 +52,12 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R private ReceiptPreferenceService receiptPreferenceService; @Resource private IDictDataService dictDataService; + @Resource + private CheckHeaderService checkHeaderService; + @Resource + private ConfigValueService configValueService; + @Resource + private ReceiptDetailMapper receiptDetailMapper; /** * 新增入库明细 @@ -64,7 +74,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R //判断入库头表状态 if (receiptHeader == null ){ throw new ServiceException("找不到主单据"); - } else if (receiptHeader.getFirstStatus() > 100){ + } else if (receiptHeader.getFirstStatus() > QuantityConstant.RECEIPT_HEADER_POOL){ throw new ServiceException("单据进入订单池后,不允许新增明细"); } else if (receiptHeader.getFirstStatus() == 20) { throw new ServiceException("单据已作废"); @@ -163,6 +173,18 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R return receiptDetail; } + //如果入库明细绑定了入库流程则从入库明细中选择流程 + if ( StringUtils.isNotEmpty(receiptDetail.getStatusFlowCode())){ + List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptDetail.getStatusFlowCode()); + String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp()); + //在状态到达时候是判断是否要质检 + if (QuantityConstant.RECEIPT_HEADER_RECEIVING.toString().equals(status) && inspection(receiptDetail)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_CHECK.toString()); + } else { + receiptDetail.setProcessStamp(status); + } + return receiptDetail; + } //查询头表信息 LambdaQueryWrapper<ReceiptHeader> lambdaReceiptHeader = Wrappers.lambdaQuery(); lambdaReceiptHeader.eq(ReceiptHeader::getCode, receiptDetail.getReceiptCode()); @@ -175,7 +197,8 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R //查询头表中绑定的入库类型中的入库流程 LambdaQueryWrapper<ReceiptType> lambdaReceiptType = Wrappers.lambdaQuery(); - lambdaReceiptType.eq(ReceiptType::getCode, receiptHeader.getReceiptType()); + lambdaReceiptType.eq(ReceiptType::getCode, receiptHeader.getReceiptType()) + .eq(ReceiptType::getWarehouseCode, ShiroUtils.getWarehouseCode()); ReceiptType receiptType = receiptTypeService.getOne(lambdaReceiptType); @@ -183,13 +206,23 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R //物料是否有入库流程 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptType.getReceiptFlow()); String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp()); - receiptDetail.setProcessStamp(status); + //在状态到达时候是判断是否要质检 + if (QuantityConstant.RECEIPT_HEADER_RECEIVING.toString().equals(status) && inspection(receiptDetail)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_CHECK.toString()); + } else { + receiptDetail.setProcessStamp(status); + } return receiptDetail; } else if (material.getReceivingFlow() != null){ //物料是否有入库流程 List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(material.getReceivingFlow()); String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp()); - receiptDetail.setProcessStamp(status); + //在状态到达时候是判断是否要质检 + if (QuantityConstant.RECEIPT_HEADER_RECEIVING.toString().equals(status) && inspection(receiptDetail)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_CHECK.toString()); + } else { + receiptDetail.setProcessStamp(status); + } return receiptDetail; } else { //该物料类别是否有入库流程 @@ -199,16 +232,31 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R if (materialType.getReceivingFlow() != null) { List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(materialType.getReceivingFlow()); String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp()); - receiptDetail.setProcessStamp(status); + //在状态到达时候是判断是否要质检 + if (QuantityConstant.RECEIPT_HEADER_RECEIVING.toString().equals(status) && inspection(receiptDetail)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_CHECK.toString()); + } else { + receiptDetail.setProcessStamp(status); + } return receiptDetail; } else { + //查询系统参数配置中绑定的入库首选项A + LambdaQueryWrapper<ConfigValue> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ConfigValue::getModuleType, "receipt"); + ConfigValue configValue = configValueService.getOne(lambdaQueryWrapper); + //以上都没有的情况下查询入库首选项中的入库流程 LambdaQueryWrapper<ReceiptPreference> lambda = Wrappers.lambdaQuery(); - lambda.last("Limit 1"); + lambda.eq(ReceiptPreference::getCode, configValue.getValue()); ReceiptPreference receiptPreference = receiptPreferenceService.getOne(lambda); List<StatusFlowDetail> statusFlowDetails = statusFlowDetailService.queryStatusFlowDetail(receiptPreference.getReceivingFlow()); String status = nextStatusFlow(statusFlowDetails, receiptDetail.getProcessStamp()); - receiptDetail.setProcessStamp(status); + //在状态到达时候是判断是否要质检 + if (QuantityConstant.RECEIPT_HEADER_RECEIVING.toString().equals(status) && inspection(receiptDetail)){ + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_CHECK.toString()); + } else { + receiptDetail.setProcessStamp(status); + } return receiptDetail; } } @@ -243,16 +291,25 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R lambdaDetails.eq(ReceiptDetail::getReceiptId, id); List<ReceiptDetail> receiptDetails = this.list(lambdaDetails); + // 判断入库明细是否为空 + if (receiptDetails.isEmpty()){ + throw new ServiceException("不存在入库明细"); + } //查询出头表信息 ReceiptHeader receiptHeader = receiptHeaderService.getById(id); Integer minStatus = Integer.parseInt(receiptDetails.get(0).getProcessStamp()); + Integer maxStatus = Integer.parseInt(receiptDetails.get(0).getProcessStamp()); //遍历明细状态得出最小状态值 for (int i = 1; i<receiptDetails.size(); i++){ - if ( minStatus > Integer.parseInt(receiptDetails.get(1).getProcessStamp())) { - minStatus = Integer.parseInt(receiptDetails.get(1).getProcessStamp()); + if ( minStatus > Integer.parseInt(receiptDetails.get(i).getProcessStamp())) { + minStatus = Integer.parseInt(receiptDetails.get(i).getProcessStamp()); + } + if ( maxStatus < Integer.parseInt(receiptDetails.get(i).getProcessStamp())) { + maxStatus = Integer.parseInt(receiptDetails.get(i).getProcessStamp()); } } + //从数据字典中获取单据当前状态 List<DictData> dictData = dictDataService.selectDictDataByType("receiptHeaderStatus"); for (int i = 0; i<dictData.size(); i++){ @@ -264,8 +321,8 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R //若更新状态值小于头状态,更新尾状态否则更新头尾状态 if (minStatus < receiptHeader.getFirstStatus()){ receiptHeader.setLastStatus(minStatus); - } else { - receiptHeader.setFirstStatus(minStatus); + } if (maxStatus > receiptHeader.getFirstStatus()){ + receiptHeader.setFirstStatus(maxStatus); receiptHeader.setLastStatus(minStatus); receiptHeaderService.updateById(receiptHeader); } @@ -297,7 +354,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R lambda.eq(ReceiptDetail::getReceiptId, id); List<ReceiptDetail> receiptDetails = this.list(lambda); for (ReceiptDetail receiptDetail : receiptDetails){ - receiptDetail.setProcessStamp("100"); + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POOL.toString()); receiptDetail = this.queryflow(receiptDetail); if (!this.updateById(receiptDetail)){ throw new ServiceException("更新入库明细表失败"); @@ -308,4 +365,35 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R } return AjaxResult.success("审核完成"); } + + @Override + public List<TaskDetail> getReceiptQtyLast7Days() { + return receiptDetailMapper.getReceiptQtyLast7Days(); + } + + @Override + public List<TaskDetail> getWarehouseReceipt() { + return receiptDetailMapper.getWarehouseReceipt(); + } + + @Override + public List<TaskDetail> getCompanyReceipt() { + return receiptDetailMapper.getCompanyReceipt(); + } + + /** + * 判断明细中是否质检 + */ + public boolean inspection(ReceiptDetail receiptDetail){ + //如果明细中需要质检,则判断是否已经生成质检单 + if ("0".equals(receiptDetail.getQcCheck())){ + LambdaQueryWrapper<CheckHeader> lambda = Wrappers.lambdaQuery(); + lambda.eq(CheckHeader::getCode, receiptDetail.getReceiptCode()); + CheckHeader checkHeader = checkHeaderService.getOne(lambda); + if (checkHeader == null){ + return true; + } + } + return false; + } } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/AdminReceiptHeaderController.java b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/AdminReceiptHeaderController.java new file mode 100644 index 0000000..6f4bc92 --- /dev/null +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/AdminReceiptHeaderController.java @@ -0,0 +1,84 @@ +package com.huaheng.pc.receipt.receiptHeader.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; +import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.List; + + +/** + * 入库单主 信息操作处理 + * + * @author huaheng + * @date 2019-05-21 + */ +@Controller +@RequestMapping("/admin/receiptHeader") +public class AdminReceiptHeaderController extends BaseController +{ + + + private String prefix = "admin/receiptHeader"; + + @Autowired + private ReceiptHeaderService receiptHeaderService; + + @GetMapping() + public String receiptHeader() + { + return prefix + "/receiptHeader"; + } + + /** + * 查询入库单主列表 + */ + @Log(title = "入库-入库单", operating = "查看入库主单列表", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ReceiptHeader receiptHeader, String time) + { + startPage(); + LambdaQueryWrapper<ReceiptHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper + .in(StringUtils.isNotEmpty(receiptHeader.getCompanyCode()),ReceiptHeader::getCompanyCode, receiptHeader.getCompanyCode()) + .eq(StringUtils.isNotEmpty(receiptHeader.getWarehouseCode()),ReceiptHeader::getWarehouseCode, receiptHeader.getWarehouseCode()) + .eq(StringUtils.isNotEmpty(receiptHeader.getReceiptType()), + ReceiptHeader::getReceiptType, receiptHeader.getReceiptType()) + .eq(StringUtils.isNotEmpty(receiptHeader.getCode()), ReceiptHeader::getCode, receiptHeader.getCode()) + .eq(StringUtils.isNotNull(receiptHeader.getFirstStatus()), + ReceiptHeader::getFirstStatus, receiptHeader.getFirstStatus()) + .eq(StringUtils.isNotNull(receiptHeader.getLastStatus()), + ReceiptHeader::getLastStatus, receiptHeader.getLastStatus()) + .orderByDesc(ReceiptHeader::getCreated); + List<ReceiptHeader> list = new ArrayList<>(); + if(StringUtils.isEmpty(time)) { + list=receiptHeaderService.list(); + }else { + list=receiptHeaderService.selectListByCreated(); + } + return getDataTable(list); + } + + @PostMapping("/getReceiptHeader") + @ResponseBody + public AjaxResult<ReceiptHeader> getShipmentHeader(int id){ + return AjaxResult.success(receiptHeaderService.getById(id)); + } +} diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java index aa58591..f24608c 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeader/controller/ReceiptHeaderController.java @@ -161,7 +161,7 @@ public class ReceiptHeaderController extends BaseController { * 审核入库单 */ @ApiOperation(value="审核入库单", notes="审核入库单", httpMethod = "POST") - @RequiresPermissions("receipt:receiptHeader:approval") + @RequiresPermissions("receipt:receiptHeader:review") @Log(title = "入库-入库单 ",operating = "审核入库单 ", action = BusinessType.UPDATE) @PostMapping("/approval") @ResponseBody @@ -303,4 +303,19 @@ public class ReceiptHeaderController extends BaseController { } return AjaxResult.success(receiptHeaderService.arrivalNotice(id)); } + + /** + * 加入订单池 + */ + @ApiOperation(value="加入订单池 ", notes="加入订单池 ", httpMethod = "POST") + @RequiresPermissions("receipt:receiptHeader:addPool") + @Log(title = "入库-入库单 ",operating = "加入订单池 ", action = BusinessType.OTHER) + @PostMapping("/addPool") + @ResponseBody + public AjaxResult addPool(String ids) { + if (StringUtils.isEmpty(ids)){ + return AjaxResult.error("id不能为空"); + } + return AjaxResult.success(receiptHeaderService.addPool(ids)); + } } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeader/mapper/ReceiptHeaderMapper.java b/src/main/java/com/huaheng/pc/receipt/receiptHeader/mapper/ReceiptHeaderMapper.java index d53a5e1..5de0b59 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeader/mapper/ReceiptHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeader/mapper/ReceiptHeaderMapper.java @@ -3,5 +3,10 @@ package com.huaheng.pc.receipt.receiptHeader.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; +import java.util.List; + public interface ReceiptHeaderMapper extends BaseMapper<ReceiptHeader> { + + List<ReceiptHeader> selectListByCreated(); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java b/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java index 6caedf1..29f1d02 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeader/service/ReceiptHeaderService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.StringUtils; @@ -24,10 +25,12 @@ import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailServiceImpl; import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import com.huaheng.pc.receipt.receiptHeader.mapper.ReceiptHeaderMapper; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.lang.ref.WeakReference; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; import java.util.List; @@ -44,6 +47,8 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei private CheckDetailService checkDetailService; @Resource private SendMailService sendMailService; + @Resource + private ReceiptHeaderMapper receiptHeaderMapper; /** * 保存入库单 @@ -52,7 +57,8 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei */ public AjaxResult saveReceiptHeader(ReceiptHeader receiptHeader){ LambdaQueryWrapper<ReceiptType> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(ReceiptType::getCode, receiptHeader.getReceiptType()); + lambdaQueryWrapper.eq(ReceiptType::getCode, receiptHeader.getReceiptType()) + .eq(ReceiptType::getWarehouseCode, ShiroUtils.getWarehouseCode()); ReceiptType receiptType = receiptTypeService.getOne(lambdaQueryWrapper); //流程详情查询 @@ -65,8 +71,8 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei String code = createCode(receiptHeader.getReceiptType()); receiptHeader.setCode(code); - receiptHeader.setFirstStatus(0); - receiptHeader.setLastStatus(0); + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_BUILD); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_BUILD); receiptHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); receiptHeader.setCreatedBy(ShiroUtils.getLoginName()); receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); @@ -111,7 +117,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei List<ReceiptDetail> receiptDetails = receiptDetailService.list(receiptDetailLambda); //更新入库明细流程 for (ReceiptDetail receiptDetail : receiptDetails) { - receiptDetail.setProcessStamp("120"); + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_RESERVATION.toString()); if (!receiptDetailService.updateById(receiptDetail)){ throw new ServiceException("更新入库明细处理标记失败"); } @@ -137,7 +143,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei public AjaxResult arrival(Integer id) { LambdaQueryWrapper<ReceiptDetail> receiptDetailLambda = Wrappers.lambdaQuery(); receiptDetailLambda.eq(ReceiptDetail::getReceiptId, id) - .eq(ReceiptDetail::getProcessStamp, "150"); + .eq(ReceiptDetail::getProcessStamp, QuantityConstant.RECEIPT_HEADER_ARRIVAL.toString()); List<ReceiptDetail> receiptDetails = receiptDetailService.list(receiptDetailLambda); //更新入库明细流程 for (ReceiptDetail receiptDetail : receiptDetails) { @@ -158,19 +164,26 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei receiptDetailLambda.eq(ReceiptDetail::getReceiptId, id); List<ReceiptDetail> receiptDetails = receiptDetailService.list(receiptDetailLambda); + //判断是否已经生成了质检单 + LambdaQueryWrapper<CheckHeader> checkHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); + checkHeaderLambdaQueryWrapper.eq(CheckHeader::getCode, receiptHeader.getCode()); + CheckHeader checkHeaderQuery = checkHeaderService.getOne(checkHeaderLambdaQueryWrapper); + if (checkHeaderQuery != null){ + throw new ServiceException("质检单已生成"); + } //创建质检头表 CheckHeader checkHeader = new CheckHeader(); checkHeader.setCode(receiptHeader.getCode()); - checkHeader.setType("100"); + checkHeader.setType(QuantityConstant.CHECK_TYPE_RECEIPT.toString()); checkHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); checkHeader.setReferCode(receiptHeader.getReferCode()); checkHeader.setEnable(1); - checkHeader.setStatus("0"); + checkHeader.setStatus(QuantityConstant.CHECK_STATUS_BUILD.toString()); checkHeader.setCreatedBy(ShiroUtils.getLoginName()); checkHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); if (!checkHeaderService.save(checkHeader)){ - throw new ServiceException("添加质检头表发送错误"); + throw new ServiceException("添加质检头表错误"); } //查询保存后的质检头表 @@ -191,7 +204,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei checkDetail.setMaterialUnit(receiptDetail.getMaterialUnit()); checkDetail.setCompanyCode(receiptDetail.getCompanyCode()); checkDetail.setInventorySts(receiptDetail.getInventorySts()); - checkDetail.setStatus("0"); + checkDetail.setStatus(QuantityConstant.CHECK_STATUS_BUILD.toString()); checkDetail.setQty(receiptDetail.getTotalQty()); checkDetail.setCheckBy(ShiroUtils.getLoginName()); checkDetail.setCreatedBy(ShiroUtils.getLoginName()); @@ -213,11 +226,11 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei Integer[] idArray = Convert.toIntArray(ids); for (int i = 0; i<idArray.length; i++){ ReceiptHeader receiptHeader = this.getById(idArray[i]); - if (receiptHeader.getFirstStatus()>5||receiptHeader.getLastStatus()>5){ + if (receiptHeader.getFirstStatus()>QuantityConstant.RECEIPT_HEADER_MODERATED ||receiptHeader.getLastStatus()>QuantityConstant.RECEIPT_HEADER_MODERATED){ return AjaxResult.error("单据号为"+receiptHeader.getCode()+"入库单不需要审核"); } - receiptHeader.setFirstStatus(5); - receiptHeader.setLastStatus(5); + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_MODERATED); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_MODERATED); if (!this.updateById(receiptHeader)){ throw new ServiceException("更新入库头表失败"); } else { @@ -237,7 +250,7 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei lambda.eq(ReceiptDetail::getReceiptId, id); List<ReceiptDetail> receiptDetails = receiptDetailService.list(lambda); for (ReceiptDetail receiptDetail : receiptDetails) { - receiptDetail.setProcessStamp(String.valueOf(150)); + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_ARRIVAL.toString()); receiptDetailService.updateById(receiptDetail); if (!receiptDetailService.updateById(receiptDetailService.queryflow(receiptDetail))){ throw new ServiceException("更新入库明细处理标记出错"); @@ -246,4 +259,46 @@ public class ReceiptHeaderService extends ServiceImpl<ReceiptHeaderMapper, Recei } return AjaxResult.success(""); } + + /** + * 加入订单池 + * @param ids 头表id字符串 + * @return + */ + @Transactional + public AjaxResult addPool(String ids){ + List<Integer> idList = Arrays.asList(Convert.toIntArray(ids)); + for (Integer id : idList){ + LambdaQueryWrapper<ReceiptDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ReceiptDetail::getReceiptId, id); + List<ReceiptDetail> list = receiptDetailService.list(lambdaQueryWrapper); + if (list.size() != 0){ + for (ReceiptDetail receiptDetail : list){ + if (Integer.parseInt(receiptDetail.getProcessStamp()) < QuantityConstant.RECEIPT_HEADER_POOL){ + //判断入库明细是否需要审核 + ReceiptDetail beforeReceiptDetail = receiptDetailService.queryflow(receiptDetail); + if (Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 5 || Integer.parseInt(beforeReceiptDetail.getProcessStamp()) == 100){ + throw new ServiceException("请先提交审核"); + } + //加入订单池 + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POOL.toString()); + ReceiptDetail receiptDetail1 = receiptDetailService.queryflow(receiptDetail); + if (!receiptDetailService.updateById(receiptDetail1)){ + throw new ServiceException("更新入库明细状态失败"); + } + } else { + throw new ServiceException("已有入库明细进入订单池"); + } + } + } + //更新头表状态 + receiptDetailService.updateReceiptHeaderLastStatus(id); + } + return AjaxResult.success("加入成功"); + } + + + public List<ReceiptHeader> selectListByCreated() { + return receiptHeaderMapper.selectListByCreated(); + } } diff --git a/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java b/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java index 1d7eb5e..ec1111e 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java +++ b/src/main/java/com/huaheng/pc/receipt/receiptHeaderHistory/service/ReceiptHeaderHistoryService.java @@ -2,6 +2,7 @@ package com.huaheng.pc.receipt.receiptHeaderHistory.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -37,8 +38,8 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor public AjaxResult add(Integer id){ ReceiptHeader receiptHeader = receiptHeaderService.getById(id); if (receiptHeader == null) return AjaxResult.success(""); - if((receiptHeader.getFirstStatus()>=800 && receiptHeader.getLastStatus()>=800)|| - (receiptHeader.getFirstStatus()<100 &receiptHeader.getLastStatus()<100)){ + if((receiptHeader.getFirstStatus()>= QuantityConstant.RECEIPT_HEADER_POSTING && receiptHeader.getLastStatus()>=QuantityConstant.RECEIPT_HEADER_POSTING)|| + (receiptHeader.getFirstStatus()<QuantityConstant.RECEIPT_HEADER_POOL &receiptHeader.getLastStatus()<QuantityConstant.RECEIPT_HEADER_POOL)){ ReceiptHeaderHistory receiptHeaderHistory = new ReceiptHeaderHistory(); List<ReceiptDetailHistory> receiptDetailHistoryList = new ArrayList<>(); //查询入库单明细 @@ -63,16 +64,19 @@ public class ReceiptHeaderHistoryService extends ServiceImpl<ReceiptHeaderHistor if (!receiptHeaderService.removeById(receiptHeader.getId())){ throw new ServiceException("删除头表失败"); } - //删除入库明细 - List<Integer> ids = new ArrayList<>(); - for (int i=0; i<receiptDetailHistoryList.size();i++){ - receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName()); - ids.add(receiptDetailHistoryList.get(i).getId()); - } - if (!receiptDetailService.removeByIds(ids)) { - throw new ServiceException("删除明细表失败"); + // 当存在明细时删除 + if (list.size()!= 0){ + //删除入库明细 + List<Integer> ids = new ArrayList<>(); + for (int i=0; i<receiptDetailHistoryList.size();i++){ + receiptDetailHistoryList.get(i).setLastUpdatedBy(ShiroUtils.getLoginName()); + ids.add(receiptDetailHistoryList.get(i).getId()); + } + if (!receiptDetailService.removeByIds(ids)) { + throw new ServiceException("删除明细表失败"); + } + receiptDetailHistoryService.saveBatch(receiptDetailHistoryList); } - receiptDetailHistoryService.saveBatch(receiptDetailHistoryList); this.save(receiptHeaderHistory); }else { return AjaxResult.success("入库单没有完成,无法删除"); diff --git a/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java b/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java index ac39e43..a45bbb9 100644 --- a/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java +++ b/src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java @@ -2,13 +2,13 @@ package com.huaheng.pc.receipt.receiving.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; -import com.huaheng.pc.config.FilterConfigHeader.domain.FilterConfigHeader; import com.huaheng.pc.config.configValue.domain.ConfigValue; import com.huaheng.pc.config.configValue.service.ConfigValueService; import com.huaheng.pc.config.location.domain.Location; @@ -25,7 +25,6 @@ import com.huaheng.pc.receipt.receiptContainerHeader.domain.ReceiptContainerHead import com.huaheng.pc.receipt.receiptContainerHeader.service.ReceiptContainerHeaderService; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; -import org.aspectj.weaver.loadtime.Aj; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -84,15 +83,14 @@ public class ReceivingService { @Transactional public Boolean position(ReceiptContainerDetail receiptContainerDetail){ ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); - if (!(0 ==receiptContainerHeader.getStatus())){ + if (0 != receiptContainerHeader.getStatus()){ throw new ServiceException("该入库组盘已生成任务不能重新定位"); } //如果入库组盘表中有目标库位说明已经指定 if (StringUtils.isNotEmpty(receiptContainerHeader.getToLocation())){return true;} - String locatingRule = receiptContainerHeader.getLocatingRule(); //定位规则 - if (StringUtils.isNotEmpty(locatingRule)){ - //入库组盘头表中定位规则不为空时执行 - } else if (locatingRule == null){ + //定位规则 + String locatingRule = receiptContainerHeader.getLocatingRule(); + if (StringUtils.isEmpty(locatingRule)){ locatingRule = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()).getLocatingRule(); //入库单明细定位规则不为空时执行 if (StringUtils.isEmpty(locatingRule)){ @@ -112,11 +110,12 @@ public class ReceivingService { //物料类别中定位规则为空时,查询入库首选项 LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery(); configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode()) - .eq(ConfigValue::getModuleType, "入库") + .eq(ConfigValue::getModuleType, "receipt") .eq(ConfigValue::getRecordType, "入库首选项"); ConfigValue configValue = configValueService.getOne(configValueLambda); LambdaQueryWrapper<ReceiptPreference> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(ReceiptPreference::getCode, configValue.getValue()); + lambdaQueryWrapper.eq(ReceiptPreference::getCode, configValue.getValue()) + .eq(ReceiptPreference::getWarehouseCode, ShiroUtils.getWarehouseCode()); ReceiptPreference receiptPreference = preferenceService.getOne(lambdaQueryWrapper); locatingRule = preferenceService.getOne(lambdaQueryWrapper).getLocationRule(); } @@ -128,12 +127,14 @@ public class ReceivingService { throw new ServiceException("未绑定定位规则"); } LambdaQueryWrapper<FilterConfigDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(FilterConfigDetail::getCode, locatingRule); + lambdaQueryWrapper.eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(FilterConfigDetail::getCode, locatingRule); FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(lambdaQueryWrapper); //根据定位规则查询库位编码 LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery(); - locationLambda.last(filterConfigDetail.getStatement()); + locationLambda.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .last(filterConfigDetail.getStatement()); String locationCode = locationService.getOne(locationLambda).getCode(); if (locationCode == null){ throw new ServiceException("没有库位可分配"); @@ -147,6 +148,7 @@ public class ReceivingService { //更新库位编码到组盘头表 receiptContainerHeader.setToLocation(locationCode); + receiptContainerHeader.setRecvDock("0"); if (!receiptContainerHeaderService.updateById(receiptContainerHeader)){ throw new ServiceException("更新库位失败"); } @@ -178,7 +180,7 @@ public class ReceivingService { public AjaxResult cancelPosition(ReceiptContainerDetail receiptContainerDetail){ //查询入库组盘头 ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); - if (!(receiptContainerHeader.getStatus() == 0)){ + if (!(receiptContainerHeader.getStatus().shortValue() == QuantityConstant.RECEIPT_CONTAINER_BUILD)){ throw new ServiceException("组盘已生成任务不能取消定位"); } //将入库组盘头表中的而库位编码赋值null @@ -200,7 +202,7 @@ public class ReceivingService { //回滚入库明细状态 ReceiptDetail receiptDetail = receiptDetailService.getById(receiptContainerDetail.getReceiptDetailId()); - receiptDetail.setProcessStamp("240"); + receiptDetail.setProcessStamp(QuantityConstant.RECEIPT_HEADER_POSITION.toString()); if ( !receiptDetailService.updateById(receiptDetail)){ throw new ServiceException("回滚入库明细状态失败"); } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java index e414571..8b94a72 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shipmentContainerHeader.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -131,17 +132,6 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont if (location == null) { throw new ServiceException("库位 " + inventoryDetail.getLocationCode() + " 不存在"); } -// if (location.getStatus().equals("lock")) { -// //如果库位状态是锁定的话,就查找出库组盘表,如果存在未下发 -// LambdaQueryWrapper<ShipmentContainerHeader> lam=Wrappers.lambdaQuery(); -// lam.eq(ShipmentContainerHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) -// .eq(ShipmentContainerHeader::getContainerCode,location.getContainerCode()) -// .eq(ShipmentContainerHeader::getTaskCreated,0); -// ShipmentContainerHeader shipmentContainerHeader = this.getOne(lam); -// if (shipmentContainerHeader == null) { -// throw new ServiceException("库位已经锁定不能使用"); -// } -// } //2.更新库存分配数 inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().add(shipmentCombinationModel.getShipQty())); @@ -155,9 +145,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont shipmentDetail.setRequestQty(shipmentDetail.getRequestQty().add(shipmentCombinationModel.getShipQty())); int i = shipmentDetail.getShipQty().compareTo(shipmentDetail.getRequestQty()); if(i > 0){ - shipmentDetail.setStatus(200); + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); }else if(i == 0){ - shipmentDetail.setStatus(300); + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); }else if(i < 0){ throw new ServiceException("出库数量不能大于单据数量!"); } @@ -166,9 +156,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont //自动判定出库任务状态,根据库存数量减去预定库存相等就是整盘出--预计任务状态 BigDecimal inventoryQty = inventoryDetail.getQty().subtract(inventoryDetail.getTaskQty()); if(inventoryQty.compareTo(new BigDecimal(0)) <= 0) { - shipmentCombinationModel.setTaskType(300); + shipmentCombinationModel.setTaskType(QuantityConstant.TASK_TYPE_WHOLESHIPMENT); } else { - shipmentCombinationModel.setTaskType(400); + shipmentCombinationModel.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); } //5.增加出库组盘头 @@ -198,7 +188,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont lambdaQueryWrapper.eq(ShipmentContainerHeader::getLocationCode,location.getCode()) .eq(ShipmentContainerHeader::getContainerCode,location.getContainerCode()) .eq(ShipmentContainerHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) - .le(ShipmentContainerHeader::getStatus,20); + .le(ShipmentContainerHeader::getStatus,QuantityConstant.SHIPMENT_CONTAINER_FINISHED); ShipmentContainerHeader shipmentContainerHeader = this.getOne(lambdaQueryWrapper); if(shipmentContainerHeader != null) { return shipmentContainerHeader; @@ -219,7 +209,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont shipmentContainerHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); shipmentContainerHeader.setCompanyCode(shipmentDetail.getCompanyCode()); shipmentContainerHeader.setContainerType(container.getContainerType()); - shipmentContainerHeader.setStatus(0); + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); shipmentContainerHeader.setTaskCreated(0); shipmentContainerHeader.setCreatedBy(ShiroUtils.getLoginName()); Boolean flag = this.save(shipmentContainerHeader); @@ -292,7 +282,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont shipmentContainerDetaill.setQty(shipmentCombinationModel.getShipQty()); shipmentContainerDetaill.setWaveId(shipmentDetail.getWaveId()); shipmentContainerDetaill.setTaskCreated(0); - shipmentContainerDetaill.setStatus(0); + shipmentContainerDetaill.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); shipmentContainerDetaill.setBatch(shipmentDetail.getBatch()); shipmentContainerDetaill.setLot(shipmentDetail.getLot()); shipmentContainerDetaill.setProjectNo(shipmentDetail.getProjectNo()); @@ -305,10 +295,10 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont //4.查看组盘头状态,如果状态在10到20,则生成任务明细或修改任务明细的数量 //查看任务头 - if(shipmentContainerHeader.getStatus()>=10 && shipmentContainerHeader.getStatus()<30){ + if(shipmentContainerHeader.getStatus()>=QuantityConstant.SHIPMENT_CONTAINER_TASK && shipmentContainerHeader.getStatus()<QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS){ LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper=Wrappers.lambdaQuery(); taskHeaderLambdaQueryWrapper.eq(TaskHeader::getWarehouseCode,shipmentContainerHeader.getWarehouseCode()) - .eq(TaskHeader::getInternalTaskType,200) + .eq(TaskHeader::getInternalTaskType,QuantityConstant.TASK_INTENERTYPE_PICKING) .eq(TaskHeader::getAllocationHeadId,shipmentContainerHeader.getId()); TaskHeader taskHeader=taskHeaderService.getOne(taskHeaderLambdaQueryWrapper); if(taskHeader==null){ @@ -322,7 +312,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont taskDetailLam.eq(TaskDetail::getWarehouseCode,shipmentContainerDetail.getWarehouseCode()) .eq(TaskDetail::getAllocationId,shipmentContainerDetail.getId()) .eq(TaskDetail::getTaskId,taskHeader.getId()) - .eq(TaskDetail::getInternalTaskType,200); + .eq(TaskDetail::getInternalTaskType,QuantityConstant.TASK_INTENERTYPE_PICKING); TaskDetail taskDetail = taskDetailService.getOne(taskDetailLam); if(taskDetail == null){ throw new ServiceException("找不到对应的任务明细"); @@ -356,10 +346,10 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont taskDetail.setWaveId(shipmentContainerDetaill.getWaveId()); taskDetail.setBatch(shipmentContainerDetaill.getBatch()); taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo()); - if (shipmentContainerHeader.getStatus() == 10) { - taskDetail.setStatus(0); + if (shipmentContainerHeader.getStatus() == QuantityConstant.SHIPMENT_CONTAINER_TASK) { + taskDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); } else { - taskDetail.setStatus(10); + taskDetail.setStatus(QuantityConstant.TASK_STATUS_RELEASE); } taskDetail.setCreatedBy(ShiroUtils.getLoginName()); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); @@ -399,7 +389,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont for(ShipmentContainerDetail shipmentContainerDetail:shipmentContainerDetails){ //获取头 ShipmentContainerHeader shipmentContainerHeader = this.getById(shipmentContainerDetail.getShippingContainerId()); - if(shipmentContainerHeader.getStatus()>9){ + if(shipmentContainerHeader.getStatus()>= QuantityConstant.SHIPMENT_CONTAINER_TASK){ return AjaxResult.error("容器"+shipmentContainerHeader.getContainerCode()+"非新建状态,不允许取消明细"); } //恢复占用库存 @@ -410,9 +400,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont ShipmentDetail shipmentDetail = shipmentDetailService.getById(shipmentContainerDetail.getShipmentDetailId()); shipmentDetail.setRequestQty(shipmentDetail.getRequestQty().subtract(shipmentContainerDetail.getQty())); if(shipmentDetail.getRequestQty().compareTo(BigDecimal.ZERO) != 0 ){ - shipmentDetail.setStatus(200);//明细状态恢复,如果删除后还有以出数量就是波次 + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAVE);//明细状态恢复,如果删除后还有以出数量就是波次 }else{ - shipmentDetail.setStatus(100 );//明细状态 + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL );//明细状态 } shipmentDetailService.saveOrUpdate(shipmentDetail); //删除这个配盘明细 @@ -481,6 +471,11 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont if (shipmentDetailList.size() < 1 || shipmentDetailList == null) { return AjaxResult.error("找不到子单链"); } + for(ShipmentDetail shipmentDetail: shipmentDetailList){ + if(shipmentDetail.getWaveId() != 0){ + return AjaxResult.error(shipmentCode+"单号已加入波次"+shipmentDetail.getWaveId()+",无法自动组盘"); + } + } return this.autoCombination(shipmentDetailList); } @@ -506,9 +501,9 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont List<InventoryDetail> inventoryList = shippingCombinationService.getInventorys(item); if(inventoryList.size() < 1 && item.getWaveId() != 0){ Wave wave = waveService.getById(item.getWaveId()); - wave.setStatus(999); + wave.setStatus(QuantityConstant.WAVE_STATUS_FAILED); waveService.updateById(wave); - return AjaxResult.error("主单为"+item.getShipmentCode()+"子单id为"+item.getId() + "的单据没有库存,波次失败"); + throw new ServiceException("主单为"+item.getShipmentCode()+"子单id为"+item.getId() + "的单据没有库存,波次失败"); } if (inventoryList.size() < 1) { num = num + 1; @@ -523,7 +518,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont ShipmentCombinationModel shipmentCombination = new ShipmentCombinationModel(); shipmentCombination.setInventoryDetailId(inventory.getId()); shipmentCombination.setShipmentDetailId(item.getId()); - shipmentCombination.setType((short) 300); + shipmentCombination.setType((short) QuantityConstant.TASK_TYPE_WHOLESHIPMENT.intValue()); //如果库存数 >= 待出库数,组盘数就是待出库数并且结束组盘,否则组盘数就是库存数 if (inventoryQty.compareTo(shipmentQty) > -1) { @@ -554,7 +549,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont public AjaxResult checkForCancelCombination(List<Integer> shipmentContainerIds) { for(int id : shipmentContainerIds){ ShipmentContainerHeader shipmentContainerHeader = this.getById(id); - if(shipmentContainerHeader.getStatus()>9){ + if(shipmentContainerHeader.getStatus()>=QuantityConstant.SHIPMENT_CONTAINER_TASK){ return AjaxResult.error("存在已生成任务的记录,请先取消任务再取消组盘"); } } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/AdminShipmentDetailController.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/AdminShipmentDetailController.java new file mode 100644 index 0000000..6344a59 --- /dev/null +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/AdminShipmentDetailController.java @@ -0,0 +1,60 @@ +package com.huaheng.pc.shipment.shipmentDetail.controller; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; +import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 出库明细 信息操作处理 + * + * @author huaheng + * @date 2018-08-19 + */ +@Controller +@RequestMapping("/admin/shipmentDetail") +public class AdminShipmentDetailController extends BaseController +{ + private String prefix = "admin/shipmentDetail"; + + @Autowired + private ShipmentDetailService shipmentDetailService; + + @GetMapping("/{shipmentId}/{shipmentCode}") + public String shipmentDetail(@PathVariable("shipmentId") String shipmentId, @PathVariable("shipmentCode") String shipmentCode,@PathVariable("inventoryStatus") String inventoryStatus, ModelMap mmap) + { + mmap.put("receiptId", shipmentId); + mmap.put("shipmentCode", shipmentCode); + mmap.put("inventoryStatus",inventoryStatus); + return prefix + "/shipmentDetail"; + } + + /** + * 查询出库明细列表 + */ + @Log(title = "出库-出库单", operating= "查看出库明细", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ShipmentDetail shipmentDetail) + { + startPage(); + LambdaQueryWrapper<ShipmentDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(StringUtils.isNotNull(shipmentDetail.getShipmentId()), ShipmentDetail::getShipmentId, shipmentDetail.getShipmentId()); + List<ShipmentDetail> list = shipmentDetailService.list(lambdaQueryWrapper) ; + return getDataTable(list); + } + + +} diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java index 28959b5..41ca620 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/controller/ShipmentDetailController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.huaheng.common.support.Convert; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.aspectj.lang.annotation.Log; @@ -144,6 +145,9 @@ public class ShipmentDetailController extends BaseController @ResponseBody public AjaxResult editSave(ShipmentDetail shipmentDetail) { + if(shipmentDetail.getStatus()>100 ){ + return AjaxResult.error("超过订单池,出库明细不能修改"); + } if(shipmentDetailService.saveOrUpdate(shipmentDetail)==false){ return AjaxResult.error("出库明细修改失败"); }else { @@ -160,6 +164,18 @@ public class ShipmentDetailController extends BaseController @ResponseBody public AjaxResult remove(String ids) { + if (StringUtils.isEmpty(ids)) + return AjaxResult.error("id不能为空"); + for (Integer id : Convert.toIntArray(ids)) + { + ShipmentDetail shipmentDetail=shipmentDetailService.getById(id); + if(shipmentDetail == null){ + return AjaxResult.error("id为"+id+"的单据明细找不到"); + } + if(shipmentDetail.getStatus()>100 && shipmentDetail.getStatus()<500){ + return AjaxResult.error("此单据状态在订单池和拣货完成之间,无法删除"); + } + } AjaxResult result = shipmentDetailService.deleteDetail(ids); return result; } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/mapper/ShipmentDetailMapper.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/mapper/ShipmentDetailMapper.java index 04e6f78..a27684b 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/mapper/ShipmentDetailMapper.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/mapper/ShipmentDetailMapper.java @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shipmentDetail.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; import java.util.List; import java.util.Map; @@ -16,5 +17,14 @@ public interface ShipmentDetailMapper extends BaseMapper<ShipmentDetail> { Integer countUnCompleted(Integer shipmentId); + Map<String,Integer> selectStatus(Integer id); + //获取7天内的出库量 + List<TaskDetail> getShipmentQtyLast7Days(); + + //以仓库维度获取入库量 + List<TaskDetail> getWarehouseShipment(); + + //以货主维度获取入库量 + List<TaskDetail> getCompanyShipment(); } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java index 1f4896f..2a20547 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailService.java @@ -3,6 +3,11 @@ package com.huaheng.pc.shipment.shipmentDetail.service; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; import com.baomidou.mybatisplus.extension.service.IService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; + +import java.util.List; +import java.util.Map; + public interface ShipmentDetailService extends IService<ShipmentDetail>{ /** @@ -20,5 +25,16 @@ public interface ShipmentDetailService extends IService<ShipmentDetail>{ //选中的单据加入波次 void saveWave(String ids,String code); + Map<String,Integer> selectStatus(Integer id); + + //获取7天内的出库量 + List<TaskDetail> getShipmentQtyLast7Days(); + + //以仓库维度获取入库量 + List<TaskDetail> getWarehouseShipment(); + + //以货主维度获取入库量 + List<TaskDetail> getCompanyShipment(); + } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java index fbd3a31..56e06a5 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetail/service/ShipmentDetailServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shipmentDetail.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.DataUtils; @@ -22,6 +23,7 @@ import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; import com.huaheng.pc.shipment.wave.domain.Wave; import com.huaheng.pc.shipment.wave.service.WaveService; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -72,7 +74,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, if (shipmentHeader == null) { return AjaxResult.error("找不到主单据"); } - if (shipmentHeader.getFirstStatus() > 100) { + if (shipmentHeader.getFirstStatus() > QuantityConstant.SHIPMENT_HEADER_POOL) { //表示已经加入了波次 return AjaxResult.error("主单据状态不允许新增明细"); } @@ -133,7 +135,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, if (list.size() > 1) { return AjaxResult.error("有多个主单据,不能一起删除!"); } - if (list.get(0).get("firstStatus") > 100) { + if (list.get(0).get("status") > QuantityConstant.SHIPMENT_HEADER_POOL) { return AjaxResult.error("单据状进入订单池,不允许删除明细"); } Integer result = shipmentDetailMapper.batchDelete(ids); @@ -173,7 +175,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, @Override @Transactional public void saveWave(String ids, String code) { - Integer status = 100; + Integer status = QuantityConstant.SHIPMENT_HEADER_POOL; List<ShipmentHeader> shipmentHeaderList =shipmentPreferenceService.checkShipmentProcess(ids,status,code); //找到波次主表,看系统是否有此波次 @@ -222,7 +224,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, //查看波次是否建成未执行 LambdaQueryWrapper<Wave> waveLam = Wrappers.lambdaQuery(); - waveLam.eq(Wave::getStatus,0) + waveLam.eq(Wave::getStatus,QuantityConstant.WAVE_STATUS_BUILD) .eq(Wave::getWaveMode,code) .eq(Wave::getWarehouseCode,ShiroUtils.getWarehouseCode()); Wave wave = waveService.getOne(waveLam); @@ -236,11 +238,12 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, }else { //创建波次 + wave=new Wave(); wave.setWarehouseCode(ShiroUtils.getWarehouseCode()); wave.setMasterCode(code); wave.setWaveName(waveMaster.getName()); - wave.setStatus(0); - wave.setCurrentWaveStep("0"); + wave.setStatus(QuantityConstant.WAVE_STATUS_BUILD); + wave.setCurrentWaveStep(QuantityConstant.WAVE_STATUS_BUILD.toString()); wave.setTotalShipments(Convert.toIntArray(ids).length); wave.setTotalLines(shipmentDetailList.size()); wave.setTotalQty(qty); @@ -254,8 +257,8 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, //修改出库子单,加入波次ID,并修改状态为波次 for(ShipmentDetail shipmentDetail :shipmentDetailList){ shipmentDetail.setWaveId(wave.getId()); - if(shipmentDetail.getStatus()<200) { - shipmentDetail.setStatus(200); + if(shipmentDetail.getStatus()<QuantityConstant.SHIPMENT_HEADER_WAVE) { + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); } } @@ -265,7 +268,7 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, } for(ShipmentHeader shipmentHeader :shipmentHeaderList){ - shipmentHeader.setLastStatus(200); + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_WAVE); } flag = shipmentHeaderService.updateBatchById(shipmentHeaderList); if(flag == false){ @@ -273,4 +276,26 @@ public class ShipmentDetailServiceImpl extends ServiceImpl<ShipmentDetailMapper, } } + + + //查看最高状态和最低状态 + @Override + public Map<String,Integer> selectStatus(Integer id) { + return shipmentDetailMapper.selectStatus(id); + } + + @Override + public List<TaskDetail> getShipmentQtyLast7Days() { + return shipmentDetailMapper.getShipmentQtyLast7Days(); + } + + @Override + public List<TaskDetail> getWarehouseShipment() { + return shipmentDetailMapper.getWarehouseShipment(); + } + + @Override + public List<TaskDetail> getCompanyShipment() { + return shipmentDetailMapper.getCompanyShipment(); + } } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/service/ShipmentDetailHistoryServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/service/ShipmentDetailHistoryServiceImpl.java index c7bda6c..23bbc34 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/service/ShipmentDetailHistoryServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/service/ShipmentDetailHistoryServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shipmentDetailHistory.service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.utils.DataUtils; import com.huaheng.common.utils.StringUtils; import com.huaheng.framework.web.domain.AjaxResult; @@ -46,7 +47,7 @@ public class ShipmentDetailHistoryServiceImpl extends ServiceImpl<ShipmentDetail if (list.size() > 1) { return AjaxResult.error("有多个主单据,不能一起删除!"); } - if (list.get(0).get("firstStatus") > 100) { + if (list.get(0).get("firstStatus") > QuantityConstant.SHIPMENT_HEADER_POOL) { return AjaxResult.error("单据状进入订单池,不允许删除明细"); } Integer result = shipmentDetailHistoryMapper.batchDelete(ids); diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/AdminShipmentHeaderController.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/AdminShipmentHeaderController.java new file mode 100644 index 0000000..d6aa3ca --- /dev/null +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/AdminShipmentHeaderController.java @@ -0,0 +1,83 @@ +package com.huaheng.pc.shipment.shipmentHeader.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.common.utils.security.ShiroUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; +import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.List; + + +/** + * 出库单主 信息操作处理 + * + * @author huaheng + * @date 2019-05-21 + */ +@Controller +@RequestMapping("/admin/shipmentHeader") +public class AdminShipmentHeaderController extends BaseController +{ + private String prefix = "admin/shipmentHeader"; + + @Autowired + private ShipmentHeaderService shipmentHeaderService; + @Autowired + + + @GetMapping() + public String shipmentHeader() + { + return prefix + "/shipmentHeader"; + } + + /** + * 查询出库单主列表 + */ + @Log(title = "出库-出库单", operating="查看出库主单", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ShipmentHeader shipmentHeader, String time) + { + startPage(); + LambdaQueryWrapper<ShipmentHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper + .eq(StringUtils.isNotEmpty(shipmentHeader.getWarehouseCode()),ShipmentHeader::getWarehouseCode, shipmentHeader.getWarehouseCode()) + .eq(ShipmentHeader::getDeleted,false) + .in(StringUtils.isNotEmpty(shipmentHeader.getCompanyCode()),ShipmentHeader::getCompanyCode,shipmentHeader.getCompanyCode()) + .eq(StringUtils.isNotEmpty(shipmentHeader.getCode()),ShipmentHeader::getCode,shipmentHeader.getCode()) + .eq(StringUtils.isNotEmpty(shipmentHeader.getShipmentType()),ShipmentHeader::getShipmentType,shipmentHeader.getShipmentType()) + .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCode()), ShipmentHeader::getReferCode, shipmentHeader.getReferCode()) + .eq(StringUtils.isNotEmpty(shipmentHeader.getReferCodeType()), ShipmentHeader::getReferCodeType, shipmentHeader.getReferCodeType()) + .eq(shipmentHeader.getFirstStatus()!=null, ShipmentHeader::getFirstStatus, shipmentHeader.getFirstStatus()) + .eq(shipmentHeader.getLastStatus()!=null, ShipmentHeader::getLastStatus, shipmentHeader.getLastStatus()) + .orderByDesc(ShipmentHeader::getId); + List<ShipmentHeader> list = new ArrayList<>(); + if(StringUtils.isEmpty(time)) { + list=shipmentHeaderService.list(lambdaQueryWrapper); + }else { + list=shipmentHeaderService.selectListByCreated(); + } + return getDataTable(list); + } + + @PostMapping("/getShipmentHeader") + @ResponseBody + public AjaxResult<ShipmentHeader> getShipmentHeader(int id){ + return AjaxResult.success(shipmentHeaderService.getById(id)); + } +} diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java index d79317a..8a5be9b 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -168,6 +168,12 @@ public class ShipmentHeaderController extends BaseController for (Integer id : Convert.toIntArray(ids)) { ShipmentHeader shipmentHeader=shipmentHeaderService.getById(id); + if(shipmentHeader == null){ + return AjaxResult.error("id为"+id+"的主单单据找不到"); + } + if(shipmentHeader.getFirstStatus()>100 && shipmentHeader.getFirstStatus()<500){ + return AjaxResult.error("此单据状态在订单池和拣货完成之间,无法删除"); + } //出库单设定为历史出库单,并删除出库单 shipmentHeaderService.addHistory(shipmentHeader); diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/mapper/ShipmentHeaderMapper.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/mapper/ShipmentHeaderMapper.java index 5f54714..4378888 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/mapper/ShipmentHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/mapper/ShipmentHeaderMapper.java @@ -3,6 +3,8 @@ package com.huaheng.pc.shipment.shipmentHeader.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; +import java.util.List; + public interface ShipmentHeaderMapper extends BaseMapper<ShipmentHeader> { /** @@ -11,4 +13,6 @@ public interface ShipmentHeaderMapper extends BaseMapper<ShipmentHeader> { */ String createCode(String shipmentType); + List<ShipmentHeader> selectListByCreated(); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderService.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderService.java index e793c9d..652684e 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderService.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderService.java @@ -5,6 +5,7 @@ import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; import com.baomidou.mybatisplus.extension.service.IService; import java.lang.reflect.InvocationTargetException; +import java.util.List; public interface ShipmentHeaderService extends IService<ShipmentHeader>{ @@ -22,4 +23,7 @@ public interface ShipmentHeaderService extends IService<ShipmentHeader>{ //审核出库单 AjaxResult review(String ids); + List<ShipmentHeader> selectListByCreated(); + + } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java index 4a8bd03..650912c 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java @@ -2,6 +2,7 @@ package com.huaheng.pc.shipment.shipmentHeader.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.security.ShiroUtils; @@ -15,9 +16,11 @@ import com.huaheng.pc.shipment.shipmentHeaderHistory.domain.ShipmentHeaderHistor import com.huaheng.pc.shipment.shipmentHeaderHistory.service.ShipmentHeaderHistoryService; import com.huaheng.pc.system.dict.service.IDictDataService; import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.collections4.QueueUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.xml.namespace.QName; import java.lang.reflect.InvocationTargetException; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -58,8 +61,8 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, } String code = createCode(shipmentHeader.getShipmentType()); shipmentHeader.setId(null); - shipmentHeader.setFirstStatus(0); - shipmentHeader.setLastStatus(0); + shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_BUILD); + shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_BUILD); shipmentHeader.setLastUpdated(null); shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); shipmentHeader.setCreated(null); @@ -106,28 +109,29 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, Map<String,Integer> map = shipmentContainerHeaderService.getShipmentContainerMaxAndMinStatusByShipmentID(shipmentId); if(map==null){ //说明没有货箱,则直接首位均为新建 - shipmentHeader.setFirstStatus(100); - shipmentHeader.setLastStatus(100); + shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POOL); + shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POOL); + this.saveOrUpdate(shipmentHeader); }else { int firstStatus = map.get("maxStatus"); int lastStatus = map.get("minStatus"); - if(firstStatus<=20){ - shipmentHeader.setFirstStatus(300); + if(firstStatus<=QuantityConstant.SHIPMENT_CONTAINER_FINISHED){ + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); } - if(firstStatus==30){ - shipmentHeader.setFirstStatus(500); + if(firstStatus==QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS){ + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); } - if(lastStatus <=20){ - shipmentHeader.setLastStatus(300); + if(lastStatus <=QuantityConstant.SHIPMENT_CONTAINER_FINISHED){ + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_GROUPDISK); } - if(lastStatus==30){ - shipmentHeader.setLastStatus(500); + if(lastStatus==QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS){ + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); } //是否存在未配盘的数量,如果是,则尾状态为新建 Integer UnCompleted = shipmentDetailService.countUnCompleted(shipmentId); if(UnCompleted != null && UnCompleted.intValue() > 0){ - shipmentHeader.setLastStatus(100); + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); } this.saveOrUpdate(shipmentHeader); } @@ -188,9 +192,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, } //2.小于100时,把主单和相应的子单加入到list中,大于等于100时,直接跳过 - if(shipmentHeader.getFirstStatus() < 100 && shipmentHeader.getLastStatus() <100){ - shipmentHeader.setFirstStatus(100); - shipmentHeader.setLastStatus(100); + if(shipmentHeader.getFirstStatus() < QuantityConstant.SHIPMENT_HEADER_POOL && shipmentHeader.getLastStatus() <QuantityConstant.SHIPMENT_HEADER_POOL){ + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_POOL); + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_POOL); shipmentHeaders.add(shipmentHeader); LambdaQueryWrapper<ShipmentDetail> lam = Wrappers.lambdaQuery(); @@ -199,7 +203,7 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, List<ShipmentDetail> shipmentDetailList = shipmentDetailService.list(lam); if(shipmentDetailList != null){ for(ShipmentDetail shipmentDetail : shipmentDetailList){ - shipmentDetail.setStatus(100); + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL); } shipmentDetails.addAll(shipmentDetailList); }else { @@ -219,4 +223,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, } return AjaxResult.success("订单审核成功,成功加入订单池"); } + + @Override + public List<ShipmentHeader> selectListByCreated() { + return shipmentHeaderMapper.selectListByCreated(); + } } diff --git a/src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java b/src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java index 276b8f6..46c3106 100644 --- a/src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java +++ b/src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java @@ -8,16 +8,8 @@ import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.controller.BaseController; import com.huaheng.framework.web.domain.AjaxResult; import com.huaheng.framework.web.page.TableDataInfo; -import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; -import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; -import com.huaheng.pc.config.configValue.domain.ConfigValue; -import com.huaheng.pc.config.configValue.service.ConfigValueService; -import com.huaheng.pc.config.material.domain.Material; -import com.huaheng.pc.config.material.service.MaterialServiceImpl; -import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; -import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; import com.huaheng.pc.shipment.shipmentContainerDetail.service.ShipmentContainerDetailService; import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentCombinationModel; import com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader; @@ -33,7 +25,6 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; import java.util.List; @Controller diff --git a/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java b/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java index e01c992..5307e99 100644 --- a/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java +++ b/src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java @@ -16,7 +16,6 @@ import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceServic import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; -import com.huaheng.pc.shipment.shippingCombination.domain.ShippingSearch; import com.huaheng.pc.shipment.shippingCombination.mapper.ShippingCombinationMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -78,7 +77,7 @@ public class ShippingCombinationService { //根据sql查库存 try { - list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); + list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getStatements(),shipmentPreference); }catch (Exception e){ throw new ServiceException("sql错误"); } @@ -98,7 +97,7 @@ public class ShippingCombinationService { } //根据sql查库存 - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getStatements(),shipmentPreference); return list; } @@ -112,7 +111,7 @@ public class ShippingCombinationService { } //根据sql查库存 - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getStatements(),shipmentPreference); return list; } diff --git a/src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java b/src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java index 2968a98..02b28c3 100644 --- a/src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java +++ b/src/main/java/com/huaheng/pc/shipment/wave/service/WaveService.java @@ -3,6 +3,7 @@ package com.huaheng.pc.shipment.wave.service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.support.Convert; import com.huaheng.common.utils.security.ShiroUtils; @@ -58,7 +59,7 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { //1、查看此波次的状态,状态不为o时,无法开始波次 Wave wave = this.getById(id); - if(wave == null || wave.getStatus() != 0){ + if(wave == null || wave.getStatus() != QuantityConstant.WAVE_STATUS_BUILD){ return AjaxResult.error("id为"+id+"的波次找不到,或者状态不能做开始操作"); } waves.add(wave); @@ -84,7 +85,7 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { //5、修改波次的状态 for(Wave wave : waves){ - wave.setStatus(300); + wave.setStatus(QuantityConstant.WAVE_STATUS_END); wave.setCurrentWaveStep("生成任务"); } Boolean flag = this.updateBatchById(waves); @@ -116,16 +117,16 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { //1、查看此波次是否可以释放 Wave wave = this.getById(id); - if(wave == null || (wave.getStatus()!=300 && wave.getStatus()!=999)){ + if(wave == null || (wave.getStatus()!=QuantityConstant.WAVE_STATUS_END && wave.getStatus()!=QuantityConstant.WAVE_STATUS_FAILED)){ return AjaxResult.error(id+"波次不可释放"); } //2、查看此波次的状态,看是成功释放还是失败释放 - if(wave.getStatus() == 300) { + if(wave.getStatus() == QuantityConstant.WAVE_STATUS_END) { //成功释放——找到此波次的未执行的子任务列表 LambdaQueryWrapper<TaskDetail> lam = Wrappers.lambdaQuery(); lam.eq(TaskDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) - .eq(TaskDetail::getStatus, 0) + .eq(TaskDetail::getStatus, QuantityConstant.TASK_STATUS_BUILD) .eq(TaskDetail::getWaveId, id); List<TaskDetail> taskDetails = taskDetailService.list(lam); if (taskDetails != null) { @@ -143,7 +144,7 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { HashSet<Integer> set = new HashSet<>(); for(ShipmentDetail item : shipmentDetails){ if(item.getShipQty().compareTo(item.getRequestQty())!=0) { - item.setStatus(0); + item.setStatus(QuantityConstant.SHIPMENT_HEADER_POOL); } item.setWaveId(0); set.add(item.getShipmentId()); @@ -157,8 +158,8 @@ public class WaveService extends ServiceImpl<WaveMapper, Wave> { if(shipmentHeader == null){ throw new ServiceException("没有对应的出库主单"); } - if(shipmentHeader.getFirstStatus()<= 200) { - shipmentHeader.setFirstStatus(0); + if(shipmentHeader.getFirstStatus()<= QuantityConstant.SHIPMENT_HEADER_WAVE) { + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_POOL); flag = shipmentHeaderService.updateById(shipmentHeader); if (flag == false) { throw new ServiceException("修改出库主单失败"); diff --git a/src/main/java/com/huaheng/pc/system/dict/mapper/DictDataMapper.java b/src/main/java/com/huaheng/pc/system/dict/mapper/DictDataMapper.java index 23e1e3d..958c4c4 100644 --- a/src/main/java/com/huaheng/pc/system/dict/mapper/DictDataMapper.java +++ b/src/main/java/com/huaheng/pc/system/dict/mapper/DictDataMapper.java @@ -115,4 +115,10 @@ public interface DictDataMapper DictData selectModel(DictData dictData); + //复制字典明细数据 + int dictDateCopy(@Param("code")String code, @Param("newCode")String newCode); + + + //修改复制明细的父ID + int updateHeaderId(@Param("code")String code); } diff --git a/src/main/java/com/huaheng/pc/system/dict/mapper/DictTypeMapper.java b/src/main/java/com/huaheng/pc/system/dict/mapper/DictTypeMapper.java index ad90a49..718cdfe 100644 --- a/src/main/java/com/huaheng/pc/system/dict/mapper/DictTypeMapper.java +++ b/src/main/java/com/huaheng/pc/system/dict/mapper/DictTypeMapper.java @@ -94,4 +94,8 @@ public interface DictTypeMapper public int insertDictTypes(@Param("dictTypes") List<DictType> dictTypes); + + //先复制字典主表数据 + int dictTypeCopy(@Param("code")String code, @Param("newCode")String newCode); + } diff --git a/src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java b/src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java index 6480de8..a7d79bc 100644 --- a/src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java +++ b/src/main/java/com/huaheng/pc/system/dict/service/DictTypeServiceImpl.java @@ -1,5 +1,6 @@ package com.huaheng.pc.system.dict.service; +import com.huaheng.common.exception.service.ServiceException; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -176,4 +177,26 @@ public class DictTypeServiceImpl implements IDictTypeService return dictTypeMapper.insertDictTypes(dictTypeList); } + + //复制字典数据 + @Override + public Boolean dictTypeCopy(String code, String newCode) { + int i = 0; + //1、先复制字典主表数据 + i = dictTypeMapper.dictTypeCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制字典主表失败"); + } + //2、复制字典明细数据 + i = dictDataMapper.dictDateCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制字典明细失败"); + } + //3、修改复制明细的父ID + i = dictDataMapper.updateHeaderId(newCode); + if(i < 1){ + throw new ServiceException("修改字典明细失败"); + } + return true; + } } diff --git a/src/main/java/com/huaheng/pc/system/dict/service/IDictTypeService.java b/src/main/java/com/huaheng/pc/system/dict/service/IDictTypeService.java index 65a0ae7..8b8a44c 100644 --- a/src/main/java/com/huaheng/pc/system/dict/service/IDictTypeService.java +++ b/src/main/java/com/huaheng/pc/system/dict/service/IDictTypeService.java @@ -96,4 +96,7 @@ public interface IDictTypeService public int insertDictTypes(List<DictType> dictTypes); + + //复制字典数据 + Boolean dictTypeCopy(String code,String newCode); } diff --git a/src/main/java/com/huaheng/pc/system/menu/mapper/MenuMapper.java b/src/main/java/com/huaheng/pc/system/menu/mapper/MenuMapper.java index 9269833..9f06004 100644 --- a/src/main/java/com/huaheng/pc/system/menu/mapper/MenuMapper.java +++ b/src/main/java/com/huaheng/pc/system/menu/mapper/MenuMapper.java @@ -118,4 +118,10 @@ public interface MenuMapper extends BaseMapper<Menu> public List<Menu> selectMobileMenusByUserId(@Param("warehouseCode") String warehouseCode, @Param("userId") Integer userId); List<Menu> selectMenuPageList(Menu menu); + + //复制菜单数据 + int menuCopy(@Param("code") String code, @Param("newCode") String newCode); + + //修改父id + int updateParentId(@Param("code") String code); } diff --git a/src/main/java/com/huaheng/pc/system/menu/service/IMenuService.java b/src/main/java/com/huaheng/pc/system/menu/service/IMenuService.java index b9b1f8e..cb9cdf7 100644 --- a/src/main/java/com/huaheng/pc/system/menu/service/IMenuService.java +++ b/src/main/java/com/huaheng/pc/system/menu/service/IMenuService.java @@ -138,4 +138,8 @@ public interface IMenuService * @return 菜单列表 */ List<Menu> selectMobileMenusByUserId(Integer userId); + + + //复制菜单 + Boolean menuCopy(String code,String newCode); } diff --git a/src/main/java/com/huaheng/pc/system/menu/service/MenuServiceImpl.java b/src/main/java/com/huaheng/pc/system/menu/service/MenuServiceImpl.java index 6408371..85d71fa 100644 --- a/src/main/java/com/huaheng/pc/system/menu/service/MenuServiceImpl.java +++ b/src/main/java/com/huaheng/pc/system/menu/service/MenuServiceImpl.java @@ -10,6 +10,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import com.huaheng.common.exception.service.ServiceException; import com.huaheng.pc.system.user.domain.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -354,5 +355,22 @@ public class MenuServiceImpl implements IMenuService return menus; } + //复制菜单 + @Override + public Boolean menuCopy(String code, String newCode) { + int i = 0; + //复制菜单数据 + i = menuMapper.menuCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制菜单数据失败"); + } + //修改父id + i= menuMapper.updateParentId(newCode); + if(i < 1){ + throw new ServiceException("修改父Id失败"); + } + return true; + } + } diff --git a/src/main/java/com/huaheng/pc/system/role/mapper/RoleMapper.java b/src/main/java/com/huaheng/pc/system/role/mapper/RoleMapper.java index eb71982..fdf75f6 100644 --- a/src/main/java/com/huaheng/pc/system/role/mapper/RoleMapper.java +++ b/src/main/java/com/huaheng/pc/system/role/mapper/RoleMapper.java @@ -91,4 +91,10 @@ public interface RoleMapper */ public Role checkroleCodeUnique(@Param("warehouseCode") String warehouseCode, @Param("roleCode") String roleCode); + + public int roleCopy(@Param("code")String code, @Param("newCode")String newCode); + + + public int roleUserCopy(@Param("code")String code); + } diff --git a/src/main/java/com/huaheng/pc/system/role/service/IRoleService.java b/src/main/java/com/huaheng/pc/system/role/service/IRoleService.java index 41d6a52..efafd30 100644 --- a/src/main/java/com/huaheng/pc/system/role/service/IRoleService.java +++ b/src/main/java/com/huaheng/pc/system/role/service/IRoleService.java @@ -108,4 +108,8 @@ public interface IRoleService */ public int countUserRoleByRoleId(Integer id); + + //复制角色 + Boolean roleCopy(String code,String newCode); + } diff --git a/src/main/java/com/huaheng/pc/system/role/service/RoleServiceImpl.java b/src/main/java/com/huaheng/pc/system/role/service/RoleServiceImpl.java index 741f6dd..1e4ce65 100644 --- a/src/main/java/com/huaheng/pc/system/role/service/RoleServiceImpl.java +++ b/src/main/java/com/huaheng/pc/system/role/service/RoleServiceImpl.java @@ -5,6 +5,8 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; + +import com.huaheng.common.exception.service.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.huaheng.common.constant.UserConstants; @@ -17,6 +19,8 @@ import com.huaheng.pc.system.role.mapper.RoleMapper; import com.huaheng.pc.system.role.mapper.RoleMenuMapper; import com.huaheng.pc.system.user.mapper.UserRoleMapper; +import javax.annotation.Resource; + /** * 角色 业务层处理 * @@ -26,13 +30,13 @@ import com.huaheng.pc.system.user.mapper.UserRoleMapper; public class RoleServiceImpl implements IRoleService { - @Autowired + @Resource private RoleMapper roleMapper; @Autowired private RoleMenuMapper roleMenuMapper; - @Autowired + @Resource private UserRoleMapper userRoleMapper; /** @@ -259,4 +263,23 @@ public class RoleServiceImpl implements IRoleService return userRoleMapper.countUserRoleByRoleId(id); } + + //复制角色 + @Override + public Boolean roleCopy(String code, String newCode) { + int i = 0; + i = roleMapper.roleCopy(code,newCode); + if(i < 1){ + throw new ServiceException("复制角色表失败"); + } + if(i < 1){ + throw new ServiceException("复制角色菜单关系表失败"); + } + i = roleMapper.roleUserCopy(newCode); + if(i < 1){ + throw new ServiceException("复制用户角色关系表失败"); + } + return true; + } + } diff --git a/src/main/java/com/huaheng/pc/system/user/controller/HomeController.java b/src/main/java/com/huaheng/pc/system/user/controller/HomeController.java new file mode 100644 index 0000000..fb987eb --- /dev/null +++ b/src/main/java/com/huaheng/pc/system/user/controller/HomeController.java @@ -0,0 +1,252 @@ +package com.huaheng.pc.system.user.controller; + +import com.huaheng.framework.config.HuaHengConfig; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.company.domain.Company; +import com.huaheng.pc.config.company.service.CompanyService; +import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.config.warehouse.domain.Warehouse; +import com.huaheng.pc.config.warehouse.service.WarehouseService; +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; +import com.huaheng.pc.report.excelReport.mapper.ExcelReportMapper; +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; +import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; +import com.huaheng.pc.system.menu.domain.Menu; +import com.huaheng.pc.system.menu.service.IMenuService; +import com.huaheng.pc.system.user.domain.User; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.annotation.Resource; +import java.util.*; + +@Controller +@RequestMapping("/admin") +public class HomeController extends BaseController { + @Autowired + private IMenuService menuService; + @Autowired + private HuaHengConfig huahengConfig; + @Resource + ExcelReportMapper mapper; + + @Autowired + private ReceiptDetailService receiptDetailService; + @Autowired + private ShipmentDetailService shipmentDetailService; + @Autowired + private LocationService locationService; + @Autowired + private InventoryDetailService InventoryDetailService; + @Autowired + private WarehouseService warehouseService; + @Autowired + private CompanyService companyService; + + + + private String prefix = "admin"; + + //6个显示后台 + @GetMapping("home/getCommonData") + @ResponseBody + public AjaxResult getCommonData(){ +// String condition = " and warehouseId = " + ShiroUtils.getWarehouseId(); + String bllCount = "SELECT ifnull(sum(t.a),0) 'total' from (\n" + + "SELECT COUNT(*) 'a' FROM receipt_header WHERE DATEDIFF(NOW(), created)=0 " + + " UNION \n" + + "SELECT COUNT(*) 'a' FROM shipment_header WHERE DATEDIFF(NOW(), created)=0 " + + ") t"; + String receiptTotal = "SELECT ifnull(sum(t.qty),0) 'total' from task_detail t\n" + + "inner join receipt_header r on t.billCode=r.code and\n" + + "t.status>100 and DATEDIFF(NOW(), t.lastUpdated)=0;"; + String shipmentTotal = "SELECT ifnull(sum(t.qty),0) 'total' from task_detail t\n" + + "inner join shipment_header s on t.billCode=s.code and\n" + + "t.status>100 and DATEDIFF(NOW(), t.lastUpdated)=0;"; + String inventoryTotal = "SELECT IFNULL(SUM(qty),0) 'total' from inventory_detail where 1=1 " ; + String materialCount = "SELECT count(DISTINCT materialCode) 'total' from inventory_detail WHERE 1=1"; + String taskUncompletedTotal = "SELECT COUNT(*) 'total' from task_header WHERE status < 100 " ; + + Map<String, Object> map = new HashMap<>(); + List<LinkedHashMap<String, Object>> temp1 = mapper.selectCommon(bllCount); + map.put("bllCount",temp1.get(0).entrySet().iterator().next().getValue()); + + List<LinkedHashMap<String, Object>> temp2 = mapper.selectCommon(receiptTotal); + map.put("receiptTotal",temp2.get(0).entrySet().stream().findFirst().get().getValue()); + + List<LinkedHashMap<String, Object>> temp3 = mapper.selectCommon(shipmentTotal); + map.put("shipmentTotal",temp3.get(0).entrySet().stream().findFirst().get().getValue()); + + List<LinkedHashMap<String, Object>> temp4 = mapper.selectCommon(inventoryTotal); + map.put("inventoryTotal",temp4.get(0).entrySet().stream().findFirst().get().getValue()); + + List<LinkedHashMap<String, Object>> temp5 = mapper.selectCommon(materialCount); + map.put("materialCount",temp5.get(0).entrySet().stream().findFirst().get().getValue()); + + List<LinkedHashMap<String, Object>> temp6 = mapper.selectCommon(taskUncompletedTotal); + map.put("taskUncompletedTotal",temp6.get(0).entrySet().stream().findFirst().get().getValue()); + + return AjaxResult.success(map); + } + + //库龄展示 + @GetMapping("home/getInventoryStatus") + @ResponseBody + public AjaxResult getInventoryStatus(String type){ + List<Map<String, Object>> list=new ArrayList<>(); + if(type.equals("1")) { + Warehouse warehouse=new Warehouse(); + List<Warehouse> warehouseList=warehouseService.selectListEntityByEqual(warehouse); + for(Warehouse item:warehouseList) { + List<String> list1=new ArrayList<>(); + Integer a=0; + Integer b=3; + String num1 = InventoryDetailService.getWarehouseInventoryStatus(item.getCode(),a,b); + list1.add(num1); + a=3; + b=6; + String num2 = InventoryDetailService.getWarehouseInventoryStatus(item.getCode(),a,b); + list1.add(num2); + a=6; + b=9; + String num3 = InventoryDetailService.getWarehouseInventoryStatus(item.getCode(),a,b); + list1.add(num3); + a=9; + b=12; + String num4 = InventoryDetailService.getWarehouseInventoryStatus(item.getCode(),a,b); + list1.add(num4); + a=12; + String num5 = InventoryDetailService.getWarehouseInventoryStatuss(item.getCode(),a); + list1.add(num5); + Map map=new ModelMap(); + map.put("warehouseName",item.getName()); + map.put("list1",list1); + list.add(map); + } + }else { + Company company=new Company(); + List<Company> companyList=companyService.selectListEntityByEqual(company); + for(Company item:companyList) { + List<String> list1=new ArrayList<>(); + Integer a=0; + Integer b=3; + String num1 = InventoryDetailService.getCompanyInventoryStatus(item.getCode(),a,b); + list1.add(num1); + a=3; + b=6; + String num2 = InventoryDetailService.getCompanyInventoryStatus(item.getCode(),a,b); + list1.add(num2); + a=6; + b=9; + String num3 = InventoryDetailService.getCompanyInventoryStatus(item.getCode(),a,b); + list1.add(num3); + a=9; + b=12; + String num4 = InventoryDetailService.getCompanyInventoryStatus(item.getCode(),a,b); + list1.add(num4); + a=12; + String num5 = InventoryDetailService.getCompanyInventoryStatuss(item.getCode(),a); + list1.add(num5); + Map map=new ModelMap(); + map.put("companyName",item.getName()); + map.put("list1",list1); + list.add(map); + } + } + return AjaxResult.success(list); + } + + //获得七天的出入库量 + @GetMapping("home/getShipmentsLast7Days") + @ResponseBody + public AjaxResult getQtyLast7Days(String type){ + List<TaskDetail> receiptDetails=new ArrayList<>(); + List<TaskDetail> shipmentDetails=new ArrayList<>(); + Map map=new ModelMap(); + if(type.equals("1")) { + receiptDetails = receiptDetailService.getReceiptQtyLast7Days(); + shipmentDetails = shipmentDetailService.getShipmentQtyLast7Days(); + } + if(type.equals("2")){ + receiptDetails =receiptDetailService.getWarehouseReceipt(); + shipmentDetails=shipmentDetailService.getWarehouseShipment(); + } + if(type.equals("3")){ + receiptDetails =receiptDetailService.getCompanyReceipt(); + shipmentDetails=shipmentDetailService.getCompanyShipment(); + } + map.put("receiptDetails", receiptDetails); + map.put("shipmentDetails", shipmentDetails); + return AjaxResult.success(map); + } + + //库存分布 + @GetMapping("home/getInventoryProp") + @ResponseBody + public AjaxResult getInventoryProp(String type){ + List<Map<String, Object>> list=new ArrayList<>(); + if(type.equals("1")) { + Warehouse warehouse=new Warehouse(); + List<Warehouse> warehouseList=warehouseService.selectListEntityByEqual(warehouse); + for(Warehouse item:warehouseList) { + List<LinkedHashMap<String, Object>> list1 = InventoryDetailService.getWarehouseInventoryProp(item.getCode()); + Map map=new ModelMap(); + if(list1!=null && list1.size()>0) { + map.put("warehouseName",item.getName()); + map.put("list1", list1); + list.add(map); + } + } + }else { + Company company=new Company(); + List<Company> companyList=companyService.selectListEntityByEqual(company); + for(Company item:companyList) { + List<LinkedHashMap<String, Object>> list1 = InventoryDetailService.getCompanyInventoryProp(item.getCode()); + Map map=new ModelMap(); + if(list1!=null && list1.size()>0){ + map.put("companyName",item.getName()); + map.put("list1",list1); + list.add(map); + } + } + } + return AjaxResult.success(list); + } + + //库位利用率 + @GetMapping("home/getLocationProp") + @ResponseBody + public AjaxResult getLocationProp(){ + List<LinkedHashMap<String, Object>> list =locationService.getLocationProp(); + return AjaxResult.success(list); + } + + @GetMapping("/home") + public String home(ModelMap mmap) + { + // 取身份信息 + User user = getUser(); + // 根据用户id取出菜单 + List<Menu> menus = menuService.selectMenusByUserId(user.getId()); + mmap.put("menus", menus); + mmap.put("user", user); + mmap.put("copyrightYear", huahengConfig.getCopyrightYear()); + return prefix + "/home"; + } + + + // 系统介绍 + @GetMapping("/main") + public String main(ModelMap mmap) { + mmap.put("version", huahengConfig.getVersion()); + return prefix + "/main"; + } +} diff --git a/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java b/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java index c7010c9..75ba6e0 100644 --- a/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java +++ b/src/main/java/com/huaheng/pc/system/user/controller/IndexController.java @@ -167,7 +167,7 @@ public class IndexController extends BaseController " union all\n" + " SELECT date_sub(curdate(), interval 6 day) as click_date\n" + ") a left join (\n" + - "SELECT DATE(h.created) AS created , SUM(d.qty) AS taskQty from receipt_container_detail d join receipt_container_header h on d.receiptContainerId = h.id and h.warehouseCode='"+ShiroUtils.getWarehouseCode()+"' WHERE h.created >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND h.processStamp=20 GROUP BY DATE(h.created)\n" + + "SELECT DATE(h.created) AS created , SUM(d.qty) AS taskQty from receipt_container_detail d join receipt_container_header h on d.receiptContainerId = h.id and h.warehouseCode='"+ShiroUtils.getWarehouseCode()+"' WHERE h.created >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND d.status=30 GROUP BY DATE(h.created)\n" + ") b on a.click_date = b.created ORDER BY a.click_date;"; List<LinkedHashMap<String, Object>> list2 = mapper.selectCommon(sql); diff --git a/src/main/java/com/huaheng/pc/task/taskDetail/controller/AdminTaskDetailController.java b/src/main/java/com/huaheng/pc/task/taskDetail/controller/AdminTaskDetailController.java new file mode 100644 index 0000000..60c5adc --- /dev/null +++ b/src/main/java/com/huaheng/pc/task/taskDetail/controller/AdminTaskDetailController.java @@ -0,0 +1,58 @@ +package com.huaheng.pc.task.taskDetail.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 立库任务明细 信息操作处理 + * + * @author huaheng + * @date 2018-08-19 + */ +@Controller +@RequestMapping("/admin/taskDetail") +public class AdminTaskDetailController extends BaseController +{ + private String prefix = "admin/taskDetail"; + + @Autowired + private TaskDetailService taskDetailService; + +// @RequiresPermissions("admin:task:view") + @GetMapping("/{taskId}") + public String taskDetail(@PathVariable("taskId") String taskId, ModelMap mmap) + { + mmap.put("taskId", taskId); + return prefix + "/taskDetail"; + } + + /** + * 查询立库任务明细列表 + */ +// @RequiresPermissions("admin:task:list") + @Log(title = "任务-任务管理", operating = "查看立库任务明细", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TaskDetail taskDetail) + { + startPage(); + LambdaQueryWrapper<TaskDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(TaskDetail::getTaskId,taskDetail.getTaskId()); + List<TaskDetail> list = taskDetailService.list(lambdaQueryWrapper) ; + return getDataTable(list); + } + + +} diff --git a/src/main/java/com/huaheng/pc/task/taskDetail/controller/TaskDetailController.java b/src/main/java/com/huaheng/pc/task/taskDetail/controller/TaskDetailController.java index beffabf..e85401e 100644 --- a/src/main/java/com/huaheng/pc/task/taskDetail/controller/TaskDetailController.java +++ b/src/main/java/com/huaheng/pc/task/taskDetail/controller/TaskDetailController.java @@ -9,6 +9,7 @@ import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.page.PageDomain; import com.huaheng.framework.web.page.TableSupport; import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -41,6 +42,9 @@ public class TaskDetailController extends BaseController @Resource private TaskDetailService taskDetailService; + + + @RequiresPermissions("task:taskHeader:view") @GetMapping("/{taskId}") public String taskDetail(@PathVariable("taskId") String taskId, ModelMap mmap) @@ -67,17 +71,32 @@ public class TaskDetailController extends BaseController Integer pageSize = pageDomain.getPageSize(); /** * 使用分页查询 + * 700盘点 */ if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ Page<TaskDetail> page = new Page<>(pageNum, pageSize); IPage<TaskDetail> iPage = taskDetailService.page(page, lambdaQueryWrapper); - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + List<TaskDetail> iPages = iPage.getRecords(); + for(TaskDetail item:iPages){ + if(item.getTaskType() == 700){ + iPages = taskDetailService.preferenceRealize(iPages) ; + } + } + return getMpDataTable(iPages, iPage.getTotal()); } else { List<TaskDetail> list = taskDetailService.list(lambdaQueryWrapper); + for(TaskDetail items:list){ + if(items.getTaskType() == 700){ + list = taskDetailService.preferenceRealize(list); + } + } return getDataTable(list); } - } + + + + // /** // * 新增立库任务明细 // */ diff --git a/src/main/java/com/huaheng/pc/task/taskDetail/domain/TaskDetail.java b/src/main/java/com/huaheng/pc/task/taskDetail/domain/TaskDetail.java index b13e2ea..94e2740 100644 --- a/src/main/java/com/huaheng/pc/task/taskDetail/domain/TaskDetail.java +++ b/src/main/java/com/huaheng/pc/task/taskDetail/domain/TaskDetail.java @@ -50,6 +50,10 @@ public class TaskDetail implements Serializable { @ApiModelProperty(value="仓库") private String warehouseCode; + private String warehouseName; + + private String companyName; + /** * 货主 */ @@ -365,111 +369,13 @@ public class TaskDetail implements Serializable { @ApiModelProperty(value="处理标记") private String processStamp; - private static final long serialVersionUID = 1L; - - public static final String COL_ID = "id"; - - public static final String COL_TASKID = "taskId"; - - public static final String COL_TASKCODE = "taskCode"; - - public static final String COL_TASKTYPE = "taskType"; - - public static final String COL_INTERNALTASKTYPE = "internalTaskType"; - - public static final String COL_WAREHOUSECODE = "warehouseCode"; - - public static final String COL_COMPANYCODE = "companyCode"; - - public static final String COL_ALLOCATIONID= "allocationId"; - - public static final String COL_BILLCODE= "billCode"; - - public static final String COL_BILLDETAILID= "billDetailId"; - - - public static final String COL_MATERIALCODE = "materialCode"; - - public static final String COL_MATERIALNAME = "materialName"; - - public static final String COL_MATERIALSPEC = "materialSpec"; - - public static final String COL_MATERIALUNIT = "materialUnit"; - - public static final String COL_QTY = "qty"; - - public static final String COL_FROMLOCATION = "fromLocation"; - - public static final String COL_TOLOCATION = "toLocation"; - - public static final String COL_CONTAINERCODE = "containerCode"; - - public static final String COL_FROMZONE = "fromZone"; - - public static final String COL_TOZONE = "toZone"; - - public static final String COL_ATTRIBUTEID = "attributeId"; - - public static final String COL_STATUS= "status"; - - public static final String COL_REFERENCECODE = "referenceCode"; - - public static final String COL_REFERENCEID = "referenceId"; - - public static final String COL_REFERENCELINEID = "referenceLineId"; - - public static final String COL_ASSIGNEDUSER = "assignedUser"; - - public static final String COL_ATTRIBUTE1 = "attribute1"; - - public static final String COL_ATTRIBUTE2 = "attribute2"; - - public static final String COL_ATTRIBUTE3 = "attribute3"; - - - public static final String COL_BATCH = "batch"; - - public static final String COL_LOT = "lot"; - - public static final String COL_PROJECTNO = "projectNo"; - - public static final String COL_QCCHECK = "qcCheck"; - - public static final String COL_MANUFACTUREDATE = "manufactureDate"; - - public static final String COL_EXPIRATIONDATE = "expirationDate"; - - public static final String COL_AGINGDATE = "agingDate"; - - public static final String COL_INVENTORYSTS = "inventorySts"; - - public static final String COL_WAVEID = "waveId"; - - public static final String COL_FROMINVENTORYID = "fromInventoryId"; - - public static final String COL_TOINVENTORYID = "toInventoryId"; - - public static final String COL_CONFIRMEDBY = "confirmedBy"; - - public static final String COL_GROUPNUM = "groupNum"; - - public static final String COL_GROUPINDEX = "groupIndex"; - - public static final String COL_CREATED = "created"; - - public static final String COL_CREATEDBY = "createdBy"; - - public static final String COL_LASTUPDATED = "lastUpdated"; - - public static final String COL_LASTUPDATEDBY = "lastUpdatedBy"; - - public static final String COL_VERSION = "version"; - - public static final String COL_USERDEF1 = "userDef1"; - - public static final String COL_USERDEF2 = "userDef2"; + /** + * 需要容器数量 + */ + @TableField(value = "containQty") + @ApiModelProperty(value="需要容器数量") + private Integer containQty; - public static final String COL_USERDEF3 = "userDef3"; + private static final long serialVersionUID = 1L; - public static final String COL_PROCESSSTAMP = "processStamp"; } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailService.java b/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailService.java index f5ac425..774d896 100644 --- a/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailService.java +++ b/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailService.java @@ -1,8 +1,14 @@ package com.huaheng.pc.task.taskDetail.service; +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; import com.huaheng.pc.task.taskDetail.domain.TaskDetail; import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + public interface TaskDetailService extends IService<TaskDetail>{ + List<TaskDetail> preferenceRealize (List<TaskDetail> cycleCoutDetailList); + } diff --git a/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailServiceImpl.java b/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailServiceImpl.java index 2b2343f..1819fc8 100644 --- a/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailServiceImpl.java +++ b/src/main/java/com/huaheng/pc/task/taskDetail/service/TaskDetailServiceImpl.java @@ -1,13 +1,94 @@ package com.huaheng.pc.task.taskDetail.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.pc.config.cycleCountPreference.domain.CycleCountPreference; +import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService; +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; +import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.huaheng.pc.task.taskDetail.mapper.TaskDetailMapper; import com.huaheng.pc.task.taskDetail.domain.TaskDetail; -import com.huaheng.pc.task.taskDetail.service.TaskDetailService; +import org.springframework.transaction.annotation.Transactional; + @Service public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDetail> implements TaskDetailService{ + + @Resource + private CycleCountDetailService cycleCountDetailService; + @Resource + private CycleCountPreferenceService cycleCountPreferenceService; + + + + + + /** + * 盘点任务首选项 + * @param taskDetailList + * @return + */ + @Transactional + @Override + public List<TaskDetail> preferenceRealize(List<TaskDetail> taskDetailList) { + /*查出盘点明细,找出盘点首选项,根据首选项显示字段*/ + List<TaskDetail> taskDetails = new ArrayList<>(); + + for (TaskDetail item:taskDetailList){ + //盘点明细 + CycleCountDetail cycleCountDetailtemp = new CycleCountDetail(); + cycleCountDetailtemp.setCycleCountHeadCode(item.getBillCode()); + cycleCountDetailtemp.setId(item.getBillDetailId()); + LambdaQueryWrapper<CycleCountDetail> detailLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountDetailtemp); + CycleCountDetail cycleCountDetail = cycleCountDetailService.getOne(detailLambdaQueryWrapper); + if(cycleCountDetail == null){ + throw new SecurityException("没有找到子任务对应的盘点明细!"); + } + //找盘点首选项 + CycleCountPreference cycleCountPreferenceTemp = new CycleCountPreference(); + cycleCountPreferenceTemp.setCode(cycleCountDetail.getPreferenceCode()); + cycleCountPreferenceTemp.setWarehouseCode(cycleCountDetail.getWarehouseCode()); + LambdaQueryWrapper<CycleCountPreference> preferenceLambdaQueryWrapper = Wrappers.lambdaQuery(cycleCountPreferenceTemp); + CycleCountPreference cycleCountPreference = cycleCountPreferenceService.getOne(preferenceLambdaQueryWrapper); + if(cycleCountPreference == null){ + throw new SecurityException("没有找到盘点首选项!"); + } + //根据首选项判断数据 + if(cycleCountPreference.getPromptLocation() == false){ + //库位 + item.setFromLocation(""); + item.setToLocation(""); + } + if(cycleCountPreference.getPromptLpn() == false){ + //容器 + item.setContainerCode(""); + } + if(cycleCountPreference.getPromptItem() == false){ + //物料 + item.setMaterialCode(""); + item.setMaterialName(""); + item.setMaterialUnit(""); + item.setMaterialSpec(""); + } + if(cycleCountPreference.getPromptQuantity() == false){ + //系统数量 + item.setQty(null); + } + taskDetails.add(item); + } + return taskDetails; + } + + + + + + + } diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/controller/AdminTaskController.java b/src/main/java/com/huaheng/pc/task/taskHeader/controller/AdminTaskController.java new file mode 100644 index 0000000..8323262 --- /dev/null +++ b/src/main/java/com/huaheng/pc/task/taskHeader/controller/AdminTaskController.java @@ -0,0 +1,66 @@ +package com.huaheng.pc.task.taskHeader.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.common.utils.StringUtils; +import com.huaheng.framework.aspectj.lang.annotation.Log; +import com.huaheng.framework.aspectj.lang.constant.BusinessType; +import com.huaheng.framework.web.controller.BaseController; +import com.huaheng.framework.web.page.TableDataInfo; +import com.huaheng.pc.task.taskHeader.domain.TaskHeader; +import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.List; + +/** + * 任务 信息操作处理 + * + * @author huaheng + * @date 2019-05-20 + */ +@Controller +@RequestMapping("/admin/task") +public class AdminTaskController extends BaseController { + private String prefix = "admin/task"; + + @Autowired + private TaskHeaderService taskHeaderService; + +// @RequiresPermissions("task:task:view") + @GetMapping() + public String task() { + return prefix + "/task"; + } + + + /** + * 查询立库任务列表 + */ +// @RequiresPermissions("task:task:list") + @Log(title = "任务-任务管理", operating = "查看立库任务列表", action = BusinessType.GRANT) + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(TaskHeader taskHeader, Short lastStatus) { + startPage(); + LambdaQueryWrapper<TaskHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(StringUtils.isNotEmpty(taskHeader.getWarehouseCode()),TaskHeader::getWarehouseCode, taskHeader.getWarehouseCode()) + .eq(StringUtils.isNotEmpty(taskHeader.getCompanyCode()),TaskHeader::getCompanyCode,taskHeader.getCompanyCode()) + .eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()),TaskHeader::getContainerCode,taskHeader.getContainerCode()) + .eq(StringUtils.isNotEmpty(taskHeader.getToLocation()),TaskHeader::getToLocation,taskHeader.getToLocation()); + List<TaskHeader> list=new ArrayList<>(); + if(lastStatus==null) { + list = taskHeaderService.list(lambdaQueryWrapper); + }else { + list = taskHeaderService.getTasksStatus(lastStatus); + } + return getDataTable(list); + } + +} \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java b/src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java index 28da9f8..f840f0a 100644 --- a/src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java +++ b/src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java @@ -16,6 +16,9 @@ import com.huaheng.framework.web.page.TableDataInfo; import com.huaheng.framework.web.page.TableSupport; import com.huaheng.pc.config.material.service.MaterialService; import com.huaheng.pc.config.warehouse.domain.Warehouse; +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; +import com.huaheng.pc.task.taskDetail.domain.TaskDetail; +import com.huaheng.pc.task.taskDetail.service.TaskDetailService; import com.huaheng.pc.task.taskHeader.domain.TaskHeader; import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper; import com.huaheng.pc.task.taskHeader.service.TaskHeaderService; @@ -36,23 +39,23 @@ import java.util.List; public class TaskHeaderController extends BaseController { + + @Resource + private TaskHeaderService taskHeaderService; + + + private String prefix = "task/taskHeader"; + @RequiresPermissions("task:taskHeader:view") @GetMapping() public String taskHeader(HttpServletRequest request, ModelMap mmap) { - String InternalTaskType= request.getParameter("InternalTaskType"); + String InternalTaskType= request.getParameter("InternalTaskType"); mmap.put("InternalTaskType",InternalTaskType); return prefix + "/taskHeader"; } - - @Resource - private TaskHeaderService taskHeaderService; - - - - /** * 查询任务列表 */ @@ -66,7 +69,6 @@ public class TaskHeaderController extends BaseController { lambdaQueryWrapper.eq(TaskHeader::getWarehouseCode,ShiroUtils.getWarehouseCode()) .in(TaskHeader::getCompanyCode,ShiroUtils.getCompanyCodeList()) .eq(StringUtils.isNotNull(InternalTaskType),TaskHeader::getInternalTaskType,InternalTaskType) - .eq(StringUtils.isNotNull(taskHeader.getInternalTaskType()),TaskHeader::getInternalTaskType,taskHeader.getInternalTaskType()) .eq(StringUtils.isNotNull(taskHeader.getId()),TaskHeader::getId,taskHeader.getId()) .eq(StringUtils.isNotEmpty(taskHeader.getContainerCode()),TaskHeader::getContainerCode,taskHeader.getContainerCode()) .eq(StringUtils.isNotEmpty(taskHeader.getToLocation()),TaskHeader::getToLocation,taskHeader.getToLocation()) @@ -83,14 +85,20 @@ public class TaskHeaderController extends BaseController { if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ Page<TaskHeader> page = new Page<>(pageNum, pageSize); IPage<TaskHeader> iPage = taskHeaderService.page(page, lambdaQueryWrapper); - return getMpDataTable(iPage.getRecords(), iPage.getTotal()); + List<TaskHeader> iPages = iPage.getRecords(); + if(InternalTaskType == 700){ + iPages = taskHeaderService.preferenceRealize(iPages) ; + } + return getMpDataTable(iPages, iPage.getTotal()); } else { List<TaskHeader> list = taskHeaderService.list(lambdaQueryWrapper); + if(InternalTaskType == 700){ + list = taskHeaderService.preferenceRealize(list); + } return getDataTable(list); } } - /** * 下发任务 */ diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java b/src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java index 6e94931..e5bba6e 100644 --- a/src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java +++ b/src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java @@ -294,5 +294,19 @@ public class TaskHeader implements Serializable { @ApiModelProperty(value="处理标记") private String processStamp; + /** + * 站台 + */ + @TableField(value = "recvDock") + @ApiModelProperty(value="站台") + private String recvDock; + + /** + * 需要容器数量 + */ + @TableField(value = "containQty") + @ApiModelProperty(value="需要容器数量") + private Integer containQty; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/mapper/TaskHeaderMapper.java b/src/main/java/com/huaheng/pc/task/taskHeader/mapper/TaskHeaderMapper.java index 60920ff..f174f7b 100644 --- a/src/main/java/com/huaheng/pc/task/taskHeader/mapper/TaskHeaderMapper.java +++ b/src/main/java/com/huaheng/pc/task/taskHeader/mapper/TaskHeaderMapper.java @@ -13,4 +13,6 @@ public interface TaskHeaderMapper extends BaseMapper<TaskHeader> { Integer UncompleteCount(@Param("containerCode") String containerCode, @Param("warehouseCode") String warehouseCode); + List<TaskHeader> getTasksStatus(Short lastStatus); + } \ No newline at end of file diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java index 24a90d6..b25f5b9 100644 --- a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java +++ b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java @@ -1,6 +1,7 @@ package com.huaheng.pc.task.taskHeader.service; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; import com.huaheng.pc.task.taskHeader.domain.TaskHeader; import com.baomidou.mybatisplus.extension.service.IService; @@ -24,7 +25,6 @@ public interface TaskHeaderService extends IService<TaskHeader>{ AjaxResult createTransferTask(String sourceLocation, String destinationLocation); - AjaxResult createCheckOutTask(String[] ids); AjaxResult completeSeeOutTask(TaskHeader taskHeader); @@ -39,5 +39,7 @@ public interface TaskHeaderService extends IService<TaskHeader>{ AjaxResult cancelTask(Integer[] taskIds) ; + List<TaskHeader> preferenceRealize (List<TaskHeader> taskHeaderList); + List<TaskHeader> getTasksStatus(Short lastStatus); } diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java index 76e5524..fe8783f 100644 --- a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java +++ b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java @@ -4,15 +4,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.huaheng.api.wcs.service.taskAssignService.TaskAssignService; +import com.huaheng.common.constant.QuantityConstant; import com.huaheng.common.exception.service.ServiceException; import com.huaheng.common.utils.DataUtils; import com.huaheng.common.utils.StringUtils; import com.huaheng.common.utils.security.ShiroUtils; import com.huaheng.framework.web.domain.AjaxResult; +import com.huaheng.pc.config.configWarning.domain.ConfigWarning; +import com.huaheng.pc.config.configWarning.service.ConfigWarningService; import com.huaheng.pc.config.container.domain.Container; import com.huaheng.pc.config.container.service.ContainerService; +import com.huaheng.pc.config.containerCapacity.domain.ContainerCapacity; +import com.huaheng.pc.config.containerCapacity.service.ContainerCapacityService; import com.huaheng.pc.config.location.domain.Location; import com.huaheng.pc.config.location.service.LocationService; +import com.huaheng.pc.config.sendMail.domain.SendMail; +import com.huaheng.pc.config.sendMail.service.MailService; +import com.huaheng.pc.config.sendMail.service.SendMailService; import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail; import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService; import com.huaheng.pc.inventory.cycleCountHeader.domain.CycleCountHeader; @@ -44,9 +53,11 @@ import com.huaheng.pc.task.taskDetail.service.TaskDetailService; import com.huaheng.pc.task.taskHeader.domain.ShipmentTaskCreateModel; import org.apache.poi.ss.formula.functions.T; import org.jsoup.helper.DataUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.time.temporal.TemporalAdjuster; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -100,8 +111,41 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea private ReceiptContainerHeaderService receiptContainerHeaderService; @Resource private TaskHeaderMapper taskHeaderMapper; + @Autowired + private TaskAssignService taskAssignService; + @Resource + private ContainerCapacityService containerCapacityService; + @Resource + private ConfigWarningService configWarningService; + @Resource + private MailService mailService; + @Resource + private SendMailService sendMailService; + /** + * 盘点任务首选项 + * + * @param taskHeaderList + * @return + */ + @Transactional + @Override + public List<TaskHeader> preferenceRealize(List<TaskHeader> taskHeaderList) { + //盘点任务头,默认不显示库位,容器。 + List<TaskHeader> taskHeaders = new ArrayList<>(); + for (TaskHeader item : taskHeaderList) { + item.setFromLocation(""); + item.setToLocation(""); + item.setContainerCode(""); + taskHeaders.add(item); + } + return taskHeaders; + } + @Override + public List<TaskHeader> getTasksStatus(Short lastStatus) { + return taskHeaderMapper.getTasksStatus(lastStatus); + } /** * 查询容器有无任务 @@ -113,17 +157,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea /** * 取消任务 - * */ + */ @Override @Transactional public AjaxResult cancelTask(Integer[] taskIds) { - for(int taskId : taskIds){ + for (int taskId : taskIds) { TaskHeader taskHeader = taskHeaderService.getById(taskId); - if(taskHeader==null){ - return AjaxResult.error("任务"+taskId+"未找到,操作中止"); + if (taskHeader == null) { + return AjaxResult.error("任务" + taskId + "未找到,操作中止"); } - if(taskHeader.getStatus() > 9){ - return AjaxResult.error("存在任务"+taskHeader.getId()+"已下发或执行,操作中止"); + if (taskHeader.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) { + return AjaxResult.error("存在任务" + taskHeader.getId() + "已下发或执行,操作中止"); } //查出任务明细 TaskDetail taskDetail1 = new TaskDetail(); @@ -133,33 +177,34 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea LambdaQueryWrapper<TaskDetail> td = Wrappers.lambdaQuery(taskDetail1); List<TaskDetail> taskDetailList = taskDetailService.list(td); TaskDetail taskDetail = taskDetailList.get(0); - if(taskDetail == null){ + if (taskDetail == null) { throw new ServiceException("任务明细条目错误"); } //删除子任务 LambdaQueryWrapper<TaskDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(TaskDetail::getTaskId,taskHeader.getId()); + lambdaQueryWrapper.eq(TaskDetail::getTaskId, taskHeader.getId()); taskDetailService.remove(lambdaQueryWrapper); //删除主任务 taskHeaderService.removeById(taskHeader.getId()); // 更改库位状态(整盘入库任务除外) - if(taskHeader.getInternalTaskType() == 100 ) - { - ReceiptContainerHeader record =new ReceiptContainerHeader(); - record.setStatus((short)0); + if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_SHELF) { + ReceiptContainerHeader record = new ReceiptContainerHeader(); + record.setStatus((short) QuantityConstant.RECEIPT_CONTAINER_BUILD.intValue()); record.setId(taskHeader.getAllocationHeadId()); - if (receiptContainerHeaderService.updateById(record)){throw new ServiceException("回滚组盘明细失败");} + if (!receiptContainerHeaderService.updateById(record)) { + throw new ServiceException("回滚组盘明细失败"); + } } //根据任务类型来更新货箱状态 //修改关联的货箱状态 - if(taskHeader.getInternalTaskType() == 200) { + if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_PICKING) { ShipmentContainerHeader shipmentContainerHeader = new ShipmentContainerHeader(); shipmentContainerHeader.setId(taskHeader.getAllocationHeadId()); - shipmentContainerHeader.setStatus(0); + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_BUILD); shipmentContainerHeaderService.updateById(shipmentContainerHeader); } //盘点取消任务,恢复明细状态为1 - if(taskHeader.getInternalTaskType() == 700) { + if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_CYCLECOUNT) { CycleCountDetail cycleCountDetail = new CycleCountDetail(); cycleCountDetail.setCompanyCode(taskDetail.getCompanyCode()); @@ -170,7 +215,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea cycleCountDetail.setId(taskDetail.getBillDetailId());//盘点细单ID LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(cycleCountDetail); List<CycleCountDetail> cycleCountDetailList = cycleCountDetailService.list(lam);// - for(CycleCountDetail item:cycleCountDetailList){ + for (CycleCountDetail item : cycleCountDetailList) { item.setTaskHeaderId(null); item.setTaskHeaderId(null); item.setLastUpdated(new Date()); @@ -180,8 +225,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } } - if(taskHeader.getInternalTaskType()==100||taskHeader.getInternalTaskType()==200){ - if(taskHeader.getToLocation()!=null){ + if (taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_SHELF || taskHeader.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_PICKING) { + if (taskHeader.getToLocation() != null) { //更新托盘、库位状态 locationService.updateStatus(taskHeader.getToLocation(), "empty"); } @@ -210,7 +255,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (shipmentContainerHeader == null) { return AjaxResult.error("出库货箱" + shipmentContainerHeaderId + "未找到,操作中止"); } - if (shipmentContainerHeader.getStatus() > 9) { + if (shipmentContainerHeader.getStatus() >= QuantityConstant.SHIPMENT_CONTAINER_TASK) { return AjaxResult.error("出库货箱" + shipmentContainerHeader.getContainerCode() + "已经生成任务,请不要重复生成,操作中止"); } //获取所有子货箱 @@ -232,40 +277,40 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea //创建任务头 TaskHeader task = new TaskHeader(); //分拣出库 - task.setTaskType(400); + task.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); task.setFromLocation(shipmentContainerHeader.getLocationCode()); task.setToLocation(shipmentContainerHeader.getLocationCode()); //判断是否整出任务,钱柜和AGV不能整出 - //表示整出优先 - //判断当前子货箱所有数量是否等于该托盘对应的所有库存的数量, - //这里必须与库存的在库数量对比,后期可能存在一个配盘在执行任务,后一个配盘又在配这个的情况(这个时候不能整出) - // 如果相等,则说明这个货箱包含了所有的数量,则可以整出,否则,创建拣选任务; - //查询所有库存 - LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); - inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getLocationCode, shipmentContainerHeader.getLocationCode()) - .eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); - List<InventoryDetail> inventories = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); - BigDecimal inventoryTotal = new BigDecimal("0"); - for (InventoryDetail item : inventories) { - inventoryTotal = inventoryTotal.add(item.getQty()); - } - BigDecimal containerTotal = new BigDecimal("0"); - for (ShipmentContainerDetail item : shipmentContainerDetails) { - containerTotal = containerTotal.add(item.getQty()); - } - if (inventoryTotal.compareTo(containerTotal) == 0) { - task.setTaskType(300);//整盘出库 - task.setToLocation(""); - } + //表示整出优先 + //判断当前子货箱所有数量是否等于该托盘对应的所有库存的数量, + //这里必须与库存的在库数量对比,后期可能存在一个配盘在执行任务,后一个配盘又在配这个的情况(这个时候不能整出) + // 如果相等,则说明这个货箱包含了所有的数量,则可以整出,否则,创建拣选任务; + //查询所有库存 + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getLocationCode, shipmentContainerHeader.getLocationCode()) + .eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()); + List<InventoryDetail> inventories = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); + BigDecimal inventoryTotal = new BigDecimal("0"); + for (InventoryDetail item : inventories) { + inventoryTotal = inventoryTotal.add(item.getQty()); + } + BigDecimal containerTotal = new BigDecimal("0"); + for (ShipmentContainerDetail item : shipmentContainerDetails) { + containerTotal = containerTotal.add(item.getQty()); + } + if (inventoryTotal.compareTo(containerTotal) == 0) { + task.setTaskType(QuantityConstant.TASK_TYPE_WHOLESHIPMENT);//整盘出库 + task.setToLocation(""); + } - task.setInternalTaskType(200); + task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_PICKING); task.setAllocationHeadId(shipmentContainerHeader.getId()); task.setWarehouseCode(shipmentContainerHeader.getWarehouseCode()); task.setCompanyCode(shipmentContainerHeader.getCompanyCode()); task.setAssignedUser(ShiroUtils.getLoginName()); task.setConfirmedBy(ShiroUtils.getLoginName()); - task.setStatus(0); + task.setStatus(QuantityConstant.TASK_STATUS_BUILD); task.setContainerCode(shipmentContainerHeader.getContainerCode()); task.setCreatedBy(ShiroUtils.getLoginName()); task.setCreated(new Date()); @@ -296,27 +341,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea taskDetail.setLot(shipmentContainerDetail.getLot()); taskDetail.setBatch(shipmentContainerDetail.getBatch()); taskDetail.setProjectNo(shipmentContainerDetail.getProjectNo()); - taskDetail.setStatus(0); + taskDetail.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskDetail.setWaveId(shipmentContainerDetail.getWaveId()); taskDetail.setInventorySts(shipmentContainerDetail.getInventorySts()); taskDetail.setCreatedBy(ShiroUtils.getLoginName()); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); - flag=taskDetailService.save(taskDetail); - if(flag == false){ + flag = taskDetailService.save(taskDetail); + if (flag == false) { throw new ServiceException("新建任务明细失败,sql报错"); } - shipmentContainerDetail.setStatus(10); + shipmentContainerDetail.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); } //更新货位状态 - shipmentContainerHeader.setStatus(10); + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_TASK); flag = shipmentContainerHeaderService.updateById(shipmentContainerHeader); - if(flag == false){ + if (flag == false) { throw new ServiceException("修改组盘头状态失败,sql报错"); } flag = shipmentContainerDetailService.updateBatchById(shipmentContainerDetails); - if(flag == false){ + if (flag == false) { throw new ServiceException("修改组盘明细状态明细失败,sql报错"); } return AjaxResult.success(task.getId()); @@ -324,9 +369,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea } /** - *下发WCS执行任务 + * 下发WCS执行任务 * 执行任务 - * */ + */ @Override @Transactional public AjaxResult<TaskHeader> sendTaskToWcs(Integer[] taskIds) { @@ -334,12 +379,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea for (Integer taskId : taskIds) { task = taskHeaderService.getById(taskId); - if (task.getStatus() > 9) { + if (task.getStatus() >= QuantityConstant.TASK_STATUS_RELEASE) { return AjaxResult.error("任务" + taskId + "已经下发,请不要重复下发,操作中止"); } + + // 给wcs传递任务 + taskAssignService.wcsTaskAssign(task); //修改任务头表 task.setId(taskId); - task.setStatus(10); + task.setStatus(QuantityConstant.TASK_STATUS_RELEASE); task.setStartPickDateTime(new Date()); //生成时间 task.setLastUpdated(new Date()); task.setLastUpdatedBy(ShiroUtils.getLoginName()); @@ -349,18 +397,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea lambdaWrapper.eq(TaskDetail::getTaskId, task.getId()); List<TaskDetail> taskDetailList = taskDetailService.list(lambdaWrapper); List<TaskDetail> taskDetails = new ArrayList<>(); - for (TaskDetail item:taskDetailList){ - item.setStatus(10); + for (TaskDetail item : taskDetailList) { + item.setStatus(QuantityConstant.TASK_STATUS_RELEASE); item.setLastUpdated(new Date()); item.setLastUpdatedBy(ShiroUtils.getLoginName()); item.setProcessStamp("100"); taskDetails.add(item); //盘点执行修改盘点单据状态为10 - if(task.getTaskType() == 700){ - cycleCountDetailService.updataDetailStatus(item.getBillDetailId(),10); + if (task.getTaskType() == QuantityConstant.TASK_TYPE_CYCLECOUNT) { + cycleCountDetailService.updataDetailStatus(item.getBillDetailId(), QuantityConstant.CYCLECOUNT_STATUS_EXECUTING); } } - if (!taskDetailService.saveOrUpdateBatch(taskDetails)){ + if (!taskDetailService.saveOrUpdateBatch(taskDetails)) { throw new ServiceException("更新任务明细失败"); } @@ -403,28 +451,28 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea // } // } - } return AjaxResult.success("执行下发任务成功", task); } @Override @Transactional - public AjaxResult completeTaskByWMS(Integer[] taskIds) { + public AjaxResult completeTaskByWMS(Integer[] taskIds) { for (int taskId : taskIds) { TaskHeader task = taskHeaderService.getById(taskId); if (task == null) { throw new ServiceException("任务" + taskId + "未找到,执行中止"); } //如果已完成则不管 - if (task.getStatus() == 100) { + if (task.getStatus() == QuantityConstant.TASK_STATUS_COMPLETED) { throw new ServiceException("任务(" + taskId + ")任务已经是完成的!"); } //如果没有库位不能完成 - if (StringUtils.isEmpty(task.getToLocation())) { - throw new ServiceException("任务" + taskId + "没有库位,执行中止"); - } +// if (StringUtils.isEmpty(task.getFromLocation())) { +// throw new ServiceException("任务" + taskId + "没有库位,执行中止"); +// } this.completeTask(task); + } return AjaxResult.success("完成任务成功!"); @@ -438,50 +486,50 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea @Transactional public void completeTask(TaskHeader task) { //区分任务类型 - if (task.getInternalTaskType() == 100) { + if (task.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_SHELF) { //入库任务 completeReceiptTask(task); } - if (task.getInternalTaskType() == 200) { + if (task.getInternalTaskType() == QuantityConstant.TASK_INTENERTYPE_PICKING) { // 出库任务 completeShipmentTask(task); } // 900 出库查看,空托出库查看 - if ( task.getTaskType() == 900) { + if (task.getTaskType() == QuantityConstant.TASK_TYPE_VIEW) { completeSeeOutTask(task); } // 700 盘点 - if ( task.getTaskType() == 700) { + if (task.getTaskType() == QuantityConstant.TASK_TYPE_CYCLECOUNT) { completeCycleCountTask(task); } - if (task.getTaskType() == 800) { + if (task.getTaskType() == QuantityConstant.TASK_TYPE_TRANSFER) { // //移库 completeTransferTask(task); } - if (task.getTaskType() == 500) { + if (task.getTaskType() == QuantityConstant.TASK_TYPE_EMPTYRECEIPT) { //空托盘入库 - completeEmptyIn(task); + completeEmptyIn(task); } - if (task.getTaskType() == 600) { - //空托盘出库 + if (task.getTaskType() == QuantityConstant.TASK_TYPE_EMPTYSHIPMENT) { + //空托盘出库 completeEmptyOut(task); } } /** - *完成入库任务 + * 完成入库任务 */ @Override @Transactional - public AjaxResult completeReceiptTask(TaskHeader task){ + public AjaxResult completeReceiptTask(TaskHeader task) { List<Map<String, Object>> taskReceiptContainerDetail = taskHeaderMapper.getReceiptTask(task.getId()); if (taskReceiptContainerDetail.size() < 1) { return AjaxResult.success("未找到对应任务的入库单号!!!"); } for (Map<String, Object> map : taskReceiptContainerDetail) { //将未完成的任务数量更新到库存表 - if (DataUtils.getInteger(map.get("status")) < 100) { + if (DataUtils.getInteger(map.get("status")) < QuantityConstant.TASK_STATUS_COMPLETED) { LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) .eq(InventoryDetail::getLocationCode, task.getFromLocation()) @@ -528,19 +576,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea detail.setLastUpdatedBy(ShiroUtils.getLoginName());//创建时间 if (!inventoryDetailService.save(detail)) throw new ServiceException("添加库存明细失败"); - } - else { + } else { detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); detail.setLastUpdatedBy(ShiroUtils.getLoginName()); LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); - lambdaUpdateWrapper.eq(InventoryDetail::getId,DataUtils.getInteger(map.get("receiptDetailId"))); + lambdaUpdateWrapper.eq(InventoryDetail::getId, DataUtils.getInteger(map.get("receiptDetailId"))); if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)) throw new ServiceException("更新入库单明细失败"); } //记录库存交易记录 InventoryTransaction inventoryTransaction = new InventoryTransaction(); - inventoryTransaction.setTransactionType(10); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); inventoryTransaction.setWarehouseCode(DataUtils.getString(map.get("warehouseCode"))); inventoryTransaction.setCompanyCode(task.getCompanyCode()); inventoryTransaction.setLocationCode(task.getToLocation()); @@ -553,8 +600,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setBillDetailId(DataUtils.getInteger(map.get("receiptDetailId"))); inventoryTransaction.setBatch(DataUtils.getString(map.get("batch"))); inventoryTransaction.setLot(DataUtils.getString(map.get("lot"))); -// inventoryTransaction.setManufactureDate(new SimpleDateFormat("yyyy-MM-dd").parse(map.get("manufactureDate").toString()));//生产日期 -// inventoryTransaction.setExpirationDate(DataUtils.getDateTime(map.get("expirationDate"))); inventoryTransaction.setInventorySts(DataUtils.getString((map.get("inventorySts")))); inventoryTransaction.setTaskQty(DataUtils.getBigDecimal(map.get("qty"))); inventoryTransaction.setCreated(new Date()); @@ -563,18 +608,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new ServiceException("新增库存记录失败"); //修改任务明细的状态为完成 TaskDetail taskDetail = new TaskDetail(); - taskDetail.setStatus(100); + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); taskDetail.setAgingDate(new Date()); //入库时间 LambdaUpdateWrapper<TaskDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); - lambdaUpdateWrapper.eq(TaskDetail::getTaskId,task.getId()); + lambdaUpdateWrapper.eq(TaskDetail::getTaskId, task.getId()); taskDetailService.update(taskDetail, lambdaUpdateWrapper); - if ( !taskDetailService.update(taskDetail, lambdaUpdateWrapper)){ + if (!taskDetailService.update(taskDetail, lambdaUpdateWrapper)) { throw new ServiceException("修改入库单明细失败"); } //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成 - task.setStatus(100); + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); task.setLastUpdatedBy(ShiroUtils.getLoginName()); task.setLastUpdated(new Date()); LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); @@ -588,7 +633,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea location.setStatus("empty"); LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation()); - if (!locationService.update(location,locationLambdaUpdateWrapper)) + if (!locationService.update(location, locationLambdaUpdateWrapper)) throw new ServiceException("更新库位失败"); //修改容器状态和对应的库位 @@ -597,18 +642,18 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea container.setStatus("some"); LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate(); containerLambdaUpdateWrapper.eq(Container::getCode, task.getContainerCode()); - if (!containerService.update(container, containerLambdaUpdateWrapper)){ + if (!containerService.update(container, containerLambdaUpdateWrapper)) { throw new ServiceException("更新容器失败"); } - //修改组盘表状态为20 + //修改组盘表状态为20 ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); - receiptContainerDetail.setStatus(30); + receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_REVIEWSUCCESS); receiptContainerDetail.setProcessStamp("0"); receiptContainerDetail.setLastUpdated(new Date()); receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(map.get("receiptId"))); - if (! receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)) + if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)) throw new ServiceException("更新组盘状态失败"); @@ -618,22 +663,27 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea receiptContainerHeader.setId(task.getAllocationHeadId()); receiptContainerHeader.setLastUpdated(new Date()); receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); - receiptContainerHeader.setStatus((short) 20); - if (!receiptContainerHeaderService.updateById(receiptContainerHeader)){ + receiptContainerHeader.setStatus((short) QuantityConstant.RECEIPT_CONTAINER_FINISHED.intValue()); + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { throw new ServiceException("更新入库组盘头表状态失败"); } //修改入库单状态 ReceiptHeader receiptHeader = new ReceiptHeader(); - receiptHeader.setFirstStatus(800); - receiptHeader.setLastStatus(800); + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING); + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING); receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); receiptHeader.setLastUpdated(new Date()); LambdaUpdateWrapper<ReceiptHeader> receiptHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); - receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId,DataUtils.getInteger(map.get("receiptId"))); - if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) + receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId, DataUtils.getInteger(map.get("receiptId"))); + if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) { throw new ServiceException("更新入库头表状态失败"); + } + /* 物料预警*/ + configWarningService.materialWarning(String.valueOf(map.get("materialCode")), String.valueOf(map.get("materialName"))); + /* 空库位剩余数量预警*/ + configWarningService.emptyLocationWarning(); } } @@ -700,10 +750,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); taskHeader.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0));//获取第一个货主 - taskHeader.setInternalTaskType(500); - taskHeader.setTaskType(800); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_CHECK); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_TRANSFER); taskHeader.setContainerCode(loc1.getContainerCode()); - taskHeader.setStatus(1); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(sourceLocation); taskHeader.setToLocation(destinationLocation); taskHeader.setCreated(new Date()); @@ -786,7 +836,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setWarehouseCode(task.getWarehouseCode()); inventoryTransaction.setLocationCode(taskDetail.getToLocation()); inventoryTransaction.setContainerCode(taskDetail.getContainerCode()); - inventoryTransaction.setTransactionType(50); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_ADJUSTPROPERTIES); inventoryTransaction.setMaterialCode(item.getMaterialCode()); inventoryTransaction.setManufactureDate(item.getManufactureDate()); inventoryTransaction.setMaterialName(item.getMaterialName()); @@ -842,16 +892,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea locationService.saveOrUpdate(loc1); locationService.saveOrUpdate(loc2); //更新taskHeader状态 - task.setStatus(100); + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); task.setLastUpdatedBy(ShiroUtils.getLoginName()); task.setLastUpdated(new Date()); taskHeaderService.saveOrUpdate(task); //更新taskDetail状态 - taskDetail.setStatus(100); + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); taskDetail.setLastUpdated(new Date()); taskDetailService.saveOrUpdate(taskDetail); - } /** @@ -893,10 +942,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea TaskHeader taskHeader = new TaskHeader(); taskHeader.setWarehouseCode(inventoryHeader.getWarehouseCode()); taskHeader.setCompanyCode(inventoryHeader.getCompanyCode());//货主 - taskHeader.setInternalTaskType(400); - taskHeader.setTaskType(900); + taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_WORK); + taskHeader.setTaskType(QuantityConstant.TASK_TYPE_VIEW); taskHeader.setContainerCode(inventoryHeader.getContainerCode()); - taskHeader.setStatus(1); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); taskHeader.setFromLocation(inventoryHeader.getLocationCode()); taskHeader.setToLocation(inventoryHeader.getLocationCode()); taskHeader.setCreated(new Date()); @@ -942,7 +991,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea @Transactional @Override public AjaxResult completeSeeOutTask(TaskHeader taskHeader) { - taskHeader.setStatus(100); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 taskHeader.setLastUpdated(new Date()); //更新时间 //task更新明细单总的状态 @@ -953,8 +1002,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail); List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);//查询子单 List<TaskDetail> list = new CopyOnWriteArrayList<>(); - for(TaskDetail item:taskDetailList){ - item.setStatus(100); + for (TaskDetail item : taskDetailList) { + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 item.setLastUpdated(new Date()); //更新时间 list.add(item); @@ -964,22 +1013,23 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new ServiceException("任务单据状态更新失败!"); } //释放库位状态 - locationService.updateStatus(taskHeader.getFromLocation(), "empty"); + locationService.updateStatus(taskHeader.getFromLocation(), "empty"); return AjaxResult.success("完成出库查看任务"); } /** * 盘点完成 + * * @param taskHeader * @return */ @Transactional @Override - public AjaxResult completeCycleCountTask(TaskHeader taskHeader){ + public AjaxResult completeCycleCountTask(TaskHeader taskHeader) { /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位*/ //修改任务主单状态 - taskHeader.setStatus(100); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 taskHeader.setLastUpdated(new Date()); //更新时间 //task更新明细单状态 @@ -992,14 +1042,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea List<TaskDetail> list = new CopyOnWriteArrayList<>(); //修改任务明细状态的同时查找到盘点明细的条目并修改状态,最后修改主单状态 List<CycleCountDetail> cycleCountDetailList = new CopyOnWriteArrayList<>(); - for(TaskDetail item:taskDetailList){ - item.setStatus(100); + for (TaskDetail item : taskDetailList) { + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 item.setLastUpdated(new Date()); //更新时间 list.add(item); CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(item.getBillDetailId());//盘点明细 - cycleCountDetail.setEnableStatus(100); + cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); cycleCountDetail.setCompletedBy(ShiroUtils.getLoginName()); cycleCountDetail.setCompletedAt(new Date()); cycleCountDetailList.add(cycleCountDetail); @@ -1008,7 +1058,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryDetail.setLockCode(""); inventoryDetailService.saveOrUpdate(inventoryDetail); } - if ( taskHeaderService.saveOrUpdate(taskHeader) == false || + if (taskHeaderService.saveOrUpdate(taskHeader) == false || taskDetailService.saveOrUpdateBatch(list) == false || cycleCountDetailService.saveOrUpdateBatch(cycleCountDetailList) == false) { throw new ServiceException("盘点任务单据状态更新失败!"); @@ -1023,13 +1073,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea /** * 完成空托盘入库任务 + * * @param taskHeader */ @Transactional public void completeEmptyIn(TaskHeader taskHeader) { //完成任务,修改主单和明细状态 - taskHeader.setStatus(100); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); taskHeader.setLastUpdated(new Date()); //taskHeaderService.saveOrUpdate(taskHeader); @@ -1041,7 +1092,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail); List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);//查询子单 for (TaskDetail item : taskDetailList) { - item.setStatus(100); + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 item.setLastUpdated(new Date()); //更新时间 taskDetailList.add(item); @@ -1051,20 +1102,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new ServiceException("任务单据状态更新失败!"); } //解锁容器,更新库位 - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(),taskHeader.getToLocation(),"empty"); + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), "empty"); //解锁库位,更新容器 - locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(),taskHeader.getContainerCode(),"empty"); + locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), "empty"); } /** * 完成空托盘出库任务 + * * @param taskHeader */ @Transactional public void completeEmptyOut(TaskHeader taskHeader) { - taskHeader.setStatus(100); + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); taskHeader.setLastUpdated(new Date()); //taskHeaderService.saveOrUpdate(taskHeader); @@ -1076,7 +1128,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail); List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);//查询子单 for (TaskDetail item : taskDetailList) { - item.setStatus(100); + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户 item.setLastUpdated(new Date()); //更新时间 taskDetailList.add(item); @@ -1093,6 +1145,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea /** * 创建上架任务 + * * @param ids * @return */ @@ -1120,15 +1173,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea if (list.size() < 1) throw new ServiceException("没有组盘明细,请先组盘!"); - if (receiptContainerHeader.getStatus() == 0) { - if (receiptContainerHeader.getStatus().intValue() < 10) { - receiptContainerHeader.setStatus((short) 10); + if (receiptContainerHeader.getStatus() == QuantityConstant.RECEIPT_CONTAINER_BUILD.intValue()) { + if (receiptContainerHeader.getStatus().intValue() < QuantityConstant.RECEIPT_CONTAINER_TASK) { + receiptContainerHeader.setStatus((short) QuantityConstant.RECEIPT_CONTAINER_TASK.intValue()); receiptContainerHeaderService.updateById(receiptContainerHeader); } //添加任务主表 TaskHeader task = new TaskHeader(); task.setAllocationHeadId(receiptContainerHeader.getId()); - task.setInternalTaskType(100); + task.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); task.setWarehouseCode(receiptContainerHeader.getWarehouseCode()); task.setCompanyCode(receiptContainerHeader.getCompanyCode()); task.setFromLocation(receiptContainerHeader.getFromLocation()); @@ -1136,20 +1189,34 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea task.setFromLocation(receiptContainerHeader.getFromLocation()); task.setToLocation(receiptContainerHeader.getToLocation()); task.setContainerCode(receiptContainerHeader.getContainerCode()); + task.setRecvDock(receiptContainerHeader.getRecvDock()); task.setCreated(new Date()); task.setCreatedBy(ShiroUtils.getLoginName()); - if (this.save(task)){ + if (this.save(task)) { //添加任务明细表 - for(ReceiptContainerDetail item : list) { + int conatinQty = 0; + for (ReceiptContainerDetail item : list) { + LambdaQueryWrapper<ContainerCapacity> lambdaQueryWrapper = Wrappers.lambdaQuery(); + String[] containCodeSplit = task.getContainerCode().split("\\D"); + String containType = containCodeSplit[0]; + lambdaQueryWrapper.eq(ContainerCapacity::getContainerType, task.getContainerCode()) + .eq(ContainerCapacity::getMaterialCode, item.getMaterialCode()) + .eq(ContainerCapacity::getWarehouseCode, ShiroUtils.getWarehouseCode()) + .eq(ContainerCapacity::getEnable, 0); + ContainerCapacity containerCapacity = containerCapacityService.getOne(lambdaQueryWrapper); + TaskDetail taskDetail = new TaskDetail(); taskDetail.setTaskId(task.getId()); taskDetail.setTaskType(Integer.valueOf(receiptContainerHeaderService.getById(item.getReceiptContainerId()).getTaskType())); - taskDetail.setInternalTaskType(100); + taskDetail.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_SHELF); taskDetail.setWarehouseCode(task.getWarehouseCode()); + taskDetail.setAllocationId(item.getReceiptId()); taskDetail.setCompanyCode(task.getCompanyCode()); taskDetail.setCompanyCode(task.getCompanyCode()); taskDetail.setMaterialCode(item.getMaterialCode()); taskDetail.setMaterialName(item.getMaterialName()); + taskDetail.setMaterialSpec(item.getMaterialSpec()); + taskDetail.setMaterialUnit(item.getMaterialUnit()); taskDetail.setBillCode(item.getReceiptCode()); taskDetail.setBillDetailId(item.getReceiptDetailId()); taskDetail.setBillCode(item.getReceiptCode()); @@ -1158,38 +1225,46 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea taskDetail.setFromLocation(task.getFromLocation()); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); taskDetail.setBatch(item.getBatch()); - if (!taskDetailService.save(taskDetail)){ + if (containerCapacity != null) { + conatinQty += (int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue()); + taskDetail.setContainQty((int) Math.floor(item.getQty().intValue() / containerCapacity.getQty().intValue())); + } + if (!taskDetailService.save(taskDetail)) { throw new ServiceException("生成任务明细失败"); } //更新入库组盘明细状态 - item.setStatus(10); - if (!receiptContainerDetailService.updateById(item)){ + item.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); + if (!receiptContainerDetailService.updateById(item)) { throw new ServiceException("更新入库组盘明细状态出错"); } ReceiptDetail receiptDetail = receiptDetailService.getById(item.getReceiptDetailId()); - if ("300".equals(receiptDetail.getProcessStamp())){ - ReceiptDetail detail = receiptDetailService.queryflow(receiptDetail); - if (!receiptDetailService.updateById(detail)){ - throw new ServiceException("更新入库单详情失败"); - } - //更新头表状态 - receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); + + ReceiptDetail detail = receiptDetailService.queryflow(receiptDetail); + if (!receiptDetailService.updateById(detail)) { + throw new ServiceException("更新入库单详情失败"); } + //更新头表状态 + receiptDetailService.updateReceiptHeaderLastStatus(receiptDetail.getReceiptId()); + + } + + task.setContainQty(conatinQty); + if (!taskHeaderService.updateById(task)) { + throw new ServiceException("更新任务头表容器数量失败"); } } else { throw new ServiceException("生成任务头表失败"); } } } - return AjaxResult.success("生成上架任务成功!"); + return AjaxResult.success("生成上架任务成功!"); } /** - * * 完成出库任务 - * */ + */ @Override @Transactional public void completeShipmentTask(TaskHeader task) { @@ -1199,8 +1274,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea LambdaQueryWrapper<TaskDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(condition); List<TaskDetail> taskDetails = taskDetailService.list(lambdaQueryWrapper); List<Integer> shipmentHeadIds = new ArrayList<>(); - for(TaskDetail taskDetail : taskDetails){ - if(taskDetail.getStatus()<20){ + for (TaskDetail taskDetail : taskDetails) { + if (taskDetail.getStatus() < QuantityConstant.TASK_STATUS_RUNNING) { //获取出库子货箱 ShipmentContainerDetail shipmentContainerDetail = shipmentContainerDetailService.getById(taskDetail.getAllocationId()); //取出子单据 @@ -1209,7 +1284,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea shipmentHeadIds.add(shipmentDetail.getShipmentId()); //获取对应库存记录 InventoryDetail inventoryDetail = inventoryDetailService.getById(taskDetail.getToInventoryId()); - if (inventoryDetail == null) { + if (inventoryDetail == null) { throw new ServiceException("任务明细对应的库存ID【" + taskDetail.getToInventoryId().toString() + "】不存在!"); } BigDecimal orignalQty = inventoryDetail.getQty(); @@ -1219,17 +1294,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea //扣减库存明细 inventoryDetail.setTaskQty(inventoryDetail.getTaskQty().subtract(taskDetail.getQty())); inventoryDetail.setQty(inventoryDetail.getQty().subtract(taskDetail.getQty())); - if(inventoryDetail.getQty().compareTo(new BigDecimal("0"))==0 && inventoryDetail.getTaskQty().compareTo(new BigDecimal("0"))==0){ + if (inventoryDetail.getQty().compareTo(new BigDecimal("0")) == 0 && inventoryDetail.getTaskQty().compareTo(new BigDecimal("0")) == 0) { //如果库存没有了,就删除这个库存 inventoryDetailService.removeById(inventoryDetail.getId()); inventoryHeaderService.removeById(inventoryHeader.getId()); - }else { + } else { //否则更新这个库存 inventoryDetailService.updateById(inventoryDetail); inventoryHeaderService.updateById(inventoryHeader); } //设置子任务状态为已执行 - taskDetail.setStatus(100); + taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); taskDetail.setLastUpdated(new Date());//完成时间 taskDetailService.updateById(taskDetail); @@ -1239,7 +1314,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea inventoryTransaction.setCompanyCode(shipmentDetail.getCompanyCode()); inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); - inventoryTransaction.setTransactionType(20); + inventoryTransaction.setTransactionType(QuantityConstant.INVENTORY_TRANSACTION_SHIPMENT); inventoryTransaction.setMaterialCode(shipmentDetail.getMaterialCode()); inventoryTransaction.setMaterialName(shipmentDetail.getMaterialName()); inventoryTransaction.setMaterialSpec(shipmentDetail.getMaterialSpec()); @@ -1263,55 +1338,68 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea // //更新单据状态 // shipmentHeaderService.updateShipmentStatus(shipmentHeader.getId()); } + /* 物料预警*/ + configWarningService.materialWarning(taskDetail.getMaterialCode(), taskDetail.getMaterialName()); + /* 空库位剩余数量预警*/ + configWarningService.emptyLocationWarning(); } //设置主任务为已执行 - task.setStatus(100); + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); task.setLastUpdatedBy(ShiroUtils.getLoginName()); task.setLastUpdated(new Date()); taskHeaderService.updateById(task); - //如果是临时容器出库完成后删除容器 - containerService.removeByCode(task.getContainerCode()); //将库位状态改为空闲,如果是整出的对应的容器也清空 - LambdaQueryWrapper<Location> lam=Wrappers.lambdaQuery(); - lam.eq(Location::getCode,task.getToLocation()); + LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery(); + lam.eq(Location::getCode, task.getFromLocation()); Location locationRecord = locationService.getOne(lam); - if(lam == null){ - throw new ServiceException("系统没有"+task.getToLocation()+"库位"); + if (lam == null) { + throw new ServiceException("系统没有" + task.getToLocation() + "库位"); } locationRecord.setStatus("empty"); - if(task.getTaskType()==300) { + if (task.getTaskType() == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { locationRecord.setContainerCode(""); } locationService.updateById(locationRecord); //如果是整出,删掉这个库位上的这个托盘,否则更改托盘状态 - Container containerRecord = new Container(); - if(task.getTaskType()==300) { - containerService.updateLocationCodeAndStatus(task.getContainerCode(),"","empty"); + LambdaQueryWrapper<Container> containerLam = Wrappers.lambdaQuery(); + containerLam.eq(Container::getCode, task.getContainerCode()); + Container ctn = containerService.getOne(containerLam); + if (ctn == null) { + throw new ServiceException("系统无此容器"); } - else{ + if (task.getTaskType() == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { + if (ctn.getContainerType().equals("LS")) { + Boolean flag = containerService.removeById(ctn.getId()); + if (flag == false) { + throw new ServiceException("删除临时容器失败"); + } + } else { + containerService.updateLocationCodeAndStatus(task.getContainerCode(), "", "empty"); + } + } else { //查询是否存在关联的库存,入如果没有就修改容器状态为empty InventoryDetail inventoryCondition = new InventoryDetail(); inventoryCondition.setLocationCode(task.getToLocation()); LambdaQueryWrapper<InventoryDetail> inventoryDetaillambdaQueryWrapper = Wrappers.lambdaQuery(); - inventoryDetaillambdaQueryWrapper.eq(InventoryDetail::getLocationCode,task.getToLocation()); - List<InventoryDetail> detailList= inventoryDetailService.list(); + inventoryDetaillambdaQueryWrapper.eq(InventoryDetail::getLocationCode, task.getToLocation()); + List<InventoryDetail> detailList = inventoryDetailService.list(); //库存查询不到该容器就把容器状态改为可用 - if (detailList.size()<1) { - Container container =new Container(); + if (detailList.size() < 1) { + Container container = new Container(); container.setCode(task.getToLocation()); condition.setToLocation(""); - LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate(); - containerLambdaUpdateWrapper.eq(Container::getCode,task.getToLocation()); - containerService.update(containerLambdaUpdateWrapper); + LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate(); + containerLambdaUpdateWrapper.eq(Container::getCode, task.getToLocation()); + containerService.update(containerLambdaUpdateWrapper); } } //设置出库货箱状态为拣货任务完成 - for(TaskDetail taskDetail : taskDetails) { + for (TaskDetail taskDetail : taskDetails) { ShipmentContainerDetail shipmentContainerDetail = new ShipmentContainerDetail(); - shipmentContainerDetail.setStatus(30); + shipmentContainerDetail.setStatus(QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS); shipmentContainerDetail.setLastUpdated(new Date()); shipmentContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName()); LambdaUpdateWrapper<ShipmentContainerDetail> shipmentContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); @@ -1320,49 +1408,53 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea throw new ServiceException("更新组盘明细状态失败"); } } - //设置出库货箱表头状态为拣货任务完成 + //设置出库货箱表头状态为拣货任务完成 ShipmentContainerHeader shipmentContainerHeader = new ShipmentContainerHeader(); - shipmentContainerHeader.setStatus(30); + shipmentContainerHeader.setStatus(QuantityConstant.SHIPMENT_CONTAINER_REVIEWSUCCESS); shipmentContainerHeader.setLastUpdated(new Date()); shipmentContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); LambdaUpdateWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); - shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId,task.getAllocationHeadId()); - if (! shipmentContainerHeaderService.update(shipmentContainerHeader, shipmentContainerHeaderLambdaUpdateWrapper)) + shipmentContainerHeaderLambdaUpdateWrapper.eq(ShipmentContainerHeader::getId, task.getAllocationHeadId()); + if (!shipmentContainerHeaderService.update(shipmentContainerHeader, shipmentContainerHeaderLambdaUpdateWrapper)) { throw new ServiceException("更新组盘头状态失败"); - //修改出库单状态 - LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); - taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId,task.getId()); - List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); - - for (TaskDetail taskDeatails: taskDetailList) { - LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); - shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getId,taskDeatails.getBillDetailId()); - - ShipmentHeader shipmentHeader =new ShipmentHeader(); - shipmentHeader.setId(shipmentDetailService.getOne(shipmentDetailLambdaQueryWrapper).getShipmentId()); - shipmentHeader.setFirstStatus(300); - shipmentHeader.setLastStatus(300); - shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); - shipmentHeader.setLastUpdated(new Date()); - shipmentHeaderService.updateById(shipmentHeader); + } + //修改出库单状态 + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskId, task.getId()); + List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); + + HashSet<Integer> ids = new HashSet<>(); + for (TaskDetail taskDeatails : taskDetailList) { + LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); + shipmentDetailLambdaQueryWrapper.eq(ShipmentDetail::getId, taskDeatails.getBillDetailId()); + ShipmentDetail shipmentDetail = shipmentDetailService.getOne(shipmentDetailLambdaQueryWrapper); + if (shipmentDetail == null) { + throw new ServiceException("查找出库单明细失败"); + } + if (shipmentDetail.getShipQty().compareTo(shipmentDetail.getRequestQty()) == 0) { + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); + shipmentDetailService.updateById(shipmentDetail); + } + ids.add(shipmentDetail.getShipmentId()); + } + + for (Integer id : ids) { + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(id); + if (shipmentHeader != null) { + Map<String, Integer> status = shipmentDetailService.selectStatus(shipmentHeader.getId()); + Integer maxStatus = status.get("maxStatus"); + Integer minStatus = status.get("minStatus"); + if (maxStatus == QuantityConstant.SHIPMENT_HEADER_COMPLETED) { + shipmentHeader.setFirstStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); } + if (minStatus == QuantityConstant.SHIPMENT_HEADER_COMPLETED) { + shipmentHeader.setLastStatus(QuantityConstant.SHIPMENT_HEADER_COMPLETED); + } + shipmentHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); + shipmentHeader.setLastUpdated(new Date()); + shipmentHeaderService.updateById(shipmentHeader); + } + } } - - - - - - - - - - - - - - - - - -} +} \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..f699ea0 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,69 @@ +# 数据源配置 +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.cj.jdbc.Driver + druid: + # 主库 + master: + url: jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 + username: softhuaheng + password: HHrobot123. + # 从库 + slave: + # 从库不启用 + enabled: false + url: + username: + password: + # 初始连接数 + initialSize: 5 + # 最小连接池数量 + minIdle: 10 + # 最大连接池数量 + maxActive: 20 + # 配置获取连接等待超时的时间 + maxWait: 5000 + # \配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 30000 + #配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 300000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: false + testOnReturn: false + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: + login-password: + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + +#日志配置 +logging: + level: + com.huaheng: debug + org.springframework: warn + spring.springboot.dao: DEBUG + +server: + port: 8888 + servlet: + context-path: /twms/ diff --git a/src/main/resources/application-druid.properties b/src/main/resources/application-druid.properties index 54782c1..dbc7477 100644 --- a/src/main/resources/application-druid.properties +++ b/src/main/resources/application-druid.properties @@ -2,7 +2,7 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver # \u4E3B\u5E93 -spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false +spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false #spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms2.0?characterEncoding=utf8&serverTimezone=GMT%2b8 @@ -39,4 +39,12 @@ spring.datasource.druid.stat-view-servlet.url-pattern=/monitor/druid/* spring.datasource.druid.filter.stat.log-slow-sql=true spring.datasource.druid.filter.stat.slow-sql-millis=1000 spring.datasource.druid.filter.stat.merge-sql=false -spring.datasource.druid.filter.wall.config.multi-statement-allow=true \ No newline at end of file +spring.datasource.druid.filter.wall.config.multi-statement-allow=true +#\u65E5\u5FD7\u914D\u7F6E +logging.level.com.huaheng=debug +logging.level.org.springframework=warn +logging.level.spring.springboot.dao=DEBUG + +#\u6D4B\u8BD5\u670D\u52A1\u7AEF\u53E3\u3001\u6D4B\u8BD5\u9879\u76EEcontextPath +server.port= +server.servlet.context-path= diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 5354a21..ed7db5d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,7 @@ +spring: + profiles: + active: dev +--- #项目相关配置 #名称 huaheng: @@ -11,19 +15,8 @@ huaheng: # 获取ip地址开关 addressEnabled: false -#开发环境配置 #测试服务端口、测试项目contextPath server: - port: 8888 - servlet: - context-path: /twms/ - #示例服务端口、示例项目contextPath - #server.port=8889 - #server.servlet.context-path=/ewms/ - #正式服务端口、正式项目contextPath - #server.port=8016 - #server.servlet.context-path=/wms/ - # tomcat的URI编码 tomcat: uri-encoding: UTF-8 # tomcat最大线程数,默认为200 @@ -31,12 +24,6 @@ server: # Tomcat启动初始化的线程数,默认值25 min-spare-threads: 30 -#日志配置 -logging: - level: - com.huaheng: debug - org.springframework: warn - spring.springboot.dao: DEBUG # 用户配置 user: diff --git a/src/main/resources/mybatis/config/AddressMapper.xml b/src/main/resources/mybatis/config/AddressMapper.xml new file mode 100644 index 0000000..6d76e05 --- /dev/null +++ b/src/main/resources/mybatis/config/AddressMapper.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.huaheng.pc.config.address.mapper.AddressMapper"> + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.address.domain.Address"> + <!--@mbg.generated--> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> + <result column="param" jdbcType="VARCHAR" property="param" /> + <result column="url" jdbcType="VARCHAR" property="url" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, warehouseCode, param,url + </sql> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/CompanyMapper.xml b/src/main/resources/mybatis/config/CompanyMapper.xml index 2bb69a7..bf126b1 100644 --- a/src/main/resources/mybatis/config/CompanyMapper.xml +++ b/src/main/resources/mybatis/config/CompanyMapper.xml @@ -58,4 +58,76 @@ where company.warehouseCode = #{warehouseCode} </select> + <select id="selectListEntityByEqual" resultType="com.huaheng.pc.config.company.domain.Company"> + SELECT id, code, warehouseCode, `name`, attentionTo, address1, address2, district, city, + province, country, postalCode, phoneNum, mobile, email, created, createdBy, lastUpdated, lastUpdatedBy, + version, userDef1, userDef2, userDef3, processStamp + FROM company + <where> + <if test="id != null"> + AND id = #{id} + </if> + <if test="code != null"> + AND code = #{code} + </if> + <if test="name != null"> + AND name = #{name} + </if> + <if test="address1 != null"> + AND address1 = #{address1} + </if> + <if test="address2 != null"> + AND address2 = #{address2} + </if> + <if test="city != null"> + AND city = #{city} + </if> + <if test="province != null"> + AND province = #{province} + </if> + <if test="country != null"> + AND country = #{country} + </if> + <if test="postalCode != null"> + AND postalCode = #{postalCode} + </if> + <if test="attentionTo != null"> + AND attentionTo = #{attentionTo} + </if> + <if test="phoneNum != null"> + AND phoneNum = #{phoneNum} + </if> + <if test="mobile != null"> + AND mobile = #{mobile} + </if> + <if test="email != null"> + AND email = #{email} + </if> + <if test="created != null"> + AND created = #{created} + </if> + <if test="createdBy != null"> + AND createdBy = #{createdBy} + </if> + <if test="lastUpdated != null"> + AND lastUpdated = #{lastUpdated} + </if> + <if test="lastUpdatedBy != null"> + AND lastUpdatedBy = #{lastUpdatedBy} + </if> + <if test="deleted != null"> + AND deleted = #{deleted} + </if> + <if test="userDef1 != null"> + AND userDef1 = #{userDef1} + </if> + <if test="userDef2 != null"> + AND userDef2 = #{userDef2} + </if> + <if test="userDef3 != null"> + AND userDef3 = #{userDef3} + </if> + </where> + </select> + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/ConfigWarningMapper.xml b/src/main/resources/mybatis/config/ConfigWarningMapper.xml new file mode 100644 index 0000000..4f44e3f --- /dev/null +++ b/src/main/resources/mybatis/config/ConfigWarningMapper.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.huaheng.pc.config.configWarning.mapper.ConfigWarningMapper"> + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.configWarning.domain.ConfigWarning"> + <!--@mbg.generated--> + <!--@Table config_warning--> + <id column="id" jdbcType="INTEGER" property="id" /> + <id column="code" jdbcType="VARCHAR" property="code" /> + <result column="type" jdbcType="VARCHAR" property="type" /> + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> + <result column="companyCode" jdbcType="VARCHAR" property="companyCode" /> + <result column="materialCode" jdbcType="VARCHAR" property="materialCode" /> + <result column="max" jdbcType="DECIMAL" property="max" /> + <result column="min" jdbcType="DECIMAL" property="min" /> + <result column="remark" jdbcType="VARCHAR" property="remark" /> + <result column="created" jdbcType="TIMESTAMP" property="created" /> + <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, code, `type`, warehouseCode, companyCode, materialCode, `max`, `min`, remark, + created, createdBy, lastUpdated, lastUpdatedBy + </sql> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/CycleCountPreferenceMapper.xml b/src/main/resources/mybatis/config/CycleCountPreferenceMapper.xml index 6205b44..aedf5f4 100644 --- a/src/main/resources/mybatis/config/CycleCountPreferenceMapper.xml +++ b/src/main/resources/mybatis/config/CycleCountPreferenceMapper.xml @@ -7,12 +7,12 @@ <result column="code" jdbcType="VARCHAR" property="code" /> <result column="name" jdbcType="VARCHAR" property="name" /> <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> - <result column="promptLocation" jdbcType="VARCHAR" property="promptLocation" /> - <result column="promptLpn" jdbcType="VARCHAR" property="promptLpn" /> - <result column="promptItem" jdbcType="VARCHAR" property="promptItem" /> - <result column="promptQuantity" jdbcType="INTEGER" property="promptQuantity" /> - <result column="allowAddNewInventory" jdbcType="INTEGER" property="allowAddNewInventory" /> - <result column="Enable" jdbcType="BOOLEAN" property="enable" /> + <result column="promptLocation" jdbcType="BOOLEAN" property="promptLocation" /> + <result column="promptLpn" jdbcType="BOOLEAN" property="promptLpn" /> + <result column="promptItem" jdbcType="BOOLEAN" property="promptItem" /> + <result column="promptQuantity" jdbcType="BOOLEAN" property="promptQuantity" /> + <result column="allowAddNewInventory" jdbcType="BOOLEAN" property="allowAddNewInventory" /> + <result column="enable" jdbcType="BOOLEAN" property="enable" /> <result column="created" jdbcType="TIMESTAMP" property="created" /> <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> @@ -22,12 +22,12 @@ <result column="userDef2" jdbcType="VARCHAR" property="userDef2" /> <result column="userDef3" jdbcType="VARCHAR" property="userDef3" /> <result column="processStamp" jdbcType="VARCHAR" property="processStamp" /> - <result column="countByPiece" jdbcType="INTEGER" property="countByPiece" /> + <result column="countByPiece" jdbcType="BOOLEAN" property="countByPiece" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> id, code, `name`, warehouseCode, promptLocation, promptLpn, promptItem, promptQuantity, - allowAddNewInventory, `Enable`, created, createdBy, lastUpdated, lastUpdatedBy, version, + allowAddNewInventory, enable, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, processStamp, countByPiece </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/FilterConfigDetailMapper.xml b/src/main/resources/mybatis/config/FilterConfigDetailMapper.xml index 294d19a..7879c53 100644 --- a/src/main/resources/mybatis/config/FilterConfigDetailMapper.xml +++ b/src/main/resources/mybatis/config/FilterConfigDetailMapper.xml @@ -33,4 +33,24 @@ version, userDef1, userDef2, userDef3, userDef4, processStamp, filterName </sql> + + + <insert id="filterConfigDetailCopy"> + insert into filter_config_detail(headerId, code, moduleType, recordType, filterCode, warehouseCode, description, + `statement`,statements, systemCreated, customSql, createdBy, lastUpdatedBy, + version,processStamp, filterName) + select headerId, code, moduleType, recordType, filterCode, #{newCode}, description, + `statement`,statements, systemCreated, customSql,createdBy, lastUpdatedBy,version, + processStamp, filterName from filter_config_detail + where warehouseCode =#{code} + + </insert> + + <update id="updateHeaderId"> + update filter_config_detail d + inner join filter_config_header t + on t.filterCode=d.filterCode and d.warehouseCode=t.warehouseCode and d.warehouseCode=#{code} + set d.headerId=t.id + + </update> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/FilterConfigHeaderMapper.xml b/src/main/resources/mybatis/config/FilterConfigHeaderMapper.xml index df68781..cba48da 100644 --- a/src/main/resources/mybatis/config/FilterConfigHeaderMapper.xml +++ b/src/main/resources/mybatis/config/FilterConfigHeaderMapper.xml @@ -28,4 +28,15 @@ created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, processStamp, filterName </sql> + + + <insert id="filterConfigHeaderCopy"> + insert into filter_config_header(moduleType, recordType, filterCode, warehouseCode, description, systemCreated, + createdBy, lastUpdatedBy, version, processStamp, filterName) + select moduleType, recordType, filterCode, #{newCode}, description, systemCreated, + createdBy, lastUpdatedBy, version, processStamp, filterName from filter_config_header + where warehouseCode = #{code} + + + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/LocationMapper.xml b/src/main/resources/mybatis/config/LocationMapper.xml index 00802a4..ebff61c 100644 --- a/src/main/resources/mybatis/config/LocationMapper.xml +++ b/src/main/resources/mybatis/config/LocationMapper.xml @@ -13,6 +13,7 @@ <result column="iColumn" jdbcType="INTEGER" property="iColumn" /> <result column="iLayer" jdbcType="INTEGER" property="iLayer" /> <result column="iGrid" jdbcType="INTEGER" property="iGrid" /> + <result column="roadway" jdbcType="VARCHAR" property="roadway" /> <result column="name" jdbcType="VARCHAR" property="name" /> <result column="lastCycleCountDate" jdbcType="TIMESTAMP" property="lastCycleCountDate" /> <result column="created" jdbcType="TIMESTAMP" property="created" /> @@ -33,7 +34,7 @@ <sql id="Base_Column_List"> <!--@mbg.generated--> id, code, warehouseCode, zoneCode, locationType, containerCode, iRow, iColumn, iLayer, - iGrid, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, + iGrid, roadway, `name`, `enable`, lastCycleCountDate, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, systemCreated </sql> @@ -49,4 +50,15 @@ UPDATE location set `status`=#{status},containerCode=#{containerCode} WHERE warehouseCode=#{warehouseCode} AND `code`=#{locationCode} </update> + <select id="getAllLocation" resultType="com.huaheng.pc.config.location.domain.Location"> + select max(iRow) as iRow,max(iColumn) as iColumn,max(iLayer) as iLayer,max(iGrid) as iGrid from location l where l.warehouseCode=#{warehouseCode} AND l.locationType=#{type} + </select> + + <select id="getLocationProp" resultType="java.util.LinkedHashMap"> + SELECT w.name warehouseName,ifnull(convert(a.num1/(b.num2+a.num1),decimal(15,2)),0) '有货',ifnull(convert(b.num2/(b.num2+a.num1),decimal(15,2)),0) '无货' from warehouse w + left join + (SELECT count(1) num1,warehouseCode FROM location WHERE containerCode!='' GROUP BY warehouseCode) a on a.warehouseCode=w.code + LEFT JOIN + (SELECT count(1) num2,warehouseCode FROM location WHERE containerCode ='' GROUP BY warehouseCode) b on b.warehouseCode=w.code + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/SendMailMapper.xml b/src/main/resources/mybatis/config/SendMailMapper.xml index 72e0a46..8e5f89e 100644 --- a/src/main/resources/mybatis/config/SendMailMapper.xml +++ b/src/main/resources/mybatis/config/SendMailMapper.xml @@ -20,10 +20,11 @@ <result column="enable" jdbcType="BIT" property="enable" /> <result column="handle" jdbcType="BIT" property="handle" /> <result column="deleted" jdbcType="BIT" property="deleted" /> + <result column="code" jdbcType="VARCHAR" property="code" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> id, warehouseCode, companyCode, `type`, alarmId, warningLevel, sendingLevel, addressee, - email, alarmTime, title, body, created, lastUpdated, `enable`, handle, deleted + email, alarmTime, title, body, created, lastUpdated, `enable`, handle, deleted, code </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/StationMapper.xml b/src/main/resources/mybatis/config/StationMapper.xml new file mode 100644 index 0000000..3b74cac --- /dev/null +++ b/src/main/resources/mybatis/config/StationMapper.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.huaheng.pc.config.station.mapper.StationMapper"> + <resultMap id="BaseResultMap" type="com.huaheng.pc.config.station.domain.Station"> + <!--@mbg.generated--> + <!--@Table station--> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="code" jdbcType="VARCHAR" property="code" /> + <result column="status" jdbcType="INTEGER" property="status" /> + <result column="code" jdbcType="VARCHAR" property="code" /> + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> + <result column="created" jdbcType="TIMESTAMP" property="created" /> + <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, code, `status`, type, warehouseCode, created, createdBy, lastUpdated, lastUpdatedBy + </sql> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/StatusFlowDetailMapper.xml b/src/main/resources/mybatis/config/StatusFlowDetailMapper.xml index 9884dec..2ac2749 100644 --- a/src/main/resources/mybatis/config/StatusFlowDetailMapper.xml +++ b/src/main/resources/mybatis/config/StatusFlowDetailMapper.xml @@ -33,4 +33,21 @@ nessary, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, processStamp </sql> + + <insert id="statusFlowDetailCopy"> + insert into status_flow_detail(headerId,headerCode, flowCode, warehouseCode, moduleType, recordType, `enable`, `sequence`, + nessary, createdBy, lastUpdatedBy, version, processStamp) + select headerId,headerCode, flowCode, #{newCode}, moduleType, recordType, `enable`, `sequence`, + nessary, createdBy, lastUpdatedBy, version,processStamp from status_flow_detail + where warehouseCode =#{code} + + </insert> + + <update id="updateHeaderId"> + update status_flow_detail d + inner join status_flow_header t + on t.code=d.headerCode and d.warehouseCode=t.warehouseCode and d.warehouseCode=#{code} + set d.headerId=t.id + + </update> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/StatusFlowHeaderMapper.xml b/src/main/resources/mybatis/config/StatusFlowHeaderMapper.xml index 6527b96..6084930 100644 --- a/src/main/resources/mybatis/config/StatusFlowHeaderMapper.xml +++ b/src/main/resources/mybatis/config/StatusFlowHeaderMapper.xml @@ -32,4 +32,11 @@ lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, processStamp, systemCreated </sql> + + + <insert id="statusFlowHeaderCopy"> + insert into status_flow_header(code,name,warehouseCode,moduleType,recordType,enable,createdBy,lastUpdatedBy,version,processStamp,systemCreated) + select code,name,#{newCode},moduleType,recordType,enable,createdBy, lastUpdatedBy,version,processStamp,systemCreated from status_flow_header + where warehouseCode = #{code} + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/WarehouseMapper.xml b/src/main/resources/mybatis/config/WarehouseMapper.xml index 4c719c5..28661bf 100644 --- a/src/main/resources/mybatis/config/WarehouseMapper.xml +++ b/src/main/resources/mybatis/config/WarehouseMapper.xml @@ -59,6 +59,92 @@ code, address1, address2, city, `state`, district, country, postalCode, attentionTo, phoneNum, faxNum, email, hostCode, `name`, `enable`, orgCode, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, - userDef6, userDef7, userDef8, delete + userDef6, userDef7, userDef8, deleted </sql> + + <insert id="companyCopy"> + insert into warehouse_company(warehouseCode,companyId,companyCode) + select #{newWarehouseCode},companyId,companyCode from warehouse_company where warehouseCode=#{warehouseCode} + </insert> + + <select id="selectListEntityByEqual" resultType="com.huaheng.pc.config.warehouse.domain.Warehouse"> + SELECT code, name, address1, address2, city, state, district, country, postalCode, attentionTo, phoneNum, faxNum, + email, hostCode,orgCode, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3 + FROM warehouse + <where> + <if test="code != null"> + AND code = #{code} + </if> + <if test="name != null"> + AND name = #{name} + </if> + <if test="address1 != null"> + AND address1 = #{address1} + </if> + <if test="address2 != null"> + AND address2 = #{address2} + </if> + <if test="city != null"> + AND city = #{city} + </if> + <if test="state != null"> + AND state = #{state} + </if> + <if test="district != null"> + AND district = #{district} + </if> + <if test="country != null"> + AND country = #{country} + </if> + <if test="postalCode != null"> + AND postalCode = #{postalCode} + </if> + <if test="attentionTo != null"> + AND attentionTo = #{attentionTo} + </if> + <if test="phoneNum != null"> + AND phoneNum = #{phoneNum} + </if> + <if test="faxNum != null"> + AND faxNum = #{faxNum} + </if> + <if test="email != null"> + AND email = #{email} + </if> + <if test="hostCode != null"> + AND hostCode = #{hostCode} + </if> + <if test="orgCode != null"> + AND orgCode = #{orgCode} + </if> + <if test="created != null"> + AND created = #{created} + </if> + <if test="createdBy != null"> + AND createdBy = #{createdBy} + </if> + <if test="lastUpdated != null"> + AND lastUpdated = #{lastUpdated} + </if> + <if test="lastUpdatedBy != null"> + AND lastUpdatedBy = #{lastUpdatedBy} + </if> + <if test="enable != null"> + AND enable = #{enable} + </if> + <if test="deleted != null"> + AND deleted = #{deleted} + </if> + <if test="userDef1 != null"> + AND userDef1 = #{userDef1} + </if> + <if test="userDef2 != null"> + AND userDef2 = #{userDef2} + </if> + <if test="userDef3 != null"> + AND userDef3 = #{userDef3} + </if> + </where> + </select> + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/WaveFlowDetailMapper.xml b/src/main/resources/mybatis/config/WaveFlowDetailMapper.xml index 91d07b0..e03c303 100644 --- a/src/main/resources/mybatis/config/WaveFlowDetailMapper.xml +++ b/src/main/resources/mybatis/config/WaveFlowDetailMapper.xml @@ -31,4 +31,24 @@ value1, value2, value3, value4, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, processStamp </sql> + + + <insert id="waveFlowDetailCopy"> + insert into wave_flow_detail(headerId, waveFlowCode, warehouseCode, `sequence`, waveStepCode, waveStepName, + value1, value2, value3, value4, createdBy, lastUpdatedBy, version,processStamp) + select headerId, waveFlowCode, #{newCode}, `sequence`, waveStepCode, waveStepName, + value1, value2, value3, value4, createdBy, lastUpdatedBy, version, processStamp from wave_flow_detail + where warehouseCode =#{code} + + + </insert> + + <update id="updateHeaderId"> + update wave_flow_detail d + inner join wave_flow_header t + on t.code=d.waveFlowCode and d.warehouseCode=t.warehouseCode and d.warehouseCode=#{code} + set d.headerId=t.id + + </update> + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/WaveFlowHeaderMapper.xml b/src/main/resources/mybatis/config/WaveFlowHeaderMapper.xml index 626cb71..0506861 100644 --- a/src/main/resources/mybatis/config/WaveFlowHeaderMapper.xml +++ b/src/main/resources/mybatis/config/WaveFlowHeaderMapper.xml @@ -22,4 +22,12 @@ id, code, warehouseCode, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, processStamp </sql> + + + <insert id="waveFlowHeaderCopy"> + insert into wave_flow_header(code, warehouseCode, createdBy, lastUpdatedBy, version,processStamp) + select code, #{newCode}, createdBy, lastUpdatedBy, version,processStamp from wave_flow_header + where warehouseCode =#{code} + + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/config/WaveMasterMapper.xml b/src/main/resources/mybatis/config/WaveMasterMapper.xml index 96e5a31..ae1c3d6 100644 --- a/src/main/resources/mybatis/config/WaveMasterMapper.xml +++ b/src/main/resources/mybatis/config/WaveMasterMapper.xml @@ -5,6 +5,7 @@ <!--@mbg.generated--> <id column="id" jdbcType="INTEGER" property="id" /> <result column="code" jdbcType="VARCHAR" property="code" /> + <result column="name" jdbcType="VARCHAR" property="name" /> <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> <result column="sequence" jdbcType="INTEGER" property="sequence" /> <result column="shipmentFilterCode" jdbcType="VARCHAR" property="shipmentFilterCode" /> @@ -37,11 +38,24 @@ </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> - id, code, warehouseCode, `sequence`, shipmentFilterCode, waveFlowCode, statusFlowCode, + id, code,name, warehouseCode, `sequence`, shipmentFilterCode, waveFlowCode, statusFlowCode, shortMode, maxShipments, maxLines, defaultWaveCreateSize, shipmentGroupSize, holdRplnTask, rplnStrategy, rplnQtyUM, maxRplnQty, groupingOrderBy, assignmentRule, needReplenishment, rplnAllocationRule, rplnLocatingRule, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, processStamp </sql> + + <insert id="waveMasterCopy"> + insert into wave_master(code,name, warehouseCode, `sequence`, shipmentFilterCode, waveFlowCode, statusFlowCode, + shortMode, maxShipments, maxLines, defaultWaveCreateSize, shipmentGroupSize, holdRplnTask, + rplnStrategy, rplnQtyUM, maxRplnQty, groupingOrderBy, assignmentRule, needReplenishment, + rplnAllocationRule, rplnLocatingRule, createdBy, lastUpdatedBy,version,processStamp) + select code,name,#{newCode}, `sequence`, shipmentFilterCode, waveFlowCode, statusFlowCode, + shortMode, maxShipments, maxLines, defaultWaveCreateSize, shipmentGroupSize, holdRplnTask, + rplnStrategy, rplnQtyUM, maxRplnQty, groupingOrderBy, assignmentRule, needReplenishment, + rplnAllocationRule, rplnLocatingRule, createdBy, lastUpdatedBy,version,processStamp from wave_master + where warehouseCode =#{code} + + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/inventory/CycleCountDetailMapper.xml b/src/main/resources/mybatis/inventory/CycleCountDetailMapper.xml index 9c2b00f..4cb3d48 100644 --- a/src/main/resources/mybatis/inventory/CycleCountDetailMapper.xml +++ b/src/main/resources/mybatis/inventory/CycleCountDetailMapper.xml @@ -42,6 +42,7 @@ <result column="batch" jdbcType="VARCHAR" property="batch" /> <result column="lot" jdbcType="VARCHAR" property="lot" /> <result column="projectNo" jdbcType="VARCHAR" property="projectNo" /> + <result column="preferenceCode" jdbcType="VARCHAR" property="preferenceCode" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> @@ -50,6 +51,6 @@ companyCode, inventorySts, systemQty, countedQty, gapQty, rejectionNote, countedBy, countedAt, assignedTo, assignedAt, completedBy, completedAt, enableStatus, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, processStamp, - batch, lot, projectNo + batch, lot, projectNo, preferenceCode </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/inventory/InventoryDetailMapper.xml b/src/main/resources/mybatis/inventory/InventoryDetailMapper.xml index 99eccad..bb19648 100644 --- a/src/main/resources/mybatis/inventory/InventoryDetailMapper.xml +++ b/src/main/resources/mybatis/inventory/InventoryDetailMapper.xml @@ -63,5 +63,89 @@ <select id="getSumQty" resultType="java.math.BigDecimal"> SELECT ifnull(sum(qty-taskQty),0) qty from inventory_detail where materialCode=#{materialCode} and warehouseCode=#{warehouseCode} and inventorySts=#{inventorySts} + <if test="companyCode != null and companyCode != ''"> + and companyCode = #{companyCode} + </if> </select> + + <select id="getWarehouseInventoryStatus" resultType="java.lang.String"> + SELECT + ifnull( + CONVERT ( + ( SELECT count( 1 ) FROM inventory_detail WHERE TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) >= #{a} + and TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) <#{b} + AND warehouseCode = #{warehouseCode} ) / ( SELECT count( 1 ) FROM inventory_detail WHERE warehouseCode = #{warehouseCode} ), + DECIMAL ( 15, 2 ) + ), + 0 + ) scale + FROM + DUAL + </select> + + <select id="getWarehouseInventoryStatuss" resultType="java.lang.String"> + SELECT + ifnull( + CONVERT ( + ( SELECT count( 1 ) FROM inventory_detail WHERE TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) >= #{a} AND warehouseCode = #{warehouseCode} ) / ( SELECT count( 1 ) FROM inventory_detail WHERE warehouseCode = #{warehouseCode} ), + DECIMAL ( 15, 2 ) + ), + 0 + ) scale + FROM + DUAL + </select> + + <select id="getCompanyInventoryStatus" resultType="java.lang.String"> + SELECT + ifnull( + CONVERT ( + ( SELECT count( 1 ) FROM inventory_detail WHERE TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) >= #{a} + and TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) <#{b} + AND companyCode = #{companyCode} ) / ( SELECT count( 1 ) FROM inventory_detail WHERE companyCode = #{companyCode} ), + DECIMAL ( 15, 2 ) + ), + 0 + ) scale + FROM + DUAL + </select> + + <select id="getCompanyInventoryStatuss" resultType="java.lang.String"> + SELECT + ifnull( + CONVERT ( + ( SELECT count( 1 ) FROM inventory_detail WHERE TIMESTAMPDIFF( MONTH, created, CURDATE( ) ) >= #{a} + AND companyCode = #{companyCode} ) / ( SELECT count( 1 ) FROM inventory_detail WHERE companyCode = #{companyCode} ), + DECIMAL ( 15, 2 ) + ), + 0 + ) scale + FROM + DUAL + </select> + + <select id="getWarehouseInventoryProp" resultType="java.util.LinkedHashMap"> +-- SELECT w.name,a.name,ifnull(a.total,0) total from warehouse w +-- left join +-- (SELECT m.name name,sum(i.qty) total,i.warehouseCode warehouseCode from inventory i +-- inner join material m on i.materialCode = m.`code` and i.warehouseId = m.warehouseId +-- GROUP BY m.name,i.warehouseCode) a on w.code=a.warehouseCode ORDER BY total desc + SELECT m.name name,sum(i.qty) total from inventory_detail i + inner join material m on i.materialCode = m.`code` and i.warehouseCode = m.warehouseCode and i.warehouseCode=#{warehouseCode} + GROUP BY m.code ORDER BY total desc limit 10 + </select> + + <select id="getCompanyInventoryProp" resultType="java.util.LinkedHashMap"> +-- SELECT c.name,a.name,ifnull(a.total,0) total from company c +-- left join +-- (SELECT m.name name,sum(i.qty) total,i.companyId companyId from inventory i +-- inner join material m on i.materialCode = m.`code` and i.companyId = m.companyId +-- GROUP BY m.name,i.companyId) a on c.id=a.companyId ORDER BY total desc + SELECT m.name name,sum(i.qty) total from inventory_detail i + inner join material m on i.materialCode = m.`code` and i.companyCode = m.companyCode and i.companyCode=#{companyCode} + GROUP BY m.code ORDER BY total desc limit 10 + </select> + + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/receipt/ReceiptContainerHeaderMapper.xml b/src/main/resources/mybatis/receipt/ReceiptContainerHeaderMapper.xml index 2d30d19..bcc90b0 100644 --- a/src/main/resources/mybatis/receipt/ReceiptContainerHeaderMapper.xml +++ b/src/main/resources/mybatis/receipt/ReceiptContainerHeaderMapper.xml @@ -31,12 +31,13 @@ <result column="userDef8" jdbcType="VARCHAR" property="userDef8" /> <result column="processStamp" jdbcType="VARCHAR" property="processStamp" /> <result column="status" jdbcType="SMALLINT" property="status" /> + <result column="recvDock" jdbcType="VARCHAR" property="recvDock" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> id, warehouseCode, companyCode, containerCode, containerType, taskType, weight, projectNo, locatingRule, fromLocation, toLocation, waveId, taskCreated, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, userDef4, userDef5, - userDef6, userDef7, userDef8, processStamp, `status` + userDef6, userDef7, userDef8, processStamp, `status`, recvDock </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/receipt/ReceiptDetailMapper.xml b/src/main/resources/mybatis/receipt/ReceiptDetailMapper.xml new file mode 100644 index 0000000..d1838d8 --- /dev/null +++ b/src/main/resources/mybatis/receipt/ReceiptDetailMapper.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.huaheng.pc.receipt.receiptDetail.mapper.ReceiptDetailMapper"> + <resultMap id="BaseResultMap" type="com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail"> + <!--@mbg.generated--> + <id column="id" jdbcType="INTEGER" property="id" /> + <result column="receiptId" jdbcType="INTEGER" property="receiptId" /> + <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" /> + <result column="companyCode" jdbcType="VARCHAR" property="companyCode" /> + <result column="receiptCode" jdbcType="VARCHAR" property="receiptCode" /> + <result column="materialCode" jdbcType="VARCHAR" property="materialCode" /> + <result column="materialName" jdbcType="VARCHAR" property="materialName" /> + <result column="materialSpec" jdbcType="VARCHAR" property="materialSpec" /> + <result column="materialUnit" jdbcType="VARCHAR" property="materialUnit" /> + <result column="supplierCode" jdbcType="VARCHAR" property="supplierCode" /> + <result column="batch" jdbcType="VARCHAR" property="batch" /> + <result column="lot" jdbcType="VARCHAR" property="lot" /> + <result column="qcCheck" jdbcType="VARCHAR" property="qcCheck" /> + <result column="projectNo" jdbcType="VARCHAR" property="projectNo" /> + <result column="manufactureDate" jdbcType="TIMESTAMP" property="manufactureDate" /> + <result column="expirationDate" jdbcType="TIMESTAMP" property="expirationDate" /> + <result column="agingDate" jdbcType="TIMESTAMP" property="agingDate" /> + <result column="attributeTemplateCode" jdbcType="VARCHAR" property="attributeTemplateCode" /> + <result column="attribute1" jdbcType="VARCHAR" property="attribute1" /> + <result column="attribute2" jdbcType="VARCHAR" property="attribute2" /> + <result column="attribute3" jdbcType="VARCHAR" property="attribute3" /> + <result column="attribute4" jdbcType="VARCHAR" property="attribute4" /> + <result column="totalQty" jdbcType="DECIMAL" property="totalQty" /> + <result column="openQty" jdbcType="DECIMAL" property="openQty" /> + <result column="referCode" jdbcType="VARCHAR" property="referCode" /> + <result column="referId" jdbcType="INTEGER" property="referId" /> + <result column="referLineNum" jdbcType="VARCHAR" property="referLineNum" /> + <result column="locatingRule" jdbcType="VARCHAR" property="locatingRule" /> + <result column="inventorySts" jdbcType="VARCHAR" property="inventorySts" /> + <result column="itemListPrice" jdbcType="DECIMAL" property="itemListPrice" /> + <result column="itemNetPrice" jdbcType="DECIMAL" property="itemNetPrice" /> + <result column="isVirtualBom" jdbcType="INTEGER" property="isVirtualBom" /> + <result column="created" jdbcType="TIMESTAMP" property="created" /> + <result column="createdBy" jdbcType="VARCHAR" property="createdBy" /> + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" /> + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" /> + <result column="version" jdbcType="INTEGER" property="version" /> + <result column="userDef1" jdbcType="VARCHAR" property="userDef1" /> + <result column="userDef2" jdbcType="VARCHAR" property="userDef2" /> + <result column="userDef3" jdbcType="VARCHAR" property="userDef3" /> + <result column="userDef4" jdbcType="VARCHAR" property="userDef4" /> + <result column="userDef5" jdbcType="VARCHAR" property="userDef5" /> + <result column="userDef6" jdbcType="VARCHAR" property="userDef6" /> + <result column="userDef7" jdbcType="VARCHAR" property="userDef7" /> + <result column="userDef8" jdbcType="VARCHAR" property="userDef8" /> + <result column="processStamp" jdbcType="VARCHAR" property="processStamp" /> + <result column="deleted" jdbcType="BIT" property="deleted" /> + <result column="statusFlowCode" jdbcType="VARCHAR" property="statusFlowCode" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, receiptId,warehouseCode, companyCode, receiptCode, materialCode, materialName, materialSpec, materialUnit, + supplierCode, batch, lot, qcCheck, projectNo, manufactureDate, expirationDate, agingDate, + attributeTemplateCode, attribute1, attribute2, attribute3, attribute4, totalQty, + openQty, referCode, referId, referLineNum,locatingRule,inventorySts,itemListPrice, + itemNetPrice, isVirtualBom, created, createdBy, lastUpdated, lastUpdatedBy, + version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, + processStamp, deleted,statusFlowCode + </sql> + + <select id="getReceiptQtyLast7Days" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> +SELECT + a.click_date AS lastUpdated, + ifnull( b.taskQty, 0 ) AS qty +FROM + ( + SELECT + curdate( ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date + ) a + LEFT JOIN ( + SELECT + DATE( r.lastUpdated ) AS date, + SUM( r.qty ) AS taskQty + FROM + task_detail r + WHERE + r.taskType = 100 and + r.lastUpdated >= DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) + AND r.status>90 + GROUP BY + DATE(r.lastUpdated ) + ) b ON a.click_date = b.date +ORDER BY + a.click_date; + </select> + + <select id="getWarehouseReceipt" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> + SELECT ifnull(sum(r.qty),0) as qty,w.name as warehouseName from warehouse w + left JOIN task_detail r on r.warehouseCode=w.code and r.status>90 and r.taskType =100 + and date(r.lastUpdated)=CURDATE() group by w.code + + </select> + + + <select id="getCompanyReceipt" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> + SELECT ifnull(sum(r.qty),0) as qty,c.name as companyName from company c + left JOIN task_detail r on r.companyCode=c.code and r.status>90 and r.taskType =100 + and date(r.lastUpdated)=CURDATE() group by c.code + </select> +</mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/receipt/ReceiptHeaderMapper.xml b/src/main/resources/mybatis/receipt/ReceiptHeaderMapper.xml index 7fdfbd5..cce1f97 100644 --- a/src/main/resources/mybatis/receipt/ReceiptHeaderMapper.xml +++ b/src/main/resources/mybatis/receipt/ReceiptHeaderMapper.xml @@ -53,4 +53,10 @@ version, userDef1, userDef2, userDef3, userDef4, userDef5, userDef6, userDef7, userDef8, processStamp, deleted </sql> + + <select id="selectListByCreated" resultType="com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader"> + SELECT r.* from receipt_header r + inner join task_detail t on t.billCode=r.code and + t.status>700 and DATEDIFF(NOW(), t.lastUpdated)=0 GROUP BY r.code + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml b/src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml index 539503a..50a46dd 100644 --- a/src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml +++ b/src/main/resources/mybatis/shipment/ShipmentDetailMapper.xml @@ -80,4 +80,61 @@ SELECT COUNT(*) FROM shipment_detail WHERE shipmentId=#{shipmentId} AND shipQty>requestQty </select> + <select id="selectStatus" resultType="java.util.Map"> + SELECT max(status) maxStatus,min(status) minStatus + FROM shipment_detail + WHERE shipmentId=#{id} + </select> + + <select id="getShipmentQtyLast7Days" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> +SELECT + a.click_date AS lastUpdated, + ifnull( b.taskQty, 0 ) AS qty +FROM + ( + SELECT + curdate( ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL + SELECT + date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date + ) a + LEFT JOIN ( + SELECT + DATE( r.lastUpdated ) AS date, + SUM( r.qty ) AS taskQty + FROM + task_detail r + WHERE + r.taskType = 200 and + r.lastUpdated >= DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) + AND r.status> 90 + GROUP BY + DATE(r.lastUpdated ) + ) b ON a.click_date = b.date +ORDER BY + a.click_date; + </select> + + + <select id="getWarehouseShipment" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> + SELECT ifnull(sum(r.qty),0) as qty,w.name as warehouseName from warehouse w + left JOIN task_detail r on r.warehouseCode=w.code and r.status>90 and r.taskType =200 + and date(r.lastUpdated)=CURDATE() group by w.code + </select> + + + <select id="getCompanyShipment" resultType="com.huaheng.pc.task.taskDetail.domain.TaskDetail"> + SELECT ifnull(sum(r.qty),0) as qty,c.name as companyName from company c + left JOIN task_detail r on r.companyCode=c.code and r.status>90 and r.taskType =200 + and date(r.lastUpdated)=CURDATE() group by c.code + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/shipment/ShipmentHeaderMapper.xml b/src/main/resources/mybatis/shipment/ShipmentHeaderMapper.xml index 51a802d..08f317b 100644 --- a/src/main/resources/mybatis/shipment/ShipmentHeaderMapper.xml +++ b/src/main/resources/mybatis/shipment/ShipmentHeaderMapper.xml @@ -70,4 +70,9 @@ SELECT code FROM shipment_header WHERE shipmentType = #{shipmentType,jdbcType=VARCHAR} ORDER BY id DESC LIMIT 1 </select> + <select id="selectListByCreated" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader"> + SELECT s.* from shipment_header s + inner join task_detail t on t.billCode=s.code and + t.status>700 and DATEDIFF(NOW(), t.lastUpdated)=0 GROUP BY s.code + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/system/DictDataMapper.xml b/src/main/resources/mybatis/system/DictDataMapper.xml index 5f6a411..1fbb803 100644 --- a/src/main/resources/mybatis/system/DictDataMapper.xml +++ b/src/main/resources/mybatis/system/DictDataMapper.xml @@ -205,4 +205,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" limit 1 </select> + <insert id="dictDateCopy"> + insert into sys_dict_data(warehouseCode,dictSort,dictLabel,dictValue,dictType,cssClass,listClass,isDefault,enable,deleted,remark) + SELECT #{newCode},dictSort,dictLabel,dictValue,dictType,cssClass,listClass,isDefault,enable,deleted,remark from sys_dict_data + where warehouseCode = #{code} + + </insert> + + <update id="updateHeaderId"> + update sys_dict_data d + inner join sys_dict_type t + on t.dictType=d.dictType and d.warehouseCode=t.warehouseCode and d.warehouseCode=#{code} + set d.headerId=t.id + </update> + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/system/DictTypeMapper.xml b/src/main/resources/mybatis/system/DictTypeMapper.xml index b64243b..57f9c35 100644 --- a/src/main/resources/mybatis/system/DictTypeMapper.xml +++ b/src/main/resources/mybatis/system/DictTypeMapper.xml @@ -141,5 +141,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) </foreach> </insert> + + <insert id="dictTypeCopy"> + insert into sys_dict_type(warehouseCode,dictName,dictType,enable,deleted,remark) + select #{newCode},dictName,dictType,enable,deleted,remark from sys_dict_type + where warehouseCode=#{code} + + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/system/MenuMapper.xml b/src/main/resources/mybatis/system/MenuMapper.xml index 823085c..f69871e 100644 --- a/src/main/resources/mybatis/system/MenuMapper.xml +++ b/src/main/resources/mybatis/system/MenuMapper.xml @@ -181,4 +181,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by orderNum </select> + <insert id="menuCopy"> + insert into sys_menu(menuName,parentId,parentName,orderNum,url,menuType,menuMobile,visible,perms,icon,warehouseCode,remark) + select menuName,parentId,parentName,orderNum,url,menuType,menuMobile,visible,perms,icon,#{newCode},remark from sys_menu + where warehouseCode = #{code} + + </insert> + + <update id="updateParentId"> + update sys_menu s + inner join sys_menu m on s.warehouseCode=#{code} and s.parentName=m.menuName set s.parentId=m.id + + </update> + </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/system/RoleMapper.xml b/src/main/resources/mybatis/system/RoleMapper.xml index c740a9d..0b9e098 100644 --- a/src/main/resources/mybatis/system/RoleMapper.xml +++ b/src/main/resources/mybatis/system/RoleMapper.xml @@ -124,5 +124,23 @@ sysdate() ) </insert> + + <insert id="roleCopy"> + insert into sys_role(roleName,roleCode,roleSort,warehouseCode,enable,remark) + select roleName,roleCode,roleSort,#{newCode},enable,remark from sys_role where warehouseCode=#{code} + </insert> + + + <update id="updateRoleMenu"> + update sys_role_menu r inner join sys_menu m + on r.roleId = (select id from sys_role where warehouseCode = #{code} limit 1) + set r. + </update> + + <insert id="roleUserCopy"> + insert into sys_user_role(userId,roleId) + values(1,(select id from sys_role where warehouseCode = #{code} limit 1)) + + </insert> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/task/TaskDetailMapper.xml b/src/main/resources/mybatis/task/TaskDetailMapper.xml index 34e888b..05c3675 100644 --- a/src/main/resources/mybatis/task/TaskDetailMapper.xml +++ b/src/main/resources/mybatis/task/TaskDetailMapper.xml @@ -50,6 +50,7 @@ <result column="userDef2" jdbcType="VARCHAR" property="userDef2" /> <result column="userDef3" jdbcType="VARCHAR" property="userDef3" /> <result column="processStamp" jdbcType="VARCHAR" property="processStamp" /> + <result column="containQty" jdbcType="INTEGER" property="containQty" /> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> @@ -59,6 +60,6 @@ assignedUser, attribute1, attribute2, attribute3, attribute4, batch, lot, projectNo, qcCheck, manufactureDate, expirationDate, agingDate, inventorySts, waveId, fromInventoryId, toInventoryId, confirmedBy, groupNum, groupIndex, created, createdBy, lastUpdated, - lastUpdatedBy, version, userDef1, userDef2, userDef3, processStamp + lastUpdatedBy, version, userDef1, userDef2, userDef3, processStamp, containQty </sql> </mapper> \ No newline at end of file diff --git a/src/main/resources/mybatis/task/TaskHeaderMapper.xml b/src/main/resources/mybatis/task/TaskHeaderMapper.xml index ddbfcbf..a71b78a 100644 --- a/src/main/resources/mybatis/task/TaskHeaderMapper.xml +++ b/src/main/resources/mybatis/task/TaskHeaderMapper.xml @@ -41,11 +41,13 @@ <result column="userDef2" jdbcType="VARCHAR" property="userDef2"/> <result column="userDef3" jdbcType="VARCHAR" property="userDef3"/> <result column="processStamp" jdbcType="VARCHAR" property="processStamp"/> + <result column="recvDock" jdbcType="VARCHAR" property="recvDock" /> + <result column="containQty" jdbcType="INTEGER" property="containQty" /> </resultMap> <select id="getReceiptTask" resultType="java.util.Map"> SELECT rd.id receiptDetailId,rd.receiptId,td.taskId, td.warehouseCode, td.id taskDetailId, td.status, td.containerCode, td.qty, td.materialCode,rd.totalQty,td.materialSpec, - rd.receiptCode,td.inventorySts, + rd.receiptCode,rd.inventorySts, td.materialName, rd.batch, rd.lot, rd.manufactureDate, rd.expirationDate FROM task_detail td @@ -56,7 +58,11 @@ SELECT COUNT(*) AS count FROM task_header WHERE status < 10 AND containerCode = #{containerCode} AND warehouseCode=#{warehouseCode} </select> - + <select id="getTasksStatus" resultType="com.huaheng.pc.task.taskHeader.domain.TaskHeader"> + select * + FROM task + where lastStatus < 100 + </select> <sql id="Base_Column_List"> @@ -67,7 +73,7 @@ allowRebatch, taskProcessType, rebinBench, rebined, startRebinDateTime, endRebinDateTime, rebinedBy, exceptionCode, exceptionHandledBy, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, userDef3, - processStamp + processStamp, containQty </sql> diff --git a/src/main/resources/static/huaheng/js/common.js b/src/main/resources/static/huaheng/js/common.js index 6621886..d3238e9 100644 --- a/src/main/resources/static/huaheng/js/common.js +++ b/src/main/resources/static/huaheng/js/common.js @@ -23,8 +23,10 @@ $(function(){ var laydate = layui.laydate; var day1 = new Date(); day1.setTime(day1.getTime()-24*60*60*1000*7); + var endDay = new Date(); + endDay.setTime(endDay.getTime()+24*60*60*1000); laydate.render({ elem: '#startTime', theme: 'molv',value: new Date(day1), isInitValue: true}); - laydate.render({ elem: '#endTime', theme: 'molv',value: new Date(), isInitValue: true }); + laydate.render({ elem: '#endTime', theme: 'molv',value: new Date(endDay), isInitValue: true }); }); } }); diff --git a/src/main/resources/templates/admin/main.html b/src/main/resources/templates/admin/main.html index f1ae4da..6af7c2d 100644 --- a/src/main/resources/templates/admin/main.html +++ b/src/main/resources/templates/admin/main.html @@ -59,7 +59,7 @@ <p>库内物料品数</p> </div> </div> - <div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/task?id=40','任务查看')"> + <div class="col-sm-2" style="padding:5px;" onclick="createMenuItem('/twms/admin/task?id=100','任务查看')"> <div class="total_box ys06"> <h1 id="s6">-</h1> <p>待执行任务数</p> diff --git a/src/main/resources/templates/check/checkHeader/checkHeader.html b/src/main/resources/templates/check/checkHeader/checkHeader.html index 350d130..dcf6346 100644 --- a/src/main/resources/templates/check/checkHeader/checkHeader.html +++ b/src/main/resources/templates/check/checkHeader/checkHeader.html @@ -43,16 +43,12 @@ </div> </form> </div> - <div class="btn-group hidden-xs" id="toolbar" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" - shiro:hasPermission="receipt:receiptHeader:add"> - <i class="fa fa-plus"></i> 新增 - </a> + <!--<div class="btn-group hidden-xs" id="toolbar" role="group"> <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="receipt:receiptHeader:remove"> <i class="fa fa-trash-o"></i> 删除 </a> - </div> + </div>--> <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> @@ -130,7 +126,7 @@ var receiptTypes = [[${@receiptTypeService.getType()}]]; var checkHeaderStatus = [[${@dict.getType('checkHeaderStatus')}]]; var checkDetailStatus = [[${@dict.getType('checkDetailStatus')}]]; - var inventorySts = [[${@dict.getType('inventoryStatus')}]]; + var inventorySts = [[${@dict.getType('inventorySts')}]]; var printFlag = [[${@permission.hasPermi('check:checkHeader:report')}]]; var addFlag= [[${@permission.hasPermi('check:checkHeader:add')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]]; diff --git a/src/main/resources/templates/config/bomHeader/add.html b/src/main/resources/templates/config/bomHeader/add.html index bde3c9e..6758573 100644 --- a/src/main/resources/templates/config/bomHeader/add.html +++ b/src/main/resources/templates/config/bomHeader/add.html @@ -98,8 +98,8 @@ $(function () { layui.use('laydate', function() { var laydate = layui.laydate; - laydate.render({ elem: '#validFromDate', theme: 'molv', format: 'yyyy-MM-dd' }); - laydate.render({ elem: '#validEndDate', theme: 'molv', format: 'yyyy-MM-dd' }); + laydate.render({ elem: '#validFromDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' }); + laydate.render({ elem: '#validEndDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' }); }); }); </script> diff --git a/src/main/resources/templates/config/bomHeader/edit.html b/src/main/resources/templates/config/bomHeader/edit.html index 1f5fcb6..b7eec0c 100644 --- a/src/main/resources/templates/config/bomHeader/edit.html +++ b/src/main/resources/templates/config/bomHeader/edit.html @@ -38,13 +38,13 @@ <div class="form-group"> <label class="col-sm-3 control-label">有效起始日期:</label> <div class="col-sm-8"> - <input id="validFromDate" name="validFromDate" class="time-input" type="text" th:field="*{validFromDate}"> + <input id="validFromDate" name="validFromDate" class="form-control" type="text" th:field="*{validFromDate}"> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">有效结束日期:</label> <div class="col-sm-8"> - <input id="validEndDate" name="validEndDate" class="time-input" type="text" th:field="*{validEndDate}"> + <input id="validEndDate" name="validEndDate" class="form-control" type="text" th:field="*{validEndDate}"> </div> </div> <div class="form-group"> diff --git a/src/main/resources/templates/config/company/edit.html b/src/main/resources/templates/config/company/edit.html index 937239a..ea59aac 100644 --- a/src/main/resources/templates/config/company/edit.html +++ b/src/main/resources/templates/config/company/edit.html @@ -144,7 +144,7 @@ <!--</div>--> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> - <button type="submit" class="btn btn-primary">提交</button> + <button type="button" onclick="submitHandler()" class="btn btn-primary">提交</button> <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> </div> </div> @@ -152,7 +152,7 @@ </div> <div th:include="include::footer"></div> <script type="text/javascript"> - var prefix = ctx + "config/company" + var prefix = ctx + "config/company"; $("#form-company-edit").validate({ rules:{ code:{ @@ -179,6 +179,32 @@ }, }, submitHandler: function(form) { + $("#form-company-edit").validate({ + rules:{ + code:{ + required:true + }, + name:{ + required:true + }, + phoneNum:{ + required:false, + isTel:true, + }, + faxNum:{ + required:false, + isTel:true, + }, + mobile:{ + required:false, + isPhone:true + }, + email:{ + required:false, + email:true, + }, + }, + }) $.ajax({ cache : true, type : "POST", @@ -213,6 +239,41 @@ }); } }); + + function submitHandler() { + $.ajax({ + cache : true, + type : "POST", + url : prefix + "/edit", + data : { + "id": $("input[name='id']").val(), + "code": $("input[name='code']").val(), + "parentId": $("#parentId option:selected").val(), + "type": $("#type option:selected").val(), + "name": $("input[name='name']").val(), + "address1": $("input[name='address1']").val(), + "address2": $("input[name='address2']").val(), + "city": $("input[name='city']").val(), + "province": $("input[name='province']").val(), + "country": $("input[name='country']").val(), + "postalCode": $("input[name='postalCode']").val(), + "attentionTo": $("input[name='attentionTo']").val(), + "phoneNum": $("input[name='phoneNum']").val(), + "mobile": $("input[name='mobile']").val(), + "faxNum": $("input[name='faxNum']").val(), + "email": $("input[name='email']").val(), + "enable" : $("input[name='enable']").is(':checked'), + "warehouseCode": $.form.selectCheckeds("warehouseCode") + }, + async : false, + error : function(request) { + $.modal.alertError("请求失败!"); + }, + success : function(data) { + $.operate.saveSuccess(data); + } + }); + } </script> </body> </html> diff --git a/src/main/resources/templates/config/configValue/add.html b/src/main/resources/templates/config/configValue/add.html index 6b612f5..86dfefc 100644 --- a/src/main/resources/templates/config/configValue/add.html +++ b/src/main/resources/templates/config/configValue/add.html @@ -9,13 +9,17 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text"> + <select id="moduleType" name="moduleType" class="form-control" th:with="moduleTypeList=${@dict.getType('moduleType')}"> + <option th:each="moduleType : ${moduleTypeList}" th:text="${moduleType['dictLabel']}" th:value="${moduleType['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">类型:</label> <div class="col-sm-8"> - <input id="recordType" name="recordType" class="form-control" type="text"> + <select id="recordType" name="recordType" class="form-control" th:with="moduleTypeList=${@dict.getType('recordType')}"> + <option th:each="moduleType : ${moduleTypeList}" th:text="${moduleType['dictLabel']}" th:value="${moduleType['dictValue']}"></option> + </select> </div> </div> <div class="form-group"> diff --git a/src/main/resources/templates/config/configValue/configValue.html b/src/main/resources/templates/config/configValue/configValue.html index c3ca7f7..dd36581 100644 --- a/src/main/resources/templates/config/configValue/configValue.html +++ b/src/main/resources/templates/config/configValue/configValue.html @@ -48,6 +48,8 @@ var prefix = ctx + "config/configValue"; var editFlag = [[${@permission.hasPermi('config:configValue:edit')}]]; var removeFlag = [[${@permission.hasPermi('config:configValue:remove')}]]; + var recordType=[[${@dict.getType('recordType')}]]; + $(function() { var options = { url: prefix + "/list", @@ -74,8 +76,12 @@ title : '模块' }, { - field : 'recordType', - title : '类型' + field: 'recordType', + title: '类型', + formatter: function(value, row, index) { + return $.table.selectDictLabel(recordType, value); + }, + }, { field : 'identifier', diff --git a/src/main/resources/templates/config/configValue/edit.html b/src/main/resources/templates/config/configValue/edit.html index 8a70d85..4e349b5 100644 --- a/src/main/resources/templates/config/configValue/edit.html +++ b/src/main/resources/templates/config/configValue/edit.html @@ -9,13 +9,13 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <input id="moduleType" name="moduleType" class="form-control" type="text" th:field="*{moduleType}"> + <input id="moduleType" name="moduleType" class="form-control" type="text" th:field="*{moduleType}" readonly> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">类型:</label> <div class="col-sm-8"> - <input id="recordType" name="recordType" class="form-control" type="text" th:field="*{recordType}"> + <input id="recordType" name="recordType" class="form-control" type="text" th:field="*{recordType}" readonly> </div> </div> <div class="form-group"> @@ -64,7 +64,7 @@ </div> <div th:include="include::footer"></div> <script type="text/javascript"> - var prefix = ctx + "config/configvalue"; + var prefix = ctx + "config/configValue"; $("#form-configValue-edit").validate({ rules:{ moduleType:{ diff --git a/src/main/resources/templates/config/configWarning/add.html b/src/main/resources/templates/config/configWarning/add.html new file mode 100644 index 0000000..11a08e1 --- /dev/null +++ b/src/main/resources/templates/config/configWarning/add.html @@ -0,0 +1,107 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> + <form class="form-horizontal m" id="form-configValue-add"> + + <div class="form-group"> + <label class="col-sm-3 control-label">编码:</label> + <div class="col-sm-8"> + <input id="code" name="code" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">描述:</label> + <div class="col-sm-8"> + <input id="remark" name="remark" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">类型:</label> + <div class="col-sm-8"> + <select id="type" name="type" class="form-control" th:with="warningTypeList=${@dict.getType('warningType')}"> + <option th:each="warningType : ${warningTypeList}" th:text="${warningType['dictLabel']}" th:value="${warningType['dictValue']}"></option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">公司:</label> + <div class="col-sm-8"> + <select id="companyCode" name="companyCode" class="form-control"> + <option th:each="item : ${list}" th:text="${item['name']}" th:value="${item['id']}" th:attr = " code = ${item['code']}"></option> + </select> + </div> + </div> + + <div class="form-group"> + <label class="col-sm-3 control-label">物料编码:</label> + <div class="col-sm-8"> + <input id="materialCode" name="materialCode" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">最大值:</label> + <div class="col-sm-8"> + <input id="max" name="max" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">最小值:</label> + <div class="col-sm-8"> + <input id="min" name="min" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">接受预警信息用户邮箱:</label> + <div class="col-sm-8"> + <input id="email" name="email" class="form-control" type="text" placeholder="多个邮箱用;号隔开"> + </div> + </div> + <div class="form-group"> + <div class="form-control-static col-sm-offset-9"> + <button type="submit" class="btn btn-primary">提交</button> + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> + </div> + </div> + </form> +</div> +<div th:include="include::footer"></div> +<script type="text/javascript"> + var prefix = ctx + "config/configWarning"; + $("#form-configValue-add").validate({ + rules:{ + code:{ + required:true + }, + remark:{ + required:true + }, + type:{ + required:true + }, + companyCode:{ + required:true + }, + materialCode:{ + required:true + }, + max:{ + required:true + }, + min:{ + required:true + }, + email:{ + required:true + } + }, + submitHandler: function(form) { + var tableValue = $("#form-configValue-add").serialize(); + $.operate.save(prefix + "/add", tableValue); + } + }); +</script> +</body> +</html> diff --git a/src/main/resources/templates/config/configWarning/configWarning.html b/src/main/resources/templates/config/configWarning/configWarning.html new file mode 100644 index 0000000..5ea4807 --- /dev/null +++ b/src/main/resources/templates/config/configWarning/configWarning.html @@ -0,0 +1,163 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="gray-bg"> +<div class="container-div"> + <div class="row"> + <div class="col-sm-12 select-info"> + <form id="configWarning-form"> + <div class="select-list"> + <ul> + <li> + 编码:<input type="text" name="code"/> + </li> + <li> + 类型:<input type="text" name="type"/> + </li> + <li> + 货主编码:<input type="text" name="configWarningCode"/> + </li> + <li> + 物料编码:<input type="text" name="materialCode"/> + </li> + + <li> + 物料名称:<input type="text" name="materialName"/> + </li> + <li> + 邮箱:<input type="text" name="email"/> + </li> + <li class="time"> + <label>创建时间: </label> + <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/> + <span>-</span> + <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('configWarning-form')"><i class="fa fa-refresh"></i> 重置</a> + <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="config:configWarning:export"><i class="fa fa-download"></i> 导出</a>--> + </li> + </ul> + </div> + </form> + </div> + <div class="btn-group hidden-xs" id="toolbar" role="group"> + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:configWarning:add"> + <i class="fa fa-plus"></i> 新增 + </a> + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:configWarning:remove"> + <i class="fa fa-trash-o"></i> 删除 + </a> + </div> + <div class="col-sm-12 select-info"> + <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> + </div> + </div> +</div> +<div th:include="include :: footer"></div> +<script th:inline="javascript"> + var prefix = ctx + "config/configWarning"; + var editFlag = [[${@permission.hasPermi('config:configWarning:edit')}]]; + var removeFlag = [[${@permission.hasPermi('config:configWarning:remove')}]]; + var warningType=[[${@dict.getType('warningType')}]]; + + $(function() { + var options = { + url: prefix + "/list", + createUrl: prefix + "/add", + updateUrl: prefix + "/edit/{id}", + removeUrl: prefix + "/remove", + modalName: "预警配置", + search: false, + sortName: "id", + sortOrder: "desc", + columns: [{ + checkbox: true + }, + { + field : 'id', + title : 'id' + }, + { + field : 'remark', + title : '描述' + }, + { + field : 'warehouseCode', + title : '仓库编码' + }, + { + field : 'companyCode', + title : '货主编码' + }, + { + field: 'recordType', + title: '类型', + formatter: function(value, row, index) { + return $.table.selectDictLabel(warningType, value); + }, + + }, + { + field : 'materialCode', + title : '物料编码' + }, + { + field : 'materialName', + title : '物料名称' + }, + { + field : 'materialSpec', + title : '物料规格' + }, + { + field : 'materialUnit', + title : '单位' + }, + { + field : 'userId', + title : '用户id', + visible : false + }, + { + field : 'userName', + title : '用户名称' + }, + { + field : 'email', + title : '邮箱' + }, + { + field : 'created', + title : '创建时间' + }, + { + field : 'createdBy', + title : '创建用户' + }, + { + field : 'lastUpdated', + title : '更新时间' + }, + { + field : 'lastUpdatedBy', + title : '更新用户' + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); + return actions.join(''); + } + }] + }; + $.table.init(options); + }); +</script> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/config/configWarning/edit.html b/src/main/resources/templates/config/configWarning/edit.html new file mode 100644 index 0000000..fad6cc0 --- /dev/null +++ b/src/main/resources/templates/config/configWarning/edit.html @@ -0,0 +1,107 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> + <form class="form-horizontal m" id="form-configValue-add" th:object="${configWarning}"> + + <div class="form-group"> + <label class="col-sm-3 control-label">编码:</label> + <div class="col-sm-8"> + <input id="code" name="code" class="form-control" type="text" th:field="*{code}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">描述:</label> + <div class="col-sm-8"> + <input id="remark" name="remark" class="form-control" type="text" th:field="*{remark}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">类型:</label> + <div class="col-sm-8"> + <select id="type" name="type" class="form-control" th:with="warningTypeList=${@dict.getType('warningType')}" th:field="*{type}"> + <option th:each="warningType : ${warningTypeList}" th:text="${warningType['dictLabel']}" th:value="${warningType['dictValue']}"></option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">公司:</label> + <div class="col-sm-8"> + <select id="companyCode" name="companyCode" class="form-control"> + <option th:each="item : ${list}" th:text="${item['name']}" th:value="${item['id']}" th:attr = " code = ${item['code']}"></option> + </select> + </div> + </div> + + <div class="form-group"> + <label class="col-sm-3 control-label">物料编码:</label> + <div class="col-sm-8"> + <input id="materialCode" name="materialCode" class="form-control" type="text" th:field="*{materialCode}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">最大值:</label> + <div class="col-sm-8"> + <input id="max" name="max" class="form-control" type="text" th:field="*{max}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">最小值:</label> + <div class="col-sm-8"> + <input id="min" name="min" class="form-control" type="text" th:field="*{min}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">接受预警信息用户邮箱:</label> + <div class="col-sm-8"> + <input id="email" name="email" class="form-control" type="text" placeholder="多个邮箱用;号隔开"> + </div> + </div> + <div class="form-group"> + <div class="form-control-static col-sm-offset-9"> + <button type="submit" class="btn btn-primary">提交</button> + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> + </div> + </div> + </form> +</div> +<div th:include="include::footer"></div> +<script type="text/javascript"> + var prefix = ctx + "config/configWarning"; + $("#form-configValue-add").validate({ + rules:{ + code:{ + required:true + }, + remark:{ + required:true + }, + type:{ + required:true + }, + companyCode:{ + required:true + }, + materialCode:{ + required:true + }, + max:{ + required:true + }, + min:{ + required:true + }, + email:{ + required:true + } + }, + submitHandler: function(form) { + var tableValue = $("#form-configValue-add").serialize(); + $.operate.save(prefix + "/add", tableValue); + } + }); +</script> +</body> +</html> diff --git a/src/main/resources/templates/config/containerCapacity/add.html b/src/main/resources/templates/config/containerCapacity/add.html index 2e9d8d8..e66d837 100644 --- a/src/main/resources/templates/config/containerCapacity/add.html +++ b/src/main/resources/templates/config/containerCapacity/add.html @@ -8,7 +8,9 @@ <div class="form-group"> <label class="col-sm-3 control-label">容器类型编码:</label> <div class="col-sm-8"> - <input id="containerType" name="containerType" class="form-control" type="text"> + <select id="containerType" name="containerType" class="form-control" th:with="containerType=${@containerType.getCode()}"> + <option th:each="item : ${containerType}" th:text="${item['name']}" th:value="${item['code']}"></option> + </select> </div> </div> <div class="form-group"> @@ -132,7 +134,7 @@ "enable" : $("input[name='enable']").is(':checked'), "materialCode" :$("input[name='materialCode']").val(), "qty" :$("input[name='qty']").val(), - "containerType" :$("input[name='containerType']").val(), + "containerType" :$("#containerType option:selected").val(), }, async : false, diff --git a/src/main/resources/templates/config/cycleCountPreference/add.html b/src/main/resources/templates/config/cycleCountPreference/add.html index fce118b..7f44e6f 100644 --- a/src/main/resources/templates/config/cycleCountPreference/add.html +++ b/src/main/resources/templates/config/cycleCountPreference/add.html @@ -1,149 +1,91 @@ <!DOCTYPE HTML> -<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="white-bg"> <div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-cycleCountPreference-add"> - <div class="form-group"> + <!--<div class="form-group"> <label class="col-sm-3 control-label">盘点首选项编码:</label> <div class="col-sm-8"> <input id="code" name="code" class="form-control" type="text"> </div> - </div> + </div>--> <div class="form-group"> <label class="col-sm-3 control-label">盘点首选项名称:</label> <div class="col-sm-8"> <input id="name" name="name" class="form-control" type="text"> </div> </div> + <div class="form-group"> - <label class="col-sm-3 control-label">系统提示货位:</label> + <label class="col-sm-3 control-label">系统提示库位:</label> <div class="col-sm-8"> - <input id="promptLocation" name="promptLocation" class="form-control" type="text"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="promptLocation" + name="promptLocation"> + <label class="onoffswitch-label" for="promptLocation"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> + <div class="form-group"> - <label class="col-sm-3 control-label">系统提示LPN:</label> - <div class="col-sm-8"> - <input id="promptLpn" name="promptLpn" class="form-control" type="text"> - </div> - </div> - <!-- <div class="form-group"> - <label class="col-sm-3 control-label">允许超收:</label> + <label class="col-sm-3 control-label">系统提示容器:</label> <div class="col-sm-8"> <div class="onoffswitch"> - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="allowOverReceiving" name="allowOverReceiving"> - <label class="onoffswitch-label" for="allowOverReceiving"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="promptLpn" + name="promptLpn"> + <label class="onoffswitch-label" for="promptLpn"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> - </div> - </div>--> - <div class="form-group"> - <label class="col-sm-3 control-label">系统提示物料:</label> - <div class="col-sm-8"> - <input id="promptItem" name="promptItem" class="form-control" type="text"> </div> </div> + <div class="form-group"> - <label class="col-sm-3 control-label">显示库存数量:</label> + <label class="col-sm-3 control-label">系统提示物料:</label> <div class="col-sm-8"> - <input id="promptQuantity" name="promptQuantity" class="form-control" type="text"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="promptItem" + name="promptItem"> + <label class="onoffswitch-label" for="promptItem"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> + <div class="form-group"> - <label class="col-sm-3 control-label">允许添加库存:</label> + <label class="col-sm-3 control-label">显示库存数量:</label> <div class="col-sm-8"> - <input id="allowAddNewInventory" name="allowAddNewInventory" class="form-control" type="text"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="promptQuantity" + name="promptQuantity"> + <label class="onoffswitch-label" for="promptQuantity"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">RF逐件盘点:</label> + <label class="col-sm-3 control-label">是否有效:</label> <div class="col-sm-8"> - <input id="countByPiece" name="countByPiece" class="form-control" type="text"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" + name="enable"> + <label class="onoffswitch-label" for="enable"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> - <!--<div class="form-group"> - <label class="col-sm-3 control-label">数据版本:</label> - <div class="col-sm-8"> - <input id="version" name="version" class="form-control" type="text"> - </div> - </div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">创建时间:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="created" name="created" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">创建者:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="createdBy" name="createdBy" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">创建时间:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="lastUpdated" name="lastUpdated" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">更新者:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="lastUpdatedBy" name="lastUpdatedBy" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <div class="form-group"> - <label class="col-sm-3 control-label">是否有效:</label> - <div class="col-sm-8"> - <!--<input id="enable" name="enable" class="form-control" type="text">--> - <div class="onoffswitch"> - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable"> - <label class="onoffswitch-label" for="enable"> - <span class="onoffswitch-inner"></span> - <span class="onoffswitch-switch"></span> - </label> - </div> - </div> - </div> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">是否删除:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="deleted" name="deleted" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef1" name="userDef1" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段2:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef2" name="userDef2" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段3:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef3" name="userDef3" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段4:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef4" name="userDef4" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段5:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef5" name="userDef5" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> <input type="submit" class="btn btn-primary" value="提交"> @@ -156,32 +98,22 @@ <script type="text/javascript"> var prefix = ctx + "config/cycleCountPreference"; $("#form-cycleCountPreference-add").validate({ - rules:{ - code:{ - required: true, - }, - name:{ - required: true, - }, - promptLocation:{ + rules: { + code: { required: true, }, - promptLpn:{ + name: { required: true, }, - promptItem:{ - required: true, - }, - promptQuantity: { - required: true, - }, - allowAddNewInventory: { - required: true, - } + }, - submitHandler: function(form) { + submitHandler: function (form) { var tableValue = $.common.getTableValue("#form-cycleCountPreference-add"); - //tableValue = formValueReplace(tableValue, "allowOverReceiving", $("input[name='allowOverReceiving']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptLocation", $("input[name='promptLocation']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptLpn", $("input[name='promptLpn']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptItem", $("input[name='promptItem']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptQuantity", $("input[name='promptQuantity']").is(':checked')); + tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked')); $.operate.save(prefix + "/addSave", tableValue); } }); diff --git a/src/main/resources/templates/config/cycleCountPreference/cycleCountPreference.html b/src/main/resources/templates/config/cycleCountPreference/cycleCountPreference.html index f4b9817..601dd79 100644 --- a/src/main/resources/templates/config/cycleCountPreference/cycleCountPreference.html +++ b/src/main/resources/templates/config/cycleCountPreference/cycleCountPreference.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML> -<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml"> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="gray-bg"> @@ -19,7 +19,7 @@ 提示物料:<input type="text" name="promptItem"/> </li> <li> - 提示LPN:<input type="text" name="promptLpn"/> + 提示容器:<input type="text" name="promptLpn"/> </li> <li> 更新人:<input type="text" name="lastUpdatedBy"/> @@ -34,8 +34,8 @@ <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/> </li> <li> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('cycleCountPreference-form')"><i class="fa fa-refresh"></i> 清除选择</a> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> - <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('cycleCountPreference-form')"><i class="fa fa-refresh"></i> 重置</a> <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export"><i class="fa fa-download"></i> 导出</a>--> </li> </ul> @@ -43,7 +43,8 @@ </form> </div> <div class="btn-group hidden-xs" id="toolbar" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" > + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" + shiro:hasPermission="config:cycleCountPreference:add"> <i class="fa fa-plus"></i> 新增 </a> </div> @@ -89,27 +90,64 @@ }, { field : 'promptLocation', - title : '系统提示货位', + title : '系统提示库位', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { field : 'promptLpn', - title : '系统提示LPN' + title : '系统提示容器', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { field : 'promptItem', - title : '系统提示物料' + title : '系统提示物料', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { field : 'promptQuantity', - title : '显示库存数量' + title : '显示库存数量', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { field : 'allowAddNewInventory', - title : '允许添加库存' - }, - { - field : 'Enable', - title : '有效' + title : '允许添加库存', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + }, + visible : false }, { field : 'created', @@ -131,22 +169,42 @@ title : '更新用户', visible : false }, - { + /*{ field : 'version', title : '数据版本', visible : false - }, - { + },*/ + /*{ field : 'processStamp', title : '处理标记', visible : false - }, + },*/ { field : 'countByPiece', title : 'RF逐件盘点' , - visible:true + visible : false, + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { + field : 'enable', + title : '有效', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } + }, + /*{ field : 'userDef1', title : '自定义字段1' , visible:false @@ -160,15 +218,15 @@ field : 'userDef3', title : '自定义字段3' , visible:false - }, + },*/ { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; - actions.push('<a class="btn btn-success btn-xs " href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>修改</a> '); - actions.push('<a class="btn btn-danger btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>修改</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); return actions.join(''); } }] diff --git a/src/main/resources/templates/config/cycleCountPreference/edit.html b/src/main/resources/templates/config/cycleCountPreference/edit.html index 18607bd..c22b605 100644 --- a/src/main/resources/templates/config/cycleCountPreference/edit.html +++ b/src/main/resources/templates/config/cycleCountPreference/edit.html @@ -14,59 +14,74 @@ <div class="form-group"> <label class="col-sm-3 control-label">盘点首选项编码:</label> <div class="col-sm-8"> - <input id="code" name="code" class="form-control" type="text" th:field="*{code}"> + <input id="code" name="code" class="form-control" type="text" th:field="*{code}" readonly="readonly"> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">盘点首选项名称:</label> <div class="col-sm-8"> - <input id="name" name="name" class="form-control" type="text" th:field="*{name}"> + <input id="name" name="name" class="form-control" type="text" th:field="*{name}" readonly="readonly"> </div> </div> - <div class="form-group"> + <!--<div class="form-group"> <label class="col-sm-3 control-label">仓库:</label> <div class="col-sm-8"> <input id="warehouseCode" name="warehouseCode" class="form-control" type="text" th:field="*{warehouseCode}" readonly="readonly"> </div> - </div> + </div>--> <div class="form-group"> <label class="col-sm-3 control-label">系统提示货位:</label> <div class="col-sm-8"> - <input id="promptLocation" name="promptLocation" class="form-control" type="text" th:field="*{promptLocation}"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{promptLocation}" class="onoffswitch-checkbox" id="promptLocation" + name="promptLocation"> + <label class="onoffswitch-label" for="promptLocation"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">系统提示LPN:</label> - <div class="col-sm-8"> - <input id="promptLpn" name="promptLpn" class="form-control" type="text" th:field="*{promptLpn}"> - </div> - </div> - <!--<div class="form-group"> - <label class="col-sm-3 control-label">系统提示LPN:</label> + <label class="col-sm-3 control-label">系统提示容器:</label> <div class="col-sm-8"> <div class="onoffswitch"> - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="promptLpn" - name="promptLpn" th:field="*{promptLpn}"> + <input type="checkbox" th:checked="*{promptLpn}" class="onoffswitch-checkbox" id="promptLpn" + name="promptLpn" > <label class="onoffswitch-label" for="promptLpn"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div> </div> - </div>--> + </div> <div class="form-group"> <label class="col-sm-3 control-label">系统提示物料:</label> <div class="col-sm-8"> - <input id="promptItem" name="promptItem" class="form-control" type="text" th:field="*{promptItem}"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{promptItem}" class="onoffswitch-checkbox" id="promptItem" + name="promptItem"> + <label class="onoffswitch-label" for="promptItem"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">显示库存数量:</label> <div class="col-sm-8"> - <input id="promptQuantity" name="promptQuantity" class="form-control" type="text" th:field="*{promptQuantity}"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{promptQuantity}" class="onoffswitch-checkbox" id="promptQuantity" + name="promptQuantity"> + <label class="onoffswitch-label" for="promptQuantity"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> - <div class="form-group"> + <!--<div class="form-group"> <label class="col-sm-3 control-label">允许添加库存:</label> <div class="col-sm-8"> <input id="allowAddNewInventory" name="allowAddNewInventory" class="form-control" type="text" th:field="*{allowAddNewInventory}"> @@ -83,7 +98,7 @@ <div class="col-sm-8"> <input id="version" name="version" class="form-control" type="text" th:field="*{version}"> </div> - </div> + </div>--> <div class="form-group"> <label class="col-sm-3 control-label">创建时间:</label> <div class="col-sm-8"> @@ -96,73 +111,25 @@ <input id="createdBy" name="createdBy" class="form-control" type="text" th:field="*{createdBy}" readonly="readonly"> </div> </div> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">更新时间:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="lastUpdated" name="lastUpdated" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">更新者:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="lastUpdatedBy" name="lastUpdatedBy" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <div class="form-group"> + <!--<div class="form-group"> <label class="col-sm-3 control-label">处理标记:</label> <div class="col-sm-8"> <input id="processStamp" name="processStamp" class="form-control" type="text" th:field="*{processStamp}" /> </div> - </div> - <!--<div class="form-group"> - <label class="col-sm-3 control-label">是否有效:</label> - <div class="col-sm-8"> - <!–<input id="enable" name="enable" class="form-control" type="text">–> - <div class="onoffswitch"> - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable"> - <label class="onoffswitch-label" for="enable"> - <span class="onoffswitch-inner"></span> - <span class="onoffswitch-switch"></span> - </label> - </div> - </div> </div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">是否删除:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="deleted" name="deleted" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef1" name="userDef1" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段2:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef2" name="userDef2" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段3:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef3" name="userDef3" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段4:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef4" name="userDef4" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> - <!--<div class="form-group"> --> - <!--<label class="col-sm-3 control-label">自定义字段5:</label>--> - <!--<div class="col-sm-8">--> - <!--<input id="userDef5" name="userDef5" class="form-control" type="text">--> - <!--</div>--> - <!--</div>--> + <div class="form-group"> + <label class="col-sm-3 control-label">是否有效:</label> + <div class="col-sm-8"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{enable}" class="onoffswitch-checkbox" id="enable" + name="enable" > + <label class="onoffswitch-label" for="enable"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> + </div> + </div> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> <input type="submit" class="btn btn-primary" value="提交"> @@ -197,13 +164,14 @@ promptQuantity: { required: true, }, - allowAddNewInventory: { - required: true, - } }, submitHandler: function(form) { var tableValue = $.common.getTableValue("#form-cycleCountPreference-edit"); - /*tableValue = formValueReplace(tableValue, "id", $("input[name='id']").is(':checked'));*/ + tableValue = formValueReplace(tableValue, "promptLocation", $("input[name='promptLocation']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptLpn", $("input[name='promptLpn']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptItem", $("input[name='promptItem']").is(':checked')); + tableValue = formValueReplace(tableValue, "promptQuantity", $("input[name='promptQuantity']").is(':checked')); + tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked')); $.operate.save(prefix + "/edit", tableValue); } }); diff --git a/src/main/resources/templates/config/filterConfigDetail/add.html b/src/main/resources/templates/config/filterConfigDetail/add.html index 1bf507e..7a557fe 100644 --- a/src/main/resources/templates/config/filterConfigDetail/add.html +++ b/src/main/resources/templates/config/filterConfigDetail/add.html @@ -24,12 +24,12 @@ <!--<input id="recordType" name="recordType" class="form-control" type="text">--> <!--</div>--> <!--</div>--> - <div class="form-group"> - <label class="col-sm-3 control-label">条件名:</label> - <div class="col-sm-8"> - <input id="filterCode" name="filterCode" class="form-control" type="text"> - </div> - </div> + <!--<div class="form-group">--> + <!--<label class="col-sm-3 control-label">条件名:</label>--> + <!--<div class="col-sm-8">--> + <!--<input id="filterCode" name="filterCode" class="form-control" type="text">--> + <!--</div>--> + <!--</div>--> <div class="form-group"> <label class="col-sm-3 control-label">描述:</label> <div class="col-sm-8"> @@ -43,6 +43,12 @@ </div> </div> <div class="form-group"> + <label class="col-sm-3 control-label">后续分组排序:</label> + <div class="col-sm-8"> + <input id="statements" name="statements" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> <label class="col-sm-3 control-label">是否系统创建:</label> <div class="col-sm-8"> <div class="onoffswitch"> @@ -82,15 +88,6 @@ code:{ required:true, }, - // moduleType:{ - // required:true, - // }, - // recordType:{ - // required:true, - // }, - filterCode:{ - required:true, - }, }, submitHandler: function(form) { // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); diff --git a/src/main/resources/templates/config/filterConfigDetail/edit.html b/src/main/resources/templates/config/filterConfigDetail/edit.html index 0dc9136..cecdd27 100644 --- a/src/main/resources/templates/config/filterConfigDetail/edit.html +++ b/src/main/resources/templates/config/filterConfigDetail/edit.html @@ -25,12 +25,7 @@ <!--<input id="recordType" name="recordType" class="form-control" type="text" th:field="*{recordType}">--> <!--</div>--> <!--</div>--> - <div class="form-group"> - <label class="col-sm-3 control-label">条件名:</label> - <div class="col-sm-8"> - <input id="filterCode" name="filterCode" class="form-control" type="text" th:field="*{filterCode}"> - </div> - </div> + <div class="form-group"> <label class="col-sm-3 control-label">描述:</label> <div class="col-sm-8"> @@ -83,15 +78,6 @@ code:{ required:true, }, - // moduleType:{ - // required:true, - // }, - // recordType:{ - // required:true, - // }, - filterCode:{ - required:true, - }, }, submitHandler: function(form) { // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); diff --git a/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html b/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html index b728ed2..feef6db 100644 --- a/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html +++ b/src/main/resources/templates/config/filterConfigDetail/filterConfigDetail.html @@ -92,6 +92,10 @@ title : '全SQL' }, { + field : 'statements', + title : '后续分组排序' + }, + { field : 'systemCreated', title : '是否系统创建', formatter: function (value, item, index) { diff --git a/src/main/resources/templates/config/filterConfigHeader/add.html b/src/main/resources/templates/config/filterConfigHeader/add.html index ef943cd..e07a189 100644 --- a/src/main/resources/templates/config/filterConfigHeader/add.html +++ b/src/main/resources/templates/config/filterConfigHeader/add.html @@ -5,11 +5,14 @@ <body class="white-bg"> <div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-filterConfigHeader-add"> - <input name="moduleType" th:field="${moduleType}" type="hidden"> + <input name="moduleType" th:value="${moduleType}" hidden> <div class="form-group"> <label class="col-sm-3 control-label">类型:</label> <div class="col-sm-8"> - <select id="recordType" name="recordType" class="form-control" th:with="recordType=${@dict.getType('recordType')}"> + <select id="recordType" name="recordType" class="form-control" th:if="${moduleType == 'receipt'}" th:with="recordType=${@dict.getType('receiptRuleType')}"> + <option th:each="item : ${recordType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> + </select> + <select id="recordType" name="recordType" class="form-control" th:if="${moduleType != 'receipt'}" th:with="recordType=${@dict.getType('shipmentRuleType')}"> <option th:each="item : ${recordType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> </select> </div> diff --git a/src/main/resources/templates/config/location/addBatch.html b/src/main/resources/templates/config/location/addBatch.html index 972b851..cb097aa 100644 --- a/src/main/resources/templates/config/location/addBatch.html +++ b/src/main/resources/templates/config/location/addBatch.html @@ -30,6 +30,12 @@ </div> </div> <div class="form-group"> + <label class="col-sm-3 control-label">巷道:</label> + <div class="col-sm-8"> + <input id="roadway" name="roadway" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> <label class="col-sm-3 control-label">库位类型:</label> <div class="col-sm-8"> <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}"> @@ -104,6 +110,7 @@ "iColumn": $("input[name='iColumn']").val(), "iLayer": $("input[name='iLayer']").val(), "iGrid": $("input[name='iGrid']").val(), + "roadway": $("input[name='roadway']").val(), "locationType": $("#locationType option:selected").val(), "zoneCode": $("#zone option:selected").attr("code"), "status" : $("#status option:selected").val(), diff --git a/src/main/resources/templates/config/location/location.html b/src/main/resources/templates/config/location/location.html index 7582f1c..06d13b5 100644 --- a/src/main/resources/templates/config/location/location.html +++ b/src/main/resources/templates/config/location/location.html @@ -68,7 +68,7 @@ <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:location:add"> <i class="fa fa-plus"></i> 新增 </a> - <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:add"> + <a class="btn btn-outline btn-primary btn-rounded" onclick="addBatch()" shiro:hasPermission="config:location:addBatch"> <i class="fa fa-plus-square-o"></i> 批量新增 </a> <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:location:remove"> @@ -133,6 +133,10 @@ title : '格' }, { + field : 'roadway', + title : '巷道' + }, + { field : 'name', title : '名称', visible : false diff --git a/src/main/resources/templates/config/material/material.html b/src/main/resources/templates/config/material/material.html index 0b48f64..ee1183b 100644 --- a/src/main/resources/templates/config/material/material.html +++ b/src/main/resources/templates/config/material/material.html @@ -162,7 +162,17 @@ }, { field : 'autoGenSerialNum', - title : '自动生成序列号' , + title : '自动生成序列号', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + if (value == 0){ + actions.push("<span class='badge badge-primary'>自动生成</span>"); + } else { + actions.push("<span class='badge badge-primary'>不自动生成</span>"); + } + return actions.join(''); + } }, { field : 'autoGenSerialNumFormat', diff --git a/src/main/resources/templates/config/receiptPreference/add.html b/src/main/resources/templates/config/receiptPreference/add.html index a021415..307dc6d 100644 --- a/src/main/resources/templates/config/receiptPreference/add.html +++ b/src/main/resources/templates/config/receiptPreference/add.html @@ -20,7 +20,7 @@ <div class="form-group"> <label class="col-sm-3 control-label">入库流程:</label> <div class="col-sm-8"> - <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('入库单')}"> + <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}"> <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> </select> </div> diff --git a/src/main/resources/templates/config/receiptPreference/edit.html b/src/main/resources/templates/config/receiptPreference/edit.html index 565b81b..849c085 100644 --- a/src/main/resources/templates/config/receiptPreference/edit.html +++ b/src/main/resources/templates/config/receiptPreference/edit.html @@ -21,7 +21,7 @@ <div class="form-group"> <label class="col-sm-3 control-label">入库流程:</label> <div class="col-sm-8"> - <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('入库单')}" th:field="*{receivingFlow}"> + <select id="receivingFlow" name="receivingFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}" th:field="*{receivingFlow}"> <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> </select> </div> diff --git a/src/main/resources/templates/config/receiptPreference/receiptPreference.html b/src/main/resources/templates/config/receiptPreference/receiptPreference.html index 8bac2f9..6b72a1b 100644 --- a/src/main/resources/templates/config/receiptPreference/receiptPreference.html +++ b/src/main/resources/templates/config/receiptPreference/receiptPreference.html @@ -139,6 +139,7 @@ { field : 'manuallyBuildLPN', title : '人工组盘', + align : "center", formatter : function(value, row, index) { return $.table.selectWhetherLabel(value); }, diff --git a/src/main/resources/templates/config/receiptType/add.html b/src/main/resources/templates/config/receiptType/add.html index d1c12e2..d97147b 100644 --- a/src/main/resources/templates/config/receiptType/add.html +++ b/src/main/resources/templates/config/receiptType/add.html @@ -46,7 +46,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">入库流程:</label> <div class="col-sm-8"> - <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('入库单')}"> + <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}"> + <option value="">请选择</option> <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> </select> </div> diff --git a/src/main/resources/templates/config/receiptType/edit.html b/src/main/resources/templates/config/receiptType/edit.html index 8f3ca3c..a092d68 100644 --- a/src/main/resources/templates/config/receiptType/edit.html +++ b/src/main/resources/templates/config/receiptType/edit.html @@ -48,7 +48,8 @@ <div class="form-group"> <label class="col-sm-3 control-label">入库流程:</label> <div class="col-sm-8"> - <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('入库单')}" th:field="*{receiptFlow}"> + <select id="receiptFlow" name="receiptFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}" th:field="*{receiptFlow}"> + <option value="">请选择</option> <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> </select> </div> diff --git a/src/main/resources/templates/config/shipmentType/add.html b/src/main/resources/templates/config/shipmentType/add.html index e35d3a8..13fe276 100644 --- a/src/main/resources/templates/config/shipmentType/add.html +++ b/src/main/resources/templates/config/shipmentType/add.html @@ -4,7 +4,7 @@ <head th:include="include :: header"></head> <body class="white-bg"> <div class="wrapper wrapper-content animated fadeInRight ibox-content"> - <form class="form-horizontal m" id="form-receiptType-add"> + <form class="form-horizontal m" id="form-shipmentType-add"> <div class="form-group"> <label class="col-sm-3 control-label">编码:</label> <div class="col-sm-8"> @@ -46,7 +46,7 @@ <div class="form-group"> <label class="col-sm-3 control-label">出库流程:</label> <div class="col-sm-8"> - <select id="receiptFlow" name="shipmentFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList()}"> + <select id="shipmentFlow" name="shipmentFlow" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('shippingFlow')}"> <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> </select> </div> @@ -153,7 +153,7 @@ <div th:include="include::footer"></div> <script type="text/javascript"> var prefix = ctx + "config/shipmentType"; - $("#form-receiptType-add").validate({ + $("#form-shipmentType-add").validate({ rules:{ code:{ required:true, @@ -167,7 +167,7 @@ }, submitHandler: function(form) { // $.operate.save(prefix + "/add", $('#form-locationType-add').serialize()); - var tableValue = $.common.getTableValue("#form-receiptType-add"); + var tableValue = $.common.getTableValue("#form-shipmentType-add"); tableValue = formValueReplace(tableValue, "companyCode", $("#companyCode option:selected").val()); tableValue = formValueReplace(tableValue, "shipmentFlow", $("#shipmentFlow option:selected").val()); tableValue = formValueReplace(tableValue, "enable", $("input[name='enable']").is(':checked')); diff --git a/src/main/resources/templates/config/shipmentType/edit.html b/src/main/resources/templates/config/shipmentType/edit.html index 1e6c3c2..3f2ce7e 100644 --- a/src/main/resources/templates/config/shipmentType/edit.html +++ b/src/main/resources/templates/config/shipmentType/edit.html @@ -155,7 +155,7 @@ <div th:include="include::footer"></div> <script type="text/javascript"> var prefix = ctx + "config/shipmentType"; - $("#form-receiptType-edit").validate({ + $("#form-shipmentType-edit").validate({ rules:{ code:{ required:true, diff --git a/src/main/resources/templates/config/station/add.html b/src/main/resources/templates/config/station/add.html new file mode 100644 index 0000000..6bcb411 --- /dev/null +++ b/src/main/resources/templates/config/station/add.html @@ -0,0 +1,54 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> + <form class="form-horizontal m" id="form-station-add"> + <div class="form-group"> + <label class="col-sm-3 control-label">编码:</label> + <div class="col-sm-8"> + <input id="code" name="code" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">类型:</label> + <div class="col-sm-8"> + <input id="type" name="type" class="form-control" type="text" > + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">状态:</label> + <div class="col-sm-8"> + <input id="status" name="status" class="form-control" type="text" > + </div> + </div> + <div class="form-group"> + <div class="form-control-static col-sm-offset-9"> + <button type="submit" class="btn btn-primary">提交</button> + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> + </div> + </div> + </form> +</div> +<div th:include="include::footer"></div> +<script type="text/javascript"> + var prefix = ctx + "config/station" + $("#form-station-add").validate({ + rules:{ + code:{ + required:true + }, + type:{ + required: true + } + }, + submitHandler: function(form) { + // $.operate.save(prefix + "/add", $('#form-supplier-add').serialize()); + var tableValue = $.common.getTableValue("#form-station-add"); + $.operate.save(prefix + "/add", tableValue); + } + }); +</script> +</body> +</html> diff --git a/src/main/resources/templates/config/station/edit.html b/src/main/resources/templates/config/station/edit.html new file mode 100644 index 0000000..b483673 --- /dev/null +++ b/src/main/resources/templates/config/station/edit.html @@ -0,0 +1,54 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> + <form class="form-horizontal m" id="form-station-add" th:object="${station}"> + <div class="form-group"> + <label class="col-sm-3 control-label">编码:</label> + <div class="col-sm-8"> + <input id="code" name="code" class="form-control" type="text" th:field="*{code}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">类型:</label> + <div class="col-sm-8"> + <input id="type" name="type" class="form-control" type="text" th:field="*{type}"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">状态:</label> + <div class="col-sm-8"> + <input id="status" name="status" class="form-control" type="text" th:field="*{status}"> + </div> + </div> + <div class="form-group"> + <div class="form-control-static col-sm-offset-9"> + <button type="submit" class="btn btn-primary">提交</button> + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> + </div> + </div> + </form> +</div> +<div th:include="include::footer"></div> +<script type="text/javascript"> + var prefix = ctx + "config/station" + $("#form-station-add").validate({ + rules:{ + code:{ + required:true + }, + type:{ + required: true + } + }, + submitHandler: function(form) { + // $.operate.save(prefix + "/add", $('#form-supplier-add').serialize()); + var tableValue = $.common.getTableValue("#form-station-add"); + $.operate.save(prefix + "/edit", tableValue); + } + }); +</script> +</body> +</html> diff --git a/src/main/resources/templates/config/station/station.html b/src/main/resources/templates/config/station/station.html new file mode 100644 index 0000000..6b5f357 --- /dev/null +++ b/src/main/resources/templates/config/station/station.html @@ -0,0 +1,115 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="gray-bg"> +<div class="container-div"> + <div class="row"> + <div class="col-sm-12 select-info"> + <form id="supplier-form"> + <div class="select-list"> + <ul> + <li> + 编码:<input type="text" name="code"/> + </li> + <li class="time"> + <label>创建时间: </label> + <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/> + <span>-</span> + <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/> + </li> + <li> + <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('supplier-form')"><i class="fa fa-refresh"></i> 重置</a> + <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="config:supplier:export"><i class="fa fa-download"></i> 导出</a>--> + </li> + </ul> + </div> + </form> + </div> + + <div class="btn-group hidden-xs" id="toolbar" role="group"> + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:station:add"> + <i class="fa fa-plus"></i> 新增 + </a> + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:station:remove"> + <i class="fa fa-trash-o"></i> 删除 + </a> + </div> + + <div class="col-sm-12 select-info"> + <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> + </div> + </div> +</div> +<div th:include="include :: footer"></div> +<script th:inline="javascript"> + var editFlag = [[${@permission.hasPermi('config:station:edit')}]]; + var removeFlag = [[${@permission.hasPermi('config:station:remove')}]]; + var prefix = ctx + "config/station" + var datas = [[${@dict.getType('sys_normal_disable')}]]; + $(function() { + var options = { + url: prefix + "/list", + createUrl: prefix + "/add", + updateUrl: prefix + "/edit/{id}", + removeUrl: prefix + "/remove", + modalName: "站台", + search: false, + sortName: "id", + sortOrder: "desc", + columns: [{ + checkbox: true + }, + { + field : 'id', + title : 'id' + }, + { + field : 'warehouseCode', + title : '仓库' + }, + { + field : 'code', + title : '编码' + }, + { + field : 'type', + title : '类型' + }, + { + field : 'status', + title : '状态' + }, + { + field : 'created', + title : '创建时间' + }, + { + field : 'createdBy', + title : '创建用户' + }, + { + field : 'lastUpdated', + title : '更新时间' + }, + { + field : 'lastUpdatedBy', + title : '更新用户' + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); + return actions.join(''); + } + }] + }; + $.table.init(options); + }); +</script> +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/templates/config/statusFlowDetail/add.html b/src/main/resources/templates/config/statusFlowDetail/add.html index 0b63952..7854e00 100644 --- a/src/main/resources/templates/config/statusFlowDetail/add.html +++ b/src/main/resources/templates/config/statusFlowDetail/add.html @@ -16,9 +16,7 @@ <div class="form-group"> <label class="col-sm-3 control-label">模块:</label> <div class="col-sm-8"> - <select id="moduleType" name="moduleType" class="form-control" th:with="moduleType=${@dict.getType('moduleType')}"> - <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> - </select> + <input id="moduleType" name="moduleType" class="form-control" type="text" th:value="${moduleType}" readonly="readonly"> </div> </div> <div class="form-group"> diff --git a/src/main/resources/templates/config/statusFlowHeader/add.html b/src/main/resources/templates/config/statusFlowHeader/add.html index adf741e..6b45eb6 100644 --- a/src/main/resources/templates/config/statusFlowHeader/add.html +++ b/src/main/resources/templates/config/statusFlowHeader/add.html @@ -5,6 +5,7 @@ <body class="white-bg"> <div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-statusFlowHeader-add"> + <input id="moduleType" name="moduleType" hidden th:value="${moduleType}"> <div class="form-group"> <label class="col-sm-3 control-label">编码:</label> <div class="col-sm-8"> @@ -17,22 +18,7 @@ <input id="name" name="name" class="form-control" type="text"> </div> </div> - <div class="form-group"> - <label class="col-sm-3 control-label">模块:</label> - <div class="col-sm-8"> - <select id="moduleType" name="moduleType" class="form-control" th:with="moduleType=${@dict.getType('moduleType')}"> - <option th:each="item : ${moduleType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> - </select> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">类型:</label> - <div class="col-sm-8"> - <select id="recordType" name="recordType" class="form-control" th:with="recordType=${@dict.getType('recordType')}"> - <option th:each="item : ${recordType}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> - </select> - </div> - </div> + <input id="recordType" name="recordType" class="form-control" type="hidden" th:value="${moduleType} == 'receipt'? 'receivingFlow':'shippingFlow'"> <!--<div class="form-group">--> <!-- <label class="col-sm-3 control-label">数据版本:</label>--> <!-- <div class="col-sm-8">--> diff --git a/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html b/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html index 675c1e1..dca7c9b 100644 --- a/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html +++ b/src/main/resources/templates/config/statusFlowHeader/statusFlowHeader.html @@ -82,7 +82,7 @@ $(function() { var options = { url: prefix + "/list", - createUrl: prefix + "/add", + createUrl: prefix + "/add/"+[[${moduleType}]], updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", modalName: "流程", diff --git a/src/main/resources/templates/config/warehouse/copy.html b/src/main/resources/templates/config/warehouse/copy.html new file mode 100644 index 0000000..944409c --- /dev/null +++ b/src/main/resources/templates/config/warehouse/copy.html @@ -0,0 +1,38 @@ +<!DOCTYPE HTML> +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> +<meta charset="utf-8"> +<head th:include="include :: header"></head> +<body class="white-bg"> +<div class="wrapper wrapper-content animated fadeInRight ibox-content"> + <form class="form-horizontal m" id="form-warehouse-add"> + <div class="form-group"> + <label class="col-sm-3 control-label">仓库编码:</label> + <div class="col-sm-8"> + <input id="newWarehouseCode" name="newWarehouseCode" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <div class="form-control-static col-sm-offset-9"> + <button type="submit" class="btn btn-primary">提交</button> + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> + </div> + </div> + </form> +</div> +<div th:include="include::footer"></div> +<script type="text/javascript"> + var prefix = ctx + "config/warehouse"; + $("#form-warehouse-add").validate({ + rules:{ + newWarehouseCode:{ + required:true + }, + }, + submitHandler: function(form) { + var tableValue = $("#form-warehouse-add").serialize(); + $.operate.save(prefix + "/copySave", tableValue); + } + }); +</script> +</body> +</html> diff --git a/src/main/resources/templates/config/warehouse/warehouse.html b/src/main/resources/templates/config/warehouse/warehouse.html index b8c6c3b..3506339 100644 --- a/src/main/resources/templates/config/warehouse/warehouse.html +++ b/src/main/resources/templates/config/warehouse/warehouse.html @@ -37,6 +37,8 @@ </form> </div> <div class="btn-group hidden-xs" id="toolbar" role="group"> + <a class="btn btn-outline btn-success btn-rounded" onclick="copy()" shiro:hasPermission="config:warehouse:copy"> + <i class="fa fa-files-o"></i>复制仓库</a> <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:warehouse:add"> <i class="fa fa-plus"></i> 新增 </a> @@ -235,6 +237,10 @@ $.operate.submit(url, "post", "json", data); }); } + function copy() { + var url = prefix+"/copy"; + $.modal.open("复制仓库" + $.table._option.modalName, url); + } </script> </body> </html> \ No newline at end of file diff --git a/src/main/resources/templates/config/waveMaster/add.html b/src/main/resources/templates/config/waveMaster/add.html index 03fade8..7e1217e 100644 --- a/src/main/resources/templates/config/waveMaster/add.html +++ b/src/main/resources/templates/config/waveMaster/add.html @@ -68,21 +68,25 @@ <div class="form-group"> <label class="col-sm-3 control-label">是否补货:</label> <div class="col-sm-8"> - <div class="radio radio-info radio-inline" style="transform: scale(1.1, 1.1);"> - <input type="radio" id="needReplenishment1" name="needReplenishment" value="true" checked="checked" - class="radio_select"> - <label for="needReplenishment1">是</label> - </div> - <div class="radio radio-danger radio-inline " style="transform: scale(1.1, 1.1);"> - <input type="radio" id="needReplenishment2" name="needReplenishment" value="false"> - <label for="needReplenishment2">否</label> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="needReplenishment" name="needReplenishment"> + <label class="onoffswitch-label" for="needReplenishment"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> </div> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">取消波次时保留补货任务:</label> <div class="col-sm-8"> - <input id="holdRplnTask" name="holdRplnTask" class="form-control" type="text"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="holdRplnTask" name="holdRplnTask"> + <label class="onoffswitch-label" for="holdRplnTask"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> <!--<div class="form-group"> diff --git a/src/main/resources/templates/config/waveMaster/edit.html b/src/main/resources/templates/config/waveMaster/edit.html index a95770c..a2e2383 100644 --- a/src/main/resources/templates/config/waveMaster/edit.html +++ b/src/main/resources/templates/config/waveMaster/edit.html @@ -69,23 +69,28 @@ <div class="form-group"> <label class="col-sm-3 control-label">是否补货:</label> <div class="col-sm-8"> - <div class="radio radio-info radio-inline" style="transform: scale(1.1, 1.1);"> - <input type="radio" id="needReplenishment1" name="needReplenishment" value="true" th:field="*{needReplenishment}" - class="radio_select"> - <label for="needReplenishment1">是</label> - </div> - <div class="radio radio-danger radio-inline " style="transform: scale(1.1, 1.1);"> - <input type="radio" id="needReplenishment2" name="needReplenishment" value="false" th:field="*{needReplenishment}"> - <label for="needReplenishment2">否</label> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{needReplenishment}" class="onoffswitch-checkbox" id="needReplenishment" name="needReplenishment"> + <label class="onoffswitch-label" for="needReplenishment"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> </div> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">取消波次时保留补货任务:</label> <div class="col-sm-8"> - <input id="holdRplnTask" name="holdRplnTask" class="form-control" type="text" th:field="*{holdRplnTask}"> + <div class="onoffswitch"> + <input type="checkbox" th:checked="*{holdRplnTask}" class="onoffswitch-checkbox" id="holdRplnTask" name="holdRplnTask"> + <label class="onoffswitch-label" for="holdRplnTask"> + <span class="onoffswitch-inner"></span> + <span class="onoffswitch-switch"></span> + </label> + </div> </div> </div> + <!--<div class="form-group"> <label class="col-sm-3 control-label">数据版本:</label> <div class="col-sm-8"> diff --git a/src/main/resources/templates/config/waveMaster/waveMaster.html b/src/main/resources/templates/config/waveMaster/waveMaster.html index 496759c..9654780 100644 --- a/src/main/resources/templates/config/waveMaster/waveMaster.html +++ b/src/main/resources/templates/config/waveMaster/waveMaster.html @@ -104,8 +104,8 @@ <div class="tab-pane fade" id="tabDetail"> <div class="btn-group hidden-xs" id="toolbar2" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="detailAdd()" - shiro:hasPermission="config:waveFlowHeader:add"> + <a class="btn btn-outline btn-success btn-rounded" onclick="detailAdd()" style="display:none;" + id="detailAdd" shiro:hasPermission="config:waveFlowHeader:add"> <i class="fa fa-plus"></i> 新增 </a> <a class="btn btn-outline btn-danger btn-rounded" onclick="detailBatRemove()" @@ -216,7 +216,15 @@ }, { field : 'holdRplnTask', - title : '取消波次时保留补货任务' + title : '取消波次时保留补货任务', + formatter: function (value, item, index) { + if (value==true) { + return '<span class="badge" style="background-color: #00B83F;color: white;width: 36px;">' + ' 是 ' + '</span>'; + } + else if (value==false) { + return '<span class="badge" style="background-color: #ff0000;color: white;width: 36px;">' + ' 否 ' + '</span>'; + } + } }, { field : 'created', @@ -524,6 +532,7 @@ function detailReg(rowId){ headerId = rowId; + $("#detailAdd").css("display","block"); detail(); } @@ -598,7 +607,7 @@ } function detailAdd() { - var url = prefix2+"/add"; + var url = prefix2+"/add/"+headerId; $.modal.open("添加明细", url); } diff --git a/src/main/resources/templates/inventory/adjustDetail/add.html b/src/main/resources/templates/inventory/adjustDetail/add.html index d5d3095..96d37e3 100644 --- a/src/main/resources/templates/inventory/adjustDetail/add.html +++ b/src/main/resources/templates/inventory/adjustDetail/add.html @@ -101,7 +101,7 @@ <input id="materialUnit" name="materialUnit" class="form-control" type="text"> </div> </div>--> - <div class="form-group"> + <!--<div class="form-group"> <label class="col-sm-3 control-label">调整类型:</label> <div class="col-sm-8"> <select id="problemType" name="problemType" class="form-control" @@ -109,9 +109,9 @@ <option th:each="dict : ${problemType}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> </select> - <!--<input id="problemType" name="problemType" class="form-control" type="text" >--> + <!–<input id="problemType" name="problemType" class="form-control" type="text" >–> </div> - </div> + </div>--> <div class="form-group"> <label class="col-sm-3 control-label">属性号:</label> <div class="col-sm-8"> @@ -143,8 +143,8 @@ <label class="col-sm-3 control-label">调整前库存状态:</label> <div class="col-sm-8"> <select id="fromInventorySts" name="fromInventorySts" class="form-control" - th:with="fromInventorySts=${@dict.getType('inventoryStatus')}"> - <option th:each="dict : ${fromInventorySts}" th:text="${dict['dictLabel']}" + th:with="fromInventoryStatus=${@dict.getType('inventorySts')}"> + <option th:each="dict : ${fromInventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> </select> </div> @@ -153,22 +153,12 @@ <label class="col-sm-3 control-label">调整后库存状态:</label> <div class="col-sm-8"> <select id="toInventorySts" name="toInventorySts" class="form-control" - th:with="toInventorySts=${@dict.getType('inventoryStatus')}"> - <option th:each="dict : ${toInventorySts}" th:text="${dict['dictLabel']}" + th:with="toInventoryStatus=${@dict.getType('inventorySts')}"> + <option th:each="dict : ${toInventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> </select> </div> </div> - <!--<div class="form-group"> - <label class="col-sm-3 control-label">调整状态:</label> - <div class="col-sm-8"> - <select id="status" name="status" class="form-control" - th:with="status=${@dict.getType('inventoryStatus')}"> - <option th:each="dict : ${status}" th:text="${dict['dictLabel']}" - th:value="${dict['dictValue']}"></option> - </select> - </div> - </div>--> <div class="form-group"> <label class="col-sm-3 control-label">重量:</label> <div class="col-sm-8"> @@ -228,9 +218,6 @@ adjustCode: { required: true, }, - problemType: { - required: true, - }, materialCode: { required: true, }, diff --git a/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html b/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html index 232ca9c..327eb53 100644 --- a/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html +++ b/src/main/resources/templates/inventory/adjustDetail/adjustDetail.html @@ -91,14 +91,16 @@ </div> </div> <div class="btn-group hidden-xs" id="toolbar" role="group"> - <a class="btn btn-outline btn-success btn-rounded" onclick="add()"> + <a class="btn btn-outline btn-success btn-rounded" onclick="add()" + shiro:hasPermission="inventory:adjustDetail:add" > <i class="fa fa-plus"></i> 新增 </a> - <a class="btn btn-outline btn-primary btn-rounded" onclick="agree()"> + <a class="btn btn-outline btn-primary btn-rounded" onclick="agree()" + shiro:hasPermission="inventory:adjustDetail:adjustAgree" > <i class="fa fa-edit"></i> 审批 </a> - <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()"/> - <!--shiro:hasPermission="inventory:cyclecountAdjustDetail:addAdjust"--> + <a class="btn btn-outline btn-danger btn-rounded" onclick="addAdjust()" + shiro:hasPermission="inventory:adjustDetail:addAdjust"> <i class="fa fa-vcard"></i>调整 </a> <!--<a class="btn btn-outline btn-success btn-rounded" onclick="$.table.refresh()"> @@ -112,6 +114,7 @@ <script th:inline="javascript"> var prefix = ctx + "inventory/adjustDetail"; var prefix_head = ctx + "inventory/adjustHeader"; + var removes= [[${@permission.hasPermi('inventory:adjustDetail:remove')}]]; var type2 = [[${@dict.getType('adjustType')}]]; var adjustStatus = [[${@dict.getType('adjustStatus')}]]; var inventoryStatus = [[${@dict.getType('inventoryStatus')}]]; @@ -353,7 +356,7 @@ align: 'center', formatter: function (value, row, index) { var actions = []; - actions.push('<a class="btn btn-danger btn-xs" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> '); + actions.push('<a class="btn btn-danger btn-xs ' + removes + ' " href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> '); return actions.join(''); } } @@ -417,7 +420,7 @@ $.modal.alertWarning("请至少选择一条记录"); return; } - $.modal.confirm("注意:该操作将更改库存,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!" + $.modal.confirm("注意:该操作将更改库存数量或属性,当实盘数量为0且库位上只剩空容器时,请手动执行空托出库任务,容器上有货则无需其他操作!" , function() { var url = prefix + "/adjustEdit"; var data = { "ids": rows.join() }; diff --git a/src/main/resources/templates/inventory/adjustHeader/adjustHeader.html b/src/main/resources/templates/inventory/adjustHeader/adjustHeader.html index 1ab0768..014cbb6 100644 --- a/src/main/resources/templates/inventory/adjustHeader/adjustHeader.html +++ b/src/main/resources/templates/inventory/adjustHeader/adjustHeader.html @@ -69,13 +69,13 @@ </div> <div class="btn-group hidden-xs" id="toolbar" role="group"> <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" - shiro:hasPermission="inventory:cycleCount:add"> + shiro:hasPermission="inventory:adjustHeader:add"> <i class="fa fa-plus"></i> 新增 </a> - <!--<a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" - shiro:hasPermission="inventory:cycleCount:remove"> - <i class="fa fa-trash-o"></i> 删除 - </a>--> + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" + shiro:hasPermission="inventory:adjustHeader:remove"> + <i class="fa fa-trash-o"></i> 删除 + </a> </div> <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> @@ -90,7 +90,7 @@ <script th:inline="javascript"> var prefix = ctx + "inventory/adjustHeader"; var upload = [[${@permission.hasPermi('inventoryHeader:adjustHeader:upload')}]]; - var report = [[${@permission.hasPermi('inventoryHeader:adjustHeader:report')}]]; + var report = [[${@permission.hasPermi('inventory:adjustHeader:report')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]]; var type2 = [[${@dict.getType('adjustType')}]]; @@ -180,8 +180,8 @@ align: 'center', formatter: function (value, row, index) { var actions = []; - /* actions.push('<a class="btn btn-success btn-xs " href="#" onclick="adjustPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> '); - actions.push('<a class="btn btn-info btn-xs ' + upload + ' " href="#" onclick="upLoad(\'' + row.code + '\',\'' + row.sourceCode + '\')"><i class="fa fa-edit"></i>上传</a> '); + actions.push('<a class="btn btn-success btn-xs " href="#" onclick="adjustPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> '); + /* actions.push('<a class="btn btn-info btn-xs ' + upload + ' " href="#" onclick="upLoad(\'' + row.code + '\',\'' + row.sourceCode + '\')"><i class="fa fa-edit"></i>上传</a> '); actions.push('<a class="btn btn-danger btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> ');*/ actions.push('<a style="background: #b5bdc0" class="btn btn-default btn-xs " href="#" onclick="detail(\'' + row.id + '\',\'' + row.code + '\')"><i class="fa fa-list-ul"></i>明细</a>'); return actions.join(''); diff --git a/src/main/resources/templates/inventory/cycleCountDetail/add.html b/src/main/resources/templates/inventory/cycleCountDetail/add.html index f1de843..3883657 100644 --- a/src/main/resources/templates/inventory/cycleCountDetail/add.html +++ b/src/main/resources/templates/inventory/cycleCountDetail/add.html @@ -11,7 +11,6 @@ <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode" th:value="${cycleCountHeadCode}"> <div class="select-list"> <ul> - <ul> <li> 库存头ID:<input id="inventoryHeaderId" type="text" name="inventoryHeaderId"/> </li> @@ -79,12 +78,14 @@ <a id="search" class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> <!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="general:inventoryHeader:export"><i class="fa fa-download"></i> 导出</a>--> </li> - </ul> + </ul> </div> </form> </div> <div class="col-sm-12 select-info"> - <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin-top: 12px" shiro:hasPermission="inventory:cyclecountDetail:add"><i class="fa fa-edit" ></i> 批量添加盘点明细</a> + <a class="btn btn-success btn-sm" onclick="addDetails()" style="float: left; margin-top: 12px" + shiro:hasPermission="inventory:cyclecountDetail:add"> + <i class="fa fa-edit" ></i> 添加盘点明细</a> <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> </div> @@ -94,7 +95,7 @@ <div th:include="include::footer"></div> <script th:inline="javascript"> - var addFlag = [[${@permission.hasPermi('inventoryHeader:cycleCountDetail:add')}]]; + var addFlag = [[${@permission.hasPermi('inventory:cyclecountDetail:add')}]]; // var removeFlag = [[${@permission.hasPermi('inventoryHeader:inventoryHeader:remove')}]]; var prefix = ctx + "inventory/inventoryDetail"; var prefix_cycleDetails = ctx + "inventory/cycleCountDetail"; @@ -132,7 +133,7 @@ { checkbox: true }, - { + /*{ title: '操作', align: 'center', formatter: function(value, row, index) { @@ -141,10 +142,10 @@ // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); return actions.join(''); } - }, + },*/ { field: 'id', - title: '明细ID', + title: '库存明细ID', sortable: true }, { @@ -315,14 +316,18 @@ }); - /*function addDetail(cycleCountHeadId) { - addInner($('cycleCountHeadId').val(),cycleCountHeadId); - }*/ + function addDetail(id) { + /*var ids =[]; + rows.forEach(function (item) { + ids.push(item.id); + });*/ + addInner($('#cycleCountHeadCode').val(),id); + } function addDetails() { var rows=$("#bootstrap-table").bootstrapTable('getSelections'); if (rows.length < 1) { - $.modal.alertWarning("请先选择记录"); + $.modal.alertWarning("请选择库存明细!"); return; } var ids =[]; @@ -339,7 +344,7 @@ url : prefix_cycleDetails + "/add", data:{ cycleCountHeadCode:cycleCountHeadCode, - inventoryDetailIdIds:ids + inventoryDetailIds:ids }, async : false, error : function(request) { diff --git a/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html b/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html index cc1c667..318e153 100644 --- a/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html +++ b/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html @@ -155,6 +155,10 @@ title: '仓库', }, { + field: 'preferenceCode', + title: '盘点首选项编码', + }, + { field: 'countId', title: '盘点内部号', visible: false @@ -318,13 +322,13 @@ align: 'center', formatter: function (value, row, index) { var actions = []; - - actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="#" onclick="confirmGapQty(\'' + row.id + '\')"><i class="fa fa-comment"></i>实盘登记</a> '); - - actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点任务</a> '); - + if(row.enableStatus >= 10 && row.enableStatus < 100){ + actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="#" onclick="confirmGapQty(\'' + row.id + '\')"><i class="fa fa-comment"></i>实盘登记</a> '); + } + if(row.enableStatus === 1 ){ + actions.push('<a class="btn btn-primary btn-xs ' + createTaskFalg + '" href="#" onclick="outcheck(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成盘点任务</a> '); + } actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')" ><i class="fa fa-trash-o"></i>删除</a>'); - return actions.join(''); } }] diff --git a/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html b/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html index 695d68d..54310a5 100644 --- a/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html +++ b/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html @@ -137,6 +137,11 @@ title: '货主编码' }, { + field: 'round', + title: ' 盘点轮次', + visible: false + }, + { field: 'sourceCode', title: '源盘点单' }, @@ -275,9 +280,9 @@ formatter: function (value, row, index) { var actions = []; actions.push('<a class="btn btn-success btn-xs ' + reportFlag + '" href="#" onclick="cyclecountPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> '); - - actions.push('<a class="btn btn-warning btn-xs ' + addAdjust + '" href="#" onclick="goAdjust(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成调整单</a> '); - + if(row.statusCyc === 100){ + actions.push('<a class="btn btn-warning btn-xs ' + addAdjust + '" href="#" onclick="goAdjust(\'' + row.id + '\')"><i class="fa fa-gbp"></i>生成调整单</a> '); + } //actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a> '); return actions.join(''); diff --git a/src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html b/src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html index f7c4248..b2bda68 100644 --- a/src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html +++ b/src/main/resources/templates/inventory/inventoryDetail/inventoryDetail.html @@ -86,7 +86,7 @@ shiro:hasPermission="inventory:inventoryHeader:seeOut"> <i class="fa fa-eye"></i> 出库查看 </a> - <a class="btn btn-outline btn-primary btn-rounded" onclick="check()" + <a class="btn btn-outline btn-danger btn-rounded" onclick="check()" shiro:hasPermission="inventory:inventoryDetail:detailCheckTask"> <i class="fa fa-eye"></i> 在库质检 </a> @@ -99,7 +99,7 @@ <div th:include="include :: footer"></div> <script th:inline="javascript"> var prefix = ctx + "inventory/inventoryDetail"; - var inventoryStatus = [[${@dict.getType('inventoryStatus')}]]; + var inventoryStatus = [[${@dict.getType('inventorySts')}]]; $(function () { update(); }); @@ -158,7 +158,15 @@ }, { field: 'qty', - title: '数量' + title: '库存数量' + }, + { + field: 'inventorySts', + title: '库存状态', + align: 'center', + formatter: function (value, row, index) { + return $.table.selectDictLabel(inventoryStatus, value); + } }, { field: 'taskQty', @@ -215,14 +223,6 @@ sortable: true, visible: false }, - { - field: 'inventorySts', - title: '库存状态', - align: 'center', - formatter: function (value, row, index) { - return $.table.selectDictLabel(inventoryStatus, value); - } - }, { field: 'referCode', @@ -305,7 +305,9 @@ visible: false } ] - },url = location.search.substr(1); + }, + + url = location.search.substr(1); let strs = url.split("&"); $("#inventoryHeaderId").val(strs[0]); $("#locationCode").val(strs[1]); diff --git a/src/main/resources/templates/inventory/inventoryHeader/emptyCheckOut.html b/src/main/resources/templates/inventory/inventoryHeader/emptyCheckOut.html index 0c4e394..b6c3d1a 100644 --- a/src/main/resources/templates/inventory/inventoryHeader/emptyCheckOut.html +++ b/src/main/resources/templates/inventory/inventoryHeader/emptyCheckOut.html @@ -12,14 +12,14 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">源库位编码:</label> + <label class="col-sm-3 control-label">库位编码:</label> <div class="col-sm-8"> <input id="location" name="location" class="form-control" type="text"> </div> </div> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> - <input type="button" class="btn-success btn" onclick="selectEmptyInOut()" value="选取" /> + <!-- <input type="button" class="btn-success btn" onclick="selectEmptyInOut()" value="选取" />--> <button type="submit" class="btn btn-primary">提交</button> <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> </div> diff --git a/src/main/resources/templates/inventory/inventoryHeader/emptyIn.html b/src/main/resources/templates/inventory/inventoryHeader/emptyIn.html index e072a78..093306d 100644 --- a/src/main/resources/templates/inventory/inventoryHeader/emptyIn.html +++ b/src/main/resources/templates/inventory/inventoryHeader/emptyIn.html @@ -6,7 +6,7 @@ <div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-task-emptyIn"> <div class="form-group"> - <label class="col-sm-3 control-label">容器编号:</label> + <label class="col-sm-3 control-label">容器编码:</label> <div class="col-sm-8"> <input id="containerCode" name="containerCode" class="form-control" type="text" > </div> diff --git a/src/main/resources/templates/inventory/inventoryHeader/emptyOut.html b/src/main/resources/templates/inventory/inventoryHeader/emptyOut.html index 4709a13..f82a17c 100644 --- a/src/main/resources/templates/inventory/inventoryHeader/emptyOut.html +++ b/src/main/resources/templates/inventory/inventoryHeader/emptyOut.html @@ -6,7 +6,7 @@ <div class="wrapper wrapper-content animated fadeInRight ibox-content"> <form class="form-horizontal m" id="form-task-emptyOut"> <div class="form-group"> - <label class="col-sm-3 control-label">容器编号:</label> + <label class="col-sm-3 control-label">容器编码:</label> <div class="col-sm-8"> <input id="containerCode" name="containerCode" class="form-control" type="text"> </div> @@ -19,7 +19,7 @@ </div> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> - <input type="button" class="btn-success btn" onclick="selectEmptyOut()" value="选取" /> + <!--<input type="button" class="btn-success btn" onclick="selectEmptyOut()" value="选取" />--> <button type="submit" class="btn btn-primary">提交</button> <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> </div> diff --git a/src/main/resources/templates/inventory/inventoryTransaction/inventoryTransaction.html b/src/main/resources/templates/inventory/inventoryTransaction/inventoryTransaction.html index 8c83724..c35f1ef 100644 --- a/src/main/resources/templates/inventory/inventoryTransaction/inventoryTransaction.html +++ b/src/main/resources/templates/inventory/inventoryTransaction/inventoryTransaction.html @@ -94,7 +94,7 @@ <script th:inline="javascript"> var editFlag = [[${@permission.hasPermi('inventoryHeader:inventoryTransaction:edit')}]]; var prefix = ctx + "inventory/inventoryTransaction"; - var inventoryStatus=[[${@dict.getType('inventoryStatus')}]]; + var inventoryStatus=[[${@dict.getType('inventorySts')}]]; var inventoryTransactionType = [[${@dict.getType('inventoryTransactionType')}]]; $(function() { $("#bootstrap-table").bootstrapTable({ diff --git a/src/main/resources/templates/monitor/locationstatus/locationstatus.html b/src/main/resources/templates/monitor/locationstatus/locationstatus.html index 9fff35b..00b3678 100644 --- a/src/main/resources/templates/monitor/locationstatus/locationstatus.html +++ b/src/main/resources/templates/monitor/locationstatus/locationstatus.html @@ -51,7 +51,7 @@ <ul id="select_info"> <li> <select id="locationType" name="locationType" style="width: 100px"> - <option value="L" selected>立库库位</option> + <option value="LK" selected>立库库位</option> <option value="Q">钱柜库位</option> <option value="DM">地面库位</option> </select> @@ -140,7 +140,7 @@ </div> <div th:include="include :: footer"></div> <script th:inline="javascript"> - var prefix = ctx + "general/location"; + var prefix = ctx + "config/location"; var grid_row; var grid_line; var grid_layer; @@ -159,7 +159,7 @@ var grid_all_lock="../img/icon/整盘锁定.png"; var rel_empty="../img/icon/空.png"; $(function() { - resetAjax("L"); + resetAjax("LK"); //库位类型和行列层选择 $("#editable-select").change(function () { @@ -181,6 +181,7 @@ } } }); + $("#locationType").change(function () { let type=$("#locationType").val(); resetAjax(type); @@ -266,7 +267,7 @@ layers=parseInt(layers); if (list_info) { for (let i = 0; i < list_info.length; i++) { - if (list_info[i].row === row && list_info[i].line === line && list_info[i].layer === layers) { + if (list_info[i].irow === row && list_info[i].icolumn === line && list_info[i].ilayer === layers) { let str_info=''; let container_code=''; if (list_info[i].containerCode) { @@ -352,7 +353,7 @@ if (res.code===200||res.data||res.msg==="成功") { if (x === "row") { for (let i = 0; i < res.data.length; i++) { - let index=res.data[i].line+((res.data[i].layer-1)*grid_line); + let index=res.data[i].icolumn+((res.data[i].ilayer-1)*grid_line); index=index-1; resShow(res,index,i); } @@ -361,7 +362,7 @@ } else if (x === "line") { for (let i = 0; i < res.data.length; i++) { - let index=res.data[i].row+((res.data[i].layer-1)*grid_row); + let index=res.data[i].iow+((res.data[i].ilayer-1)*grid_row); index=index-1; resShow(res,index,i); } @@ -370,7 +371,7 @@ } else if (x === "layer") { for (let i = 0; i < res.data.length; i++) { - let index=res.data[i].line+((res.data[i].row-1)*grid_line); + let index=res.data[i].icolumn+((res.data[i].irow-1)*grid_line); index=index-1; resShow(res,index,i); } @@ -396,6 +397,7 @@ //库位请求的结果显示 function resShow(res, index ,i) { if (res.data[i].deleted === false) { + console.log(res.data[i].userDef3); if (res.data[i].userDef3 === "1") { $(".grid").eq(index).attr({"src": grid_rest, "isTrue": 1}); } else if (res.data[i].userDef3 === "2") { @@ -448,7 +450,7 @@ layers=parseInt(layers); if (list_info) {//缓存查询 for (let i = 0; i < list_info.length; i++) { - if (list_info[i].row === row && list_info[i].line === line && list_info[i].layer === layers) { + if (list_info[i].irow === row && list_info[i].icolumn === line && list_info[i].ilayer === layers) { if (list_info[i].materialName) { $("#material").children().remove(); for (let j = 0; j < list_info[i].materialName.length; j++) { diff --git a/src/main/resources/templates/receipt/receiptDetail/add.html b/src/main/resources/templates/receipt/receiptDetail/add.html index f9f9e32..a25975c 100644 --- a/src/main/resources/templates/receipt/receiptDetail/add.html +++ b/src/main/resources/templates/receipt/receiptDetail/add.html @@ -52,7 +52,10 @@ <div class="form-group"> <label class="col-sm-3 control-label">是否质检:</label> <div class="col-sm-8"> - <input id="qcCheck" name="qcCheck" class="form-control" type="text"> + <select id="qcCheck" name="qcCheck" class="form-control"> + <option value="1">否</option> + <option value="0">是</option> + </select> </div> </div> <div class="form-group"> @@ -70,7 +73,7 @@ <div class="form-group"> <label class="col-sm-3 control-label">库存状态:</label> <div class="col-sm-8"> - <select id="inventorySts" name="inventorySts" class="form-control" th:with="inventoryStatus=${@dict.getType('inventoryStatus')}"> + <select id="inventorySts" name="inventorySts" class="form-control" th:with="inventoryStatus=${@dict.getType('inventorySts')}"> <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> </select> </div> @@ -84,12 +87,21 @@ <div class="form-group"> <label class="col-sm-3 control-label">定位规则:</label> <div class="col-sm-8"> - <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('入库')}"> + <select id="locatingRule" name="locatingRule" class="form-control" th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locationRule')}"> <option value="">请选择</option> <option th:each="item : ${list}" th:text="${item['description']}" th:value="${item['code']}"></option> </select> </div> </div> + <div class="form-group"> + <label class="col-sm-3 control-label">入库流程:</label> + <div class="col-sm-8"> + <select id="statusFlowCode" name="statusFlowCode" class="form-control" th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}"> + <option value="">请选择</option> + <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> + </select> + </div> + </div> <!-- <div class="form-group">--> <!-- <label class="col-sm-3 control-label">标价:</label>--> <!-- <div class="col-sm-8">--> @@ -150,6 +162,7 @@ submitHandler: function(form) { var tableValue = $("#form-receiptDetail-add").serialize(); tableValue = formValueReplace(tableValue, "inventorySts", $("#inventorySts option:selected").val()); + tableValue = formValueReplace(tableValue, "qcCheck", $("#qcCheck option:selected").val()); $.operate.save(prefix + "/add", tableValue); } }); diff --git a/src/main/resources/templates/receipt/receiptDetail/edit.html b/src/main/resources/templates/receipt/receiptDetail/edit.html index eb16d9a..a7d31fc 100644 --- a/src/main/resources/templates/receipt/receiptDetail/edit.html +++ b/src/main/resources/templates/receipt/receiptDetail/edit.html @@ -53,7 +53,10 @@ <div class="form-group"> <label class="col-sm-3 control-label">是否质检:</label> <div class="col-sm-8"> - <input id="qcCheck" name="qcCheck" class="form-control" type="text" th:field="*{qcCheck}"> + <select id="qcCheck" name="qcCheck" class="form-control" th:field="*{qcCheck}"> + <option value="1">否</option> + <option value="0">是</option> + </select> </div> </div> <div class="form-group"> @@ -72,7 +75,7 @@ <label class="col-sm-3 control-label">库存状态:</label> <div class="col-sm-8"> <select id="inventorySts" name="inventorySts" class="form-control" - th:with="inventoryStatus=${@dict.getType('inventoryStatus')}" th:field="*{inventorySts}"> + th:with="inventoryStatus=${@dict.getType('inventorySts')}" th:field="*{inventorySts}"> <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> </select> </div> @@ -86,7 +89,11 @@ <div class="form-group"> <label class="col-sm-3 control-label">定位规则:</label> <div class="col-sm-8"> - <input id="locatingRule" name="locatingRule" class="form-control" type="text" th:field="*{locatingRule}"> + <select id="locatingRule" name="locatingRule" class="form-control" + th:with="list=${@FilterConfigDetailService.queryFilterConfigDetail('locationRule')}" th:field="*{locatingRule}"> + <option value="">请选择</option> + <option th:each="item : ${list}" th:text="${item['description']}" th:value="${item['code']}"></option> + </select> </div> </div> <div class="form-group"> @@ -101,6 +108,16 @@ <input id="itemNetPrice" name="itemNetPrice" class="form-control" type="text" th:field="*{itemNetPrice}"> </div> </div> + <div class="form-group"> + <label class="col-sm-3 control-label">入库流程:</label> + <div class="col-sm-8"> + <select id="statusFlowCode" name="statusFlowCode" class="form-control" + th:with="statusFlowList=${@StatusFlow.flowList('receivingFlow')}" th:field="*{statusFlowCode}"> + <option value="">请选择</option> + <option th:each="flow : ${statusFlowList}" th:text="${flow['name']}" th:value="${flow['code']}"></option> + </select> + </div> + </div> <!--<div class="form-group">--> <!--<label class="col-sm-3 control-label">自定义字段1:</label>--> <!--<div class="col-sm-8">--> diff --git a/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html b/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html index e19105f..e583e89 100644 --- a/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html +++ b/src/main/resources/templates/receipt/receiptHeader/receiptHeader.html @@ -82,12 +82,15 @@ <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="receipt:receiptHeader:add"> <i class="fa fa-plus"></i> 新增 </a> - <a class="btn btn-outline btn-default btn-rounded" onclick="submitReview()" shiro:hasPermission="receipt:receiptHeader:add"> + <a class="btn btn-outline btn-default btn-rounded" onclick="submitReview()" shiro:hasPermission="receipt:receiptHeader:approval"> <i class="fa fa-fighter-jet"></i> 提交审核 </a> - <a class="btn btn-outline btn-primary btn-rounded" onclick="approval()" shiro:hasPermission="receipt:receiptHeader:add"> + <a class="btn btn-outline btn-primary btn-rounded" onclick="approval()" shiro:hasPermission="receipt:receiptHeader:review"> <i class="fa fa-level-up"></i> 审核通过 </a> + <a class="btn btn-outline btn-primary btn-rounded" onclick="addPool()" shiro:hasPermission="receipt:receiptHeader:addPool"> + <i class="fa fa-check-circle"></i> 加入订单池 + </a> <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="receipt:receiptHeader:remove"> <i class="fa fa-trash-o"></i> 删除 </a> @@ -389,7 +392,7 @@ actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="arrival(\'' + row.id + '\')" ><i class="fa fa-edit"></i>入库预约</a> '); } if (row.firstStatus ==150 || row.lastStatus == 150 ){ - actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')" ><i class="fa fa-edit"></i>到货通知</a> '); + actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="arrivalNotice(\'' + row.id + '\')" ><i class="fa fa-edit"></i>到货通知</a> '); } if (row.firstStatus ==180 || row.lastStatus == 180 ){ actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="check(\'' + row.id + '\')" ><i class="fa fa-edit"></i>质检</a> '); @@ -474,7 +477,17 @@ }, { field : 'qcCheck', - title : '是否质检' + title : '是否质检', + align : "center", + formatter: function(value, row, index) { + var actions = []; + if (value == 0) { + actions.push("<span class='badge badge-info'>是</span>"); + } else { + actions.push("<span class='badge badge-info'>否</span>"); + } + return actions.join(''); + } }, { field : 'projectNo', @@ -541,8 +554,13 @@ visible:false }, { + field : 'statusFlowCode', + title : '流程编码' + }, + { field : 'isVirtualBom', title : '是否虚拟套件', + align : "center", formatter: function(value, row, index) { return $.table.selectDictLabel(isVirtualBoms, value); } @@ -813,6 +831,21 @@ var data = { "id": id }; $.operate.submit(url, "post", "json", data); } + + function addPool() { + var rows=$("#bootstrap-table").bootstrapTable('getSelections'); + if (rows.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + var url = prefix+"/addPool"; + var ids = ""; + for(var i=0; i<rows.length; i++) { + ids = ids + rows[i].id + "," + } + var data = { "ids": ids.substring(0, ids.length-1),"approval": 100 }; + $.operate.submit(url, "post", "json", data); + } </script> </body> </html> \ No newline at end of file diff --git a/src/main/resources/templates/receipt/receiving/add.html b/src/main/resources/templates/receipt/receiving/add.html index bf1dd02..122b86b 100644 --- a/src/main/resources/templates/receipt/receiving/add.html +++ b/src/main/resources/templates/receipt/receiving/add.html @@ -140,6 +140,7 @@ $("input[name='openQty']").val(urlParms.openQty); $("input[name='inventorySts']").val(urlParms.inventorySts); $("input[name='materialUnit']").val(urlParms.materialUnit); + $("input[name='qty']").val(urlParms.totalQty-urlParms.openQty); $("input[name='qty']").focus(); diff --git a/src/main/resources/templates/shipment/shipmentDetail/add.html b/src/main/resources/templates/shipment/shipmentDetail/add.html index 56b9112..92abad4 100644 --- a/src/main/resources/templates/shipment/shipmentDetail/add.html +++ b/src/main/resources/templates/shipment/shipmentDetail/add.html @@ -19,12 +19,6 @@ <input id="shipmentCode" name="shipmentCode" class="form-control" type="text" th:value="${shipmentCode}" readonly="readonly"> </div> </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上游系统行号:</label> - <div class="col-sm-8"> - <input id="referLineNum" name="referLineNum" class="form-control" type="text" onkeyup=" this.value=this.value.replace(/^\s+|\s+$/g,'')"> - </div> - </div> <div class="form-group"> <label class="col-sm-3 control-label">存货编码:</label> <div class="col-sm-8"> @@ -32,6 +26,44 @@ </div> </div> <div class="form-group"> + <label class="col-sm-3 control-label">库存状态:</label> + <div class="col-sm-8"> + <select id="inventoryStatus" class="form-control" th:with="inventoryStatus=${@dict.getType('inventorySts')}"> + <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> + </select> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">发货数量:</label> + <div class="col-sm-8"> + <input id="shipQty" name="shipQty" class="form-control" type="text" onkeyup=" this.value=this.value.replace(/^\s+|\s+$/g,'')"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">批次:</label> + <div class="col-sm-8"> + <input id="batch" name="batch" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">批号:</label> + <div class="col-sm-8"> + <input id="lot" name="lot" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">项目号:</label> + <div class="col-sm-8"> + <input id="projectNo" name="project" class="form-control" type="text"> + </div> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">上游系统行号:</label> + <div class="col-sm-8"> + <input id="referLineNum" name="referLineNum" class="form-control" type="text" onkeyup=" this.value=this.value.replace(/^\s+|\s+$/g,'')"> + </div> + </div> + <div class="form-group"> <label class="col-sm-3 control-label">分配规则:</label> <div class="col-sm-8"> <select id="allocationRule" class="form-control" th:with="allocationRule=${@FilterConfigDetailService.queryFilterConfigDetail('出库')}"> @@ -59,23 +91,6 @@ </div> </div> <div class="form-group"> - <label class="col-sm-3 control-label">批次:</label> - <div class="col-sm-8"> - <input id="batch" name="batch" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">批号:</label> - <div class="col-sm-8"> - <input id="lot" name="lot" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">项目号:</label> - <div class="col-sm-8"> - <input id="projectNo" name="project" class="form-control" type="text"> - </div> - </div> <div class="form-group"> <label class="col-sm-3 control-label">生产日期:</label> <div class="col-sm-8"> @@ -88,20 +103,6 @@ <input id="expirationDate" name="expirationDate" class="form-control" type="text"> </div> </div> - <div class="form-group"> - <label class="col-sm-3 control-label">库存状态:</label> - <div class="col-sm-8"> - <select id="inventoryStatus" class="form-control" th:with="inventoryStatus=${@dict.getType('inventoryStatus')}"> - <option th:each="dict : ${inventoryStatus}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option> - </select> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">发货数量:</label> - <div class="col-sm-8"> - <input id="shipQty" name="shipQty" class="form-control" type="text" onkeyup=" this.value=this.value.replace(/^\s+|\s+$/g,'')"> - </div> - </div> <div class="form-group"> <div class="form-control-static col-sm-offset-9"> <button type="submit" class="btn btn-primary">提交</button> diff --git a/src/main/resources/templates/shipment/shipmentHeader/add.html b/src/main/resources/templates/shipment/shipmentHeader/add.html index 8fbc41d..86b711a 100644 --- a/src/main/resources/templates/shipment/shipmentHeader/add.html +++ b/src/main/resources/templates/shipment/shipmentHeader/add.html @@ -48,18 +48,6 @@ <input id="priority" name="priority" class="form-control" type="text"> </div> </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总数量:</label> - <div class="col-sm-8"> - <input id="totalQty" name="totalQty" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总行数:</label> - <div class="col-sm-8"> - <input id="totalLines" name="totalLines" class="form-control" type="text"> - </div> - </div> <div class="form-group"> <label class="col-sm-3 control-label">要求到货时间:</label> <div class="col-sm-8"> @@ -119,14 +107,7 @@ // required:true, // digits:true, // }, - totalQty:{ - required:false, - digits:true, - }, - totalLines:{ - required:false, - digits:true, - }, + }, submitHandler: function(form) { $.ajax({ @@ -140,8 +121,6 @@ "referPlatform": $("input[name='referPlatform']").val(), "customerCode": $("input[name='customerCode']").val(), "priority": $("input[name='priority']").val(), - "totalQty": $("input[name='totalQty']").val(), - "totalLines": $("input[name='totalLines']").val(), "requestedDeliveryDate": $("input[name='requestedDeliveryDate']").val(), }, async: false, @@ -158,7 +137,7 @@ $(function () { layui.use('laydate', function() { var laydate = layui.laydate; - laydate.render({ elem: '#appointmentTime',min: 0, theme: 'molv' ,type: 'datetime'}); + laydate.render({ elem: '#requestedDeliveryDate', theme: 'molv', format: 'yyyy-MM-dd HH:mm:ss' }); }); }) </script> diff --git a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html index d440942..a93bde4 100644 --- a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html +++ b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html @@ -175,9 +175,6 @@ <a class="btn btn-outline btn-danger btn-rounded" onclick="batRemove()" shiro:hasPermission="shipment:bill:remove"> <i class="fa fa-trash-o"></i> 删除 </a> - <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.edit(shipmentId)" shiro:hasPermission="shipment:bill:edit"> - <i class="fa fa-edit"></i> 编辑主单据 - </a> <a class="btn btn-outline btn-default btn-rounded" onclick="loadDetail()"> <i class="fa fa-refresh"></i> 刷新 </a> @@ -338,9 +335,6 @@ if (row.firstStatus < 100){ actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); } - if (row.firstStatus < 120){ - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); - } return actions.join(''); } }] @@ -475,7 +469,6 @@ formatter: function (value, row, index) { var actions = []; actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); return actions.join(''); } }] diff --git a/src/main/resources/templates/shipment/shipmentHeaderHistory/add.html b/src/main/resources/templates/shipment/shipmentHeaderHistory/add.html deleted file mode 100644 index c8ee289..0000000 --- a/src/main/resources/templates/shipment/shipmentHeaderHistory/add.html +++ /dev/null @@ -1,205 +0,0 @@ -<!DOCTYPE HTML> -<html lang="zh" xmlns:th="http://www.thymeleaf.org"> -<meta charset="utf-8"> -<head th:include="include :: header"></head> -<body class="white-bg"> - <div class="wrapper wrapper-content animated fadeInRight ibox-content"> - <form class="form-horizontal m" id="form-shipmentHeaderHistory-add"> - <div class="form-group"> - <label class="col-sm-3 control-label">出库单编码:</label> - <div class="col-sm-8"> - <input id="code" name="code" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">仓库id:</label> - <div class="col-sm-8"> - <input id="warehouseId" name="warehouseId" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">仓库编码:</label> - <div class="col-sm-8"> - <input id="warehouseCode" name="warehouseCode" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">货主id:</label> - <div class="col-sm-8"> - <input id="companyId" name="companyId" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">货主编码:</label> - <div class="col-sm-8"> - <input id="companyCode" name="companyCode" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上游系统单号:</label> - <div class="col-sm-8"> - <input id="sourceCode" name="sourceCode" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上游平台:</label> - <div class="col-sm-8"> - <input id="sourcePlatform" name="sourcePlatform" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">出库单类型:</label> - <div class="col-sm-8"> - <input id="type" name="type" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">客户编码:</label> - <div class="col-sm-8"> - <input id="shipTo" name="shipTo" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">优先级:</label> - <div class="col-sm-8"> - <input id="priority" name="priority" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">发货站台:</label> - <div class="col-sm-8"> - <input id="station" name="station" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总数量:</label> - <div class="col-sm-8"> - <input id="totalQty" name="totalQty" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总行数:</label> - <div class="col-sm-8"> - <input id="totalLines" name="totalLines" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">备注:</label> - <div class="col-sm-8"> - <input id="remark" name="remark" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传备注:</label> - <div class="col-sm-8"> - <input id="uploadremark" name="uploadremark" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传时间:</label> - <div class="col-sm-8"> - <input id="uploadTime" name="uploadTime" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">发货预约时间:</label> - <div class="col-sm-8"> - <input id="appointmentTime" name="appointmentTime" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">单据头状态:</label> - <div class="col-sm-8"> - <input id="firstStatus" name="firstStatus" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">单据尾状态:</label> - <div class="col-sm-8"> - <input id="lastStatus" name="lastStatus" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传状态:</label> - <div class="col-sm-8"> - <input id="uploadStatus" name="uploadStatus" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">创建时间:</label> - <div class="col-sm-8"> - <input id="created" name="created" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">创建用户:</label> - <div class="col-sm-8"> - <input id="createdBy" name="createdBy" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">最后修改时间:</label> - <div class="col-sm-8"> - <input id="lastUpdated" name="lastUpdated" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">更新用户:</label> - <div class="col-sm-8"> - <input id="lastUpdatedBy" name="lastUpdatedBy" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">是否有效:</label> - <div class="col-sm-8"> - <input id="enable" name="enable" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">是否删除:</label> - <div class="col-sm-8"> - <input id="deleted" name="deleted" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段1:</label> - <div class="col-sm-8"> - <input id="userDef1" name="userDef1" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段2:</label> - <div class="col-sm-8"> - <input id="userDef2" name="userDef2" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段3:</label> - <div class="col-sm-8"> - <input id="userDef3" name="userDef3" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <div class="form-control-static col-sm-offset-9"> - <button type="submit" class="btn btn-primary">提交</button> - <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> - </div> - </div> - </form> - </div> - <div th:include="include::footer"></div> - <script type="text/javascript"> - var prefix = ctx + "shipment/shipmentHeaderHistory" - $("#form-shipmentHeaderHistory-add").validate({ - rules:{ - xxxx:{ - required:true, - }, - }, - submitHandler: function(form) { - $.operate.save(prefix + "/add", $('#form-shipmentHeaderHistory-add').serialize()); - } - }); - </script> -</body> -</html> diff --git a/src/main/resources/templates/shipment/shipmentHeaderHistory/edit.html b/src/main/resources/templates/shipment/shipmentHeaderHistory/edit.html deleted file mode 100644 index 06bbba6..0000000 --- a/src/main/resources/templates/shipment/shipmentHeaderHistory/edit.html +++ /dev/null @@ -1,206 +0,0 @@ -<!DOCTYPE HTML> -<html lang="zh" xmlns:th="http://www.thymeleaf.org"> -<meta charset="utf-8"> -<head th:include="include :: header"></head> -<body class="white-bg"> - <div class="wrapper wrapper-content animated fadeInRight ibox-content"> - <form class="form-horizontal m" id="form-shipmentHeaderHistory-edit" th:object="${shipmentHeaderHistory}"> - <input id="id" name="id" th:field="*{id}" type="hidden"> - <div class="form-group"> - <label class="col-sm-3 control-label">出库单编码:</label> - <div class="col-sm-8"> - <input id="code" name="code" th:field="*{code}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">仓库id:</label> - <div class="col-sm-8"> - <input id="warehouseId" name="warehouseId" th:field="*{warehouseId}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">仓库编码:</label> - <div class="col-sm-8"> - <input id="warehouseCode" name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">货主id:</label> - <div class="col-sm-8"> - <input id="companyId" name="companyId" th:field="*{companyId}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">货主编码:</label> - <div class="col-sm-8"> - <input id="companyCode" name="companyCode" th:field="*{companyCode}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上游系统单号:</label> - <div class="col-sm-8"> - <input id="sourceCode" name="sourceCode" th:field="*{sourceCode}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上游平台:</label> - <div class="col-sm-8"> - <input id="sourcePlatform" name="sourcePlatform" th:field="*{sourcePlatform}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">出库单类型:</label> - <div class="col-sm-8"> - <input id="type" name="type" th:field="*{type}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">客户编码:</label> - <div class="col-sm-8"> - <input id="shipTo" name="shipTo" th:field="*{shipTo}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">优先级:</label> - <div class="col-sm-8"> - <input id="priority" name="priority" th:field="*{priority}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">发货站台:</label> - <div class="col-sm-8"> - <input id="station" name="station" th:field="*{station}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总数量:</label> - <div class="col-sm-8"> - <input id="totalQty" name="totalQty" th:field="*{totalQty}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">总行数:</label> - <div class="col-sm-8"> - <input id="totalLines" name="totalLines" th:field="*{totalLines}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">备注:</label> - <div class="col-sm-8"> - <input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传备注:</label> - <div class="col-sm-8"> - <input id="uploadremark" name="uploadremark" th:field="*{uploadremark}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传时间:</label> - <div class="col-sm-8"> - <input id="uploadTime" name="uploadTime" th:field="*{uploadTime}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">发货预约时间:</label> - <div class="col-sm-8"> - <input id="appointmentTime" name="appointmentTime" th:field="*{appointmentTime}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">单据头状态:</label> - <div class="col-sm-8"> - <input id="firstStatus" name="firstStatus" th:field="*{firstStatus}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">单据尾状态:</label> - <div class="col-sm-8"> - <input id="lastStatus" name="lastStatus" th:field="*{lastStatus}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">上传状态:</label> - <div class="col-sm-8"> - <input id="uploadStatus" name="uploadStatus" th:field="*{uploadStatus}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">创建时间:</label> - <div class="col-sm-8"> - <input id="created" name="created" th:field="*{created}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">创建用户:</label> - <div class="col-sm-8"> - <input id="createdBy" name="createdBy" th:field="*{createdBy}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">最后修改时间:</label> - <div class="col-sm-8"> - <input id="lastUpdated" name="lastUpdated" th:field="*{lastUpdated}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">更新用户:</label> - <div class="col-sm-8"> - <input id="lastUpdatedBy" name="lastUpdatedBy" th:field="*{lastUpdatedBy}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">是否有效:</label> - <div class="col-sm-8"> - <input id="enable" name="enable" th:field="*{enable}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">是否删除:</label> - <div class="col-sm-8"> - <input id="deleted" name="deleted" th:field="*{deleted}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段1:</label> - <div class="col-sm-8"> - <input id="userDef1" name="userDef1" th:field="*{userDef1}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段2:</label> - <div class="col-sm-8"> - <input id="userDef2" name="userDef2" th:field="*{userDef2}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <label class="col-sm-3 control-label">自定义字段3:</label> - <div class="col-sm-8"> - <input id="userDef3" name="userDef3" th:field="*{userDef3}" class="form-control" type="text"> - </div> - </div> - <div class="form-group"> - <div class="form-control-static col-sm-offset-9"> - <button type="submit" class="btn btn-primary">提交</button> - <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button> - </div> - </div> - </form> - </div> - <div th:include="include::footer"></div> - <script type="text/javascript"> - var prefix = ctx + "shipment/shipmentHeaderHistory" - $("#form-shipmentHeaderHistory-edit").validate({ - rules:{ - xxxx:{ - required:true, - }, - }, - submitHandler: function(form) { - $.operate.save(prefix + "/edit", $('#form-shipmentHeaderHistory-edit').serialize()); - } - }); - </script> -</body> -</html> diff --git a/src/main/resources/templates/shipment/shipmentHeaderHistory/shipmentHeaderHistory.html b/src/main/resources/templates/shipment/shipmentHeaderHistory/shipmentHeaderHistory.html index fc08b07..4e705a0 100644 --- a/src/main/resources/templates/shipment/shipmentHeaderHistory/shipmentHeaderHistory.html +++ b/src/main/resources/templates/shipment/shipmentHeaderHistory/shipmentHeaderHistory.html @@ -310,12 +310,6 @@ var actions = []; actions.push('<a id="table_edit" class="btn btn-success btn-xs ' + printFlag + '" href="#" onclick="receiptPrint(\'' + row.id + '\')"><i class="fa fa-print"></i>打印</a> '); // actions.push('<a class="btn btn-info btn-xs " href="#" onclick="detail(\'' + row.id + '\',\'' + row.code + '\')"><i class="fa fa-list-ul"></i>列表</a> '); - if (row.firstStatus < 100){ - actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); - } - if (row.firstStatus < 120){ - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); - } return actions.join(''); } }] @@ -449,8 +443,6 @@ align: 'center', formatter: function (value, row, index) { var actions = []; - actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); - actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); return actions.join(''); } }] diff --git a/src/main/resources/templates/shipment/wave/wave.html b/src/main/resources/templates/shipment/wave/wave.html index 2b4a993..de6ebcc 100644 --- a/src/main/resources/templates/shipment/wave/wave.html +++ b/src/main/resources/templates/shipment/wave/wave.html @@ -229,7 +229,7 @@ return v.id; }).join(',') }; - localSubmit(url, "post", "json", data); + $.operate.submit(url, "post", "json", data); } @@ -246,7 +246,7 @@ return v.id; }).join(',') }; - localSubmit(url, "post", "json", data); + $.operate.submit(url, "post", "json", data); } </script> </body> diff --git a/src/main/resources/templates/task/task/task.html b/src/main/resources/templates/task/task/task.html index f7922a6..6c03c39 100644 --- a/src/main/resources/templates/task/task/task.html +++ b/src/main/resources/templates/task/task/task.html @@ -260,8 +260,7 @@ }, { field : 'userDef1', - title : '自定义字段1' , - visible:false + title : '处理' , }, { field : 'userDef2', diff --git a/src/main/resources/templates/task/taskHeader/taskHeader.html b/src/main/resources/templates/task/taskHeader/taskHeader.html index c7cc364..abc1a5e 100644 --- a/src/main/resources/templates/task/taskHeader/taskHeader.html +++ b/src/main/resources/templates/task/taskHeader/taskHeader.html @@ -24,15 +24,18 @@ <form id="task-form"> <div class="select-list"> <ul> + <input type="hidden" th:value="${InternalTaskType}" name="InternalTaskType"> <li> 任务id:<input type="text" name="id"/> </li> <li> 容器编号:<input type="text" name="containerCode"/> </li> - + <li> + 源库位编号:<input type="text" name="fromLocation"/> + </li> <li> - 库位编号:<input type="text" name="toLocation"/> + 目的库位编号:<input type="text" name="toLocation"/> </li> <li class="time" style="height: 30px"> <label>创建时间: </label> @@ -146,7 +149,7 @@ sortOrder: "desc", search: false, clickToSelect:true, - queryParams:"InternalTaskType="+[[${InternalTaskType}]], + queryParams: queryParams, columns: [{ checkbox: true }, @@ -170,9 +173,15 @@ } }, + { + field : 'fromLocation', + title : '源库位号', + visible:true + }, + { field : 'toLocation', - title : '库位号', + title : '目的库位号', visible:true }, { @@ -180,6 +189,11 @@ title : '容器号' , sortable: true }, + { + field : 'exceptionCode', + title : '异常原因', + sortable: true + }, { field : 'startPickDateTime', @@ -270,11 +284,11 @@ }, { field : 'id', - title : '明细Id' + title : '明细ID' }, { field : 'taskId', - title : '任务Id', + title : '任务头ID', sortable: true }, { @@ -282,17 +296,23 @@ title : '单据编码', }, { + field : 'billDetailId', + title : '单据明细ID', + sortable: true, + visible:true, + }, + { field : 'materialCode', - title : '存货编码', - sortable: true + title : '物料编码', + }, { field : 'materialName', title : '物料名称', - sortable:true + }, { - field : 'project', + field : 'projectNo', title : '项目号', }, { @@ -482,15 +502,18 @@ $.operate.submit(url, "post", "json", data); }) } - - function emptyIn() { - $.modal.open("空托盘入库",prefix+"/emptyIn") - } - - function emptyOut() { - $.modal.open("空托盘出库",prefix+"/emptyOut") - } + function queryParams(params) { + return { + InternalTaskType: +[[${InternalTaskType}]], + // 传递参数查询参数 + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order + }; + }; </script> </body> </html> \ No newline at end of file diff --git a/src/test/java/com.huaheng.test/EncryptPassword.java b/src/test/java/com.huaheng.test/EncryptPassword.java index 6356d79..8e93b5e 100644 --- a/src/test/java/com.huaheng.test/EncryptPassword.java +++ b/src/test/java/com.huaheng.test/EncryptPassword.java @@ -2,11 +2,16 @@ package com.huaheng.test; import com.huaheng.framework.shiro.service.PasswordService; +import java.math.BigDecimal; + public class EncryptPassword { public static void main(String[] args) { - PasswordService passwordService = new PasswordService(); - String psw = passwordService.encryptPassword("superAdmin", "admin123", "3d82fd"); - System.out.println(psw); +// PasswordService passwordService = new PasswordService(); +// String psw = passwordService.encryptPassword("superAdmin", "admin123", "3d82fd"); +// System.out.println(psw); + BigDecimal sum = new BigDecimal(575); + BigDecimal max = new BigDecimal(400); + System.out.println(sum.compareTo(max)); } }