rev:深坑相关

This commit is contained in:
zhangzhiqiang
2023-06-08 16:44:43 +08:00
parent 2292512476
commit b237b67f6b
13 changed files with 462 additions and 15 deletions

View File

@@ -28,6 +28,8 @@ import org.nl.wms.product_manage.sch.manage.AbstractAcsTask;
import org.nl.wms.product_manage.sch.service.TaskService;
import org.nl.wms.product_manage.sch.service.dto.TaskDto;
import org.nl.wms.product_manage.sch.tasks.WashMachineryTask;
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
import org.nl.wms.storage_manage.CHANGE_BILL_TYPE_ENUM;
@@ -60,6 +62,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
private CacheLineHandService cacheLineHandService;
@Autowired
private IPdmProduceWorkorderService workorderService;
@Autowired
private IPdmBiDeviceService deviceService;
@@ -139,7 +143,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
if (taskHandler!=null){
taskHandler.updateTaskStatus(row,status);
}
//发布一个任务执行事件
//发布一个任务执行事件:服务跟任务不一样,可以同事存在
TaskEvent event = TaskEvent.builder()
.task_id(task_id)
.task_type(taskDto.getTask_type())
@@ -261,8 +265,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
while (iterator.hasNext()){
String deviceCode = (String)iterator.next();
if (!StringUtils.isEmpty(deviceCode)){
String qty = String.valueOf(param.get(deviceCode));
deviceTab.update(MapOf.of("deviceinstor_qty",qty),"device_code = '"+deviceCode+"'");
Map item = (Map)param.get(deviceCode);
Object qty = item.get("qty");
Object weight = item.get("weight");
UpdateWrapper<PdmBiDevice> wrapper = new UpdateWrapper<>();
wrapper.set("deviceinstor_qty",qty);
if (weight!=null){
wrapper.set("deviceinstor_weight",weight);
}
wrapper.eq("device_code",deviceCode);
deviceService.update(wrapper);
}
}
}

View File

