fix: 新增车间区域管理
This commit is contained in:
@@ -43,6 +43,11 @@
|
||||
<artifactId>dynamic-tp-spring-boot-starter-adapter-webserver</artifactId>
|
||||
<version>1.1.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>1.5.1-RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 日志链路追踪 https://tlog.yomahub.com/pages/f62a84/#%E5%90%8C%E6%AD%A5%E6%97%A5%E5%BF%97-->
|
||||
<dependency>
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.nl.common.logging.annotation;
|
||||
|
||||
import org.nl.common.logging.domain.InterfaceLogType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -28,4 +30,34 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Log {
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* 是否打印到日志文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isPrintToLogFile() default false;
|
||||
|
||||
|
||||
/**
|
||||
* 是否插入操作日志表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAddLogTable() default true;
|
||||
|
||||
/**
|
||||
* 是否接口日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isInterfaceLog() default false;
|
||||
|
||||
|
||||
/**
|
||||
* 接口日志类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
InterfaceLogType interfaceLogType() default InterfaceLogType.DEFAULT;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.common.logging.domain;
|
||||
|
||||
/**
|
||||
* @author: lyd
|
||||
* @description:
|
||||
* @Date: 2022/10/11
|
||||
*/
|
||||
public enum InterfaceLogType {
|
||||
DEFAULT("默认"),
|
||||
LMS_TO_MES("LMS请求MES"),
|
||||
MES_TO_LMS("MES请求LMS"),
|
||||
LMS_TO_CRM("LMS请求CRM"),
|
||||
CRM_TO_LMS("CRM请求LMS"),
|
||||
LMS_TO_SAP("LMS请求SAP"),
|
||||
SAP_TO_LMS("SAP请求LMS"),
|
||||
LMS_TO_ACS("LMS请求ACS"),
|
||||
ACS_TO_LMS("ACS请求LMS");
|
||||
|
||||
private String desc;
|
||||
|
||||
InterfaceLogType(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package org.nl.system.service.user.dao;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -158,5 +159,6 @@ public class SysUser implements Serializable {
|
||||
*/
|
||||
private String extuser_id;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.system.service.user.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -70,4 +71,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* @return List<String>
|
||||
*/
|
||||
List<String> getUserIdByDeptId(String deptId);
|
||||
|
||||
|
||||
IPage<SysUser> selectPageLeftJoinAndDept(IPage<SysUser> pages, Map whereJson);
|
||||
}
|
||||
|
||||
@@ -140,4 +140,19 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectPageLeftJoinAndDept" resultType="org.nl.system.service.user.dao.SysUser">
|
||||
SELECT
|
||||
sys_user.*,
|
||||
dept.name
|
||||
FROM
|
||||
sys_user sys_user
|
||||
LEFT JOIN sys_user_dept sdept ON sdept.user_id = sys_user.user_id
|
||||
LEFT JOIN sys_dept dept ON dept.dept_id = sdept.dept_id
|
||||
WHERE
|
||||
sys_user.is_used = '1'
|
||||
<if test="whereJson.blurry != null">
|
||||
AND (username LIKE '%${whereJson.blurry}%'
|
||||
OR person_name LIKE '%${whereJson.blurry}%')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.nl.wms.basedata.st.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata.st.service.IUserAreaService;
|
||||
import org.nl.wms.basedata.st.service.dao.UserArea;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/userArea")
|
||||
public class UserAreaController {
|
||||
|
||||
@Autowired
|
||||
private IUserAreaService userAreaService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询用户区域绑定")
|
||||
//@SaCheckPermission("userarea:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(TableDataInfo.build(userAreaService.queryAll(whereJson,page)),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryUserArea")
|
||||
@Log("查询用户对应区域")
|
||||
public ResponseEntity<Object> queryUserArea(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(userAreaService.queryUserArea(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增用户区域绑定")
|
||||
//@SaCheckPermission("userarea:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody UserArea entity){
|
||||
userAreaService.create(entity);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
@Log("保存用户仓库信息")
|
||||
public ResponseEntity<Object> save(@RequestBody JSONObject whereJson) {
|
||||
userAreaService.saveAreaAuthority(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改用户区域绑定")
|
||||
//@SaCheckPermission("userarea:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody UserArea entity){
|
||||
userAreaService.update(entity);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除用户区域绑定")
|
||||
//@SaCheckPermission("userarea:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
userAreaService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.wms.basedata.st.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.wms.basedata.st.service.dao.UserArea;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
public interface IUserAreaService extends IService<UserArea> {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param pageable 分页参数
|
||||
* @return IPage<Userarea>
|
||||
*/
|
||||
IPage<SysUser> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param entity /
|
||||
*/
|
||||
void create(UserArea entity);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param entity /
|
||||
*/
|
||||
void update(UserArea entity);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询用户对应仓库
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
List<UserArea> queryUserArea(JSONObject whereJson);
|
||||
|
||||
void saveAreaAuthority(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.basedata.st.service.dao;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/6
|
||||
*/
|
||||
@Data
|
||||
public class CompositeKey implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String product_area;
|
||||
private String user_id;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.basedata.st.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_userarea")
|
||||
public class UserArea implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 生产区域 */
|
||||
@MppMultiId
|
||||
private String product_area;
|
||||
|
||||
/** 人员标识 */
|
||||
@MppMultiId
|
||||
private String user_id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.basedata.st.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.wms.basedata.st.service.dao.UserArea;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
public interface UserareaMapper extends BaseMapper<UserArea> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.basedata.st.service.dao.mapper.UserareaMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.nl.wms.basedata.st.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
@Data
|
||||
public class UserareaDto implements Serializable {
|
||||
|
||||
/** 生产区域 */
|
||||
private String product_area;
|
||||
|
||||
/** 人员标识 */
|
||||
private String user_id;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.nl.wms.basedata.st.service.dto;
|
||||
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.basedata.st.service.dao.UserArea;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
public class UserareaQuery extends BaseQuery<UserArea> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package org.nl.wms.basedata.st.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.user.ISysUserService;
|
||||
import org.nl.system.service.user.dao.SysUser;
|
||||
import org.nl.system.service.user.dao.mapper.SysUserMapper;
|
||||
import org.nl.wms.basedata.st.service.IUserAreaService;
|
||||
import org.nl.wms.basedata.st.service.dao.mapper.UserareaMapper;
|
||||
import org.nl.wms.basedata.st.service.dao.UserArea;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2024-08-06
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class UserareaServiceImpl extends ServiceImpl<UserareaMapper, UserArea> implements IUserAreaService {
|
||||
|
||||
@Autowired
|
||||
private UserareaMapper userareaMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SysUser> queryAll(Map whereJson, PageQuery page){
|
||||
IPage<SysUser> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||
pages = userMapper.selectPageLeftJoinAndDept(pages, whereJson);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(UserArea entity) {
|
||||
entity.setUser_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
userareaMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(UserArea entity) {
|
||||
UserArea dto = userareaMapper.selectById(entity.getUser_id());
|
||||
if (dto == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_SystemAuthError"));
|
||||
}
|
||||
userareaMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Set<String> ids) {
|
||||
// 真删除
|
||||
userareaMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserArea> queryUserArea(JSONObject whereJson) {
|
||||
String user_id = whereJson.getString("user_id");
|
||||
return userareaMapper.selectList(new LambdaQueryWrapper<UserArea>()
|
||||
.eq(UserArea::getUser_id, user_id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAreaAuthority(JSONObject whereJson) {
|
||||
JSONObject jo = whereJson.getJSONObject("jo");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
|
||||
String user_id = jo.getString("user_id");
|
||||
userareaMapper.delete(new LambdaQueryWrapper<UserArea>()
|
||||
.eq(UserArea::getUser_id, user_id));
|
||||
List<UserArea> userAreas = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String product_area = row.getString("product_area");
|
||||
UserArea userArea = new UserArea();
|
||||
userArea.setUser_id(user_id);
|
||||
userArea.setProduct_area(product_area);
|
||||
userAreas.add(userArea);
|
||||
}
|
||||
saveBatch(userAreas);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,10 +2,9 @@ package org.nl.wms.ext.acs.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.logging.domain.InterfaceLogType;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -16,21 +15,117 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: acs请求lms接口
|
||||
* @Date: 2023/6/16
|
||||
*/
|
||||
* @author ludj
|
||||
* @date 2021-07-21
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/api/wms")
|
||||
@RequestMapping("/api/wms/task")
|
||||
@Slf4j
|
||||
public class AcsToWmsController {
|
||||
|
||||
@Autowired
|
||||
private AcsToWmsService acsToWmsService;
|
||||
|
||||
@PostMapping("/apply")
|
||||
@PostMapping("/status")
|
||||
@Log(value = "ACS给WMS反馈任务状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> apply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.acsApply(param), HttpStatus.OK);
|
||||
public ResponseEntity<Object> receiveTaskStatusAcs(@RequestBody String string) {
|
||||
log.info("ACS给WMS反馈任务状态:{}", string);
|
||||
return new ResponseEntity<>(acsToWmsService.receiveTaskStatusAcs(string), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/apply")
|
||||
@Log(value = "申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> apply(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(acsToWmsService.apply(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/againApply")
|
||||
@Log(value = "二次申请任务", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> againApply(@RequestBody String task_id) {
|
||||
return new ResponseEntity<>(acsToWmsService.againApply(task_id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/deviceApply")
|
||||
@Log(value = "申请贴标、捆扎", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> deviceApply(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.deviceApply(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/process")
|
||||
@Log(value = "RCS上报密集库任务异常处理", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> process(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.process(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/shipDeviceUpdate")
|
||||
// @Log(value = "输送线光电无货上报", isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> shipDeviceUpdate(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.shipDeviceUpdate(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendDeviceStatus")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendDeviceStatus(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.sendDeviceStatus(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendCBZInfo")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendCBZInfo(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.sendCBZInfo(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendGetGoalStruct")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> sendGetGoalStruct(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.sendGetGoalStruct(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/actionFinishRequest")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> actionFinishRequest(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.actionFinishRequest(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/actionFinishRequest2")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> actionFinishRequest2(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(acsToWmsService.actionFinishRequest2(jo), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/initialize")
|
||||
@Log(value = "仓位初始化", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@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)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> initPoint() {
|
||||
acsToWmsService.initPoint();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/slitterApply")
|
||||
@Log(value = "二期分切请求", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/feedbackSubVolumeWeightApply")
|
||||
@Log(value = "二期ACS反馈子卷重量", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> feedbackSubVolumeWeightApply(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(acsToWmsService.feedbackSubVolumeWeightApply(param), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +1,121 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: acs请求wms
|
||||
* @Date: 2023/6/26
|
||||
*/
|
||||
import java.util.Map;
|
||||
|
||||
public interface AcsToWmsService {
|
||||
/**
|
||||
* ACS请求接口
|
||||
* @param param
|
||||
* @return BaseResponse
|
||||
*/
|
||||
BaseResponse acsApply(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* 任务反馈
|
||||
* @param param
|
||||
* @return BaseResponse
|
||||
* ACS客户端--->WMS服务端
|
||||
* ACS向WMS反馈任务状态
|
||||
*
|
||||
* @param string ACS反馈的任务数组
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
BaseResponse feedbackTaskStatus(JSONObject param);
|
||||
|
||||
Map<String, Object> receiveTaskStatusAcs(String string);
|
||||
|
||||
|
||||
/**
|
||||
* 实时修改点位状态
|
||||
* @param param
|
||||
* @return BaseResponse
|
||||
* @param task_id: 任务标识
|
||||
* @return 二次申请的点位
|
||||
*/
|
||||
BaseResponse realTimeSetPoint(JSONObject param);
|
||||
String againApply(String task_id);
|
||||
|
||||
|
||||
/**
|
||||
* ACS客户端--->WMS服务端
|
||||
* ACS向WMS反馈点位状态
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
|
||||
Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* 任务申请
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject apply(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* 申请贴标、捆扎
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject deviceApply(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* RCS上报密集库任务异常处理
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject process(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* 输送线光电无货上报
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject shipDeviceUpdate(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* ACS客户端--->LMS服务端
|
||||
* 输送线光电无货上报
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject sendDeviceStatus(JSONObject whereJson);
|
||||
|
||||
JSONObject sendCBZInfo(JSONObject whereJson);
|
||||
|
||||
JSONObject sendGetGoalStruct(JSONObject whereJson);
|
||||
|
||||
JSONObject actionFinishRequest(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 仓位初始化
|
||||
*/
|
||||
void initialize(JSONObject json);
|
||||
|
||||
/**
|
||||
* 点位初始化
|
||||
*/
|
||||
void initPoint();
|
||||
|
||||
|
||||
/**
|
||||
* 二期分切请求
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject slitterApply(JSONObject param);
|
||||
|
||||
|
||||
/**
|
||||
* 二期ACS反馈子卷重量
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject feedbackSubVolumeWeightApply(JSONObject param);
|
||||
|
||||
/**
|
||||
* 二楼取货完成请求
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject actionFinishRequest2(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -1,165 +1,94 @@
|
||||
package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.acs.service.dto.to.wms.FeedBackTaskStatusRequest;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: acs请求wms的实现类
|
||||
* @Date: 2023/6/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
/**
|
||||
* 将解析的整数与结果相乘
|
||||
*/
|
||||
private Map<String, Method> methodCache = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private ISysInteractRecordService interactRecordService;
|
||||
|
||||
/**
|
||||
* 初始化反射方法
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initCacheMethod() {
|
||||
for (Method method : this.getClass().getMethods()) {
|
||||
if (method.getParameterCount() == 1 && method.getParameterTypes()[0] == JSONObject.class) {
|
||||
methodCache.put(method.getName(), method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseResponse acsApply(JSONObject param) {
|
||||
String requestNo = param.getString("requestNo");
|
||||
String requestMethodName = param.getString("request_medthod_name");
|
||||
BaseResponse result = BaseResponse.build(requestNo);
|
||||
try {
|
||||
// 获取请求方法名
|
||||
String requestMethodCode = param.getString("request_medthod_code");
|
||||
Method method = methodCache.get(StrUtil.toCamelCase(requestMethodCode));
|
||||
if (method == null) {
|
||||
throw new BadRequestException(LangProcess.msg("error_isNull",requestMethodCode));
|
||||
}
|
||||
result = (BaseResponse) method.invoke(this, param);
|
||||
} catch (Exception e) {
|
||||
String message = ObjectUtil.isEmpty(e.getMessage())
|
||||
? ((InvocationTargetException) e).getTargetException().getMessage()
|
||||
: e.getMessage();
|
||||
log.error("ACS请求LMS出现错误: {}", message);
|
||||
result.setCode(HttpStatus.HTTP_BAD_REQUEST);
|
||||
result.setMessage(message);
|
||||
result.setRequestNo(requestNo);
|
||||
// 消息通知
|
||||
noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
}
|
||||
// acs对接记录
|
||||
interactRecordService.saveRecord(requestMethodName, param, result, GeneralDefinition.ACS_LMS);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提前要料
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse pressRequestMaterial2(JSONObject param) {
|
||||
public Map<String, Object> receiveTaskStatusAcs(String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务反馈
|
||||
*/
|
||||
@Override
|
||||
public BaseResponse feedbackTaskStatus(JSONObject param) {
|
||||
// todo: action暂未维护
|
||||
String requestNo = param.getString("requestNo");
|
||||
FeedBackTaskStatusRequest taskStatusRequest = param.toJavaObject(FeedBackTaskStatusRequest.class);
|
||||
JSONObject taskInfo = taskStatusRequest.getTask_info();
|
||||
if (ObjectUtil.isEmpty(taskInfo)) {
|
||||
throw new BadRequestException("任务信息不能为空!");
|
||||
}
|
||||
SchBaseTask taskObj = taskService.getByCode(taskInfo.getString("task_code"));
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("未找到任务编码为 [" + taskInfo.getString("task_code") + "] 的任务");
|
||||
}
|
||||
// 任务处理类
|
||||
String processingClass = taskObj.getConfig_code();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
String acsTaskStatus = param.getString("task_status");
|
||||
String message = "";
|
||||
TaskStatus status = TaskStatus.APPLY;
|
||||
switch (acsTaskStatus) {
|
||||
case "1":
|
||||
status = TaskStatus.EXECUTING;
|
||||
break;
|
||||
case "2":
|
||||
status = TaskStatus.FINISHED;
|
||||
break;
|
||||
case "3":
|
||||
status = TaskStatus.CANCELED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 根据配置去工厂类获得类对象
|
||||
AbstractTask abstractTask = taskFactory.getTask(processingClass);
|
||||
// 更新任务
|
||||
try {
|
||||
abstractTask.updateTaskStatus(taskInfo, status);
|
||||
} catch (Exception e) {
|
||||
log.error("任务状态更新失败: {}", message);
|
||||
return BaseResponse.responseError(requestNo, "任务:[" + taskInfo.getString("task_code") + "]状态更新失败," + message);
|
||||
}
|
||||
return BaseResponse.responseOk(requestNo, "任务状态反馈成功!");
|
||||
public String againApply(String task_id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实时修改点位状态
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public BaseResponse realTimeSetPoint(JSONObject param) {
|
||||
return null;
|
||||
public Map<String, Object> receivePointStatusFromAcs(Map<String, String> jsonObject) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject apply(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject deviceApply(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject process(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject shipDeviceUpdate(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendDeviceStatus(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendCBZInfo(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject sendGetGoalStruct(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject actionFinishRequest(JSONObject whereJson) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(JSONObject json) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject slitterApply(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject feedbackSubVolumeWeightApply(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject actionFinishRequest2(JSONObject param) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +194,8 @@ public class PdmBiRawfoilworkorder extends Model<PdmBiRawfoilworkorder> {
|
||||
* 请求入半成品库
|
||||
*/
|
||||
private String is_instor;
|
||||
private String wind_roll;
|
||||
private String order_type;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* API 接口地址枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum URLEnum {
|
||||
//
|
||||
ACS_URL_A1("A1", () -> SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL_A1").getValue());
|
||||
|
||||
private final String product_area;
|
||||
|
||||
private final Supplier<String> acs_url;
|
||||
|
||||
public static String find(String product_area) {
|
||||
for (URLEnum value : URLEnum.values()) {
|
||||
if (product_area.equals(value.getProduct_area())) {
|
||||
return value.getAcs_url().get();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ nl:
|
||||
port: 3306
|
||||
username: root
|
||||
password: 12356
|
||||
database: nl-platform
|
||||
database: ldnx_lms2
|
||||
redis:
|
||||
ip: 127.0.0.1
|
||||
port: 6379
|
||||
|
||||
@@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<contextName>nlAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8"/>
|
||||
<property name="log.pattern"
|
||||
value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %blue(%msg%n)"/>
|
||||
value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--引入默认的一些设置-->
|
||||
<!--<include resource="log/XrToMes.xml"/>
|
||||
|
||||
Reference in New Issue
Block a user