18188916393
2 years ago
32 changed files with 1653 additions and 89 deletions
@ -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 |
|||
|
|||
|
@ -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; |
|||
} |
|||
|
|||
} |
@ -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) { |
|||
|
|||
} |
|||
} |
Binary file not shown.
Loading…
Reference in new issue