代码更新

This commit is contained in:
2023-04-21 17:38:20 +08:00
parent db89a4abb1
commit 4ba04da9c5
33 changed files with 2030 additions and 101 deletions

View File

@@ -201,7 +201,7 @@ public class AppRun {
int nodeSizeH = 50;
for (int i = 1; i <= 4; i++) {
JSONArray resultJSONArray = attrTab.query("col_num = '" + i + "' and point_type = '9' and layer_num = '1' order by row_num ASC").getResultJSONArray(0);
JSONArray resultJSONArray = attrTab.query("col_num = '" + i + "' and point_type = '9' and layer_num = '2' order by row_num ASC").getResultJSONArray(0);
for (int j = 0; j < resultJSONArray.size(); j++) {
JSONObject json = resultJSONArray.getJSONObject(j);
@@ -229,7 +229,7 @@ public class AppRun {
}
save.put("nodes", nodes);
save.put("edges", edges);
JSONObject jsonObject = stageTab.query("stage_code = 'FS'").uniqueResult(0);
JSONObject jsonObject = stageTab.query("stage_code = 'FS_2'").uniqueResult(0);
jsonObject.put("stage_data", save);
stageTab.update(jsonObject);
return "Backend service started successfully";

View File

@@ -0,0 +1,79 @@
package org.nl.wms.basedata.master.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.basedata.master.service.FaultDeviceService;
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author liuxy
* @date 2023-04-20
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "设备故处理")
@RequestMapping("/api/faultdevice")
@Slf4j
public class FaultDeviceController {
private final FaultDeviceService faultDeviceService;
@GetMapping
@Log("查询设备故障处理表")
@ApiOperation("查询设备故障处理表")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(faultDeviceService.queryAll(whereJson, page), HttpStatus.OK);
}
@GetMapping("/deviceCharge")
@Log("查询说有设备故障")
@ApiOperation("查询说有设备故障")
public ResponseEntity<Object> queryDeviceAll(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(faultDeviceService.queryDeviceAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增设备故障处理表")
@ApiOperation("新增设备故障处理表")
public ResponseEntity<Object> create(@Validated @RequestBody CustomerbaseDto dto) {
faultDeviceService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改设备故障处理表")
@ApiOperation("修改设备故障处理表")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
faultDeviceService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除设备故障处理表")
@ApiOperation("删除设备故障处理表")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
faultDeviceService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("同步信息")
@ApiOperation("同步信息")
@PostMapping("/syncInfo")
public ResponseEntity<Object> syncInfo() {
faultDeviceService.syncInfo();
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,78 @@
package org.nl.wms.basedata.master.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author liuxy
* @date 2023-04-20
**/
public interface FaultDeviceService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryDeviceAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<CustomerbaseDto>
*/
List<CustomerbaseDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param cust_id ID
* @return Customerbase
*/
CustomerbaseDto findById(Long cust_id);
/**
* 根据编码查询
* @param code code
* @return Customerbase
*/
CustomerbaseDto findByCode(String code);
/**
* 创建
* @param dto /
*/
void create(CustomerbaseDto dto);
/**
* 编辑
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 同步信息
*/
void syncInfo();
}

View File

@@ -0,0 +1,254 @@
package org.nl.wms.basedata.master.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.PageUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.basedata.master.service.FaultDeviceService;
import org.nl.wms.basedata.master.service.dto.CustomerbaseDto;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author liuxy
* @description 服务实现
* @date 2023-04-20
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class FaultDeviceServiceImpl implements FaultDeviceService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String fault_code = MapUtil.getStr(whereJson, "fault_code");
String fault_type = MapUtil.getStr(whereJson, "fault_type");
JSONObject map = new JSONObject();
map.put("flag","1");
map.put("fault_code",fault_code);
map.put("fault_type",fault_type);
JSONObject json = WQL.getWO("QMD_BI_FAULT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time DESC");
return json;
}
@Override
public Map<String, Object> queryDeviceAll(Map whereJson, Pageable page) {
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
String device_code = MapUtil.getStr(whereJson, "device_code");
String is_fault = MapUtil.getStr(whereJson, "is_fault");
String region_code = MapUtil.getStr(whereJson, "region_code");
String plant_code = MapUtil.getStr(whereJson, "plant_code");
JSONObject param = new JSONObject();
if (ObjectUtil.isNotEmpty(device_code)) {
param.put("device_code",device_code);
}
// 调用acs接口获取设备
JSONObject result = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).realTimefaultInfo(param);
JSONArray data = result.getJSONArray("data");
// 根据入参处理对应数据
ArrayList<Object> objects = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
JSONObject json = data.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("region_code", region_code);
map.put("plant_code", plant_code);
map.put("device_code", json.getString("device_code"));
JSONObject jsonDevice = WQL.getWO("QMD_BI_FAULT").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(jsonDevice)) continue;
// 获取报警码
JSONObject jsonFault = faultTab.query("fault_type = '" + json.getString("fault_type") + "' and fault_code = '" + json.getString("fault_code") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonFault)) {
jsonDevice.put("fault_code", jsonFault.getString("fault_code"));
jsonDevice.put("fault_info", jsonFault.getString("fault_info"));
jsonDevice.put("fault_type", jsonFault.getString("fault_type"));
jsonDevice.put("solve_mode", jsonFault.getString("solve_mode"));
}
// 判断是否异常
if (!StrUtil.equals(json.getString("fault_code"),"0")) {
jsonDevice.put("is_fault", "1");
} else {
jsonDevice.put("is_fault", "0");
}
if (StrUtil.equals(is_fault, "1")) {
if (!StrUtil.equals(json.getString("fault_code"),"0")) {
objects.add(jsonDevice);
}
} else if (StrUtil.equals(is_fault, "0")) {
if (StrUtil.equals(json.getString("fault_code"),"0")) {
objects.add(jsonDevice);
}
} else {
objects.add(jsonDevice);
}
}
// 组织分页查询并返回
Map<String, Object> json = PageUtil.toPage(
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), objects),
objects.size()
);
return json;
}
@Override
public List<CustomerbaseDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
JSONArray arr = wo.query().getResultJSONArray(0);
List<CustomerbaseDto> list = arr.toJavaList(CustomerbaseDto.class);
return list;
}
@Override
public CustomerbaseDto findById(Long cust_id) {
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
JSONObject json = wo.query("cust_id =" + cust_id + "").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) return null;
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
return obj;
}
@Override
public CustomerbaseDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
JSONObject json = wo.query("cust_code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) return null;
final CustomerbaseDto obj = json.toJavaObject(CustomerbaseDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(CustomerbaseDto dto) {
String cust_code = dto.getCust_code();
CustomerbaseDto customerbaseDto = this.findByCode(cust_code);
if (customerbaseDto != null && customerbaseDto.getIs_delete().equals("0")) {
throw new BadRequestException("存在相同的客户编号");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
dto.setCust_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
whereJson.put("update_id",currentUserId);
whereJson.put("update_name",nickName);
whereJson.put("update_time",DateUtil.now());
faultTab.update(whereJson);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("md_cs_customerbase");
for (Long cust_id : ids) {
JSONObject param = new JSONObject();
param.put("cust_id", String.valueOf(cust_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void syncInfo() {
WQLObject faultTab = WQLObject.getWQLObject("EM_BI_FaultDisposeDevice");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
// 调用acs接口获取信息
JSONObject json = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).syncfaultInfo();
JSONArray data = json.getJSONArray("data");
for (int i = 0; i < data.size(); i++) {
JSONObject jsonDtl = data.getJSONObject(i);
JSONObject jsonFault = faultTab.query("fault_code = '" + jsonDtl.getString("fault_code") + "' and fault_type = '" + jsonDtl.getString("fault_type") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonFault)) {
jsonFault.put("fault_info",jsonDtl.getString("fault_info"));
jsonFault.put("create_id",currentUserId);
jsonFault.put("create_name",nickName);
jsonFault.put("create_time",DateUtil.now());
jsonFault.put("update_id",currentUserId);
jsonFault.put("update_name",nickName);
jsonFault.put("update_time",DateUtil.now());
faultTab.update(jsonFault);
} else {
jsonDtl.put("fault_id", IdUtil.getSnowflake(1,1).nextId());
jsonDtl.put("create_id",currentUserId);
jsonDtl.put("create_name",nickName);
jsonDtl.put("create_time",DateUtil.now());
jsonDtl.put("update_id",currentUserId);
jsonDtl.put("update_name",nickName);
jsonDtl.put("update_time",DateUtil.now());
faultTab.insert(jsonDtl);
}
}
}
}

View File

@@ -0,0 +1,92 @@
[交易说明]
交易名: 故障分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.fault_code TYPEAS s_string
输入.fault_type TYPEAS s_string
输入.region_code TYPEAS s_string
输入.plant_code TYPEAS s_string
输入.device_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
*
FROM
EM_BI_FaultDisposeDevice
WHERE
1 = 1
OPTION 输入.fault_code <> ""
fault_code = 输入.fault_code
ENDOPTION
OPTION 输入.fault_type <> ""
fault_type = 输入.fault_type
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
*
FROM
EM_BI_MonitorDevice
WHERE
is_crux = '1'
OPTION 输入.region_code <> ""
region_code = 输入.region_code
ENDOPTION
OPTION 输入.plant_code <> ""
plant_code = 输入.plant_code
ENDOPTION
OPTION 输入.device_code <> ""
device_code = 输入.device_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -336,12 +336,23 @@ public class StructattrServiceImpl implements StructattrService {
String point_code = whereJson.getString("point_code");
JSONObject jsonPoint = pointTab.query("point_code = '" + point_code + "'").uniqueResult(0);
/*
判断点位是第几层
1层解锁当前点位和2层点位
2层直接解锁当前点位
*/
if (StrUtil.equals(jsonPoint.getString("layer_num"), "1")) {
JSONObject jsonPoint2 = pointTab.query("device_code = '" + jsonPoint.getString("device_code") + "' and layer_num = '2'").uniqueResult(0);
jsonPoint2.put("point_status", "1");
jsonPoint2.put("lock_type", "1");
jsonPoint2.put("vehicle_code", "");
pointTab.update(jsonPoint2);
}
jsonPoint.put("point_status", "1");
jsonPoint.put("vehicle_code", "");
jsonPoint.put("lock_type", "1");
jsonPoint.put("vehicle_code", "");
pointTab.update(jsonPoint);
return null;
}

View File

@@ -91,11 +91,19 @@ public class AcsToWmsController {
@Log(value = "仓位初始化", isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
@ApiOperation("仓位初始化")
@SaIgnore
public ResponseEntity<Object> initialize(@RequestBody JSONObject json) {
acsToWmsService.initialize(json);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/initPoint")
@Log(value = "点位初始化", isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
@ApiOperation("点位初始化")
@SaIgnore
public ResponseEntity<Object> initPoint() {
acsToWmsService.initPoint();
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -125,5 +125,19 @@ public class WmsToAcsController {
return new ResponseEntity<>(wmsToAcsService.sendAgvChargeTask(jo), HttpStatus.OK);
}
@PostMapping("/syncfaultInfo")
@Log(value = "LMS同步ACS报警码信息", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("LMS同步ACS报警码信息")
public ResponseEntity<Object> syncfaultInfo() {
return new ResponseEntity<>(wmsToAcsService.syncfaultInfo(), HttpStatus.OK);
}
@PostMapping("/realTimefaultInfo")
@Log(value = "LMS查看ACS实时报警信息", isInterfaceLog = true, interfaceLogType = InterfaceLogType.LMS_TO_ACS)
@ApiOperation("LMS查看ACS实时报警信息")
public ResponseEntity<Object> realTimefaultInfo(@RequestBody JSONObject jo) {
return new ResponseEntity<>(wmsToAcsService.realTimefaultInfo(jo), HttpStatus.OK);
}
}

View File

@@ -82,4 +82,9 @@ public interface AcsToWmsService {
* 仓位初始化
*/
void initialize(JSONObject json);
/**
* 点位初始化
*/
void initPoint();
}

View File

@@ -97,4 +97,17 @@ public interface WmsToAcsService {
* @return JSONObject
*/
JSONObject sendAgvChargeTask(JSONObject jo);
/**
* LMS同步ACS报警码信息
* @return JSONObject
*/
JSONObject syncfaultInfo();
/**
* LMS查看ACS实时报警信息
* @param jo /
* @return JSONObject
*/
JSONObject realTimefaultInfo(JSONObject jo);
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
@@ -429,13 +430,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
String sale_order_name = sub_jo.getString("sale_order_name");
String box_length_1 = sub_jo.getString("box_length");
String box_width_1 = sub_jo.getString("box_width");
String box_high_1 = sub_jo.getString("box_high");
String product_name = sub_jo.getString("product_name");
JSONObject param = new JSONObject();
param.put("flag", "1");
param.put("sale_order_name",sale_order_name);
param.put("product_name",product_name);
param.put("box_length",box_length_1);
param.put("box_width",box_width_1);
param.put("box_high",box_high_1);
//查询是否存在可用的空位
String point_code = "";
JSONArray joArr = new JSONArray();
// 查找此订单号所在的所有
JSONArray joRow = WQL.getWO("QST_ACSTOLMSTYPE4").addParam("flag", "1").addParam("sale_order_name", sale_order_name).process().getResultJSONArray(0);
// 查找此订单号、物料、木箱长宽高相同的一
JSONArray joRow = WQL.getWO("QST_ACSTOLMSTYPE4").addParamMap(param).process().getResultJSONArray(0);
for (int j = 0; j < joRow.size(); j++) {
JSONObject json = joRow.getJSONObject(j);
String row_num = json.getString("row_num");
@@ -461,8 +474,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject point_jo = rowArr.getJSONObject(i);
JSONArray pointArr = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' and IFNULL(vehicle_code,'') = '' order by out_order_seq ASC").getResultJSONArray(0);
if (pointArr.size() == 4) {
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
if (pointArr.size() == 8) {
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq,layer_num").uniqueResult(0);
point_code = jsonNewRow.getString("point_code");
break;
}
@@ -501,8 +514,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
JSONObject point_jo = rowArr.getJSONObject(i);
JSONArray pointArr = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' and IFNULL(vehicle_code,'') = '' order by out_order_seq ASC").getResultJSONArray(0);
if (pointArr.size() == 4) {
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
if (pointArr.size() == 8) {
JSONObject jsonNewRow = WQLObject.getWQLObject("sch_base_point").query("row_num = '" + point_jo.getString("row_num") + "' AND point_type ='9' AND is_delete = '0' and lock_type = '1' order by out_order_seq,layer_num").uniqueResult(0);
point_code = jsonNewRow.getString("point_code");
break;
}
@@ -564,6 +577,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
try {
if (tryLock) {
if (type.equals("1")) {
//贴标申请
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
}
@@ -574,7 +588,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//贴标申请
/*
* 判断此客户是否是自动贴标
*/
// 查询客户
JSONObject jsonCust = WQLObject.getWQLObject("md_cs_customerbase").query("cust_code = '" + sub_jo.getString("customer_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCust)) {
throw new BadRequestException("客户不存在请检查!");
}
// 判断是否贴标
if (!StrUtil.equals(jsonCust.getString("is_auto_table"), "1")) {
return result;
}
String print_type = "1";
if (StrUtil.isEmpty(print_type)) {
throw new BadRequestException("请指定一台打印机进行打印!");
@@ -591,13 +619,35 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
default:
throw new BadRequestException("未查询到对应打印机!");
}
// 调用打印机进行打印
JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = '" + print_code + "'").uniqueResult(0);
JSONObject print_jo = new JSONObject();
print_jo.put("box_no", vehicle_code);
print_jo.put("print_type", print_info.getString("print_id"));
print_jo.put("box_weight", weight);
new PrintServiceImpl().customerPrint2(print_jo);
// 贴标成功:更新系统参数贴标次数
WQLObject paramTab = WQLObject.getWQLObject("sys_param");
String label_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_up").getValue();
String now_num = NumberUtil.sub(label_num_up, "1").toString();
JSONObject jsonParam = paramTab.query("code = 'label_num_up'").uniqueResult(0);
jsonParam.put("value", now_num);
paramTab.update(jsonParam);
// 判断是否到达预警值
String label_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("label_num_down").getValue();
if (Integer.valueOf(label_num_down) >= Integer.valueOf(now_num)) {
result.put("message", "标签纸数量过低,请更换!");
}
} else if (type.equals("2")) {
//捆扎申请
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("木箱码不能为空!");
}
@@ -605,7 +655,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (ObjectUtil.isEmpty(sub_jo)) {
throw new BadRequestException("未查询到该木箱对应的包装关系!");
}
//捆扎申请
// 计算此木箱需要捆扎几次
String box_length = sub_jo.getString("box_length");
String box_width = sub_jo.getString("box_width");
String box_high = sub_jo.getString("box_high");
@@ -624,7 +675,40 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
data.put("bundle_times", 2);
}
// 判断是否需要捆扎
String is_lash = whereJson.getString("is_lash"); // TODO 此字段未跟acs确认需要确认
if (StrUtil.equals(is_lash, "1")) {
// 获取系统参数:捆扎米数
String lash_num_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_up").getValue();
Double lash_num_up_double = Double.valueOf(lash_num_up);
// 获取系统参数:捆扎一次的米数
String lash_num_one = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_one").getValue();
Double lash_num_one_double = Double.valueOf(lash_num_one);
// 捆扎次数
Double bundle_times_double = data.getDoubleValue("bundle_times");
// 当前米数 = 捆扎米数 - (捆扎次数 * 捆扎一次的米数)
double now_num = NumberUtil.sub(lash_num_up_double, (Double) NumberUtil.mul(lash_num_one_double, bundle_times_double));
// 更新捆扎米数
WQLObject paramTab = WQLObject.getWQLObject("sys_param");
JSONObject jsonParam = paramTab.query("code = 'lash_num_up'").uniqueResult(0);
jsonParam.put("value", String.valueOf(now_num));
paramTab.update(jsonParam);
// 判断是否达到预警值
String lash_num_down = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("lash_num_down").getValue();
if (Double.parseDouble(lash_num_down) >= now_num) {
result.put("message", "捆扎带米数过低,请更换!");
}
}
result.put("data", data);
} else if (type.equals("3")) {
//判断AGV是否启用
String agv_status = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("agv_status").getValue();
@@ -891,4 +975,43 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
}
}
@Override
public void initPoint() {
WQLObject point = WQLObject.getWQLObject("sch_base_point");
JSONArray resultJSONArray = point.query("point_type = '9' order by point_code").getResultJSONArray(0);
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject json = resultJSONArray.getJSONObject(i);
json.put("device_code", json.getString("point_code"));
json.put("point_code", json.getString("point_code") + "_1");
json.put("layer_num", 1);
point.update(json);
JSONObject jsonTwo = new JSONObject();
jsonTwo.put("point_id", IdUtil.getSnowflake(1,1).nextId());
jsonTwo.put("device_code", json.getString("device_code"));
jsonTwo.put("point_code", jsonTwo.getString("device_code") + "_2");
jsonTwo.put("point_name", json.getString("point_name"));
jsonTwo.put("region_id", json.get("region_id"));
jsonTwo.put("region_code", json.getString("region_code"));
jsonTwo.put("region_name", json.getString("region_name"));
jsonTwo.put("point_type", json.getString("point_type"));
jsonTwo.put("point_status", json.getString("point_status"));
jsonTwo.put("lock_type", json.getString("lock_type"));
jsonTwo.put("row_num", json.get("row_num"));
jsonTwo.put("col_num", json.get("col_num"));
jsonTwo.put("layer_num", 2);
jsonTwo.put("out_order_seq", json.get("out_order_seq"));
jsonTwo.put("is_used", "1");
jsonTwo.put("is_delete", "0");
jsonTwo.put("create_id", 1);
jsonTwo.put("create_name", "管理员");
jsonTwo.put("create_time", DateUtil.now());
point.insert(jsonTwo);
}
}
}

View File

@@ -279,18 +279,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
result.put("message", "下发成功但未连接ACS!");
result.put("data", new JSONObject());
/* // 测试数据
String car_no = whereJson.getString("car_no");
JSONObject jsonParam = new JSONObject();
if ("2,3".contains(car_no)) {
jsonParam.put("avg_system", "2");
jsonParam.put("car_no", car_no);
} else if ("1".contains(car_no)) {
jsonParam.put("avg_system", "1");
jsonParam.put("car_no", car_no);
}*/
return result;
}
@@ -304,10 +292,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
JSONObject jsonParam = new JSONObject();
if ("2,3".contains(car_no)) {
jsonParam.put("avg_system", "2");
jsonParam.put("agv_system", "2");
jsonParam.put("car_no", car_no);
} else if ("1".contains(car_no)) {
jsonParam.put("avg_system", "1");
jsonParam.put("agv_system", "1");
jsonParam.put("car_no", car_no);
}
@@ -332,4 +320,81 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return result;
}
@Override
public JSONObject syncfaultInfo() {
JSONObject whereJson = new JSONObject();
String api = "api/wms/syncfaultInfo";
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
JSONObject result = new JSONObject();
if (StrUtil.equals("0", isConnect)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功但未连接ACS!");
result.put("data", new JSONArray());
return result;
}
//ACS地址127.0.0.1:8010
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
String url = acsUrl + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(whereJson))
.execute().body();
result = JSONObject.parseObject(resultMsg);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
result.put("status", HttpStatus.BAD_REQUEST);
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONArray());
}
//acs抛异常这里
if (!StrUtil.equals(result.getString("status"), "200")) {
throw new BadRequestException("同步失败:"+result.getString("message"));
}
return result;
}
@Override
public JSONObject realTimefaultInfo(JSONObject whereJson) {
String api = "api/wms/realTimefaultInfo";
//判断是否连接ACS系统
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
JSONObject result = new JSONObject();
if (StrUtil.equals("0", isConnect)) {
result.put("status", HttpStatus.OK.value());
result.put("message", "下发成功但未连接ACS!");
result.put("data", new JSONArray());
return result;
}
//ACS地址127.0.0.1:8010
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("acs_url").getValue();
String url = acsUrl + api;
try {
String resultMsg = HttpRequest.post(url)
.body(String.valueOf(whereJson))
.execute().body();
result = JSONObject.parseObject(resultMsg);
} catch (Exception e) {
String msg = e.getMessage();
//网络不通
System.out.println(msg);
result.put("status", HttpStatus.BAD_REQUEST);
result.put("message", "网络不通,操作失败!");
result.put("data", new JSONArray());
}
//acs抛异常这里
if (!StrUtil.equals(result.getString("status"), "200")) {
throw new BadRequestException("同步失败:"+result.getString("message"));
}
return result;
}
}

View File

@@ -58,4 +58,11 @@ public class ProductInstorController {
return new ResponseEntity<>(productInstorService.bale(whereJson),HttpStatus.OK);
}
@PostMapping("/abnormalOut")
@Log("异常出口点位解锁")
@ApiOperation("异常出口点位解锁")
public ResponseEntity<Object> abnormalOut(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productInstorService.abnormalOut(whereJson),HttpStatus.OK);
}
}

View File

@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "出库确认")
@Api(tags = "生产区发货")
@RequestMapping("/api/pda/st")
@Slf4j
public class ProductionOutController {
@@ -31,12 +31,26 @@ public class ProductionOutController {
private final ProductionOutService productionOutService;
@PostMapping("/ivtQuery")
@Log("出库初始化查询")
@ApiOperation("出库初始化查询")
@Log("单据初始化查询")
@ApiOperation("单据初始化查询")
public ResponseEntity<Object> ivtQuery(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productionOutService.ivtQuery(whereJson),HttpStatus.OK);
}
@PostMapping("/ivtDtlQuery")
@Log("查询点位木箱")
@ApiOperation("查询点位木箱")
public ResponseEntity<Object> ivtDtlQuery(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productionOutService.ivtDtlQuery(whereJson),HttpStatus.OK);
}
@PostMapping("/ivtbBoxDtlQuery")
@Log("木箱明细")
@ApiOperation("木箱明细")
public ResponseEntity<Object> ivtbBoxDtlQuery(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productionOutService.ivtbBoxDtlQuery(whereJson),HttpStatus.OK);
}
@PostMapping("/outConfirm")
@Log("出库确认")
@ApiOperation("出库确认")

