Commit 0e1e4b7bdeb902dd0a8c42ad6d57a43d1068801a

Authored by 肖超群
1 parent a9bce149

增加指定库位功能

ant-design-vue-jeecg/src/api/api.js
... ... @@ -324,6 +324,8 @@ export const flatOnShell = (params) => postAction("/receipt/receiveHeader/flatOn
324 324 export const queryInventoryDetailListByMainIds = (params) => postAction("/inventory/inventoryDetail/getInventoryDetailListByInventoryDetailIds", params);
325 325 //根据出库单头ID查询出库单详情
326 326 export const getInventoryByShipmentDetail = (params) => postAction('/shipment/shipmentHeader/getInventoryByShipmentDetail', params);
  327 +//指定库位
  328 +export const allocation = (params) => postAction('/receipt/receiptContainerHeader/allocation', params);
327 329  
328 330 // 中转HTTP请求
329 331 export const transitRESTful = {
... ...
ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
... ... @@ -136,7 +136,7 @@
136 136 <a-popconfirm v-if="record.status == 0" v-has="'receiptContainerHeader:delete'" title="确定取消配盘吗?" @confirm="() => handleDelete(record.id)">
137 137 <a><a-button type="danger">取消配盘</a-button></a>
138 138 </a-popconfirm>
139   -
  139 + <a v-if="record.status == 0" @click="allocation(record)" v-has="'receiptContainerHeader:allocation'"><a-button type="primary">指定库位</a-button></a>
140 140 <a v-has="'receiptContainerHeader:edit'" @click="handleEdit(record)"><a-button type="default">编辑</a-button></a>
141 141 </span>
142 142 </a-table>
... ... @@ -153,6 +153,7 @@
153 153 <receiptContainerFillSelect-modal ref="modalForm3" @ok="modalFormOk"></receiptContainerFillSelect-modal>
154 154 <receiptContainerStatusSelect-modal ref="modalForm4" @ok="modalFormOk"></receiptContainerStatusSelect-modal>
155 155 <receipt-container-on-shell-modal ref="modalForm5" @ok="modalFormOk"></receipt-container-on-shell-modal>
  156 + <receipt-container-allocationl-modal ref="modalForm6" @ok="modalFormOk"></receipt-container-allocationl-modal>
156 157  
157 158 </a-card>
158 159 </template>
... ... @@ -172,11 +173,13 @@ import ReceiptContainerFillSelectModal from &quot;./modules/ReceiptContainerFillSelec
172 173 import ReceiptContainerStatusSelectModal from "./modules/ReceiptContainerStatusSelectModal";
173 174 import '@/assets/less/TableExpand.less'
174 175 import ReceiptContainerOnShellModal from "@views/system/receipt/modules/ReceiptContainerOnShellModal.vue";
  176 +import ReceiptContainerAllocationlModal from "@views/system/receipt/modules/ReceiptContainerAllocationlModal.vue";
175 177  
176 178 export default {
177 179 name: "ReceiptContainerHeaderList",
178 180 mixins: [JeecgListMixin],
179 181 components: {
  182 + ReceiptContainerAllocationlModal,
180 183 ReceiptContainerOnShellModal,
181 184 ReceiptContainerSelectModal,
182 185 ReceiptContainerDetailList,
... ... @@ -404,6 +407,10 @@ export default {
404 407 this.$refs.modalForm5.edit(record);
405 408 this.$refs.modalForm5.title = "平库上架";
406 409 },
  410 + allocation(record) {
  411 + this.$refs.modalForm6.edit(record);
  412 + this.$refs.modalForm6.title = "指定库位";
  413 + },
407 414 createBatchTask() {
408 415 if (this.selectedRowKeys.length <= 0) {
409 416 this.$message.warning('至少选择一条记录!')
... ...
ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptContainerAllocationlModal.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 + <div class="table-page-search-wrapper">
  12 + <a-spin :spinning="confirmLoading">
  13 + <a-form-model ref="form" :model="model" :rules="validatorRules" >
  14 + <a-row>
  15 + <a-col :span="24">
  16 + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toLocationCode">
  17 + <a-input v-model="model.toLocationCode" placeholder="请输入库位编码"></a-input>
  18 + </a-form-model-item>
  19 + </a-col>
  20 + </a-row>
  21 + </a-form-model>
  22 + </a-spin>
  23 + </div>
  24 + </j-modal>
  25 +</template>
  26 +
  27 +<script>
  28 +
  29 +import {httpAction} from '@/api/manage'
  30 +import {validateDuplicateValue} from '@/utils/util'
  31 +import {allocation, flatOnShell} from '@/api/api'
  32 +
  33 +export default {
  34 + name: "ReceiptContainerAllocationlModal",
  35 + components: {},
  36 + props: {
  37 + mainId: {
  38 + type: String,
  39 + required: false,
  40 + default: ''
  41 + }
  42 + },
  43 + data() {
  44 + return {
  45 + title: "操作",
  46 + portList: [],
  47 + flag:'0',
  48 + width: 500,
  49 + visible: false,
  50 + model: {},
  51 + labelCol: {
  52 + xs: {span: 24},
  53 + sm: {span: 5},
  54 + },
  55 + wrapperCol: {
  56 + xs: {span: 24},
  57 + sm: {span: 16},
  58 + },
  59 + confirmLoading: false,
  60 + validatorRules: {
  61 + toLocationCode: [{ required: true, message: '请输入库位编码!' }]
  62 + },
  63 + url: {
  64 + }
  65 + }
  66 + },
  67 + created() {
  68 + //备份model原始值
  69 + this.modelDefault = JSON.parse(JSON.stringify(this.model));
  70 + },
  71 + methods: {
  72 + add() {
  73 + this.edit(this.modelDefault);
  74 + },
  75 + edit(record) {
  76 + this.model = Object.assign({}, record);
  77 + this.visible = true;
  78 + },
  79 + close() {
  80 + this.$emit('close');
  81 + this.visible = false;
  82 + this.$refs.form.clearValidate();
  83 + },
  84 + handleOk() {
  85 + const that = this;
  86 + // 触发表单验证
  87 + this.$refs.form.validate(valid => {
  88 + if (valid) {
  89 + that.confirmLoading = true;
  90 + allocation(this.model).then((res) => {
  91 + if (res.success) {
  92 + that.$message.success(res.message);
  93 + that.$emit('ok');
  94 + } else {
  95 + that.$message.warning(res.message);
  96 + }
  97 + }).finally(() => {
  98 + that.confirmLoading = false;
  99 + that.close();
  100 + });
  101 + } else {
  102 + return false
  103 + }
  104 + });
  105 + },
  106 + handleCancel() {
  107 + this.close()
  108 + },
  109 + }
  110 +}
  111 +</script>
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java
... ... @@ -62,10 +62,14 @@ public interface IHuahengMultiHandlerService {
62 62  
63 63 /**
64 64 * 快速入库实现方法
65   - * @param bean
66   - * @param warehouseCode
  65 + * @param bean
  66 + * @param warehouseCode
67 67 * @return
68 68 */
69 69 Result quickReceiptService(QuickReceiptBean bean, String warehouseCode);
70 70  
  71 + /**
  72 + * 指定库位
  73 + */
  74 + Result allocation(ReceiptContainerHeader receiptContainerHeader);
71 75 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
... ... @@ -279,6 +279,17 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem
279 279 }
280 280  
281 281 @Override
  282 + public Result allocation(ReceiptContainerHeader receiptContainerHeader) {
  283 + Result result = handleMultiProcess("allocation", "", new MultiProcessListener() {
  284 + @Override
  285 + public Result<?> doProcess() {
  286 + return receiptContainerHeaderService.allocation(receiptContainerHeader);
  287 + }
  288 + });
  289 + return result;
  290 + }
  291 +
  292 + @Override
282 293 public Result createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode) {
283 294 Result result = handleMultiProcess("createReceiptTask", warehouseCode, new MultiProcessListener() {
284 295 @Override
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java
... ... @@ -435,4 +435,15 @@ public class ReceiptContainerHeaderController extends JeecgController&lt;ReceiptCon
435 435 return Result.OK(portList);
436 436 }
437 437  
  438 + /**
  439 + * 指定库位
  440 + * @return
  441 + */
  442 + @AutoLog(value = "入库组盘-指定库位")
  443 + @ApiOperation(value = "入库组盘-指定库位", notes = "入库组盘-指定库位")
  444 + @RequestMapping(value = "/allocation", method = {RequestMethod.PUT, RequestMethod.POST})
  445 + public Result<String> allocation(@RequestBody ReceiptContainerHeader receiptContainerHeader) {
  446 + Result result = huahengMultiHandlerService.allocation(receiptContainerHeader);
  447 + return result;
  448 + }
438 449 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java
... ... @@ -70,4 +70,11 @@ public interface IReceiptContainerHeaderService extends IService&lt;ReceiptContaine
70 70 * 更新去向toPort和状态status
71 71 */
72 72 boolean updateToPortAndStatus(String toPort, int status, int id);
  73 +
  74 + /**
  75 + * 更新去向toLocation
  76 + */
  77 + boolean updateToLocationById(String toLocationCode, int id);
  78 +
  79 + Result allocation(ReceiptContainerHeader receiptContainerHeader);
73 80 }
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... ... @@ -13,6 +13,7 @@ import org.jeecg.common.api.vo.Result;
13 13 import org.jeecg.common.exception.JeecgBootException;
14 14 import org.jeecg.modules.wms.config.container.entity.Container;
15 15 import org.jeecg.modules.wms.config.container.service.IContainerService;
  16 +import org.jeecg.modules.wms.config.location.entity.Location;
16 17 import org.jeecg.modules.wms.config.location.service.ILocationService;
17 18 import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService;
18 19 import org.jeecg.modules.wms.config.zone.entity.Zone;
... ... @@ -492,7 +493,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
492 493 }
493 494  
494 495 @Override
495   - @Transactional
  496 + @Transactional(rollbackFor = Exception.class)
496 497 public Result cancelReceiving(List<Integer> ids) {
497 498 Result result = null;
498 499 for (Integer id : ids) {
... ... @@ -505,7 +506,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
505 506 }
506 507  
507 508 @Override
508   - @Transactional
509 509 public boolean updateToPortById(String toPort, int id) {
510 510 ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader();
511 511 receiptContainerHeader.setToPort(toPort);
... ... @@ -515,7 +515,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
515 515 }
516 516  
517 517 @Override
518   - @Transactional
519 518 public boolean updateToPortAndStatus(String toPort, int status, int id) {
520 519 ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader();
521 520 receiptContainerHeader.setToPort(toPort);
... ... @@ -526,6 +525,41 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl&lt;ReceiptContai
526 525 }
527 526  
528 527 @Override
  528 + public boolean updateToLocationById(String toLocationCode, int id) {
  529 + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader();
  530 + receiptContainerHeader.setToLocationCode(toLocationCode);
  531 + receiptContainerHeader.setId(id);
  532 + boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader);
  533 + return success;
  534 + }
  535 +
  536 + @Override
  537 + @Transactional(rollbackFor = Exception.class)
  538 + public Result allocation(ReceiptContainerHeader receiptContainerHeader) {
  539 + String toLocationCode = receiptContainerHeader.getToLocationCode();
  540 + String warehouseCode = receiptContainerHeader.getWarehouseCode();
  541 + if (StringUtils.isEmpty(toLocationCode)) {
  542 + return Result.error("指定库位失败,库位编码为空");
  543 + }
  544 + if (StringUtils.isEmpty(warehouseCode)) {
  545 + return Result.error("指定库位失败,仓库编码为空");
  546 + }
  547 + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
  548 + if (toLocation == null) {
  549 + return Result.error("指定库位失败,没有找到库位" + toLocationCode);
  550 + }
  551 + String locationStatus = toLocation.getStatus();
  552 + if (locationStatus.equals(QuantityConstant.STATUS_LOCATION_LOCK)) {
  553 + return Result.error("指定库位失败,库位" + toLocationCode + "已经锁定");
  554 + }
  555 + if (!receiptContainerHeaderService.updateToLocationById(toLocationCode, receiptContainerHeader.getId())) {
  556 + throw new JeecgBootException("指定库位失败, 更新组盘头失败");
  557 + }
  558 + Result result = receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode);
  559 + return result;
  560 + }
  561 +
  562 + @Override
529 563 public boolean updateById(ReceiptContainerHeader receiptContainerHeader) {
530 564 LambdaQueryWrapper<ReceiptContainerHeader> receiptContainerHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
531 565 receiptContainerHeaderLambdaQueryWrapper.eq(ReceiptContainerHeader::getId, receiptContainerHeader.getId()).lt(receiptContainerHeader.getStatus() != null,
... ...
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... ... @@ -2005,14 +2005,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2005 2005 return Result.error("创建入库任务时, 容器已在库位" + container.getLocationCode() + "上");
2006 2006 }
2007 2007 if (StringUtils.isNotEmpty(toLocationCode)) {
2008   - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_ALLOCATION);
2009   - if (StringUtils.isEmpty(value)) {
2010   - return Result.error("创建入库任务时, 未绑定定位规则");
2011   - }
2012   - int allocationRule = Integer.parseInt(value);
2013   - if (allocationRule == QuantityConstant.DOUBLE_FORK) {
2014   - return Result.error("创建入库任务时, 双伸位库位不能手动指定库位");
2015   - }
2016 2008 Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode);
2017 2009 if (toLocation == null) {
2018 2010 return Result.error("创建入库任务时," + toLocationCode + "目标库位不存在");
... ... @@ -2024,6 +2016,14 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
2024 2016 return Result.error("创建入库任务时, 目标库位非空闲");
2025 2017 }
2026 2018 zoneCode = toLocation.getZoneCode();
  2019 + String value = parameterConfigurationService.getValueByZoneCode(QuantityConstant.RULE_ALLOCATION, zoneCode);
  2020 + if (StringUtils.isEmpty(value)) {
  2021 + return Result.error("创建入库任务时, 未绑定定位规则");
  2022 + }
  2023 + int allocationRule = Integer.parseInt(value);
  2024 + if (allocationRule == QuantityConstant.DOUBLE_FORK) {
  2025 + return Result.error("创建入库任务时, 双伸位库位不能手动指定库位");
  2026 + }
2027 2027 }
2028 2028 taskLockEntity.setZoneCode(zoneCode);
2029 2029 success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, warehouseCode);
... ...