add:半成品移库功能
This commit is contained in:
@@ -26,6 +26,7 @@ public class StructarrQuery extends BaseQuery<StIvtStructattr> {
|
||||
private String lock_type;
|
||||
private Boolean is_used;
|
||||
private Boolean emptyvehicle;
|
||||
private Boolean is_emptyvehicle;
|
||||
private String blurry;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -141,6 +141,16 @@ public class StIvtMoveinvCpServiceImpl extends ServiceImpl<StIvtMoveinvCpMapper,
|
||||
if (lockInStructList.size()!=lockOutStructList.size()){
|
||||
throw new BadRequestException("不允许选择相同货位进行分配");
|
||||
}
|
||||
lockInStructList.addAll(lockOutStructList);
|
||||
//校验点位有没有锁定
|
||||
List<StIvtStructattr> list = structattrService.list(new QueryWrapper<StIvtStructattr>()
|
||||
.in("struct_code", lockInStructList)
|
||||
.nested(i -> i.eq("is_used", false)
|
||||
.or()
|
||||
.gt("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))));
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException("选择点位已经锁定禁用:"+list.stream().map(StIvtStructattr::getStruct_code).collect(Collectors.joining(",")));
|
||||
}
|
||||
this.save(mst);
|
||||
moveinvdtlCpService.saveBatch(itemList);
|
||||
lockInStructList.addAll(lockOutStructList);
|
||||
|
||||
@@ -4,6 +4,7 @@ package org.nl.wms.storage_manage.rawmanage.controller.structIvt;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.device_manage.ios.service.structIvt.dto.StructIvtEmQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -57,6 +58,14 @@ public class StIvtStructivtYlController {
|
||||
return new ResponseEntity<>(structivtYlService.getSemiProductIvt(query), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getSemiProductIvt2")
|
||||
@Log("查询可用的半成品库存")
|
||||
//("查询可用的半成品库存")
|
||||
public ResponseEntity<Object> getSemiProductIvt2(StructIvtYLQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(structivtYlService.getSemiProductIvt(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getAllRawIvt")
|
||||
@Log("查询原料库存")
|
||||
//("查询原料库存")
|
||||
|
||||
@@ -40,4 +40,6 @@ public interface IStIvtStructivtYlService extends IService<StIvtStructivtYl> {
|
||||
|
||||
|
||||
Object getSemiProductIvt(StructIvtYLQuery query);
|
||||
|
||||
Object getSemiProductIvt(StructIvtYLQuery query,PageQuery page);
|
||||
}
|
||||
|
||||
@@ -60,4 +60,13 @@ public class StIvtStructivtYlServiceImpl extends ServiceImpl<StIvtStructivtYlMap
|
||||
public Object getSemiProductIvt(StructIvtYLQuery query) {
|
||||
return this.baseMapper.getSemiProductIvt(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSemiProductIvt(StructIvtYLQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = this.baseMapper.getSemiProductIvt(query);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvCpSe
|
||||
import org.nl.wms.storage_manage.semimanage.service.check.IStIvtCheckmstBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.iostorInv.IStIvtIostorinvBcpOutService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.iostorInv.IStIvtIostorinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.IStIvtShutframeinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.check.IStIvtCheckmstHrBcpService;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.iostorInv.IStIvtIostorinvEmpBcpService;
|
||||
@@ -71,6 +72,11 @@ public enum TASKEnum implements FunctionStrategy<String, JSONObject> {
|
||||
IStIvtMoveinvCpService bean = SpringContextHolder.getBean(IStIvtMoveinvCpService.class);
|
||||
bean.taskOperate(form);
|
||||
}),
|
||||
BCP_MOVE_TASK(type -> AcsTaskEnum.TASK_STRUCT_BCP_MOVE.getCode().equals(type), form -> {
|
||||
IStIvtMoveinvBcpService bean = SpringContextHolder.getBean(IStIvtMoveinvBcpService.class);
|
||||
bean.taskOperate(form);
|
||||
}),
|
||||
|
||||
POINT_FINISH_TASK(type -> AcsTaskEnum.TASK_WASH_FULL_QZ.getCode().equals(type), form -> {
|
||||
ISchBasePointService bean = SpringContextHolder.getBean(ISchBasePointService.class);
|
||||
bean.taskOperate(form);
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package org.nl.wms.storage_manage.semimanage.controller.moveInv;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvdtlCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dto.MoveInvQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvdtlBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dto.MoveInvBcpQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -14,8 +27,49 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtMoveinvBcp")
|
||||
@RequestMapping("/api/stIvtMoveinvBcp")
|
||||
public class StIvtMoveinvBcpController {
|
||||
@Autowired
|
||||
private IStIvtMoveinvBcpService moveinvbcpService;
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlBcpService moveinvdtlbcpService;
|
||||
|
||||
|
||||
@GetMapping
|
||||
@Log("查询移库主表")
|
||||
//("查询盘点单主表")
|
||||
public ResponseEntity<Object> query(MoveInvBcpQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(moveinvbcpService.page(page.build(StIvtMoveinvBcp.class),query.build())), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("创建移库单")
|
||||
//("创建盘点单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
moveinvbcpService.create(whereJson);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getMoveDtl")
|
||||
@Log("查询盘点明细")
|
||||
//("查询盘点明细")
|
||||
public ResponseEntity<Object> getCheckDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(moveinvdtlbcpService.listJoinTask(whereJson.getString("moveinv_id"))), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/update")
|
||||
@Log("更新单据")
|
||||
//("查询盘点明细")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
moveinvbcpService.update(whereJson);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/cancel")
|
||||
@Log("取消单据")
|
||||
//("查询盘点明细")
|
||||
public ResponseEntity<Object> cancel(@RequestBody JSONObject whereJson) {
|
||||
moveinvbcpService.cancel(whereJson);
|
||||
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package org.nl.wms.storage_manage.semimanage.controller.moveInv;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvdtlCpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvdtlBcpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -14,8 +18,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtMoveinvdtlBcp")
|
||||
@RequestMapping("/api/stIvtMoveinvdtlBcp")
|
||||
public class StIvtMoveinvdtlBcpController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlBcpService moveinvdtlbcpService;
|
||||
|
||||
@PostMapping("/task/{option}")
|
||||
public ResponseEntity<Object> optionTask(@RequestBody JSONObject form, @PathVariable String option){
|
||||
moveinvdtlbcpService.taskOption(form,option);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ public class StIvtIostorinvBcpOutServiceImpl extends ServiceImpl<StIvtIostorinvB
|
||||
param.put("result_qty", 0);
|
||||
param.put("bill_code","");
|
||||
param.put("inv_id","");
|
||||
param.put("bill_type_scode","");
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("出库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
|
||||
@@ -237,7 +237,7 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
|
||||
param.put("result_qty", ivtDao.getCanuse_qty());
|
||||
param.put("bill_code","");
|
||||
param.put("inv_id","");
|
||||
param.put("bill_type_scode","");
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("入库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
@@ -290,7 +290,7 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
|
||||
param.put("result_qty", ivtDao.getCanuse_qty());
|
||||
param.put("bill_code",mst.getBill_code());
|
||||
param.put("inv_id",mst.getIostorinv_id());
|
||||
param.put("bill_type_scode",mst.getBill_type());
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("入库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
|
||||
//维护载具
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvBcp;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -12,5 +13,23 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface IStIvtMoveinvBcpService extends IService<StIvtMoveinvBcp> {
|
||||
/**
|
||||
* 新增
|
||||
* @param form
|
||||
*/
|
||||
void create(JSONObject form);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param form
|
||||
*/
|
||||
void update(JSONObject form);
|
||||
|
||||
void cancel(JSONObject form);
|
||||
|
||||
/**
|
||||
* 任务回调处理
|
||||
* @param form
|
||||
*/
|
||||
void taskOperate(JSONObject form);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvdtlBcp;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 移库单明细表 服务类
|
||||
@@ -12,5 +16,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface IStIvtMoveinvdtlBcpService extends IService<StIvtMoveinvdtlBcp> {
|
||||
List<Map> listJoinTask(String moveinv_id);
|
||||
|
||||
void taskOption(JSONObject form, String option);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
@@ -25,6 +27,7 @@ public class StIvtMoveinvBcp implements Serializable {
|
||||
/**
|
||||
* 移库单标识
|
||||
*/
|
||||
@TableId(value = "moveinv_id")
|
||||
private String moveinv_id;
|
||||
|
||||
/**
|
||||
@@ -70,7 +73,7 @@ public class StIvtMoveinvBcp implements Serializable {
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal detail_count;
|
||||
private Integer dtl_count;
|
||||
|
||||
/**
|
||||
* 单据状态
|
||||
@@ -90,52 +93,32 @@ public class StIvtMoveinvBcp implements Serializable {
|
||||
/**
|
||||
* 制单人
|
||||
*/
|
||||
private String input_optid;
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 制单人姓名
|
||||
*/
|
||||
private String input_optname;
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 制单时间
|
||||
*/
|
||||
private Date input_time;
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
private String update_id;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
private String update_name;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date update_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private String confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private Date confirm_time;
|
||||
|
||||
/**
|
||||
* 确认说明
|
||||
*/
|
||||
private String confirm_info;
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
@@ -24,6 +26,7 @@ public class StIvtMoveinvdtlBcp implements Serializable {
|
||||
/**
|
||||
* 移库单明细标识
|
||||
*/
|
||||
@TableId(value = "moveinvdtl_id")
|
||||
private String moveinvdtl_id;
|
||||
|
||||
/**
|
||||
@@ -34,7 +37,7 @@ public class StIvtMoveinvdtlBcp implements Serializable {
|
||||
/**
|
||||
* 明细序号
|
||||
*/
|
||||
private BigDecimal seq_no;
|
||||
private Integer seq_no;
|
||||
|
||||
/**
|
||||
* 转出库区标识
|
||||
@@ -70,6 +73,7 @@ public class StIvtMoveinvdtlBcp implements Serializable {
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
@@ -105,6 +109,10 @@ public class StIvtMoveinvdtlBcp implements Serializable {
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
private BigDecimal unit_weight;
|
||||
|
||||
/**
|
||||
* 转入库区标识
|
||||
@@ -139,7 +147,7 @@ public class StIvtMoveinvdtlBcp implements Serializable {
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private String work_status;
|
||||
private String bill_status;
|
||||
|
||||
/**
|
||||
* 任务标识
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.semimanage.service.moveInv.dao.mapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvdtlBcp;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 移库单明细表 Mapper 接口
|
||||
@@ -12,5 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface StIvtMoveinvdtlBcpMapper extends BaseMapper<StIvtMoveinvdtlBcp> {
|
||||
|
||||
List<Map> listJoinTask(String moveinv_id);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.storage_manage.semimanage.service.moveInv.dao.mapper.StIvtMoveinvdtlBcpMapper">
|
||||
|
||||
<select id="listJoinTask" resultType="java.util.Map">
|
||||
SELECT
|
||||
st_ivt_moveinvdtl_bcp.*,
|
||||
sch_base_task.task_code,
|
||||
sch_base_task.task_status
|
||||
FROM
|
||||
st_ivt_moveinvdtl_bcp
|
||||
LEFT JOIN sch_base_task ON st_ivt_moveinvdtl_bcp.task_id = sch_base_task.task_id
|
||||
where moveinv_id = #{moveinv_id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvCp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvBcp;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class MoveInvBcpQuery extends BaseQuery<StIvtMoveinvBcp> {
|
||||
|
||||
|
||||
private String stor_id;
|
||||
|
||||
private String bill_status;
|
||||
|
||||
private String bill_type;
|
||||
|
||||
private String bill_code;
|
||||
|
||||
private Boolean is_delete = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("bill_code", QParam.builder().k(new String[]{"bill_code"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,48 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
import org.nl.wms.storage_manage.IVTEnum;
|
||||
import org.nl.wms.storage_manage.MoveInvEnum;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.service.IStIvtStructivtflowService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvdtlCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.util.ChangeIvtUtil;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvdtlBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvdtlBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.mapper.StIvtMoveinvBcpMapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvBcpService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.storage_manage.semimanage.service.structIvt.IStIvtStructivtBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.StIvtStructivtBcp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,4 +55,337 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtMoveinvBcpServiceImpl extends ServiceImpl<StIvtMoveinvBcpMapper, StIvtMoveinvBcp> implements IStIvtMoveinvBcpService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoveinvdtlBcpService moveinvdtlCpService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtBcpService iStIvtStructivtBcpService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtflowService iStIvtStructivtflowService; // 库存变动服务
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(JSONObject form) {
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
// 调用主表 插入/更新方法
|
||||
StIvtMoveinvBcp mst = new StIvtMoveinvBcp();
|
||||
// 新增
|
||||
mst.setMoveinv_id(IdUtil.getStringId());
|
||||
mst.setBill_code(CodeUtil.getNewCode("BCP_MOVE_CODE"));
|
||||
mst.setBuss_type(form.getString("buss_type"));
|
||||
mst.setBill_type(form.getString("buss_type"));
|
||||
mst.setStor_id(form.getString("stor_id"));
|
||||
mst.setStor_name(form.getString("stor_name"));
|
||||
mst.setStor_code(form.getString("stor_code"));
|
||||
mst.setBiz_date(DateUtil.today());
|
||||
mst.setBill_status(MoveInvEnum.BILL_STATUS.code("生成"));
|
||||
mst.setDtl_count(form.getInteger("dtl_num"));
|
||||
mst.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setCreate_time(DateUtil.now());
|
||||
mst.setIs_delete(false);
|
||||
mst.setRemark(form.getString("remark"));
|
||||
//调用明细表 插入方法
|
||||
List<StIvtMoveinvdtlBcp> itemList = new ArrayList<>();
|
||||
Set<String> lockInStructList = new HashSet<>();
|
||||
Set<String> lockOutStructList = new HashSet<>();
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject item = rows.getJSONObject(i);
|
||||
if (StringUtils.isEmpty(item.getString("turnin_struct_id"))){
|
||||
throw new BadRequestException("移入货位没有配置齐全");
|
||||
}
|
||||
StIvtMoveinvdtlBcp moveinvdtlCp = new StIvtMoveinvdtlBcp();
|
||||
moveinvdtlCp.setMoveinv_id(mst.getMoveinv_id());
|
||||
moveinvdtlCp.setMoveinvdtl_id(IdUtil.getStringId());
|
||||
moveinvdtlCp.setSeq_no(i+1);
|
||||
moveinvdtlCp.setBill_status(mst.getBill_status());
|
||||
// moveinvdtlCp.setSource_billdtl_id(item.getString("sale_id"));
|
||||
moveinvdtlCp.setSource_bill_type(item.getString("bill_type"));
|
||||
material: {
|
||||
moveinvdtlCp.setIs_active(true);
|
||||
moveinvdtlCp.setIvt_level(IVTEnum.IVT_LEVEL.code("一级"));
|
||||
moveinvdtlCp.setIs_issued(true);
|
||||
moveinvdtlCp.setMaterial_id(item.getString("material_id"));
|
||||
moveinvdtlCp.setMaterial_code(item.getString("material_code"));
|
||||
moveinvdtlCp.setQty(item.getBigDecimal("canuse_qty"));
|
||||
moveinvdtlCp.setUnit_weight(item.getBigDecimal("unit_weight"));
|
||||
moveinvdtlCp.setPcsn(item.getString("pcsn"));
|
||||
moveinvdtlCp.setQty_unit_id(item.getString("qty_unit_id"));
|
||||
moveinvdtlCp.setQty_unit_name(item.getString("qty_unit_name"));
|
||||
moveinvdtlCp.setQuality_scode(item.getString("quality_scode"));
|
||||
moveinvdtlCp.setStoragevehicle_code(item.getString("storagevehicle_code"));
|
||||
}
|
||||
target: {
|
||||
moveinvdtlCp.setTurnin_sect_code(item.getString("sect_code"));
|
||||
moveinvdtlCp.setTurnin_sect_id(item.getString("sect_id"));
|
||||
moveinvdtlCp.setTurnin_sect_name(item.getString("sect_name"));
|
||||
moveinvdtlCp.setTurnin_struct_code(item.getString("turnin_struct_code"));
|
||||
moveinvdtlCp.setTurnin_struct_name(item.getString("turnin_struct_name"));
|
||||
moveinvdtlCp.setTurnin_struct_id(item.getString("turnin_struct_id"));
|
||||
}
|
||||
source:{
|
||||
moveinvdtlCp.setTurnout_sect_code(item.getString("sect_code"));
|
||||
moveinvdtlCp.setTurnout_sect_id(item.getString("sect_id"));
|
||||
moveinvdtlCp.setTurnout_sect_name(item.getString("sect_name"));
|
||||
moveinvdtlCp.setTurnout_struct_code(item.getString("struct_code"));
|
||||
moveinvdtlCp.setTurnout_struct_name(item.getString("struct_name"));
|
||||
moveinvdtlCp.setTurnout_struct_id(item.getString("struct_id"));
|
||||
}
|
||||
total.add(moveinvdtlCp.getQty());
|
||||
itemList.add(moveinvdtlCp);
|
||||
lockInStructList.add(moveinvdtlCp.getTurnin_struct_code());
|
||||
lockOutStructList.add(moveinvdtlCp.getTurnout_struct_code());
|
||||
}
|
||||
if (lockInStructList.size()!=lockOutStructList.size()){
|
||||
throw new BadRequestException("不允许选择相同货位进行分配");
|
||||
}
|
||||
lockInStructList.addAll(lockOutStructList);
|
||||
//校验点位有没有锁定
|
||||
List<StIvtStructattr> list = structattrService.list(new QueryWrapper<StIvtStructattr>()
|
||||
.in("struct_code", lockInStructList)
|
||||
.nested(i -> i.eq("is_used", false)
|
||||
.or()
|
||||
.gt("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))));
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException("选择点位已经锁定禁用:"+list.stream().map(StIvtStructattr::getStruct_code).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
mst.setTotal_qty(total);
|
||||
this.save(mst);
|
||||
moveinvdtlCpService.saveBatch(itemList);
|
||||
lockInStructList.addAll(lockOutStructList);
|
||||
structattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("移库锁"))
|
||||
.set(StIvtStructattr::getInv_code,mst.getBill_code())
|
||||
.in(StIvtStructattr::getStruct_code, lockInStructList)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(JSONObject form) {
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
List<StIvtMoveinvdtlBcp> dtlList = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlBcp>().eq("moveinv_id", form.getString("moveinv_id")));
|
||||
//调用明细表 插入方法
|
||||
Set<String> unLockStructList = new HashSet<>();
|
||||
for (StIvtMoveinvdtlBcp cp : dtlList) {
|
||||
unLockStructList.add(cp.getTurnin_struct_code());
|
||||
unLockStructList.add(cp.getTurnout_struct_code());
|
||||
}
|
||||
structattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(StIvtStructattr::getInv_code,"")
|
||||
.in(StIvtStructattr::getStruct_code, unLockStructList)
|
||||
);
|
||||
List<StIvtMoveinvdtlBcp> itemList = new ArrayList<>();
|
||||
Set<String> lockOutStructList = new HashSet<>();
|
||||
Set<String> lockInStructList = new HashSet<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject item = rows.getJSONObject(i);
|
||||
StIvtMoveinvdtlBcp moveinvdtlCp = JSONObject.parseObject(JSON.toJSONString(item), StIvtMoveinvdtlBcp.class);
|
||||
source:{
|
||||
moveinvdtlCp.setTurnout_struct_code(item.getString("struct_code"));
|
||||
moveinvdtlCp.setTurnout_struct_name(item.getString("struct_name"));
|
||||
moveinvdtlCp.setTurnout_struct_id(item.getString("struct_id"));
|
||||
}
|
||||
itemList.add(moveinvdtlCp);
|
||||
lockInStructList.add(moveinvdtlCp.getTurnin_struct_code());
|
||||
lockOutStructList.add(moveinvdtlCp.getTurnout_struct_code());
|
||||
}
|
||||
if (lockOutStructList.size()!=lockInStructList.size()){
|
||||
throw new BadRequestException("不允许选择相同货位进行分配");
|
||||
}
|
||||
lockInStructList.addAll(lockOutStructList);
|
||||
//校验点位有没有锁定
|
||||
List<StIvtStructattr> list = structattrService.list(new QueryWrapper<StIvtStructattr>()
|
||||
.in("struct_code", lockInStructList)
|
||||
.nested(i -> i.eq("is_used", false)
|
||||
.or()
|
||||
.gt("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))));
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
throw new BadRequestException("选择点位已经锁定禁用:"+list.stream().map(StIvtStructattr::getStruct_code).collect(Collectors.joining(",")));
|
||||
}
|
||||
moveinvdtlCpService.updateBatchById(itemList);
|
||||
structattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("移库锁"))
|
||||
.set(StIvtStructattr::getInv_code,form.getString("bill_code"))
|
||||
.in(StIvtStructattr::getStruct_code, lockInStructList)
|
||||
);
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public void cancel(JSONObject form) {
|
||||
List<StIvtMoveinvdtlBcp> dtlList = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlBcp>().eq("moveinv_id", form.getString("moveinv_id")));
|
||||
//调用明细表 插入方法
|
||||
Set<String> unLockStructList = new HashSet<>();
|
||||
for (StIvtMoveinvdtlBcp cp : dtlList) {
|
||||
if (cp.getBill_status().equals(MoveInvEnum.BILL_STATUS.code("完成"))||cp.getBill_status().equals(MoveInvEnum.BILL_STATUS.code("移库中"))){
|
||||
throw new BadRequestException("存在已完成明细不允许直接取消单据");
|
||||
}
|
||||
unLockStructList.add(cp.getTurnin_struct_code());
|
||||
unLockStructList.add(cp.getTurnout_struct_code());
|
||||
}
|
||||
structattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(StIvtStructattr::getInv_code,"")
|
||||
.in(StIvtStructattr::getStruct_code, unLockStructList)
|
||||
);
|
||||
moveinvdtlCpService.update(new UpdateWrapper<StIvtMoveinvdtlBcp>()
|
||||
.set("bill_status",MoveInvEnum.BILL_STATUS.code("取消"))
|
||||
.set("task_id","").eq("moveinv_id", form.getString("moveinv_id")));
|
||||
this.update(new UpdateWrapper<StIvtMoveinvBcp>()
|
||||
.set("bill_status",MoveInvEnum.BILL_STATUS.code("取消"))
|
||||
.set("update_name",SecurityUtils.getCurrentUsername())
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.set("update_time",DateUtil.now())
|
||||
.eq("moveinv_id", form.getString("moveinv_id")));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void taskOperate(JSONObject form) {
|
||||
AcsTaskEnum status = AcsTaskEnum.getType(form.getString("status"),"status_");
|
||||
List<StIvtMoveinvdtlBcp> dtls = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlBcp>()
|
||||
.eq("task_id", form.getString("task_id")));
|
||||
if (CollectionUtils.isEmpty(dtls)){
|
||||
return;
|
||||
}
|
||||
StIvtMoveinvBcp mst = this.getById(dtls.get(0).getMoveinv_id());
|
||||
switch (status){
|
||||
case STATUS_START:
|
||||
mst.setBill_status(MoveInvEnum.BILL_STATUS.code("移库中"));
|
||||
mst.setUpdate_time(DateUtil.now());
|
||||
mst.setUpdate_name("acs");
|
||||
this.updateById(mst);
|
||||
break;
|
||||
case STATUS_FINISH:
|
||||
StIvtStructattr one = structattrService.getOne(new QueryWrapper<StIvtStructattr>()
|
||||
.eq("struct_id", dtls.get(0).getTurnin_struct_id())
|
||||
.eq("storagevehicle_code", dtls.get(0).getStoragevehicle_code()));
|
||||
if (one==null){
|
||||
for (StIvtMoveinvdtlBcp dtl : dtls) {
|
||||
if (!dtl.getBill_status().equals(MoveInvEnum.BILL_STATUS.code("完成"))){
|
||||
//新增库存
|
||||
StIvtStructivtBcp ivtDao = StIvtStructivtBcp.builder()
|
||||
.struct_id(dtl.getTurnin_struct_id())
|
||||
.struct_code(dtl.getTurnin_struct_code())
|
||||
.struct_name(dtl.getTurnin_struct_name())
|
||||
.material_id(dtl.getMaterial_id())
|
||||
.quality_scode(dtl.getQuality_scode())
|
||||
.pcsn(dtl.getPcsn())
|
||||
.ivt_level(dtl.getIvt_level())
|
||||
.is_active(dtl.getIs_active())
|
||||
.qty_unit_id(dtl.getQty_unit_id())
|
||||
.instorage_time(DateUtil.now())
|
||||
.stor_id(mst.getStor_id())
|
||||
.canuse_qty(dtl.getQty())
|
||||
.workshop_id(mst.getProduct_area())
|
||||
.unit_weight(dtl.getUnit_weight())
|
||||
.bill_type(dtl.getSource_bill_type())
|
||||
.build();
|
||||
新增库存: {
|
||||
iStIvtStructivtBcpService.save(ivtDao);
|
||||
// 插入库存变动记录
|
||||
JSONObject param = JSONObject.parseObject(JSON.toJSONString(ivtDao));
|
||||
param.put("change_type", ChangeIvtUtil.ADD_SUBIVT_QTY);
|
||||
param.put("change_qty", ivtDao.getCanuse_qty());
|
||||
param.put("result_qty", ivtDao.getCanuse_qty());
|
||||
param.put("bill_code",mst.getBill_code());
|
||||
param.put("inv_id",mst.getMoveinv_id());
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("移库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_code, dtl.getTurnin_struct_code())
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(StIvtStructattr::getIs_emptyvehicle,false)
|
||||
.set(StIvtStructattr::getInv_code, "")
|
||||
.set(StIvtStructattr::getStoragevehicle_code, dtl.getStoragevehicle_code()));
|
||||
}
|
||||
减库存:{
|
||||
iStIvtStructivtBcpService.remove(new QueryWrapper<StIvtStructivtBcp>().eq("struct_id", dtl.getTurnout_struct_id()));
|
||||
ivtDao.setStruct_id(dtl.getTurnout_struct_id());
|
||||
ivtDao.setStruct_code(dtl.getTurnout_struct_code());
|
||||
ivtDao.setStruct_name(dtl.getTurnout_struct_name());
|
||||
JSONObject param = JSONObject.parseObject(JSON.toJSONString(ivtDao));
|
||||
param.put("change_type", ChangeIvtUtil.SUB_SUBIVT_QTY);
|
||||
param.put("change_qty", dtl.getQty());
|
||||
param.put("result_qty", 0);
|
||||
param.put("bill_code",mst.getBill_code());
|
||||
param.put("inv_id",mst.getMoveinv_id());
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("移库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_code, dtl.getTurnout_struct_code())
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(StIvtStructattr::getInv_code,"")
|
||||
.set(StIvtStructattr::getIs_emptyvehicle,false)
|
||||
.set(StIvtStructattr::getStoragevehicle_code, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 解锁仓位
|
||||
structattrService.update(
|
||||
new StIvtStructattr()
|
||||
.setLock_type(IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.setInv_id("")
|
||||
.setInv_type("")
|
||||
.setStoragevehicle_code("")
|
||||
.setInv_code(""),
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_id, dtls.get(0).getTurnout_struct_id())
|
||||
);
|
||||
structattrService.update(
|
||||
new StIvtStructattr()
|
||||
.setLock_type(IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.setInv_id(mst.getMoveinv_id())
|
||||
.setInv_type(IOSEnum.IO_TYPE.code("移库"))
|
||||
.setStoragevehicle_code(dtls.get(0).getStoragevehicle_code())
|
||||
.setInv_code(mst.getBill_code()),
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_id, dtls.get(0).getTurnin_struct_id())
|
||||
);
|
||||
//更新明细
|
||||
moveinvdtlCpService.update(new UpdateWrapper<StIvtMoveinvdtlBcp>()
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("完成"))
|
||||
.in("moveinvdtl_id",dtls.stream().map(StIvtMoveinvdtlBcp::getMoveinvdtl_id).collect(Collectors.toList())));
|
||||
//更新主单据
|
||||
List<StIvtMoveinvdtlBcp> list = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlBcp>()
|
||||
.eq("moveinv_id", mst.getMoveinv_id())
|
||||
.ne("bill_status", MoveInvEnum.BILL_STATUS.code("完成"))
|
||||
.ne("bill_status", MoveInvEnum.BILL_STATUS.code("取消")));
|
||||
if (list.size() == 0) {
|
||||
this.update(new UpdateWrapper<StIvtMoveinvBcp>()
|
||||
.set("bill_status",MoveInvEnum.BILL_STATUS.code("完成"))
|
||||
.set("update_time", DateUtil.now())
|
||||
.set("update_name", SecurityUtils.getCurrentUsername())
|
||||
.set("update_id",SecurityUtils.getCurrentUserId())
|
||||
.eq("moveinv_id",mst.getMoveinv_id()));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case STATUS_CANNEL:
|
||||
//更新明细
|
||||
moveinvdtlCpService.update(new UpdateWrapper<StIvtMoveinvdtlBcp>()
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("取消"))
|
||||
.set("task_id","")
|
||||
.in("moveinvdtl_id",dtls.stream().map(StIvtMoveinvdtlBcp::getMoveinvdtl_id).collect(Collectors.toList())));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,34 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.moveInv.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.enums.AcsTaskEnum;
|
||||
import org.nl.common.publish.BussEventMulticaster;
|
||||
import org.nl.common.publish.event.PointEvent;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
|
||||
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
||||
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||
import org.nl.wms.storage_manage.MoveInvEnum;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.StIvtMoveinvdtlBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.dao.mapper.StIvtMoveinvdtlBcpMapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvdtlBcpService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -17,4 +41,66 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtMoveinvdtlBcpServiceImpl extends ServiceImpl<StIvtMoveinvdtlBcpMapper, StIvtMoveinvdtlBcp> implements IStIvtMoveinvdtlBcpService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoveinvCpService moveinvCpService;
|
||||
|
||||
@Override
|
||||
public List<Map> listJoinTask(String moveinv_id) {
|
||||
if (StringUtils.isEmpty(moveinv_id)){
|
||||
throw new BadRequestException("移库单主单据id不能为空");
|
||||
}
|
||||
return this.baseMapper.listJoinTask(moveinv_id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void taskOption(JSONObject form, String option) {
|
||||
List<StIvtMoveinvdtlBcp> list = this.list(new QueryWrapper<StIvtMoveinvdtlBcp>()
|
||||
.eq("moveinv_id", form.getString("moveinv_id"))
|
||||
.eq("turnout_struct_code", form.getString("turnout_struct_code")));
|
||||
List<StIvtMoveinvdtlBcp> collect = list.stream().filter(a -> a.getBill_status().equals(MoveInvEnum.BILL_STATUS.code("完成"))).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(collect)){
|
||||
throw new BadRequestException("当前明细存在正在执行的单据");
|
||||
}
|
||||
switch (option){
|
||||
case "immediateNotifyAcs":
|
||||
StIvtMoveinvdtlBcp moveinvdtlCp = list.get(0);
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(AcsTaskEnum.TASK_STRUCT_BCP_MOVE)
|
||||
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode())
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code1(form.getString("turnout_struct_code"))
|
||||
.point_code3(form.getString("turnin_struct_code"))
|
||||
.vehicle_code(form.getString("storagevehicle_code"))
|
||||
.product_area("A1")
|
||||
.callback((Consumer<String>) moveinvdtlCp::setTask_id)
|
||||
.build();
|
||||
BussEventMulticaster.Publish(event);
|
||||
this.update(new UpdateWrapper<StIvtMoveinvdtlBcp>()
|
||||
.set("task_id",moveinvdtlCp.getTask_id())
|
||||
.set("turnin_struct_code",form.getString("turnin_struct_code"))
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("移库中"))
|
||||
.eq("moveinv_id", form.getString("moveinv_id"))
|
||||
.eq("turnout_struct_code", form.getString("turnout_struct_code")));
|
||||
form.put("task_id",moveinvdtlCp.getTask_id());
|
||||
break;
|
||||
case "forceFinish":
|
||||
break;
|
||||
case "cancel":
|
||||
SchBaseTask task = taskService.getById(form.getString("task_id"));
|
||||
if (task.getTask_status().equals(TaskStatusEnum.EXECUTING.getCode())||task.getTask_status().equals(TaskStatusEnum.FINISHED.getCode())){
|
||||
throw new BadRequestException("当前移库任务已下发执行,不允许取消");
|
||||
}
|
||||
this.update(new UpdateWrapper<StIvtMoveinvdtlBcp>()
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("生成"))
|
||||
.set("task_id","")
|
||||
.in("moveinvdtl_id",list.stream().map(StIvtMoveinvdtlBcp::getMoveinvdtl_id).collect(Collectors.toList())));
|
||||
break;
|
||||
}
|
||||
taskService.operation(MapOf.of("method_name",option,"task_id", form.getString("task_id")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ public class StIvtIostorinvHrBcpInServiceImpl extends ServiceImpl<StIvtIostorinv
|
||||
param.put("result_qty", ivtDao.getCanuse_qty());
|
||||
param.put("bill_code","");
|
||||
param.put("inv_id","");
|
||||
param.put("bill_type_scode","");
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("入库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
|
||||
@@ -254,7 +254,7 @@ public class StIvtIostorinvHrBcpOutServiceImpl extends ServiceImpl<StIvtIostorin
|
||||
param.put("result_qty", 0);
|
||||
param.put("bill_code","");
|
||||
param.put("inv_id","");
|
||||
param.put("bill_type_scode","");
|
||||
param.put("bill_type_scode",IOSEnum.IO_TYPE.code("出库"));
|
||||
iStIvtStructivtflowService.insetIvtChange(param);
|
||||
//维护载具
|
||||
structattrService.update(new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
|
||||
@@ -8,7 +8,16 @@ INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`,
|
||||
|
||||
|
||||
-- 移库单
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('d29d467457c945da9c69e3ad2d036f86', '01', 'PD', 'PD', '', '', '', '', NULL, 0, '', 'd3911293b92841e2800dcb115c01970e', '1', '0', 0, '', '2021-09-23 10:58:20', 0, '', '');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('bbadbd46d70d411391213d35c7f99c5f', '01', 'YK', 'YK', '', '', '', '', NULL, 1, '', 'c9674fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:54:58', 0, '', '2022-01-06 08:55:25');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('af1de297ebe34c059f74b7dc1c462c67', '02', '20230912', '20230912', '', '', '', 'yyyyMMdd', NULL, 2, '', 'c9674fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:55:31', 0, '', '');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('bbadbd46d70d411391213d35c7f99c5f', '01', 'YK', 'YK', '', '', '', '', NULL, 1, '', 'c9674fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:54:58', 0, '', '2022-01-06 08:55:25');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('eb7f7e7bf3754fbb9c1c0b202def07b9', '03', '0', '15', '999', '1', '0', '', 3, 3, '', 'c9674fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:56:01', 0, '', '');
|
||||
|
||||
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule`(`id`, `code`, `name`, `current_value`, `remark`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('z9994fd7ef1e4569a3fb32a05ba511cd', 'BCP_MOVE_CODE', '半成品移库单编码', NULL, NULL, '1', '0', 0, NULL, '2022-01-06 08:51:50', NULL, NULL, NULL);
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('z56de297ebe34c059f74b7dc1c462c67', '02', '20230912', '20230912', '', '', '', 'yyyyMMdd', NULL, 2, '', 'z9994fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:55:31', 0, '', '');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('bzzzbd46d70d411391213d35c7f99c5f', '01', 'BCPYK', 'BCP', '', '', '', '', NULL, 1, '', 'z9994fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:54:58', 0, '', '2022-01-06 08:55:25');
|
||||
INSERT INTO `hl_one_mes`.`sys_code_rule_detail`(`id`, `type`, `init_value`, `current_value`, `max_value`, `step`, `fillchar`, `format`, `length`, `sort_num`, `remark`, `code_rule_id`, `is_active`, `is_delete`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('eb7f7ez993754fbb9c1c0b202def07b9', '03', '0', '15', '999', '1', '0', '', 3, 3, '', 'z9994fd7ef1e4569a3fb32a05ba511cd', '1', '0', 0, '', '2022-01-06 08:56:01', 0, '', '');
|
||||
-- 字典添加手工移库
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1699305837757075456', 'ST_INV_MOVE_TYPE', '移库类型', '手工移库', '1', 1, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-06 14:17:37', '1694303357524643840', '管理员', '2023-09-06 14:17:37');
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1699310839531704320', 'MOVE_BILL_STATUS', '移库单状态', '完成', '99', 3, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-06 14:37:30', '1694303357524643840', '管理员', '2023-09-06 14:37:30');
|
||||
@@ -18,7 +27,10 @@ INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`,
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1701435666942005248', 'CHANGE_TYPE_SCODE', '变动类型', '加库存(移库)', '8', 8, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-12 11:20:48', '1694303357524643840', '管理员', '2023-09-12 11:20:48');
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1701435629621088256', 'CHANGE_TYPE_SCODE', '变动类型', '减库存(移库)', '7', 7, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-12 11:20:39', '1694303357524643840', '管理员', '2023-09-12 11:20:39');
|
||||
|
||||
|
||||
-- 半成品库存变动类型字典数据
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1701563825796550656', 'ST_INV_BCP_IN_OUT_TYPE', '半成品出入库类型', '移库', '2', 2, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-12 19:50:04', '1694303357524643840', '管理员', '2023-09-12 19:50:04');
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1701563798009286656', 'ST_INV_BCP_IN_OUT_TYPE', '半成品出入库类型', '出库', '1', 1, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-12 19:49:57', '1694303357524643840', '管理员', '2023-09-12 19:49:57');
|
||||
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1701558260970164224', 'ST_INV_BCP_IN_OUT_TYPE', '半成品出入库类型', '入库', '0', 0, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-12 19:27:57', '1694303357524643840', '管理员', '2023-09-12 19:27:57');
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user