View File

@@ -23,4 +23,6 @@ public interface ProductInstorService {
JSONObject mendCode(JSONObject whereJson);
JSONObject bale(JSONObject whereJson);
JSONObject abnormalOut(JSONObject whereJson);
}

View File

@@ -11,7 +11,7 @@ import com.alibaba.fastjson.JSONObject;
public interface ProductionOutService {
/**
* 出库初始化查询
* 单据初始化查询
* @param whereJson /
* @return JSONObject /
*/
@@ -23,4 +23,18 @@ public interface ProductionOutService {
* @return JSONObject /
*/
JSONObject outConfirm(JSONObject whereJson);
/**
* 查询点位木箱
* @param whereJson /
* @return JSONObject /
*/
JSONObject ivtDtlQuery(JSONObject whereJson);
/**
* 木箱明细
* @param whereJson /
* @return JSONObject /
*/
JSONObject ivtbBoxDtlQuery(JSONObject whereJson);
}

View File

@@ -372,4 +372,45 @@ public class ProductInstorServiceImpl implements ProductInstorService {
jo.put("message", "捆扎成功!");
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject abnormalOut(JSONObject whereJson) {
String vehicle_code = whereJson.getString("box_no");
String device_code = whereJson.getString("point_code");
if (ObjectUtil.isEmpty(vehicle_code) && ObjectUtil.isEmpty(device_code)) {
throw new BadRequestException("载具号或木箱号不能为空!");
}
JSONObject map = new JSONObject();
map.put("flag", "9");
map.put("box_no",vehicle_code);
map.put("point_code",device_code);
// 查询对应任务
JSONObject json = WQL.getWO("PDA_ST_01").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isEmpty(json)) throw new BadRequestException("木箱不存在或任务不存在!");
// 下发给acs
JSONObject jsonParam = new JSONObject();
jsonParam.put("device_code", json.getString("point_code2"));
jsonParam.put("vehicle_code", json.getString("vehicle_code"));
jsonParam.put("task_code", json.getString("task_code"));
JSONObject jo = new JSONObject();
jo.put("message", "解锁成功!");
WmsToAcsServiceImpl bean = SpringContextHolder.getBean(WmsToAcsServiceImpl.class);
try {
bean.unLock(jsonParam);
} catch (Exception e) {
jo.put("message",e.getMessage());
}
return jo;
}
}

