跟acs测试提交
This commit is contained in:
@@ -77,6 +77,8 @@ IF 输入.flag = "2"
|
||||
left join st_rule_IOdisStruct ruledis on ruledis.struct_uuid = structattr.struct_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_type<>'05'
|
||||
AND point.point_type<>'01'
|
||||
AND ( point.vehicle_code = '' OR point.vehicle_code IS NULL )
|
||||
AND point.is_used = '1'
|
||||
AND point.point_status = '00'
|
||||
@@ -108,6 +110,8 @@ IF 输入.flag = "3"
|
||||
ivt.canuse_qty,
|
||||
ivt.workprocedure_id,
|
||||
ivt.qty_unit_id,
|
||||
ivt.pcsn,
|
||||
ivt.qty_unit_id,
|
||||
ruledis.out_seq_no
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
|
||||
package org.nl.wms.dump.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.dump.service.DumpinvService;
|
||||
import org.nl.wms.dump.service.dto.DumpinvDto;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @date 2022-02-15
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "转储单设置管理")
|
||||
@RequestMapping("/api/dumpinv")
|
||||
@Slf4j
|
||||
public class DumpinvController {
|
||||
|
||||
private final DumpinvService dumpinvService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询转储单设置")
|
||||
@ApiOperation("查询转储单设置")
|
||||
//@PreAuthorize("@el.check('dumpinv:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(dumpinvService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增转储单设置")
|
||||
@ApiOperation("新增转储单设置")
|
||||
//@PreAuthorize("@el.check('dumpinv:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody DumpinvDto dto){
|
||||
dumpinvService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改转储单设置")
|
||||
@ApiOperation("修改转储单设置")
|
||||
//@PreAuthorize("@el.check('dumpinv:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DumpinvDto dto){
|
||||
dumpinvService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除转储单设置")
|
||||
@ApiOperation("删除转储单设置")
|
||||
//@PreAuthorize("@el.check('dumpinv:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
dumpinvService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("导出转储单设置")
|
||||
@ApiOperation("导出转储单设置")
|
||||
@GetMapping(value = "/download")
|
||||
//@PreAuthorize("@el.check('dumpinv:list')")
|
||||
public void download(HttpServletResponse response, Map whereJson) throws IOException {
|
||||
dumpinvService.download(dumpinvService.queryAll(whereJson), response);
|
||||
}
|
||||
@PostMapping(value ="/crateTask")
|
||||
@Log("生产任务并且下发")
|
||||
@ApiOperation("生产任务并且下发")
|
||||
//@PreAuthorize("@el.check('dumpinv:add')")
|
||||
public ResponseEntity<Object> crateTask(@Validated @RequestBody DumpinvDto dto){
|
||||
dumpinvService.crateTask(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping(value ="/finshTask")
|
||||
@Log("生产任务并且下发")
|
||||
@ApiOperation("生产任务并且下发")
|
||||
//@PreAuthorize("@el.check('dumpinv:add')")
|
||||
public ResponseEntity<Object> finshTask(@Validated @RequestBody DumpinvDto dto){
|
||||
dumpinvService.finshTask(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/dis")
|
||||
@Log("组盘分配任务并审核")
|
||||
@ApiOperation("组盘分配任务并审核")
|
||||
//@PreAuthorize("@el.check('dumpinv:add')")
|
||||
public ResponseEntity<Object> dis( @RequestBody Map map){
|
||||
dumpinvService.dis(map);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
package org.nl.wms.dump.rest;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
|
||||
import org.nl.wms.dump.service.MaterialbaseService;
|
||||
import org.nl.wms.dump.service.dto.MaterialbaseDto;
|
||||
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 zhouz
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "仓储库存物料选择")
|
||||
@RequestMapping("/api/Materialbase")
|
||||
@Slf4j
|
||||
public class MaterialbaseController {
|
||||
|
||||
private final MaterialbaseService materialBaseService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询物料")
|
||||
@ApiOperation("查询物料")
|
||||
//@PreAuthorize("@el.check('Materialbase:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(materialBaseService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/EmptyStruct")
|
||||
@Log("查询空仓位")
|
||||
@ApiOperation("查询空仓位")
|
||||
//@PreAuthorize("@el.check('Materialbase:list')")
|
||||
public ResponseEntity<Object> queryEmptyStruct(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(materialBaseService.queryEmptyStruct(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
package org.nl.wms.dump.service;
|
||||
|
||||
import org.nl.wms.dump.service.dto.DumpinvDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务接口
|
||||
* @date 2022-02-15
|
||||
**/
|
||||
public interface DumpinvService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<DumpinvDto>
|
||||
*/
|
||||
List<DumpinvDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param dumpinv_uuid ID
|
||||
* @return Dumpinv
|
||||
*/
|
||||
DumpinvDto findById(String dumpinv_uuid);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Dumpinv
|
||||
*/
|
||||
DumpinvDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(DumpinvDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(DumpinvDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param dtos 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<DumpinvDto> dtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 生成任务
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void crateTask(DumpinvDto dto);
|
||||
|
||||
/**
|
||||
* 任务完成
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void finshTask(DumpinvDto dto);
|
||||
|
||||
void dis(Map map);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
package org.nl.wms.dump.service;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description 服务接口
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
public interface MaterialbaseService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 查询空仓位
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryEmptyStruct(Map whereJson, Pageable page);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package org.nl.wms.dump.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description /
|
||||
* @date 2022-02-15
|
||||
**/
|
||||
@Data
|
||||
public class DumpinvDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 转储单标识
|
||||
*/
|
||||
private String dumpinv_id;
|
||||
|
||||
/**
|
||||
* 单据编号
|
||||
*/
|
||||
private String bill_code;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
*/
|
||||
private String bill_status;
|
||||
|
||||
/**
|
||||
* 转出仓位标识
|
||||
*/
|
||||
private String turnout_struct_id;
|
||||
|
||||
/**
|
||||
* 转出仓位编码
|
||||
*/
|
||||
private String turnout_struct_code;
|
||||
|
||||
/**
|
||||
* 转出仓位名称
|
||||
*/
|
||||
private String turnout_struct_name;
|
||||
|
||||
/**
|
||||
* 转入仓位标识
|
||||
*/
|
||||
private String turnin_struct_id;
|
||||
|
||||
/**
|
||||
* 转入仓位编码
|
||||
*/
|
||||
private String turnin_struct_code;
|
||||
|
||||
/**
|
||||
* 转入仓位名称
|
||||
*/
|
||||
private String turnin_struct_name;
|
||||
|
||||
/**
|
||||
* 工序标识
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String create_by;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改者
|
||||
*/
|
||||
private String update_by;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private String task_id;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package org.nl.wms.dump.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description /
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@Data
|
||||
public class MaterialbaseDto implements Serializable {
|
||||
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long material_id;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
private String material_name;
|
||||
|
||||
private String material_spec;
|
||||
|
||||
private String material_model;
|
||||
|
||||
private String english_name;
|
||||
|
||||
private Long base_unit_id;
|
||||
private String base_unit_name;
|
||||
|
||||
private String approve_fileno;
|
||||
|
||||
private String print_no;
|
||||
|
||||
/**
|
||||
* 物料分类
|
||||
*/
|
||||
private Long material_type_id;
|
||||
|
||||
private Long len_unit_id;
|
||||
|
||||
private BigDecimal length;
|
||||
|
||||
private BigDecimal width;
|
||||
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
private Long weight_unit_id;
|
||||
|
||||
private BigDecimal gross_weight;
|
||||
|
||||
private BigDecimal net_weight;
|
||||
|
||||
private Long cubage_unit_id;
|
||||
|
||||
private BigDecimal cubage;
|
||||
|
||||
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 String is_used_time;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String is_used;
|
||||
|
||||
private String is_delete;
|
||||
|
||||
private String ext_id;
|
||||
|
||||
private String material_height_type;
|
||||
|
||||
private Long ass_unit_id;
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
|
||||
package org.nl.wms.dump.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.dump.service.DumpinvService;
|
||||
import org.nl.wms.dump.service.dto.DumpinvDto;
|
||||
import org.nl.wms.pda.exception.PdaRequestException;
|
||||
import org.nl.wms.sch.manage.buss.DumpTask;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wms.sch.service.impl.PointServiceImpl;
|
||||
import org.nl.wms.st.ivt.IvtChangeTypeEnum;
|
||||
import org.nl.wms.st.ivt.StoreIvtServiceImpl;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qinx
|
||||
* @description 服务实现
|
||||
* @date 2022-02-15
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DumpinvServiceImpl implements DumpinvService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
JSONObject json = WQL.getWO("QMD_ME_MATERIAL").addParam("flag", "3").pageQuery(WqlUtil.getHttpContext(page), "bill_code desc");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DumpinvDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_buss_dumpinv");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<DumpinvDto> list = arr.toJavaList(DumpinvDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DumpinvDto findById(String dumpinv_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_buss_dumpinv");
|
||||
JSONObject json = wo.query("dumpinv_id ='" + dumpinv_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) return json.toJavaObject(DumpinvDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DumpinvDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_buss_dumpinv");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) return json.toJavaObject(DumpinvDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DumpinvDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
String turnout_struct_id = dto.getTurnout_struct_id();
|
||||
String turnin_struct_id = dto.getTurnin_struct_id();
|
||||
if (StrUtil.isEmpty(turnout_struct_id)) {
|
||||
throw new BadRequestException("转出仓位不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(turnin_struct_id)) {
|
||||
throw new BadRequestException("转入仓位不能为空!");
|
||||
}
|
||||
JSONObject ivtJo = WQLObject.getWQLObject("st_ivt_structivt").query("struct_id='" + turnout_struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtJo)) {
|
||||
throw new BadRequestException("未找到库存信息");
|
||||
}
|
||||
JSONObject turninObj = WQLObject.getWQLObject("sch_base_point").query("point_id='" + turnin_struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(turninObj)) {
|
||||
throw new BadRequestException("转入仓位未找到");
|
||||
}
|
||||
JSONObject dumpinvObj = new JSONObject();
|
||||
dumpinvObj.put("dumpinv_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
dumpinvObj.put("bill_code", CodeUtil.getNewCode("PD_CODE"));
|
||||
dumpinvObj.put("bill_status", "00");
|
||||
dumpinvObj.put("turnout_struct_id", dto.getTurnout_struct_id());
|
||||
dumpinvObj.put("turnout_struct_code", dto.getTurnout_struct_code());
|
||||
dumpinvObj.put("turnout_struct_name", dto.getTurnout_struct_name());
|
||||
dumpinvObj.put("turnin_struct_id", dto.getTurnin_struct_id());
|
||||
dumpinvObj.put("turnin_struct_code", dto.getTurnin_struct_code());
|
||||
dumpinvObj.put("turnin_struct_name", dto.getTurnin_struct_name());
|
||||
dumpinvObj.put("barcode", ivtJo.getString("barcode"));
|
||||
dumpinvObj.put("material_id", ivtJo.getString("material_id"));
|
||||
dumpinvObj.put("pcsn", ivtJo.getString("pcsn"));
|
||||
dumpinvObj.put("qty_unit_id", ivtJo.getString("qty_unit_id"));
|
||||
dumpinvObj.put("qty", ivtJo.getString("canuse_qty"));
|
||||
dumpinvObj.put("vehicle_code", ivtJo.getString("vehicle_code"));
|
||||
dumpinvObj.put("remark", dto.getRemark());
|
||||
dumpinvObj.put("is_active", "1");
|
||||
dumpinvObj.put("create_by", currentUsername);
|
||||
dumpinvObj.put("create_time", now);
|
||||
dumpinvObj.put("update_by", currentUsername);
|
||||
dumpinvObj.put("update_time", now);
|
||||
WQLObject.getWQLObject("st_buss_dumpinv").insert(dumpinvObj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DumpinvDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String dumpinv_id = dto.getDumpinv_id();
|
||||
String now = DateUtil.now();
|
||||
JSONObject dumpinvObj = WQLObject.getWQLObject("st_buss_dumpinv").query("dumpinv_id='" + dumpinv_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dumpinvObj)) {
|
||||
throw new BadRequestException("未找到该单据!");
|
||||
}
|
||||
String turnout_struct_id = dto.getTurnout_struct_id();
|
||||
String turnin_struct_id = dto.getTurnin_struct_id();
|
||||
if (StrUtil.isEmpty(turnout_struct_id)) {
|
||||
throw new BadRequestException("转出仓位不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(turnin_struct_id)) {
|
||||
throw new BadRequestException("转入仓位不能为空!");
|
||||
}
|
||||
JSONObject ivtJo = WQLObject.getWQLObject("st_ivt_structivt").query("struct_id='" + turnout_struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtJo)) {
|
||||
throw new BadRequestException("未找到库存信息");
|
||||
}
|
||||
JSONObject turninObj = WQLObject.getWQLObject("sch_base_point").query("point_id='" + turnin_struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(turninObj)) {
|
||||
throw new BadRequestException("转入仓位未找到");
|
||||
}
|
||||
|
||||
dumpinvObj.put("turnout_struct_id", dto.getTurnout_struct_id());
|
||||
dumpinvObj.put("turnout_struct_code", dto.getTurnout_struct_code());
|
||||
dumpinvObj.put("turnout_struct_name", dto.getTurnout_struct_name());
|
||||
dumpinvObj.put("turnin_struct_id", dto.getTurnin_struct_id());
|
||||
dumpinvObj.put("turnin_struct_code", dto.getTurnin_struct_code());
|
||||
dumpinvObj.put("turnin_struct_name", dto.getTurnin_struct_name());
|
||||
dumpinvObj.put("barcode", ivtJo.getString("barcode"));
|
||||
dumpinvObj.put("material_id", ivtJo.getString("material_id"));
|
||||
dumpinvObj.put("pcsn", ivtJo.getString("pcsn"));
|
||||
dumpinvObj.put("qty_unit_id", ivtJo.getString("qty_unit_id"));
|
||||
dumpinvObj.put("qty", ivtJo.getString("canuse_qty"));
|
||||
dumpinvObj.put("vehicle_code", ivtJo.getString("vehicle_code"));
|
||||
dumpinvObj.put("remark", dto.getRemark());
|
||||
dumpinvObj.put("is_active", "1");
|
||||
dumpinvObj.put("create_by", currentUsername);
|
||||
dumpinvObj.put("create_time", now);
|
||||
dumpinvObj.put("update_by", currentUsername);
|
||||
dumpinvObj.put("update_time", now);
|
||||
WQLObject.getWQLObject("st_buss_dumpinv").update(dumpinvObj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("st_buss_dumpinv");
|
||||
for (String dumpinv_id : ids) {
|
||||
wo.delete("dumpinv_id = '" + dumpinv_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<DumpinvDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (DumpinvDto dumpinv : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("单据编号", dumpinv.getBill_code());
|
||||
map.put("单据状态", dumpinv.getBill_status());
|
||||
map.put("转出仓位标识", dumpinv.getTurnout_struct_id());
|
||||
map.put("转出仓位编码", dumpinv.getTurnout_struct_code());
|
||||
map.put("转出仓位名称", dumpinv.getTurnout_struct_name());
|
||||
map.put("转入仓位标识", dumpinv.getTurnin_struct_id());
|
||||
map.put("转入仓位编码", dumpinv.getTurnin_struct_code());
|
||||
map.put("转入仓位名称", dumpinv.getTurnin_struct_name());
|
||||
map.put("条形码", dumpinv.getWorkprocedure_id());
|
||||
map.put("物料标识", dumpinv.getMaterial_id());
|
||||
map.put("批次", dumpinv.getPcsn());
|
||||
map.put("数量计量单位标识", dumpinv.getQty_unit_id());
|
||||
map.put("数量", dumpinv.getQty());
|
||||
map.put("载具号", dumpinv.getVehicle_code());
|
||||
map.put("备注", dumpinv.getRemark());
|
||||
map.put("是否启用", dumpinv.getIs_active());
|
||||
map.put("是否删除", dumpinv.getIs_delete());
|
||||
map.put("创建者", dumpinv.getCreate_by());
|
||||
map.put("创建时间", dumpinv.getCreate_time());
|
||||
map.put("修改者", dumpinv.getUpdate_by());
|
||||
map.put("修改时间", dumpinv.getUpdate_time());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void crateTask(DumpinvDto dto) {
|
||||
//1 生成任务 //2 加锁 // 更新状态
|
||||
String dumpinv_id = dto.getDumpinv_id();
|
||||
JSONObject dumpObj = WQLObject.getWQLObject("st_buss_DumpInv").query("dumpinv_id='" + dumpinv_id + "'").uniqueResult(0);
|
||||
DumpTask task = new DumpTask();
|
||||
JSONObject taskObj = new JSONObject();
|
||||
String turnout_struct_code = dumpObj.getString("turnout_struct_code");
|
||||
String turnin_struct_code = dumpObj.getString("turnin_struct_code");
|
||||
taskObj.put("taskdtl_type", "00");
|
||||
taskObj.put("start_point_code", turnout_struct_code);
|
||||
taskObj.put("next_point_code", turnin_struct_code);
|
||||
taskObj.put("buss_area_type", "01");
|
||||
taskObj.put("vehicle_code", dumpObj.getString("vehicle_code"));
|
||||
String task_code = CodeUtil.getNewCode("TASK_CODE");
|
||||
String task_id = task.createTask(taskObj);
|
||||
//加锁
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject outPointObj = pointTable.query("point_code ='" + turnout_struct_code + "'").uniqueResult(0);
|
||||
JSONObject InPointObj = pointTable.query("point_code ='" + turnin_struct_code + "'").uniqueResult(0);
|
||||
outPointObj.put("lock_type", "01");
|
||||
InPointObj.put("lock_type", "01");
|
||||
pointTable.update(outPointObj);
|
||||
pointTable.update(InPointObj);
|
||||
//更新转储单的状态
|
||||
dumpObj.put("bill_status", "01");
|
||||
dumpObj.put("task_code", task_code);
|
||||
dumpObj.put("task_id", task_id);
|
||||
|
||||
WQLObject.getWQLObject("st_buss_DumpInv").update(dumpObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finshTask(DumpinvDto dto) {
|
||||
String task_id = dto.getTask_id();
|
||||
if (StrUtil.isEmpty(task_id)) {
|
||||
throw new BadRequestException("任务标志不能为空!");
|
||||
}
|
||||
DumpTask task = new DumpTask();
|
||||
task.forceFinish(task_id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void dis(Map map) {
|
||||
String billdis_id = (String) map.get("billdis_id");
|
||||
String start_point_code = (String) map.get("turnout_struct_code");
|
||||
String next_point_code = (String) map.get("turnin_struct_code");
|
||||
if (StrUtil.isEmpty(billdis_id)) {
|
||||
throw new PdaRequestException("分配标志不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(next_point_code)) {
|
||||
throw new PdaRequestException("终点不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(start_point_code)) {
|
||||
throw new PdaRequestException("起点不能为空!");
|
||||
}
|
||||
JSONObject disObj = WQLObject.getWQLObject("st_buss_IOStoreDis").query("billdis_id='" + billdis_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(disObj)) {
|
||||
throw new PdaRequestException("未找到分配记录!");
|
||||
}
|
||||
//根据起点去找起点区域
|
||||
WQLObject pointtable = WQLObject.getWQLObject("sch_base_point");
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
PointDto nextPointDto = pointService.findByCode(next_point_code);
|
||||
if (ObjectUtil.isNull(nextPointDto)) {
|
||||
throw new PdaRequestException("未找到可用点位:" + next_point_code);
|
||||
}
|
||||
PointDto startPointDto = pointService.findByCode(start_point_code);
|
||||
if (ObjectUtil.isNull(startPointDto)) {
|
||||
throw new PdaRequestException("未找到可用点位:" + start_point_code);
|
||||
}
|
||||
|
||||
String startArea = startPointDto.getArea_type();
|
||||
String nextArea = nextPointDto.getArea_type();
|
||||
disObj.put("start_area_type", startArea);
|
||||
disObj.put("next_area_type", nextArea);
|
||||
disObj.put("start_point_code", start_point_code);
|
||||
disObj.put("next_point_code", next_point_code);
|
||||
disObj.put("is_finishtask", "1");
|
||||
WQLObject.getWQLObject("st_buss_IOStoreDis").update(disObj);
|
||||
//增加库存
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", disObj.getString("material_id"));
|
||||
param.put("bill_id", disObj.getString("bill_id"));
|
||||
param.put("qty_unit_id", disObj.getString("qty_unit_id"));
|
||||
param.put("pcsn", disObj.getString("pcsn"));
|
||||
param.put("change_qty", disObj.getString("realassign_qty"));
|
||||
param.put("vehicle_code", disObj.getString("vehicle_code"));
|
||||
param.put("barcode", disObj.getString("barcode"));
|
||||
param.put("struct_id", nextPointDto.getPoint_id());
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.ADD_IVT_AND_CAN_USE);
|
||||
//更新主表跟明细表
|
||||
String billdtl_id = disObj.getString("billdtl_id");
|
||||
String bill_id = disObj.getString("bill_id");
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("st_buss_IOStoreDtl");
|
||||
WQLObject mstTab = WQLObject.getWQLObject("st_buss_IOStoreMst");
|
||||
JSONObject dtlObj = dtlTab.query("billdtl_id='" + billdtl_id + "'").uniqueResult(0);
|
||||
JSONObject disjoo = WQLObject.getWQLObject("st_buss_iostoredis").query("billdtl_id='" + billdtl_id + "' and is_finishtask<>'1' and is_delete<>'1'").uniqueResult(0);
|
||||
//假如所有的分配都完成了任务,更新明细表
|
||||
double qty = Double.valueOf(dtlObj.getString("qty"));
|
||||
double assign_qty = Double.valueOf(dtlObj.getString("assign_qty"));
|
||||
if (ObjectUtil.isEmpty(disjoo) && (qty == assign_qty)) {
|
||||
dtlObj.put("bill_status", "40");
|
||||
dtlObj.put("is_can_back", "1");
|
||||
dtlTab.update(dtlObj);
|
||||
}
|
||||
//该表主表的状态
|
||||
if (StrUtil.isNotEmpty(bill_id)) {
|
||||
JSONObject mstObj = mstTab.query("bill_id='" + bill_id + "'").uniqueResult(0);
|
||||
JSONObject dtlObj1 = dtlTab.query("bill_id='" + bill_id + "' and bill_status<>'40'").uniqueResult(0);
|
||||
if (ObjectUtil.isNull(dtlObj1)) {
|
||||
mstObj.put("bill_status", "40");
|
||||
mstTab.update(mstObj);
|
||||
}
|
||||
}
|
||||
//更新点位状态
|
||||
//解锁仓位,托盘信息,回写到点位上去
|
||||
String vehicle_code = disObj.getString("vehicle_code");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject endpointObj = pointTab.query("point_code='" + next_point_code + "'").uniqueResult(0);
|
||||
endpointObj.put("lock_type", "00");
|
||||
endpointObj.put("point_status", "02");
|
||||
endpointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(endpointObj);
|
||||
|
||||
JSONObject startPointObj = pointTab.query("point_code='" + start_point_code + "'").uniqueResult(0);
|
||||
startPointObj.put("lock_type", "00");
|
||||
startPointObj.put("point_status", "00");
|
||||
startPointObj.put("vehicle_code", "");
|
||||
pointTab.update(startPointObj);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
package org.nl.wms.dump.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.dump.service.MaterialbaseService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @description 服务实现
|
||||
* @date 2021-12-07
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MaterialbaseServiceImpl implements MaterialbaseService {
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
if (StrUtil.isNotEmpty(search)){
|
||||
map.put("search", "%" + search + "%");
|
||||
}
|
||||
|
||||
JSONObject jo = WQL.getWO("QMD_ME_MATERIAL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "struct_code");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryEmptyStruct(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
String sect_code = MapUtil.getStr(whereJson,"sect_code");
|
||||
map.put("sect_code", sect_code);
|
||||
String search = MapUtil.getStr(whereJson, "search");
|
||||
if (StrUtil.isNotEmpty(search)){
|
||||
map.put("search", "%" + search + "%");
|
||||
}
|
||||
JSONObject jo = WQL.getWO("QMD_ME_MATERIAL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "sect_code,struct_code");
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
[交易说明]
|
||||
交易名: 物料分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
输入.class_code TYPEAS s_string
|
||||
输入.idssql TYPEAS f_string
|
||||
输入.classIds TYPEAS f_string
|
||||
输入.sect_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
struct.struct_code,
|
||||
struct.struct_name,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
struct.struct_id,
|
||||
ivt.canuse_qty,
|
||||
ivt.ivt_qty,
|
||||
ivt.vehicle_code,
|
||||
ivt.pcsn
|
||||
FROM
|
||||
st_ivt_structivt ivt
|
||||
LEFT JOIN st_ivt_structattr struct ON ivt.struct_id = struct.struct_id
|
||||
LEFT JOIN md_me_material material ON material.material_id = ivt.material_id
|
||||
LEFT JOIN sch_base_point point ON point.point_id = struct.struct_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND point.point_status = '02'
|
||||
AND point.lock_type = '00'
|
||||
AND point.is_used = '1'
|
||||
OPTION 输入.search <> ""
|
||||
(
|
||||
struct.struct_code like 输入.search
|
||||
OR
|
||||
material.material_name like 输入.search
|
||||
or
|
||||
material.material_code like 输入.search
|
||||
or
|
||||
ivt.vehicle_code like 输入.search
|
||||
)
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
struct.*,
|
||||
sect.sect_code,
|
||||
sect.sect_name
|
||||
FROM
|
||||
st_ivt_structattr struct
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = struct.sect_id
|
||||
LEFT JOIN sch_base_point point ON point.point_id = struct.struct_id
|
||||
WHERE
|
||||
point.area_type IN ( '01', '02', '10' )
|
||||
AND point_status = '00'
|
||||
AND point.is_used = '1'
|
||||
AND lock_type = '00'
|
||||
AND vehicle_code = ''
|
||||
OPTION 输入.sect_code <> ""
|
||||
sect.sect_code = 输入.sect_code
|
||||
ENDOPTION
|
||||
OPTION 输入.search <> ""
|
||||
(
|
||||
point.point_code like 输入.search
|
||||
OR
|
||||
point.point_name like 输入.search
|
||||
)
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
unit.unit_name as qty_unit_uuid_name,
|
||||
dump.*,
|
||||
material.material_code,
|
||||
material.material_name ,
|
||||
case dump.bill_status when '00' then '新增'
|
||||
when '01' then '生成任务'
|
||||
when '02' then '任务执行中'
|
||||
when '03' then '完成'
|
||||
else '' end as bill_status_name
|
||||
FROM
|
||||
st_buss_dumpinv dump
|
||||
LEFT JOIN md_me_material material ON dump.material_id = material.material_id
|
||||
left join md_pb_measureunit unit on unit.unit_id =dump.qty_unit_id
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -82,4 +82,10 @@ public class AcsToWmsController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/status")
|
||||
@Log("ACS给WMS反馈任务状态")
|
||||
@ApiOperation("ACS给WMS反馈任务状态")
|
||||
public ResponseEntity<Object> receiveTaskStatusAcs(@RequestBody String string) {
|
||||
return new ResponseEntity<>(acsToWmsService.receiveTaskStatusAcs(string), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,5 +62,14 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
|
||||
void sureProduceTask(Map jsonObject);
|
||||
/**
|
||||
* ACS客户端--->WMS服务端
|
||||
* ACS向WMS反馈任务状态
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
|
||||
Map<String, Object> receiveTaskStatusAcs(String string);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.nl.wms.ext.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -14,15 +15,21 @@ import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.database.service.dto.VehicleDto;
|
||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.manage.buss.CallEmptyVehicleTask;
|
||||
import org.nl.wms.sch.manage.buss.CallMaterialTask;
|
||||
import org.nl.wms.sch.manage.buss.SendEmptyVehicleTask;
|
||||
import org.nl.wms.sch.manage.buss.SendMaterialTask;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
import org.nl.wms.sch.service.dto.TaskDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -33,6 +40,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private final CallMaterialTask callMaterialTask;
|
||||
private final SendEmptyVehicleTask sendEmptyVehicleTask;
|
||||
private final CallEmptyVehicleTask callEmptyVehicleTask;
|
||||
private final TaskService taskService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -306,8 +314,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String producetask_code = (String) jsonObject.get("producetask_code");
|
||||
String device_code = (String) jsonObject.get("device_code");
|
||||
String material_code = (String) jsonObject.get("material_code");
|
||||
String qty = (String) jsonObject.get("qty");
|
||||
String weight = (String) jsonObject.get("weight");
|
||||
String qty = String.valueOf(jsonObject.get("qty"));
|
||||
String type = (String) jsonObject.get("type");
|
||||
if (StrUtil.isEmpty(type)) {
|
||||
throw new BadRequestException("类型不能为空!");
|
||||
@@ -341,18 +348,80 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (!StrUtil.equals(materiObj.getString("material_id"), taskObj.getString("material_id"))) {
|
||||
throw new BadRequestException("物料标识不一样!");
|
||||
}
|
||||
taskObj.put("producetask_status", "03");
|
||||
taskObj.put("producetask_status", "04");
|
||||
|
||||
}
|
||||
if (StrUtil.equals("2", type)) {
|
||||
taskObj.put("producetask_status", "04");
|
||||
}
|
||||
if (StrUtil.equals("3", type)) {
|
||||
taskObj.put("producetask_status", "05");
|
||||
taskObj.put("real_qty",qty);
|
||||
}
|
||||
taskTable.update(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> receiveTaskStatusAcs(String string) {
|
||||
JSONArray array = JSONArray.parseArray(string);
|
||||
//返回处理失败的任务
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject row = array.getJSONObject(i);
|
||||
String task_id = row.getString("ext_task_uuid");
|
||||
row.put("task_id",task_id);
|
||||
TaskDto taskDto = taskService.findById(task_id);
|
||||
String processing_class = taskDto.getHandle_class();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
String acs_task_status = row.getString("task_status");
|
||||
String message = "";
|
||||
String status = "";
|
||||
if ("1".equals(acs_task_status)) {
|
||||
status = TaskStatusEnum.EXECUTING.getCode();
|
||||
}
|
||||
if ("2".equals(acs_task_status)) {
|
||||
status = TaskStatusEnum.FINISHED.getCode();
|
||||
}
|
||||
// 任务处理类
|
||||
try {
|
||||
Class<?> clz = Class.forName(processing_class);
|
||||
Object obj = clz.newInstance();
|
||||
// 调用每个任务类的forceFinishInst()强制结束方法
|
||||
Method m = obj.getClass().getDeclaredMethod("updateTaskStatus", JSONObject.class, String.class);
|
||||
m.invoke(obj, row, status);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
//空指针
|
||||
if (ObjectUtil.isNull(e.getTargetException().getMessage())) {
|
||||
message = e.getTargetException().toString();
|
||||
} else {
|
||||
message = e.getTargetException().getMessage();
|
||||
}
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = e.getMessage();
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "任务状态反馈成功!");
|
||||
result.put("data", new JSONObject());
|
||||
result.put("errArr", errArr);
|
||||
return result;
|
||||
}
|
||||
|
||||
private JSONObject getProduceInfoByCode(String code) {
|
||||
//根据 设备点位去找生产任务信息
|
||||
//1 根据点位去找设备,去找对应的设备信息
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
package org.nl.wms.pda.callEmpty.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.pda.callEmpty.service.CallEmptyService;
|
||||
import org.nl.wms.pda.sendMaterial.service.SendMaterialService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.nl.wms.pda.callMaterial.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -7,17 +10,25 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.pda.callMaterial.service.CallMaterialService;
|
||||
import org.nl.wms.pda.exception.PdaRequestException;
|
||||
import org.nl.wms.sch.manage.AreaEnum;
|
||||
import org.nl.wms.sch.manage.buss.CallEmptyVehicleTask;
|
||||
import org.nl.wms.sch.manage.buss.CallMaterialTask;
|
||||
import org.nl.wms.sch.manage.buss.DumpTask;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.security.Security;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@@ -28,7 +39,7 @@ public class CallMaterialServiceImpl implements CallMaterialService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryPoint(Map<String, String> jsonObject) {
|
||||
//只查人工处理位
|
||||
//只查人工处理位 跟压机上料位置05空出来的位置
|
||||
JSONArray pointArr = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "16").process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
@@ -45,19 +56,93 @@ public class CallMaterialServiceImpl implements CallMaterialService {
|
||||
if (StrUtil.isEmpty(is_full)) {
|
||||
throw new PdaRequestException("是否满拖不能为空!");
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//叫料出库
|
||||
jsonObject.put("next_point_code", next_point_code);
|
||||
jsonObject.put("create_mode", "03");
|
||||
//批次 物料,客户要从排产单里面去取
|
||||
jsonObject.put("pcsn", "pcsn");
|
||||
JSONObject produceInfoByCode = this.getProduceInfoByCode(next_point_code);
|
||||
jsonObject.put("material_id", produceInfoByCode.getString("material_id"));
|
||||
jsonObject.put("cust_id", produceInfoByCode.getString("cust_id"));
|
||||
jsonObject.put("stewing_time", produceInfoByCode.getString("stewing_time"));
|
||||
jsonObject.put("producetask_id", produceInfoByCode.getString("producetask_id"));
|
||||
jsonObject.put("is_full", is_full);
|
||||
callMaterialTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
//假如是压机上料位,则走转储的功能
|
||||
WQLObject point_Table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject pointObj = point_Table.query("point_code='" + next_point_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(pointObj)) {
|
||||
throw new BadRequestException("未找到点位编码为" + next_point_code + "'的信息!");
|
||||
}
|
||||
String point_type = pointObj.getString("point_type");
|
||||
//如果是压机上料位置则走转储的流程
|
||||
if (StrUtil.equals(point_type, "05")) {
|
||||
//查询当前压机对应的排产单的物料信息是
|
||||
JSONObject TaskObj = WQLObject.getWQLObject("PDM_MG_produceTask").query("device_id='" + pointObj.getString("device_id") + "' and producetask_status in ('02','03','04') and is_delete='0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(TaskObj)) {
|
||||
throw new BadRequestException("未找到该点位设备的工单信息!");
|
||||
}
|
||||
String material_id = TaskObj.getString("material_id");
|
||||
String startArea_type = AreaEnum.KLHJ.getCode();
|
||||
JSONObject param1 = new JSONObject();
|
||||
param1.put("material_id", material_id);
|
||||
param1.put("area_type", startArea_type);
|
||||
param1.put("workprocedure_id", WorkProcedureEnum.HNGX.getId());
|
||||
param1.put("is_full", is_full);
|
||||
JSONObject outStructObj = StructFindUtil.getOutStruct(param1);
|
||||
if (ObjectUtil.isEmpty(outStructObj)) {
|
||||
throw new BadRequestException("未找到合适的出库仓位!");
|
||||
}
|
||||
String qty = outStructObj.getString("canuse_qty");
|
||||
String qty_unit_id = outStructObj.getString("qty_unit_id");
|
||||
|
||||
String start_point_code = outStructObj.getString("struct_code");
|
||||
String vehicle_code = outStructObj.getString("vehicle_code");
|
||||
//创建转储单据
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextIdStr();
|
||||
String task_code = CodeUtil.getNewCode("TASK_CODE");
|
||||
JSONObject dump = new JSONObject();
|
||||
dump.put("dumpinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dump.put("bill_code", CodeUtil.getNewCode("ZC_BILL_CODE"));
|
||||
dump.put("bill_status", "01");
|
||||
dump.put("turnout_struct_id", outStructObj.getString("struct_id"));
|
||||
dump.put("turnout_struct_code", outStructObj.getString("struct_code"));
|
||||
dump.put("turnout_struct_name", outStructObj.getString("struct_name"));
|
||||
dump.put("turnin_struct_id", pointObj.getString("point_id"));
|
||||
dump.put("turnin_struct_code", pointObj.getString("point_code"));
|
||||
dump.put("turnin_struct_name", pointObj.getString("point_name"));
|
||||
dump.put("workprocedure_id", outStructObj.getString("workprocedure_id"));
|
||||
dump.put("material_id", outStructObj.getString("material_id"));
|
||||
dump.put("task_id", task_id);
|
||||
dump.put("task_code", task_code);
|
||||
dump.put("pcsn", outStructObj.getString("pcsn"));
|
||||
dump.put("qty_unit_id", outStructObj.getString("qty_unit_id"));
|
||||
dump.put("qty", outStructObj.getString("canuse_qty"));
|
||||
dump.put("vehicle_code", outStructObj.getString("vehicle_code"));
|
||||
dump.put("is_active", "1");
|
||||
dump.put("is_delete", "0");
|
||||
dump.put("create_by", SecurityUtils.getCurrentUserId());
|
||||
dump.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("st_buss_dumpinv").insert(dump);
|
||||
DumpTask task = new DumpTask();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", task_id);
|
||||
jo.put("start_point_code", start_point_code);
|
||||
jo.put("next_point_code", next_point_code);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
task.createTask(jo);
|
||||
//锁定起点跟终点
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONObject outpoint = point_table.query("point_code='" + outStructObj.getString("struct_code") + "'").uniqueResult(0);
|
||||
outpoint.put("lock_type", "01");
|
||||
JSONObject inpoint = point_table.query("point_code='" + pointObj.getString("point_code") + "'").uniqueResult(0);
|
||||
inpoint.put("lock_type", "01");
|
||||
point_table.update(outpoint);
|
||||
|
||||
} else {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
//叫料出库
|
||||
jsonObject.put("next_point_code", next_point_code);
|
||||
jsonObject.put("create_mode", "03");
|
||||
//批次 物料,客户要从排产单里面去取
|
||||
jsonObject.put("pcsn", "pcsn");
|
||||
JSONObject produceInfoByCode = this.getProduceInfoByCode(next_point_code);
|
||||
jsonObject.put("material_id", produceInfoByCode.getString("material_id"));
|
||||
jsonObject.put("cust_id", produceInfoByCode.getString("cust_id"));
|
||||
jsonObject.put("stewing_time", produceInfoByCode.getString("stewing_time"));
|
||||
jsonObject.put("producetask_id", produceInfoByCode.getString("producetask_id"));
|
||||
jsonObject.put("is_full", is_full);
|
||||
callMaterialTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
|
||||
@@ -486,6 +486,22 @@
|
||||
sch_base_point point
|
||||
WHERE
|
||||
point_name LIKE '人工处理位%'
|
||||
or point_type='05'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "17"
|
||||
QUERY
|
||||
SELECT
|
||||
point.point_id,
|
||||
point.point_code,
|
||||
point.point_name
|
||||
FROM
|
||||
sch_base_point point
|
||||
WHERE
|
||||
area_type ='01'
|
||||
and point_type in ('03','05')
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
package org.nl.wms.pda.pressout.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.wms.pda.pressout.service.PressurelOutService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-07-26
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持盘点单接口管理")
|
||||
@RequestMapping("/api/pda")
|
||||
@Slf4j
|
||||
public class PressOutController {
|
||||
|
||||
private final PressurelOutService pdaService;
|
||||
|
||||
@PostMapping("/pressure/queryPoint")
|
||||
@Log("查询压制机上料位置的点位")
|
||||
@ApiOperation("查询压制机上料位置的点位")
|
||||
public ResponseEntity<Object> queryPoint(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaService.queryPoint(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/pressure/confirm")
|
||||
@Log("发送出库请求确认")
|
||||
@ApiOperation("发送出库请求确认")
|
||||
public ResponseEntity<Object> bussConfirm(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaService.bussConfirm(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.pda.pressout.service;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PressurelOutService {
|
||||
Map<String, Object> queryPoint(Map<String,String> jsonObject);
|
||||
/**
|
||||
* 任务请求确认
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> bussConfirm(@RequestBody Map<String, String> param);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package org.nl.wms.pda.pressout.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.common.StructFindUtil;
|
||||
import org.nl.wms.pda.exception.PdaRequestException;
|
||||
import org.nl.wms.pda.pressout.service.PressurelOutService;
|
||||
import org.nl.wms.sch.manage.AreaEnum;
|
||||
import org.nl.wms.sch.manage.BillTypeEnum;
|
||||
import org.nl.wms.sch.manage.buss.CallMaterialTask;
|
||||
import org.nl.wms.sch.manage.buss.DumpTask;
|
||||
import org.nl.wms.st.ivt.IvtChangeTypeEnum;
|
||||
import org.nl.wms.st.ivt.StoreIvtServiceImpl;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PressureOutServiceImpl implements PressurelOutService {
|
||||
private final CallMaterialTask callMaterialTask;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryPoint(Map<String, String> jsonObject) {
|
||||
//只查人工处理位 跟压机上料位置05空出来的位置
|
||||
JSONArray pointArr = WQL.getWO("QPADSTSETSERVICE").addParam("flag", "17").process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", pointArr);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Map<String, Object> bussConfirm(@RequestBody Map<String, String> param) {
|
||||
String point_code = param.get("point_code");
|
||||
String point_id = param.get("point_id");
|
||||
if (StrUtil.isEmpty(point_id)) {
|
||||
throw new BadRequestException("请选择一个点位");
|
||||
}
|
||||
WQLObject ivt_Table = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
//查询改点位有没有库存
|
||||
JSONObject ivtObj = ivt_Table.query("struct_id = '" + point_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtObj)) {
|
||||
throw new BadRequestException("点位为'" + point_code + "' 未找到库存,不能进行出库操作!");
|
||||
}
|
||||
//创建出库单据
|
||||
JSONObject iosObj = new JSONObject();
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
iosObj.put("iostorinv_id", iostorinv_id);
|
||||
iosObj.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
iosObj.put("io_type", "1");
|
||||
iosObj.put("bill_type", BillTypeEnum.YZCK.getCode());
|
||||
iosObj.put("workprocedure_id", WorkProcedureEnum.YZGX.getId());
|
||||
iosObj.put("ivt_workprocedure_id", ivtObj.getString("workprocedure_id"));
|
||||
iosObj.put("material_id", ivtObj.getString("material_id"));
|
||||
iosObj.put("vehicle_code", ivtObj.getString("vehicle_code"));
|
||||
iosObj.put("qty", ivtObj.getString("canuse_qty"));
|
||||
iosObj.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
//默认是分配状态
|
||||
iosObj.put("bill_status", "50");
|
||||
iosObj.put("start_point_code", point_code);
|
||||
iosObj.put("end_point_code", "");
|
||||
iosObj.put("start_area", AreaEnum.KLHJ);
|
||||
iosObj.put("end_area", "");
|
||||
iosObj.put("cust_id", "");
|
||||
iosObj.put("create_mode", "03");
|
||||
iosObj.put("task_id", "");
|
||||
iosObj.put("pcsn", ivtObj.getString("pcsn"));
|
||||
iosObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
iosObj.put("create_name", SecurityUtils.getNickName());
|
||||
iosObj.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").insert(iosObj);
|
||||
//扣除库存
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("material_id", ivtObj.getString("material_id"));
|
||||
jo.put("bill_id", iostorinv_id);
|
||||
jo.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
jo.put("pcsn", ivtObj.getString("pcsn"));
|
||||
jo.put("change_qty", ivtObj.getString("canuse_qty"));
|
||||
jo.put("vehicle_code", ivtObj.getString("vehicle_code"));
|
||||
jo.put("workprocedure_id", ivtObj.getString("workprocedure_id"));
|
||||
jo.put("struct_id", point_id);
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
ivtService.addIvtFlow(jo, IvtChangeTypeEnum.SUB_IVT_AND_CAN_USE);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nl.wms.pda.sendMaterial.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -10,20 +8,14 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.service.UserService;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.database.service.MaterialService;
|
||||
import org.nl.wms.pda.sendMaterial.service.SendMaterialService;
|
||||
import org.nl.wms.pda.exception.PdaRequestException;
|
||||
import org.nl.wms.pda.sendMaterial.service.SendMaterialService;
|
||||
import org.nl.wms.sch.manage.buss.SendMaterialTask;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
|
||||
@@ -276,7 +276,7 @@ public class ProducetaskServiceImpl implements ProducetaskService {
|
||||
String producetask_id = param.getString("producetask_id");
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_mg_producetask");
|
||||
JSONObject taskObj= WQL.getWO("PDM_ProduceTask_01").addParam("flag", "3").addParam("producetask_id", producetask_id).process().uniqueResult(0);
|
||||
|
||||
taskObj.put("product_code","wms");
|
||||
WmsToAcsService wmsToAcsService = SpringContextHolder.getBean(WmsToAcsService.class);
|
||||
JSONArray arr = new JSONArray();
|
||||
arr.add(taskObj);
|
||||
|
||||
@@ -109,6 +109,8 @@
|
||||
QUERY
|
||||
SELECT
|
||||
task.*,
|
||||
cust.cust_code,
|
||||
cust.cust_name,
|
||||
device.device_code,
|
||||
device.device_name,
|
||||
material.material_code,
|
||||
@@ -119,8 +121,9 @@
|
||||
pdm_mg_producetask task
|
||||
LEFT JOIN pdm_base_device device ON task.device_id = device.device_id
|
||||
LEFT JOIN md_me_material material ON material.material_id = task.material_id
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_id = task.cust_id
|
||||
WHERE
|
||||
1=1
|
||||
1 =1
|
||||
OPTION 输入.producetask_id <> ""
|
||||
(task.producetask_id = 输入.producetask_id)
|
||||
ENDOPTION
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class AbstractAcsTask {
|
||||
for (int i = 0, j = tasks.size(); i < j; i++) {
|
||||
JSONObject json = tasks.getJSONObject(i);
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setTask_id(json.getString("task_id"));
|
||||
taskDto.setExt_task_uuid(json.getString("task_id"));
|
||||
taskDto.setTask_code(json.getString("task_code"));
|
||||
taskDto.setTask_type("1");
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractAcsTask {
|
||||
for (int i = 0, j = arr.size(); i < j; i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setTask_id(json.getString("task_id"));
|
||||
taskDto.setExt_task_uuid(json.getString("task_id"));
|
||||
taskDto.setTask_code(json.getString("task_code"));
|
||||
taskDto.setTask_type("1");
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.nl.wms.sch.manage;
|
||||
*/
|
||||
public enum AreaEnum {
|
||||
KLHJ("01", "困料货架"),
|
||||
CYHJ("02", "出窑货架()"),
|
||||
CYHJ("02", "入窑暂存"),
|
||||
CYZC("03", "出窑暂存区"),
|
||||
BZZC("04", "包装暂存区"),
|
||||
HNQY("21", "混碾区域"),
|
||||
@@ -15,7 +15,9 @@ public enum AreaEnum {
|
||||
YYJLZ("23", "液压机料盅架"),
|
||||
YQU("24", "窑区域"),
|
||||
KGTDDQ("25", "空钢托堆叠区"),
|
||||
ZDCDX("26", "自动柴垛线");
|
||||
ZDCDX("26", "自动柴垛线"),
|
||||
RGCPQ("26", "人工拆盘区域"),
|
||||
BZQ("26", "包装区");
|
||||
|
||||
private final String name;
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package org.nl.wms.sch.manage.buss;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 入库任务生成
|
||||
*/
|
||||
public class DumpTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = DumpTask.class.getName();
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
*改变任务状态
|
||||
**/
|
||||
String task_id = taskObj.getString("task_id");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
//更新转储表的状态 02
|
||||
JSONObject dumpObj = WQLObject.getWQLObject("st_buss_dumpinv").query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(dumpObj)) {
|
||||
dumpObj.put("bill_status", "02");
|
||||
}
|
||||
WQLObject.getWQLObject("st_buss_dumpinv").update(dumpObj);
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
//更新转储单的状态
|
||||
JSONObject dumpObj = WQLObject.getWQLObject("st_buss_dumpinv").query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(dumpObj)) {
|
||||
dumpObj.put("bill_status", "03");
|
||||
}
|
||||
WQLObject.getWQLObject("st_buss_dumpinv").update(dumpObj);
|
||||
//解锁
|
||||
WQLObject pointTable = WQLObject.getWQLObject("sch_base_point");
|
||||
String start_point_code = jsonTask.getString("start_point_code");
|
||||
String next_point_code = jsonTask.getString("next_point_code");
|
||||
JSONObject outPointObj = pointTable.query("point_code ='" + start_point_code + "'").uniqueResult(0);
|
||||
JSONObject InPointObj = pointTable.query("point_code ='" + next_point_code + "'").uniqueResult(0);
|
||||
InPointObj.put("lock_type", "00");
|
||||
InPointObj.put("point_status", "02");
|
||||
InPointObj.put("vehicle_code", outPointObj.getString("vehicle_code"));
|
||||
|
||||
outPointObj.put("lock_type", "00");
|
||||
outPointObj.put("point_status", "00");
|
||||
outPointObj.put("vehicle_code", "");
|
||||
|
||||
|
||||
pointTable.update(outPointObj);
|
||||
pointTable.update(InPointObj);
|
||||
//更新库存信息
|
||||
WQLObject ivtTable = WQLObject.getWQLObject("st_ivt_structIvt");
|
||||
JSONObject ivtObj = ivtTable.query("struct_id='" + outPointObj.getString("point_id") + "'").uniqueResult(0);
|
||||
ivtObj.put("struct_id", InPointObj.getString("point_id"));
|
||||
ivtTable.update(ivtObj);
|
||||
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createTask(JSONObject form) {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
//申请任务的时候ACS会传任务标识
|
||||
if (StrUtil.isNotEmpty(form.getString("task_id"))) {
|
||||
taskObj.put("task_id", form.getString("task_id"));
|
||||
} else {
|
||||
taskObj.put("task_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
}
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "04");
|
||||
String task_status = TaskStatusEnum.START_AND_POINT.getCode();
|
||||
taskObj.put("task_status", task_status);
|
||||
taskObj.put("start_point_code", form.getString("start_point_code"));
|
||||
taskObj.put("next_point_code", form.getString("next_point_code"));
|
||||
taskObj.put("vehicle_code", form.getString("vehicle_code"));
|
||||
taskObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("create_time", DateUtil.now());
|
||||
taskObj.put("handle_class", THIS_CLASS);
|
||||
//任务基础表【sch_base_task】
|
||||
WQLObject.getWQLObject("sch_base_task").insert(taskObj);
|
||||
return taskObj.getString("task_id");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
if (StrUtil.isEmpty(task_id)) {
|
||||
throw new BadRequestException("任务id不能为空!");
|
||||
}
|
||||
JSONObject taskjo = WQLObject.getWQLObject("sch_base_task").query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
taskjo.getString("taskfinish_mode");
|
||||
this.updateTaskStatus(taskjo, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AcsTaskDto {
|
||||
//任务标识
|
||||
private String task_id;
|
||||
private String ext_task_uuid;
|
||||
//任务编码
|
||||
private String task_code;
|
||||
//任务类型
|
||||
|
||||
@@ -90,7 +90,7 @@ public class AutoCreateTask {
|
||||
if ("200".equals(status)) {
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_id", item.getExt_task_uuid());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发成功");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
@@ -99,7 +99,7 @@ public class AutoCreateTask {
|
||||
} else {//下发失败
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_id", item.getExt_task_uuid());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发失败:" + message);
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/*
|
||||
package org.nl.wms.sch.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -20,18 +21,22 @@ import org.nl.wms.st.ivt.StoreIvtServiceImpl;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
*/
|
||||
/**
|
||||
* 入库任务生成
|
||||
*/
|
||||
*//*
|
||||
|
||||
public class InTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = InTask.class.getName();
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
*/
|
||||
/**
|
||||
*改变任务状态
|
||||
**/
|
||||
**//*
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
@@ -152,12 +157,14 @@ public class InTask extends AbstractAcsTask {
|
||||
param.put("area_type", jsonTask.getString("buss_area_type"));
|
||||
param.put("height", disarr.getJSONObject(0).getString("height"));
|
||||
JSONObject structObj = new JSONObject();
|
||||
/* JSONArray structarr = StructFindUtil.getInStruct(param);
|
||||
*/
|
||||
/* JSONArray structarr = StructFindUtil.getInStruct(param);
|
||||
if (ObjectUtil.isEmpty(structarr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
structObj = structarr.getJSONObject(0);*/
|
||||
structObj = structarr.getJSONObject(0);*//*
|
||||
|
||||
String struct_code = structObj.getString("struct_code");
|
||||
|
||||
String bill_uuid = "";
|
||||
@@ -259,3 +266,4 @@ public class InTask extends AbstractAcsTask {
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -43,28 +43,37 @@
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
view_struct.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
structrelamaterial.*,
|
||||
struct.struct_code,
|
||||
struct.struct_name,
|
||||
sect.sect_name,
|
||||
stor.stor_name
|
||||
FROM
|
||||
st_ivt_structrelamaterial structrelamaterial
|
||||
LEFT JOIN st_ivt_structattr struct ON structrelamaterial.struct_id = struct.struct_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON struct.sect_id = sect.sect_id
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON struct.stor_id = stor.stor_id
|
||||
WHERE
|
||||
structrelamaterial.is_delete = '0'
|
||||
GROUP BY
|
||||
structrelamaterial.struct_id
|
||||
) view_struct
|
||||
where
|
||||
1 = 1
|
||||
SELECT
|
||||
view_struct.*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
any_value ( structrelamaterial.relation_id ) AS relation_id,
|
||||
any_value ( structrelamaterial.struct_id ) AS struct_id,
|
||||
any_value ( structrelamaterial.material_id ) AS material_id,
|
||||
any_value ( structrelamaterial.create_id ) AS create_id,
|
||||
any_value ( structrelamaterial.create_name ) AS create_name,
|
||||
any_value ( structrelamaterial.create_time ) AS create_time,
|
||||
any_value ( structrelamaterial.update_optid ) AS update_optid,
|
||||
any_value ( structrelamaterial.update_optname ) AS update_optname,
|
||||
any_value ( structrelamaterial.update_time ) AS update_time,
|
||||
any_value ( structrelamaterial.is_delete ) AS is_delete,
|
||||
any_value ( struct.struct_code ) AS struct_code,
|
||||
any_value ( struct.struct_name ) AS struct_name,
|
||||
any_value ( sect.sect_name ) AS sect_name,
|
||||
any_value ( stor.stor_name ) AS stor_name
|
||||
FROM
|
||||
st_ivt_structrelamaterial structrelamaterial
|
||||
LEFT JOIN st_ivt_structattr struct ON structrelamaterial.struct_id = struct.struct_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON struct.sect_id = sect.sect_id
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON struct.stor_id = stor.stor_id
|
||||
WHERE
|
||||
structrelamaterial.is_delete = '0'
|
||||
GROUP BY
|
||||
structrelamaterial.struct_id
|
||||
) view_struct
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.search <> ""
|
||||
(view_struct.struct_code like 输入.search or
|
||||
view_struct.struct_name like 输入.search)
|
||||
|
||||
@@ -54,26 +54,28 @@
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
vehicleType.struct_id,
|
||||
vehicleType.create_id,
|
||||
vehicleType.create_name,
|
||||
vehicleType.create_time,
|
||||
vehicleType.update_optname,
|
||||
vehicleType.update_time,
|
||||
GROUP_CONCAT(vehicleType.vehicle_type) as vehicle_type,
|
||||
struct.struct_name,
|
||||
struct.struct_code
|
||||
FROM
|
||||
ST_IVT_StructRelaVehicleType vehicleType
|
||||
LEFT JOIN st_ivt_structattr struct ON vehicleType.struct_id = struct.struct_id
|
||||
GROUP BY vehicleType.struct_id) AS view_vehicleType
|
||||
WHERE
|
||||
1 = 1
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
any_value ( vehicleType.struct_id ) AS struct_id,
|
||||
any_value ( vehicleType.create_id ) AS create_id,
|
||||
any_value ( vehicleType.create_name ) AS create_name,
|
||||
any_value ( vehicleType.create_time ) AS create_time,
|
||||
any_value ( vehicleType.update_optname ) AS update_optname,
|
||||
any_value ( struct.struct_code ) AS struct_code,
|
||||
any_value ( vehicleType.update_time ) AS update_time,
|
||||
any_value ( struct.struct_name ) AS struct_name,
|
||||
any_value ( GROUP_CONCAT( vehicleType.vehicle_type ) ) AS vehicle_type
|
||||
FROM
|
||||
ST_IVT_StructRelaVehicleType vehicleType
|
||||
LEFT JOIN st_ivt_structattr struct ON vehicleType.struct_id = struct.struct_id
|
||||
GROUP BY
|
||||
vehicleType.struct_id
|
||||
) AS view_vehicleType
|
||||
WHERE
|
||||
1 = 1
|
||||
OPTION 输入.search <> ""
|
||||
(view_vehicleType.struct_code like 输入.search or
|
||||
view_vehicleType.struct_name like 输入.search)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user