Commit 802620229c97ca2c38201d6cf4d3461ed6599c8c

Authored by 谭毅彬
2 parents 4c361247 cd3b19c0

Merge branch 'develop' of http://www.huahengrobot.com:90/wms/wms4.git into develop

ant-design-vue-jeecg/src/api/api.js
... ... @@ -139,6 +139,8 @@ export const execute = (params) => postAction('/task/taskHeader/execute', params
139 139 export const cancelTask = (params) => postAction('/task/taskHeader/cancelTask?ids=' + params, params);
140 140 //自动配盘
141 141 export const autoCombination = (params) => postAction('/shipment/shipmentCombination/autoCombination', params);
  142 +//自动出库
  143 +export const autoShipment = (params) => postAction('/shipment/shipmentHeader/autoShipment', params);
142 144 //创建出库任务
143 145 export const createShipmentTask = (params) => postAction('/shipment/shipmentCombination/createShipmentTask', params);
144 146 //批量创建出库任务
... ...
ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
... ... @@ -196,6 +196,8 @@
196 196 </a-popconfirm>
197 197 <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus <= 200))
198 198 || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button> <a-divider type="vertical"/></a>
  199 + <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800))
  200 + || (flowOff == '0' && record.lastStatus < 800)" @click="openAutoShipmentCombine(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">自动出库</a-button> <a-divider type="vertical"/></a>
199 201 <a-dropdown>
200 202 <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
201 203 <a-menu slot="overlay">
... ... @@ -223,8 +225,9 @@
223 225 </a-tabs>
224 226  
225 227 <shipmentHeader-modal ref="modalForm" @ok="modalFormOk"></shipmentHeader-modal>
226   - <shipment-audit-modal ref="auditForm"></shipment-audit-modal>
227   - <flow-process ref="porcessForm"></flow-process>
  228 + <shipment-audit-modal ref="auditForm" @ok="modalFormOk"></shipment-audit-modal>
  229 + <flow-process ref="porcessForm" @ok="modalFormOk"></flow-process>
  230 + <auto-shipment-select-modal ref="autoShipmentForm" @ok="modalFormOk"></auto-shipment-select-modal>
228 231 </a-card>
229 232 </template>
230 233  
... ... @@ -240,15 +243,17 @@ import {getCompanyList, backErpShipment} from &#39;@/api/api&#39;
240 243 import {getShipmentTypeList} from '@/api/api'
241 244 import {getCustomerList} from '@/api/api'
242 245 import {autoCombination} from '@/api/api'
243   -import {createShipmentAuditFlow, getDocumentAduitFlow, mergeShipment} from '@/api/api'
  246 +import {createShipmentAuditFlow, getDocumentAduitFlow, mergeShipment, autoShipment} from '@/api/api'
244 247 import store from '@/store'
245 248 import ShipmentAuditModal from "./modules/ShipmentAuditModal";
246 249 import FlowProcess from "../flow/FlowProcess";
  250 +import AutoShipmentSelectModal from "@views/system/shipment/modules/AutoShipmentSelectModal";
247 251  
248 252 export default {
249 253 name: "ShipmentHeaderList",
250 254 mixins: [JeecgListMixin],
251 255 components: {
  256 + AutoShipmentSelectModal,
252 257 ShipmentAuditModal,
253 258 ShipmentDetailList,
254 259 ShipmentHeaderModal,
... ... @@ -557,6 +562,10 @@ export default {
557 562 })
558 563 return actions.join('')
559 564 },
  565 + openAutoShipmentCombine(record) {
  566 + this.$refs.autoShipmentForm.title = "自动出库";
  567 + this.$refs.autoShipmentForm.edit(record);
  568 + },
560 569 autoShipmentCombine(record) {
561 570 this.loading = true;
562 571 autoCombination(record).then((res) => {
... ... @@ -569,6 +578,18 @@ export default {
569 578 this.searchQuery();
570 579 });
571 580 },
  581 + autoShipment(record) {
  582 + this.loading = true;
  583 + autoShipment(record).then((res) => {
  584 + if (res.success) {
  585 + this.$message.success(res.message);
  586 + } else {
  587 + this.$message.warning(res.message)
  588 + }
  589 + this.loading = false;
  590 + this.searchQuery();
  591 + });
  592 + },
572 593 loadData(arg) {
573 594 if (!this.url.list) {
574 595 this.$message.error("请设置url.list属性!")
... ...
ant-design-vue-jeecg/src/views/system/shipment/modules/AutoShipmentSelectModal.vue 0 → 100644
  1 +<template>
  2 + <j-modal
  3 + :title="title"
  4 + :width="width"
  5 + :visible="visible"
  6 + :confirmLoading="confirmLoading"
  7 + switchFullscreen
  8 + @ok="handleOk"
  9 + @cancel="handleCancel"
  10 + cancelText="关闭">
  11 + <a-spin :spinning="confirmLoading">
  12 + <a-form-model ref="form" :model="model" :rules="validatorRules">
  13 + <a-row>
  14 + <a-col :span="24">
  15 + <a-col :span="24">
  16 + <a-form-model-item label="出库口" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toPort">
  17 + <a-input v-model="model.toPort" placeholder="请输入出库口" style="width: 100%"/>
  18 + </a-form-model-item>
  19 + </a-col>
  20 + </a-col>
  21 + </a-row>
  22 + </a-form-model>
  23 + </a-spin>
  24 + </j-modal>
  25 +</template>
  26 +
  27 +<script>
  28 +
  29 +import {httpAction} from '@/api/manage'
  30 +import {validateDuplicateValue} from '@/utils/util'
  31 +import {autoShipment} from '@/api/api'
  32 +import {selectSortingPort} from '@/api/api'
  33 +
  34 +export default {
  35 + name: "AutoShipmentSelectModal",
  36 + components: {},
  37 + props: {
  38 + mainId: {
  39 + type: String,
  40 + required: false,
  41 + default: ''
  42 + }
  43 + },
  44 + data() {
  45 + return {
  46 + portList: [],
  47 + flag:'0',
  48 + shipmentContainerHeaderList:[],
  49 + title: "操作",
  50 + width: 500,
  51 + visible: false,
  52 + model: {},
  53 + labelCol: {
  54 + xs: {span: 24},
  55 + sm: {span: 5},
  56 + },
  57 + wrapperCol: {
  58 + xs: {span: 24},
  59 + sm: {span: 16},
  60 + },
  61 +
  62 + confirmLoading: false,
  63 + validatorRules: {},
  64 + url: {
  65 + createTask: "/shipment/shipmentContainerHeader/createShipmentTask",
  66 + }
  67 +
  68 + }
  69 + },
  70 + created() {
  71 + //备份model原始值
  72 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  73 + },
  74 + methods: {
  75 + add() {
  76 + this.edit(this.modelDefault);
  77 + },
  78 + edit(record) {
  79 + this.model = Object.assign({}, record);
  80 + this.visible = true;
  81 + },
  82 + close() {
  83 + this.$emit('close');
  84 + this.visible = false;
  85 + this.$refs.form.clearValidate();
  86 + },
  87 + handleOk() {
  88 + const that = this;
  89 + this.confirmLoading = true;
  90 + autoShipment(this.model).then((res) => {
  91 + if (res.success) {
  92 + this.$message.success(res.message);
  93 + } else {
  94 + this.$message.warning(res.message)
  95 + }
  96 + this.confirmLoading = false;
  97 + that.close();
  98 + that.$emit('ok');
  99 + });
  100 + },
  101 + handleCancel() {
  102 + this.close()
  103 + },
  104 +
  105 + }
  106 +}
  107 +</script>
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java
... ... @@ -36,6 +36,8 @@ public interface IHuahengMultiHandlerService {
36 36  
37 37 Result autoCombination(String shipmentCode, String warehouseCode);
38 38  
  39 + Result autoShipment(String shipmentCode, String toPort, String warehouseCode);
  40 +
39 41 Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber);
40 42  
41 43 Result callBox(CallBoxBean bean, String warehouseCode);
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
... ... @@ -25,6 +25,7 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam;
25 25 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
26 26 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
27 27 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
  28 +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService;
28 29 import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
29 30 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
30 31 import org.springframework.scheduling.annotation.Async;
... ... @@ -49,6 +50,9 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem
49 50 private IShipmentCombinationService shipmentCombinationService;
50 51  
51 52 @Resource
  53 + private IShipmentHeaderService shipmentHeaderService;
  54 +
  55 + @Resource
52 56 private IShipmentDetailService shipmentDetailService;
53 57  
54 58 @Resource
... ... @@ -176,6 +180,18 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem
176 180 }
177 181  
178 182 @Override
  183 + public Result autoShipment(String shipmentCode, String toPort, String warehouseCode) {
  184 + Result result = handleMultiProcess("combination", new MultiProcessListener() {
  185 + @Override
  186 + public Result<?> doProcess() {
  187 + Result result = shipmentHeaderService.autoShipment(shipmentCode, toPort, warehouseCode);
  188 + return result;
  189 + }
  190 + });
  191 + return result;
  192 + }
  193 +
  194 + @Override
179 195 public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) {
180 196 Result result = handleMultiProcess("createShipmentTask", new MultiProcessListener() {
181 197 @Override
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
... ... @@ -398,4 +398,16 @@ public class ShipmentHeaderController extends JeecgController&lt;ShipmentHeader, IS
398 398 Result result = huahengMultiHandlerService.callBox(bean, warehouseCode);
399 399 return result;
400 400 }
  401 +
  402 + @AutoLog(value = "快速出库")
  403 + @ApiOperation(value = "快速出库", notes = "快速出库")
  404 + @PostMapping("/autoShipment")
  405 + @ResponseBody
  406 + public Result<TaskHeader> autoShipment(@RequestBody ShipmentHeader shipmentHeader, HttpServletRequest req) {
  407 + String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req);
  408 + String toPort = shipmentHeader.getToPort();
  409 + String shipmentCode = shipmentHeader.getCode();
  410 + Result result = huahengMultiHandlerService.autoShipment(shipmentCode, toPort, warehouseCode);
  411 + return result;
  412 + }
401 413 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/entity/ShipmentHeader.java
1 1 package org.jeecg.modules.wms.shipment.shipmentHeader.entity;
2 2  
3 3 import java.io.Serializable;
4   -import java.io.UnsupportedEncodingException;
5 4 import java.util.Date;
  5 +
  6 +import org.jeecg.common.aspect.annotation.Dict;
  7 +import org.jeecgframework.poi.excel.annotation.Excel;
  8 +
6 9 import com.baomidou.mybatisplus.annotation.IdType;
  10 +import com.baomidou.mybatisplus.annotation.TableField;
7 11 import com.baomidou.mybatisplus.annotation.TableId;
8 12 import com.baomidou.mybatisplus.annotation.TableName;
9   -import org.jeecgframework.poi.excel.annotation.Excel;
10   -import lombok.Data;
11   -import com.fasterxml.jackson.annotation.JsonFormat;
12   -import org.springframework.format.annotation.DateTimeFormat;
13   -import org.jeecg.common.aspect.annotation.Dict;
  13 +
14 14 import io.swagger.annotations.ApiModel;
15 15 import io.swagger.annotations.ApiModelProperty;
  16 +import lombok.Data;
16 17  
17 18 /**
18 19 * @Description: 出库单
... ... @@ -80,6 +81,9 @@ public class ShipmentHeader implements Serializable {
80 81 @Excel(name = "出库单备注", width = 15)
81 82 @ApiModelProperty(value = "出库单备注")
82 83 private String remark;
  84 + /** 出库口 */
  85 + @TableField(exist = false)
  86 + private String toPort;
83 87 /** 备用字段1 */
84 88 @Excel(name = "备用字段1", width = 15)
85 89 @ApiModelProperty(value = "备用字段1")
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java
... ... @@ -42,4 +42,6 @@ public interface IShipmentHeaderService extends IService&lt;ShipmentHeader&gt; {
42 42 boolean updateFirstStatusAndLastStatusById(Integer firstStatus, Integer lastStatus, int id);
43 43  
44 44 public Result<Object> mergeShipment(List<ShipmentHeader> shipmentHeaderList);
  45 +
  46 + Result autoShipment(String shipmentCode, String toPort, String warehouseCode);
45 47 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
... ... @@ -15,10 +15,17 @@ import org.jeecg.common.exception.JeecgBootException;
15 15 import org.jeecg.modules.wms.config.container.service.IContainerService;
16 16 import org.jeecg.modules.wms.config.location.service.ILocationService;
17 17 import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService;
  18 +import org.jeecg.modules.wms.config.port.entity.Port;
  19 +import org.jeecg.modules.wms.config.port.service.IPortService;
18 20 import org.jeecg.modules.wms.config.shipmentType.entity.ShipmentType;
19 21 import org.jeecg.modules.wms.config.shipmentType.service.IShipmentTypeService;
  22 +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService;
20 23 import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService;
  24 +import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService;
  25 +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail;
  26 +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader;
21 27 import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService;
  28 +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService;
22 29 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail;
23 30 import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader;
24 31 import org.jeecg.modules.wms.shipment.shipmentHeader.mapper.ShipmentDetailMapper;
... ... @@ -26,6 +33,7 @@ import org.jeecg.modules.wms.shipment.shipmentHeader.mapper.ShipmentHeaderMapper
26 33 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService;
27 34 import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService;
28 35 import org.jeecg.modules.wms.shipment.shipmentHeaderHistory.service.IShipmentHeaderHistoryService;
  36 +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader;
29 37 import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService;
30 38 import org.jeecg.utils.StringUtils;
31 39 import org.jeecg.utils.constant.QuantityConstant;
... ... @@ -86,6 +94,14 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl&lt;ShipmentHeaderMapper,
86 94  
87 95 @Resource
88 96 private IShipmentHeaderHistoryService shipmentHeaderHistoryService;
  97 + @Resource
  98 + private IShipmentCombinationService shipmentCombinationService;
  99 + @Resource
  100 + private IShipmentContainerHeaderService shipmentContainerHeaderService;
  101 + @Resource
  102 + private IHuahengMultiHandlerService huahengMultiHandlerService;
  103 + @Resource
  104 + private IPortService portService;
89 105  
90 106 @Override
91 107 @Transactional
... ... @@ -329,4 +345,74 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl&lt;ShipmentHeaderMapper,
329 345 }
330 346 return Result.OK("合并成功");
331 347 }
  348 +
  349 + @Override
  350 + @Transactional(rollbackFor = JeecgBootException.class)
  351 + public Result autoShipment(String shipmentCode, String toPort, String warehouseCode) {
  352 + if (StringUtils.isEmpty(shipmentCode)) {
  353 + return Result.error("自动出库, 出库单编码为空");
  354 + }
  355 + if (StringUtils.isEmpty(toPort)) {
  356 + return Result.error("自动出库, 出库口为空");
  357 + }
  358 + if (StringUtils.isEmpty(warehouseCode)) {
  359 + return Result.error("自动出库, 仓库编码为空");
  360 + }
  361 + Port port = portService.getPortByCode(toPort, warehouseCode);
  362 + if (port == null) {
  363 + return Result.error("自动出库, 出库口为空");
  364 + }
  365 + int type = Integer.parseInt(port.getType());
  366 + if (type == QuantityConstant.PORT_TYPE_IN) {
  367 + return Result.error("自动出库, 不能选择入库口来出库");
  368 + }
  369 + Result result = shipmentCombinationService.autoCombination(shipmentCode, warehouseCode);
  370 + if (!result.isSuccess()) {
  371 + throw new JeecgBootException("自动出库," + result.getMessage());
  372 + }
  373 + List<ShipmentContainerDetail> shipmentContainerDetailList = shipmentContainerDetailService.getShipmentContainerDetailListByShipmentCode(shipmentCode);
  374 + if (shipmentContainerDetailList == null) {
  375 + throw new JeecgBootException("自动出库, 没有找到出库配盘详情");
  376 + }
  377 + List<Integer> shipmentContainerIdList =
  378 + shipmentContainerDetailList.stream().map(ShipmentContainerDetail::getShipmentContainerId).distinct().collect(Collectors.toList());
  379 + long shipmentOrder = System.currentTimeMillis();
  380 + int sequenceNumber = shipmentContainerIdList.size();
  381 + int sequence = 0;
  382 + for (int shipmentContainerId : shipmentContainerIdList) {
  383 + sequence++;
  384 + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerId);
  385 + if (shipmentContainerHeader == null) {
  386 + throw new JeecgBootException("自动出库, 没有找到出库表头:" + shipmentContainerId);
  387 + }
  388 + shipmentContainerHeader.setToPort(toPort);
  389 + boolean success = shipmentContainerHeaderService.updateById(shipmentContainerHeader);
  390 + if (!success) {
  391 + throw new JeecgBootException("自动出库, 更新出库组盘头失败");
  392 + }
  393 + result = huahengMultiHandlerService.createShipmentTask(shipmentContainerHeader, warehouseCode, shipmentOrder, sequence, sequenceNumber);
  394 + if (!result.isSuccess()) {
  395 + throw new JeecgBootException("自动出库, " + result.getMessage());
  396 + }
  397 + String containerCode = shipmentContainerHeader.getContainerCode();
  398 + if (StringUtils.isEmpty(containerCode)) {
  399 + throw new JeecgBootException("自动出库, 容器号为空");
  400 + }
  401 + TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(containerCode, warehouseCode);
  402 + if (taskHeader == null) {
  403 + throw new JeecgBootException("自动出库, 没有找到容器号对应任务" + containerCode);
  404 + }
  405 + if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) {
  406 + if (type != QuantityConstant.PORT_TYPE_OUT) {
  407 + throw new JeecgBootException("自动出库, 出库口和整出任务不匹配" + toPort);
  408 + }
  409 + }
  410 + if (taskHeader.getTaskType() == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) {
  411 + if (type != QuantityConstant.PORT_TYPE_PICK) {
  412 + throw new JeecgBootException("自动出库, 出库口和分拣任务不匹配" + toPort);
  413 + }
  414 + }
  415 + }
  416 + return Result.OK("自动出库成功");
  417 + }
332 418 }
... ...
huaheng-wms-core/src/main/resources/application-dev.yml
... ... @@ -138,7 +138,7 @@ spring:
138 138 master:
139 139 url: jdbc:log4jdbc:mysql://localhost:3306/wms4?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
140 140 username: root
141   - password: 123456
  141 + password: HHsoft123.
142 142 driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
143 143 # sqlserver 数据源配置
144 144 # url: jdbc:sqlserver://172.16.29.88:1433;DatabaseName=wms4;encrypt=false;SelectMethod=cursor;
... ... @@ -161,7 +161,7 @@ spring:
161 161 database: 0
162 162 host: 127.0.0.1
163 163 port: 6379
164   - password:
  164 + password: 123456
165 165 timeout: 5000 #超时时间ms
166 166 lettuce:
167 167 pool:
... ... @@ -283,7 +283,7 @@ jeecg:
283 283 #分布式锁配置
284 284 redisson:
285 285 address: 127.0.0.1:6379
286   - password:
  286 + password: 123456
287 287 type: STANDALONE
288 288 enabled: true
289 289 #cas单点登录
... ...