@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -78,14 +79,17 @@ public class AgvInstService {
Map query = MapOf.of("workprocedure_id", basePointService.getWorkprodureByCode(next.getId()).get("workprocedure_id")
, "qty", quantity,"spec",workprodure.get("spec"));
//判断缓存线是不是去深坑清洗深坑区域15个点判断空的物料坑位
List<Map<String,String>> collect = new ArrayList<>();
if (next.getName().equals("深坑清洗")){
query.put("material_id",task.getString("material_id"));
// query.put("qty",quantity) 深坑物料需要转重量
task.put("task_type",AcsTaskEnum.TASK_PRODUCT_WASH.getCode());
task.put("task_name",AcsTaskEnum.TASK_PRODUCT_WASH.getDesc());
query.put("material_id",task.getString("material_id"));
// query.put("qty",quantity) 深坑物料需要转重量
collect = deviceService.workproceduceDevicesWeight(query);
}else {
collect = deviceService.workproceduceDevicesQty(query);
}
List<Map<String,String>> collect = deviceService.workproceduceDevices(query);
log.info("调度任务分配点位信息:", JSON.toJSONString(collect));
List<Map<String, String>> list = collect.stream().filter(stringStringMap -> stringStringMap.get("tasks") == null || stringStringMap.get("materials").contains(task.getString("material_id"))).collect(Collectors.toList());
task.put("acs_task_type",AcsTaskEnum.ACS_TASK_TYPE_NOBLE_SINGLE_TASK.getCode());

View File

@@ -46,6 +46,7 @@ public class SpecialDeviceController {
@GetMapping("/query")
@ApiOperation("查询生产设备")
@Log("深坑物料")
@SaIgnore
public ResponseEntity<Object> query(DeviceQuery query,PageQuery page) {
Page<Map<String, Object>> list = iDeviceService.pageMaps(page.build(PdmBiDevice.class), query.build());

View File

@@ -202,7 +202,6 @@ public class SpeEmpTask extends AbstractAcsTask {
if (!("fall_finish"+task.getTask_id()).equals(device.getRemark())){
iDeviceService.update(new UpdateWrapper<PdmBiDevice>()
.set("material_id", task.getMaterial_id())
.set("deviceinstor_qty",device.getDeviceinstor_qty().add(task.getMaterial_qty()))
.set("remark","fall_finish"+task.getTask_id())
.eq("device_code", task.getPoint_code2()));
}

View File

@@ -265,7 +265,6 @@ public class SpeFullTask extends AbstractAcsTask {
if (!("fall_finish"+task.getTask_id()).equals(one.getRemark())){
deviceService.update(new UpdateWrapper<PdmBiDevice>()
.set("material_id", task.getMaterial_id())
.set("deviceinstor_qty",one.getDeviceinstor_qty().add(task.getMaterial_qty()))
.set("remark","fall_finish"+task.getTask_id())
.eq("device_code", task.getPoint_code2()));
}

View File

@@ -25,7 +25,8 @@ public interface IPdmBiDeviceService extends IService<PdmBiDevice> {
* @param param
* @return
*/
List<Map> workproceduceDevices(Map<String,Object> param);
List<Map> workproceduceDevicesQty(Map<String,Object> param);
List<Map> workproceduceDevicesWeight(Map<String,Object> param);
/**
* 根据点位查询对应设备

View File

@@ -98,6 +98,7 @@ public class PdmBiDevice implements Serializable {
* 设备实时来料仓数:用于数量校验
*/
private BigDecimal deviceinstor_qty;
private BigDecimal deviceinstor_weight;
/**
* 设备实时产品仓数

View File

@@ -19,7 +19,9 @@ public interface PdmBiDeviceMapper extends BaseMapper<PdmBiDevice> {
List<Map> getNotWorkDevice(Map<String,Object> query);
List<Map> workproceduceDevices(Map<String,Object> query);
List<Map> workproceduceDevicesQty(Map<String,Object> query);
List<Map> workproceduceDevicesWeight(Map<String,Object> query);
PdmBiDevice getDeviceByPoint(String pointCode);
}

View File

@@ -18,7 +18,7 @@
from PDM_produce_workOrder o
where '5' > o.workorder_status and o.is_delete = '0' )
</select>
<select id="workproceduceDevices" resultType="java.util.Map">
<select id="workproceduceDevicesQty" resultType="java.util.Map">
select
GROUP_CONCAT(sch_base_task.task_id) as tasks,GROUP_CONCAT(sch_base_task.material_id) as materials,
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty ), 0 ) - pdm_bi_device.deviceinstor_qty AS currentQty,
@@ -39,6 +39,30 @@
GROUP BY pdm_bi_device.device_code
HAVING currentQty > #{qty}
</select>
<select id="workproceduceDevicesWeight" resultType="java.util.Map">
select
GROUP_CONCAT(sch_base_task.task_id) as tasks,GROUP_CONCAT(sch_base_task.material_id) as materials,pdm_bi_device.inupperlimit_qty,pdm_bi_device.deviceinstor_weight,
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty*md_me_materialbase.net_weight), 0 ) - pdm_bi_device.deviceinstor_weight AS currentQty,
pdm_bi_device.device_code,
sch_base_point.point_code
from sch_base_point
left join pdm_bi_device on pdm_bi_device.device_code = sch_base_point.device_code
left JOIN sch_base_task ON sch_base_point.point_code = point_code2 and '7' > task_status
left join md_me_materialbase on sch_base_task.material_id = md_me_materialbase.material_id
where
sch_base_point.point_type = '4' and pdm_bi_device.is_used = true
and workprocedure_id = #{workprocedure_id}
<if test="material_id != null and material_id != ''">
and (pdm_bi_device.material_id = #{material_id} or pdm_bi_device.material_id is null or pdm_bi_device.material_id = '')
</if>
<if test="spec != null and spec != ''">
and (pdm_bi_device.spec = #{spec} or pdm_bi_device.spec is null)
</if>
GROUP BY pdm_bi_device.device_code
HAVING currentQty > #{qty}
</select>
<select id="getDeviceByPoint" resultType="org.nl.wms.product_manage.service.device.dao.PdmBiDevice">
select pdm_bi_device.* from pdm_bi_device
left join sch_base_point on sch_base_point.device_code = pdm_bi_device.device_code

View File

@@ -1,10 +1,15 @@
package org.nl.wms.product_manage.service.device.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import org.nl.wms.product_manage.service.device.dao.mapper.PdmBiDeviceMapper;
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -21,14 +26,27 @@ import java.util.Map;
@Service
public class PdmBiDeviceServiceImpl extends ServiceImpl<PdmBiDeviceMapper, PdmBiDevice> implements IPdmBiDeviceService {
@Autowired
private ISchBaseTaskService taskService;
@Autowired
protected IMdMeMaterialbaseService iMdMeMaterialbaseService; // 物料服务
@Override
public List<Map> getNotWorkDeviceByWorkproceduceId(JSONObject param) {
return this.baseMapper.getNotWorkDevice(param);
}
@Override
public List<Map> workproceduceDevices(Map<String, Object> param) {
return this.baseMapper.workproceduceDevices(param);
public List<Map> workproceduceDevicesQty(Map<String, Object> param) {
return this.baseMapper.workproceduceDevicesQty(param);
}
@Override
public List<Map> workproceduceDevicesWeight(Map<String, Object> param) {
//#{workprocedure_id} //material_id //#{qty}
MdMeMaterialbase one = iMdMeMaterialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", param.get("material_id")));
param.put("qty",one.getNet_weight().doubleValue()*(int)param.get("qty"));
return this.baseMapper.workproceduceDevicesWeight(param);
}
@Override

View File

@@ -68,6 +68,10 @@
<template slot-scope="scope">
<el-input v-model="scope.row.deviceinstor_qty" /></template>
</el-table-column>
<el-table-column prop="deviceinstor_weight" label="深坑物料数量" align="center" width="120px" show-overflow-tooltip>
<template slot-scope="scope">
<el-input v-model="scope.row.deviceinstor_weight" /></template>
</el-table-column>
<el-table-column prop="remark" label="备注" width="200px" show-overflow-tooltip />
<el-table-column label="操作" width="150px" align="center" fixed="right">
<template slot-scope="scope">
@@ -95,7 +99,7 @@ import pagination from '@crud/Pagination'
import rrOperation from '@crud/RR.operation'
import MaterDtl from '@/views/wms/pub/MaterDialog'
const defaultForm = { product_area: 'A1', workprocedure_id: '1535144552481034240', device_code: null, material_id: null, material_name: null, material_spec: null, deviceinstor_qty: null, remark: null }
const defaultForm = { product_area: 'A1', workprocedure_id: '1535144552481034240', device_code: null, material_id: null, material_name: null, material_spec: null, deviceinstor_qty: null, deviceinstor_weight: null, remark: null }
export default {
name: 'SKdevice',
@@ -131,6 +135,12 @@ export default {
this.nowindex = index
this.nowrow = row
},
updateSKMaterial(row) {
crudDevice.edit(row).then(() => {
this.notify('保存成功', 'success')
}).catch(() => {
})
},
setMaterValue(row) {
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code

View File

@@ -0,0 +1,93 @@
<template>
<el-dialog
title="发货单导入"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="true"
width="500px"
v-loading.fullscreen.lock="fullscreenLoading"
@close="close"
>
<div class="head-container">
<div>
<!-- 搜索 -->
<el-form ref="form" :model="form1" :rules="rules" size="mini" label-width="110px">
<el-form-item label="日期区间:" prop="createTime">
<el-date-picker
v-model="form.createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</el-form-item>
<el-form-item label="发货单号:" prop="bill_code">
<el-input v-model="form.bill_code" style="width: 350px;"/>
</el-form-item>
</el-form>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStruct">确认
</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import CRUD, {header, presenter} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import crudSap from '@/api/wms/ext/sap'
export default {
name: 'importOrder',
components: {rrOperation, pagination, DateRangePicker},
cruds() {
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
fullscreenLoading: false,
dialogVisible: false,
form: {}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
close() {
this.form = {}
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},
queryStruct() {
this.fullscreenLoading = true
if (this.form.createTime) {
this.form.date_begin = this.form.createTime[0]
this.form.date_end = this.form.createTime[1]
}
crudSap.getDeliveryNote(this.form).then(res => {
this.crud.notify(res.message, CRUD.NOTIFICATION_TYPE.SUCCESS)
this.fullscreenLoading = false
}).catch(() => {
this.fullscreenLoading = false
})
}
}
}
</script>

View File

@@ -0,0 +1,283 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<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.deliver_code" clearable placeholder="发货单号" style="width: 200px;"
class="filter-item"/>
</el-form-item>
<el-form-item label="物料搜索">
<el-input
v-model="query.material"
clearable
size="small"
placeholder="物料编码、名称或规格"
style="width: 200px;"
class="filter-item"
/>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00','23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<el-form-item label="状态">
<el-select
v-model="query.status"
style="width: 200px"
clearable
filterable
placeholder="请选择"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.PCS_DELI_STATUS"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="产品系列">
<treeselect
v-model="query.product_series"
:options="classes3"
:auto-load-root-options="false"
:load-options="loadChildNodes"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<el-form-item label="是否正常">
<el-select
v-model="query.is_success"
style="width: 200px"
clearable
filterable
placeholder="请选择"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.IS_OR_NOT"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation :crud="crud"/>
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
@click="importin"
>
同步
</el-button>
</crudOperation>
<!--表单组件-->
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0"
:title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;"
@selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55"/>
<el-table-column prop="deliver_code" label="发货单号"/>
<el-table-column prop="seq_no" label="明细序号"/>
<el-table-column prop="deliver_type" label="发货单类型" width="120">
<template slot-scope="scope">
{{ dict.label.PCS_DELIVER_TYPE[scope.row.deliver_type] }}
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码"/>
<el-table-column prop="material_name" label="物料名称"/>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
{{ dict.label.PCS_DELI_STATUS[scope.row.status] }}
</template>
</el-table-column>
<el-table-column prop="delivery_qty" label="发货数量"/>
<el-table-column prop="cust_code" label="客户编码"/>
<el-table-column prop="cust_coname" label="客户名称"/>
<el-table-column prop="unit_name" label="计量单位" show-overflow-tooltip min-width="150"/>
<el-table-column prop="sale_code" label="销售单号"/>
<el-table-column prop="sale_seq_no" label="销售明细序号" show-overflow-tooltip min-width="150"/>
<el-table-column prop="remark" label="备注" show-overflow-tooltip min-width="200"/>
<el-table-column prop="create_name" label="创建人"/>
<el-table-column prop="create_time" label="创建时间"/>
<el-table-column prop="update_optname" label="修改人"/>
<el-table-column prop="update_time" label="修改时间"/>
<!-- <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>-->
</el-table>
<!--分页组件-->
<pagination/>
</div>
<Dialog :dialog-show.sync="dialogShow"/>
</div>
</template>
<script>
import crudDeliveryOrder from '@/api/wms/pcs/deliveryOrder'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import Dialog from '@/views/wms/pcs/deliveryorder/Dialog'
import pagination from '@crud/Pagination'
import Treeselect, {LOAD_CHILDREN_OPTIONS} from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
const defaultForm = {
deliver_id: null,
deliver_code: null,
seq_no: null,
deliver_type: null,
material_id: null,
status: null,
delivery_qty: null,
cust_id: null,
qty_unit_id: null,
sale_id: null,
sale_code: null,
sale_seq_no: null,
create_id: null,
create_name: null,
create_time: null,
update_optid: null,
update_optname: null,
update_time: null,
cust_code: null,
cust_name: null
}
export default {
name: 'DeliveryOrder',
dicts: ['PCS_DELIVER_TYPE', 'PCS_DELI_STATUS'],
components: {pagination, crudOperation, rrOperation, udOperation, Treeselect, Dialog},
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '发货单', url: 'api/deliveryOrder', idField: 'deliver_id', sort: 'deliver_id,desc',
optShow: {
add: false,
edit: false,
del: false,
reset: true,
download: false
},
crudMethod: {...crudDeliveryOrder}
})
},
data() {
return {
classes3: [],
dialogShow: false,
permission: {},
rules: {},
queryTypeOptions: [
{key: 'deliver_code', display_name: '发货单号'}
]
}
},
created() {
this.initClass3()
},
methods: {
queryClassId() {
const param = {
'class_idStr': this.class_idStr
}
crudClassstandard.queryClassById(param).then(res => {
this.classes = res.content.map(obj => {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
importin() {
this.dialogShow = true
},
buildTree(classes) {
classes.forEach(data => {
if (data.children) {
this.buildTree(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null // 重点代码
}
})
},
// 获取子节点数据
loadChildNodes({action, parentNode, callback}) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({pid: parentNode.id}).then(res => {
parentNode.children = res.content.map(function (obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
initClass3() {
const param = {
parent_class_code: '07'
}
crudClassstandard.getClassType(param).then(res => {
const data = res.content
this.buildTree(data)
this.classes3 = data
})
},
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
}
}
}
</script>
<style scoped>
</style>