Browse Source

完善项目

master
张江玮 2 years ago
parent
commit
0bd8060be0
  1. 2
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvService.java
  2. 19
      acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  3. BIN
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls
  4. 65
      acs/hd/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java
  5. 45
      acs/hd/nladmin-system/src/main/java/org/nl/hand/service/PadService.java
  6. 80
      acs/hd/nladmin-system/src/main/java/org/nl/hand/service/dto/PadDto.java
  7. 218
      acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java
  8. 176
      acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql
  9. BIN
      acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/sys_table.xls
  10. 4
      lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/rest/SendMaterialController.java
  11. 4
      lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/service/SendMaterialService.java
  12. 113
      lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/service/impl/SendMaterialServiceImpl.java
  13. 47
      lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java
  14. 7
      lms/hd/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RegionioInServiceImpl.java
  15. 18
      lms/qd/src/views/wms/basedata/st/ivt/index.vue
  16. 11
      lms/qd/src/views/wms/st/inbill/index.vue

2
acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/AgvService.java

@ -21,6 +21,4 @@ public interface AgvService {
//
public String queryAllDoorStatus();
}

19
acs/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java

@ -141,25 +141,6 @@ public class AgvServiceImpl implements AgvService {
return ja.toString();
}
public static void main(String[] args) {
String address = "L1-01-01";
if (address.indexOf("-") > 0) {

BIN
acs/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls

Binary file not shown.

65
acs/hd/nladmin-system/src/main/java/org/nl/hand/rest/PadController.java

@ -0,0 +1,65 @@
package org.nl.hand.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.hand.service.PadService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author qxuan
* @date 2021-07-21
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "平板接口")
@RequestMapping("/api/hand")
@Slf4j
public class PadController {
private final PadService HandService;
@PostMapping("/tasks")
@Log("查询任务")
@ApiOperation("查询任务")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryTask(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.queryTask(whereJson), HttpStatus.OK);
}
@PostMapping("/insts")
@Log("查询指令")
@ApiOperation("查询指令")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> queryInst(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.queryInst(whereJson), HttpStatus.OK);
}
@PostMapping("/inst")
@Log("指令操作")
@ApiOperation("指令操作")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> Instoperation(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.Instoperation(whereJson), HttpStatus.OK);
}
@PostMapping("/taskoperation")
@Log("任务操作")
@ApiOperation("任务操作")
//@PreAuthorize("@el.check('sect:list')")
public ResponseEntity<Object> Taskoperation(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(HandService.Taskoperation(whereJson), HttpStatus.OK);
}
}

45
acs/hd/nladmin-system/src/main/java/org/nl/hand/service/PadService.java

