add:成品库移库任务

This commit is contained in:
zhangzhiqiang
2023-09-11 09:24:11 +08:00
parent 9ece4e9113
commit 665ac256b9
31 changed files with 2004 additions and 70 deletions

View File

@@ -46,6 +46,7 @@ public enum AcsTaskEnum {
TASK_STRUCT_HR_EMP_IN("29","入库-海柔半成品-空托盘"),
TASK_STRUCT_HR_EMP_OUT("30","出库-海柔半成品-空托盘"),
TASK_STRUCT_CP_CHECK("13","成品-盘点"),
TASK_STRUCT_CP_MOVE("14","成品-移库"),
TASK_WASH_SEND_MATERIAL("20","清洗机-上料请求"),
TASK_WASH_EMP("21","清洗机-空框请求"),
TASK_WASH_FULL_AUTO("22","清洗机-满料请求自动"),//去半成品入库:参数不全也去异常处理位

View File

@@ -81,7 +81,6 @@ public class LogServiceImpl implements LogService {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, Log logDto) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();

View File

@@ -15,7 +15,7 @@
1 = 1 and mater.material_type_id = '1528555445302726656'
<if test="query.material_code != null and query.material_code != ''">
AND (mater.material_code LIKE '%${query.material_code}%' or
mater.material_name LIKE '%${query.material_code}%') or
mater.material_name LIKE '%${query.material_code}%' or
mater.material_spec LIKE '%${query.material_code}%')
</if>
order by mater.material_code ASC

View File

@@ -35,7 +35,7 @@ public enum IOSEnum {
//订单/发货单 状态
ORDER_STATUS(MapOf.of("生成", "10", "提交", "20", "发货中", "30", "确认", "99")),
//锁定类型
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","拼盘锁","5","其他锁","99")),
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","拼盘锁","5","移库锁","10","其他锁","99")),
// 海柔半成品出入库类型
BILL_TYPE_HR(MapOf.of("生产出库", "1001", "盘点出库", "1002", "手工出库", "1009","生产入库","0001")),
// 半成品出入类型

View File

@@ -0,0 +1,42 @@
package org.nl.wms.storage_manage;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.utils.MapOf;
import org.nl.modules.common.exception.BadRequestException;
import java.util.Map;
/*
* @author ZZQ
* @Date 2023/5/4 20:11
*/
@AllArgsConstructor
@Getter
public enum MoveInvEnum {
//单据类型
BILL_TYPE(MapOf.of("手工移库", "1")),
//单据状态
BILL_STATUS(MapOf.of("生成", "10", "移库中", "20","取消", "30", "完成", "99")),
CREATE_MODE(MapOf.of("PC产生", "01", "终端产生", "02", "外部接口产生", "03", "内部调度产生", "04"));
private Map<String, String> code;
public String code(String desc) {
String code = this.getCode().get(desc);
if (StringUtils.isNotEmpty(code)) {
return code;
}
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
}
public String check(String code) {
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
if (entry.getValue().equals("code")) {
return entry.getValue();
}
}
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
}
}

View File

@@ -1,8 +1,25 @@
package org.nl.wms.storage_manage.productmanage.controller.moveInv;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.check.IStIvtCheckmstCpService;
import org.nl.wms.storage_manage.productmanage.service.check.dto.CheckQueryMst;
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.dao.StIvtMoveinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dto.MoveInvQuery;
import org.nl.wms.storage_manage.semimanage.service.moveInv.IStIvtMoveinvBcpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
@@ -13,8 +30,42 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-04
*/
@RestController
@RequestMapping("/stIvtMoveinvCp")
@RequestMapping("api/stIvtMoveinvCp")
public class StIvtMoveinvCpController {
@Autowired
private IStIvtMoveinvCpService moveinvcpService;
@Autowired
private IStIvtMoveinvdtlCpService moveinvdtlCpService;
@GetMapping
@Log("查询盘点单主表")
//("查询盘点单主表")
public ResponseEntity<Object> query(MoveInvQuery query, PageQuery page) {
return new ResponseEntity<>(TableDataInfo.build(moveinvcpService.page(page.build(StIvtMoveinvCp.class),query.build())), HttpStatus.OK);
}
@PostMapping
@Log("创建盘点单")
//("创建盘点单")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
moveinvcpService.create(whereJson);
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
}
@PostMapping("/getMoveDtl")
@Log("查询盘点明细")
//("查询盘点明细")
public ResponseEntity<Object> getCheckDtl(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(TableDataInfo.build(moveinvdtlCpService.listJoinTask(whereJson.getString("moveinv_id"))),HttpStatus.OK);
}
@PostMapping("/update")
@Log("更新单据")
//("查询盘点明细")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
moveinvcpService.update(whereJson);
return new ResponseEntity<>(TableDataInfo.build(),HttpStatus.OK);
}
}

