opt: 解包批量工单
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pm_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.annotation.Limit;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
@@ -82,4 +83,17 @@ public class PdmBdWorkorderController {
|
||||
public ResponseEntity<Object> getStockMaterial(PdmBdWorkorderQuery entity, PageQuery pageQuery) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBdWorkorderService.getStockMaterial(entity, pageQuery)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/batchAddOrders")
|
||||
@Log("批量新增工单")
|
||||
public ResponseEntity<Object> batchAddOrders(@RequestBody JSONObject entity) {
|
||||
pdmBdWorkorderService.batchAddOrders(entity);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getStockMaterial2")
|
||||
@Log("获取库存物料2")
|
||||
public ResponseEntity<Object> getStockMaterial2(PdmBdWorkorderQuery entity, PageQuery pageQuery) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(pdmBdWorkorderService.getStockMaterial2(entity, pageQuery)), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public interface IPdmBdWorkorderService extends IService<PdmBdWorkorder> {
|
||||
* @return
|
||||
*/
|
||||
IPage<GroupPlate> getStockMaterial(PdmBdWorkorderQuery entity, PageQuery pageQuery);
|
||||
IPage<GroupPlate> getStockMaterial2(PdmBdWorkorderQuery entity, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 开工
|
||||
@@ -86,4 +87,6 @@ public interface IPdmBdWorkorderService extends IService<PdmBdWorkorder> {
|
||||
void submits(PdmBdWorkorder entity);
|
||||
|
||||
void loadComplete(PdmBdWorkorder entity);
|
||||
|
||||
void batchAddOrders(JSONObject entity);
|
||||
}
|
||||
|
||||
@@ -15,4 +15,5 @@ public interface PdmBdWorkorderMapper extends BaseMapper<PdmBdWorkorder> {
|
||||
IPage<PdmBdWorkorder> selectPageLeftJoin(IPage<PdmBdWorkorder> pages, PdmBdWorkorderQuery query);
|
||||
|
||||
IPage<GroupPlate> selectUseMaterialPageLeftJoin(IPage<GroupPlate> pages, PdmBdWorkorderQuery query);
|
||||
IPage<GroupPlate> selectUseMaterialPageLeftJoin2(IPage<GroupPlate> pages, PdmBdWorkorderQuery query);
|
||||
}
|
||||
|
||||
@@ -52,5 +52,32 @@
|
||||
#{query.blurry}, '%'))
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectUseMaterialPageLeftJoin2"
|
||||
resultType="org.nl.wms.warehouse_manage.service.dao.GroupPlate">
|
||||
SELECT
|
||||
mg.*,
|
||||
ss.struct_code,
|
||||
mm.material_code,
|
||||
mm.material_name,
|
||||
mm.material_spec
|
||||
FROM
|
||||
`md_pb_groupplate` mg
|
||||
LEFT JOIN st_ivt_structattr ss ON ss.storagevehicle_code = mg.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase mm ON mm.material_id = mg.material_id
|
||||
WHERE mg.`status` = '02' AND mg.frozen_qty = 0 AND IFNULL(mg.storagevehicle_code,'') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(ss.struct_code,'') <![CDATA[ <> ]]> ''
|
||||
AND 0 = (SELECT COUNT(*) FROM pdm_bd_workorder po WHERE po.raw_material_code = mg.storagevehicle_code AND po.workorder_status <![CDATA[ <> ]]> '5')
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
AND ss.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
<if test="query.blurry != null and query.blurry != ''">
|
||||
AND (mm.material_code LIKE CONCAT('%', #{query.blurry}, '%') OR mm.material_name LIKE CONCAT('%',
|
||||
#{query.blurry}, '%'))
|
||||
</if>
|
||||
AND 0 = (SELECT COUNT(*)
|
||||
FROM pdm_bd_workorder o
|
||||
WHERE o.workorder_status <![CDATA[ < ]]> 5
|
||||
AND o.struct_code = ss.struct_code)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.pm_manage.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -36,6 +37,7 @@ import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -170,6 +172,12 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
||||
pages = pdmBdWorkorderMapper.selectUseMaterialPageLeftJoin(pages, query);
|
||||
return pages;
|
||||
}
|
||||
@Override
|
||||
public IPage<GroupPlate> getStockMaterial2(PdmBdWorkorderQuery query, PageQuery page) {
|
||||
IPage<GroupPlate> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = pdmBdWorkorderMapper.selectUseMaterialPageLeftJoin2(pages, query);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submits(PdmBdWorkorder entity) {
|
||||
@@ -196,6 +204,54 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
|
||||
updateById(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchAddOrders(JSONObject entity) {
|
||||
log.info("{}", entity);
|
||||
List<PdmBdWorkorder> orders = new ArrayList<>();
|
||||
JSONArray materials = entity.getJSONArray("materials");
|
||||
for (int i = 0; i < materials.size(); i++) {
|
||||
JSONObject material = materials.getJSONObject(i);
|
||||
PdmBdWorkorder order = new PdmBdWorkorder();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
String today = DateUtil.format(DateUtil.date(), "yyyyMMdd");
|
||||
// 点位编码和点位名称为父点位
|
||||
order.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
order.setWorkorder_code(CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
order.setPlan_qty(entity.getBigDecimal("plan_qty"));
|
||||
order.setVehicle_type(entity.getString("vehicle_type"));
|
||||
order.setRegion_code(entity.getString("region_code"));
|
||||
order.setRegion_name(entity.getString("region_name"));
|
||||
order.setPoint_code(entity.getString("point_code"));
|
||||
order.setPoint_name(entity.getString("point_name"));
|
||||
order.setPlanproducestart_date(entity.getString("planproducestart_date"));
|
||||
order.setPlanproduceend_date(entity.getString("planproduceend_date"));
|
||||
order.setMaterial_id(material.getString("material_id"));
|
||||
order.setMaterial_name(material.getString("material_name"));
|
||||
order.setMaterial_spec(material.getString("material_spec"));
|
||||
order.setMaterial_code(material.getString("material_code"));
|
||||
order.setStruct_code(material.getString("struct_code"));
|
||||
order.setRaw_material_code(material.getString("storagevehicle_code"));
|
||||
order.setPlan_weight(material.getBigDecimal("qty"));
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("pcsn", material.getString("pcsn"));
|
||||
data.put("supp_code", material.getString("supp_code"));
|
||||
data.put("supp_name", material.getString("supp_name"));
|
||||
order.setExt_data(JSONObject.toJSONString(data));
|
||||
order.setCreate_id(currentUserId);
|
||||
order.setCreate_name(nickName);
|
||||
order.setCreate_time(now);
|
||||
order.setTeam(CommonUtils.getDayShift());
|
||||
order.setProduce_date(today);
|
||||
order.setUpdate_id(currentUserId);
|
||||
order.setUpdate_name(nickName);
|
||||
order.setUpdate_time(now);
|
||||
orders.add(order);
|
||||
}
|
||||
this.saveBatch(orders);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工单是否下发、当天工单
|
||||
* 判断逻辑不能过于复杂,因此提取出来
|
||||
|
||||
@@ -77,10 +77,10 @@
|
||||
@select-all="onSelectAll"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" />
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" :selectable="checkSelectable"/>
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
|
||||
<el-radio v-model="tableRadio" :label="scope.row" :disabled="scope.row.struct_code !== 'YL'"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||
@@ -123,7 +123,7 @@ export default {
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生产任务',
|
||||
url: 'api/pdmBdWorkorder/getStockMaterial',
|
||||
url: 'api/pdmBdWorkorder/getStockMaterial2',
|
||||
optShow: {},
|
||||
query: {
|
||||
is_used: true
|
||||
@@ -202,6 +202,9 @@ export default {
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', this.rows, this.flag)
|
||||
},
|
||||
checkSelectable(row, index) {
|
||||
return row.struct_code !== 'YL'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
<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"
|
||||
>
|
||||
<el-form-item label="仓库">
|
||||
<el-select
|
||||
v-model="query.stor_id"
|
||||
clearable
|
||||
placeholder="仓库"
|
||||
class="filter-item"
|
||||
style="width: 210px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料名称">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="物料名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="物料规格">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="query.material_spec"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="mini"-->
|
||||
<!-- placeholder="物料名称"-->
|
||||
<!-- @keyup.enter.native="crud.toQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="物料型号">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="query.material_model"-->
|
||||
<!-- clearable-->
|
||||
<!-- size="mini"-->
|
||||
<!-- placeholder="物料名称"-->
|
||||
<!-- @keyup.enter.native="crud.toQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item :label="queryInfo">-->
|
||||
<!-- <el-button icon="el-icon-sort" circle @click="queryMaterials"></el-button>-->
|
||||
<!-- </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"
|
||||
@current-change="clickChange"
|
||||
>
|
||||
<el-table-column v-if="!isSingle" type="selection" width="55" :selectable="checkSelectable"/>
|
||||
<el-table-column v-if="isSingle" label="选择" width="55">
|
||||
<template slot-scope="scope">
|
||||
<el-radio v-model="tableRadio" :label="scope.row" :disabled="scope.row.struct_code === 'YL'"><i /></el-radio>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="pcsn" label="物料批次" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="struct_code" label="仓位编码" width="160" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具编码" width="160" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" width="160" />
|
||||
<el-table-column prop="supp_name" label="供应商" width="160" />
|
||||
<el-table-column prop="material_spec" label="物料规格" width="140" />
|
||||
<!-- <el-table-column prop="material_model" label="物料型号" width="140" />-->
|
||||
<el-table-column prop="update_name" label="修改人" />
|
||||
<el-table-column prop="update_time" label="修改时间" width="135" />
|
||||
</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'
|
||||
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
export default {
|
||||
name: 'MaterialDialog2',
|
||||
components: { rrOperation, pagination },
|
||||
dicts: ['is_used'],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生产任务',
|
||||
url: 'api/pdmBdWorkorder/getStockMaterial2',
|
||||
optShow: {},
|
||||
query: {
|
||||
is_used: true
|
||||
}
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isSingle: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
flag: {
|
||||
type: Number,
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableRadio: null,
|
||||
tableData: [],
|
||||
queryInfo: '物料顺序',
|
||||
queryFlag: false,
|
||||
storlist: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickChange(item) {
|
||||
this.tableRadio = item
|
||||
},
|
||||
open() {
|
||||
crudBsrealstorattr.getStor().then(res => {
|
||||
this.storlist = res
|
||||
})
|
||||
},
|
||||
handleSelectionChange(val, row) {
|
||||
this.checkrow = row
|
||||
},
|
||||
onSelectAll() {
|
||||
this.$refs.table.clearSelection()
|
||||
},
|
||||
close() {
|
||||
this.storlist = []
|
||||
this.crud.resetQuery(false)
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
submit() {
|
||||
// 处理单选
|
||||
if (this.isSingle && this.tableRadio) {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('tableChanged', 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('tableChanged', this.rows)
|
||||
},
|
||||
checkSelectable(row, index) {
|
||||
return row.struct_code === 'YL'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="批量创建工单"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="900px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form
|
||||
ref="form"
|
||||
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
|
||||
:inline="true"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="mini"
|
||||
label-width="135px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="计划开始时间" prop="planproducestart_date">
|
||||
<el-date-picker
|
||||
v-model="form.planproducestart_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划结束时间" prop="planproduceend_date">
|
||||
<el-date-picker
|
||||
v-model="form.planproduceend_date"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
style="width: 240px;"
|
||||
placeholder="选择日期时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划数量" prop="plan_qty">
|
||||
<el-input-number
|
||||
v-model.number="form.plan_qty"
|
||||
:disabled="true"
|
||||
:min="1"
|
||||
style="width: 240px;"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属工序" prop="region_code">
|
||||
<el-select
|
||||
v-model="form.region_code"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
@change="setRegionName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in regionList"
|
||||
:key="item.region_code"
|
||||
:label="item.region_code"
|
||||
:value="item.region_code"
|
||||
>
|
||||
<span style="float: left">{{ item.region_name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.region_code }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工序名称">
|
||||
<el-input v-model="form.region_name" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编码" prop="point_code">
|
||||
<el-select
|
||||
v-model="form.point_code"
|
||||
filterable
|
||||
placeholder="请选择"
|
||||
style="width: 240px;"
|
||||
@change="setPointName"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in pointList"
|
||||
:key="item.point_code"
|
||||
:label="item.point_code"
|
||||
:value="item.point_code"
|
||||
>
|
||||
<span style="float: left">{{ item.point_name }}</span>
|
||||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.point_code }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称">
|
||||
<el-input v-model="form.point_name" style="width: 240px;" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具类型">
|
||||
<el-select
|
||||
v-model="form.vehicle_type"
|
||||
clearable
|
||||
:disabled="true"
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
style="width: 240px;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.storagevehicle_type"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="crud-opts2">
|
||||
<span class="role-span">物料信息</span>
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left" />
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="openAdd()"
|
||||
>
|
||||
添加物料
|
||||
</el-button>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<el-table
|
||||
ref="table"
|
||||
:data="form.materials"
|
||||
style="width: 100%;"
|
||||
border
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column prop="material_code" label="物料编码" width="160" />
|
||||
<el-table-column prop="material_name" label="物料名称" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="pcsn" label="物料批次" width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="material_spec" label="物料规格" width="140" />
|
||||
<el-table-column prop="qty" label="重量" width="140" />
|
||||
<el-table-column prop="struct_code" label="仓位编码" width="160" />
|
||||
<el-table-column prop="storagevehicle_code" label="载具编码" width="160" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" width="160" />
|
||||
<el-table-column prop="supp_name" label="供应商" width="160" />
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
<MaterialDialog2
|
||||
:dialog-show.sync="materialDialog"
|
||||
:is-single="false"
|
||||
@tableChanged="tableChanged"
|
||||
/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudPdmBdWorkorder from './pdmBdWorkorder'
|
||||
import crudSchBaseRegion from '@/views/wms/sch/region/schBaseRegion'
|
||||
import crudSchBasePoint from '@/views/wms/sch/point/schBasePoint'
|
||||
import MaterialDialog2 from './MaterialDialog2.vue'
|
||||
export default {
|
||||
name: 'BatchAddDialog',
|
||||
components: { MaterialDialog2 },
|
||||
dicts: ['storagevehicle_type', 'pdm_workorder_status'],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableRadio: null,
|
||||
tableData: [],
|
||||
queryInfo: '物料顺序',
|
||||
queryFlag: false,
|
||||
materialDialog: false,
|
||||
storlist: [],
|
||||
regionList: [],
|
||||
pointList: [],
|
||||
form: {
|
||||
plan_qty: null,
|
||||
vehicle_type: null,
|
||||
planproducestart_date: null,
|
||||
planproduceend_date: null,
|
||||
point_code: null,
|
||||
point_name: null,
|
||||
region_code: null,
|
||||
region_name: null,
|
||||
materials: []
|
||||
},
|
||||
rules: {
|
||||
plan_qty: [
|
||||
{ required: true, message: '计划数量不能为空', trigger: 'blur' }
|
||||
],
|
||||
planproducestart_date: [
|
||||
{ required: true, message: '计划开始不能为空', trigger: 'change' }
|
||||
],
|
||||
planproduceend_date: [
|
||||
{ required: true, message: '计划结束不能为空', trigger: 'change' }
|
||||
],
|
||||
point_code: [
|
||||
{ required: true, message: '设备编码不能为空', trigger: 'change' }
|
||||
],
|
||||
region_code: [
|
||||
{ required: true, message: '区域编码不能为空', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.form = {
|
||||
plan_qty: null,
|
||||
vehicle_type: null,
|
||||
planproducestart_date: null,
|
||||
planproduceend_date: null,
|
||||
point_code: null,
|
||||
point_name: null,
|
||||
region_code: null,
|
||||
region_name: null,
|
||||
materials: []
|
||||
}
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
open() {
|
||||
this.getRegionList()
|
||||
this.$emit('update:dialogShow', true)
|
||||
},
|
||||
submit() {
|
||||
// 传到后端
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
crudPdmBdWorkorder.batchAddOrders(this.form).then(res => {
|
||||
this.$message({
|
||||
message: '新增成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.dialogVisible = false
|
||||
})
|
||||
} else {
|
||||
console.log('error submit!!')
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
getRegionList() {
|
||||
const param = {
|
||||
is_has_workder: true
|
||||
}
|
||||
crudSchBaseRegion.getRegionList(param).then(res => {
|
||||
this.regionList = res
|
||||
})
|
||||
},
|
||||
getPointList() { // 获取点位列表
|
||||
if (this.regionCodeParam) {
|
||||
const param = {
|
||||
region_code: this.regionCodeParam
|
||||
}
|
||||
crudSchBasePoint.getPointList2(param).then(res => {
|
||||
this.pointList = res
|
||||
this.regionCodeParam = null
|
||||
})
|
||||
}
|
||||
},
|
||||
setRegionName(data) {
|
||||
// 清空
|
||||
this.form.point_code = null
|
||||
this.form.point_name = null
|
||||
this.regionCodeParam = data
|
||||
var region = this.regionList.find(item => item.region_code === data)
|
||||
this.form.region_name = region.region_name
|
||||
this.getPointList()
|
||||
},
|
||||
setPointName(data) {
|
||||
var point = this.pointList.find(item => item.point_code === data)
|
||||
this.form.point_name = point.point_name
|
||||
this.form.vehicle_type = point.can_vehicle_type
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.materials = row
|
||||
},
|
||||
openAdd() {
|
||||
this.materialDialog = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.crud-opts2 {
|
||||
padding: 0 0 0 10px;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
padding: 4px 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -61,6 +61,16 @@
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="openBatchAdd()"
|
||||
>
|
||||
批量建单
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
@@ -449,8 +459,12 @@
|
||||
<MaterialDialog
|
||||
:dialog-show.sync="materialDialog"
|
||||
:flag="flag"
|
||||
:is-single="true"
|
||||
@tableChanged="tableChanged"
|
||||
/>
|
||||
<batch-add-dialog
|
||||
:dialog-show.sync="batchAdd"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -465,6 +479,7 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import item from '@/layout/components/Sidebar/Item.vue'
|
||||
import MaterialDialog from '../workerorder/MaterialDialog.vue'
|
||||
import BatchAddDialog from './batchAddDialog.vue'
|
||||
|
||||
const defaultForm = {
|
||||
workorder_id: null,
|
||||
@@ -510,7 +525,7 @@ const defaultForm = {
|
||||
export default {
|
||||
name: 'PdmBdWorkorder',
|
||||
dicts: ['storagevehicle_type', 'pdm_workorder_status'],
|
||||
components: { MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
components: { BatchAddDialog, MaterialDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
@@ -565,6 +580,7 @@ export default {
|
||||
regionCodeParam: null,
|
||||
materialDialog: false,
|
||||
orderDialog: false,
|
||||
batchAdd: false,
|
||||
fullscreenLoading: false,
|
||||
materialCode: null,
|
||||
flag: 1
|
||||
@@ -585,6 +601,10 @@ export default {
|
||||
},
|
||||
getWorkShopList() { // 获取车间列表
|
||||
|
||||
},
|
||||
openBatchAdd() {
|
||||
console.log('111')
|
||||
this.batchAdd = true
|
||||
},
|
||||
getRegionList() { // 获取区域列表
|
||||
const param = {
|
||||
|
||||
@@ -68,5 +68,12 @@ export function getCuster() {
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
export function batchAddOrders(data) {
|
||||
return request({
|
||||
url: 'api/pdmBdWorkorder/batchAddOrders',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, submits, loadComplete, forceFinish, orderSynchronize, queryMaterials, getCuster }
|
||||
export default { add, edit, del, submits, loadComplete, forceFinish, orderSynchronize, queryMaterials, getCuster, batchAddOrders }
|
||||
|
||||
Reference in New Issue
Block a user