@ -0,0 +1,45 @@
package org.nl.hand.service;
import java.util.Map;
/**
* @author qxuan
* @description 服务接口
* @date 2021-07-21
**/
public interface PadService {
/**
* 查询指令
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> queryInst(Map<String, String> jsonObject);
/**
* 查询任务
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> queryTask(Map<String, String> jsonObject);
/**
* 指令操作
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> Instoperation(Map<String, String> jsonObject);
/**
* 任务操作
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> Taskoperation(Map<String, String> jsonObject);
}

80
acs/hd/nladmin-system/src/main/java/org/nl/hand/service/dto/PadDto.java

@ -0,0 +1,80 @@
package org.nl.hand.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author qxuan
* @description /
* @date 2021-07-21
**/
@Data
public class PadDto implements Serializable {
/**
* 库区标识
*/
private String sect_uuid;
/**
* 库区编码
*/
private String sect_code;
/**
* 库区名称
*/
private String sect_name;
/**
* 库区简称
*/
private String simple_name;
/**
* 库区类型
*/
private String sect_type;
/**
* 顺序号
*/
private BigDecimal order_seq;
/**
* 仓库标识
*/
private String store_uuid;
/**
* 是否启用
*/
private String is_active;
/**
* 是否删除
*/
private String is_delete;
/**
* 创建者
*/
private String create_by;
/**
* 创建时间
*/
private String create_time;
/**
* 修改者
*/
private String update_by;
/**
* 修改时间
*/
private String update_time;
}

218
acs/hd/nladmin-system/src/main/java/org/nl/hand/service/impl/PadServiceImpl.java

@ -0,0 +1,218 @@
package org.nl.hand.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
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.acs.agv.server.AgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.config.server.impl.AcsConfigServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.exception.BadRequestException;
import org.nl.hand.service.PadService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* @author qxuan
* @description 服务实现
* @date 2021-07-21
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class PadServiceImpl implements PadService {
@Override
public Map<String, Object> queryInst(Map<String, String> jsonObject) {
//查询位完成的指令
JSONObject resultJson = new JSONObject();
JSONArray resultArr = WQL.getWO("QHAND_QUERY").addParam("flag", "4").addParamMap((HashMap) jsonObject).process().getResultJSONArray(0);
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", resultArr);
return resultJson;
}
@Override
public Map<String, Object> queryTask(Map<String, String> jsonObject) {
String key = jsonObject.get("keyword");
String start_point = jsonObject.get("start_devicecode");
String next_point = jsonObject.get("next_devicecode");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "2");
map.put("key", key);
map.put("start_point", start_point);
map.put("next_point", next_point);
//查询有任务 但是没有指令的任务
JSONArray result = WQL.getWO("QHAND_QUERY").addParamMap(map).process().getResultJSONArray(0);
JSONObject resultJson = new JSONObject();
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
resultJson.put("result", result);
return resultJson;
}
@Override
public Map<String, Object> Instoperation(Map<String, String> jsonObject) {
JSONObject jo = new JSONObject();
String type = jsonObject.get("type");
String inst_uuid = jsonObject.get("inst_uuid");
JSONObject instwo = WQLObject.getWQLObject("acs_instruction").query("instruction_id='" + inst_uuid + "'").uniqueResult(0);
if (instwo == null) {
throw new BadRequestException("未找到该指令!");
}
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
AcsConfigService acsConfigService = SpringContextHolder.getBean(AcsConfigServiceImpl.class);
String task_id = instwo.getString("task_id");
/* 1 指令撤销
2 重新下发
3 强制完成*/
if (type.equals("1")) {
//调用agv删除任务的接口
agvService = SpringContextHolder.getBean("agvServiceImpl");
try {
agvService.deleteAgvInstToNDC(instwo.toJavaObject(Instruction.class));
instructionService.cancel(inst_uuid);
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
if (type.equals("2")) {
Instruction instdto = (Instruction) JSONObject.toJavaObject(instwo, Instruction.class);
AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
try {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "1")) {
agvService.sendAgvInstToNDC(instdto);
} else if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.AGVTYPE).toString(), "2")) {
agvService.sendAgvInstToNDC(instdto);
}
}
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
if (type.equals("3")) {
//完成指令
try {
instructionService.finish(inst_uuid);
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
}
jo.put("code", "1");
jo.put("desc", "操作成功");
jo.put("result", new JSONObject());
return jo;
}
@Override
public Map<String, Object> Taskoperation(Map<String, String> jsonObject) {
JSONObject jo = new JSONObject();
String task_uuid = jsonObject.get("inst_uuid");
String type = jsonObject.get("type");
JSONObject taskjo = WQLObject.getWQLObject("acs_task").query("task_id='" + task_uuid + "'").uniqueResult(0);
if (StrUtil.isEmpty(task_uuid)) {
throw new BadRequestException("id不能为空!");
}
if (StrUtil.isEmpty(type)) {
throw new BadRequestException("操作类型不能为空!");
}
//重新生成
if (type.equals("1")) {
//重新生产指令
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO"));
instdto.setRemark(taskjo.getString("remark"));
instdto.setMaterial(taskjo.getString("taskjo"));
instdto.setTask_id(taskjo.getString("task_id"));
instdto.setTask_code(taskjo.getString("task_code"));
instdto.setVehicle_code(taskjo.getString("vehicle_code"));
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_point_code(taskjo.getString("start_point_code"));
instdto.setNext_point_code(taskjo.getString("next_point_code"));
instdto.setStart_device_code(taskjo.getString("start_device_code"));
instdto.setNext_device_code(taskjo.getString("next_device_code"));
instdto.setInstruction_status("0");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
try {
instructionService.create(instdto);
TaskDto acsTask = (TaskDto) JSONObject.toJavaObject(taskjo, TaskDto.class);
acsTask.setTask_status("1");
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(acsTask));
taskwo.update(json);
} catch (Exception e) {
jo.put("code", "2");
jo.put("desc", e.getMessage());
jo.put("result", "");
return jo;
}
instdto.setExecute_device_code(taskjo.getString("start_point_code"));
//下发指令给agv
// AgvService agvserver = SpringContextHolder.getBean("agvServiceImpl");
// try {
// agvserver.sendAgvInstToMagic(instdto);
// } catch (Exception e) {
// jo.put("code", "2");
// jo.put("desc", e.getMessage());
// jo.put("result", "");
// return jo;
// }
}
//强制完成
if (type.equals("2")) {
//手工完成
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
TaskDto acsTask = (TaskDto) JSONObject.toJavaObject(taskjo, TaskDto.class);
taskService.finish(acsTask.getTask_id());
}
jo.put("code", "1");
jo.put("desc", "操作成功");
jo.put("result", new JSONObject());
return jo;
}
}