View File

@@ -1,8 +1,23 @@
package org.nl.wms.storage_manage.productmanage.controller.moveInv;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.nl.common.TableDataInfo;
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.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.function.Consumer;
/**
* <p>
@@ -16,5 +31,15 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/stIvtMoveinvdtlCp")
public class StIvtMoveinvdtlCpController {
@Autowired
private IStIvtMoveinvdtlCpService moveinvdtlCpService;
@PostMapping("/task/{option}")
public ResponseEntity<Object> optionTask(@RequestBody JSONObject form, @PathVariable String option){
moveinvdtlCpService.taskOption(form,option);
return new ResponseEntity<>(HttpStatus.OK);
};
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.storage_manage.productmanage.service.moveInv;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvCp;
@@ -12,5 +13,21 @@ import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvC
* @since 2023-05-04
*/
public interface IStIvtMoveinvCpService extends IService<StIvtMoveinvCp> {
/**
* 新增
* @param form
*/
void create(JSONObject form);
/**
* 更新
* @param form
*/
void update(JSONObject form);
/**
* 任务回调处理
* @param form
*/
void taskOperate(JSONObject form);
}

View File

@@ -1,8 +1,12 @@
package org.nl.wms.storage_manage.productmanage.service.moveInv;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
import java.util.List;
import java.util.Map;
/**
* <p>
* 移库单明细表 服务类
@@ -13,4 +17,7 @@ import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvd
*/
public interface IStIvtMoveinvdtlCpService extends IService<StIvtMoveinvdtlCp> {
List<Map> listJoinTask(String moveinv_id);
void taskOption(JSONObject form,String option);
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.storage_manage.productmanage.service.moveInv.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -26,6 +27,7 @@ public class StIvtMoveinvCp implements Serializable {
/**
* 移库单标识
*/
@TableId(value = "moveinv_id")
private String moveinv_id;
/**
@@ -66,12 +68,12 @@ public class StIvtMoveinvCp implements Serializable {
/**
* 总数量
*/
private BigDecimal total_qty;
private Integer total_qty;
/**
* 明细数
*/
private BigDecimal detail_count;
private Integer dtl_count;
/**
* 单据状态
@@ -91,63 +93,33 @@ public class StIvtMoveinvCp implements Serializable {
/**
* 制单人
*/
private String input_optid;
private String create_id;
/**
* 制单人姓名
*/
private String input_optname;
private String create_name;
/**
* 制单时间
*/
private String input_time;
private String create_time;
/**
* 修改人
*/
private String update_optid;
private String update_id;
/**
* 修改人姓名
*/
private String update_optname;
private String update_name;
/**
* 修改时间
*/
private LocalDateTime update_time;
/**
* 确认人
*/
private String confirm_optid;
/**
* 确认人姓名
*/
private String confirm_optname;
/**
* 确认时间
*/
private String confirm_time;
/**
* 确认说明
*/
private String confirm_info;
/**
* 部门ID
*/
private String sysdeptid;
/**
* 公司ID
*/
private String syscompanyid;
/**
* 是否删除
*/

View File

@@ -1,5 +1,6 @@
package org.nl.wms.storage_manage.productmanage.service.moveInv.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -16,7 +17,6 @@ import java.math.BigDecimal;
* @since 2023-05-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("st_ivt_moveinvdtl_cp")
public class StIvtMoveinvdtlCp implements Serializable {
@@ -25,6 +25,7 @@ public class StIvtMoveinvdtlCp implements Serializable {
/**
* 移库单明细标识
*/
@TableId(value = "moveinvdtl_id")
private String moveinvdtl_id;
/**
@@ -35,7 +36,9 @@ public class StIvtMoveinvdtlCp implements Serializable {
/**
* 明细序号
*/
private BigDecimal seq_no;
private Integer seq_no;
private String sale_id;
/**
* 转出库区标识
@@ -72,6 +75,11 @@ public class StIvtMoveinvdtlCp implements Serializable {
*/
private String material_id;
/**
* 物料标识
*/
private String material_code;
/**
* 批次
*/
@@ -140,18 +148,13 @@ public class StIvtMoveinvdtlCp implements Serializable {
/**
* 执行状态
*/
private String work_status;
private String bill_status;
/**
* 任务标识
*/
private String task_id;
/**
* 存储载具标识
*/
private String storagevehicle_id;
/**
* 存储载具编码
*/

View File

@@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.productmanage.service.moveInv.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
import java.util.List;
import java.util.Map;
/**
* <p>
* 移库单明细表 Mapper 接口
@@ -13,4 +16,5 @@ import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvd
*/
public interface StIvtMoveinvdtlCpMapper extends BaseMapper<StIvtMoveinvdtlCp> {
List<Map> listJoinTask(String moveinv_id);
}

View File

@@ -2,4 +2,14 @@
<!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.productmanage.service.moveInv.dao.mapper.StIvtMoveinvdtlCpMapper">
<select id="listJoinTask" resultType="java.util.Map">
SELECT
st_ivt_moveinvdtl_cp.*,
sch_base_task.task_code,
sch_base_task.task_status
FROM
st_ivt_moveinvdtl_cp
LEFT JOIN sch_base_task ON st_ivt_moveinvdtl_cp.task_id = sch_base_task.task_id
where moveinv_id = #{moveinv_id}
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
package org.nl.wms.storage_manage.productmanage.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.check.dao.StIvtCheckmstCp;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvCp;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class MoveInvQuery extends BaseQuery<StIvtMoveinvCp> {
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());
}
}

View File

@@ -1,14 +1,50 @@
package org.nl.wms.storage_manage.productmanage.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.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
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.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.nl.wms.storage_manage.CHECKEnum;
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.productmanage.service.check.dao.StIvtCheckdtlCp;
import org.nl.wms.storage_manage.productmanage.service.check.dao.StIvtCheckmstCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
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.dao.StIvtMoveinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.mapper.StIvtMoveinvCpMapper;
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
import org.nl.wms.storage_manage.productmanage.util.ChangeIvtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* <p>
* 移库单主表 服务实现类
* {"buss_type":"","stor_code":"F102","dtl_num":1,"bill_code":"","stor_id":"1528627995269533696","stor_name":"紫铜成品仓库","create_mode":"","remark":"","tableData":[{"sale_id":"1688802358693335040","ivt_level":"1","stor_id":"1528627995269533696","ivt_qty":15000,"sect_code":"KQ001","stockrecord_id":"1688821672087523328","quality_scode":"01","warehousing_qty":0,"storagevehicle_code":"4_0660698902","struct_id":"1668543869077295104","qty_unit_name":"个\\只","struct_code":"L07-02-02","material_name":"90度等径承口弯头\\L22-TW\\ESNA0100037","class_name":"紫铜管件S","is_active":true,"qty_unit_id":"16","canuse_qty":15000,"product_area":"A1","instorage_time":"2023-08-08 16:01:07","sect_id":"1528631043496742912","struct_name":"7排2列2层","material_id":"1684134839965585408","pcsn":"2023-08-08","sect_name":"成品库区","frozen_qty":0,"unit_weight":34.89,"material_code":"24018346S","status":"01","base_qty":15000,"turnin_struct_code":"L01-02-01"}],"check_type":"32","status":"10"}
* </p>
*
* @author generator
@@ -17,4 +53,223 @@ import org.springframework.stereotype.Service;
@Service
public class StIvtMoveinvCpServiceImpl extends ServiceImpl<StIvtMoveinvCpMapper, StIvtMoveinvCp> implements IStIvtMoveinvCpService {
@Autowired
private IStIvtMoveinvdtlCpService moveinvdtlCpService;
@Autowired
private IStIvtStructattrService structattrService;
@Autowired
private IStIvtStructivtCpService iStIvtStructivtCpService;
@Override
@Transactional
public void create(JSONObject form) {
JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用主表 插入/更新方法
StIvtMoveinvCp mst = new StIvtMoveinvCp();
// 新增
mst.setMoveinv_id(IdUtil.getStringId());
mst.setBill_code(CodeUtil.getNewCode("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.setTotal_qty(mst.getDtl_count());
mst.setRemark(form.getString("remark"));
//调用明细表 插入方法
List<StIvtMoveinvdtlCp> itemList = new ArrayList<>();
Set<String> lockStructList = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject item = rows.getJSONObject(i);
StIvtMoveinvdtlCp moveinvdtlCp = new StIvtMoveinvdtlCp();
moveinvdtlCp.setMoveinv_id(mst.getMoveinv_id());
moveinvdtlCp.setMoveinvdtl_id(IdUtil.getStringId());
moveinvdtlCp.setSeq_no(i+1);
moveinvdtlCp.setBill_status(mst.getBill_status());
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.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"));
}
itemList.add(moveinvdtlCp);
lockStructList.add(moveinvdtlCp.getTurnin_struct_code());
lockStructList.add(moveinvdtlCp.getTurnout_struct_code());
}
if (lockStructList.size()<rows.size()*2){
throw new BadRequestException("不允许选择相同货位进行分配");
}
this.save(mst);
moveinvdtlCpService.saveBatch(itemList);
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, lockStructList)
);
}
@Override
@Transactional
public void update(JSONObject form) {
JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
List<StIvtMoveinvdtlCp> dtlList = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlCp>().eq("moveinv_id", form.getString("moveinv_id")));
//调用明细表 插入方法
Set<String> unLockStructList = new HashSet<>();
for (StIvtMoveinvdtlCp 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<StIvtMoveinvdtlCp> itemList = new ArrayList<>();
Set<String> lockStructList = new HashSet<>();
for (int i = 0; i < rows.size(); i++) {
JSONObject item = rows.getJSONObject(i);
StIvtMoveinvdtlCp moveinvdtlCp = JSONObject.parseObject(JSON.toJSONString(item), StIvtMoveinvdtlCp.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);
lockStructList.add(moveinvdtlCp.getTurnin_struct_code());
lockStructList.add(moveinvdtlCp.getTurnout_struct_code());
}
if (lockStructList.size()<rows.size()*2){
throw new BadRequestException("不允许选择相同货位进行分配");
}
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, lockStructList)
);
}
@Override
public void taskOperate(JSONObject form) {
String task_id = form.getString("task_id");
String status = form.getString("status");
StIvtMoveinvdtlCp dtl = moveinvdtlCpService.getOne(new QueryWrapper<StIvtMoveinvdtlCp>().eq("task_id", task_id));
StIvtMoveinvCp mst = this.getById(dtl.getMoveinv_id());
if (status.equals(AcsTaskEnum.STATUS_FINISH.getCode())) {
moveinvdtlCpService.update(new UpdateWrapper<StIvtMoveinvdtlCp>()
.set("bill_status",MoveInvEnum.BILL_STATUS.code("完成")).eq("moveinvdtl_id",dtl.getMoveinvdtl_id()));
List<StIvtMoveinvdtlCp> list = moveinvdtlCpService.list(new QueryWrapper<StIvtMoveinvdtlCp>()
.eq("moveinv_id", dtl.getMoveinv_id())
.ne("bill_status", MoveInvEnum.BILL_STATUS.code("完成")));
if (list.size() == 0) {
this.update(new UpdateWrapper<StIvtMoveinvCp>()
.set("bill_status",MoveInvEnum.BILL_STATUS.code("完成"))
.eq("moveinv_id",dtl.getMoveinv_id()));
}
//减出库。加入库
JSONObject ivtOutParam = new JSONObject();
ivtOutParam.put("struct_id", dtl.getTurnout_struct_id());
ivtOutParam.put("material_id", dtl.getMaterial_id());
ivtOutParam.put("pcsn", dtl.getPcsn());
ivtOutParam.put("quality_scode", dtl.getQuality_scode());
ivtOutParam.put("ivt_level", dtl.getIvt_level());
ivtOutParam.put("change_qty", dtl.getQty());
ivtOutParam.put("change_type", ChangeIvtUtil.SUB_SUBIVT_QTY);
ivtOutParam.put("sale_id", dtl.getSale_id());
ivtOutParam.put("bill_code",mst.getBill_code());
ivtOutParam.put("inv_id",mst.getMoveinv_id());
ivtOutParam.put("bill_type_scode",mst.getBill_type());
iStIvtStructivtCpService.UpdateIvt(ivtOutParam);
// 解锁仓位
structattrService.update(
new StIvtStructattr()
.setLock_type(IOSEnum.LOCK_TYPE.code("未锁定"))
.setInv_id("")
.setInv_type("")
.setInv_code(""),
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStruct_id, dtl.getTurnout_struct_id())
);
//加入库
JSONObject ivtInParam = new JSONObject();
ivtInParam.put("struct_id", dtl.getTurnin_struct_id());
ivtInParam.put("material_id", dtl.getMaterial_id());
ivtInParam.put("pcsn", dtl.getPcsn());
ivtInParam.put("quality_scode", dtl.getQuality_scode());
ivtInParam.put("ivt_level", dtl.getIvt_level());
ivtInParam.put("change_qty", dtl.getQty());
ivtInParam.put("change_type", ChangeIvtUtil.ADD_SUBIVT_QTY);
ivtInParam.put("sale_id", dtl.getSale_id());
ivtInParam.put("bill_code",mst.getBill_code());
ivtInParam.put("inv_id",mst.getMoveinv_id());
ivtInParam.put("bill_type_scode",mst.getBill_type());
iStIvtStructivtCpService.UpdateIvt(ivtInParam);
structattrService.update(
new StIvtStructattr()
.setLock_type(IOSEnum.LOCK_TYPE.code("未锁定"))
.setInv_id("")
.setInv_type("")
.setStoragevehicle_code(dtl.getStoragevehicle_code())
.setInv_code(""),
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStruct_id, dtl.getTurnin_struct_id())
);
}
// if (status.equals(AcsTaskEnum.STATUS_CANNEL.getCode())) {
// structattrService.update(
// new StIvtStructattr()
// .setLock_type(IOSEnum.LOCK_TYPE.code("未锁定"))
// .setInv_id("")
// .setInv_type("")
// .setInv_code(""),
// new QueryWrapper<StIvtStructattr>().lambda()
// .in(StIvtStructattr::getStruct_id, dtl.getTurnin_struct_id(),dtl.getTurnout_struct_id())
// );
// }
}
}

