代码更新
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package org.nl.wms.common;
|
||||
package org.nl.wms.sch;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -9,7 +9,7 @@ import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
|
||||
|
||||
public class StructFindUtil {
|
||||
public class PointFindUtil {
|
||||
public static JSONObject getInStruct(JSONObject jsonObject) {
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
String area_type = jsonObject.getString("area_type");
|
||||
@@ -1,69 +0,0 @@
|
||||
|
||||
package org.nl.wms.sch.cppoint.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.cppoint.service.CppointService;
|
||||
import org.nl.wms.sch.cppoint.service.dto.CppointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-18
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "成品库区管理")
|
||||
@RequestMapping("/api/cppoint")
|
||||
@Slf4j
|
||||
public class CppointController {
|
||||
|
||||
private final CppointService cppointService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询成品库区")
|
||||
@ApiOperation("查询成品库区")
|
||||
//@SaCheckPermission("@el.check('cppoint:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(cppointService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Log("新增成品库区")
|
||||
@ApiOperation("新增成品库区")
|
||||
@SaIgnore
|
||||
//@SaCheckPermission("@el.check('cppoint:add')")
|
||||
public ResponseEntity<Object> create(){
|
||||
cppointService.create();
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改成品库区")
|
||||
@ApiOperation("修改成品库区")
|
||||
//@SaCheckPermission("@el.check('cppoint:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody CppointDto dto){
|
||||
cppointService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除成品库区")
|
||||
@ApiOperation("删除成品库区")
|
||||
//@SaCheckPermission("@el.check('cppoint:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
cppointService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package org.nl.wms.sch.cppoint.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.cppoint.service.dto.CppointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2022-10-18
|
||||
**/
|
||||
public interface CppointService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<CppointDto>
|
||||
*/
|
||||
List<CppointDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param point_id ID
|
||||
* @return Cppoint
|
||||
*/
|
||||
CppointDto findById(Long point_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Cppoint
|
||||
*/
|
||||
CppointDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*/
|
||||
void create();
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(CppointDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package org.nl.wms.sch.cppoint.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2022-10-18
|
||||
**/
|
||||
@Data
|
||||
public class CppointDto implements Serializable {
|
||||
|
||||
/** 点位标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long point_id;
|
||||
|
||||
/** 点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** 批次 */
|
||||
private String pcsn;
|
||||
|
||||
/** 物料标识 */
|
||||
private Long material_id;
|
||||
|
||||
/** 库存数 */
|
||||
private BigDecimal ivt_qty;
|
||||
|
||||
/** 计量单位标识 */
|
||||
private Long qty_unit_id;
|
||||
|
||||
/** 入库时间 */
|
||||
private String instorage_time;
|
||||
|
||||
/** 外部编码 */
|
||||
private String ext_code;
|
||||
|
||||
/** 点位状态 */
|
||||
private String point_status;
|
||||
|
||||
/** 托盘类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 排 */
|
||||
private BigDecimal row_num;
|
||||
|
||||
/** 列 */
|
||||
private BigDecimal col_num;
|
||||
|
||||
/** 层 */
|
||||
private BigDecimal layer_num;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 是否锁定 */
|
||||
private String is_lock;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private Long update_optid;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_optname;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
|
||||
package org.nl.wms.sch.cppoint.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.sch.cppoint.service.CppointService;
|
||||
import org.nl.wms.sch.cppoint.service.dto.CppointDto;
|
||||
import org.nl.wms.sch.service.RegionService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-18
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CppointServiceImpl implements CppointService {
|
||||
|
||||
private final RegionService regionService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (!ObjectUtil.isNull(whereJson.get("point_code"))) {
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
}
|
||||
map.put("layer_num", whereJson.get("layer_num"));
|
||||
map.put("row_num", whereJson.get("row_num"));
|
||||
map.put("col_num", whereJson.get("col_num"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
map.put("lock_type", whereJson.get("lock_type"));
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("vehicle_type", whereJson.get("vehicle_type"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
JSONObject json = WQL.getWO("SCH_BASE_CPPOINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
JSONArray res = new JSONArray();
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject cppEntry = content.getJSONObject(i);
|
||||
String point_status_explain = regionService.findById(cppEntry.getLong("region_id")).getPoint_status_explain();
|
||||
String[] split = point_status_explain.split(",");
|
||||
JSONObject statusMap = new JSONObject();
|
||||
for (int j = 0; j < split.length; j++) {
|
||||
String[] status = split[j].split("-");
|
||||
statusMap.put(status[0], status[1]);
|
||||
}
|
||||
cppEntry.put("point_status_name", statusMap.getString(cppEntry.getString("point_status")));
|
||||
res.add(cppEntry);
|
||||
}
|
||||
json.put("content", res);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CppointDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_cppoint");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(CppointDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CppointDto findById(Long point_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_cppoint");
|
||||
JSONObject json = wo.query("point_id = '" + point_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( CppointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CppointDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_cppoint");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( CppointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create() {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_CpPoint");
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
String row = "";
|
||||
if ( i < 10 ) row = "0" + i;
|
||||
else row = "" + i;
|
||||
for (int j = 1; j <= 78; j++) {
|
||||
String col = "";
|
||||
if ( j < 10) col = "-" + "0" + j;
|
||||
else col = "-" + j;
|
||||
for ( int k = 1; k <= 5; k++ ) {
|
||||
String layer = "-" + "0" + k;
|
||||
String now = DateUtil.now();
|
||||
JSONObject cp = new JSONObject();
|
||||
cp.put("point_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
cp.put("point_code", row + col + layer);
|
||||
cp.put("row_num", i);
|
||||
cp.put("col_num", j);
|
||||
cp.put("layer_num", k);
|
||||
cp.put("is_used", 1);
|
||||
cp.put("is_lock", 0);
|
||||
cp.put("create_id", currentUserId);
|
||||
cp.put("create_name", nickName);
|
||||
cp.put("create_time", now);
|
||||
cp.put("update_optid", currentUserId);
|
||||
cp.put("update_optname", nickName);
|
||||
cp.put("update_time", now);
|
||||
wo.insert(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(CppointDto dto) {
|
||||
CppointDto entity = this.findById(dto.getPoint_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_cppoint");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_cppoint");
|
||||
for (Long point_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_id", String.valueOf(point_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 成品区
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.point_code TYPEAS s_string
|
||||
输入.layer_num TYPEAS s_string
|
||||
输入.row_num TYPEAS s_string
|
||||
输入.col_num TYPEAS s_string
|
||||
输入.lock_type TYPEAS s_string
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.point_status TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.io_type TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
cppoint.*,
|
||||
str.stockrecord_id,
|
||||
str.pcsn,
|
||||
str.material_id,
|
||||
str.ivt_qty,
|
||||
str.qty_unit_id,
|
||||
str.instorage_time,
|
||||
str.standing_time
|
||||
FROM
|
||||
sch_base_point cppoint
|
||||
LEFT JOIN st_ivt_structivt str ON str.point_id = cppoint.point_id
|
||||
WHERE
|
||||
cppoint.region_code IN ('CPQYA01')
|
||||
OPTION 输入.point_code <> ""
|
||||
point_code LIKE 输入.point_code
|
||||
ENDOPTION
|
||||
OPTION 输入.point_status <> ""
|
||||
point_status = 输入.point_status
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
OPTION 输入.layer_num <> ""
|
||||
layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
OPTION 输入.row_num <> ""
|
||||
row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
col_num = 输入.col_num
|
||||
ENDOPTION
|
||||
OPTION 输入.lock_type <> ""
|
||||
YsaPoint.lock_type = 输入.lock_type
|
||||
ENDOPTION
|
||||
OPTION 输入.is_used <> ""
|
||||
is_used = 输入.is_used
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
instorage_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
instorage_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -12,7 +12,7 @@ import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.sch.PointFindUtil;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
@@ -99,7 +99,7 @@ public class CallMaterialTask extends AbstractAcsTask {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", IosObj.getString("material_id"));
|
||||
param.put("area_type", IosObj.getString("start_area"));
|
||||
JSONObject inStructObj = StructFindUtil.getOutStruct(param);
|
||||
JSONObject inStructObj = PointFindUtil.getOutStruct(param);
|
||||
if (ObjectUtil.isEmpty(inStructObj)) {
|
||||
throw new BadRequestException("未找到合适的出库仓位!");
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.sch.PointFindUtil;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
@@ -133,7 +133,7 @@ public class SendMaterialTask extends AbstractAcsTask {
|
||||
param.put("material_id", IosObj.getString("material_id"));
|
||||
param.put("area_type", IosObj.getString("end_area"));
|
||||
param.put("vehicle_code", IosObj.getString("vehicle_code"));
|
||||
JSONObject inStructObj = StructFindUtil.getInStruct(param);
|
||||
JSONObject inStructObj = PointFindUtil.getInStruct(param);
|
||||
if (ObjectUtil.isEmpty(inStructObj)) {
|
||||
throw new BadRequestException("未找到合适的入库仓位!");
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.rest;
|
||||
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.ysa.service.YsapointService;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "养生A区管理")
|
||||
@RequestMapping("/api/ysapoint")
|
||||
@Slf4j
|
||||
public class YsapointController {
|
||||
|
||||
private final YsapointService ysapointService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询养生A区")
|
||||
@ApiOperation("查询养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(ysapointService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Log("新增养生A区")
|
||||
@ApiOperation("新增养生A区")
|
||||
@SaIgnore
|
||||
//@SaCheckPermission("@el.check('ysapoint:add')")
|
||||
public ResponseEntity<Object> create(){
|
||||
ysapointService.create();
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改养生A区")
|
||||
@ApiOperation("修改养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody YsapointDto dto){
|
||||
ysapointService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除养生A区")
|
||||
@ApiOperation("删除养生A区")
|
||||
//@SaCheckPermission("@el.check('ysapoint:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
ysapointService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
public interface YsapointService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<YsapointDto>
|
||||
*/
|
||||
List<YsapointDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param point_id ID
|
||||
* @return Ysapoint
|
||||
*/
|
||||
YsapointDto findById(Long point_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Ysapoint
|
||||
*/
|
||||
YsapointDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create();
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(YsapointDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package org.nl.wms.sch.ysa.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@Data
|
||||
public class YsapointDto implements Serializable {
|
||||
|
||||
/** 点位标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long point_id;
|
||||
|
||||
/** 点位编码 */
|
||||
private String point_code;
|
||||
|
||||
/** 批次 */
|
||||
private String pcsn;
|
||||
|
||||
/** 物料标识 */
|
||||
private Long material_id;
|
||||
|
||||
/** 库存数 */
|
||||
private BigDecimal ivt_qty;
|
||||
|
||||
/** 计量单位标识 */
|
||||
private Long qty_unit_id;
|
||||
|
||||
/** 入库时间 */
|
||||
private String instorage_time;
|
||||
|
||||
/** 外部编码 */
|
||||
private String ext_code;
|
||||
|
||||
/** 点位状态 */
|
||||
private String point_status;
|
||||
|
||||
/** 托盘类型 */
|
||||
private String vehicle_type;
|
||||
|
||||
/** 静置时间(分钟) */
|
||||
private BigDecimal standing_time;
|
||||
|
||||
/** 块 */
|
||||
private BigDecimal block_num;
|
||||
|
||||
/** 排 */
|
||||
private BigDecimal row_num;
|
||||
|
||||
/** 列 */
|
||||
private BigDecimal col_num;
|
||||
|
||||
/** 层 */
|
||||
private BigDecimal layer_num;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否启用 */
|
||||
private String is_used;
|
||||
|
||||
/** 是否锁定 */
|
||||
private String is_lock;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 修改人 */
|
||||
private Long update_optid;
|
||||
|
||||
/** 修改人 */
|
||||
private String update_optname;
|
||||
|
||||
/** 修改时间 */
|
||||
private String update_time;
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
|
||||
package org.nl.wms.sch.ysa.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.wms.sch.service.RegionService;
|
||||
import org.nl.wms.sch.ysa.service.YsapointService;
|
||||
import org.nl.wms.sch.ysa.service.dto.YsapointDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-17
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class YsapointServiceImpl implements YsapointService {
|
||||
|
||||
private final RegionService regionService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "1");
|
||||
if (!ObjectUtil.isNull(whereJson.get("point_code"))) {
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
}
|
||||
map.put("block_num", whereJson.get("block_num"));
|
||||
map.put("row_num", whereJson.get("row_num"));
|
||||
map.put("col_num", whereJson.get("col_num"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("vehicle_type", whereJson.get("vehicle_type"));
|
||||
map.put("lock_type", whereJson.get("lock_type"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
JSONObject json = WQL.getWO("SCH_BASE_YSAPOINT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
JSONArray res = new JSONArray();
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject ysaEntry = content.getJSONObject(i);
|
||||
String point_status_explain = regionService.findById(ysaEntry.getLong("region_id")).getPoint_status_explain();
|
||||
String[] split = point_status_explain.split(",");
|
||||
JSONObject statusMap = new JSONObject();
|
||||
for (int j = 0; j < split.length; j++) {
|
||||
String[] status = split[j].split("-");
|
||||
statusMap.put(status[0], status[1]);
|
||||
}
|
||||
ysaEntry.put("point_status_name", statusMap.getString(ysaEntry.getString("point_status")));
|
||||
res.add(ysaEntry);
|
||||
}
|
||||
json.put("content", res);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YsapointDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(YsapointDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YsapointDto findById(Long point_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = wo.query("point_id = '" + point_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( YsapointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YsapointDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( YsapointDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create() {
|
||||
|
||||
for (int i = 1; i <= 8; i++) {
|
||||
for (int j = 1; j <= 13; j++) {
|
||||
String row = "";
|
||||
if ( j == 13 && ( i == 7 || i == 8 ) ) break;
|
||||
if ( j < 10) row = "0" + j;
|
||||
else row = "" + j;
|
||||
for ( int k = 1; k <= 13; k++ ) {
|
||||
String col = "";
|
||||
if ( i < 7 && k > 9) break;
|
||||
if ( k < 10 ) col = "-" + "0" + k + "-" + "01";
|
||||
else col = "-" + k + "-" + "01";
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
JSONObject ysa = new JSONObject();
|
||||
ysa.put("point_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
ysa.put("point_code", "2" + i + row + col);
|
||||
ysa.put("block_num", i);
|
||||
ysa.put("row_num", j);
|
||||
ysa.put("col_num", k);
|
||||
ysa.put("layer_num", 1);
|
||||
ysa.put("is_used", 1);
|
||||
ysa.put("is_lock", 0);
|
||||
ysa.put("standing_time", 0);
|
||||
ysa.put("create_id", currentUserId);
|
||||
ysa.put("create_name", nickName);
|
||||
ysa.put("create_time", now);
|
||||
ysa.put("update_optid", currentUserId);
|
||||
ysa.put("update_optname", nickName);
|
||||
ysa.put("update_time", now);
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_YsaPoint");
|
||||
wo.insert(ysa);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YsapointDto dto) {
|
||||
YsapointDto entity = this.findById(dto.getPoint_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_ysapoint");
|
||||
for (Long point_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_id", String.valueOf(point_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 养生A区
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.point_code TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.block_num TYPEAS s_string
|
||||
输入.row_num TYPEAS s_string
|
||||
输入.col_num TYPEAS s_string
|
||||
输入.io_type TYPEAS s_string
|
||||
输入.is_used TYPEAS s_string
|
||||
输入.point_status TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.lock_type TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
YsaPoint.*,
|
||||
str.stockrecord_id,
|
||||
str.pcsn,
|
||||
str.material_id,
|
||||
str.ivt_qty,
|
||||
str.qty_unit_id,
|
||||
str.instorage_time,
|
||||
str.standing_time
|
||||
FROM
|
||||
sch_base_point YsaPoint
|
||||
LEFT JOIN st_ivt_structivt str ON str.point_id = YsaPoint.point_id
|
||||
WHERE
|
||||
YsaPoint.region_code IN ('YSQA01', 'YSAQKTPQ01')
|
||||
OPTION 输入.point_code <> ""
|
||||
YsaPoint.point_code LIKE 输入.point_code
|
||||
ENDOPTION
|
||||
OPTION 输入.point_status <> ""
|
||||
YsaPoint.point_status = 输入.point_status
|
||||
ENDOPTION
|
||||
OPTION 输入.lock_type <> ""
|
||||
YsaPoint.lock_type = 输入.lock_type
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
YsaPoint.vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
OPTION 输入.block_num <> ""
|
||||
YsaPoint.block_num = 输入.block_num
|
||||
ENDOPTION
|
||||
OPTION 输入.row_num <> ""
|
||||
YsaPoint.row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
YsaPoint.col_num = 输入.col_num
|
||||
ENDOPTION
|
||||
OPTION 输入.is_used <> ""
|
||||
YsaPoint.is_used = 输入.is_used
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
str.instorage_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
str.instorage_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.nl.wms.st.bill.rest;
|
||||
|
||||
import org.nl.wms.st.bill.service.RegionIoService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.nl.wms.st.bill.service.dto.RegionIoDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
@@ -34,11 +34,19 @@ public class RegionIoController {
|
||||
return new ResponseEntity<>(regionioService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/warehousing")
|
||||
@Log("查询养生区和成品库存")
|
||||
@ApiOperation("查询养生区和成品库存")
|
||||
//@SaCheckPermission("@el.check('regionio:list')")
|
||||
public ResponseEntity<Object> queryWarehousing(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(regionioService.queryWarehousing(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增1")
|
||||
@ApiOperation("新增1")
|
||||
//@SaCheckPermission("@el.check('regionio:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody RegionioDto dto){
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody RegionIoDto dto){
|
||||
regionioService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -47,7 +55,7 @@ public class RegionIoController {
|
||||
@Log("修改1")
|
||||
@ApiOperation("修改1")
|
||||
//@SaCheckPermission("@el.check('regionio:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody RegionioDto dto){
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody RegionIoDto dto){
|
||||
regionioService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.st.bill.service;
|
||||
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.bill.service.dto.RegionIoDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
@@ -25,40 +27,48 @@ public interface RegionIoService {
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<RegionioDto>
|
||||
* @return List<RegionIoDto>
|
||||
*/
|
||||
List<RegionioDto> queryAll(Map whereJson);
|
||||
List<RegionIoDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param qty_unit_id ID
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findById(Long qty_unit_id);
|
||||
RegionIoDto findById(Long qty_unit_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findByCode(String code);
|
||||
RegionIoDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(RegionioDto dto);
|
||||
void create(RegionIoDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(RegionioDto dto);
|
||||
void update(RegionIoDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询养生区和成品库存
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
JSONObject queryWarehousing(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.sch.service.RegionService;
|
||||
import org.nl.wms.st.bill.service.RegionIoService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.nl.wms.st.bill.service.dto.RegionIoDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -33,6 +34,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RegionIoServiceImpl implements RegionIoService {
|
||||
private final RegionService regionService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
@@ -51,36 +53,36 @@ public class RegionIoServiceImpl implements RegionIoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionioDto> queryAll(Map whereJson){
|
||||
public List<RegionIoDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RegionioDto.class);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RegionIoDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findById(Long qty_unit_id) {
|
||||
public RegionIoDto findById(Long qty_unit_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("qty_unit_id = '" + qty_unit_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
return json.toJavaObject( RegionIoDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findByCode(String code) {
|
||||
public RegionIoDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
return json.toJavaObject( RegionIoDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(RegionioDto dto) {
|
||||
public void create(RegionIoDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -100,8 +102,8 @@ public class RegionIoServiceImpl implements RegionIoService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(RegionioDto dto) {
|
||||
RegionioDto entity = this.findById(dto.getQty_unit_id());
|
||||
public void update(RegionIoDto dto) {
|
||||
RegionIoDto entity = this.findById(dto.getQty_unit_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -136,5 +138,48 @@ public class RegionIoServiceImpl implements RegionIoService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询养生区和成品库存
|
||||
*
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONObject queryWarehousing(Map whereJson, Pageable page) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("region_code", "(" + whereJson.get("region_code") + ")");
|
||||
if (!ObjectUtil.isNull(whereJson.get("point_code"))) {
|
||||
map.put("point_code", "%" + whereJson.get("point_code") + "%");
|
||||
}
|
||||
map.put("layer_num", whereJson.get("layer_num"));
|
||||
map.put("row_num", whereJson.get("row_num"));
|
||||
map.put("col_num", whereJson.get("col_num"));
|
||||
map.put("is_used", whereJson.get("is_used"));
|
||||
map.put("lock_type", whereJson.get("lock_type"));
|
||||
map.put("point_status", whereJson.get("point_status"));
|
||||
map.put("vehicle_type", whereJson.get("vehicle_type"));
|
||||
map.put("begin_time", whereJson.get("begin_time"));
|
||||
map.put("end_time", whereJson.get("end_time"));
|
||||
JSONObject json = WQL.getWO("ST_IVT_REGIONIO").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "point_code asc");
|
||||
JSONArray content = json.getJSONArray("content");
|
||||
JSONArray res = new JSONArray();
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject cppEntry = content.getJSONObject(i);
|
||||
String point_status_explain = regionService.findById(cppEntry.getLong("region_id")).getPoint_status_explain();
|
||||
String[] split = point_status_explain.split(",");
|
||||
JSONObject statusMap = new JSONObject();
|
||||
for (int j = 0; j < split.length; j++) {
|
||||
String[] status = split[j].split("-");
|
||||
statusMap.put(status[0], status[1]);
|
||||
}
|
||||
cppEntry.put("point_status_name", statusMap.getString(cppEntry.getString("point_status")));
|
||||
res.add(cppEntry);
|
||||
}
|
||||
json.put("content", res);
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.io_region TYPEAS f_string
|
||||
输入.region_code TYPEAS f_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
@@ -70,4 +71,54 @@
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
cppoint.*,
|
||||
str.stockrecord_id,
|
||||
str.pcsn,
|
||||
str.material_id,
|
||||
str.ivt_qty,
|
||||
str.qty_unit_id,
|
||||
str.instorage_time,
|
||||
str.standing_time
|
||||
FROM
|
||||
st_ivt_structivt str
|
||||
LEFT JOIN sch_base_point cppoint ON str.point_id = cppoint.point_id
|
||||
WHERE
|
||||
cppoint.region_code IN 输入.region_code
|
||||
OPTION 输入.point_code <> ""
|
||||
point_code LIKE 输入.point_code
|
||||
ENDOPTION
|
||||
OPTION 输入.point_status <> ""
|
||||
point_status = 输入.point_status
|
||||
ENDOPTION
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
OPTION 输入.layer_num <> ""
|
||||
layer_num = 输入.layer_num
|
||||
ENDOPTION
|
||||
OPTION 输入.row_num <> ""
|
||||
row_num = 输入.row_num
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
col_num = 输入.col_num
|
||||
ENDOPTION
|
||||
OPTION 输入.lock_type <> ""
|
||||
YsaPoint.lock_type = 输入.lock_type
|
||||
ENDOPTION
|
||||
OPTION 输入.is_used <> ""
|
||||
is_used = 输入.is_used
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
instorage_time >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
instorage_time <= 输入.end_time
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,77 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.inbill.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.inbill.service.RegionioInService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "区域入库管理")
|
||||
@RequestMapping("/api/regionioIn")
|
||||
@Slf4j
|
||||
public class RegionioInController {
|
||||
|
||||
private final RegionioInService rgionioInService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询区域入库")
|
||||
@ApiOperation("查询区域入库")
|
||||
//@SaCheckPermission("regionio:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(rgionioInService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增区域入库")
|
||||
@ApiOperation("新增区域入库")
|
||||
//@SaCheckPermission("regionio:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody RegionioDto dto) {
|
||||
rgionioInService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改区域入库")
|
||||
@ApiOperation("修改区域入库")
|
||||
//@SaCheckPermission("regionio:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody RegionioDto dto) {
|
||||
rgionioInService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除区域入库")
|
||||
@ApiOperation("删除区域入库")
|
||||
//@SaCheckPermission("regionio:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
rgionioInService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("生成任务")
|
||||
@ApiOperation("生成任务")
|
||||
@PostMapping("/createTask")
|
||||
public ResponseEntity<Object> createTask(@RequestBody JSONObject jsonObject) {
|
||||
rgionioInService.createTask(jsonObject);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.inbill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
public interface RegionioInService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<RegionioDto>
|
||||
*/
|
||||
List<RegionioDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param qty_unit_id ID
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findById(Long qty_unit_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(RegionioDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(RegionioDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 生成任务
|
||||
*
|
||||
* @param jsonObject /
|
||||
*/
|
||||
void createTask(JSONObject jsonObject);
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package org.nl.wms.st.inbill.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description /
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
@Data
|
||||
public class RegionioDto implements Serializable {
|
||||
|
||||
/** 出入单标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long iostorinv_id;
|
||||
|
||||
/**
|
||||
* 单据编号
|
||||
*/
|
||||
private String bill_code;
|
||||
|
||||
/**
|
||||
* 出入类型
|
||||
*/
|
||||
private String io_type;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private Long material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/** 数量单位标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long qty_unit_id;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
private String bill_status;
|
||||
|
||||
/**
|
||||
* 起始点位编码
|
||||
*/
|
||||
private String point_code1;
|
||||
|
||||
/**
|
||||
* 终点点位编码
|
||||
*/
|
||||
private String end_point_code;
|
||||
|
||||
/**
|
||||
* 起始区域
|
||||
*/
|
||||
private String start_region_id;
|
||||
|
||||
/**
|
||||
* 终点区域
|
||||
*/
|
||||
private String end_region_id;
|
||||
|
||||
/**
|
||||
* 客户标识
|
||||
*/
|
||||
private Long cust_id;
|
||||
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String create_mode;
|
||||
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private Long task_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private Long confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.inbill.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.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.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.pdm.service.DeviceService;
|
||||
import org.nl.wms.pdm.service.dto.DeviceDto;
|
||||
import org.nl.wms.sch.tasks.SendMaterialTask;
|
||||
import org.nl.wms.st.inbill.service.RegionioInService;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author Liuxy
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RegionioInServiceImpl implements RegionioInService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
String vehicle_code = MapUtil.getStr(whereJson, "vehicle_code");
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String point_code1 = MapUtil.getStr(whereJson, "point_code1");
|
||||
String end_point_code = MapUtil.getStr(whereJson, "end_point_code");
|
||||
String start_region_code = MapUtil.getStr(whereJson, "start_region_code");
|
||||
String end_region_code = MapUtil.getStr(whereJson, "end_region_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("bill_status",MapUtil.getStr(whereJson, "bill_status"));
|
||||
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code", bill_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(vehicle_code)) map.put("vehicle_code", vehicle_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", material_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", pcsn + "%");
|
||||
if (ObjectUtil.isNotEmpty(point_code1)) map.put("point_code1", point_code1 + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_point_code)) map.put("end_point_code", end_point_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(start_region_code)) map.put("start_region_code", start_region_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_region_code)) map.put("end_region_code", end_region_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("ST_REGION_IN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ios.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionioDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RegionioDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findById(Long qty_unit_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("qty_unit_id = '" + qty_unit_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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("ehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0' and is_used= '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVehicle)) {
|
||||
throw new BadRequestException("载具不存在");
|
||||
}
|
||||
}
|
||||
|
||||
String bill_code = CodeUtil.getNewCode("IN_STORE_CODE");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setIostorinv_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setBill_code(bill_code);
|
||||
dto.setIo_type("0");
|
||||
dto.setBill_status("10");
|
||||
dto.setCreate_mode("01");
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
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));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(RegionioDto dto) {
|
||||
RegionioDto entity = this.findById(dto.getQty_unit_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
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("ehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0' and is_used= '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVehicle)) {
|
||||
throw new BadRequestException("载具不存在");
|
||||
}
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
dto.setBill_status("10");
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setQty_unit_id(jsonMater.getLongValue("base_unit_id"));
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_regionIO");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
for (Long iostorinv_id: ids) {
|
||||
JSONObject param = wo.query("iostorinv_id = '" + String.valueOf(iostorinv_id) + "'").uniqueResult(0);
|
||||
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 createTask(JSONObject jsonObject) {
|
||||
String iostorinv_id = jsonObject.getString("iostorinv_id");
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_regionIO");
|
||||
WQLObject orderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||
|
||||
JSONObject jsonIn = wo.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
String point_code1 = jsonIn.getString("point_code1");
|
||||
|
||||
// 准备参数 并调用入库处理类中的创建任务方法
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("vehicle_code", jsonIn.getString("vehicle_code"));
|
||||
form.put("point_code1", point_code1);
|
||||
form.put("point_code2", jsonIn.getString("end_point_code"));
|
||||
form.put("material_id", jsonIn.getString("material_id"));
|
||||
form.put("qty", jsonIn.getString("qty"));
|
||||
form.put("cust_id", jsonIn.getString("cust_id"));
|
||||
form.put("create_mode", jsonIn.getString("create_mode"));
|
||||
form.put("pcsn", jsonIn.getString("pcsn"));
|
||||
form.put("iostorinv_id", iostorinv_id);
|
||||
|
||||
// 根据起点点位 找到对应设备,根据设备找到对应工单,根据工单获取载具类型
|
||||
String device_code = point_code1.substring(0, point_code1.indexOf("_"));
|
||||
|
||||
DeviceService deviceBean = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceDto deviceDto = deviceBean.findByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(deviceDto)) throw new BadRequestException("此设备不存在");
|
||||
JSONObject jsonOrder = orderTab.query("device_id = '" + deviceDto.getDevice_id() + "' and order_status = '02' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonOrder)) throw new BadRequestException("此设备未在生产中或不存在");
|
||||
|
||||
form.put("vehicle_type", jsonOrder.getString("vehicle_type"));
|
||||
SendMaterialTask sendMaterialTask = new SendMaterialTask();
|
||||
String task_id = sendMaterialTask.createTask(form);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
json.put("update_optname", SecurityUtils.getCurrentNickName());
|
||||
json.put("update_time", DateUtil.now());
|
||||
json.put("bill_status", "20");
|
||||
wo.update(json, "iostorinv_id = '" + iostorinv_id + "'");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 区域入库分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.point_code1 TYPEAS s_string
|
||||
输入.end_point_code TYPEAS s_string
|
||||
输入.start_region_code TYPEAS s_string
|
||||
输入.end_region_code TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ios.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region1.region_name AS start_region_name,
|
||||
region2.region_name AS end_region_name,
|
||||
point1.point_name AS start_point_name,
|
||||
point2.point_name AS end_point_name
|
||||
FROM
|
||||
ST_IVT_regionIO ios
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ios.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ios.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region1 ON region1.region_id = ios.start_region_id
|
||||
LEFT JOIN SCH_BASE_Region region2 ON region2.region_id = ios.end_region_id
|
||||
LEFT JOIN sch_base_point point1 ON point1.point_code = ios.point_code1
|
||||
LEFT JOIN sch_base_point point2 ON point2.point_code = ios.end_point_code
|
||||
WHERE
|
||||
ios.is_delete = '0'
|
||||
AND ios.io_type = '0'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
ios.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.bill_status <> ""
|
||||
ios.bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
ios.vehicle_code like 输入.vehicle_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.pcsn <> ""
|
||||
ios.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_code <> ""
|
||||
(mater.material_code like 输入.material_code or
|
||||
mater.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_code1 <> ""
|
||||
(point1.point_code like 输入.point_code1 or
|
||||
point1.point_name like 输入.point_code1)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_point_code <> ""
|
||||
(point2.point_code like 输入.end_point_code or
|
||||
point2.point_name like 输入.end_point_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.start_region_code <> ""
|
||||
(region1.region_code like 输入.start_region_code or
|
||||
region1.region_name like 输入.start_region_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_region_code <> ""
|
||||
(region2.region_code like 输入.end_region_code or
|
||||
region2.region_name like 输入.end_region_code)
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.point_status = '1'
|
||||
AND point.lock_type = '00'
|
||||
AND point.is_used = '1'
|
||||
AND point.is_delete = '0'
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,84 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.outbill.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.st.inbill.service.dto.RegionioDto;
|
||||
import org.nl.wms.st.outbill.service.RegionioOutService;
|
||||
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 2022-08-11
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "区域出库管理")
|
||||
@RequestMapping("/api/regionioOut")
|
||||
@Slf4j
|
||||
public class RegionioOutController {
|
||||
|
||||
private final RegionioOutService regionioOutService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询区域出库")
|
||||
@ApiOperation("查询区域出库")
|
||||
//@SaCheckPermission("regionio:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(regionioOutService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增区域出库")
|
||||
@ApiOperation("新增区域出库")
|
||||
//@SaCheckPermission("regionio:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody RegionioDto dto) {
|
||||
regionioOutService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改区域入库")
|
||||
@ApiOperation("修改区域入库")
|
||||
//@SaCheckPermission("regionio:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody RegionioDto dto) {
|
||||
regionioOutService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除区域出库")
|
||||
@ApiOperation("删除区域出库")
|
||||
//@SaCheckPermission("regionio:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
regionioOutService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("生成任务")
|
||||
@ApiOperation("生成任务")
|
||||
@PostMapping("/createTask")
|
||||
public ResponseEntity<Object> createTask(@RequestBody JSONObject jsonObject) {
|
||||
regionioOutService.createTask(jsonObject);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getMaterial")
|
||||
@Log("选择物料")
|
||||
@ApiOperation("选择物料")
|
||||
public ResponseEntity<Object> getMaterial(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(regionioOutService.getMaterial(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.outbill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
public interface RegionioOutService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<RegionioDto>
|
||||
*/
|
||||
List<RegionioDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param qty_unit_id ID
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findById(Long qty_unit_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Regionio
|
||||
*/
|
||||
RegionioDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(RegionioDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(RegionioDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 生成任务
|
||||
*
|
||||
* @param jsonObject /
|
||||
*/
|
||||
void createTask(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 选择出库物料
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<RegionioDto>
|
||||
*/
|
||||
Map<String,Object> getMaterial(Map whereJson, Pageable page);
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
|
||||
package org.nl.wms.st.outbill.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 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.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.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.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.sch.tasks.CallMaterialTask;
|
||||
import org.nl.wms.st.inbill.service.dto.RegionioDto;
|
||||
import org.nl.wms.st.outbill.service.RegionioOutService;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author Liuxy
|
||||
* @date 2022-08-11
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RegionioOutServiceImpl implements RegionioOutService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
String vehicle_code = MapUtil.getStr(whereJson, "vehicle_code");
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String point_code1 = MapUtil.getStr(whereJson, "point_code1");
|
||||
String end_point_code = MapUtil.getStr(whereJson, "end_point_code");
|
||||
String start_region_code = MapUtil.getStr(whereJson, "start_region_code");
|
||||
String end_region_code = MapUtil.getStr(whereJson, "end_region_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("bill_status",MapUtil.getStr(whereJson, "bill_status"));
|
||||
if (ObjectUtil.isNotEmpty(bill_code)) map.put("bill_code", bill_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(vehicle_code)) map.put("vehicle_code", vehicle_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", material_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", pcsn + "%");
|
||||
if (ObjectUtil.isNotEmpty(point_code1)) map.put("point_code1", point_code1 + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_point_code)) map.put("end_point_code", end_point_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(start_region_code)) map.put("start_region_code", start_region_code + "%");
|
||||
if (ObjectUtil.isNotEmpty(end_region_code)) map.put("end_region_code", end_region_code + "%");
|
||||
|
||||
JSONObject json = WQL.getWO("ST_REGION_OUT_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ios.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RegionioDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(RegionioDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findById(Long qty_unit_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("qty_unit_id = '" + qty_unit_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionioDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( RegionioDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@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("ehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0' and is_used= '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVehicle)) {
|
||||
throw new BadRequestException("载具不存在");
|
||||
}
|
||||
}
|
||||
|
||||
String bill_code = CodeUtil.getNewCode("OUT_STORE_CODE");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setIostorinv_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setBill_code(bill_code);
|
||||
dto.setIo_type("1");
|
||||
dto.setBill_status("10");
|
||||
dto.setCreate_mode("01");
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
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));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(RegionioDto dto) {
|
||||
RegionioDto entity = this.findById(dto.getQty_unit_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
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("ehicle_code = '" + dto.getVehicle_code() + "' and is_delete = '0' and is_used= '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonVehicle)) {
|
||||
throw new BadRequestException("载具不存在");
|
||||
}
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
dto.setBill_status("10");
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setQty_unit_id(jsonMater.getLongValue("base_unit_id"));
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_regionIO");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_regionio");
|
||||
for (Long iostorinv_id: ids) {
|
||||
JSONObject param = wo.query("iostorinv_id = '" + String.valueOf(iostorinv_id) + "'").uniqueResult(0);
|
||||
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 createTask(JSONObject jsonObject) {
|
||||
String iostorinv_id = jsonObject.getString("iostorinv_id");
|
||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_regionIO");
|
||||
JSONObject jsonIn = wo.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||
|
||||
// 准备参数 并调用入库处理类中的创建任务方法
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("vehicle_code", jsonIn.getString("vehicle_code"));
|
||||
form.put("point_code1", jsonIn.getString("point_code1"));
|
||||
form.put("point_code2", jsonIn.getString("end_point_code"));
|
||||
form.put("material_id", jsonIn.getString("material_id"));
|
||||
form.put("qty", jsonIn.getString("qty"));
|
||||
form.put("cust_id", jsonIn.getString("cust_id"));
|
||||
form.put("create_mode", jsonIn.getString("create_mode"));
|
||||
form.put("pcsn", jsonIn.getString("pcsn"));
|
||||
form.put("iostorinv_id", iostorinv_id);
|
||||
CallMaterialTask callMaterialTask = new CallMaterialTask();
|
||||
String task_id = callMaterialTask.createTask(form);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
json.put("update_optname", SecurityUtils.getCurrentNickName());
|
||||
json.put("update_time", DateUtil.now());
|
||||
json.put("bill_status", "20");
|
||||
wo.update(json, "iostorinv_id = '" + iostorinv_id + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMaterial(Map whereJson, Pageable page) {
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("region_id", MapUtil.getStr(whereJson, "region_id"));
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code",material_code);
|
||||
|
||||
JSONObject json = WQL.getWO("ST_REGION_OUT_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.instorage_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 区域入库分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.vehicle_code TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.point_code1 TYPEAS s_string
|
||||
输入.end_point_code TYPEAS s_string
|
||||
输入.start_region_code TYPEAS s_string
|
||||
输入.end_region_code TYPEAS s_string
|
||||
输入.region_id TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ios.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name,
|
||||
region1.region_name AS start_region_name,
|
||||
region2.region_name AS end_region_name,
|
||||
point1.point_name AS start_point_name,
|
||||
point2.point_name AS end_point_name
|
||||
FROM
|
||||
ST_IVT_regionIO ios
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ios.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ios.qty_unit_id
|
||||
LEFT JOIN SCH_BASE_Region region1 ON region1.region_id = ios.start_region_id
|
||||
LEFT JOIN SCH_BASE_Region region2 ON region2.region_id = ios.end_region_id
|
||||
LEFT JOIN sch_base_point point1 ON point1.point_code = ios.point_code1
|
||||
LEFT JOIN sch_base_point point2 ON point2.point_code = ios.end_point_code
|
||||
WHERE
|
||||
ios.is_delete = '0'
|
||||
AND ios.io_type = '1'
|
||||
|
||||
OPTION 输入.bill_code <> ""
|
||||
ios.bill_code like 输入.bill_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.bill_status <> ""
|
||||
ios.bill_status = 输入.bill_status
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.vehicle_code <> ""
|
||||
ios.vehicle_code like 输入.vehicle_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.pcsn <> ""
|
||||
ios.pcsn like 输入.pcsn
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_code <> ""
|
||||
(mater.material_code like 输入.material_code or
|
||||
mater.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.point_code1 <> ""
|
||||
(point1.point_code like 输入.point_code1 or
|
||||
point1.point_name like 输入.point_code1)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_point_code <> ""
|
||||
(point2.point_code like 输入.end_point_code or
|
||||
point2.point_name like 输入.end_point_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.start_region_code <> ""
|
||||
(region1.region_code like 输入.start_region_code or
|
||||
region1.region_name like 输入.start_region_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.end_region_code <> ""
|
||||
(region2.region_code like 输入.end_region_code or
|
||||
region2.region_name like 输入.end_region_code)
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ivt.*,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
mater.material_model,
|
||||
unit.unit_name,
|
||||
point.vehicle_code
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
|
||||
WHERE
|
||||
1=1
|
||||
|
||||
OPTION 输入.region_id <> ""
|
||||
point.region_id = 输入.region_id
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_code <> ""
|
||||
(mater.material_code like 输入.material_code or
|
||||
mater.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
ivt.*
|
||||
FROM
|
||||
ST_IVT_StructIvt ivt
|
||||
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
|
||||
LEFT JOIN SCH_BASE_Region region ON region.region_id = point.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '02'
|
||||
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
point.vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.material_id <> ""
|
||||
ivt.material_id = 输入.material_id
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user