176
acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/QHAND_QUERY.wql

@ -0,0 +1,176 @@
[交易说明]
交易名: 手持接口查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.key TYPEAS s_string
输入.keyword TYPEAS s_string
输入.start_devicecode TYPEAS s_string
输入.next_devicecode TYPEAS s_string
输入.detail_id TYPEAS s_string
输入.start_point TYPEAS s_string
输入.next_point TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
dtl.detail_id as region_id,
dtl.label as region_name,
dtl.value as region_code
FROM
sys_dict sys
LEFT JOIN sys_dict_detail dtl ON dtl.dict_id = sys.dict_id
WHERE
sys.NAME = "region_type"
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
task.task_id AS task_uuid,
task.task_code AS task_no,
task.start_point_code AS start_devicecode,
task.next_point_code AS next_devicecode,
task.task_type AS task_type,
sys2.VALUE AS material_type_name,
sys2.label AS material_type,
sys.VALUE AS task_status_name,
sys.label AS task_status,
task.vehicle_code AS carrier,
task.create_time,
task.priority
FROM
acs_task task
LEFT JOIN sys_dict_detail sys ON sys.label = task.task_status
AND sys.NAME = 'task_status'
LEFT JOIN sys_dict_detail sys2 ON sys2.VALUE = task.material
AND sys2.NAME = 'material_type'
where
( task.task_status ='1' or task.task_status ='0' )
and
( task.task_id IN (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1 and (instruction_status<>'1' and instruction_status <>'2' and instruction_status <>'0')) or task.task_id not in (select inst.task_id FROM acs_instruction inst where inst.is_delete<>1
))
OPTION 输入.key <> ""
(task.task_code like 输入.key or task.task_status like 输入.key)
ENDOPTION
OPTION 输入.start_point <> ""
task.start_point_code = 输入.start_point
ENDOPTION
OPTION 输入.next_point <> ""
task.next_point_code = 输入.next_point
ENDOPTION
ORDER BY task.create_time
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
*
FROM
sys_dict_detail detl
WHERE
1=1
OPTION 输入.detail_id <> ""
detl.detail_id = 输入.detail_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
inst.instruction_id AS inst_uuid,
inst.task_code AS task_no,
inst.instruction_code AS inst_no,
inst.start_point_code AS start_devicecode,
inst.next_point_code AS next_devicecode,
inst.instruction_status AS inst_status,
dtl.VALUE AS inst_status_name,
inst.execute_message AS inst_step,
inst.vehicle_code AS carrier,
inst.carno,
inst.priority,
inst.create_time,
inst.material AS material_type,
dtl2.VALUE AS material_type_name
FROM
acs_instruction inst
LEFT JOIN sys_dict_detail AS dtl ON dtl.label = inst.instruction_status
AND dtl.NAME = 'task_status'
LEFT JOIN sys_dict_detail AS dtl2 ON dtl2.label = inst.material
AND dtl2.NAME = 'material_type'
WHERE
inst.is_delete = '0'
AND (inst.instruction_status ='1'
OR inst.instruction_status ='0')
OPTION 输入.keyword <> ""
(inst.instruction_code like 输入.keyword
or
inst.task_code like 输入.keyword
or inst.execute_device_code like 输入.keyword)
ENDOPTION
OPTION 输入.start_devicecode <> ""
inst.start_point_code = 输入.start_devicecode
ENDOPTION
OPTION 输入.next_devicecode <> ""
inst.next_point_code = 输入.next_devicecode
ENDOPTION
ORDER BY inst.create_time desc
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
detl.label AS label,
detl.
VALUE
AS value
FROM
sys_dict_detail detl
WHERE
detl.name = 'material_type'
ENDSELECT
ENDQUERY
ENDIF