View File

@@ -2,8 +2,6 @@
package org.nl.wms.pda.st.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 com.alibaba.fastjson.JSONArray;
@@ -11,11 +9,8 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.pda.st.service.CoolInService;
import org.nl.wms.pda.st.service.ProductionOutService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -33,24 +28,16 @@ public class ProductionOutServiceImpl implements ProductionOutService {
@Override
public JSONObject ivtQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
String bill_code = whereJson.getString("bill_code");
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("box_no", whereJson.getString("box_no"));
map.put("point_code", whereJson.getString("point_code"));
if (ObjectUtil.isNotEmpty(box_no)) map.put("box_no","%"+box_no+"%");
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code","%"+bill_code+"%");
JSONArray resultJSONArray = WQL.getWO("PDA_PRODUVTIONOUT").addParamMap(map).process().getResultJSONArray(0);
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject jsonObject = resultJSONArray.getJSONObject(i);
String isRePrintPackageBoxLabel = jsonObject.getString("isRePrintPackageBoxLabel");
String isUnPackBox = jsonObject.getString("isUnPackBox");
if (StrUtil.equals(isRePrintPackageBoxLabel, "1") || StrUtil.equals(isUnPackBox, "1")) {
jsonObject.put("colro_flag", "1");
} else {
jsonObject.put("colro_flag", "0");
}
}
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("message", "查询成功!");
@@ -69,17 +56,25 @@ public class ProductionOutServiceImpl implements ProductionOutService {
JSONObject jsonPoint = pointTab.query("vehicle_code = '" + box_no + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) {
throw new BadRequestException("请输入正确的木箱");
throw new BadRequestException("请输入正确的木箱或查看点位是否存在");
}
/*
* 生产区确认
* a.解锁出库点位、清除木箱号
判断点位是第几层
1层解锁当前点位和2层点位
2层直接解锁当前点位
*/
if (StrUtil.equals(jsonPoint.getString("layer_num"), "1")) {
JSONObject jsonPoint2 = pointTab.query("device_code = '" + jsonPoint.getString("device_code") + "' and layer_num = '2'").uniqueResult(0);
jsonPoint2.put("point_status", "1");
jsonPoint2.put("lock_type", "1");
jsonPoint2.put("vehicle_code", "");
pointTab.update(jsonPoint2);
}
jsonPoint.put("point_status", "1");
jsonPoint.put("lock_type", "1");
jsonPoint.put("vehicle_code", "");
jsonPoint.put("vehicle_type", "");
jsonPoint.put("vehicle_qty", 0);
pointTab.update(jsonPoint);
JSONObject jo = new JSONObject();
@@ -87,4 +82,38 @@ public class ProductionOutServiceImpl implements ProductionOutService {
return jo;
}
@Override
public JSONObject ivtDtlQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
String bill_code = whereJson.getString("bill_code");
JSONObject map = new JSONObject();
map.put("flag", "2");
map.put("bill_code", bill_code);
if (ObjectUtil.isNotEmpty(box_no)) map.put("box_no","%"+box_no+"%");
JSONArray resultJSONArray = WQL.getWO("PDA_PRODUVTIONOUT").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("message", "查询成功!");
return jo;
}
@Override
public JSONObject ivtbBoxDtlQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
JSONObject map = new JSONObject();
map.put("flag", "3");
map.put("box_no", box_no);
JSONArray resultJSONArray = WQL.getWO("PDA_PRODUVTIONOUT").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("data", resultJSONArray);
jo.put("message", "查询成功!");
return jo;
}
}

