Commit b3ece8e4506b8905fd59857f6d024de2ce6edb53
1 parent
26cc68a6
出库单合并问题修复
Signed-off-by: TanYibin <5491541@qq.com>
Showing
3 changed files
with
41 additions
and
23 deletions
ant-design-vue-jeecg/src/views/system/shipment/ShipmentHeaderList.vue
... | ... | @@ -125,21 +125,11 @@ |
125 | 125 | <a-button type="primary" icon="import">导入</a-button> |
126 | 126 | </a-upload> |
127 | 127 | <a-button v-has="'shipmentHeader:print'" @click="batchPrint()" type="primary">打印</a-button> |
128 | -<!-- <!– 高级查询区域 –>--> | |
129 | -<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal"--> | |
130 | -<!-- @handleSuperQuery="handleSuperQuery"></j-super-query>--> | |
131 | 128 | <j-super-query :fieldList="superFieldList" v-has="'shipmentHeader:superQuery'" @handleSuperQuery="handleSuperQuery"/> |
132 | - | |
133 | 129 | </div> |
134 | 130 | |
135 | 131 | <!-- table区域-begin --> |
136 | 132 | <div> |
137 | -<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">--> | |
138 | -<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a--> | |
139 | -<!-- style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项--> | |
140 | -<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> | |
141 | -<!-- </div>--> | |
142 | - | |
143 | 133 | <a-table |
144 | 134 | ref="table" |
145 | 135 | size="middle" |
... | ... | @@ -219,19 +209,24 @@ |
219 | 209 | </a-popconfirm> |
220 | 210 | <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) |
221 | 211 | || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentCombine(record)" v-has="'shipmentHeader:autoShipmentCombine'"><a-button type="primary">自动配盘</a-button><a-divider type="vertical"/></a> |
222 | - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) | |
223 | - || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipment(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">自动出库</a-button><a-divider type="vertical"/></a> | |
224 | - <a v-if="((record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800)) | |
225 | - || (flowOff == '0' && record.lastStatus <= 200)" @click="autoShipmentAdvice(record)" v-has="'shipmentHeader:autoShipment'"><a-button type="primary">预配盘出库</a-button></a> | |
226 | - <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1') || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null)"> | |
227 | - <a class="ant-dropdown-link"><a-divider type="vertical"/>更多 <a-icon type="down"/></a> | |
212 | + <a-dropdown v-if="(record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1') | |
213 | + || (record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null) | |
214 | + || (record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) | |
215 | + || (flowOff == '0' && record.lastStatus <= 200)"> | |
216 | + <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> | |
228 | 217 | <a-menu slot="overlay"> |
229 | - <a-menu-item v-if="record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1'"> | |
230 | - <a @click="openProcess(record)" type="primary">审核进度</a> | |
231 | - </a-menu-item> | |
232 | - <a-menu-item v-has="'shipmentHeader:edit'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> | |
218 | + <a-menu-item v-if="record.firstStatus > 0 && record.firstStatus <= 20 && flowOff=='1'"> | |
219 | + <a @click="openProcess(record)" type="primary">审核进度</a> | |
220 | + </a-menu-item> | |
221 | + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) || (flowOff == '0' && record.lastStatus <= 200)" v-has="'shipmentHeader:autoShipment'"> | |
222 | + <a @click="autoShipment(record)" type="primary">自动出库</a> | |
223 | + </a-menu-item> | |
224 | + <a-menu-item v-if="(record.firstStatus >= 15 && record.firstStatus != '20' && record.lastStatus < 800) || (flowOff == '0' && record.lastStatus <= 200)" v-has="'shipmentHeader:autoShipment'"> | |
225 | + <a @click="autoShipmentAdvice(record)" type="primary">预配盘出库</a> | |
226 | + </a-menu-item> | |
227 | + <a-menu-item v-has="'shipmentHeader:edit'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> | |
233 | 228 | <a @click="handleEdit(record)">编辑</a> |
234 | - </a-menu-item> | |
229 | + </a-menu-item> | |
235 | 230 | <a-menu-item v-has="'shipmentHeader:delete'" v-if="record.firstStatus == 0 && record.lastStatus == 0 && record.referCode == null"> |
236 | 231 | <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
237 | 232 | <a>删除</a> |
... | ... |
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; |
48 | 48 | |
49 | 49 | import com.alibaba.fastjson.JSON; |
50 | 50 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
51 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
51 | 52 | import com.baomidou.mybatisplus.core.metadata.IPage; |
53 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
52 | 54 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
53 | 55 | |
54 | 56 | import cn.monitor4all.logRecord.annotation.OperationLog; |
... | ... | @@ -155,7 +157,9 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS |
155 | 157 | @ApiOperation(value = "出库单-通过id删除", notes = "出库单-通过id删除") |
156 | 158 | @DeleteMapping(value = "/delete") |
157 | 159 | public Result<String> delete(@RequestParam(name = "id", required = true) String id) { |
158 | - shipmentHeaderService.delMain(id, "删除出库单"); | |
160 | + if (!shipmentHeaderService.delMain(id, "删除出库单")) { | |
161 | + return Result.error("删除失败!"); | |
162 | + } | |
159 | 163 | return Result.OK("删除成功!"); |
160 | 164 | } |
161 | 165 | |
... | ... |
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, |
124 | 124 | private IShipmentContainerAdviceService shipmentContainerAdviceService; |
125 | 125 | |
126 | 126 | @Override |
127 | - @Transactional | |
127 | + @Transactional(rollbackFor = Exception.class) | |
128 | 128 | public boolean delMain(String id, String reason) { |
129 | 129 | ShipmentHeader shipmentHeader = getById(id); |
130 | + if (shipmentHeader == null) { | |
131 | + throw new JeecgBootException("获取出库单信息失败!"); | |
132 | + } | |
130 | 133 | if (shipmentHeader.getFirstStatus().intValue() > QuantityConstant.RECEIPT_HEADER_BUILD) { |
131 | 134 | throw new JeecgBootException("不能删除非新建状态单据"); |
132 | 135 | } |
136 | + LambdaUpdateWrapper<ShipmentHeader> shipmentHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
137 | + shipmentHeaderLambdaUpdateWrapper.eq(ShipmentHeader::getMergeShipmentCode, shipmentHeader.getCode()); | |
138 | + shipmentHeaderLambdaUpdateWrapper.set(ShipmentHeader::getFirstStatus, QuantityConstant.SHIPMENT_HEADER_BUILD).set(ShipmentHeader::getLastStatus, | |
139 | + QuantityConstant.SHIPMENT_HEADER_BUILD); | |
140 | + if (!shipmentHeaderService.update(shipmentHeaderLambdaUpdateWrapper)) { | |
141 | + throw new JeecgBootException("更新出库单主表失败"); | |
142 | + } | |
143 | + LambdaUpdateWrapper<ShipmentDetail> shipmentDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | |
144 | + shipmentDetailLambdaUpdateWrapper.eq(ShipmentDetail::getMergeShipmentCode, shipmentHeader.getCode()); | |
145 | + shipmentDetailLambdaUpdateWrapper.set(ShipmentDetail::getStatus, QuantityConstant.SHIPMENT_HEADER_BUILD); | |
146 | + if (!shipmentDetailService.update(shipmentDetailLambdaUpdateWrapper)) { | |
147 | + throw new JeecgBootException("更新出库单主表失败"); | |
148 | + } | |
133 | 149 | shipmentHeaderHistoryService.saveById(id, reason); |
134 | 150 | shipmentDetailMapper.deleteByMainId(id.toString()); |
135 | 151 | shipmentHeaderMapper.deleteById(id); |
... | ... | @@ -319,6 +335,9 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
319 | 335 | if (mergeShipmentHeaderList.stream().map(ShipmentHeader::getCustomerCode).distinct().count() > 1) { |
320 | 336 | return Result.error("客户信息不一致!"); |
321 | 337 | } |
338 | + if (mergeShipmentHeaderList.stream().map(ShipmentHeader::getZoneCode).distinct().count() > 1) { | |
339 | + return Result.error("库区信息不一致!"); | |
340 | + } | |
322 | 341 | // 查询出库单详情 |
323 | 342 | LambdaQueryWrapper<ShipmentDetail> shipmentDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); |
324 | 343 | shipmentDetailLambdaQueryWrapper.in(ShipmentDetail::getShipmentCode, shipmentHeaderList.stream().map(ShipmentHeader::getCode).collect(Collectors.toList())); |
... | ... |