库存修改

This commit is contained in:
lyd
2022-11-03 10:35:20 +08:00
parent bdc86d6e28
commit 3bdbf389d4
9 changed files with 385 additions and 70 deletions

View File

@@ -45,12 +45,16 @@ class MaterialLabelServiceImpl implements MaterialLabelService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
//物料模糊查询
String bullery = MapUtil.getStr(whereJson, "bullery");
String material_name = MapUtil.getStr(whereJson, "material_name");
String formula = MapUtil.getStr(whereJson, "formula");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
HashMap<String, String> map = new HashMap<>();
map.put("bullery", bullery);
map.put("flag", "1");
map.put("material_name", material_name);
map.put("formula", formula);
map.put("pcsn", pcsn);
JSONObject json = WQL.getWO("QMD_materialLab_01").addParam("flag", "1").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
JSONObject json = WQL.getWO("QMD_materialLab_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
//处理标签码
JSONArray arr = json.optJSONArray("content");

View File

@@ -1,10 +1,10 @@
[交易说明]
交易名: 配方分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
@@ -14,47 +14,49 @@
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.label_code TYPEAS s_string
输入.material_name TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.formula TYPEAS s_string
输入.bullery TYPEAS s_string
输入.formula TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
SELECT
*
FROM
md_base_materialLabelMst m
WHERE
m.is_delete = '0'
OPTION 输入.bullery <> ""
(m.material_name like "%" 输入.bullery "%" or m.material_code like "%" 输入.bullery "%" or m.material_spec like "%" 输入.bullery)
OPTION 输入.material_name <> ""
m.material_name like "%" 输入.material_name "%"
ENDOPTION
OPTION 输入.bullery <> ""
(m.formula like "%" 输入.bullery "%" or m.pcsn like "%" 输入.bullery "%")
OPTION 输入.formula <> ""
m.formula like "%" 输入.formula "%"
ENDOPTION
OPTION 输入.pcsn <> ""
m.pcsn like "%" 输入.pcsn "%"
ENDOPTION
ENDSELECT
ENDPAGEQUERY

View File

@@ -91,4 +91,12 @@ public class PointDto implements Serializable {
* 所属区域
*/
private String area_type;
/**
* 物料标签id
*/
private String label_uuid;
private String material_uuid;
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.sch.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -112,9 +113,71 @@ public class PointServiceImpl implements PointService {
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("sch_base_point");
// 获取数据
String label_uuid = dto.getLabel_uuid();
String point_type1 = dto.getPoint_type1(); // 点位类型
String struct_code = dto.getPoint_code(); // 点位编码就是仓位编码
String point_status = dto.getPoint_status();
String vehicle_code = dto.getVehicle_code();
String material_uuid = dto.getMaterial_uuid();
WQLObject structIvtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
WQLObject materialLabelTab = WQLObject.getWQLObject("md_base_materialLabelMst");
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject structTab = WQLObject.getWQLObject("st_base_struct");
JSONObject structIvtObj = null;
JSONObject structObj = null;
JSONObject materialLabelObj = null;
if (ObjectUtil.isNotEmpty(struct_code)) {
structObj = structTab.query("struct_code = '" + struct_code + "'").uniqueResult(0);
}
// 通过载具号获取仓位库存信息
if (ObjectUtil.isNotEmpty(structObj)) {
structIvtObj = structIvtTab.query("struct_uuid = '" + structObj.getString("struct_uuid") + "'").uniqueResult(0);
}
if (ObjectUtil.isNotEmpty(label_uuid)) {
materialLabelObj = materialLabelTab.query("label_uuid = '" + label_uuid + "'").uniqueResult(0);
}
if (point_type1.equals("01")) { // 仓位的时候需要对仓位库存进行操作
if (point_status.equals("00")) { // 空位
// 删除仓位库存
if (ObjectUtil.isNotEmpty(structIvtObj)) structIvtTab.delete(structIvtObj);
vehicle_code = null;
} else if (point_status.equals("01")) { // 空载具
if (ObjectUtil.isNotEmpty(structIvtObj)) structIvtTab.delete(structIvtObj);
} else { // 有箱有料
if (ObjectUtil.isEmpty(materialLabelObj)) throw new BadRequestException("物料不能为空");
if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("载具编码不能为空");
if (ObjectUtil.isEmpty(structIvtObj)) { // 仓位库存为空就插入
JSONObject structIvt = new JSONObject();
structIvt.put("stockrecord_uuid", IdUtil.simpleUUID());
structIvt.put("struct_uuid", structObj.getString("struct_uuid"));
structIvt.put("stand_hour", materialLabelObj.getString("stand_hour"));
structIvt.put("label_uuid", label_uuid);
structIvt.put("material_uuid", material_uuid);
structIvt.put("vehicle_code", vehicle_code);
structIvt.put("instorage_time", DateUtil.now());
structIvtTab.insert(structIvt);
} else { // 修改
structIvtObj.put("struct_uuid", structObj.getString("struct_uuid"));
structIvtObj.put("label_uuid", label_uuid);
structIvtObj.put("stand_hour", materialLabelObj.getString("stand_hour"));
structIvtObj.put("material_uuid", material_uuid);
structIvtObj.put("vehicle_code", vehicle_code);
structIvtObj.put("instorage_time", DateUtil.now());
structIvtTab.update(structIvtObj);
}
}
}
// 点位修改
dto.setVehicle_code(vehicle_code);
JSONObject json = JSONObject.fromObject(dto);
wo.update(json);
pointTab.update(json);
}
@Override

View File

@@ -1,10 +1,10 @@
[交易说明]
交易名: 库区分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
@@ -24,26 +24,26 @@
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
@@ -66,13 +66,16 @@
point.create_by,
point.create_time,
point.update_by,
point.update_time
point.update_time,
material.material_name
FROM
sch_base_point point
LEFT JOIN sys_dict_detail d1 ON point.point_type1 = d1.value and d1.name='point_type1'
LEFT JOIN sys_dict_detail d2 ON point.area_type = d2.value and d2.name='sch_area_type'
LEFT JOIN sys_dict_detail d3 ON point.lock_type = d3.value and d3.name='lock_type'
LEFT JOIN sys_dict_detail d4 ON point.point_status = d4.value and d4.name='sch_point_status'
LEFT JOIN st_ivt_structivt structivt ON structivt.vehicle_code = point.vehicle_code
LEFT JOIN md_base_material material ON material.material_uuid = structivt.material_uuid
WHERE
point.is_delete = '0'
OPTION 输入.area_type <> ""
@@ -98,4 +101,4 @@
ENDIF

View File

@@ -802,7 +802,6 @@ function form(defaultForm) {
* crud
*/
function crud(options = {}) {
debugger
const defaultOptions = {
type: undefined
}

View File

@@ -10,14 +10,38 @@
label-width="80px"
label-suffix=":"
>
<el-form-item label="配方|批次">
<el-form-item label="物料名称">
<!-- 搜索 -->
<el-input
v-model="query.bullery"
v-model="query.material_name"
clearable
size="small"
placeholder="请输入配方或批次"
style="width: 250px;"
placeholder="请输入物料名称"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="配方">
<!-- 搜索 -->
<el-input
v-model="query.formula"
clearable
size="small"
placeholder="请输入配方"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="批次">
<!-- 搜索 -->
<el-input
v-model="query.pcsn"
clearable
size="small"
placeholder="请输入批次"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>

View File

@@ -0,0 +1,181 @@
<template>
<el-dialog
title="物料选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="1000px"
@close="close"
@open="open"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="物料名称">
<!-- 搜索 -->
<el-input
v-model="query.material_name"
clearable
size="small"
placeholder="请输入物料名称"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="配方">
<!-- 搜索 -->
<el-input
v-model="query.formula"
clearable
size="small"
placeholder="请输入配方"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="批次">
<!-- 搜索 -->
<el-input
v-model="query.pcsn"
clearable
size="small"
placeholder="请输入批次"
style="width: 180px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:cell-style="{'text-align':'center'}"
:header-cell-style="{background:'#f5f7fa',color:'#606266','text-align':'center'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column prop="formula" label="配方" />
<el-table-column prop="pcsn" label="批次" />
<el-table-column prop="machine" label="班组" />
<el-table-column v-if="false" prop="material_uuid" label="产品标识" />
<el-table-column prop="material_spec" label="产品规格" />
<el-table-column prop="material_code" label="产品编码" />
<el-table-column prop="material_name" label="产品名称" />
<el-table-column prop="label_code" label="最新标签码" width="150" show-overflow-tooltip/>
<el-table-column prop="dtl_count" label="打印次数" />
<el-table-column prop="stand_hour" label="静置小时" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'MaterDialog',
components: { rrOperation, pagination },
cruds() {
return CRUD({ title: '物料标签', url: 'api/materialLabel', optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
}
},
data() {
return {
dialogVisible: false,
tableRadio: null,
tableData: []
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
clickChange(item) {
this.tableRadio = item
},
open() {
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged3', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged3', this.rows)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -136,6 +136,20 @@
<el-form-item v-if="false" label="点位标识" prop="point_uuid">
<el-input v-model="form.point_uuid" style="width: 370px;" />
</el-form-item>
<el-form-item label="所属区域" prop="area_type">
<el-select
v-model="form.area_type"
placeholder="请选择"
style="width: 370px;"
:disabled="this.form.point_type1==='01'"
>
<el-option
v-for="item in dict.sch_area_type"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="点位编码" prop="point_code">
<el-input v-model="form.point_code" style="width: 370px;" :disabled="this.form.point_type1==='01'" />
</el-form-item>
@@ -172,33 +186,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="载具编码" prop="vehicle_code">
<el-form-item v-if="false" label="物料标签id">
<el-input v-model="form.label_uuid" style="width: 370px;" @focus="getMater" />
</el-form-item>
<el-form-item v-if="false" label="物料id">
<el-input v-model="form.material_uuid" style="width: 370px;" @focus="getMater" />
</el-form-item>
<el-form-item label="物料名称" v-if="form.point_status==='02' && form.point_type1==='01'">
<el-input v-model="form.material_name" style="width: 370px;" @focus="getMater" />
</el-form-item>
<el-form-item label="载具编码" prop="vehicle_code" v-if="form.point_status!=='00'">
<el-input v-model="form.vehicle_code" clearable style="width: 370px;" />
</el-form-item>
<el-form-item label="点位类型" prop="point_type1">
<el-radio-group v-model="form.point_type1">
<el-radio
v-for="item in dict.sch_point_type1"
:label="item.value"
:disabled="item.value==='01'"
>{{ item.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="所属区域" prop="area_type">
<el-select
v-model="form.area_type"
placeholder="请选择"
style="width: 370px;"
:disabled="this.form.point_type1==='01'"
>
<el-option
v-for="item in dict.sch_area_type"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" style="width: 370px;" rows="3" type="textarea" />
@@ -263,6 +262,7 @@
</template>
</el-table-column>
</el-table>
<MaterDialog :dialog-show.sync="materDialog" @tableChanged3="tableChanged"/>
<!--分页组件-->
<pagination />
</div>
@@ -276,6 +276,7 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import MaterDialog from '@/views/wms/sch/point/MaterLabelDialog'
const defaultForm = {
point_uuid: null,
@@ -292,7 +293,7 @@ const defaultForm = {
export default {
name: 'Point',
dicts: ['sch_point_type1', 'sch_area_type', 'sch_point_status', 'is_active', 'd_lock_type'],
components: { pagination, crudOperation, rrOperation, udOperation },
components: { MaterDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -315,13 +316,14 @@ export default {
data() {
return {
syncLoading: false,
materDialog: false,
options: [],
permission: {
add: ['admin', 'point:add'],
edit: ['admin', 'point:edit'],
del: ['admin', 'point:del']
},
dict_data: [],
rules: {
point_code: [
{ required: true, message: '点位编码不能为空', trigger: 'blur' }
@@ -345,6 +347,27 @@ export default {
}
}
},
watch: {
'form.area_type'(new_value, old_value) {
// 刚刷新时候直接返回
if (new_value === null || new_value === undefined || new_value === '') return
// 第一次改变的时候记录原本的值
if ((old_value === null || old_value === undefined || old_value === '') && this.dict_data.length === 0) {
for (const i in this.dict.sch_point_status) {
this.dict_data.push(this.dict.sch_point_status[i])
}
}
if (old_value === null || old_value === '') return
if (new_value === '04') {
this.dict.sch_point_status.length = 2
} else if (this.dict.sch_point_status.length < 3) { // 没有删过数据就不需要添加数据
this.dict.sch_point_status.length = 0 // 清空数据
for (const i in this.dict_data) {
this.dict.sch_point_status.push(this.dict_data[i])
}
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
@@ -392,8 +415,16 @@ export default {
}).catch(err => {
console.log(err.response.data.message)
})
},
getMater() {
this.materDialog = true
},
tableChanged(row) {
console.log(row)
this.form.label_uuid = row.label_uuid
this.form.material_uuid = row.material_uuid
this.form.material_name = row.material_name
}
}
}
</script>