View File

@@ -14,7 +14,7 @@
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.point_code TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.box_no TYPEAS s_string
@@ -42,44 +42,155 @@
IF 输入.flag = "1"
QUERY
SELECT
sub.package_box_SN AS package_box_SN,
sub.container_name AS container_name,
sub.product_name AS product_name,
sub.product_description AS product_description,
sub.net_weight AS net_weight,
(
CASE
sub.isRePrintPackageBoxLabel
WHEN '1' THEN ''
WHEN '0' THEN ''
END
) AS change_out,
(
CASE
sub.isUnPackBox
WHEN '1' THEN '是'
WHEN '0' THEN '否'
END
) AS change_in,
sub.isRePrintPackageBoxLabel,
sub.isUnPackBox,
point.point_code
SELECT DISTINCT
mst.bill_code,
(
CASE
mst.bill_status
WHEN '10' THEN '生成'
WHEN '20' THEN '提交'
WHEN '30' THEN '分配中'
WHEN '40' THEN '分配完'
WHEN '50' THEN '确认'
WHEN '99' THEN '完成'
END
) AS bill_status,
ROUND(mst.total_qty, 3) AS total_qty,
mst.detail_count,
mst.cust_code,
cust.cust_name,
mst.source_id,
mst.remark,
mst.input_optname,
mst.input_time,
mst.dis_optname,
mst.dis_time,
mst.confirm_optname,
mst.confirm_time
FROM
PDM_BI_SubPackageRelation sub
LEFT JOIN sch_base_point point ON sub.package_box_SN = point.vehicle_code
st_ivt_iostorinv mst
LEFT JOIN (
SELECT
box_no,
max(iostorinv_id) AS iostorinv_id
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
group by box_no
) dis ON dis.iostorinv_id = mst.iostorinv_id
LEFT JOIN sch_base_point point ON point.vehicle_code = dis.box_no
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = mst.cust_code
WHERE
point.point_type = '9'
mst.is_delete = '0'
AND mst.io_type = '1'
AND point.point_type = '9'
OPTION 输入.box_no <> ""
point.vehicle_code = 输入.box_no
point.vehicle_code LIKE 输入.box_no
ENDOPTION
OPTION 输入.point_code <> ""
point.point_code = 输入.point_code
OPTION 输入.bill_code <> ""
mst.bill_code LIKE 输入.bill_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
point.vehicle_code AS package_box_sn,
point.point_code,
point.point_name,
ROUND(sub.box_weight,3) AS box_weight,
sub.product_name,
sub.product_description,
sub.sale_order_name
FROM
sch_base_point point
LEFT JOIN (
SELECT
box_no,
max(iostorinv_id) AS iostorinv_id
FROM
st_ivt_iostorinvdis
WHERE
1 = 1
group by box_no
) dis ON dis.box_no = point.vehicle_code
LEFT JOIN (
SELECT
package_box_sn,
MAX(box_weight) AS box_weight,
MAX(product_name) AS product_name,
MAX(product_description) AS product_description,
MAX(sale_order_name) AS sale_order_name
FROM
pdm_bi_subpackagerelation
WHERE
1 = 1
group by package_box_sn
) sub ON sub.package_box_sn = dis.box_no
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
WHERE
mst.is_delete = '0'
AND mst.io_type = '1'
AND point.point_type = '9'
OPTION 输入.box_no <> ""
point.vehicle_code LIKE 输入.box_no
ENDOPTION
OPTION 输入.bill_code <> ""
mst.bill_code = 输入.bill_code
ENDOPTION
order by point_code
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
package_box_sn,
container_name,
sap_pcsn,
ROUND(net_weight,3) AS net_weight,
(
CASE
status
WHEN '0' THEN '生成'
WHEN '1' THEN '包装'
WHEN '2' THEN '入库'
WHEN '3' THEN '出库'
END
) AS status,
sale_order_name,
customer_name,
customer_description,
width,
thickness,
ROUND(length,3) AS length,
width_standard,
thickness_request,
quality_guaran_period,
date_of_production,
date_of_fG_inbound
FROM
pdm_bi_subpackagerelation
WHERE
1 = 1
OPTION 输入.box_no <> ""
package_box_sn = 输入.box_no
ENDOPTION
order by package_box_sn,container_name
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -15,6 +15,7 @@
#################################################
输入.flag TYPEAS s_string
输入.box_no TYPEAS s_string
输入.point_code TYPEAS s_string
输入.stor_id TYPEAS s_string
@@ -206,6 +207,31 @@
dis.box_no = 输入.box_no
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "9"
QUERY
SELECT
task.*
FROM
sch_base_task task
WHERE
task.is_delete = '0'
AND task.task_status = '07'
AND task.task_type = '010503'
OPTION 输入.box_no <> ""
task.vehicle_code = 输入.box_no
ENDOPTION
OPTION 输入.point_code <> ""
task.point_code2 = 输入.point_code
ENDOPTION
order by update_time DESC
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -38,4 +38,8 @@ public class AcsTaskDto {
private String oven_time;
//密集库明细类型
private String dtl_type;
//发货区起点高度
private String start_height;
//发货区终点高度
private String next_height;
}