View File

@@ -1,11 +1,28 @@
package org.nl.wms.storage_manage.productmanage.service.moveInv.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.IStIvtMoveinvdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.StIvtMoveinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moveInv.dao.mapper.StIvtMoveinvdtlCpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
* <p>
* 移库单明细表 服务实现类
@@ -17,4 +34,51 @@ import org.springframework.stereotype.Service;
@Service
public class StIvtMoveinvdtlCpServiceImpl extends ServiceImpl<StIvtMoveinvdtlCpMapper, StIvtMoveinvdtlCp> implements IStIvtMoveinvdtlCpService {
@Autowired
private ISchBaseTaskService taskService;
@Override
public List<Map> listJoinTask(String moveinv_id) {
if (StringUtils.isEmpty(moveinv_id)){
throw new BadRequestException("移库单主单据id不能为空");
}
return this.baseMapper.listJoinTask(moveinv_id);
}
@Override
public void taskOption(JSONObject form, String option) {
StIvtMoveinvdtlCp moveinvdtl = this.getById(form.getString("moveinvdtl_id"));
switch (option){
case "immediateNotifyAcs":
PointEvent event = PointEvent.builder()
.type(AcsTaskEnum.TASK_STRUCT_CP_MOVE)
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_RT.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>) moveinvdtl::setTask_id)
.build();
BussEventMulticaster.Publish(event);
moveinvdtl.setBill_status(MoveInvEnum.BILL_STATUS.code("移库中"));
break;
case "forceFinish":
moveinvdtl.setBill_status(MoveInvEnum.BILL_STATUS.code("完成"));
break;
case "cannel":
String task_id = moveinvdtl.getTask_id();
SchBaseTask task = taskService.getById(task_id);
if (task.getTask_status().equals(TaskStatusEnum.ISSUE.getCode())||task.getTask_status().equals(TaskStatusEnum.EXECUTING.getCode())){
throw new BadRequestException("当前移库任务正在执行中,不允许取消");
}
moveinvdtl.setBill_status(MoveInvEnum.BILL_STATUS.code("取消"));
moveinvdtl.setTask_id("");
break;
}
this.updateById(moveinvdtl);
taskService.operation(MapOf.of("method_name",option,"task_id",form.getString("task_id")));
}
}