BIN
acs/hd/nladmin-system/src/main/java/org/nl/hand/wql/sys_table.xls

Binary file not shown.

4
lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/rest/SendMaterialController.java

@ -38,7 +38,7 @@ public class SendMaterialController {
@PostMapping("/confirm")
@Log("送料确定")
@ApiOperation("送料确定")
public ResponseEntity<JSONObject> confirm(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(sendMaterialService.confirm(whereJson), HttpStatus.OK);
public ResponseEntity<JSONObject> confirm(@RequestBody JSONObject param) {
return new ResponseEntity<>(sendMaterialService.confirm(param), HttpStatus.OK);
}
}

4
lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/service/SendMaterialService.java

@ -14,8 +14,8 @@ public interface SendMaterialService {
/**
* 送料确定
*
* @param whereJson /
* @param param /
* @return JSONObject
*/
JSONObject confirm(JSONObject whereJson);
JSONObject confirm(JSONObject param);
}

113
lms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendmaterial/service/impl/SendMaterialServiceImpl.java

@ -1,12 +1,18 @@
package org.nl.wms.pda.sendmaterial.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
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.wms.ext.acs.service.AcsToWmsService;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wms.pda.sendmaterial.service.SendMaterialService;
import org.nl.wms.sch.tasks.SendMaterialTask;
import org.nl.wms.st.inbill.service.dto.RegionioDto;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.core.engine.object.WO;
@ -18,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
@Slf4j
public class SendMaterialServiceImpl implements SendMaterialService {
private final AcsToWmsService acsToWmsService;
private final SendMaterialTask sendMaterialTask;
@Override
public JSONObject queryPoint() {
@ -26,8 +32,8 @@ public class SendMaterialServiceImpl implements SendMaterialService {
JSONObject resultJSON = new JSONObject();
// 查询所有区域
WO wo = WQL.getWO("PDA_SENDMATERIAL_01");
JSONArray result = wo
JSONArray result = WQL
.getWO("PDA_SENDMATERIAL_01")
.addParam("flag", "1")
.process()
.getResultJSONArray(0);
@ -35,7 +41,8 @@ public class SendMaterialServiceImpl implements SendMaterialService {
// 遍历所有区域查询区域下的点位
for (Object r : result) {
JSONObject region = (JSONObject) r;
JSONArray pointArr = wo
JSONArray pointArr = WQL
.getWO("PDA_SENDMATERIAL_01")
.addParam("flag", "2")
.addParam("region_id", region.getString("region_id"))
.process()
@ -50,31 +57,81 @@ public class SendMaterialServiceImpl implements SendMaterialService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject confirm(JSONObject whereJson) {
JSONObject result = new JSONObject();
// 1、准备参数:point_code、type:2为共挤区域,8为豪凯区域
JSONObject param = new JSONObject();
public JSONObject confirm(JSONObject param) {
// 返回值
JSONObject resultJSON = new JSONObject();
String region_id = whereJson.getString("region_id");
JSONObject jsonObject = WQLObject.getWQLObject("sch_base_region").query("region_id ='" + region_id + "'").uniqueResult(0);
String region_code = jsonObject.getString("region_code");
if (StrUtil.equals(region_code, "GJQY01")) param.put("type","2");
if (StrUtil.equals(region_code, "HKQY01")) param.put("type","8");
// 参数校验
String startRegionId = param.getString("start_region_id");
if (StrUtil.isEmpty(startRegionId)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "起点区域不能为空");
return resultJSON;
}
String startPointCode = param.getString("start_point_code");
if (StrUtil.isEmpty(startPointCode)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "起点不能为空");
return resultJSON;
}
String nextRegionId = param.getString("next_region_id");
if (StrUtil.isEmpty(nextRegionId)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "终点区域不能为空");
return resultJSON;
}
String nextPointCode = param.getString("next_point_code");
if (StrUtil.isEmpty(nextPointCode)) {
resultJSON.put("code", "0");
resultJSON.put("desc", "终点不能为空");
return resultJSON;
}
WQLObject regionIOTable = WQLObject.getWQLObject("st_ivt_regionio");
long id = IdUtil.getSnowflake(1, 1).nextId();
try {
// 创建搬运记录
RegionioDto dto = new RegionioDto();
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
dto.setIostorinv_id(id);
dto.setBill_code(CodeUtil.getNewCode("IN_STORE_CODE"));
dto.setIo_type("0");
dto.setBill_status("10");
dto.setStart_region_id(startRegionId);
dto.setStart_point_code(startPointCode);
dto.setEnd_region_id(nextRegionId);
dto.setEnd_point_code(nextPointCode);
dto.setCreate_mode("02");
dto.setCreate_id(currentUserId);
dto.setCreate_name(nickName);
dto.setUpdate_optid(currentUserId);
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
regionIOTable.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
// 创建任务并自动下发
String taskId = sendMaterialTask.createTask(param);
// 创建并下发成功后更新搬运记录
JSONObject json = new JSONObject();
json.put("task_id", taskId);
json.put("bill_status", "20");
regionIOTable.update(json, "iostorinv_id = " + id);
} catch (Exception e) {
// 报错删除搬运记录(任务已在createTask中删除)
regionIOTable.delete("iostorinv_id = " + id);
param.put("point_code",whereJson.getString("point_code"));
param.put("qty",whereJson.getString("qty"));
// 2、调用接口
JSONObject json = acsToWmsService.apply(param);
if (StrUtil.equals(json.getString("status"), "200")) {
result.put("result", "");
result.put("code", "1");
result.put("desc", "操作成功");
} else {
result.put("result", "");
result.put("code", "0");
result.put("desc", "操作失败:"+json.getString("message"));
resultJSON.put("code", "0");
resultJSON.put("desc", e.getMessage());
return resultJSON;
}
return result;
// 返回
resultJSON.put("code", "1");
resultJSON.put("desc", "搬运任务已生成");
return resultJSON;
}
}

47
lms/hd/nladmin-system/src/main/java/org/nl/wms/sch/tasks/SendMaterialTask.java

@ -60,12 +60,14 @@ public class SendMaterialTask extends AbstractAcsTask {
jsonTask.put("update_time", DateUtil.now());
jsonTask.put("car_no", taskObj.getString("car_no"));
taskTab.update(jsonTask);
// HashMap map = new HashMap();
// map.put("update_optid", SecurityUtils.getCurrentUserId());
// map.put("update_optname", SecurityUtils.getNickName());
// map.put("update_time", DateUtil.now());
// map.put("bill_status", "40");
// WQLObject.getWQLObject("ST_IVT_regionIO").update(map, "task_id='" + jsonTask.getString("task_id") + "'");
// 更新搬运记录
JSONObject regionIO = new JSONObject();
regionIO.put("update_optid", SecurityUtils.getCurrentUserId());
regionIO.put("update_optname", SecurityUtils.getNickName());
regionIO.put("update_time", DateUtil.now());
regionIO.put("bill_status", "40");
WQLObject.getWQLObject("st_ivt_regionio").update(regionIO, "task_id = " + task_id);
}
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
@ -149,6 +151,14 @@ public class SendMaterialTask extends AbstractAcsTask {
startPointObj.put("point_status", "00");
pointTab.update(startPointObj);
// 更新搬运记录
JSONObject regionIO = new JSONObject();
regionIO.put("update_optid", SecurityUtils.getCurrentUserId());
regionIO.put("update_optname", SecurityUtils.getNickName());
regionIO.put("update_time", DateUtil.now());
regionIO.put("bill_status", "50");
WQLObject.getWQLObject("st_ivt_regionio").update(regionIO, "task_id = " + task_id);
// 更新任务
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
jsonTask.put("update_optname", SecurityUtils.getNickName());
@ -176,7 +186,7 @@ public class SendMaterialTask extends AbstractAcsTask {
WQLObject ProcedureIOStable = WQLObject.getWQLObject("ST_IVT_regionIO");
JSONObject IosObj = ProcedureIOStable.query("task_id='" + task_id + "' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(IosObj)) {
throw new BadRequestException("未找到任务号为'" + taskObj.getString("task_code") + "'的入库单据");
throw new BadRequestException("未找到任务号为'" + taskObj.getString("task_code") + "'的入库单据");
}
JSONObject param = new JSONObject();
param.put("material_id", IosObj.getString("material_id"));
@ -184,7 +194,7 @@ public class SendMaterialTask extends AbstractAcsTask {
param.put("vehicle_code", IosObj.getString("vehicle_code"));
JSONObject inStructObj = StructFindUtil.getInStruct(param);
if (ObjectUtil.isEmpty(inStructObj)) {
throw new BadRequestException("未找到合适的入库仓位");
throw new BadRequestException("未找到合适的入库仓位");
}
//修改单据状态,将终点填入
IosObj.put("bill_status", "20");
@ -211,11 +221,14 @@ public class SendMaterialTask extends AbstractAcsTask {
// 参数校验
String start_point_code = form.getString("start_point_code");
if (StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空");
throw new BadRequestException("起点不能为空");
}
String next_point_code = form.getString("next_point_code");
if (StrUtil.isEmpty(next_point_code)) {
throw new BadRequestException("终点不能为空!");
throw new BadRequestException("终点不能为空");
}
if (StrUtil.equals(start_point_code, next_point_code)) {
throw new BadRequestException("起点和终点不能相同");
}
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
@ -225,13 +238,13 @@ public class SendMaterialTask extends AbstractAcsTask {
// 起点是空位不能搬
PointDto startPoint = pointService.findByCode(start_point_code);
if (StrUtil.equals(startPoint.getPoint_status(), "00")) {
throw new BadRequestException("起点是空位");
throw new BadRequestException("起点是空位");
}
// 终点不是空位不能搬
PointDto nextPoint = pointService.findByCode(next_point_code);
if (!StrUtil.equals(nextPoint.getPoint_status(), "00")) {
throw new BadRequestException("终点不是空位");
throw new BadRequestException("终点不是空位");
}
// 判断起点有没有未完成的指令
@ -239,7 +252,7 @@ public class SendMaterialTask extends AbstractAcsTask {
.query("(start_point_code = '" + start_point_code + "' OR next_point_code = '" + start_point_code + "') AND is_delete = '0' AND task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'")
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(startPointTask)) {
throw new BadRequestException("起点存在指令号为'" + startPointTask.getString("task_code") + "'未完成");
throw new BadRequestException("起点存在指令号为'" + startPointTask.getString("task_code") + "'未完成");
}
// 判断起点有没有未完成的指令
@ -247,7 +260,7 @@ public class SendMaterialTask extends AbstractAcsTask {
.query("(start_point_code = '" + next_point_code + "' OR next_point_code = '" + next_point_code + "') AND is_delete = '0' AND task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'")
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(nextPointTask)) {
throw new BadRequestException("终点存在指令号为'" + nextPointTask.getString("task_code") + "'未完成");
throw new BadRequestException("终点存在指令号为'" + nextPointTask.getString("task_code") + "'未完成");
}
if (StrUtil.equals(startPoint.getPoint_status(), "03") && StrUtil.equals(startPoint.getPoint_type(), "01")) {
@ -300,11 +313,9 @@ public class SendMaterialTask extends AbstractAcsTask {
JSONObject ACSResult = renotifyAcs(taskId);
if (!StrUtil.equals(ACSResult.getString("status"), "200")) {
// 报错后删除任务
// 报错后抛异常回滚
taskTable.delete("task_id = " + taskId);
String resultMessage = ACSResult.getString("message");
throw new BadRequestException(resultMessage);
throw new BadRequestException(ACSResult.getString("message"));
}
return taskId;

7
lms/hd/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RegionioInServiceImpl.java

@ -102,9 +102,7 @@ public class RegionioInServiceImpl implements RegionioInService {
@Override
@Transactional(rollbackFor = Exception.class)
public void create(RegionioDto dto) {
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
WQLObject vehicleTab = WQLObject.getWQLObject("MD_PB_StorageVehicleInfo");
JSONObject jsonMater = materTab.query("material_id = '" + dto.getMaterial_id() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(dto.getVehicle_code())) {
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0' and is_used= '1'").uniqueResult(0);
@ -129,7 +127,6 @@ public class RegionioInServiceImpl implements RegionioInService {
dto.setUpdate_optname(nickName);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setQty_unit_id(jsonMater.getLongValue("base_unit_id"));
WQLObject wo = WQLObject.getWQLObject("ST_IVT_regionIO");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
@ -177,12 +174,12 @@ public class RegionioInServiceImpl implements RegionioInService {
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
for (Long iostorinv_id: ids) {
JSONObject param = wo.query("iostorinv_id = '" + String.valueOf(iostorinv_id) + "'").uniqueResult(0);
JSONObject param = new JSONObject();
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
wo.update(param, "iostorinv_id = " + iostorinv_id);
}
}

18
lms/qd/src/views/wms/basedata/st/ivt/index.vue

@ -21,7 +21,7 @@
class="filter-item"
/>
</el-form-item>
<el-form-item label="物料搜索">
<el-form-item v-if="false" label="物料搜索">
<el-input
v-model="query.material"
clearable
@ -58,19 +58,19 @@
<el-table-column prop="point_code" label="仓位编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="point_name" label="仓位名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="region_name" label="下料区域" min-width="120" show-overflow-tooltip />
<el-table-column prop="material_code" label="物料编码" min-width="120" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" min-width="120" show-overflow-tooltip />
<el-table-column v-if="false" prop="material_code" label="物料编码" min-width="120" show-overflow-tooltip />
<el-table-column v-if="false" prop="material_name" label="物料名称" min-width="120" show-overflow-tooltip />
<el-table-column prop="quality_scode" label="品质类型" min-width="120" show-overflow-tooltip >
<template slot-scope="scope">
{{ dict.label.ST_QUALITY_SCODE[scope.row.quality_scode] }}
</template>
</el-table-column>
<el-table-column prop="pcsn" label="批次" min-width="120" show-overflow-tooltip />
<el-table-column prop="canuse_qty" label="可用数" :formatter="rounding" />
<el-table-column prop="frozen_qty" label="冻结数" :formatter="rounding" />
<el-table-column prop="ivt_qty" label="库存数" :formatter="rounding" />
<el-table-column prop="warehousing_qty" label="待入数" :formatter="rounding" />
<el-table-column prop="unit_name" label="计量单位" />
<el-table-column v-if="false" prop="pcsn" label="批次" min-width="120" show-overflow-tooltip />
<el-table-column v-if="false" prop="canuse_qty" label="可用数" :formatter="rounding" />
<el-table-column v-if="false" prop="frozen_qty" label="冻结数" :formatter="rounding" />
<el-table-column v-if="false" prop="ivt_qty" label="库存数" :formatter="rounding" />
<el-table-column v-if="false" prop="warehousing_qty" label="待入数" :formatter="rounding" />
<el-table-column v-if="false" prop="unit_name" label="计量单位" />
<el-table-column prop="instorage_time" label="入库时间" min-width="150" />
</el-table>
<!--分页组件-->

11
lms/qd/src/views/wms/st/inbill/index.vue

@ -21,7 +21,7 @@
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="物料编码">
<el-form-item v-if="false" label="物料编码">
<el-input
v-model="query.material_code"
clearable
@ -105,7 +105,7 @@
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="物料" prop="material_id">
<el-form-item v-if="false" label="物料" prop="material_id">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.material_name" style="width: 200px;" :disabled="crud.status.view > 0" @focus="getMater" />
</el-form-item>
@ -190,8 +190,8 @@
{{ dict.label.st_bill_status[scope.row.bill_status] }}
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" width="130px" />
<el-table-column prop="material_name" label="物料名称" width="130px" />
<el-table-column v-if="false" prop="material_code" label="物料编码" width="130px" />
<el-table-column v-if="false" prop="material_name" label="物料名称" width="130px" />
<el-table-column prop="start_point_name" label="起始点位" width="130px" />
<el-table-column prop="end_point_name" label="终点点位" width="130px" />
<el-table-column prop="start_region_name" label="起始区域" />
@ -303,9 +303,6 @@ export default {
pointDialog: false,
permission: {},
rules: {
material_id: [
{ required: true, message: '物料不能为空', trigger: 'blur' }
],
start_region_id: [
{ required: true, message: '起点区域不能为空', trigger: 'blur' }
],

Loading…
Cancel
Save