View File

@@ -34,24 +34,43 @@ public class SendOutTask extends AbstractAcsTask {
/*
* 下发给ACS时需要特殊处理
*/
JSONArray arr = WQLObject.getWQLObject("SCH_BASE_Task").query("handle_class = '" + THIS_CLASS + "' and task_status = '" + TaskStatusEnum.START_AND_POINT.getCode() + "' and is_delete ='0'").getResultJSONArray(0);
ArrayList<AcsTaskDto> resultList = new ArrayList<>();
for (int i = 0; i < arr.size(); i++) {
JSONObject json = arr.getJSONObject(i);
String start_high = "0";
String next_high = "";
// 判断此木箱是在2层还是1层
JSONObject jsonPoint = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + json.getString("point_code2") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("终点点位不存在!");
if (StrUtil.equals(jsonPoint.getString("layer_num"), "2")) {
JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("vehicle_code") + "'").uniqueResult(0);
next_high = jsonSub.getString("box_high");
} else {
next_high = "0";
}
AcsTaskDto dto = AcsTaskDto.builder()
.ext_task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(json.getString("point_code2"))
.next_device_code(jsonPoint.getString("device_code"))
.agv_system_type("1")
.vehicle_code(json.getString("vehicle_code"))
.priority(json.getString("priority"))
.remark(json.getString("remark"))
.start_height(start_high)
.next_height(next_high)
.build();
resultList.add(dto);
System.out.println(resultList.toString());
}
return resultList;
}

View File

@@ -15,6 +15,10 @@
#################################################
输入.flag TYPEAS s_string
输入.sale_order_name TYPEAS s_string
输入.product_name TYPEAS s_string
输入.box_length TYPEAS s_string
输入.box_width TYPEAS s_string
输入.box_high TYPEAS s_string
输入.point_code TYPEAS s_string
输入.row_num TYPEAS s_string
@@ -50,7 +54,26 @@
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.package_box_sn = po.vehicle_code
WHERE
po.point_type = '9'
AND sub.sale_order_name = 输入.sale_order_name
OPTION 输入.sale_order_name <> ""
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.product_name <> ""
sub.product_name = 输入.product_name
ENDOPTION
OPTION 输入.box_length <> ""
sub.box_length = 输入.box_length
ENDOPTION
OPTION 输入.box_width <> ""
sub.box_width = 输入.box_width
ENDOPTION
OPTION 输入.box_high <> ""
sub.box_high = 输入.box_high
ENDOPTION
GROUP BY po.row_num
@@ -87,7 +110,7 @@
AND is_delete = '0'
)
ORDER BY po.out_order_seq ASC
ORDER BY po.out_order_seq,po.layer_num
ENDSELECT
ENDQUERY

View File

@@ -447,7 +447,7 @@
AND
sa2.is_used = '1'
AND
sa.sect_id = 输入.sect_id
sa2.sect_id = 输入.sect_id
OPTION 输入.material_code <> ""
mb.material_code = 输入.material_code
ENDOPTION

View File

