From b3ece8e4506b8905fd59857f6d024de2ce6edb53 Mon Sep 17 00:00:00 2001 From: TanYibin <5491541@qq.com> Date: Thu, 14 Dec 2023 11:25:51 +0800 Subject: [PATCH] 出库单合并问题修复 --- ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue | 37 ++++++++++++++++--------------------- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java | 6 +++++- huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java | 21 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue index 5a3b484..70118af 100644 --- a/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue +++ b/ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue @@ -125,21 +125,11 @@ <a-button type="primary" icon="import">导入</a-button> </a-upload> <a-button v-has="'shipmentHeader:print'" @click="batchPrint()" type="primary">打印</a-button> -<!-- <!– 高级查询区域 –>--> -<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal"--> -<!-- @handleSuperQuery="handleSuperQuery"></j-super-query>--> <j-super-query :fieldList="superFieldList" v-has="'shipmentHeader:superQuery'" @handleSuperQuery="handleSuperQuery"/> - </div> <!-- table区域-begin --> <div> -<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">--> -<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a--> -<!-- style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项--> -<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> -<!-- </div>--> - <a-table ref="table" size="middle" @@ -219,19 +209,24 @@ </a-popconfirm> <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button><a-divider type="vertical"/></a> - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) - || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipment(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">自动出库</a-button><a-divider type="vertical"/></a> - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) - || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentAdvice(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">预配盘出库</a-button></a> - <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1') || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null)"> - <a class="ant-dropdown-link"><a-divider type="vertical"/>更多 <a-icon type="down"/></a> + <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1') + || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null) + || (record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) + || (flowOff == '0' && record.lastStatus <= 200)"> + <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> <a-menu slot="overlay"> - <a-menu-item v-if="record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1'"> - <a @click="openProcess(record)" type="primary">审核进度</a> - </a-menu-item> - <a-menu-item v-has="'shipmentHeader:edit'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> + <a-menu-item v-if="record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1'"> + <a @click="openProcess(record)" type="primary">审核进度</a> + </a-menu-item> + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) || (flowOff == '0' && record.lastStatus <= 200)" v-has="'shipmentHeader:autoShipment'"> + <a @click="autoShipment(record)" type="primary">自动出库</a> + </a-menu-item> + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) || (flowOff == '0' && record.lastStatus <= 200)" v-has="'shipmentHeader:autoShipment'"> + <a @click="autoShipmentAdvice(record)" type="primary">预配盘出库</a> + </a-menu-item> + <a-menu-item v-has="'shipmentHeader:edit'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> <a @click="handleEdit(record)">编辑</a> - </a-menu-item> + </a-menu-item> <a-menu-item v-has="'shipmentHeader:delete'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a>删除</a> diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java index 45ae32c..92d268c 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -48,7 +48,9 @@ import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import cn.monitor4all.logRecord.annotation.OperationLog; @@ -155,7 +157,9 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS @ApiOperation(value = "出库单-通过id删除", notes = "出库单-通过id删除") @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name = "id", required = true) String id) { - shipmentHeaderService.delMain(id, "删除出库单"); + if (!shipmentHeaderService.delMain(id, "删除出库单")) { + return Result.error("删除失败!"); + } return Result.OK("删除成功!"); } diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java index c0ee8d6..18b2105 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java @@ -124,12 +124,28 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, private IShipmentContainerAdviceService shipmentContainerAdviceService; @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public boolean delMain(String id, String reason) { ShipmentHeader shipmentHeader = getById(id); + if (shipmentHeader == null) { + throw new JeecgBootException("获取出库单信息失败!"); + } if (shipmentHeader.getFirstStatus().intValue() > QuantityConstant.RECEIPT_HEADER_BUILD) { throw new JeecgBootException("不能删除非新建状态单据"); } + LambdaUpdateWrapper<ShipmentHeader> shipmentHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); + shipmentHeaderLambdaUpdateWrapper.eq(ShipmentHeader::getMergeShipmentCode, shipmentHeader.getCode()); + shipmentHeaderLambdaUpdateWrapper.set(ShipmentHeader::getFirstStatus, QuantityConstant.SHIPMENT_HEADER_BUILD).set(ShipmentHeader::getLastStatus, + QuantityConstant.SHIPMENT_HEADER_BUILD); + if (!shipmentHeaderService.update(shipmentHeaderLambdaUpdateWrapper)) { + throw new JeecgBootException("更新出库单主表失败"); + } + LambdaUpdateWrapper<ShipmentDetail> shipmentDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); + shipmentDetailLambdaUpdateWrapper.eq(ShipmentDetail::getMergeShipmentCode, shipmentHeader.getCode()); + shipmentDetailLambdaUpdateWrapper.set(ShipmentDetail::getStatus, QuantityConstant.SHIPMENT_HEADER_BUILD); + if (!shipmentDetailService.update(shipmentDetailLambdaUpdateWrapper)) { + throw new JeecgBootException("更新出库单主表失败"); + } shipmentHeaderHistoryService.saveById(id, reason); shipmentDetailMapper.deleteByMainId(id.toString()); shipmentHeaderMapper.deleteById(id); @@ -319,6 +335,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, if (mergeShipmentHeaderList.stream().map(ShipmentHeader::getCustomerCode).distinct().count() > 1) { return Result.error("客户信息不一致!"); } + if (mergeShipmentHeaderList.stream().map(ShipmentHeader::getZoneCode).distinct().count() > 1) { + return Result.error("库区信息不一致!"); + } // 查询出库单详情 LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); shipmentDetailLambdaQueryWrapper.in(ShipmentDetail::getShipmentCode, shipmentHeaderList.stream().map(ShipmentHeader::getCode).collect(Collectors.toList())); -- libgit2 0.22.2