add:完善配盘配送
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pda_manage.demand.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.demand.service.IPlatingDemandService;
|
||||
@@ -13,19 +14,23 @@ import javax.annotation.Resource;
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/platingDemand")
|
||||
public class PdaPlatingDemandController {
|
||||
@Resource private IPlatingDemandService platingDemandService;
|
||||
@Resource
|
||||
private IPlatingDemandService platingDemandService;
|
||||
|
||||
@GetMapping
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> unfinished() {
|
||||
return ResponseData.build(platingDemandService.unfinished(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> detail(@PathVariable String id) {
|
||||
return ResponseData.build(platingDemandService.detail(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/complete")
|
||||
@SaIgnore
|
||||
@Log("PDA完成托盘配料需求单")
|
||||
public ResponseEntity<Object> complete(@PathVariable String id, @RequestBody PlatingDemandCompleteParam param) {
|
||||
platingDemandService.complete(id, param);
|
||||
|
||||
@@ -5,4 +5,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PlatingDemandCompleteParam {
|
||||
private String palletCode;
|
||||
private String storeCode;
|
||||
private String pointCode;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
@@ -22,6 +23,8 @@ import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandItemMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmPlatingDemandMapper;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandCompleteParam;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PlatingDemandDto;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
@@ -75,6 +78,10 @@ public class PlatingDemandServiceImpl implements IPlatingDemandService {
|
||||
private IStInventoryService inventoryService;
|
||||
@Resource
|
||||
private IPmStockReturnService stockReturnService;
|
||||
@Resource
|
||||
private ISchBasePointService schBasePointService;
|
||||
@Resource
|
||||
private IMdPbStoragevehicleinfoService storagevehicleinfoService;
|
||||
|
||||
@Override
|
||||
public List<PlatingDemandDto> preview(List<String> workOrderCodes) {
|
||||
@@ -167,17 +174,20 @@ public class PlatingDemandServiceImpl implements IPlatingDemandService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void complete(String id, PlatingDemandCompleteParam param) {
|
||||
SchBasePoint point = schBasePointService.selectByCode(param.getPointCode());
|
||||
if (point == null) throw new BadRequestException("点位不存在:" + param.getPointCode());
|
||||
PmPlatingDemand demand = demandMapper.selectById(id);
|
||||
if (demand == null || demand.getStatus() == 2) throw new BadRequestException("需求单不存在或已完成");
|
||||
if (param == null || param.getPalletCode() == null || param.getPalletCode().trim().isEmpty())
|
||||
throw new BadRequestException("请输入托盘编码");
|
||||
storagevehicleinfoService.chackAndInsert(param.getPalletCode());
|
||||
List<PmPlatingDemandItem> items = items(id);
|
||||
List<GroupPlate> plates = groupplateService.list(new LambdaQueryWrapper<GroupPlate>().eq(GroupPlate::getStoragevehicle_code, param.getPalletCode()).ne(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")));
|
||||
Map<String, BigDecimal> palletQty = plates.stream().collect(Collectors.groupingBy(GroupPlate::getMaterial_code, Collectors.mapping(GroupPlate::getQty, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
|
||||
for (PmPlatingDemandItem item : items)
|
||||
if (palletQty.getOrDefault(item.getMaterial_code(), BigDecimal.ZERO).compareTo(item.getDemand_qty()) < 0)
|
||||
throw new BadRequestException("托盘物料不足:" + item.getMaterial_code());
|
||||
Structattr struct = structattrService.getOne(new LambdaQueryWrapper<Structattr>().eq(Structattr::getStoragevehicle_code, param.getPalletCode()).last("limit 1"));
|
||||
Structattr struct = structattrService.getOne(new LambdaQueryWrapper<Structattr>().eq(Structattr::getSect_code, param.getStoreCode()).last("limit 1"));
|
||||
if (struct == null) throw new BadRequestException("托盘未绑定库位:" + param.getPalletCode());
|
||||
saveOutbound(demand, items, struct, param.getPalletCode());
|
||||
demandMapper.update(null, new LambdaUpdateWrapper<PmPlatingDemand>().eq(PmPlatingDemand::getId, id).set(PmPlatingDemand::getStatus, 2).set(PmPlatingDemand::getPallet_code, param.getPalletCode()).set(PmPlatingDemand::getFinish_time, DateUtil.now()));
|
||||
|
||||
98
pda/pda/src/views/PlatingDemand.vue
Normal file
98
pda/pda/src/views/PlatingDemand.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<van-nav-bar title="托盘配料需求单" left-arrow @click-left="router.push('/')"/>
|
||||
<div class="page-content">
|
||||
<van-pull-refresh v-model="refreshing" @refresh="loadDemands">
|
||||
<van-empty v-if="!demands.length && !loading" description="暂无未完成需求单"/>
|
||||
<van-cell-group v-else inset>
|
||||
<van-cell v-for="item in demands" :key="item.id" is-link @click="selectDemand(item.id)">
|
||||
<template #title><strong>{{ item.demandCode }}</strong>
|
||||
<div class="sub-text">工单:{{ item.workOrderCode }}</div>
|
||||
</template>
|
||||
<template #label>上料口:{{ item.loadPort }} | {{ statusLabel(item.status) }}</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-pull-refresh>
|
||||
|
||||
<template v-if="current">
|
||||
<van-divider>需求物料</van-divider>
|
||||
<van-cell-group inset>
|
||||
<van-cell v-for="item in current.items" :key="item.id" :title="item.materialCode"
|
||||
:label="item.materialName + (item.spec ? ' ' + item.spec : '') + (item.warehouseName ? ' | ' + item.warehouseName : '')"
|
||||
:value="item.demandQty + ' ' + item.unit"/>
|
||||
</van-cell-group>
|
||||
<van-field v-model="palletCode" label="托盘编码" placeholder="请扫描或输入托盘编码" clearable/>
|
||||
<BottomButton text="完成配盘并出库" :loading="submitting" @click="complete"/>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {ref, onMounted} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {showConfirmDialog, showToast} from 'vant'
|
||||
import request from '@/utils/request'
|
||||
import BottomButton from '@/components/BottomButton.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const demands = ref([])
|
||||
const current = ref(null)
|
||||
const palletCode = ref('')
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const submitting = ref(false)
|
||||
|
||||
function statusLabel(status) {
|
||||
return ['创建', '配盘中', '完成'][status] || '-'
|
||||
}
|
||||
|
||||
async function loadDemands() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await request.get('/api/pda/platingDemand');
|
||||
demands.value = res.data || []
|
||||
} finally {
|
||||
loading.value = false;
|
||||
refreshing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function selectDemand(id) {
|
||||
const res = await request.get(`/api/pda/platingDemand/${id}`);
|
||||
current.value = res.data;
|
||||
palletCode.value = ''
|
||||
}
|
||||
|
||||
async function complete() {
|
||||
if (!palletCode.value) {
|
||||
showToast({message: '请输入托盘编码', type: 'fail'});
|
||||
return
|
||||
}
|
||||
try {
|
||||
await showConfirmDialog({title: '确认完成', message: '将按需求数量生产出库并创建回传单,确认继续?'})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await request.post(`/api/pda/platingDemand/${current.value.id}/complete`, {palletCode: palletCode.value});
|
||||
showToast({message: '配盘完成', type: 'success'});
|
||||
current.value = null;
|
||||
palletCode.value = '';
|
||||
await loadDemands()
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(loadDemands)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sub-text {
|
||||
margin-top: 4px;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user