View File

@@ -103,6 +103,14 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
// 减冻结、减库存
subFrozenSubQty(json);
break;
case ChangeIvtUtil.SUB_SUBIVT_QTY:
// 减冻结、减库存
subSubQty(json);
break;
case ChangeIvtUtil.ADD_SUBIVT_QTY:
// 减冻结、减库存
AddQty(json);
break;
default:
throw new BadRequestException("变动类型异常!");
}
@@ -445,7 +453,86 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
param.put("result_qty", ivt_qty);
insetIvtChange(param);
}
private void subSubQty(JSONObject json) {
// 找到对应库存
StIvtStructivtCp ivtDao = new StIvtStructivtCp();
if (ObjectUtil.isEmpty(json.getString("sale_id"))) {
ivtDao = this.getOne(
new QueryWrapper<StIvtStructivtCp>().lambda()
.eq(StIvtStructivtCp::getStruct_id, json.getString("struct_id"))
.eq(StIvtStructivtCp::getMaterial_id, json.getString("material_id"))
.eq(StIvtStructivtCp::getPcsn, json.getString("pcsn"))
);
} else {
ivtDao = this.getOne(
new QueryWrapper<StIvtStructivtCp>().lambda()
.eq(StIvtStructivtCp::getStruct_id, json.getString("struct_id"))
.eq(StIvtStructivtCp::getMaterial_id, json.getString("material_id"))
.eq(StIvtStructivtCp::getSale_id,json.getString("sale_id"))
);
}
if (ObjectUtil.isEmpty(ivtDao)) throw new BadRequestException("库存异常,请检查!");
// 库存数
double ivt_qty = NumberUtil.sub(ivtDao.getIvt_qty().doubleValue(), json.getDoubleValue("change_qty"));
if (ivt_qty == 0) {
// 删除
this.removeById(ivtDao.getStockrecord_id());
} else {
ivtDao.setIvt_qty(BigDecimal.valueOf(ivt_qty));
ivtDao.setCanuse_qty(BigDecimal.valueOf(ivt_qty));
this.updateById(ivtDao);
}
// 插入库存变动记录
JSONObject param = JSONObject.parseObject(JSON.toJSONString(ivtDao));
param.put("change_type_scode", ChangeIvtUtil.SUB_SUBIVT_QTY);
param.put("inv_id", json.getString("inv_id"));
param.put("bill_type_scode", json.getString("bill_type_scode"));
param.put("bill_code", json.getString("bill_code"));
param.put("change_qty", json.getBigDecimal("change_qty"));
param.put("result_qty", ivt_qty);
insetIvtChange(param);
}
private void AddQty(JSONObject json) {
// 为空插入
StIvtStructattr attrDao = iStIvtStructattrService.getById(json.getString("struct_id"));
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(json.getString("material_id"));
StIvtStructivtCp dao = new StIvtStructivtCp();
dao.setStockrecord_id(org.nl.common.utils.IdUtil.getStringId());
dao.setStruct_id(attrDao.getStruct_id());
dao.setStruct_code(attrDao.getStruct_code());
dao.setStruct_name(attrDao.getStruct_name());
dao.setMaterial_id(materDao.getMaterial_id());
dao.setQuality_scode(json.getString("quality_scode"));
dao.setIvt_level(json.getString("ivt_level"));
dao.setIs_active(true);
dao.setPcsn(json.getString("pcsn"));
dao.setFrozen_qty(BigDecimal.valueOf(0));
dao.setCanuse_qty(json.getBigDecimal("change_qty"));
dao.setIvt_qty(json.getBigDecimal("change_qty"));
dao.setQty_unit_id(materDao.getBase_unit_id());
dao.setSale_id(json.getString("sale_id"));
dao.setProduct_area(json.getString("product_area"));
dao.setStor_id(json.getString("stor_id"));
dao.setUnit_weight(materDao.getNet_weight());
dao.setBill_type(json.getString("bill_type_scode"));
this.save(dao);
// 插入库存变动记录
JSONObject param = JSONObject.parseObject(JSON.toJSONString(dao));
param.put("change_type_scode", ChangeIvtUtil.ADD_SUBIVT_QTY);
param.put("change_qty", json.getBigDecimal("change_qty"));
param.put("inv_id", json.getString("inv_id"));
param.put("bill_type_scode", json.getString("bill_type_scode"));
param.put("bill_code", json.getString("bill_code"));
param.put("result_qty", 0);
insetIvtChange(param);
}
/*
校验数据
*/

