fix:托盘入库添加任务校验;移动单修改功能,盘点单修改功能

This commit is contained in:
zhangzq
2024-07-26 10:37:42 +08:00
parent 486639cc2f
commit f89ac94bec
10 changed files with 105 additions and 24 deletions

View File

@@ -132,7 +132,6 @@ public class SpringContextHolder implements ApplicationContextAware, DisposableB
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
log.warn("自动注入bean工具");
if (SpringContextHolder.applicationContext != null) {
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
}

View File

@@ -64,6 +64,13 @@ public class PalletInStorageTask extends AbstractTask {
if (StringUtils.isEmpty(currentInstId)){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"未创建入库流程");
}
SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("vehicle_code", vehicle_code).select("task_code")
.lt("status",StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask!=null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"已经存任务"+schBaseTask.getTask_code());
}
ActRuExecution execution = iActRuExecutionService.getById(currentInstId);
if (execution == null){
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"流程信息不存在"+currentInstId);

View File

@@ -1,10 +1,11 @@
package org.nl.wms.stor_manage.move.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.ibatis.annotations.Update;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.entity.PageQuery;
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
import org.nl.wms.pm_manage.form_data.service.dao.PmFormData;
@@ -45,11 +46,18 @@ public class MovingController {
return new ResponseEntity<>(iPmFormDataService.getSonDtlFormData(id),HttpStatus.OK);
}
@PostMapping("/save")
@PostMapping("")
@Log("新增移库单")
public ResponseEntity<Object> save(@RequestBody JSONObject params) {
movingService.save(params);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping
@Log("修改移库单")
public ResponseEntity<Object> update(@RequestBody JSONObject params) {
movingService.update(params);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/updateStatus")
public ResponseEntity<Object> updateStatus(@RequestBody JSONObject param) {
//TODO:明细校验

View File

@@ -29,9 +29,12 @@ import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
/*
@@ -87,13 +90,46 @@ public class MovingService {
.set("lock_type", StatusEnum.LOCK.code("移库锁"))
.in("struct_code",structs));
}
@Transactional
public void update(JSONObject form){
Assert.noNullElements(new Object[]{form,form.getString("id")},"请求参数不能为空");
String user = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
iFormDataService.update(new UpdateWrapper<PmFormData>()
.eq("id",form.getString("id"))
.set("remark",form.getString("remark"))
.set("update_time",now)
.set("update_name",user));
List items = (List) form.get("item");
Set<String> structs = new HashSet<>();
Set<String> release = new HashSet<>();
for (Object itemO : items) {
JSONObject itemJ = new JSONObject((Map) itemO);
PmFormData dtl = itemJ.toJavaObject(PmFormData.class);
String end_struct_code = dtl.getForm_data().getString("end_struct_code");
PmFormData byId = iFormDataService.getById(dtl.getId());
if (!end_struct_code.equals(byId.getForm_data().getString("end_struct_code"))){
release.add(byId.getForm_data().getString("end_struct_code"));
structs.add(end_struct_code);
}
}
if (!CollectionUtils.isEmpty(structs)){
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.set("lock_type", StatusEnum.LOCK.code("移库锁"))
.in("struct_code",structs));
iStIvtStructattrService.update(new UpdateWrapper<StIvtStructattr>()
.set("lock_type", StatusEnum.LOCK.code("无锁"))
.in("struct_code",release));
}
}
/**
* 删除移库单
* @param ids
*/
@Transactional
public void delete(String[] ids){
public void delete(String...ids){
if (ids.length>0){
List<PmFormData> dtls = iFormDataService.getByParentId(ids);
List<String> removeCollect = dtls.stream().map(PmFormData::getId).collect(Collectors.toList());

View File

@@ -13,13 +13,9 @@
md_me_materialbase.material_name,
md_me_materialbase.material_code,
md_me_materialbase.material_spec,
struct.*,
sect.sect_name,
stor.stor_name
struct.*
FROM
st_ivt_structattr struct
left join st_ivt_sectattr sect on sect.sect_id = struct.sect_code
left join st_ivt_bsrealstorattr stor on struct.stor_code = stor.stor_code
left join md_pb_vehicleMater on struct.vehicle_code = md_pb_vehicleMater.vehicle_code
left JOIN md_me_materialbase on md_pb_vehicleMater.material_id = md_me_materialbase.material_id
<where>

View File

@@ -214,7 +214,11 @@
{{ tableEnum.label.st_ivt_sectattr[scope.row.sect_code] }}
</template>
</el-table-column>
<el-table-column prop="stor_name" label="所属仓库" width="150" />
<el-table-column prop="stor_code" label="所属仓库" width="150" >
<template slot-scope="scope">
{{ tableEnum.label.st_ivt_bsrealstorattr[scope.row.stor_code] }}
</template>
</el-table-column>
<el-table-column prop="vehicle_code" label="载具号" :min-width="flexWidth('vehicle_code',crud.data,'载具号')" />
<el-table-column prop="is_temp" label="是否临时" width="150" >
<template slot-scope="scope">

View File

@@ -67,7 +67,11 @@
{{ tableEnum.label.st_ivt_sectattr[scope.row.sect_code] }}
</template>
</el-table-column>
<el-table-column prop="stor_name" label="仓库" show-overflow-tooltip />
<el-table-column prop="stor_code" label="仓库" show-overflow-tooltip >
<template slot-scope="scope">
{{ tableEnum.label.st_ivt_bsrealstorattr[scope.row.stor_code] }}
</template>
</el-table-column>
<el-table-column prop="struct_code" label="仓位编码" show-overflow-tooltip />
<el-table-column prop="struct_name" label="仓位名称" show-overflow-tooltip />
<el-table-column prop="vehicle_code" label="载具编码" show-overflow-tooltip>
@@ -130,7 +134,7 @@ export default {
}})
},
mixins: [presenter(), header()],
tableEnums: [ 'bm_measure_unit#unit_name#unit_id','st_ivt_sectattr#sect_name#sect_code' ],
tableEnums: [ 'bm_measure_unit#unit_name#unit_id','st_ivt_bsrealstorattr#stor_name#stor_code','st_ivt_sectattr#sect_name#sect_code' ],
statusEnums: [ 'LOCK' ],
props: {
dialogShow: {

View File

@@ -239,6 +239,19 @@ export default {
this.dis_flag = true
}
},
[CRUD.HOOK.beforeCrudToCU]() {
this.$refs['form'].validate((valid) => {
if (valid) {
return true
}else {
return false
}
})
if (this.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
submitCU() {
// 提交前校验
this.$refs['form'].validate((valid) => {
@@ -260,7 +273,6 @@ export default {
this.crud.toQuery()
})
},
deleteRow(index, rows) {
rows.splice(index, 1)
},

View File

@@ -109,7 +109,7 @@
<!-- </template>-->
<!-- </el-table-column>-->
<template scope="scope">
<el-input v-model="tableData[scope.$index].form_data[item.value]" class="input-with-select" />
<el-input disabled v-model="tableData[scope.$index].form_data[item.value]" class="input-with-select" />
</template>
</el-table-column>
@@ -156,6 +156,7 @@ import StructAttrDialog from '@/views/wms/stor_manage/storIvtInfo/StructAttrDial
import StructAttrDialog2 from '@/views/wms/stor_manage/storIvtInfo/StructAttrDialog'
import formstruc from '@/views/wms/config_manage/formStruc/formstruc'
import crudMove from '@/views/wms/stor_manage/warehouse/move/move'
import crudFormData, {getSonFormData} from './formData'
const defaultForm = {
id: '',
@@ -277,14 +278,22 @@ export default {
return false
}
this.form.item = this.tableData
if (!this.form.id){
crudMove.add(this.form).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.close()
this.dialogVisible
this.crud.toQuery()
})
}else {
crudMove.edit(this.form).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.close()
this.dialogVisible
this.crud.toQuery()
})
}
},
deleteRow(index, rows) {
rows.splice(index, 1)
},
@@ -332,7 +341,13 @@ export default {
this.endStructs.push(end_struct_code)
this.$set(this.tableData[this.currentIndex].form_data,"end_struct_code",end_struct_code)
}
}
},
[CRUD.HOOK.beforeToEdit]() {
// 获取入库单明细
crudFormData.getSonFormData(this.form.id).then(res => {
this.tableData = res
})
},
}
}
</script>

View File

@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function add(data) {
return request({
url: '/api/move/save',
url: '/api/move',
method: 'post',
data
})
@@ -19,7 +19,7 @@ export function del(ids) {
export function edit(data) {
return request({
url: 'api/move',
method: 'post',
method: 'put',
data
})
}