add:出库管理
This commit is contained in:
@@ -33,5 +33,11 @@ public class PdmBiSubpackagerelationController {
|
||||
return new ResponseEntity<>(iPdmBiSubpackagerelationService.pageQuery(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getTestOut")
|
||||
@Log("出库新增物料测试")
|
||||
public ResponseEntity<Object> getTestOut(SubPackageQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(iPdmBiSubpackagerelationService.getTestOut(query,page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,4 +21,12 @@ public interface IPdmBiSubpackagerelationService extends IService<PdmBiSubpackag
|
||||
* @return /
|
||||
*/
|
||||
Object pageQuery(SubPackageQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 测试
|
||||
* @param query
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
Object getTestOut(SubPackageQuery query, PageQuery page);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pdm.subpackage.service.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -20,4 +21,12 @@ import java.util.Map;
|
||||
public interface PdmBiSubpackagerelationMapper extends BaseMapper<PdmBiSubpackagerelation> {
|
||||
|
||||
List<Map> getPageQuery(@Param("query") SubPackageQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 出库新增测试
|
||||
* @param query
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> getTestOut(@Param("query") SubPackageQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -46,4 +46,46 @@
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getTestOut" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
sub.date_of_FG_inbound AS instorage_time,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
sub.package_box_sn AS box_no,
|
||||
sub.container_name AS pcsn,
|
||||
sub.sap_pcsn,
|
||||
sub.net_weight AS plan_qty,
|
||||
'KG' AS qty_unit_name,
|
||||
'1' AS qty_unit_id
|
||||
|
||||
FROM
|
||||
pdm_bi_subpackagerelation sub
|
||||
LEFT JOIN md_base_material mater ON mater.material_code = sub.product_name
|
||||
<where>
|
||||
1 = 1
|
||||
|
||||
<if test="query.start_time != null">
|
||||
and create_time >= #{query.start_time}
|
||||
</if>
|
||||
|
||||
<if test="query.end_time != null">
|
||||
and #{query.end_time} >= create_time
|
||||
</if>
|
||||
|
||||
<if test="query.package_box_sn != null and query.package_box_sn != ''">
|
||||
and package_box_sn = #{query.package_box_sn}
|
||||
</if>
|
||||
|
||||
<if test="query.list != null and query.list != ''">
|
||||
and package_box_sn in
|
||||
<foreach item="item" index="index" collection="query.list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -6,6 +6,8 @@ import org.nl.common.domain.query.QParam;
|
||||
import org.nl.common.enums.QueryTEnum;
|
||||
import org.nl.wms.pdm.subpackage.service.dao.PdmBiSubpackagerelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* @author LXY
|
||||
* @Date 2023/11/10 14:49
|
||||
@@ -26,6 +28,7 @@ public class SubPackageQuery extends BaseQuery<PdmBiSubpackagerelation> {
|
||||
|
||||
private String sap_pcsn;
|
||||
|
||||
private List<String> list;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.pdm.subpackage.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -35,4 +36,15 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTestOut(SubPackageQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("package_box_sn DESC");
|
||||
List<JSONObject> mst_detail = this.baseMapper.getTestOut(query, pageQuery);
|
||||
|
||||
TableDataInfo<JSONObject> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package org.nl.wms.storage_manage.ios.controller.iostorInv;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dto.IostorInvQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出库单主表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/stIvtIostorinv/outBill")
|
||||
public class StIvtIostorinvOutController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvOutService stIvtIostorinvOutService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询出库单")
|
||||
public ResponseEntity<Object> query(IostorInvQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(stIvtIostorinvOutService.pageQuery(query, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增出库单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("新增出库单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除入库单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids){
|
||||
stIvtIostorinvOutService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryBoxMater")
|
||||
@Log("查询木箱对应子卷")
|
||||
public ResponseEntity<Object> queryBoxMater(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(stIvtIostorinvOutService.queryBoxMater(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getIosDtl")
|
||||
@Log("获取明细")
|
||||
public ResponseEntity<Object> getIosDtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(stIvtIostorinvOutService.getIosDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getIosDis")
|
||||
@Log("获取分配明细")
|
||||
public ResponseEntity<Object> getIosDis(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(stIvtIostorinvOutService.getIosDis(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/moneySubmit")
|
||||
@Log("发货信息保存")
|
||||
public ResponseEntity<Object> moneySubmit(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.moneySubmit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/allDiv")
|
||||
@Log("分配")
|
||||
public ResponseEntity<Object> allDiv(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.allDiv(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/allCancel")
|
||||
@Log("取消分配")
|
||||
public ResponseEntity<Object> allCancel(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.allCancel(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/allSetPoint")
|
||||
@Log("全部设置站点")
|
||||
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.allSetPoint(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getIosDisTask")
|
||||
@Log("获取明细任务")
|
||||
public ResponseEntity<Object> getIosDisTask(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(stIvtIostorinvOutService.getIosDisTask(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/issueTask")
|
||||
@Log("下发任务")
|
||||
public ResponseEntity<Object> issueTask(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.issueTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmTask")
|
||||
@Log("标识完成任务")
|
||||
public ResponseEntity<Object> confirmTask(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.confirmTask(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("单据强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
stIvtIostorinvOutService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package org.nl.wms.storage_manage.ios.service.iostorInv;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dto.IostorInvQuery;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出库单主表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
public interface IStIvtIostorinvOutService extends IService<StIvtIostorinv> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query,page /
|
||||
* @return Object
|
||||
*/
|
||||
Object pageQuery(IostorInvQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询木箱对应子卷
|
||||
* @param whereJson {
|
||||
* 'data': [子卷信息]
|
||||
* }
|
||||
* @return JSONArray
|
||||
*/
|
||||
JSONArray queryBoxMater(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 新增出库单
|
||||
* @param whereJson
|
||||
* {
|
||||
* stor_id:
|
||||
* stor_code:
|
||||
* stor_name:
|
||||
* total_qty:
|
||||
* detail_count:
|
||||
* bill_type:
|
||||
* remark:
|
||||
* biz_date:
|
||||
* out_stor_id:
|
||||
* create_mode:
|
||||
* tableData: [明细]
|
||||
* }
|
||||
*/
|
||||
void create(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 修改出库单
|
||||
* @param whereJson
|
||||
* {
|
||||
* stor_id:
|
||||
* stor_code:
|
||||
* stor_name:
|
||||
* total_qty:
|
||||
* detail_count:
|
||||
* remark:
|
||||
* biz_date:
|
||||
* tableData: [明细]
|
||||
* }
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 删除入库单
|
||||
* @param ids /
|
||||
*/
|
||||
void delete(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinv_id
|
||||
* }
|
||||
* @return JSONArray
|
||||
*/
|
||||
JSONArray getIosDtl(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取分配明细
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinv_id
|
||||
* }
|
||||
* @return JSONArray
|
||||
*/
|
||||
JSONArray getIosDis(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 发货信息保存
|
||||
* @param whereJson
|
||||
* {
|
||||
* 主表字段
|
||||
* }
|
||||
*/
|
||||
void moneySubmit(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 分配
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinv_id:
|
||||
* iostorinvdtl_id: 为空全部分配,否则分配一条
|
||||
* }
|
||||
*/
|
||||
void allDiv(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 取消分配
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinv_id:
|
||||
* iostorinvdtl_id: 为空全部分配,否则分配一条
|
||||
* }
|
||||
*/
|
||||
void allCancel(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 全部设置站点
|
||||
* @param whereJson
|
||||
* {
|
||||
* point_code: 起点
|
||||
* iostorinv_id:
|
||||
* checked: 是否异常出库口
|
||||
* }
|
||||
*/
|
||||
void allSetPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取明细任务
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinvdtl_id:
|
||||
* checked:是否显示未完成任务
|
||||
* }
|
||||
* @return JSONArray
|
||||
*/
|
||||
JSONArray getIosDisTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 下发任务
|
||||
* @param whereJson
|
||||
* {
|
||||
* 分配明细
|
||||
* }
|
||||
*/
|
||||
void issueTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 标识完成任务
|
||||
* @param whereJson
|
||||
* {
|
||||
* 分配明细
|
||||
* }
|
||||
*/
|
||||
void confirmTask(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 单据强制确认
|
||||
* @param whereJson
|
||||
* {
|
||||
* iostorinv_id
|
||||
* }
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
}
|
||||
@@ -19,5 +19,11 @@ import java.util.Map;
|
||||
*/
|
||||
public interface StIvtIostorinvMapper extends BaseMapper<StIvtIostorinv> {
|
||||
|
||||
/**
|
||||
* 查询入库单
|
||||
* @param query
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
List<Map> getPageQuery(@Param("query") IostorInvQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.storage_manage.ios.service.iostorInv.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.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dto.IostorInvQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
public interface StIvtIostorinvOutMapper extends BaseMapper<StIvtIostorinv> {
|
||||
|
||||
/**
|
||||
* 查询出库单
|
||||
* @param query
|
||||
* @param pageQuery
|
||||
* @return
|
||||
*/
|
||||
List<Map> getPageQuery(@Param("query") IostorInvQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
@@ -0,0 +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.ios.service.iostorInv.dao.mapper.StIvtIostorinvOutMapper">
|
||||
|
||||
<select id="getPageQuery" resultType="java.util.Map">
|
||||
SELECT
|
||||
mst.*
|
||||
FROM
|
||||
st_ivt_iostorinv mst
|
||||
<where>
|
||||
mst.is_delete = '0'
|
||||
AND
|
||||
io_type = '1'
|
||||
|
||||
<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_type != null and query.bill_type != ''">
|
||||
and mst.bill_type = #{query.bill_type}
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.bill_code = #{query.bill_code}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,625 @@
|
||||
package org.nl.wms.storage_manage.ios.service.iostorInv.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.wms.pdm.subpackage.service.dao.mapper.PdmBiSubpackagerelationMapper;
|
||||
import org.nl.wms.pdm.subpackage.service.dto.SubPackageQuery;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.storage_manage.ios.enums.IOSEnum;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.IStIvtIostorinvOutService;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdisService;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.IStIvtIostorinvdtlService;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinv;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdis;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dao.StIvtIostorinvdtl;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dao.mapper.StIvtIostorinvOutMapper;
|
||||
import org.nl.wms.storage_manage.ios.service.iostorInv.dto.IostorInvQuery;
|
||||
import org.nl.wms.storage_manage.ios.util.IosOutRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
@Service
|
||||
public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutMapper, StIvtIostorinv> implements IStIvtIostorinvOutService {
|
||||
|
||||
@Autowired
|
||||
private PdmBiSubpackagerelationMapper pdmBiSubpackagerelationMapper; // 子卷包装mapper
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvdtlService iStIvtIostorinvdtlService; // 出入库明细服务
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvdisService iStIvtIostorinvdisService; // 出入库分配明细服务
|
||||
|
||||
@Autowired
|
||||
private IosOutRuleService iosOutRuleService; // 出库分配规则
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService; // 点位服务
|
||||
|
||||
@Autowired
|
||||
private ISchBaseTaskService iSchBaseTaskService; // 任务服务
|
||||
|
||||
@Override
|
||||
public Object pageQuery(IostorInvQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("input_time DESC");
|
||||
List<Map> mst_detail = this.baseMapper.getPageQuery(query, pageQuery);
|
||||
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray queryBoxMater(JSONObject whereJson) {
|
||||
List<String> collect = whereJson.getJSONArray("data").stream()
|
||||
.map(row -> JSON.parseObject(JSONObject.toJSONString(row)))
|
||||
.map(row -> row.getString("box_no"))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
SubPackageQuery subPackageQuery = new SubPackageQuery();
|
||||
subPackageQuery.setList(collect);
|
||||
List<JSONObject> resultList = pdmBiSubpackagerelationMapper.getTestOut(subPackageQuery, null);
|
||||
|
||||
return JSONArray.parseArray(JSONObject.toJSONString(resultList));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(JSONObject whereJson) {
|
||||
|
||||
// 组织主表数据
|
||||
StIvtIostorinv mstDao = StIvtIostorinv.builder()
|
||||
.iostorinv_id(IdUtil.getStringId())
|
||||
.bill_code(CodeUtil.getNewCode("OUT_IVN_CODE"))
|
||||
.bill_status(IOSEnum.BILL_STATUS.code("生成"))
|
||||
.create_mode(IOSEnum.CREATE_MODE.code("PC产生"))
|
||||
.io_type(IOSEnum.IO_TYPE.code("出库"))
|
||||
.input_optid(SecurityUtils.getCurrentUserId())
|
||||
.input_optname(SecurityUtils.getCurrentNickName())
|
||||
.input_time(DateUtil.now())
|
||||
.build();
|
||||
|
||||
updateMst(mstDao, whereJson);
|
||||
|
||||
this.save(mstDao);
|
||||
|
||||
// 组织插入明细、分配的数据
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
|
||||
ArrayList<JSONObject> dtlList = new ArrayList<>();
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
|
||||
JSONObject dtl = new JSONObject();
|
||||
dtl.put("material_code",json.getString("material_code"));
|
||||
dtl.put("pcsn",json.getString("pcsn"));
|
||||
dtl.put("plan_qty",json.getString("plan_qty"));
|
||||
dtl.put("box_no",json.getString("box_no"));
|
||||
dtlList.add(dtl);
|
||||
}
|
||||
|
||||
// 插入明细
|
||||
iStIvtIostorinvdtlService.insertDtl(mstDao.getIostorinv_id(), dtlList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(JSONObject whereJson) {
|
||||
StIvtIostorinv mstDao = this.getById(whereJson.getString("iostorinv_id"));
|
||||
|
||||
// 组织主表数据
|
||||
updateMst(mstDao, whereJson);
|
||||
|
||||
mstDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
|
||||
// 组织插入明细、分配的数据
|
||||
JSONArray tableData = whereJson.getJSONArray("tableData");
|
||||
|
||||
ArrayList<JSONObject> dtlList = new ArrayList<>();
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.getJSONObject(i);
|
||||
|
||||
JSONObject dtl = new JSONObject();
|
||||
dtl.put("material_code",json.getString("material_code"));
|
||||
dtl.put("pcsn",json.getString("pcsn"));
|
||||
dtl.put("plan_qty",json.getString("plan_qty"));
|
||||
dtl.put("box_no",json.getString("box_no"));
|
||||
dtlList.add(dtl);
|
||||
}
|
||||
|
||||
// 插入明细
|
||||
iStIvtIostorinvdtlService.insertDtl(mstDao.getIostorinv_id(), dtlList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtIostorinv>().lambda()
|
||||
.set(StIvtIostorinv::getIs_delete, IOSEnum.IS_NOTANDYES.code("是"))
|
||||
.eq(StIvtIostorinv::getIostorinv_id, id)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getIosDtl(JSONObject whereJson) {
|
||||
return iStIvtIostorinvdtlService.getIosDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getIosDis(JSONObject whereJson) {
|
||||
return iStIvtIostorinvdisService.getIosDis(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void moneySubmit(JSONObject whereJson) {
|
||||
// JSONObject转实体类
|
||||
StIvtIostorinv mstDao = BeanUtil.copyProperties(whereJson,StIvtIostorinv.class);
|
||||
|
||||
mstDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void allDiv(JSONObject whereJson) {
|
||||
// 查出未分配的明细
|
||||
List<StIvtIostorinvdtl> dtlDaoList = new ArrayList<>();
|
||||
|
||||
// 判断是全部分配还是分配一条
|
||||
if (ObjectUtil.isEmpty(whereJson.getString("iostorinvdtl_id"))) {
|
||||
dtlDaoList = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
.in(StIvtIostorinvdtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"), IOSEnum.BILL_STATUS.code("分配中"))
|
||||
);
|
||||
} else {
|
||||
dtlDaoList = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
.eq(StIvtIostorinvdtl::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id"))
|
||||
.in(StIvtIostorinvdtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"), IOSEnum.BILL_STATUS.code("分配中"))
|
||||
);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(dtlDaoList)) throw new BadRequestException("没有需要分配的明细!");
|
||||
|
||||
List<JSONObject> ivtList = iosOutRuleService.getCancelIvt(whereJson); // 库存集合
|
||||
|
||||
List<JSONObject> disList = new ArrayList<>(); // 需插入分配明细集合
|
||||
|
||||
for (int i = 0; i < dtlDaoList.size(); i++) {
|
||||
StIvtIostorinvdtl dtlDao = dtlDaoList.get(i);
|
||||
|
||||
// 判断是否有批次
|
||||
if (ObjectUtil.isNotEmpty(dtlDao.getPcsn())) {
|
||||
// 根据批次找到对应库存
|
||||
List<JSONObject> ivtDaoList = ivtList.stream()
|
||||
.filter(row -> row.getString("pcsn").equals(dtlDao.getPcsn()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isEmpty(ivtDaoList))
|
||||
throw new BadRequestException("批次:"+dtlDao.getPcsn()+"无可用库存!");
|
||||
|
||||
JSONObject jsonDisParam = ivtDaoList.get(0);
|
||||
jsonDisParam.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
|
||||
jsonDisParam.put("iostorinv_id",dtlDao.getIostorinv_id());
|
||||
disList.add(updateDis(jsonDisParam));
|
||||
|
||||
// 更新明细
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
dtlDao.setAssign_qty(dtlDao.getUnassign_qty());
|
||||
dtlDao.setUnassign_qty(BigDecimal.valueOf(0));
|
||||
} else {
|
||||
// 无批次:根据物料和销售订单找库存
|
||||
double unassign_qty = dtlDao.getUnassign_qty().doubleValue();// 未分配重量
|
||||
double assign_qty = 0.00; // 已分配重量
|
||||
|
||||
// 符合条件的集合
|
||||
List<JSONObject> ivtDaoList = ivtList.stream()
|
||||
.filter(row -> row.getString("material_id").equals(dtlDao.getMaterial_id())
|
||||
&& row.getString("sale_order_name").equals(dtlDao.getSource_bill_code())
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (ObjectUtil.isEmpty(ivtDaoList))
|
||||
throw new BadRequestException("销售订单:"+dtlDao.getSource_bill_code()+"无可用库存!");
|
||||
|
||||
while (unassign_qty > 0) {
|
||||
|
||||
if (ivtDaoList.size() == 0)
|
||||
throw new BadRequestException("销售订单:"+dtlDao.getSource_bill_code()+"库存不足!");
|
||||
|
||||
// 找出相同箱号的子卷
|
||||
JSONObject jsonDis = ivtDaoList.get(0);
|
||||
List<JSONObject> boxList = ivtDaoList.stream()
|
||||
.filter(row -> row.getString("box_no").equals(jsonDis.getString("box_no")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
boxList.forEach(row -> {
|
||||
ivtDaoList.remove(row);
|
||||
|
||||
row.put("iostorinvdtl_id",dtlDao.getIostorinvdtl_id());
|
||||
row.put("iostorinv_id",dtlDao.getIostorinv_id());
|
||||
disList.add(updateDis(row));
|
||||
});
|
||||
|
||||
// 减去未分配重量
|
||||
double qty = boxList.stream()
|
||||
.map(row -> row.getDoubleValue("plan_qty"))
|
||||
.reduce(Double::sum)
|
||||
.orElse(0.00);
|
||||
|
||||
unassign_qty = NumberUtil.sub(unassign_qty, qty);
|
||||
|
||||
// 增加已分配重量
|
||||
assign_qty = NumberUtil.add(assign_qty,qty);
|
||||
}
|
||||
|
||||
// 更新明细
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
dtlDao.setAssign_qty(BigDecimal.valueOf(assign_qty));
|
||||
dtlDao.setUnassign_qty(BigDecimal.valueOf(0));
|
||||
}
|
||||
}
|
||||
|
||||
// 插入分配明细
|
||||
iStIvtIostorinvdisService.insetDis(disList);
|
||||
|
||||
// 锁住点位
|
||||
String pointCode_in = disList.stream()
|
||||
.map(row -> row.getString("point_code"))
|
||||
.distinct()
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
List<SchBasePoint> pointDaoList = iSchBasePointService.list(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.in(SchBasePoint::getPoint_code, "('" + pointCode_in + "')")
|
||||
);
|
||||
|
||||
iSchBasePointService.lockPoint(pointDaoList,IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
|
||||
// 更新明细状态
|
||||
iStIvtIostorinvdtlService.updateBatchById(dtlDaoList);
|
||||
|
||||
// 更新主表状态
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtIostorinv>().lambda()
|
||||
.set(StIvtIostorinv::getUpdate_optid,SecurityUtils.getCurrentUserId())
|
||||
.set(StIvtIostorinv::getUpdate_optname,SecurityUtils.getCurrentNickName())
|
||||
.set(StIvtIostorinv::getUpdate_time,DateUtil.now())
|
||||
.set(StIvtIostorinv::getDis_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(StIvtIostorinv::getDis_optname,SecurityUtils.getCurrentNickName())
|
||||
.set(StIvtIostorinv::getDis_time,DateUtil.now())
|
||||
.eq(StIvtIostorinv::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
updateMstStatus(whereJson.getString("iostorinv_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void allCancel(JSONObject whereJson) {
|
||||
// 查出已分配的明细
|
||||
List<StIvtIostorinvdtl> dtlDaoList = new ArrayList<>();
|
||||
|
||||
// 判断是全部取消还是取消一条
|
||||
if (ObjectUtil.isEmpty(whereJson.getString("iostorinvdtl_id"))) {
|
||||
dtlDaoList = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
.in(StIvtIostorinvdtl::getBill_status, IOSEnum.BILL_STATUS.code("分配完"), IOSEnum.BILL_STATUS.code("分配中"))
|
||||
);
|
||||
} else {
|
||||
dtlDaoList = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
.eq(StIvtIostorinvdtl::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id"))
|
||||
.in(StIvtIostorinvdtl::getBill_status, IOSEnum.BILL_STATUS.code("分配完"), IOSEnum.BILL_STATUS.code("分配中"))
|
||||
);
|
||||
}
|
||||
|
||||
// 查询出所有分配明细
|
||||
String id_in = dtlDaoList.stream()
|
||||
.map(StIvtIostorinvdtl::getIostorinvdtl_id)
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
List<StIvtIostorinvdis> disDaoList = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.in(StIvtIostorinvdis::getIostorinvdtl_id, "('" + id_in + "')")
|
||||
);
|
||||
|
||||
// 判断是否有任务存在
|
||||
boolean is_task = disDaoList.stream()
|
||||
.anyMatch(row -> ObjectUtil.isNotEmpty(row.getTask_id()));
|
||||
|
||||
if (is_task) throw new BadRequestException("已生成任务不可取消分配!");
|
||||
|
||||
// 解锁点位
|
||||
String pointCode_in = disDaoList.stream()
|
||||
.map(StIvtIostorinvdis::getStruct_code)
|
||||
.distinct()
|
||||
.collect(Collectors.joining("','"));
|
||||
|
||||
List<SchBasePoint> pointDaoList = iSchBasePointService.list(
|
||||
new QueryWrapper<SchBasePoint>().lambda()
|
||||
.in(SchBasePoint::getPoint_code, "('" + pointCode_in + "')")
|
||||
);
|
||||
iSchBasePointService.lockPoint(pointDaoList,IOSEnum.LOCK_TYPE.code("未锁定"));
|
||||
|
||||
// 删除分配明细
|
||||
iStIvtIostorinvdisService.remove(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.in(StIvtIostorinvdis::getIostorinvdtl_id, "('" + id_in + "')")
|
||||
);
|
||||
|
||||
// 更新明细状态、数量
|
||||
dtlDaoList.forEach(row -> {
|
||||
row.setUnassign_qty(row.getPlan_qty());
|
||||
row.setAssign_qty(BigDecimal.valueOf(0));
|
||||
row.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
});
|
||||
|
||||
iStIvtIostorinvdtlService.updateBatchById(dtlDaoList);
|
||||
|
||||
// 更新主表状态
|
||||
updateMstStatus(whereJson.getString("iostorinv_id"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void allSetPoint(JSONObject whereJson) {
|
||||
// 判断主表状态是否为分配完
|
||||
StIvtIostorinv mstDao = this.getById(whereJson.getString("iostorinv_id"));
|
||||
|
||||
if (!mstDao.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完")))
|
||||
throw new BadRequestException("状态不为分配完!");
|
||||
|
||||
// 查询所有分配明细:分配状态为未生成
|
||||
List<StIvtIostorinvdis> disDaoList = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getWork_status, IOSEnum.WORK_STATUS.code("未生成"))
|
||||
.eq(StIvtIostorinvdis::getIostorinv_id, whereJson.getString("iostorinv_id"))
|
||||
);
|
||||
|
||||
// 生成任务
|
||||
|
||||
// 下发任务
|
||||
|
||||
// 更新分配明细
|
||||
disDaoList.forEach(row -> {
|
||||
row.setTask_id("");
|
||||
row.setWork_status(IOSEnum.WORK_STATUS.code("生成"));
|
||||
});
|
||||
iStIvtIostorinvdisService.updateBatchById(disDaoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getIosDisTask(JSONObject whereJson) {
|
||||
return iStIvtIostorinvdisService.getIosDisTask(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void issueTask(JSONObject whereJson) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirmTask(JSONObject whereJson) {
|
||||
// 更新任务为完成
|
||||
iSchBaseTaskService.update(
|
||||
new UpdateWrapper<SchBaseTask>().lambda()
|
||||
.set(SchBaseTask::getTask_status, "07")
|
||||
.eq(SchBaseTask::getTask_id, whereJson.getString("task_id"))
|
||||
);
|
||||
|
||||
// 更新分配明细状态
|
||||
iStIvtIostorinvdisService.update(
|
||||
new UpdateWrapper<StIvtIostorinvdis>().lambda()
|
||||
.set(StIvtIostorinvdis::getWork_status, IOSEnum.WORK_STATUS.code("完成"))
|
||||
.eq(StIvtIostorinvdis::getTask_id, whereJson.getString("task_id"))
|
||||
);
|
||||
|
||||
// 更新明细状态
|
||||
updateDtlStatus(whereJson.getString("iostorinvdtl_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirm(JSONObject whereJson) {
|
||||
StIvtIostorinv mstDao = this.getById(whereJson.getString("iostorinv_id"));
|
||||
|
||||
// 调用方法
|
||||
updateIvt(mstDao.getIostorinv_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织主表数据
|
||||
* @param mstDao /
|
||||
* @param whereJson /
|
||||
*/
|
||||
private void updateMst(StIvtIostorinv mstDao, JSONObject whereJson) {
|
||||
mstDao.setBuss_type(whereJson.getString("bill_type"));
|
||||
mstDao.setBill_type(whereJson.getString("bill_type"));
|
||||
mstDao.setBiz_date(whereJson.getString("biz_date").substring(0,10));
|
||||
mstDao.setStor_id(whereJson.getString("stor_id"));
|
||||
mstDao.setStor_code(whereJson.getString("stor_code"));
|
||||
mstDao.setStor_name(whereJson.getString("stor_name"));
|
||||
mstDao.setSource_id(whereJson.getString("source_id"));
|
||||
mstDao.setSource_name(whereJson.getString("source_name"));
|
||||
mstDao.setSource_type(whereJson.getString("source_type"));
|
||||
mstDao.setTotal_qty(whereJson.getBigDecimal("total_qty"));
|
||||
mstDao.setDetail_count(whereJson.getBigDecimal("detail_count"));
|
||||
mstDao.setRemark(whereJson.getString("remark"));
|
||||
mstDao.setSyscompanyid("1");
|
||||
mstDao.setSysdeptid("1");
|
||||
mstDao.setIs_delete(false);
|
||||
mstDao.setIs_upload(false);
|
||||
mstDao.setIs_writeoff(false);
|
||||
mstDao.setUpload_mes(false);
|
||||
mstDao.setUpload_sap(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 组织分配明细
|
||||
* @param jsonDisParam /
|
||||
* @return JSONObject
|
||||
*/
|
||||
private JSONObject updateDis(JSONObject jsonDisParam) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("iostorinv_id", jsonDisParam.getString("iostorinv_id"));
|
||||
result.put("iostorinvdtl_id", jsonDisParam.getString("iostorinvdtl_id"));
|
||||
result.put("sect_id", jsonDisParam.getString("sect_id"));
|
||||
result.put("sect_code", jsonDisParam.getString("sect_code"));
|
||||
result.put("sect_name", jsonDisParam.getString("sect_name"));
|
||||
result.put("struct_id", jsonDisParam.getString("struct_id"));
|
||||
result.put("struct_code", jsonDisParam.getString("struct_code"));
|
||||
result.put("struct_name", jsonDisParam.getString("struct_name"));
|
||||
result.put("material_id", jsonDisParam.getString("material_id"));
|
||||
result.put("pcsn", jsonDisParam.getString("pcsn"));
|
||||
result.put("quality_scode", jsonDisParam.getString("quality_scode"));
|
||||
result.put("storagevehicle_id", jsonDisParam.getString("storagevehicle_id"));
|
||||
result.put("storagevehicle_code", jsonDisParam.getString("storagevehicle_code"));
|
||||
result.put("qty_unit_id", jsonDisParam.getString("qty_unit_id"));
|
||||
result.put("qty_unit_name", jsonDisParam.getString("qty_unit_name"));
|
||||
result.put("plan_qty", jsonDisParam.getString("plan_qty"));
|
||||
result.put("real_qty", jsonDisParam.getString("real_qty"));
|
||||
result.put("box_no", jsonDisParam.getString("box_no"));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param iostorinv_id 、
|
||||
*/
|
||||
private void updateMstStatus(String iostorinv_id) {
|
||||
StIvtIostorinv mstDao = this.getById(iostorinv_id);
|
||||
|
||||
// 查询所有明细是否都为完成、分配中、分配完
|
||||
List<StIvtIostorinvdtl> dtlDaoList = iStIvtIostorinvdtlService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtl>().lambda()
|
||||
.eq(StIvtIostorinvdtl::getIostorinv_id, iostorinv_id)
|
||||
);
|
||||
|
||||
boolean is_confirm = dtlDaoList.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("完成")));
|
||||
|
||||
boolean is_div = dtlDaoList.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))
|
||||
|| row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))
|
||||
);
|
||||
|
||||
boolean is_create = dtlDaoList.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成")));
|
||||
|
||||
if (is_confirm) {
|
||||
// 都为完成
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
} else {
|
||||
if (is_div) {
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
} else {
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_create) {
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
}
|
||||
|
||||
this.updateById(mstDao);
|
||||
|
||||
if (is_confirm) updateIvt(mstDao.getIostorinv_id());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新明细状态
|
||||
* @param iostorinvdtl_id 、
|
||||
*/
|
||||
private void updateDtlStatus(String iostorinvdtl_id) {
|
||||
|
||||
StIvtIostorinvdtl dtlDao = iStIvtIostorinvdtlService.getById(iostorinvdtl_id);
|
||||
|
||||
// 查询所有分配明细是否都为完成
|
||||
List<StIvtIostorinvdis> disDao = iStIvtIostorinvdisService.list(
|
||||
new QueryWrapper<StIvtIostorinvdis>().lambda()
|
||||
.eq(StIvtIostorinvdis::getIostorinvdtl_id, iostorinvdtl_id)
|
||||
);
|
||||
|
||||
// 判断是否都为完成
|
||||
boolean is_confirm = disDao.stream()
|
||||
.allMatch(row -> row.getWork_status().equals(IOSEnum.WORK_STATUS.code("完成")));
|
||||
|
||||
if (is_confirm) {
|
||||
// 更新明细为完成
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
iStIvtIostorinvdtlService.updateById(dtlDao);
|
||||
|
||||
updateMstStatus(dtlDao.getIostorinv_id());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新库存
|
||||
* @param iostorinv_id 、
|
||||
*/
|
||||
private void updateIvt(String iostorinv_id) {
|
||||
// 更新主表状态为完成
|
||||
StIvtIostorinv mstDao = this.getById(iostorinv_id);
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
mstDao.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setConfirm_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
|
||||
// 更新库存
|
||||
}
|
||||
}
|
||||
@@ -449,7 +449,9 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("完成")));
|
||||
|
||||
boolean is_div = dtlDaoList.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完")));
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))
|
||||
|| row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完"))
|
||||
);
|
||||
|
||||
boolean is_create = dtlDaoList.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("生成")));
|
||||
|
||||
@@ -53,7 +53,7 @@ public class StIvtIostorinvdisServiceImpl extends ServiceImpl<StIvtIostorinvdisM
|
||||
.work_status(IOSEnum.WORK_STATUS.code("未生成"))
|
||||
.task_id(json.getString("task_id"))
|
||||
.storagevehicle_id(json.getString("storagevehicle_id"))
|
||||
.storagevehicle_code(json.getString("box_no"))
|
||||
.storagevehicle_code(json.getString("storagevehicle_code"))
|
||||
.is_issued(false)
|
||||
.qty_unit_id(json.getString("qty_unit_id"))
|
||||
.qty_unit_name(json.getString("qty_unit_name"))
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.wms.storage_manage.ios.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出库分配规则 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-10
|
||||
*/
|
||||
public interface IosOutRuleService {
|
||||
|
||||
/**
|
||||
* 根据仓库、库区找到可用库存
|
||||
* @param param
|
||||
* {
|
||||
* sect_id: 区域,
|
||||
* stor_id: 仓库,
|
||||
* }
|
||||
* @return List<JSONObject> :库存集合
|
||||
*/
|
||||
List<JSONObject> getCancelIvt(JSONObject param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.storage_manage.ios.util.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.storage_manage.ios.util.IosInRuleService;
|
||||
import org.nl.wms.storage_manage.ios.util.IosOutRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出库分配规则 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-11-16
|
||||
*/
|
||||
@Service
|
||||
public class IosOutRuleServiceImpl implements IosOutRuleService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<JSONObject> getCancelIvt(JSONObject param) {
|
||||
List<JSONObject> list = new ArrayList<>();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user