View File

@@ -31,6 +31,15 @@ public class ChangeIvtUtil {
* 减冻结、减库存
*/
public static final String SUBFROZEN_SUBIVT_QTY = "6";
/**
* 减库存
*/
public static final String SUB_SUBIVT_QTY = "7";
/**
* 加库存
*/
public static final String ADD_SUBIVT_QTY = "8";
}

View File

@@ -58,7 +58,7 @@
and mst.bill_code = #{query.bill_code}
</if>
</where>
GROUP BY mst.bill_code
order by create_time DESC
</select>

View File

@@ -76,6 +76,7 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
public Object pageQuery(YlIostorInvQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
List<Map> mst_detail = this.baseMapper.getMstDetail(query, pageQuery);
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;

View File

@@ -11,6 +11,7 @@ import org.nl.wms.storage_manage.pda.service.PdaStBcpInService;
import org.nl.wms.storage_manage.productmanage.service.check.IStIvtCheckmstCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpOutService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService;
import org.nl.wms.storage_manage.productmanage.service.moveInv.IStIvtMoveinvCpService;
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;
@@ -66,6 +67,10 @@ public enum TASKEnum implements FunctionStrategy<String, JSONObject> {
IStIvtCheckmstCpService bean = SpringContextHolder.getBean(IStIvtCheckmstCpService.class);
bean.taskOperate(form);
}),
CP_MOVE_TASK(type -> AcsTaskEnum.TASK_STRUCT_CP_MOVE.getCode().equals(type), form -> {
IStIvtMoveinvCpService bean = SpringContextHolder.getBean(IStIvtMoveinvCpService.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);

View File

@@ -7,8 +7,13 @@ 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_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');
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 ('1699310801569058816', 'MOVE_BILL_STATUS', '移库单状态', '移库中', '20', 2, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-06 14:37:21', '1694303357524643840', '管理员', '2023-09-06 14:37:21');
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 ('1699310669570117632', 'MOVE_BILL_STATUS', '移库单状态', '生成', '10', 1, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-06 14:36:49', '1694303357524643840', '管理员', '2023-09-06 14:36:49');