add:库内移库,库存状态变更
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.basedata_manage.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
@@ -9,10 +10,7 @@ import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
@@ -40,4 +38,11 @@ public class StructIvtController {
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iMdPbStoragevehicleextService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/statusChange")
|
||||
@Log("状态变更")
|
||||
public ResponseEntity<Object> statusChange(@RequestBody JSONObject whereJson) {
|
||||
iMdPbStoragevehicleextService.statusChange(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,12 @@ public class StructattrController {
|
||||
return new ResponseEntity<>(TableDataInfo.build(structattrService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getMoveStruct")
|
||||
@Log("查询移入仓位")
|
||||
public ResponseEntity<Object> getMoveStruct(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(structattrService.getMoveStruct(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增仓位")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Structattr dto) {
|
||||
|
||||
@@ -41,4 +41,10 @@ public interface IMdPbStoragevehicleextService extends IService<MdPbStoragevehic
|
||||
* }
|
||||
*/
|
||||
void updateIvt(List<JSONObject> updateIvtList);
|
||||
|
||||
/**
|
||||
* 品质类型变更
|
||||
* @param whereJson 库存记录
|
||||
*/
|
||||
void statusChange(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,15 @@ public interface IStructattrService extends IService<Structattr> {
|
||||
*/
|
||||
IPage<Structattr> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
IPage<Structattr> getMoveStruct(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
@@ -101,4 +110,5 @@ public interface IStructattrService extends IService<Structattr> {
|
||||
* @return Structattr
|
||||
*/
|
||||
Structattr getByCode(String struct_code);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.basedata_manage.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@@ -89,5 +90,11 @@ public class MdPbStoragevehicleext implements Serializable {
|
||||
*/
|
||||
private String insert_time;
|
||||
|
||||
/**
|
||||
* 仓位编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String struct_code;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,14 @@ public interface MdPbStoragevehicleextMapper extends BaseMapper<MdPbStoragevehic
|
||||
*/
|
||||
IPage<JSONObject> getCanuseIvt(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 获取可用库存托盘
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<JSONObject>
|
||||
*/
|
||||
IPage<JSONObject> getCanuseVheicle(Page<JSONObject> page, @Param("param") Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据批次和物料查看可用库存总和
|
||||
* @param pcsn
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
attr.sect_name AS turnout_sect_name,
|
||||
attr.sect_code AS turnout_sect_code,
|
||||
attr.sect_id,
|
||||
attr.stor_id,
|
||||
attr.struct_id,
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
@@ -56,6 +57,58 @@
|
||||
ORDER BY ext.insert_time Desc
|
||||
</select>
|
||||
|
||||
<select id="getCanuseVheicle" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ext.storagevehicleext_id,
|
||||
ext.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
ext.pcsn,
|
||||
ext.qty_unit_id,
|
||||
ext.qty_unit_name,
|
||||
ext.canuse_qty AS qty,
|
||||
ext.frozen_qty,
|
||||
attr.sect_name AS turnout_sect_name,
|
||||
attr.sect_code AS turnout_sect_code,
|
||||
attr.sect_id,
|
||||
attr.stor_id,
|
||||
attr.struct_id,
|
||||
attr.storagevehicle_code,
|
||||
attr.is_emptyvehicle,
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
st_ivt_structattr attr
|
||||
LEFT JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = ext.material_id
|
||||
<where>
|
||||
attr.lock_type = '0'
|
||||
AND attr.is_used = "1"
|
||||
AND IFNULL(attr.storagevehicle_code,'') != ''
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
attr.stor_id LIKE #{param.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="param.sect_id != null and param.sect_id != ''">
|
||||
AND
|
||||
attr.sect_id = #{param.sect_id}
|
||||
</if>
|
||||
|
||||
<if test="param.storagevehicle_code != null and param.storagevehicle_code != ''">
|
||||
AND
|
||||
attr.storagevehicle_code LIKE #{param.storagevehicle_code}
|
||||
</if>
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
attr.struct_code LIKE #{param.struct_code}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
ORDER BY attr.struct_code
|
||||
</select>
|
||||
|
||||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ext.storagevehicleext_id,
|
||||
@@ -70,25 +123,28 @@
|
||||
attr.struct_name,
|
||||
attr.stor_name,
|
||||
attr.sect_name,
|
||||
mater.material_id,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec
|
||||
mater.material_spec,
|
||||
late.quality_time,
|
||||
late.produce_time,
|
||||
late.quality_type,
|
||||
late.quality_type AS old_quality_type,
|
||||
late.bake_num,
|
||||
false AS edit,
|
||||
(
|
||||
CASE late.quality_type
|
||||
WHEN '1' THEN '待检'
|
||||
WHEN '2' THEN '合格'
|
||||
WHEN '3' THEN '不合格'
|
||||
END
|
||||
) AS quality_name
|
||||
FROM
|
||||
md_pb_storagevehicleext ext
|
||||
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
|
||||
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
material_id,
|
||||
storagevehicle_code,
|
||||
pcsn
|
||||
FROM
|
||||
md_pb_groupplate
|
||||
WHERE
|
||||
status = '2'
|
||||
GROUP BY
|
||||
material_id,storagevehicle_code,pcsn
|
||||
) late ON late.material_id = ext.material_id and late.pcsn = ext.pcsn and late.storagevehicle_code = ext.storagevehicle_code
|
||||
LEFT JOIN md_pb_groupplate late ON late.material_id = ext.material_id and late.pcsn = ext.pcsn and late.storagevehicle_code = ext.storagevehicle_code
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
package org.nl.wms.basedata_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinv;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
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;
|
||||
|
||||
@@ -32,6 +51,30 @@ public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStorageveh
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||
|
||||
/**
|
||||
* 移库单服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoveinvService iStIvtMoveinvService;
|
||||
|
||||
/**
|
||||
* 组盘记录服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbGroupplateService iMdPbGroupplateService;
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
@@ -44,4 +87,162 @@ public class MdPbStoragevehicleextServiceImpl extends ServiceImpl<MdPbStorageveh
|
||||
updateIvtUtils.updateIvt(json);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void statusChange(JSONObject whereJson) {
|
||||
// 查询载具扩展属性
|
||||
MdPbStoragevehicleext extDao = this.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
.eq(MdPbStoragevehicleext::getMaterial_id, whereJson.getString("material_id"))
|
||||
.eq(MdPbStoragevehicleext::getPcsn, whereJson.getString("pcsn"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前库存数据不存在,请检查数据!");
|
||||
}
|
||||
|
||||
// 校验仓位是否锁定
|
||||
Structattr attrDao = iStructattrService.getOne(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(attrDao)) {
|
||||
throw new BadRequestException("未找到对应仓位!");
|
||||
}
|
||||
if (!attrDao.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) {
|
||||
throw new BadRequestException("当前仓位【" + attrDao.getStruct_code() + "】有其他任务正在进行中,请稍后在试!");
|
||||
}
|
||||
|
||||
// 判断库区
|
||||
String sectc_code = "";
|
||||
|
||||
String quality_type = whereJson.getString("quality_type");
|
||||
switch (quality_type) {
|
||||
case IOSConstant.ONE:
|
||||
sectc_code = IOSEnum.SECT_CODE.code("待检区");
|
||||
break;
|
||||
case IOSConstant.TWO:
|
||||
sectc_code = IOSEnum.SECT_CODE.code("合格区");
|
||||
break;
|
||||
case IOSConstant.THREE:
|
||||
sectc_code = IOSEnum.SECT_CODE.code("不合格区");
|
||||
break;
|
||||
}
|
||||
|
||||
// 分配相同库区且有空托盘的仓位
|
||||
JSONObject jsonParam = new JSONObject();
|
||||
jsonParam.put("stor_id", attrDao.getStor_id());
|
||||
jsonParam.put("sectc_code", sectc_code);
|
||||
Structattr newAttr = divStruct(jsonParam);
|
||||
|
||||
// 创建移库单据并下发任务
|
||||
extDao.setStruct_code(attrDao.getStruct_code());
|
||||
createMove(extDao, newAttr);
|
||||
|
||||
// 更新组盘记录品质类型
|
||||
iMdPbGroupplateService.update(
|
||||
new UpdateWrapper<GroupPlate>().lambda()
|
||||
.set(GroupPlate::getQuality_type, quality_type)
|
||||
.eq(GroupPlate::getMaterial_id, extDao.getMaterial_id())
|
||||
.eq(GroupPlate::getStoragevehicle_code, extDao.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getPcsn, extDao.getPcsn())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配仓位:空托盘优先
|
||||
*
|
||||
* @param jsonParam {
|
||||
* stor_id: 仓库id
|
||||
* sectc_code: 库区 编码
|
||||
* }
|
||||
* @return Structattr
|
||||
*/
|
||||
private Structattr divStruct(JSONObject jsonParam) {
|
||||
|
||||
Structattr structattr = new Structattr();
|
||||
|
||||
List<Structattr> vehicleAttrList = iStructattrService.list(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStor_id, jsonParam.getString("stor_id"))
|
||||
.eq(Structattr::getSect_code, jsonParam.getString("sectc_code"))
|
||||
.eq(Structattr::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||
.eq(Structattr::getIs_used, IOSConstant.ONE)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getIs_emptyvehicle, IOSConstant.ONE)
|
||||
.and(wrapper -> wrapper.isNotNull(Structattr::getStoragevehicle_code).or().ne(Structattr::getStoragevehicle_code, ""))
|
||||
.orderByAsc(Structattr::getStruct_code)
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(vehicleAttrList)) {
|
||||
structattr = vehicleAttrList.get(0);
|
||||
} else {
|
||||
List<Structattr> attrList = iStructattrService.list(
|
||||
new QueryWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStor_id, jsonParam.getString("stor_id"))
|
||||
.eq(Structattr::getSect_code, jsonParam.getString("sectc_code"))
|
||||
.eq(Structattr::getIs_delete, IOSConstant.IS_DELETE_NO)
|
||||
.eq(Structattr::getIs_used, IOSConstant.ONE)
|
||||
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.ne(Structattr::getIs_emptyvehicle, IOSConstant.ONE)
|
||||
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code, ""))
|
||||
.orderByAsc(Structattr::getStruct_code)
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(attrList)) {
|
||||
structattr = attrList.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(structattr)) {
|
||||
throw new BadRequestException("当前库区【" + jsonParam.getString("sectc_code") + "】没有可用仓位");
|
||||
}
|
||||
return structattr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建移库单据
|
||||
*
|
||||
* @param extDao 载具扩展属性实体类
|
||||
* @param newAttr 仓位实体类
|
||||
*/
|
||||
private void createMove(MdPbStoragevehicleext extDao, Structattr newAttr) {
|
||||
// 查询移出货位
|
||||
Structattr oldAttr = iStructattrService.getByCode(extDao.getStruct_code());
|
||||
// 组织主表
|
||||
MoveInsertDto moveInsertDto = new MoveInsertDto();
|
||||
moveInsertDto.setBill_type(IOSEnum.MOVE_BILL_TYPE.code("库内移库"));
|
||||
moveInsertDto.setBiz_date(DateUtil.today());
|
||||
moveInsertDto.setStor_id(newAttr.getStor_id());
|
||||
moveInsertDto.setTotal_qty(extDao.getCanuse_qty());
|
||||
moveInsertDto.setDetail_count(BigDecimal.ONE);
|
||||
moveInsertDto.setBill_status(IOSEnum.MOVE_MST_STATUS.code("生成"));
|
||||
moveInsertDto.setRemark("由库存状态变更发起!");
|
||||
|
||||
// 组织明细
|
||||
List<JSONObject> dtlList = new ArrayList<>();
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("turnout_sect_code", oldAttr.getSect_code());
|
||||
jsonDtl.put("turnout_struct_code", oldAttr.getStruct_code());
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(extDao.getMaterial_id());
|
||||
jsonDtl.put("material_code", materDao.getMaterial_code());
|
||||
jsonDtl.put("material_id", materDao.getMaterial_id());
|
||||
jsonDtl.put("pcsn", extDao.getPcsn());
|
||||
jsonDtl.put("qty_unit_id", extDao.getQty_unit_id());
|
||||
jsonDtl.put("qty_unit_name", extDao.getQty_unit_name());
|
||||
jsonDtl.put("qty", extDao.getCanuse_qty());
|
||||
jsonDtl.put("turnin_sect_code", newAttr.getSect_code());
|
||||
jsonDtl.put("turnin_struct_code", newAttr.getStruct_code());
|
||||
jsonDtl.put("work_status", IOSEnum.MOVE_DTL_STATUS.code("生成"));
|
||||
jsonDtl.put("storagevehicle_code", oldAttr.getStoragevehicle_code());
|
||||
jsonDtl.put("storagevehicle_code2", newAttr.getStoragevehicle_code());
|
||||
dtlList.add(jsonDtl);
|
||||
moveInsertDto.setTableData(dtlList);
|
||||
|
||||
// 调用移库单新增
|
||||
String move_id = iStIvtMoveinvService.create(moveInsertDto);
|
||||
// 下发任务
|
||||
StIvtMoveinv moveDao = new StIvtMoveinv();
|
||||
moveDao.setMoveinv_id(move_id);
|
||||
iStIvtMoveinvService.sendTask(moveDao);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
String layer_num = (String) whereJson.get("layer_num");
|
||||
String is_used = (String) whereJson.get("is_used");
|
||||
String is_have = (String) whereJson.get("is_have");
|
||||
String not_point = (String) whereJson.get("not_point");
|
||||
String storagevehicle_type = (String) whereJson.get("storagevehicle_type");
|
||||
|
||||
return structattrMapper.selectPage(new Page<>(page.getPage() + 1 ,page.getSize()), new LambdaQueryWrapper<Structattr>()
|
||||
@@ -74,6 +75,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
.eq(StrUtil.isNotEmpty(sect_id),Structattr::getSect_id, sect_id)
|
||||
.eq(StrUtil.isNotEmpty(lock_type),Structattr::getLock_type, lock_type)
|
||||
.eq(StrUtil.isNotEmpty(layer_num),Structattr::getLayer_num, layer_num)
|
||||
.ne(StrUtil.isNotEmpty(not_point),Structattr::getStruct_id, not_point)
|
||||
.eq(StrUtil.isNotEmpty(storagevehicle_type),Structattr::getStoragevehicle_type, storagevehicle_type)
|
||||
.eq(StrUtil.isNotEmpty(is_used),Structattr::getIs_used, is_used)
|
||||
.eq(Structattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
@@ -85,6 +87,32 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Structattr> getMoveStruct(Map whereJson, PageQuery page) {
|
||||
|
||||
String search = (String) whereJson.get("search");
|
||||
String stor_id = (String) whereJson.get("stor_id");
|
||||
String sect_id = (String) whereJson.get("sect_id");
|
||||
String lock_type = (String) whereJson.get("lock_type");
|
||||
String layer_num = (String) whereJson.get("layer_num");
|
||||
String is_used = (String) whereJson.get("is_used");
|
||||
String not_point = (String) whereJson.get("not_point");
|
||||
String storagevehicle_type = (String) whereJson.get("storagevehicle_type");
|
||||
|
||||
return structattrMapper.selectPage(new Page<>(page.getPage() + 1 ,page.getSize()), new LambdaQueryWrapper<Structattr>()
|
||||
.eq(StrUtil.isNotEmpty(stor_id),Structattr::getStor_id, stor_id)
|
||||
.eq(StrUtil.isNotEmpty(sect_id),Structattr::getSect_id, sect_id)
|
||||
.eq(StrUtil.isNotEmpty(lock_type),Structattr::getLock_type, lock_type)
|
||||
.eq(StrUtil.isNotEmpty(layer_num),Structattr::getLayer_num, layer_num)
|
||||
.ne(StrUtil.isNotEmpty(not_point),Structattr::getStruct_id, not_point)
|
||||
.eq(StrUtil.isNotEmpty(storagevehicle_type),Structattr::getStoragevehicle_type, storagevehicle_type)
|
||||
.eq(StrUtil.isNotEmpty(is_used),Structattr::getIs_used, is_used)
|
||||
.eq(Structattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.like(StrUtil.isNotEmpty(search),Structattr::getStruct_code, search)
|
||||
.orderByAsc(Structattr::getStoragevehicle_code)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Structattr findById(String struct_id) {
|
||||
return structattrMapper.selectById(struct_id);
|
||||
|
||||
@@ -3,52 +3,48 @@ package org.nl.wms.sch_manage.service.util.tasks;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.AcsTaskDto;
|
||||
import org.nl.wms.sch_manage.service.util.TaskType;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
||||
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 余料回库类
|
||||
* @Date: 2025/6/6
|
||||
* <p>
|
||||
* 退料入库任务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
@Component(value = "BackInTask")
|
||||
@TaskType("BackInTask")
|
||||
public class BackInTask extends AbstractTask {
|
||||
|
||||
/**
|
||||
* 任务服务类
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
|
||||
/**
|
||||
* 点位服务
|
||||
*/
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
@Resource
|
||||
private IRawAssistIStorService rawAssistIStorService;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
@Resource
|
||||
private IOStorInvDisMapper ioStorInvDisMapper;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
@@ -56,11 +52,15 @@ public class BackInTask extends AbstractTask {
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||
task.setConfig_code(json.getString("config_code"));
|
||||
task.setConfig_code(BackInTask.class.getSimpleName());
|
||||
task.setPoint_code1(json.getString("point_code1"));
|
||||
task.setPoint_code2(json.getString("point_code2"));
|
||||
task.setVehicle_code(json.getString("vehicle_code"));
|
||||
task.setMaterial_id(json.getString("material_id"));
|
||||
task.setMaterial_qty(json.getBigDecimal("material_qty"));
|
||||
task.setGroup_id(json.getString("group_id"));
|
||||
task.setRequest_param(json.toString());
|
||||
task.setTask_type(TaskEnum.TASK_TYPE.code("料箱"));
|
||||
task.setPriority(json.getString("Priority"));
|
||||
task.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
task.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
@@ -85,6 +85,7 @@ public class BackInTask extends AbstractTask {
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setVehicle_code(taskDao.getVehicle_code());
|
||||
acsTaskDto.setTask_type("1");
|
||||
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
@@ -100,7 +101,6 @@ public class BackInTask extends AbstractTask {
|
||||
}
|
||||
// 根据传来的类型去对任务进行操作
|
||||
if (status.equals(TaskStatus.EXECUTING)) {
|
||||
// 更新明细状态
|
||||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
|
||||
taskObj.setRemark("执行中");
|
||||
taskService.updateById(taskObj);
|
||||
@@ -111,6 +111,7 @@ public class BackInTask extends AbstractTask {
|
||||
if (status.equals(TaskStatus.CANCELED)) {
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,7 +120,10 @@ public class BackInTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,51 +132,47 @@ public class BackInTask extends AbstractTask {
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
if (!TaskStatus.CREATE.getCode().equals(taskObj.getTask_status())) {
|
||||
throw new BadRequestException("任务状态必须为生成才能取消任务");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
this.cancelTask(taskObj);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
taskService.updateById(taskObj);
|
||||
rawAssistIStorService.taskFinish(taskObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
// 取消任务
|
||||
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
|
||||
.set(SchBaseTask::getIs_delete, BaseDataEnum.IS_YES_NOT.code("是"))
|
||||
.set(SchBaseTask::getTask_status, TaskStatus.CANCELED.getCode())
|
||||
.set(SchBaseTask::getRemark, "已取消")
|
||||
.eq(SchBaseTask::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
//分配表清除任务
|
||||
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getTask_id, null)
|
||||
.set(IOStorInvDis::getPoint_code, null)
|
||||
.set(IOStorInvDis::getIs_issued, 0)
|
||||
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("未生成"))
|
||||
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
|
||||
);
|
||||
|
||||
// 更新任务状态
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskConfirm(String task_code) {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void finishTask(SchBaseTask taskObj) {
|
||||
// 更新终点
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
|
||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code())
|
||||
.set(Structattr::getTaskdtl_id, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
// 更新起点
|
||||
iSchBasePointService.update(
|
||||
new UpdateWrapper<SchBasePoint>().lambda()
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code1())
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
.set(SchBasePoint::getIos_id, null)
|
||||
);
|
||||
// 更新任务
|
||||
taskObj.setRemark("已完成");
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void cancelTask(SchBaseTask taskObj) {
|
||||
// 更新终点
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2())
|
||||
.set(Structattr::getTaskdtl_id, null)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
// 更新任务
|
||||
taskObj.setRemark("已取消");
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,16 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Author: Liuxy
|
||||
* @Description: 移库任务类
|
||||
* @Date: 2025/5/25
|
||||
* <p>
|
||||
* 库内移库任务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
@Component(value = "MoveTask")
|
||||
@TaskType("MoveTask")
|
||||
public class MoveTask extends AbstractTask {
|
||||
@Component(value = "InsideMoveTask")
|
||||
@TaskType("InsideMoveTask")
|
||||
public class InsideMoveTask extends AbstractTask {
|
||||
|
||||
/**
|
||||
* 任务服务类
|
||||
@@ -54,10 +57,12 @@ public class MoveTask extends AbstractTask {
|
||||
task.setTask_id(IdUtil.getStringId());
|
||||
task.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.setTask_status(TaskStatus.CREATE.getCode());
|
||||
task.setConfig_code(json.getString("config_code"));
|
||||
task.setConfig_code(InsideMoveTask.class.getSimpleName());
|
||||
task.setPoint_code1(json.getString("point_code1"));
|
||||
task.setPoint_code2(json.getString("point_code2"));
|
||||
task.setVehicle_code(json.getString("vehicle_code"));
|
||||
task.setVehicle_code2(json.getString("vehicle_code2"));
|
||||
task.setGroup_id(json.getString("group_id"));
|
||||
task.setRequest_param(json.toString());
|
||||
task.setPriority(json.getString("Priority"));
|
||||
task.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
@@ -130,7 +135,7 @@ public class MoveTask extends AbstractTask {
|
||||
if (Integer.parseInt(taskObj.getTask_status()) > Integer.parseInt(TaskStatus.CREATE.getCode())) {
|
||||
throw new BadRequestException("只能取消生成中的任务!");
|
||||
}
|
||||
this.cancelTask(taskObj);
|
||||
this.cancelTask(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.nl.wms.warehouse_management.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinv;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoveInsertDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -20,7 +20,7 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 基础分类表 控制层
|
||||
* 移库管理 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
@@ -62,6 +62,13 @@ public class MoveStorController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendTask")
|
||||
@Log("下发任务")
|
||||
public ResponseEntity<Object> sendTask(@RequestBody StIvtMoveinv dao) {
|
||||
iStIvtMoveinvService.sendTask(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getMoveDtl")
|
||||
@Log("查询移库单明细")
|
||||
public ResponseEntity<Object> getMoveDtl(@RequestParam Map whereJson) {
|
||||
@@ -71,7 +78,7 @@ public class MoveStorController {
|
||||
@GetMapping("/getCanuseIvt")
|
||||
@Log("获取可用库存物料")
|
||||
public ResponseEntity<Object> getCanuseIvt(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtMoveinvService.getCanuseIvt(whereJson,page)),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtMoveinvService.getCanuseIvt(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
|
||||
@@ -17,11 +17,26 @@ public class IOSConstant {
|
||||
*/
|
||||
public final static String IS_DELETE_YES = "1";
|
||||
|
||||
/**
|
||||
* 数字0
|
||||
*/
|
||||
public final static String ZERO = "0";
|
||||
|
||||
/**
|
||||
* 数字1
|
||||
*/
|
||||
public final static String ONE = "1";
|
||||
|
||||
/**
|
||||
* 数字2
|
||||
*/
|
||||
public final static String TWO = "2";
|
||||
|
||||
/**
|
||||
* 数字3
|
||||
*/
|
||||
public final static String THREE = "3";
|
||||
|
||||
/**
|
||||
* 出入库 入库
|
||||
*/
|
||||
|
||||
@@ -32,11 +32,14 @@ public enum IOSEnum {
|
||||
,"拼箱入库", "0004" ,"拣选回库", "0005", "手工入库", "0009"
|
||||
)),
|
||||
|
||||
// 入库业务类型
|
||||
// 出库业务类型
|
||||
OUT_BILL_TYPE(MapOf.of("领料出库","1001", "质检出库","1002" , "退货出库","1003"
|
||||
,"烘干出库", "1004" ,"手工出库", "1009"
|
||||
)),
|
||||
|
||||
// 移库业务类型
|
||||
MOVE_BILL_TYPE(MapOf.of("库内移库","2001")),
|
||||
|
||||
// 入库任务配置类编码
|
||||
IN_CONFIG_CODE(MapOf.of("0001","DetainInTask", "0002", "BackInTask",
|
||||
"0003", "GeBoxInTask", "0004", "PieceBoxInTask", "0005", "SelectBackInTask", "0009", "HandInTask"
|
||||
@@ -47,6 +50,11 @@ public enum IOSEnum {
|
||||
"1003", "BackOutTask", "1004", "HotOutTask", "1009", "HandOutTask"
|
||||
)),
|
||||
|
||||
// 移库任务配置类编码
|
||||
MOVE_CONFIG_CODE(MapOf.of("2001","InsideMoveTask", "2002", "2002",
|
||||
"2003", "2003", "2004", "2004", "2005", "2005"
|
||||
)),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),
|
||||
|
||||
@@ -59,6 +67,9 @@ public enum IOSEnum {
|
||||
"其他锁","9"
|
||||
)),
|
||||
|
||||
// 库区编码
|
||||
SECT_CODE(MapOf.of("合格区", "HG01", "待检区", "DJ01", "不合格区", "BHG01")),
|
||||
|
||||
// 存放载具类型
|
||||
VEHICLE_TYPE_PUT(MapOf.of("大料架(短边)", "1", "大料架(长边)", "2", "金属托盘", "3"
|
||||
, "小料架", "4")),
|
||||
|
||||
@@ -34,8 +34,9 @@ public interface IStIvtMoveinvService extends IService<StIvtMoveinv> {
|
||||
/**
|
||||
* 新增移库单
|
||||
* @param dto:新增修改dto实体类
|
||||
* @return move_id
|
||||
*/
|
||||
void create(MoveInsertDto dto);
|
||||
String create(MoveInsertDto dto);
|
||||
|
||||
/**
|
||||
* 修改移库单
|
||||
@@ -97,4 +98,10 @@ public interface IStIvtMoveinvService extends IService<StIvtMoveinv> {
|
||||
* @param dto 新增修改dto实体类
|
||||
*/
|
||||
void confirm(MoveInsertDto dto);
|
||||
|
||||
/**
|
||||
* 下发任务
|
||||
* @param dao 移库主表实体类
|
||||
*/
|
||||
void sendTask(StIvtMoveinv dao);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,11 @@ public class StIvtMoveinvdtl implements Serializable {
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 存储载具编码
|
||||
*/
|
||||
private String storagevehicle_code2;
|
||||
|
||||
/**
|
||||
* 是否已下发
|
||||
*/
|
||||
|
||||
@@ -15,18 +15,21 @@
|
||||
dtl.qty_unit_id,
|
||||
dtl.qty_unit_name,
|
||||
dtl.storagevehicle_code,
|
||||
dtl.storagevehicle_code2,
|
||||
attrout.sect_name AS turnout_sect_name,
|
||||
attrout.sect_code AS turnout_sect_code,
|
||||
attrout.struct_code AS turnout_struct_code,
|
||||
attrin.sect_name AS turnin_sect_name,
|
||||
attrin.sect_code AS turnin_sect_code,
|
||||
attrin.struct_code AS turnin_struct_code
|
||||
attrin.struct_code AS turnin_struct_code,
|
||||
task.task_code
|
||||
FROM
|
||||
st_ivt_moveinvdtl dtl
|
||||
LEFT JOIN st_ivt_moveinv ios ON ios.moveinv_id = dtl.moveinv_id
|
||||
LEFT JOIN md_me_materialbase material ON material.material_code = dtl.material_code
|
||||
LEFT JOIN st_ivt_structattr attrout ON attrout.struct_code = dtl.turnout_struct_code
|
||||
LEFT JOIN st_ivt_structattr attrin ON attrin.struct_code = dtl.turnin_struct_code
|
||||
LEFT JOIN sch_base_task task ON task.task_id = dtl.task_id
|
||||
<where>
|
||||
ios.is_delete = '0'
|
||||
<if test="param.moveinv_id != null and param.moveinv_id != ''">
|
||||
|
||||
@@ -70,6 +70,7 @@ public class MoveInsertDto {
|
||||
* qty_unit_id 计量单位标识
|
||||
* qty_unit_name 计量单位名称
|
||||
* storagevehicle_code 载具编码
|
||||
* storagevehicle_code2 载具编码
|
||||
* turnin_sect_code 移入库区
|
||||
* turnin_struct_code 移入仓位
|
||||
* turnout_sect_code 移出库区
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -17,9 +19,12 @@ import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.MoveTask;
|
||||
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
||||
import org.nl.wms.sch_manage.service.util.TaskFactory;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.InsideMoveTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvService;
|
||||
@@ -52,12 +57,6 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
@Autowired
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
|
||||
/**
|
||||
* 载具扩展属性服务类
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
/**
|
||||
* 移库单明细服务
|
||||
*/
|
||||
@@ -83,10 +82,10 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
/**
|
||||
* 移库任务配置类
|
||||
* 任务工厂服务
|
||||
*/
|
||||
@Autowired
|
||||
private MoveTask moveTask;
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
@@ -96,7 +95,7 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(MoveInsertDto dto) {
|
||||
public String create(MoveInsertDto dto) {
|
||||
// 主表数据
|
||||
StIvtMoveinv moveDao = new StIvtMoveinv();
|
||||
moveDao.setMoveinv_id(IdUtil.getStringId());
|
||||
@@ -117,6 +116,7 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
// 新增明细以及任务
|
||||
dto.setMoveinv_id(moveDao.getMoveinv_id());
|
||||
iStIvtMoveinvdtlService.createMoveDtl(dto);
|
||||
return moveDao.getMoveinv_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +163,7 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> getCanuseIvt(Map whereJson, PageQuery page) {
|
||||
return mdPbStoragevehicleextMapper.getCanuseIvt(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
return mdPbStoragevehicleextMapper.getCanuseVheicle(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@@ -196,47 +196,32 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
|
||||
@Override
|
||||
public void confirmTask(StIvtMoveinvdtl dtlDao) {
|
||||
// 需要更新库存集合
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
// 查询物料
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getOne(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
.eq(MdMeMaterialbase::getMaterial_code, dtlDao.getMaterial_code())
|
||||
);
|
||||
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN);
|
||||
jsonIvt.put("storagevehicle_code", dtlDao.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", materDao.getMaterial_id());
|
||||
jsonIvt.put("pcsn", dtlDao.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", dtlDao.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", dtlDao.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", dtlDao.getQty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
JSONObject jsonIvtTwo = new JSONObject();
|
||||
jsonIvtTwo.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE);
|
||||
jsonIvtTwo.put("storagevehicle_code", dtlDao.getStoragevehicle_code());
|
||||
jsonIvtTwo.put("material_id", materDao.getMaterial_id());
|
||||
jsonIvtTwo.put("pcsn", dtlDao.getPcsn());
|
||||
jsonIvtTwo.put("qty_unit_id", dtlDao.getQty_unit_id());
|
||||
jsonIvtTwo.put("qty_unit_name", dtlDao.getQty_unit_name());
|
||||
jsonIvtTwo.put("change_qty", dtlDao.getQty());
|
||||
updateIvtList.add(jsonIvtTwo);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
|
||||
// 查询移入货位
|
||||
Structattr inStruct = iStructattrService.getByCode(dtlDao.getTurnin_struct_code());
|
||||
// 查询移出货位
|
||||
Structattr outStruct = iStructattrService.getByCode(dtlDao.getTurnout_struct_code());
|
||||
// 更新起点
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, dtlDao.getTurnout_struct_code())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(Structattr::getStoragevehicle_code, null)
|
||||
.set(Structattr::getStoragevehicle_code, dtlDao.getStoragevehicle_code2())
|
||||
.set(Structattr::getIs_emptyvehicle,
|
||||
inStruct.getIs_emptyvehicle().equals(IOSConstant.IS_DELETE_YES) ? IOSConstant.IS_DELETE_YES
|
||||
: IOSConstant.IS_DELETE_NO
|
||||
)
|
||||
);
|
||||
|
||||
// 更新终点
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.eq(Structattr::getStruct_code, dtlDao.getTurnin_struct_code())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.set(Structattr::getStoragevehicle_code, dtlDao.getStoragevehicle_code())
|
||||
.set(Structattr::getIs_emptyvehicle,
|
||||
outStruct.getIs_emptyvehicle().equals(IOSConstant.IS_DELETE_YES) ? IOSConstant.IS_DELETE_YES
|
||||
: IOSConstant.IS_DELETE_NO
|
||||
)
|
||||
);
|
||||
|
||||
// 更新明细状态
|
||||
@@ -261,28 +246,57 @@ public class StIvtMoveinvServiceImpl extends ServiceImpl<StIvtMoveinvMapper, StI
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirm(MoveInsertDto dto) {
|
||||
StIvtMoveinv mstDao = this.getById(dto.getMoveinv_id());
|
||||
// 查询所有明细
|
||||
List<StIvtMoveinvdtl> dtlDaoList = iStIvtMoveinvdtlService.list(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id())
|
||||
);
|
||||
List<SchBaseTask> taskDaoList = iSchBaseTaskService.list(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
.in(SchBaseTask::getTask_id,
|
||||
dtlDaoList.stream()
|
||||
.map(StIvtMoveinvdtl::getTask_id)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
|
||||
for (StIvtMoveinvdtl dao : dtlDaoList) {
|
||||
SchBaseTask taskDao = taskDaoList.stream()
|
||||
.filter(row -> row.getTask_id().equals(dao.getTask_id()))
|
||||
.findFirst().orElse(null);
|
||||
moveTask.finishTask(taskDao);
|
||||
if (ObjectUtil.isNotEmpty(dao.getTask_id())) {
|
||||
SchBaseTask taskDao = iSchBaseTaskService.getById(dao.getTask_id());
|
||||
AbstractTask task = taskFactory.getTask(IOSEnum.MOVE_CONFIG_CODE.code(mstDao.getBill_type()));
|
||||
task.updateTaskStatus(taskDao.getTask_code(), TaskStatus.FINISHED);
|
||||
} else {
|
||||
this.confirmTask(dao);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void sendTask(StIvtMoveinv dao) {
|
||||
StIvtMoveinv mstDao = this.getById(dao.getMoveinv_id());
|
||||
if (!mstDao.getBill_status().equals(IOSEnum.MORE_MST_STATUS.code("生成"))) {
|
||||
throw new BadRequestException("当前移库单已下发任务!");
|
||||
}
|
||||
|
||||
List<StIvtMoveinvdtl> dtlList = iStIvtMoveinvdtlService.list(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getMoveinv_id, dao.getMoveinv_id())
|
||||
);
|
||||
|
||||
AbstractTask task = taskFactory.getTask(IOSEnum.MOVE_CONFIG_CODE.code(mstDao.getBill_type()));
|
||||
for (StIvtMoveinvdtl dtlDao : dtlList) {
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
jsonTask.put("point_code1", dtlDao.getTurnout_struct_code());
|
||||
jsonTask.put("point_code2", dtlDao.getTurnin_struct_code());
|
||||
jsonTask.put("vehicle_code", dtlDao.getStoragevehicle_code());
|
||||
jsonTask.put("vehicle_code2", dtlDao.getStoragevehicle_code2());
|
||||
String task_id = task.create(jsonTask);
|
||||
|
||||
// 更新明细任务标识
|
||||
dtlDao.setTask_id(task_id);
|
||||
}
|
||||
iStIvtMoveinvdtlService.updateBatchById(dtlList);
|
||||
|
||||
// 更新主表状态为提交
|
||||
dao.setBill_status(IOSEnum.MOVE_MST_STATUS.code("提交"));
|
||||
this.updateById(dao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新主表状态
|
||||
* @param moveinv_id 移库单id
|
||||
|
||||
@@ -10,13 +10,8 @@ import org.nl.common.utils.IdUtil;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.sch_manage.enums.TaskEnum;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.MoveTask;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoveinvdtlService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoveinvdtl;
|
||||
@@ -26,8 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -40,12 +36,6 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMapper, StIvtMoveinvdtl> implements IStIvtMoveinvdtlService {
|
||||
|
||||
/**
|
||||
* 载具扩展属性服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdPbStoragevehicleextService iMdPbStoragevehicleextService;
|
||||
|
||||
/**
|
||||
* 仓位服务
|
||||
*/
|
||||
@@ -58,43 +48,21 @@ public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMappe
|
||||
@Autowired
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
/**
|
||||
* 物料服务
|
||||
*/
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||
|
||||
/**
|
||||
* 移库任务配置类
|
||||
*/
|
||||
@Autowired
|
||||
private MoveTask moveTask;
|
||||
|
||||
@Override
|
||||
public void createMoveDtl(MoveInsertDto dto) {
|
||||
// 批量插入明细集合
|
||||
List<StIvtMoveinvdtl> moveDtlList = new ArrayList<>();
|
||||
// 批量更新库存集合
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
// 批量更新仓位
|
||||
List<JSONObject> updateAttrList = new ArrayList<>();
|
||||
// 处理明细数据
|
||||
List<JSONObject> tableData = dto.getTableData();
|
||||
for (int i = 0; i < tableData.size(); i++) {
|
||||
JSONObject json = tableData.get(i);
|
||||
// 组织任务数据
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
jsonTask.put("config_code", IOSConstant.MOVE_CONFIG_TASK);
|
||||
jsonTask.put("point_code1",json.getString("turnout_struct_code"));
|
||||
jsonTask.put("point_code2",json.getString("turnin_struct_code"));
|
||||
jsonTask.put("vehicle_code",json.getString("storagevehicle_code"));
|
||||
jsonTask.put("Priority", TaskEnum.ACS_PRIORITY.code("1"));
|
||||
String task_id = moveTask.create(jsonTask);
|
||||
// 明细数据
|
||||
StIvtMoveinvdtl dtlDao = new StIvtMoveinvdtl();
|
||||
dtlDao.setMoveinvdtl_id(IdUtil.getStringId());
|
||||
dtlDao.setMoveinv_id(dto.getMoveinv_id());
|
||||
dtlDao.setSeq_no(BigDecimal.valueOf(i+1));
|
||||
dtlDao.setSeq_no(BigDecimal.valueOf(i + 1));
|
||||
dtlDao.setTurnout_sect_code(json.getString("turnout_sect_code"));
|
||||
dtlDao.setTurnout_struct_code(json.getString("turnout_struct_code"));
|
||||
dtlDao.setMaterial_code(json.getString("material_code"));
|
||||
@@ -106,33 +74,20 @@ public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMappe
|
||||
dtlDao.setTurnin_struct_code(json.getString("turnin_struct_code"));
|
||||
dtlDao.setWork_status(json.getString("work_status"));
|
||||
dtlDao.setStoragevehicle_code(json.getString("storagevehicle_code"));
|
||||
dtlDao.setStoragevehicle_code2(json.getString("storagevehicle_code2"));
|
||||
dtlDao.setRemark(json.getString("remark"));
|
||||
dtlDao.setTask_id(task_id);
|
||||
moveDtlList.add(dtlDao);
|
||||
// 组织要更新库存的数据
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN);
|
||||
jsonIvt.put("storagevehicle_code", dtlDao.getStoragevehicle_code());
|
||||
jsonIvt.put("material_id", json.getString("material_id"));
|
||||
jsonIvt.put("pcsn", dtlDao.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", dtlDao.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", dtlDao.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", dtlDao.getQty());
|
||||
jsonIvt.put("struct_code_out", dtlDao.getTurnout_struct_code());
|
||||
jsonIvt.put("struct_code_in", dtlDao.getTurnin_struct_code());
|
||||
updateIvtList.add(jsonIvt);
|
||||
// 组织要更新仓位的数据
|
||||
JSONObject jsonAttrIn = new JSONObject();
|
||||
jsonAttrIn.put("struct_code",dtlDao.getTurnin_struct_code());
|
||||
jsonAttrIn.put("lock_type",IOSEnum.LOCK_TYPE.code("移入锁"));
|
||||
jsonAttrIn.put("struct_code", dtlDao.getTurnin_struct_code());
|
||||
jsonAttrIn.put("lock_type", IOSEnum.LOCK_TYPE.code("移入锁"));
|
||||
updateAttrList.add(jsonAttrIn);
|
||||
JSONObject jsonAttrOut = new JSONObject();
|
||||
jsonAttrOut.put("struct_code",dtlDao.getTurnout_struct_code());
|
||||
jsonAttrOut.put("lock_type",IOSEnum.LOCK_TYPE.code("移出锁"));
|
||||
jsonAttrOut.put("struct_code", dtlDao.getTurnout_struct_code());
|
||||
jsonAttrOut.put("lock_type", IOSEnum.LOCK_TYPE.code("移出锁"));
|
||||
updateAttrList.add(jsonAttrOut);
|
||||
}
|
||||
this.saveBatch(moveDtlList);
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
// 锁定仓位
|
||||
iStructattrService.updateLock(updateAttrList);
|
||||
}
|
||||
@@ -151,39 +106,13 @@ public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMappe
|
||||
lambda.eq(StIvtMoveinvdtl::getTask_id, dto.getTask_id());
|
||||
}
|
||||
List<StIvtMoveinvdtl> oldDtlDao = this.list(lambda);
|
||||
// 查询物料
|
||||
List<MdMeMaterialbase> materialList = iMdMeMaterialbaseService.list(
|
||||
new QueryWrapper<MdMeMaterialbase>().lambda()
|
||||
.in(MdMeMaterialbase::getMaterial_code,
|
||||
oldDtlDao.stream()
|
||||
.map(StIvtMoveinvdtl::getMaterial_code)
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
|
||||
// 需要删除的任务
|
||||
List<String> taskDeleteList = new ArrayList<>();
|
||||
// 需要更新的库存集合
|
||||
List<JSONObject> updateIvtList = new ArrayList<>();
|
||||
// 需要更新的仓位集合
|
||||
List<String> updateAttrList = new ArrayList<>();
|
||||
for (StIvtMoveinvdtl dao : oldDtlDao) {
|
||||
taskDeleteList.add(dao.getTask_id());
|
||||
|
||||
// 更新库存数据组织
|
||||
JSONObject jsonIvt = new JSONObject();
|
||||
jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE);
|
||||
jsonIvt.put("storagevehicle_code", dao.getStoragevehicle_code());
|
||||
MdMeMaterialbase materDao = materialList.stream()
|
||||
.filter(row -> row.getMaterial_code().equals(dao.getMaterial_code()))
|
||||
.findFirst().orElse(null);
|
||||
jsonIvt.put("material_id", materDao.getMaterial_id());
|
||||
jsonIvt.put("pcsn", dao.getPcsn());
|
||||
jsonIvt.put("qty_unit_id", dao.getQty_unit_id());
|
||||
jsonIvt.put("qty_unit_name", dao.getQty_unit_name());
|
||||
jsonIvt.put("change_qty", dao.getQty());
|
||||
updateIvtList.add(jsonIvt);
|
||||
|
||||
// 需要更新的仓位
|
||||
updateAttrList.add(dao.getTurnin_struct_code());
|
||||
updateAttrList.add(dao.getTurnout_struct_code());
|
||||
@@ -191,15 +120,13 @@ public class StIvtMoveinvdtlServiceImpl extends ServiceImpl<StIvtMoveinvdtlMappe
|
||||
// 删除明细
|
||||
this.remove(
|
||||
new QueryWrapper<StIvtMoveinvdtl>().lambda()
|
||||
.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id())
|
||||
.eq(StIvtMoveinvdtl::getMoveinv_id, dto.getMoveinv_id())
|
||||
);
|
||||
// 更新库存
|
||||
iMdPbStoragevehicleextService.updateIvt(updateIvtList);
|
||||
// 更新仓位
|
||||
iStructattrService.update(
|
||||
new UpdateWrapper<Structattr>().lambda()
|
||||
.in(Structattr::getStruct_code, updateAttrList)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.in(Structattr::getStruct_code, updateAttrList)
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
);
|
||||
// 删除任务
|
||||
iSchBaseTaskService.removeByIds(taskDeleteList);
|
||||
|
||||
Reference in New Issue
Block a user