Browse Source

add PDA送空

master
张江玮 2 years ago
parent
commit
65734963c5
  1. 17
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  2. 18
      lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java
  3. 8
      lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java
  4. 129
      lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  5. 5
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java
  6. 1
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java
  7. 5
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql
  8. 18
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java
  9. BIN
      lms/nladmin-system/src/main/java/org/nl/wms/wms.xls
  10. 8
      lms/nladmin-ui/src/utils/nladmin.js
  11. 58
      lms/nladmin-ui/src/views/wms/pdm/device/index.vue
  12. 4
      lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue
  13. 1
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue
  14. 5
      lms/nladmin-ui/src/views/wms/pub/DeviceDialog.vue

17
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -25,6 +25,7 @@ import org.nl.wms.sch.task.call.empty.GTKCallEmptyTask;
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
import org.nl.wms.sch.task.call.material.SZCallMaterialTask;
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
@ -75,6 +76,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final YZSendEmptyTask yzSendEmptyTask;
private final SZCallMaterialTask szCallMaterialTask;
/**
* task_id任务标识
* task_code任务编码
@ -313,14 +316,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break;
case "2":
// 叫料
JSONObject workorder = TaskUtils.hasWorkOrder(point);
method_param.put("workorder", workorder);
switch (region) {
case YZ:
JSONObject workorder = TaskUtils.hasWorkOrder(point);
method_param.put("workorder", workorder);
task_code = yzCallMaterialTask.createTask(method_param);
break;
case SZ:
task_code = szCallMaterialTask.createTask(method_param);
break;
case FJ:
workorder = TaskUtils.hasWorkOrder(point);
method_param.put("workorder", workorder);
task_code = fjCallMaterialTask.createTask(method_param);
break;
default:
@ -329,7 +336,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break;
case "3":
// 送空
workorder = WQLObject
JSONObject workorder = WQLObject
.getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'")
.uniqueResult(0);
@ -347,6 +354,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
JSONObject vd_update = new JSONObject();
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
TaskUtils.addACSUpdateColum(vd_update);
WQLObject
.getWQLObject("st_ivt_vehicle_detail")
.update(vd_update, "vehicle_type = " + vehicle_type + " AND vehicle_code = '" + vehicle_code + "'");
@ -364,6 +372,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
method_param.put("vehicle_code", vehicle_code);
vd_update = new JSONObject();
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
TaskUtils.addACSUpdateColum(vd_update);
WQLObject
.getWQLObject("st_ivt_vehicle_detail")
.update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'");

18
lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java

@ -140,4 +140,22 @@ public class PdaController {
pdaService.callMaterial(point_code, param.toJSONString());
return PdaUtils.buildSuccessResultJSON(null);
}
@PostMapping("/sendEmpty")
@Log("送空")
@ApiOperation("送空")
@PdaAnnotation
public JSONObject sendEmpty(@RequestBody JSONObject param) {
String point_code = param.getString("point_code");
if (StrUtil.isBlank(point_code)) {
throw new BadRequestException("点位编码不能为空!");
}
String vehicle_code = param.getString("vehicle_code");
if (StrUtil.isBlank(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
pdaService.sendEmpty(point_code, vehicle_code, param.toJSONString());
return PdaUtils.buildSuccessResultJSON(null);
}
}

8
lms/nladmin-system/src/main/java/org/nl/wms/pda/service/PdaService.java

@ -61,4 +61,12 @@ public interface PdaService {
* @param point_code 点位编码
*/
void callMaterial(String point_code, String request_param);
/**
* 送空
*
* @param point_code 点位编码
* @param vehicle_code 载具编码
*/
void sendEmpty(String point_code, String vehicle_code, String request_param);
}

