rev: 初始化货位、成品出入库超限货位处理
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.masterdata_manage.service.vehicle.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
@@ -25,6 +27,7 @@ public class MdPbStoragevehicleinfo implements Serializable {
|
||||
/**
|
||||
* 载具标识
|
||||
*/
|
||||
@TableId
|
||||
private String storagevehicle_id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,4 +40,10 @@ public interface IStIvtStructattrService extends IService<StIvtStructattr> {
|
||||
* @param jo
|
||||
*/
|
||||
JSONObject getSectCascader(JSONObject jo);
|
||||
|
||||
/**
|
||||
* 查询超限货位
|
||||
* @param jo
|
||||
*/
|
||||
StIvtStructattr getExceedAttr(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.masterdata_manage.storage.service.storage.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
|
||||
@@ -13,4 +14,5 @@ import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
*/
|
||||
public interface StIvtStructattrMapper extends BaseMapper<StIvtStructattr> {
|
||||
|
||||
StIvtStructattr getExceedAttr(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,33 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.masterdata_manage.storage.service.storage.dao.mapper.StIvtStructattrMapper">
|
||||
|
||||
<select id="getExceedAttr" resultType="org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr">
|
||||
SELECT
|
||||
a.*
|
||||
FROM
|
||||
`st_ivt_structattr` a
|
||||
INNER JOIN st_ivt_structattr b ON a.struct_id = b.control_code
|
||||
WHERE
|
||||
a.is_used = '1'
|
||||
and a.lock_type = '0'
|
||||
and IFNULL(a.storagevehicle_code,'') = ''
|
||||
|
||||
and b.is_used = '1'
|
||||
and b.lock_type = '0'
|
||||
and IFNULL(b.storagevehicle_code,'') = ''
|
||||
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and a.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="sect_id != null and sect_id != ''">
|
||||
and a.sect_id = #{sect_id}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and b.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="sect_id != null and sect_id != ''">
|
||||
and b.sect_id = #{sect_id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -117,6 +117,11 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StIvtStructattr getExceedAttr(JSONObject jo) {
|
||||
return this.baseMapper.getExceedAttr(jo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(JSONObject form) {
|
||||
Assert.notNull(form,"请求参数不能为空");
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.util.Map;
|
||||
public enum IOSEnum {
|
||||
//出入库类型
|
||||
IO_TYPE(MapOf.of("入库", "0", "出库", "1")),
|
||||
//是否
|
||||
IS_USED(MapOf.of("是", "1", "否", "0")),
|
||||
//单据类型
|
||||
BILL_TYPE(MapOf.of("生产入库", "11", "手工入库", "12", "原料入库", "13"
|
||||
, "领料出库", "21", "销售出库", "22", "手工出库", "23")),
|
||||
@@ -25,7 +27,7 @@ public enum IOSEnum {
|
||||
//单据状态
|
||||
WORK_STATUS(MapOf.of("未生成", "00", "生成", "10", "执行中", "20", "完成", "99")),
|
||||
//锁定类型
|
||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4")),
|
||||
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","其他锁","99")),
|
||||
;
|
||||
private Map<String, String> code;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.productmanage.controller.iostorInv;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -141,5 +142,13 @@ public class IStivtlostorivnCpOutController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/initAttr")
|
||||
@Log("初始化仓位")
|
||||
@ApiOperation("初始化仓位")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> initAttr(){
|
||||
iStIvtIostorinvCpOutService.initAttr();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -178,4 +178,9 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
|
||||
* }
|
||||
*/
|
||||
void confirmTask(JSONObject whereJson);
|
||||
|
||||
/*
|
||||
初始化仓位
|
||||
*/
|
||||
void initAttr();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleextServic
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleinfoService;
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
|
||||
@@ -457,7 +458,7 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
.findAny().get();
|
||||
iStIvtStructivtCpService.UpdateIvt(ivtDataParam(dao,ChangeIvtUtil.SUBFROZEN_SUBIVT_QTY,dtlDao.getSource_billdtl_id()));
|
||||
|
||||
// 3)解锁终点
|
||||
// 3)解锁起点
|
||||
unLockNext(dao.getStruct_id());
|
||||
|
||||
// 4) 更新载具扩展属性
|
||||
@@ -634,6 +635,45 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
taskOperate(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void initAttr() {
|
||||
// 总共9排 一排15列 5层 按照成品库区:sect_code: KQ001 sect_name: 成品库区 sect_id: 1528631043496742912
|
||||
for (int i = 1; i < 10; i++) {
|
||||
for (int j = 1; j < 16; j++) {
|
||||
for (int k = 1; k < 6; k++) {
|
||||
StIvtStructattr dao = new StIvtStructattr();
|
||||
dao.setStruct_id(IdUtil.getStringId());
|
||||
if (j<10) {
|
||||
dao.setStruct_code("L0"+i+"-0"+j+"-0"+k);
|
||||
} else {
|
||||
dao.setStruct_code("L0"+i + "-" + j + "-0"+k);
|
||||
}
|
||||
dao.setStruct_name(i+"排"+j+"列"+k+"层");
|
||||
dao.setSimple_name(i+"排"+j+"列"+k+"层");
|
||||
dao.setSect_id("1528631043496742912");
|
||||
dao.setSect_code("KQ001");
|
||||
dao.setSect_name("成品库区");
|
||||
dao.setStor_id("1528627995269533696");
|
||||
dao.setStor_code("F102");
|
||||
dao.setStor_name("紫铜成品仓库");
|
||||
dao.setStor_type("4");
|
||||
dao.setIs_tempstruct(false);
|
||||
dao.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dao.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dao.setCreate_time(new Date());
|
||||
dao.setIs_used(true);
|
||||
dao.setLock_type("0");
|
||||
dao.setXqty(BigDecimal.valueOf(i));
|
||||
dao.setYqty(BigDecimal.valueOf(j));
|
||||
dao.setZqty(BigDecimal.valueOf(k));
|
||||
dao.setMaterial_height_type("1");
|
||||
iStIvtStructattrService.save(dao);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
@@ -808,6 +848,21 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
StIvtStructattr attrDao = iStIvtStructattrService.getById(struct_id);
|
||||
if (ObjectUtil.isEmpty(attrDao)) throw new BadRequestException("仓位不存在!");
|
||||
|
||||
// 判断载具是否超限
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleinfo>().lambda()
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, attrDao.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
if (StrUtil.equals(vehicleDao.getOverstruct_type(),IOSEnum.IS_USED.code("是"))) {
|
||||
// 解锁超限货位
|
||||
iStIvtStructattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(StIvtStructattr::getControl_code,attrDao.getStruct_id())
|
||||
);
|
||||
}
|
||||
|
||||
attrDao.setInv_code("");
|
||||
attrDao.setInv_type("");
|
||||
attrDao.setInv_id("");
|
||||
@@ -816,5 +871,4 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
iStIvtStructattrService.updateById(attrDao);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -428,7 +428,15 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
if (ObjectUtil.isEmpty(struct_id)) {
|
||||
/* 自动分配 */
|
||||
|
||||
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN_1);
|
||||
// 判断载具是否超限
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getById(disDao.getStoragevehicle_id());
|
||||
|
||||
if (StrUtil.equals(vehicleDao.getOverstruct_type(),IOSEnum.IS_USED.code("是"))) {
|
||||
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN_2);
|
||||
} else {
|
||||
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN_1);
|
||||
}
|
||||
|
||||
attrDao = divRuleCpService.divRuleIn(whereJson);
|
||||
|
||||
} else {
|
||||
@@ -516,6 +524,18 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
.eq(StIvtStructattr::getStruct_code, disDao.getStruct_code())
|
||||
);
|
||||
|
||||
// 判断载具是否超限
|
||||
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getById(disDao.getStoragevehicle_id());
|
||||
|
||||
if (StrUtil.equals(vehicleDao.getOverstruct_type(),IOSEnum.IS_USED.code("是"))) {
|
||||
// 解锁超限货位
|
||||
iStIvtStructattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(StIvtStructattr::getControl_code,disDao.getStruct_id())
|
||||
);
|
||||
}
|
||||
|
||||
// 更新库存
|
||||
iStIvtStructivtCpService.UpdateIvt(ivtDataParam(disDao,ChangeIvtUtil.SUBWAREHOUSING_QTY,null));
|
||||
|
||||
|
||||
@@ -8,6 +8,12 @@ public class RuleUtil {
|
||||
*/
|
||||
public static final String PRODUCTION_IN_1 = "in_1";
|
||||
|
||||
/*
|
||||
* 入库分配:
|
||||
* 按照仓位顺序找到一个成品仓一层两个货位
|
||||
*/
|
||||
public static final String PRODUCTION_IN_2 = "in_2";
|
||||
|
||||
/*
|
||||
* 出库分配:
|
||||
* 根据 仓库、库区、物料、销售单找库存
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.storage_manage.productmanage.util.impl;
|
||||
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 org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
@@ -50,13 +51,23 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStor_id, stor_id)
|
||||
.eq(StIvtStructattr::getSect_id, sect_id)
|
||||
.isNull(StIvtStructattr::getStoragevehicle_code)
|
||||
.ne(StIvtStructattr::getStoragevehicle_code,"")
|
||||
.eq(StIvtStructattr::getIs_used, "1") //TODO 暂时写死
|
||||
.eq(StIvtStructattr::getIs_used, IOSEnum.IS_USED.code("是"))
|
||||
.eq(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(StIvtStructattr::getStoragevehicle_code,"")
|
||||
.orderByAsc(StIvtStructattr::getStruct_code)
|
||||
,false);
|
||||
break;
|
||||
case RuleUtil.PRODUCTION_IN_2 :
|
||||
attrDao = iStIvtStructattrService.getExceedAttr(whereJson);
|
||||
|
||||
// 不为空则锁住对应货位
|
||||
if (ObjectUtil.isNotEmpty(attrDao))
|
||||
iStIvtStructattrService.update(
|
||||
new UpdateWrapper<StIvtStructattr>().lambda()
|
||||
.set(StIvtStructattr::getLock_type, IOSEnum.LOCK_TYPE.code("其他锁"))
|
||||
.eq(StIvtStructattr::getStruct_id, attrDao.getControl_code())
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return attrDao;
|
||||
|
||||
@@ -320,7 +320,7 @@ export default {
|
||||
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
const area_type = 'A1_RK01'
|
||||
const area_type = 'A1_CPRK01'
|
||||
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
|
||||
this.pointlist = res
|
||||
})
|
||||
|
||||
@@ -301,7 +301,7 @@ export default {
|
||||
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
const area_type = 'A1_RK01'
|
||||
const area_type = 'A1_FH01'
|
||||
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
|
||||
this.pointList = res
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user