@@ -29,6 +29,7 @@ import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl;
import org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.AcsUtil;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.tasks.OutTask;
import org.nl.wms.st.inbill.service.CheckOutBillService;
@@ -2574,6 +2575,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String point_code = whereJson.getString("point_code"); // 终点
String iostorinv_id = whereJson.getString("iostorinv_id");
String iostorinvdtl_id = whereJson.getString("iostorinvdtl_id");
boolean checked = whereJson.getBoolean("checked"); // 是否异常出库
//查询主表信息
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
@@ -2608,11 +2610,66 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}
}
if (checked) {
// 查询此明细所有的层
JSONArray layerArr = WQL.getWO("ST_OUTIVT04")
.addParam("flag", "9")
.addParam("iostorinv_id", iostorinv_id)
.process()
.getResultJSONArray(0);
for (int i = 0; i < layerArr.size(); i++) {
JSONObject json = layerArr.getJSONObject(i);
String layer_num = json.getString("layer_num");
String out_point = "";
switch (layer_num) {
case "1" :
out_point = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_1").getValue();
break;
case "2" :
out_point = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_2").getValue();
break;
case "3" :
out_point = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_3").getValue();
break;
}
// 将这一巷道的所有木箱进行移库
JSONObject jsonNextPoint = attrTab.query("struct_code = '" + out_point + "'").uniqueResult(0);
JSONObject map2 = new JSONObject();
map2.put("block_num", jsonNextPoint.getString("block_num"));
map2.put("row_num", jsonNextPoint.getString("row_num"));
map2.put("out_order_seq", jsonNextPoint.getString("out_order_seq"));
map2.put("flag", "7");
JSONArray paramMoveArr = WQL.getWO("ST_OUTIVT04").addParamMap(map2).process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(paramMoveArr)) {
JSONObject moveParam = new JSONObject();
moveParam.put("jsonAllBlockPoint", paramMoveArr);
moveParam.put("task_group_id", IdUtil.getSnowflake(1,1).nextId());
this.createMove(moveParam);
new HandMoveStorAcsTask().immediateNotifyAcs(null);
// 更新任务为下发
JSONObject param = new JSONObject();
param.put("task_status", TaskStatusEnum.ISSUE.getCode());
wo_Task.update(param,"task_group_id = '"+moveParam.getString("task_group_id")+"'");
}
}
}
for (int i = 0; i < allRowArr.size(); i++) {
// 调用当前排处理方法
JSONObject jsonRow = allRowArr.getJSONObject(i);
jsonRow.put("iostorinv_id", iostorinv_id);
jsonRow.put("point_code", point_code);
jsonRow.put("checked", checked);
jsonRow.put("iostorinvdtl_id", iostorinvdtl_id);
jsonRow.put("point_id", jsonPoint2.getString("point_id"));
this.rowDispose(jsonRow);
@@ -2625,10 +2682,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
// 仓位表
WQLObject attr_tab = WQLObject.getWQLObject("st_ivt_structattr");
// 点位表
WQLObject point_tab = WQLObject.getWQLObject("sch_base_point");
String point_code = jsonRow.getString("point_code");
String iostorinvdtl_id = jsonRow.getString("iostorinvdtl_id");
String point_id = jsonRow.getString("point_id");
Boolean checked = jsonRow.getBoolean("checked");
/*
* 查询这一排的要出库的所有分配明细(正序)
@@ -2887,6 +2949,29 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
this.createMove(moveParam);
}
// 判断是否是异常出库口
if (checked) {
JSONObject jsonStartPoint = attr_tab.query("struct_code = '" + jsonObject.getString("struct_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStartPoint)) throw new BadRequestException("起始点位异常!");
String layer_num = jsonStartPoint.getString("layer_num");
switch (layer_num) {
case "1" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_1").getValue();
break;
case "2" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_2").getValue();
break;
case "3" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_3").getValue();
break;
default:
throw new BadRequestException("起点楼层异常:"+jsonStartPoint.getString("struct_code"));
}
point_id = point_tab.query("point_code = '"+point_code+"'").uniqueResult(0).getString("point_id");
}
// 创建任务
JSONObject param = new JSONObject();
param.put("task_type", "010503");
@@ -3031,6 +3116,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
String iostorinv_id = whereJson.getString("iostorinv_id");
String iostorinvdtl_id = whereJson.getString("iostorinvdtl_id");
String iostorinvdis_id = whereJson.getString("iostorinvdis_id");
boolean checked = whereJson.getBoolean("checked"); // 是否异常出库
String point_id = "";
//查询主表信息
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
@@ -3043,6 +3130,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
if (ObjectUtil.isEmpty(jsonPoint2)) {
throw new BadRequestException("该站点被锁定或者有载具号,不允许设置!");
}
point_id = jsonPoint2.getString("point_id");
// 查询未生成和生成未下发的分配记录
JSONArray disArrOne = WQL.getWO("QST_IVT_CHECKOUTBILL")
@@ -3291,6 +3379,29 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
this.createMove(moveParam);
}
// 判断是否是异常出库口
if (checked) {
JSONObject jsonStartPoint = attrTab.query("struct_code = '" + jsonObject.getString("struct_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonStartPoint)) throw new BadRequestException("起始点位异常!");
String layer_num = jsonStartPoint.getString("layer_num");
switch (layer_num) {
case "1" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_1").getValue();
break;
case "2" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_2").getValue();
break;
case "3" :
point_code = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("out_point_3").getValue();
break;
default:
throw new BadRequestException("起点楼层异常:"+jsonStartPoint.getString("struct_code"));
}
point_id = wo_Point.query("point_code = '"+point_code+"'").uniqueResult(0).getString("point_id");
}
// 创建任务
JSONObject param = new JSONObject();
param.put("task_type", "010503");
@@ -3309,7 +3420,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject jsonUpdateMap = new JSONObject();
jsonUpdateMap.put("work_status", "01");
jsonUpdateMap.put("task_id", jsonTask.getLong("task_id"));
jsonUpdateMap.put("point_id", jsonPoint2.getLongValue("point_id"));
jsonUpdateMap.put("point_id", point_id);
wo_dis.update(jsonUpdateMap, "iostorinvdis_id = '" + jsonObject.getString("iostorinvdis_id") + "'");
// 1.判断此条分配明细的 ‘仓位’在此主表下的分配明细是否有相同的 ‘仓位’
@@ -3323,7 +3434,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject jsonObject2 = disArr.getJSONObject(n);
jsonObject2.put("work_status", "01");
jsonObject2.put("task_id", jsonTask.getLong("task_id"));
jsonObject2.put("point_id", jsonPoint2.getLongValue("point_id"));
jsonObject2.put("point_id", point_id);
wo_dis.update(jsonObject2);
}
@@ -3377,7 +3488,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject jsonUpdateMap2 = new JSONObject();
jsonUpdateMap2.put("work_status", "01");
jsonUpdateMap2.put("task_id", jsonTask2.getLong("task_id"));
jsonUpdateMap2.put("point_id", jsonPoint2.getLongValue("point_id"));
jsonUpdateMap2.put("point_id", point_id);
wo_dis.update(jsonUpdateMap2, "iostorinvdis_id = '" + jsonNext.getString("iostorinvdis_id") + "'");
// 1.判断此条分配明细的 ‘仓位’在此主表下的分配明细是否有相同的 ‘仓位’
@@ -3391,7 +3502,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject jsonObject3 = disArr2.getJSONObject(m);
jsonObject3.put("work_status", "01");
jsonObject3.put("task_id", jsonTask2.getLong("task_id"));
jsonObject3.put("point_id", jsonPoint2.getLongValue("point_id"));
jsonObject3.put("point_id", point_id);
wo_dis.update(jsonObject3);
}
@@ -3421,6 +3532,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
String is_move = whereJson.getString("is_move");
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
@@ -3429,9 +3541,16 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
if (ObjectUtil.isNotEmpty(is_move)) {
mapParam.put("bill_type", "28");
mapParam.put("buss_type", "28");
mapParam.put("bill_status", "20");
} else {
mapParam.put("bill_type", "21");
mapParam.put("buss_type", "21");
mapParam.put("bill_status", "10");
}
mapParam.put("biz_date", DateUtil.today());
mapParam.put("stor_code", "CP01");
mapParam.put("stor_id", "1582991156504039424");

View File

@@ -163,7 +163,7 @@ export default {
this.timer = setInterval(() => { // 定时刷新
console.log('定时器启动')
this.initStatus()
}, 10000)
}, 2000)
},
initStatus() {
const data = {

View File

@@ -0,0 +1,193 @@
<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.device_code"
size="mini"
clearable
placeholder="设备编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="是否异常">
<el-select
v-model="query.is_fault"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.IS_OR_NOT"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备区域">
<el-select
v-model="query.region_code"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.DEVICE_REGION_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备车间">
<el-select
v-model="query.plant_code"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.product_area"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
size="mini"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip width="150px" />
<el-table-column prop="device_name" label="设备名称 " show-overflow-tooltip width="300px" />
<el-table-column prop="is_fault" label="状态 " show-overflow-tooltip width="100px">
<template slot-scope="scope">
<el-button v-if="scope.row.is_fault==='1'" type="danger" circle />
<el-button v-if="scope.row.is_fault==='0'" type="success" circle />
</template>
</el-table-column>
<el-table-column prop="plant_code" label="所属车间 " show-overflow-tooltip width="100px" :formatter="formatType1" />
<el-table-column prop="region_code" label="所属区域 " show-overflow-tooltip width="100px" :formatter="formatType2" />
<el-table-column prop="fault_type" label="异常类型 " show-overflow-tooltip width="100px" :formatter="formatType3" />
<el-table-column prop="fault_info" label="故障信息" show-overflow-tooltip width="250px" />
<el-table-column prop="solve_mode" label="解决方式" show-overflow-tooltip width="250px" />
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudFaultdevice from '@/views/wms/basedata/master/faultdevice/faultdevice'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = {
}
export default {
name: 'Devicecharge',
dicts: ['DEVICE_ERROR_TYPE', 'IS_OR_NOT', 'DEVICE_REGION_TYPE', 'product_area'],
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '设备故障监控',
url: 'api/faultdevice/deviceCharge',
optShow: {
add: false,
reset: true
},
size: 20,
idField: 'device_id',
sort: 'device_id,desc',
crudMethod: { ...crudFaultdevice }
})
},
data() {
return {
permission: {},
syncLoading: false,
rules: {
}
}
},
mounted() {
this.init()
},
beforeDestroy() {
// js提供的clearInterval方法用来清除定时器
console.log('定时器销毁')
clearInterval(this.timer)
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
init: function() {
this.initStageData()
},
initStageData() {
this.timer = setInterval(() => {
console.log('定时器启动')
this.initStatus()
}, 2000)
},
initStatus() {
const data = this.crud.query
crudFaultdevice.deviceCharge(data).then(res => {
this.crud.data = res.content
this.crud.page.size = 10
})
},
formatType1(row) {
return this.dict.label.product_area[row.plant_code]
},
formatType2(row) {
return this.dict.label.DEVICE_REGION_TYPE[row.region_code]
},
formatType3(row) {
return this.dict.label.DEVICE_ERROR_TYPE[row.fault_type]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -129,6 +129,14 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="是否自动贴标" prop="is_auto_table">
<el-radio v-model="form.is_auto_table" label="0">否</el-radio>
<el-radio v-model="form.is_auto_table" label="1">是</el-radio>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="16">
<el-form-item label="备注">
<el-input v-model="form.remark" style="width: 550px;" type="textarea" />
@@ -159,6 +167,7 @@
<el-table-column prop="bz_print_no" label="包装打印模板" width="150px" :formatter="printTemple" show-overflow-tooltip />
<el-table-column prop="shd_print_no" label="送货单打印模板路径" width="180px" show-overflow-tooltip/>
<el-table-column prop="shd_dtl_num" label="送货单明细数" width="150px" show-overflow-tooltip />
<el-table-column prop="is_auto_table" label="是否自动贴标" width="150px" show-overflow-tooltip :formatter="autoTable"/>
<el-table-column prop="update_optname" label="修改者" />
<el-table-column prop="update_time" label="修改时间" width="150" />
<el-table-column label="启用" align="center" prop="is_used">
@@ -239,7 +248,8 @@ const defaultForm = {
class_name: null,
zj_print_no: null,
bz_print_no: null,
shd_print_no: null
shd_print_no: null,
is_auto_table: '1'
}
export default {
name: 'Customerbase',
@@ -369,6 +379,9 @@ export default {
},
printTemple(row) {
return this.dict.label.print_temple[row.bz_print_no]
},
autoTable(row) {
return this.dict.label.is_used[row.is_auto_table]
}
}
}

View File

@@ -0,0 +1,42 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/faultdevice',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/faultdevice/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/faultdevice',
method: 'put',
data
})
}
export function syncInfo() {
return request({
url: 'api/faultdevice/syncInfo',
method: 'post'
})
}
export function deviceCharge(params) {
return request({
url: 'api/faultdevice/deviceCharge',
method: 'get',
params
})
}
export default { add, edit, del, syncInfo, deviceCharge }

View File

@@ -0,0 +1,211 @@
<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.fault_code"
size="mini"
clearable
placeholder="故障编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="异常类型">
<el-select
v-model="query.fault_type"
clearable
size="mini"
placeholder="请选择"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.DEVICE_ERROR_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
<rrOperation />
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-thumb"
size="mini"
:loading="syncLoading"
@click="syncInfo"
>
同步
</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="550px"
>
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="140px">
<el-form-item label="故障编码:" prop="fault_code">
<el-input v-model="form.fault_code" style="width: 300px;" :disabled="true" />
</el-form-item>
<el-form-item label="故障信息:" prop="fault_info">
<el-input v-model="form.fault_info" style="width: 300px;" :disabled="true" />
</el-form-item>
<el-form-item label="异常类型:" prop="fault_type">
<el-select
v-model="form.fault_type"
size="mini"
:disabled="true"
placeholder="请选择"
class="filter-item"
style="width: 300px"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.DEVICE_ERROR_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="解决方式:" prop="solve_mode">
<el-input v-model="form.solve_mode" type="textarea" :rows="2" style="width: 300px;" />
</el-form-item>
</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 prop="fault_code" label="故障编码" show-overflow-tooltip />
<el-table-column prop="fault_info" label="故障信息 " show-overflow-tooltip width="150px" />
<el-table-column prop="fault_type" label="异常类型 " show-overflow-tooltip width="100px" :formatter="formatType" />
<el-table-column prop="solve_mode" label="解决方式" show-overflow-tooltip width="300px" />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" width="150" />
<el-table-column prop="update_name" label="修改者" />
<el-table-column prop="update_time" label="修改时间" width="150" />
<el-table-column
v-permission="['admin','customerbase:edit','customerbase:del']"
label="操作"
width="150px"
align="center"
>
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-dle="true"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudFaultdevice from '@/views/wms/basedata/master/faultdevice/faultdevice'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = {
fault_id: null,
fault_code: null,
fault_info: null,
acs_type: null,
solve_mode: null,
create_id: null,
create_name: null,
create_time: null,
update_id: null,
update_name: null,
update_time: null
}
export default {
name: 'Faultdevice',
dicts: ['DEVICE_ERROR_TYPE'],
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '设备故障处理',
url: 'api/faultdevice',
optShow: {
add: false,
reset: true
},
idField: 'device_id',
sort: 'device_id,desc',
crudMethod: { ...crudFaultdevice }
})
},
data() {
return {
permission: {},
syncLoading: false,
rules: {
}
}
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
syncInfo() {
this.syncLoading = true
crudFaultdevice.syncInfo().then(res => {
this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
this.syncLoading = false
}).catch(() => {
this.syncLoading = false
})
},
formatType(row) {
return this.dict.label.DEVICE_ERROR_TYPE[row.fault_type]
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,312 @@
<template>
<div>
<el-row>
<div id="container" className="container" />
</el-row>
<!--点击设备显示信息-->
<el-dialog
id="dialogs"
title="点位信息"
class="newDialog"
:visible.sync="dialogDeviceMsgVisible"
width="22%"
:top="tops"
:show-close="false"
:modal="false"
>
<el-table
:data="arr"
style="width: 100%"
max-height="500px"
>
<el-table-column
prop="name"
label="监控项"
/>
<el-table-column
prop="value"
label="当前值"
/>
</el-table>
</el-dialog>
<!--弹窗设置设备与图标绑定与角度-->
<el-dialog title="点位操作" :visible.sync="dialogFormVisible1" width="35%">
<el-form :model="form" size="small">
<el-form-item label="点位编码:" prop="device_code" label-width="80px">
<el-input v-model="form.point_code" :disabled="true" />
</el-form-item>
<el-form-item label="木箱号:" label-width="80px">
<el-input v-model="form.vehicle_code" :disabled="true" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible1 = false"> </el-button>
<el-button type="primary" @click="unlock"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import crudStage from '@/api/logicflow/stage'
import '@logicflow/core/dist/style/index.css'
import '@logicflow/extension/lib/style/index.css'
import { LogicFlow } from '@logicflow/core'
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
import { getStructByCodesFs, unLockPoint } from '@/views/system/monitor/device/structStage'
let data = {}
let lf = ''
export default {
// 发货区监控1层
name: 'Sendout',
data() {
return {
stageParam: 'FS_2', // 舞台参数
dialogDeviceMsgVisible: false,
device_code: null,
tops: '20vh',
stage_code: '',
stageSelectList: [],
arr: [], // 显示数组
dialogFormVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
form: {
point_code: '',
vehicle_code: ''
},
allStructMsg: [],
msgTop: '200px',
msgLeft: '200px'
}
},
mounted() {
this.init()
},
beforeDestroy() {
// js提供的clearInterval方法用来清除定时器
console.log('定时器销毁')
clearInterval(this.timer)
},
methods: {
// 流程图初始化
init() {
// 初始化配置
lf = new LogicFlow({
overlapMode: 1,
container: document.querySelector('#container'), // 容器
// 画布配置
// width: window.innerWidth, // 宽度
height: window.innerHeight, // 高度
grid: { // 不用格子直接显示,使用背景
visible: false,
type: 'mesh',
size: 5
},
background: {
// backgroundImage: 'url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2QwZDBkMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZDBkMGQwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=")',
backgroundRepeat: 'repeat'
},
adjustEdge: false,
adjustEdgeMiddle: false,
adjustEdgeStartAndEnd: false,
adjustNodePosition: false,
hideAnchors: true,
nodeTextEdit: false,
edgeTextEdit: false
})
lf.setTheme(
{
baseEdge: { strokeWidth: 1 },
baseNode: { strokeWidth: 1 },
nodeText: { overflowMode: 'autoWrap', lineHeight: 1.5 },
edgeText: { overflowMode: 'autoWrap', lineHeight: 1.5 }
}
)
// 注册自定义元素
registerCustomElement(lf)
// 删除默认的右键菜单
lf.extension.menu.setMenuConfig({
nodeMenu: false
})
lf.on('node:click', (data, e) => { // 鼠标点击节点
// 展开显示设备信息 todo: 1
if (data.data.type !== 'pro-rect' && data.data.type !== 'pro-circle' && data.data.type !== 'triangle' && data.data.type !== 'rect-radius') {
if (data.data.properties.struct_id) {
this.moveShow(data.data) // 传递节点数据用来获取id做比对
this.dialogDeviceMsgVisible = true
this.struct_id = data.data.properties.struct_id // ?暂时没用
this.tops = data.e.y + 'px'
document.getElementsByClassName('el-dialog')[0].style.marginLeft = data.e.x + 'px'
}
}
})
// 右键单击事件
lf.on('node:contextmenu', (data, e) => {
debugger
let item = ''
item = this.allStructMsg.find((structMsg) => structMsg.id === data.data.id)
const data1 = item.data[0]
this.form.point_code = data1.point_code
this.form.vehicle_code = data1.vehicle_code
this.dialogFormVisible1 = true
})
// lf.on('node:mouseleave', (data, e) => {
// this.dialogDeviceMsgVisible = false
// })
// 开始渲染
lf.render(data)
this.initStageData()
},
initStageData() {
// 获取舞台编码
crudStage.getNewStageDataByCode(this.stageParam).then(res => {
data = JSON.parse(res.stage_data)
lf.render(data)
this.initStatus()
})
// todo: 定时器
this.timer = setInterval(() => { // 定时刷新设备的状态信息
console.log('定时器启动')
this.initStatus()
}, 10000)
},
initStatus() { // 初始化数据
let resion = {}
resion = lf.getGraphData().nodes.map(item => ({ id: item.id, struct_id: item.properties.struct_id }))
getStructByCodesFs(resion).then(res => {
this.allStructMsg = res
// 实时设置状态信息
for (var item of res) { // 循环设置属性
if (item.struct_status != undefined) {
lf.setProperties(item.id, {
struct_status: item.struct_status
})
}
}
// 设置动态实时显示设备信息
const { nodes } = lf.getSelectElements() // 获取选中的节点
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
}
})
},
moveShow(nodeData) { // 点击之后显示出来的数据----只需要设备信息
let item = ''
// 查找点击节点的id
item = this.allStructMsg.find((structMsg) => structMsg.id === nodeData.id)
this.arr = [] // 清空
if (item.struct_id && item.data) { // item.data是数组
this.arr = [
{ name: '货位编号', value: item.struct_code }
]
const data1 = item.data[0] // 至少有一条
const data = item.data // 总的data数据
// 以下是设置参数显示值
for (const val in data1) {
if (val === 'vehicle_code' && data1.vehicle_code) {
const obj = { name: '木箱号', value: data1[val] }
this.arr.push(obj)
}
if (val === 'quanlity_in_box' && data1.quanlity_in_box) {
const obj = { name: '子卷数', value: data1[val] }
this.arr.push(obj)
}
if (val === 'sale_order_name' && data1.sale_order_name) {
const obj = { name: '订单号', value: data1[val] }
this.arr.push(obj)
}
if (val === 'product_description' && data1.product_description) {
const obj = { name: '物料', value: data1[val] }
this.arr.push(obj)
}
if (val === 'box_weight' && data1.box_weight) {
const obj = { name: '木箱总重', value: data1[val] }
this.arr.push(obj)
}
}
if (data.length > 1) { // 显示子卷
for (let i = 0; i < data.length; i++) {
let container_name
let net_weight
for (const val in data[i]) {
if (val === 'container_name' && data[i].container_name) {
container_name = data[i][val]
}
if (val === 'net_weight' && data[i].net_weight) {
net_weight = data[i][val]
}
}
if (container_name && net_weight) {
const obj = { name: container_name, value: net_weight }
this.arr.push(obj)
}
}
}
}
},
unlock() {
// 解锁点位
if (this.form.vehicle_code === '') {
this.$message({
message: '此点位已解绑',
type: 'warning'
})
return
}
unLockPoint(this.form).then(res => {
this.dialogFormVisible1 = false
this.initStageData()
this.$message({
message: '解绑成功',
type: 'success'
})
})
}
}
}
</script>
<style>
html, body {
height: 100%;
}
body {
padding: 0;
margin: 0;
}
</style>
<style scoped>
.container {
background-color: #f8f9fa;
height: 100%;
}
.newDialog /deep/ .el-dialog__header {
padding: 1vh 1vw 0 1vw;
}
.newDialog /deep/ .el-dialog__body {
padding: 1vh 1vw;
}
.toolbar-sty {
position: absolute;
margin-top: 5px;
top: 0;
padding: 5px;
left: 30px;
height: 45px;
/*width: 310px;*/
display: flex;
align-items: center;
border-bottom: 1px solid #e5e5e5;
z-index: 10;
background: #e5e5e5;
}
</style>

