dev:拆拼盘修改
This commit is contained in:
@@ -57,10 +57,10 @@ public class CodeGenerator {
|
||||
mpg.setGlobalConfig(gc);
|
||||
// 数据源配置
|
||||
DataSourceConfig dsc = new DataSourceConfig();
|
||||
dsc.setUrl("jdbc:mysql://192.168.46.5:3306/hl_one_mes_test?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
|
||||
dsc.setUrl("jdbc:mysql://192.168.81.252:3306/hl_one_mes_xc?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("123456");
|
||||
dsc.setPassword("Root.123456");
|
||||
mpg.setDataSource(dsc);
|
||||
// 包配置
|
||||
PackageConfig pc = new PackageConfig();
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
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 SHUTEnum {
|
||||
//拆拼类型
|
||||
BUSI_CLASSS_CODE(MapOf.of("拆盘", "01", "拼盘", "02")),
|
||||
//单据类型
|
||||
BILL_TYPE(MapOf.of("普通拆盘", "51", "普通拼盘", "52")),
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成", "10", "提交", "20", "执行中", "30", "确认", "60", "完成", "99")),
|
||||
//单据状态
|
||||
WORK_STATUS(MapOf.of("未生成", "00", "生成", "10", "执行中", "20", "确认", "30", "完成", "99")),
|
||||
;
|
||||
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 + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class StIvtCheckmstYlServiceImpl extends ServiceImpl<StIvtCheckmstYlMappe
|
||||
@Override
|
||||
public Object pageQuery(CheckQuery query, PageQuery page) {
|
||||
// 查询条件
|
||||
page.setSort("check_code,ASC");
|
||||
page.setSort("check_code");
|
||||
// 分页查询
|
||||
Page<StIvtCheckmstYl> pageQuery = this.page(page.build(), query.build());
|
||||
TableDataInfo<StIvtCheckmstYl> build = TableDataInfo.build(pageQuery);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.storage_manage.semimanage.controller.shutFrame;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼盘明细表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtShutframedtlBcp")
|
||||
public class StIvtShutframedtlBcpController {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,15 +4,14 @@ package org.nl.wms.storage_manage.semimanage.controller.shutFrame;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.check.dto.CheckQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.IStIvtShutframeinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -23,16 +22,32 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtShutframeinvBcp")
|
||||
@RequestMapping("api/shutframe")
|
||||
public class StIvtShutframeinvBcpController {
|
||||
|
||||
// @Autowired
|
||||
// private IStIvtShutframeinvBcpService shutframeinvBcpService;
|
||||
// @PostMapping("/create")
|
||||
// @Log("创建拼盘单")
|
||||
// @ApiOperation("创建拼盘单")
|
||||
// public ResponseEntity<Object> create(@RequestBody JSONObject jo) {
|
||||
// return new ResponseEntity<>(shutframeinvBcpService.create(jo), HttpStatus.OK);
|
||||
// }
|
||||
@Autowired
|
||||
private IStIvtShutframeinvBcpService shutframeinvBcpService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Log("创建拼盘单")
|
||||
@ApiOperation("创建拼盘单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject jo) {
|
||||
shutframeinvBcpService.create(jo);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询拼盘单")
|
||||
@ApiOperation("查询拼盘单")
|
||||
public ResponseEntity<Object> query(ShutQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(shutframeinvBcpService.pageQuery(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getBillDtl")
|
||||
@Log("查询拼盘明细")
|
||||
@ApiOperation("查询拼盘明细")
|
||||
public ResponseEntity<Object> getBillDtl(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(shutframeinvBcpService.getBillDtl(jo), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframedtlBcp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼盘明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
public interface IStIvtShutframedtlBcpService extends IService<StIvtShutframedtlBcp> {
|
||||
|
||||
/**
|
||||
* 主单据使用
|
||||
* @param row
|
||||
* @param shutframeinv_id
|
||||
* @return
|
||||
*/
|
||||
int create(JSONArray row, String shutframeinv_id);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframeinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,16 @@ import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframe
|
||||
*/
|
||||
public interface IStIvtShutframeinvBcpService extends IService<StIvtShutframeinvBcp> {
|
||||
|
||||
void create (JSONObject jo);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query,page /
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object pageQuery(ShutQuery query, PageQuery page);
|
||||
|
||||
List<Map> getBillDtl(JSONObject jo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼盘明细表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_shutframedtl_bcp")
|
||||
public class StIvtShutframedtlBcp implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 拆拼单明细标识
|
||||
*/
|
||||
private String shutframeinvdtl_id;
|
||||
|
||||
/**
|
||||
* 拆拼单标识
|
||||
*/
|
||||
private String shutframeinv_id;
|
||||
|
||||
/**
|
||||
* 明细序号
|
||||
*/
|
||||
private BigDecimal seqno;
|
||||
|
||||
/**
|
||||
* 转出库区标识
|
||||
*/
|
||||
private String turnout_sect_id;
|
||||
|
||||
/**
|
||||
* 转出库区编码
|
||||
*/
|
||||
private String turnout_sect_code;
|
||||
|
||||
/**
|
||||
* 转出库区名称
|
||||
*/
|
||||
private String turnout_sect_name;
|
||||
|
||||
/**
|
||||
* 转出仓位标识
|
||||
*/
|
||||
private String turnout_struct_id;
|
||||
|
||||
/**
|
||||
* 转出仓位编码
|
||||
*/
|
||||
private String turnout_struct_code;
|
||||
|
||||
/**
|
||||
* 转出仓位名称
|
||||
*/
|
||||
private String turnout_struct_name;
|
||||
|
||||
/**
|
||||
* 转出载具标识
|
||||
*/
|
||||
private String storagevehicle_id;
|
||||
|
||||
/**
|
||||
* 转出载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 品质类型
|
||||
*/
|
||||
private String quality_scode;
|
||||
|
||||
/**
|
||||
* 库存等级
|
||||
*/
|
||||
private String ivt_level;
|
||||
|
||||
/**
|
||||
* 是否可用
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量计量单位名称
|
||||
*/
|
||||
private String qty_unit_name;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 实际数量
|
||||
*/
|
||||
private BigDecimal fact_qty;
|
||||
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
private BigDecimal unit_weight;
|
||||
|
||||
/**
|
||||
* 转入库区标识
|
||||
*/
|
||||
private String turnin_sect_id;
|
||||
|
||||
/**
|
||||
* 转入库区编码
|
||||
*/
|
||||
private String turnin_sect_code;
|
||||
|
||||
/**
|
||||
* 转入库区名称
|
||||
*/
|
||||
private String turnin_sect_name;
|
||||
|
||||
/**
|
||||
* 转入仓位标识
|
||||
*/
|
||||
private String turnin_struct_id;
|
||||
|
||||
/**
|
||||
* 转入仓位编码
|
||||
*/
|
||||
private String turnin_struct_code;
|
||||
|
||||
/**
|
||||
* 转入仓位名称
|
||||
*/
|
||||
private String turnin_struct_name;
|
||||
|
||||
/**
|
||||
* 转入载具标识
|
||||
*/
|
||||
private String storagevehicle_id_in;
|
||||
|
||||
/**
|
||||
* 转入载具编码
|
||||
*/
|
||||
private String storagevehicle_code_in;
|
||||
|
||||
/**
|
||||
* 执行状态
|
||||
*/
|
||||
private String work_status;
|
||||
|
||||
/**
|
||||
* 任务标识
|
||||
*/
|
||||
private String task_id;
|
||||
|
||||
/**
|
||||
* 是否已下发
|
||||
*/
|
||||
private Boolean is_issued;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.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;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼单主表
|
||||
@@ -25,6 +26,7 @@ public class StIvtShutframeinvBcp implements Serializable {
|
||||
/**
|
||||
* 拆拼单标识
|
||||
*/
|
||||
@TableId
|
||||
private String shutframeinv_id;
|
||||
|
||||
/**
|
||||
@@ -105,7 +107,7 @@ public class StIvtShutframeinvBcp implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date create_time;
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
@@ -120,7 +122,7 @@ public class StIvtShutframeinvBcp implements Serializable {
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date update_time;
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
@@ -135,7 +137,7 @@ public class StIvtShutframeinvBcp implements Serializable {
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private Date confirm_time;
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 确认说明
|
||||
@@ -160,7 +162,7 @@ public class StIvtShutframeinvBcp implements Serializable {
|
||||
/**
|
||||
* 车间标识
|
||||
*/
|
||||
private String product_area;
|
||||
private String workshop_id;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframedtlBcp;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼盘明细表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
public interface StIvtShutframedtlBcpMapper extends BaseMapper<StIvtShutframedtlBcp> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframeinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +19,5 @@ import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframe
|
||||
*/
|
||||
public interface StIvtShutframeinvBcpMapper extends BaseMapper<StIvtShutframeinvBcp> {
|
||||
|
||||
List<Map> getMstDetail(@Param("query")ShutQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.shutFrame.dao.mapper.StIvtShutframedtlBcpMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,37 @@
|
||||
<?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.moreOrLess.dao.mapper.StIvtShutframeinvBcpMapper">
|
||||
<mapper namespace="org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.mapper.StIvtShutframeinvBcpMapper">
|
||||
|
||||
<select id="getMstDetail" resultType="java.util.Map">
|
||||
SELECT
|
||||
mst.*
|
||||
FROM
|
||||
st_ivt_shutframeinv_bcp mst
|
||||
LEFT JOIN st_ivt_shutframedtl_bcp dtl ON dtl.shutframeinv_id = mst.shutframeinv_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
|
||||
<where>
|
||||
mst.is_delete = '0'
|
||||
<if test="query.start_time != null">
|
||||
and mst.create_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null">
|
||||
and #{query.end_time} >= mst.create_time
|
||||
</if>
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
and mst.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
<if test="query.bill_status != null and query.bill_status != ''">
|
||||
and mst.bill_status = #{query.bill_status}
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.bill_code = #{query.bill_code}
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.bill_code = #{query.bill_code}
|
||||
</if>
|
||||
<if test="query.material_search != null and query.material_search != ''">
|
||||
and (mb.material_name = #{query.material_search} OR mb.material_code = #{query.material_search})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.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.rawmanage.service.check.dao.StIvtCheckmstYl;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframeinvBcp;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class ShutQuery extends BaseQuery<StIvtShutframeinvBcp> {
|
||||
|
||||
|
||||
private String stor_id;
|
||||
|
||||
private String bill_status;
|
||||
|
||||
private String bill_code;
|
||||
|
||||
private String material_search;
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
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.SHUTEnum;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.IStIvtShutframedtlBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframedtlBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.mapper.StIvtShutframedtlBcpMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼盘明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
@Service
|
||||
public class StIvtShutframedtlBcpServiceImpl extends ServiceImpl<StIvtShutframedtlBcpMapper, StIvtShutframedtlBcp> implements IStIvtShutframedtlBcpService {
|
||||
|
||||
private StIvtStructattr first_struct;
|
||||
|
||||
private StIvtStructattr last_struct;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService;
|
||||
|
||||
@Override
|
||||
public int create(JSONArray rows, String shutframeinv_id) {
|
||||
int total_qty = 1;
|
||||
|
||||
if (rows.size() > 0 && StringUtils.isNotEmpty(shutframeinv_id)) {
|
||||
// 先删除在插入
|
||||
this.remove(new QueryWrapper<StIvtShutframedtlBcp>().eq("shutframeinv_id", shutframeinv_id));
|
||||
LinkedList<String> struct_list = new LinkedList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
if (ObjectUtil.isEmpty(struct_list)) {
|
||||
struct_list.addFirst(row.getString("struct_code"));
|
||||
first_struct = structattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", row.getString("struct_code")));
|
||||
continue;
|
||||
} else {
|
||||
if (!struct_list.contains(row.getString("struct_code"))) {
|
||||
struct_list.addLast(row.getString("struct_code"));
|
||||
if (ObjectUtil.isEmpty(last_struct)) {
|
||||
last_struct = structattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_code", row.getString("struct_code")));
|
||||
}
|
||||
if (struct_list.size() > 2) {
|
||||
throw new BadRequestException("拼盘数组数据异常!");
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
StIvtShutframedtlBcp dtl = new StIvtShutframedtlBcp();
|
||||
dtl.setShutframeinvdtl_id(IdUtil.getStringId());
|
||||
dtl.setShutframeinv_id(shutframeinv_id);
|
||||
dtl.setSeqno(BigDecimal.valueOf(total_qty));
|
||||
dtl.setTurnout_sect_id(last_struct.getSect_id());
|
||||
dtl.setTurnout_sect_code(last_struct.getSect_code());
|
||||
dtl.setTurnout_sect_name(last_struct.getSect_name());
|
||||
dtl.setTurnout_struct_id(last_struct.getStruct_id());
|
||||
dtl.setTurnout_struct_code(last_struct.getStruct_code());
|
||||
dtl.setTurnout_struct_name(last_struct.getStruct_name());
|
||||
dtl.setStoragevehicle_code(row.getString("storagevehicle_code"));
|
||||
dtl.setMaterial_id(row.getString("material_id"));
|
||||
dtl.setPcsn(row.getString("pcsn"));
|
||||
dtl.setQty_unit_id(row.getString("qty_unit_id"));
|
||||
dtl.setQty_unit_name(row.getString("qty_unit_name"));
|
||||
dtl.setQty(row.getBigDecimal("canuse_qty"));
|
||||
dtl.setFact_qty(row.getBigDecimal("canuse_qty"));
|
||||
dtl.setUnit_weight(row.getBigDecimal("unit_weight"));
|
||||
dtl.setTurnin_sect_id(first_struct.getSect_id());
|
||||
dtl.setTurnin_sect_code(first_struct.getSect_code());
|
||||
dtl.setTurnin_sect_name(first_struct.getSect_name());
|
||||
dtl.setTurnin_struct_id(first_struct.getStruct_id());
|
||||
dtl.setTurnin_struct_code(first_struct.getStruct_code());
|
||||
dtl.setTurnin_struct_name(first_struct.getStruct_name());
|
||||
dtl.setWork_status(SHUTEnum.WORK_STATUS.code("未生成"));
|
||||
dtl.setIs_issued(true);
|
||||
|
||||
this.save(dtl);
|
||||
total_qty++;
|
||||
}
|
||||
}
|
||||
return total_qty;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,40 @@
|
||||
package org.nl.wms.storage_manage.semimanage.service.shutFrame.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
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.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
import org.nl.wms.storage_manage.SHUTEnum;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.IStIvtShutframedtlBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.IStIvtShutframeinvBcpService;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframedtlBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.StIvtShutframeinvBcp;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dao.mapper.StIvtShutframeinvBcpMapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.mapper.StIvtStructivtBcpMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 拆拼单主表 服务实现类
|
||||
@@ -18,4 +46,89 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtShutframeinvBcpServiceImpl extends ServiceImpl<StIvtShutframeinvBcpMapper, StIvtShutframeinvBcp> implements IStIvtShutframeinvBcpService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtShutframedtlBcpService shutframedtlBcpService;
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService stIvtBsrealstorattrService;
|
||||
@Autowired
|
||||
private StIvtStructivtBcpMapper bcpMapper;
|
||||
|
||||
@Override
|
||||
public Object pageQuery(ShutQuery 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getBillDtl(JSONObject jo) {
|
||||
List<StIvtShutframedtlBcp> list = shutframedtlBcpService.list(new QueryWrapper<StIvtShutframedtlBcp>().eq("shutframeinv_id", jo.getString("shutframeinv_id")));
|
||||
List<Map> ivt_list = bcpMapper.getStructIvtInfo(MapOf.of("struct_code", list.get(0).getTurnout_struct_code()));
|
||||
List<Map> ivt_list2 = bcpMapper.getStructIvtInfo(MapOf.of("struct_code", list.get(0).getTurnin_struct_code()));
|
||||
ivt_list.addAll(ivt_list2);
|
||||
return ivt_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(JSONObject form) {
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
|
||||
// 调用主表 插入/更新方法
|
||||
StIvtShutframeinvBcp shutframeinvBcp = packageMstForm(new StIvtShutframeinvBcp(), form, false);
|
||||
|
||||
// 调用明细表 插入/更新方法
|
||||
int i = shutframedtlBcpService.create(rows, shutframeinvBcp.getShutframeinv_id());
|
||||
|
||||
// 插入主表
|
||||
shutframeinvBcp.setDetail_count(BigDecimal.valueOf(i));
|
||||
this.save(shutframeinvBcp);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtShutframeinvBcp packageMstForm(StIvtShutframeinvBcp shutMst, JSONObject whereJson, Boolean isUpdate) {
|
||||
if (!isUpdate) {
|
||||
// 新增
|
||||
shutMst.setShutframeinv_id(IdUtil.getStringId());
|
||||
shutMst.setBill_code(CodeUtil.getNewCode("CPP_CODE"));
|
||||
shutMst.setBusi_classs_code(SHUTEnum.BUSI_CLASSS_CODE.code("拼盘"));
|
||||
shutMst.setBuss_type(whereJson.getString("bill_type"));
|
||||
shutMst.setBill_type(shutMst.getBuss_type());
|
||||
shutMst.setBiz_date(whereJson.getString("biz_date"));
|
||||
shutMst.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
shutMst.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
shutMst.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
shutMst.setCreate_time(DateUtil.now());
|
||||
shutMst.setIs_delete(false);
|
||||
// TODO 暂时写死
|
||||
shutMst.setSysdeptid("111");
|
||||
shutMst.setSyscompanyid("111");
|
||||
|
||||
} else {
|
||||
// 修改
|
||||
shutMst.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
shutMst.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
shutMst.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
shutMst.setBiz_date(whereJson.getString("biz_date").substring(0, 10));
|
||||
// 获取仓库信息
|
||||
QueryWrapper<StIvtBsrealstorattr> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("stor_id", whereJson.getString("stor_id"));
|
||||
wrapper.eq("is_used", true);
|
||||
StIvtBsrealstorattr bsrealDao = stIvtBsrealstorattrService.getOne(wrapper);
|
||||
if (ObjectUtil.isEmpty(bsrealDao)) throw new BadRequestException("仓库不存在或未启用!");
|
||||
|
||||
shutMst.setStor_id(bsrealDao.getStor_id());
|
||||
shutMst.setStor_code(bsrealDao.getStor_code());
|
||||
shutMst.setStor_name(bsrealDao.getStor_name());
|
||||
shutMst.setTotal_qty(whereJson.getBigDecimal("total_qty"));
|
||||
shutMst.setRemark(whereJson.getString("remark"));
|
||||
shutMst.setWorkshop_id(whereJson.getString("workshop_id"));
|
||||
|
||||
return shutMst;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,5 +26,7 @@ public interface StIvtStructivtBcpMapper extends BaseMapper<StIvtStructivtBcp> {
|
||||
|
||||
List<Map> getBcpIvtInfo(@Param("map") JSONObject map);
|
||||
|
||||
List<Map> getStructIvtInfo(@Param("map") Map map);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -84,4 +84,29 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getStructIvtInfo" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*,
|
||||
mu.unit_name AS qty_unit_name,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.sect_name,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name,
|
||||
sa.storagevehicle_code
|
||||
FROM
|
||||
st_ivt_structivt_bcp ivt
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = ivt.struct_id
|
||||
LEFT JOIN md_pb_measureunit mu ON mu.measure_unit_id = ivt.qty_unit_id
|
||||
<where>
|
||||
<if test="map.struct_code != null and map.struct_code != ''">
|
||||
and #{map.struct_code} = sa.struct_code
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user