129
lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -13,12 +13,16 @@ import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.pda.service.PdaService;
import org.nl.wms.sch.manage.ACSSystem;
import org.nl.wms.sch.manage.CreateMode;
import org.nl.wms.sch.manage.PointStatus;
import org.nl.wms.sch.manage.Region;
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
import org.nl.wms.sch.task.send.material.FJSendMaterialTask;
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
@ -45,19 +49,31 @@ public class PdaServiceImpl implements PdaService {
private final FJCallMaterialTask fjCallMaterialTask;
private final YZSendEmptyTask yzSendEmptyTask;
private final FJSendEmptyTask fjSendEmptyTask;
@Override
public JSONArray region(String func) {
switch (func) {
case "send_material":
// 送料
case "call_material":
// 送料
return WQL
.getWO("PDA")
.addParam("flag", "1")
.addParam("where", "('HL', 'YZ', 'FJ')")
.process()
.getResultJSONArray(0);
case "call_material":
// 叫料
case "send_empty":
// 送空
return WQL
.getWO("PDA")
.addParam("flag", "1")
.addParam("where", "('YZ', 'FJ')")
.process()
.getResultJSONArray(0);
default:
throw new BadRequestException("未知功能!");
}
@ -131,6 +147,36 @@ public class PdaServiceImpl implements PdaService {
default:
throw new BadRequestException(region.label() + "没有叫料点位!");
}
case "send_empty":
// 送空
switch (region) {
case YZ:
JSONArray result = WQL
.getWO("PDA")
.addParam("flag", "2")
.addParam("region_code", region_code)
.addParam("point_type", "('2', '3')")
.process()
.getResultJSONArray(0);
result.addAll(WQL
.getWO("PDA")
.addParam("flag", "2")
.addParam("region_code", Region.KLHJ.value())
.addParam("point_type", "('3')")
.process()
.getResultJSONArray(0));
return result;
case FJ:
return WQL
.getWO("PDA")
.addParam("flag", "2")
.addParam("region_code", region_code)
.addParam("point_type", "('1')")
.process()
.getResultJSONArray(0);
default:
throw new BadRequestException(region.label() + "没有送空点位!");
}
default:
throw new BadRequestException("未知功能!");
}
@ -174,11 +220,11 @@ public class PdaServiceImpl implements PdaService {
TaskUtils.isLocked(point);
JSONObject workorder = TaskUtils.hasWorkOrder(point);
String vehicle_type = workorder.getString("vehicle_type");
String device_code = workorder.getString("device_code");
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
JSONObject vd_update = new JSONObject();
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
vd_table.update(vd_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'");
TaskUtils.addCurrentUpdateColum(vd_update);
vd_table.update(vd_update, "is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'");
// 组盘
JSONObject vd = new JSONObject();
@ -191,17 +237,25 @@ public class PdaServiceImpl implements PdaService {
vd.put("is_full", is_full);
vd.put("workorder_id", workorder.getString("workorder_id"));
vd.put("point_code", point_code);
vd.put("create_id", SecurityUtils.getCurrentUserId());
vd.put("create_name", SecurityUtils.getCurrentNickName());
Long user_id = SecurityUtils.getCurrentUserId();
vd.put("create_id", user_id);
String nick_name = SecurityUtils.getCurrentNickName();
vd.put("create_name", nick_name);
vd.put("create_time", DateUtil.now());
vd.put("is_delete", "0");
if (device_code.startsWith("FJ")) {
vd.put("is_delete", TrueOrFalse.FALSE.value());
String region_code = point.getString("region_code");
vd.put("is_fire", TrueOrFalse.FALSE.value());
if (Region.FJ.value().equals(region_code)) {
vd.put("is_fire", TrueOrFalse.TRUE.value());
}
vd.put("is_in_kiln", TrueOrFalse.trueOrFalse(is_full) ? TrueOrFalse.TRUE.value() : TrueOrFalse.FALSE.value());
if (device_code.startsWith("FJ")) {
vd.put("is_in_kiln", is_full);
if (Region.FJ.value().equals(region_code)) {
vd.put("is_in_kiln", TrueOrFalse.FALSE.value());
}
if (Region.FJ.value().equals(region_code)) {
vd.put("is_package", TrueOrFalse.TRUE.value());
}
vd_table.insert(vd);
Region region = Region.get(point.getString("region_code"));
@ -211,8 +265,8 @@ public class PdaServiceImpl implements PdaService {
method_param.put("vd", vd);
method_param.put("create_mode", CreateMode.SCCJ.value());
method_param.put("request_param", request_param);
method_param.put("create_id", SecurityUtils.getCurrentUserId());
method_param.put("create_name", SecurityUtils.getCurrentNickName());
method_param.put("create_id", user_id);
method_param.put("create_name", nick_name);
switch (region) {
case HL:
@ -250,6 +304,7 @@ public class PdaServiceImpl implements PdaService {
method_param.put("create_name", SecurityUtils.getCurrentNickName());
switch (region) {
case KLHJ:
case YZ:
yzCallMaterialTask.createTask(method_param);
break;
@ -260,4 +315,54 @@ public class PdaServiceImpl implements PdaService {
throw new BadRequestException("[" + region.label() + "] 不能发起叫料任务!");
}
}
@Override
public void sendEmpty(String point_code, String vehicle_code, String request_param) {
JSONObject point = WQLObject
.getWQLObject("sch_base_point")
.query("is_used = '1' AND point_code = '" + point_code + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(point)) {
throw new BadRequestException("[" + point_code + "] 已删除或未启用!");
}
JSONObject workorder = WQLObject
.getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'")
.uniqueResult(0);
Region region = Region.get(point.getString("region_code"));
JSONObject method_param = new JSONObject();
method_param.put("point", point);
method_param.put("workorder", workorder);
method_param.put("create_mode", CreateMode.SCCJ.value());
method_param.put("request_param", request_param);
method_param.put("create_id", SecurityUtils.getCurrentUserId());
method_param.put("create_name", SecurityUtils.getCurrentNickName());
switch (region) {
case KLHJ:
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
point.put("vehicle_type", VehicleType.CUP.value());
point.put("vehicle_code", vehicle_code);
point.put("point_status", PointStatus.NOT_EMPTY.value());
TaskUtils.addCurrentUpdateColum(point);
point_table.update(point);
JSONObject point_update = new JSONObject();
point_update.put("vehicle_type", "");
point_update.put("vehicle_code", "");
point_update.put("point_status", PointStatus.EMPTY.value());
TaskUtils.addCurrentUpdateColum(point_update);
point_table.update(point_update, "region_code = 'KLHJ' AND point_type = '2' AND vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'");
case YZ:
yzSendEmptyTask.createTask(method_param);
break;
case FJ:
method_param.put("vehicle_code", vehicle_code);
fjSendEmptyTask.createTask(method_param);
break;
default:
throw new BadRequestException("[" + region.label() + "] 不能发起送空任务!");
}
}
}

5
lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/DeviceDto.java

@ -77,4 +77,9 @@ public class DeviceDto implements Serializable {
* 设备产能
*/
private BigDecimal productivity;
/**
* 是否工单设备
*/
private String is_workorder;
}

1
lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java

@ -46,6 +46,7 @@ public class DeviceServiceImpl implements DeviceService {
if (!StrUtil.isEmpty(search)) {
map.put("search", "%" + search + "%");
}
map.put("is_workorder", MapUtil.getStr(whereJson, "is_workorder"));
map.put("region_str", MapUtil.getStr(whereJson, "region_str"));
JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_model ASC, device.device_code ASC");
return json;

5
lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/PDM_BI_DEVICE01.wql

@ -16,6 +16,7 @@
输入.flag TYPEAS s_string
输入.search TYPEAS s_string
输入.region_str TYPEAS f_string
输入.is_workorder TYPEAS s_string
[临时表]
@ -58,7 +59,9 @@
OPTION 输入.region_str <> ""
device.region_code IN 输入.region_str
ENDOPTION
OPTION 输入.is_workorder <> ""
device.is_workorder = 输入.is_workorder
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

18
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java

@ -22,24 +22,6 @@ import org.springframework.stereotype.Component;
public class SZCallMaterialTask extends AbstractAcsTask {
@Override
public void autoCreate() {
JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "2").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(points) && !points.isEmpty()) {
JSONObject form = new JSONObject();
form.put("create_mode", CreateMode.ZDSC.value());
form.put("create_id", AutoCreate.id);
form.put("create_name", AutoCreate.nick_name);
form.put("request_param", "auto");
for (int i = 0; i < points.size(); i++) {
JSONObject point = points.getJSONObject(i);
form.put("point", point);
this.createTask(form);
}
}
}
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {

BIN
lms/nladmin-system/src/main/java/org/nl/wms/wms.xls

Binary file not shown.

8
lms/nladmin-ui/src/utils/nladmin.js

@ -234,14 +234,16 @@ export async function blobValidate(data) {
* prop,title有一个必传
*/
export function flexWidth(prop, tableData, title, num = 0) {
if (tableData.length === 0) { // 表格没数据不做处理
return
}
let flexWidth = 0// 初始化表格列宽
let columnContent = ''// 占位最宽的内容
const canvas = document.createElement('canvas')
const context = canvas.getContext('2d')
context.font = '14px Microsoft YaHei'
if (tableData.length === 0) { // 表格没数据采用标题
const width = context.measureText(title)
flexWidth = width.width + 20 + num
return flexWidth + 'px'
}
// 获取占位最宽的内容
let index = 0
for (let i = 0; i < tableData.length; i++) { // 循环表格内容,获取表格内容中最长的数据

58
lms/nladmin-ui/src/views/wms/pdm/device/index.vue

@ -33,7 +33,7 @@
:title="crud.status.title"
width="600px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="160px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="160px" label-suffix="">
<el-form-item label="设备编码" prop="device_code">
<el-input v-model="form.device_code" :disabled="crud.status.edit" style="width: 300px" />
</el-form-item>
@ -44,7 +44,6 @@
<el-select
v-model="form.region_code"
placeholder="所属区域"
class="filter-item"
style="width: 300px"
clearable
>
@ -60,7 +59,6 @@
<el-select
v-model="form.device_model"
placeholder="设备类型"
class="filter-item"
style="width: 300px"
clearable
>
@ -75,6 +73,10 @@
<el-form-item label="设备产能">
<el-input v-model="form.productivity" type="number" style="width: 300px" />
</el-form-item>
<el-form-item label="是否工单设备" prop="is_workorder">
<el-radio v-model="form.is_workorder" label="1"></el-radio>
<el-radio v-model="form.is_workorder" label="0"></el-radio>
</el-form-item>
<el-form-item label="外部编码">
<el-input v-model="form.extend_code" style="width: 300px" />
</el-form-item>
@ -97,16 +99,46 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="device_code" label="设备编码" :min-width="flexWidth('device_code',crud.data,'设备编码')" />
<el-table-column prop="device_name" label="设备名称" :min-width="flexWidth('device_name',crud.data,'设备名称')" />
<el-table-column prop="region_name" label="所属区域" :min-width="flexWidth('region_name',crud.data,'所属区域')" />
<el-table-column prop="device_model" label="设备类型" :min-width="flexWidth('device_model',crud.data,'设备类型')">
<el-table-column
prop="device_code"
label="设备编码"
:min-width="flexWidth('device_code',crud.data,'设备编码')"
/>
<el-table-column
prop="device_name"
label="设备名称"
:min-width="flexWidth('device_name',crud.data,'设备名称')"
/>
<el-table-column
prop="region_name"
label="所属区域"
:min-width="flexWidth('region_name',crud.data,'所属区域')"
/>
<el-table-column
prop="device_model"
label="设备类型"
:min-width="flexWidth('device_model',crud.data,'设备类型')"
>
<template slot-scope="scope">
{{ dict.label.pdm_device_type[scope.row.device_model] }}
</template>
</el-table-column>
<el-table-column prop="productivity" label="设备产能" :min-width="flexWidth('productivity',crud.data,'设备产能')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" show-overflow-tooltip />
<el-table-column
prop="productivity"
label="设备产能"
:min-width="flexWidth('productivity',crud.data,'设备产能')"
/>
<el-table-column prop="is_workorder" label="是否工单设备" :min-width="flexWidth('is_workorder',crud.data,'是否工单设备')">
<template slot-scope="scope">
{{ dict.label.true_or_false[scope.row.is_workorder] }}
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
:min-width="flexWidth('remark',crud.data,'备注')"
show-overflow-tooltip
/>
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
@ -145,12 +177,13 @@ const defaultForm = {
create_name: null,
create_time: null,
is_delete: null,
productivity: null
productivity: null,
is_workorder: '1'
}
export default {
name: 'Device',
components: { pagination, crudOperation, rrOperation, udOperation },
dicts: ['pdm_device_type'],
dicts: ['pdm_device_type', 'true_or_false'],
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@ -180,6 +213,9 @@ export default {
],
region_code: [
{ required: true, message: '所属区域不能为空', trigger: 'blur' }
],
is_workorder: [
{ required: true, message: '是否工单设备不能为空', trigger: 'blur' }
]
},
regionList: []

4
lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue

@ -349,6 +349,9 @@ export default {
],
is_pri: [
{ required: true, message: '是否优先包装不能为空', trigger: 'blur' }
],
is_new: [
{ required: true, message: '是否新料不能为空', trigger: 'blur' }
]
}
}
@ -388,6 +391,7 @@ export default {
crudWorkorder.forceFinish({ row: this.orderData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
this.finishShow = false
})
},
//

1
lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

@ -430,6 +430,7 @@ export default {
crudWorkorder.forceFinish({ row: this.orderData }).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
this.finishShow = false
})
},
//

5
lms/nladmin-ui/src/views/wms/pub/DeviceDialog.vue

@ -83,7 +83,10 @@ export default {
title: '设备',
url: 'api/device',
crudMethod: { ...crudDevice },
optShow: {}
optShow: {},
query: {
is_workorder: '1'
}
})
},
mixins: [presenter(), header()],

Loading…
Cancel
Save