View File

@@ -171,6 +171,9 @@
/>
</el-select>
</el-form-item>
<el-form-item prop="checked">
<el-checkbox v-model="checked">是否异常出库</el-checkbox>
</el-form-item>
</el-form>
</div>
<span class="crud-opts-right2">
@@ -317,6 +320,7 @@ export default {
tabledis: [],
currentRow: {},
currentDis: {},
checked: false,
form: {
gender2: ''
},
@@ -593,6 +597,7 @@ export default {
this.loadingSetPoint = true
if (this.currentDis.iostorinvdis_id !== null) {
this.currentDis.point_code = this.form2.point_code
this.currentDis.checked = this.checked
checkoutbill.oneSetPoint2(this.currentDis).then(res => {
this.queryTableDdis(this.currentDis.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
@@ -614,6 +619,7 @@ export default {
}
this.loadingSetAllPoint = true
this.currentRow.point_code = this.form2.point_code
this.currentRow.checked = this.checked
checkoutbill.allSetPoint(this.currentRow).then(res => {
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
@@ -630,7 +636,8 @@ export default {
this.loadingSetAllPoint = true
const data = {
'point_code': this.form2.point_code,
'iostorinv_id': this.mstrow.iostorinv_id
'iostorinv_id': this.mstrow.iostorinv_id,
'checked': this.checked
}
checkoutbill.allSetPoint(data).then(res => {
// this.queryTableDdis(this.currentRow.iostorinvdtl_id)