Merge remote-tracking branch 'origin/master_1' into master_1

This commit is contained in:
2025-04-15 12:16:57 +08:00
26 changed files with 2220 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ public enum IOSEnum {
//出库单据类型
OUT_TYPE(MapOf.of("发货出库", "1001", "改切出库", "1003", "调拨出库", "1004", "拆箱出库", "1005",
"返检出库", "1006", "超期报废", "1007", "退货报废", "1008", "质量问题报废", "1010", "其他报废", "1002",
"手工出库", "1009"
"手工出库", "1009","管控出库", "1099"
)),
//移库单据类型

View File

@@ -947,7 +947,9 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
/*
* 如果为返检出库或者改切出库删除对应的包装关系
*/
if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("返检出库")) || mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("改切出库"))) {
if (mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("返检出库")) || mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("改切出库"))
|| mstDao.getBill_type().equals(IOSEnum.OUT_TYPE.code("管控出库"))
) {
// 查询库区
String sect_in = disDaoList.stream()

View File

@@ -42,6 +42,14 @@ public class StructivtController {
}
@GetMapping("/control")
@Log("查询管控库存")
//@PreAuthorize("@el.check('structivt:list')")
public ResponseEntity<Object> queryCntrol(@RequestParam Map whereJson, Pageable page, String[] product_area, String[] ivt_flag) {
return new ResponseEntity<>(structivtService.queryCntrol(whereJson, page, product_area, ivt_flag), HttpStatus.OK);
}
@PostMapping
@Log("新增库存管理")

View File

@@ -28,6 +28,15 @@ public interface StructivtService {
*/
Map<String, Object> queryAll(Map whereJson, Pageable page, String[] product_area, String[] ivt_flag);
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryCntrol(Map whereJson, Pageable page, String[] product_area, String[] ivt_flag);
/**
* 查询所有数据不分页
*
@@ -85,4 +94,5 @@ public interface StructivtService {
void save(JSONObject whereJson);
void importExcel(MultipartFile file, HttpServletRequest request);
}

View File

@@ -118,6 +118,80 @@ public class StructivtServiceImpl implements StructivtService {
return jsonObject;
}
@Override
public Map<String, Object> queryCntrol(Map whereJson, Pageable page, String[] product_area, String[] ivt_flag) {
String material = MapUtil.getStr(whereJson, "material");
String struct = MapUtil.getStr(whereJson, "struct");
String stor_id = MapUtil.getStr(whereJson, "stor_id");
String sect_id = MapUtil.getStr(whereJson, "sect_id");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
String package_box_sn = MapUtil.getStr(whereJson, "package_box_sn");
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
String ivt_status = MapUtil.getStr(whereJson, "ivt_status");
String is_virtual = MapUtil.getStr(whereJson, "is_virtual");
String sub_type = MapUtil.getStr(whereJson, "sub_type");
String quality_scode = MapUtil.getStr(whereJson, "quality_scode");
JSONObject map = new JSONObject();
map.put("flag", "11");
map.put("stor_id", stor_id);
map.put("sect_id", sect_id);
map.put("ivt_status", ivt_status);
map.put("is_virtual", is_virtual);
map.put("sub_type", sub_type);
map.put("quality_scode", quality_scode);
if (StrUtil.isNotEmpty(material)) {
map.put("material", "%" + material + "%");
}
if (StrUtil.isNotEmpty(struct)) {
map.put("struct", "%" + struct + "%");
}
if (StrUtil.isNotEmpty(pcsn)) {
map.put("pcsn", "%" + pcsn + "%");
}
if (StrUtil.isNotEmpty(sap_pcsn)) {
map.put("sap_pcsn", "%" + sap_pcsn + "%");
}
if (StrUtil.isNotEmpty(package_box_sn)) {
map.put("package_box_sn", "%" + package_box_sn + "%");
}
if (StrUtil.isNotEmpty(sale_order_name)) {
map.put("sale_order_name", "%" + sale_order_name + "%");
}
if (ObjectUtil.isNotEmpty(product_area)) {
String areas = "(";
for (int i = 0; i < product_area.length; i++) {
if (i != product_area.length - 1) {
areas += "'" + product_area[i] + "',";
} else {
areas += "'" + product_area[i] + "')";
}
}
map.put("areas", areas);
}
if (ObjectUtil.isNotNull(ivt_flag)) {
StringJoiner joiner = new StringJoiner(",", "(", ")");
for (String type : ivt_flag) {
joiner.add("'" + type + "'");
}
map.put("rein_flag", joiner.toString());
}
//获取人员对应的仓库
UserStorServiceImpl userStorService = new UserStorServiceImpl();
String in_stor_id = userStorService.getInStor();
if (ObjectUtil.isNotEmpty(in_stor_id)) {
map.put("in_stor_id", in_stor_id);
}
JSONObject jsonObject = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "a.instorage_time desc,a.package_box_sn");
return jsonObject;
}
@Override
public List<StructivtDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("st_ivt_structivt");

View File

@@ -209,6 +209,166 @@
ENDPAGEQUERY
ENDIF
IF 输入.flag = "11"
PAGEQUERY
SELECT
a.*
FROM
(
SELECT
ivt.*,
sub.sap_pcsn,
sub.package_box_sn,
sub.quanlity_in_box,
sub.sale_order_name,
sub.box_weight,
case when plan.paper_tube_or_FRP = '1' then '纸管' when plan.paper_tube_or_FRP = '2' then 'FRP管' end AS paper_type,
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_material when plan.paper_tube_or_FRP = '2' then plan.FRP_material end AS paper_code,
case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name,
CASE
WHEN SUBSTRING( sub.container_name, 1, 2 ) = 'BB' THEN
CASE
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2'
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1'
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3'
END
WHEN SUBSTRING( sub.container_name, 1, 2 ) <> 'BB' THEN
CASE
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2'
WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1'
WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3'
END
END AS sub_type,
DATEDIFF( NOW(), dis.confirm_time ) AS stock_age,
DATEDIFF( NOW(), sub.date_of_production ) AS produce_age,
sub.joint_type,
dis.confirm_time
FROM
(
SELECT
StructIvt.*,
attr.sect_id,
attr.sect_code,
attr.sect_name,
attr.stor_name,
attr.storagevehicle_code,
mater.material_code,
mater.material_name,
unit.unit_name,
region.region_name
FROM
ST_IVT_StructIvt StructIvt
inner JOIN st_ivt_structattr attr ON StructIvt.struct_id = attr.struct_id
inner JOIN st_ivt_sectattr sect ON sect.sect_id = attr.sect_id
inner JOIN md_me_materialbase mater ON mater.material_id = StructIvt.material_id
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = StructIvt.qty_unit_id
LEFT JOIN SCH_BASE_Region region ON region.region_id = StructIvt.region_id
WHERE
attr.lock_type = '88'
and attr.stor_id in 输入.in_stor_id
OPTION 输入.struct <> ""
(
StructIvt.struct_code like 输入.struct or
StructIvt.struct_name like 输入.struct
)
ENDOPTION
OPTION 输入.material <> ""
(
mater.material_code like 输入.material or
mater.material_name like 输入.material
)
ENDOPTION
OPTION 输入.pcsn <> ""
StructIvt.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.quality_scode <> ""
StructIvt.quality_scode = 输入.quality_scode
ENDOPTION
OPTION 输入.is_virtual = "0"
sect.sect_type_attr <> '09'
ENDOPTION
OPTION 输入.is_virtual = "1"
sect.sect_type_attr = '09'
ENDOPTION
OPTION 输入.stor_id <> ""
attr.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.sect_id <> ""
attr.sect_id = 输入.sect_id
ENDOPTION
OPTION 输入.ivt_status = "canuse_qty"
StructIvt.canuse_qty > 0
ENDOPTION
OPTION 输入.ivt_status = "warehousing_qty"
StructIvt.warehousing_qty > 0
ENDOPTION
OPTION 输入.ivt_status = "frozen_qty"
StructIvt.frozen_qty > 0
ENDOPTION
) ivt
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = ivt.pcsn AND ivt.storagevehicle_code = sub.package_box_sn
LEFT JOIN (SELECT
container_name,
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
MAX(paper_tube_material) AS paper_tube_material,
MAX(paper_tube_description) AS paper_tube_description,
MAX(paper_tube_model) AS paper_tube_model,
MAX(FRP_material) AS FRP_material,
MAX(FRP_description) AS FRP_description,
MAX(FRP_model) AS FRP_model
FROM
pdm_bi_slittingproductionplan plan1
WHERE
plan1.is_delete = '0'
GROUP BY container_name) plan ON plan.container_name = sub.container_name
LEFT JOIN (
SELECT
(
CASE
WHEN MAX(mst.bill_type) = '0001' THEN MIN( mst.confirm_time )
ELSE MAX( mst.confirm_time )
END
) AS confirm_time,
dis.pcsn
FROM
st_ivt_iostorinvdis dis
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
WHERE
mst.io_type = '0'
AND mst.bill_type IN ('0001','0006','0007')
AND mst.is_delete = '0'
GROUP BY
dis.pcsn
) dis ON dis.pcsn = ivt.pcsn
WHERE
1 = 1
OPTION 输入.areas <> ""
(LEFT(sub.container_name,2) IN 输入.areas OR SUBSTRING(sub.container_name,2,2) IN 输入.areas)
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn like 输入.sap_pcsn
ENDOPTION
OPTION 输入.package_box_sn <> ""
sub.package_box_sn like 输入.package_box_sn
ENDOPTION
OPTION 输入.sale_order_name <> ""
sub.sale_order_name like 输入.sale_order_name
ENDOPTION
OPTION 输入.rein_flag <> ""
IFNULL(sub.sub_type,'') in 输入.rein_flag
ENDOPTION
) a
WHERE 1=1
OPTION 输入.sub_type <> ""
a.sub_type = 输入.sub_type
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT

View File

@@ -0,0 +1,49 @@
package org.nl.wms.control.controller;
import com.alibaba.fastjson.JSONObject;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.control.service.IStIvtControlmstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* <p>
* 库存管控主表 前端控制器
* </p>
*
* @author author
* @since 2025-04-08
*/
@RestController
@RequestMapping("/api/control")
public class StIvtControlmstController {
@Autowired
private IStIvtControlmstService iStIvtControlmstService;
@GetMapping
@Log("分页查询")
public ResponseEntity<Object> queryAll(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(iStIvtControlmstService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping("/queryDtl")
@Log("查询明细")
public ResponseEntity<Object> queryAll(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(iStIvtControlmstService.queryDtl(whereJson), HttpStatus.OK);
}
@PostMapping("/addSubmit")
@Log("新增管控单")
public ResponseEntity<Object> addSubmit(@RequestBody JSONObject whereJson) {
iStIvtControlmstService.addSubmit(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
}

View File

@@ -0,0 +1,24 @@
package org.nl.wms.control.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.control.service.dao.StIvtControldtl;
import java.util.List;
/**
* <p>
* 库存管控明细表 服务类
* </p>
*
* @author author
* @since 2025-04-08
*/
public interface IStIvtControldtlService extends IService<StIvtControldtl> {
/**
* 新增明细
* @param <T> 参数
*/
<T extends JSONObject>void instDtl(T whereJson);
}

View File

@@ -0,0 +1,58 @@
package org.nl.wms.control.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.control.service.dao.StIvtControlmst;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* <p>
* 库存管控主表 服务类
* </p>
*
* @author author
* @since 2025-04-08
*/
public interface IStIvtControlmstService extends IService<StIvtControlmst> {
/**
* 分页查询
* @param whereJson 查询条件
* @param page 分页参数
* @return Map<String, Object>
*/
Object queryAll(Map whereJson, Pageable page);
/**
* 新增
* @param whereJson {
* bill_type: 0-1-2
* biz_date: 日期
* control_code:
* detail_count: 明细数
* remark: 备注
* stor_id: 仓库id
* total_qty: 总数量
* open_type: 0-锁定 1-解控 2-出库
* tableData: [
* box_no: 木箱号
* canuse_qty: 库存数
* material_id: 物料标识
* pcsn: 批次
* sap_pcsn: sap批次
* struct_id: 仓位编码
* ]
* }
*/
void addSubmit(JSONObject whereJson);
/**
* 查询明细
* @param whereJson 主表dao
* @return List明细
*/
List<JSONObject> queryDtl(JSONObject whereJson);
}

View File

@@ -0,0 +1,73 @@
package org.nl.wms.control.service.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
* 库存管控明细表
* </p>
*
* @author author
* @since 2025-04-08
*/
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("st_ivt_controldtl")
public class StIvtControldtl implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 管控明细标识
*/
@TableId
private String controldtl_id;
/**
* 管控标识
*/
private String control_id;
/**
* 明细序号
*/
private BigDecimal seq_no;
/**
* 物料标识
*/
private String material_id;
/**
* 批次
*/
private String pcsn;
/**
* 木箱号
*/
private String box_no;
/**
* 重量
*/
private BigDecimal qty;
/**
* 仓位标识
*/
private String struct_id;
}

View File

@@ -0,0 +1,88 @@
package org.nl.wms.control.service.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* <p>
* 库存管控主表
* </p>
*
* @author author
* @since 2025-04-08
*/
@Data
@Builder
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("st_ivt_controlmst")
public class StIvtControlmst implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 管控标识
*/
@TableId
private String control_id;
/**
* 单据编号
*/
private String control_code;
/**
* 业务日期
*/
private String biz_date;
/**
* 仓库标识
*/
private String stor_id;
/**
* 总重量
*/
private BigDecimal total_qty;
/**
* 明细数
*/
private BigDecimal detail_count;
/**
* 管控类型
*/
private String bill_type;
/**
* 备注
*/
private String remark;
/**
* 制单人
*/
private String input_optid;
/**
* 制单人姓名
*/
private String input_optname;
/**
* 制单时间
*/
private String input_time;
}

View File

@@ -0,0 +1,27 @@
package org.nl.wms.control.service.dao.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.control.service.dao.StIvtControldtl;
import java.util.List;
/**
* <p>
* 库存管控明细表 Mapper 接口
* </p>
*
* @author author
* @since 2025-04-08
*/
public interface StIvtControldtlMapper extends BaseMapper<StIvtControldtl> {
/**
* 查询明细
* @param query 查询参数
* @return List<JSONObject>明细集合
*/
List<JSONObject> queryDtl(@Param("query") JSONObject query);
}

View File

@@ -0,0 +1,28 @@
<?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.control.service.dao.mapper.StIvtControldtlMapper">
<select id="queryDtl" resultType="com.alibaba.fastjson.JSONObject">
SELECT
dtl.*,
mater.material_code,
mater.material_name,
sub.sap_pcsn,
attr.struct_code
FROM
st_ivt_controldtl dtl
LEFT JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
LEFT JOIN pdm_bi_subpackagerelation sub ON sub.container_name = dtl.pcsn AND sub.package_box_sn = dtl.box_no
LEFT JOIN st_ivt_structattr attr ON attr.struct_id = dtl.struct_id
<where>
1 = 1
<if test="query.control_id != null and query.control_id != ''">
and dtl.control_id = #{query.control_id}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,28 @@
package org.nl.wms.control.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.control.service.dao.StIvtControlmst;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* <p>
* 库存管控主表 Mapper 接口
* </p>
*
* @author author
* @since 2025-04-08
*/
public interface StIvtControlmstMapper extends BaseMapper<StIvtControlmst> {
/**
* 分页查询
* @param query: 查询条件
* @param pageQuery: 分页工具
* @return List<Map>
*/
List<Map> queryAll(@Param("query") Map query, @Param("pageQuery") Pageable pageQuery);
}

View File

@@ -0,0 +1,57 @@
<?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.control.service.dao.mapper.StIvtControlmstMapper">
<select id="queryAll" resultType="java.util.Map">
SELECT
mst.*,
attr.stor_code,
attr.stor_name
FROM
st_ivt_controlmst mst
INNER JOIN (
SELECT
control_id
FROM
st_ivt_controldtl dtl
WHERE
1 = 1
<if test="query.box_no != null and query.box_no != ''">
and box_no = #{query.box_no}
</if>
<if test="query.pcsn != null and query.pcsn != ''">
and pcsn = #{query.pcsn}
</if>
GROUP BY control_id
) dtl ON dtl.control_id = mst.control_id
LEFT JOIN st_ivt_bsrealstorattr attr ON attr.stor_id = mst.stor_id
<where>
1 = 1
<if test="query.control_code != null and query.control_code != ''">
and mst.control_code LIKE '%${query.control_code}%'
</if>
<if test="query.stor_id != null and query.stor_id != ''">
and mst.stor_id = #{query.stor_id}
</if>
<if test="query.begin_time != null and query.begin_time != ''">
and mst.input_time > #{query.begin_time}
</if>
<if test="query.end_time != null and query.end_time != ''">
and #{query.end_time} > mst.input_time
</if>
<if test="query.bill_type != null and query.bill_type != ''">
and mst.bill_type = #{query.bill_type}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,49 @@
package org.nl.wms.control.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.common.utils.IdUtil;
import org.nl.wms.control.service.IStIvtControldtlService;
import org.nl.wms.control.service.dao.StIvtControldtl;
import org.nl.wms.control.service.dao.mapper.StIvtControldtlMapper;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 库存管控明细表 服务实现类
* </p>
*
* @author author
* @since 2025-04-08
*/
@Service
public class StIvtControldtlServiceImpl extends ServiceImpl<StIvtControldtlMapper, StIvtControldtl> implements IStIvtControldtlService {
@Override
public <T extends JSONObject> void instDtl(T whereJson) {
String control_id = whereJson.getString("control_id");
List<JSONObject> tableDataList = whereJson.getJSONArray("tableData").toJavaList(JSONObject.class);
List<StIvtControldtl> paramList = new ArrayList<>();
for (int i = 0; i < tableDataList.size(); i++) {
JSONObject json = tableDataList.get(i);
StIvtControldtl dtlDao = StIvtControldtl.builder()
.controldtl_id(IdUtil.getStringId())
.control_id(control_id)
.seq_no(BigDecimal.valueOf(i + 1))
.material_id(json.getString("material_id"))
.pcsn(json.getString("pcsn"))
.box_no(json.getString("box_no"))
.qty(json.getBigDecimal("canuse_qty"))
.struct_id(json.getString("struct_id"))
.build();
paramList.add(dtlDao);
}
this.saveBatch(paramList);
}
}

View File

@@ -0,0 +1,186 @@
package org.nl.wms.control.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
import org.nl.common.TableDataInfo;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.control.service.IStIvtControldtlService;
import org.nl.wms.control.service.IStIvtControlmstService;
import org.nl.wms.control.service.dao.StIvtControlmst;
import org.nl.wms.control.service.dao.mapper.StIvtControldtlMapper;
import org.nl.wms.control.service.dao.mapper.StIvtControlmstMapper;
import org.nl.wms.st.inbill.service.CheckOutBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 库存管控主表 服务实现类
* </p>
*
* @author author
* @since 2025-04-08
*/
@Service
public class StIvtControlmstServiceImpl extends ServiceImpl<StIvtControlmstMapper, StIvtControlmst> implements IStIvtControlmstService {
/*
* 明细服务
*/
@Autowired
private IStIvtControldtlService iStIvtControldtlService;
/*
* 明细mapper
*/
@Autowired
private StIvtControldtlMapper stIvtControldtlMapper;
/*
* 出库服务
*/
@Autowired
private CheckOutBillService checkOutBillService;
/**
* 二期出出库服务
*/
@Autowired
private IStIvtIostorinvOutService iStIvtIostorinvOutService;
@Override
public Object queryAll(Map query, Pageable pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPageNumber() + 1, pageQuery.getPageSize());
page.setOrderBy("input_time DESC");
List<Map> mst_detail = this.baseMapper.queryAll(query, pageQuery);
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void addSubmit(JSONObject whereJson) {
// 新增主表
StIvtControlmst mstDao = StIvtControlmst.builder()
.control_id(IdUtil.getStringId())
.control_code(CodeUtil.getNewCode("CONTORL_CODE"))
.biz_date(whereJson.getString("biz_date").substring(0, 10))
.stor_id(whereJson.getString("stor_id"))
.total_qty(whereJson.getBigDecimal("total_qty"))
.detail_count(BigDecimal.valueOf(whereJson.getJSONArray("tableData").size()))
.bill_type(whereJson.getString("bill_type"))
.remark(whereJson.getString("remark"))
.input_optid(SecurityUtils.getCurrentUserId())
.input_optname(SecurityUtils.getCurrentNickName())
.input_time(DateUtil.now())
.build();
this.save(mstDao);
// 新增明细
whereJson.put("control_id",mstDao.getControl_id());
iStIvtControldtlService.instDtl(whereJson);
// 锁定仓位库存
List<JSONObject> tableDataList = whereJson.getJSONArray("tableData").toJavaList(JSONObject.class);
lockStruct(whereJson.getString("open_type"),tableDataList);
// 如果是出库则生成出库单据
if (whereJson.getString("open_type").equals("2")) {
whereJson.put("source_code",mstDao.getControl_code());
createIos(whereJson);
}
}
@Override
public List<JSONObject> queryDtl(JSONObject whereJson) {
return stIvtControldtlMapper.queryDtl(whereJson);
}
/**
* 锁定仓位库存
* @param open_type 类型
* @param tableDataList 仓库库存集合
*/
private void lockStruct(String open_type, List<JSONObject> tableDataList) {
String struct_id_in = tableDataList.stream()
.map(row -> row.getString("struct_id"))
.collect(Collectors.joining("','"));
JSONObject param = new JSONObject();
param.put("lock_type", open_type.equals("0") ? "88" : "1");
param.put("update_optid", SecurityUtils.getCurrentUserId());
param.put("update_optname", SecurityUtils.getCurrentNickName());
param.put("update_time",DateUtil.now() );
WQLObject.getWQLObject("st_ivt_structattr")
.update(param,"struct_id IN ('"+struct_id_in+"')");
}
/**
* 创建出库单据并分配
* @param whereJson 、
*/
private void createIos(JSONObject whereJson) {
JSONArray dtlAttr = whereJson.getJSONArray("tableData");
// 组织数据
JSONObject jsonOutMst = new JSONObject();
jsonOutMst.put("stor_id", whereJson.getString("stor_id"));
jsonOutMst.put("stor_code", whereJson.getString("stor_code"));
jsonOutMst.put("stor_name", whereJson.getString("stor_name"));
jsonOutMst.put("detail_count", dtlAttr.size());
jsonOutMst.put("bill_status", "10");
jsonOutMst.put("create_mode", "03");
jsonOutMst.put("biz_date", DateUtil.now());
jsonOutMst.put("io_type", "1");
jsonOutMst.put("buss_type", "1099");
jsonOutMst.put("bill_type", "1099");
jsonOutMst.put("source_name", "质量管控单:"+whereJson.getString("source_code"));
JSONArray tableData = new JSONArray();
for (int i = 0; i < dtlAttr.size(); i++) {
JSONObject json = dtlAttr.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("pcsn", json.getString("pcsn"));
jsonDtl.put("box_no", json.getString("box_no"));
jsonDtl.put("material_id", json.getString("material_id"));
jsonDtl.put("qty_unit_id", json.getLongValue("qty_unit_id"));
jsonDtl.put("qty_unit_name", json.getString("qty_unit_name"));
jsonDtl.put("plan_qty", json.getDoubleValue("plan_qty"));
tableData.add(jsonDtl);
}
// 调用出库新增并分配
jsonOutMst.put("tableData", tableData);
String iostorinv_id = checkOutBillService.insertDtl(jsonOutMst);
JSONObject jsonObject = new JSONObject();
jsonObject.put("iostorinv_id", iostorinv_id);
// 分配
if (whereJson.getString("stor_id").equals(IOSEnum.STOR_ID.code("二期"))) {
jsonObject.put("div_type", "1");
iStIvtIostorinvOutService.allDiv(jsonObject);
} else {
checkOutBillService.allDiv(jsonObject);
}
}
}

View File

@@ -14,9 +14,11 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum;
import org.nl.common.utils.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@@ -25,6 +27,8 @@ import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.system.service.dept.ISysUserDeptService;
import org.nl.system.service.dept.dao.SysUserDept;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
@@ -72,6 +76,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
private final HandMoveStorAcsTask moveStorAcsTask;
private final InAndOutReturnService inAndOutReturnService;
private final RedissonClient redissonClient;
private final ISysUserDeptService iSysUserDeptService;
@Override
public Map<String, Object> pageQuery(Map whereJson, Pageable page, String[] stor_id, String[] bill_status, String[] bill_type) {
@@ -232,6 +238,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
map.put("stor_id", MapUtil.getStr(whereJson, "stor_id"));
map.put("lock_type", MapUtil.getStr(whereJson, "lock_type"));
map.put("canuse_qty", "0");
if (StrUtil.isNotEmpty(map.get("material_code"))) {
@@ -823,6 +830,32 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
@Override
public JSONArray getOutBillDtl(Map whereJson) {
// 判断此人员是否有权限
JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'")
.uniqueResult(0);
String currentUserId = SecurityUtils.getCurrentUserId();
List<SysUserDept> deptList = iSysUserDeptService.list(
new QueryWrapper<SysUserDept>().lambda()
.eq(SysUserDept::getUser_id, currentUserId)
);
if (mst.getString("bill_type").equals(IOSEnum.OUT_TYPE.code("管控出库"))) {
boolean flag = deptList.stream()
.anyMatch(row -> row.getDept_id().toString().equals("9"));
if (!flag) {
throw new BadRequestException("当前为【管控出库】您当前没有分配权限!");
}
} else {
boolean flag = deptList.stream()
.anyMatch(row -> row.getDept_id().toString().equals("9"));
if (flag) {
throw new BadRequestException("您当前没有分配权限!");
}
}
whereJson.put("flag", "2");
JSONArray jo = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParamMap((HashMap) whereJson)
@@ -4944,7 +4977,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
}*/
if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))) {
if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))
|| "1099".equals(out_jo.getString("bill_type"))
) {
//如果为返检出库或者改切出库删除对应的包装关系
JSONArray dis_rows = new JSONArray();
if (jo_mst.getString("is_overdue").equals("1")) {
@@ -5559,7 +5594,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
mst_wql.insert(jo_mst);
}
if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))) {
if ("1003".equals(out_jo.getString("bill_type")) || "1006".equals(out_jo.getString("bill_type"))
|| "1099".equals(out_jo.getString("bill_type"))
) {
//如果为返检出库或者改切出库删除对应的包装关系
JSONArray dis_rows = new JSONArray();
if (jo_mst.getString("is_overdue").equals("1")) {

View File

@@ -56,6 +56,7 @@
输入.thickness_request TYPEAS s_string
输入.width_standard TYPEAS s_string
输入.task_group_id TYPEAS s_string
输入.lock_type TYPEAS s_string
输入.in_stor_id TYPEAS f_string
输入.struct_codes TYPEAS f_string
输入.storIds TYPEAS f_string
@@ -960,6 +961,10 @@
attr.struct_code like 输入.struct_code
ENDOPTION
OPTION 输入.lock_type <> ""
attr.lock_type = 输入.lock_type
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -269,7 +269,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
}
// 返检出库回传mes
if (StrUtil.equals(bill_type, "1006")) {
if (StrUtil.equals(bill_type, "1006") || StrUtil.equals(bill_type, "1099")) {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
// 判断是否有未完成的任务
ifUnTask(disArr.toJavaList(JSONObject.class));
@@ -1546,7 +1546,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
}
// 返检出库回传mes
if (StrUtil.equals(bill_type, "1006")) {
if (StrUtil.equals(bill_type, "1006") || StrUtil.equals(bill_type, "1099")) {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
// 判断是否有未完成的任务
ifUnTask(disArr.toJavaList(JSONObject.class));