add:入库分配
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
package org.nl.wms.storage_manage.basedata.controller.storage;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtSectattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 库区属性表 前端控制器
|
||||
@@ -13,8 +27,18 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtSectattr")
|
||||
@RequestMapping("/api/stIvtSectattr")
|
||||
public class StIvtSectattrController {
|
||||
|
||||
@Autowired
|
||||
protected IStIvtSectattrService iStIvtSectattrService;
|
||||
|
||||
@PostMapping("/getSect")
|
||||
@Log("仓库库区多级下拉框")
|
||||
@ApiOperation("仓库库区多级下拉框")
|
||||
public ResponseEntity<Object> queryStor(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iStIvtSectattrService.getSect(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.basedata.service.storage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 实物库属性表 服务类
|
||||
@@ -13,4 +16,5 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt
|
||||
*/
|
||||
public interface IStIvtBsrealstorattrService extends IService<StIvtBsrealstorattr> {
|
||||
|
||||
List<Map> queryStor(Map<String,Object> map);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.basedata.service.storage;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr;
|
||||
|
||||
@@ -13,4 +14,10 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr;
|
||||
*/
|
||||
public interface IStIvtSectattrService extends IService<StIvtSectattr> {
|
||||
|
||||
/**
|
||||
* 仓库库区多级下拉框
|
||||
* @param whereJson /
|
||||
* @return Object
|
||||
*/
|
||||
Object getSect(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package org.nl.wms.storage_manage.basedata.service.storage.dao.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 实物库属性表 Mapper 接口
|
||||
@@ -13,4 +16,5 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt
|
||||
*/
|
||||
public interface StIvtBsrealstorattrMapper extends BaseMapper<StIvtBsrealstorattr> {
|
||||
|
||||
List<Map> queryStor(Map<String,Object> map);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
<?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.basedata.service.storage.dao.mapper.StIvtBsrealstorattrMapper">
|
||||
|
||||
<select id="queryStor" resultType="java.util.Map">
|
||||
SELECT
|
||||
arrt.*
|
||||
FROM
|
||||
ST_IVT_BSRealStorAttr arrt
|
||||
WHERE 1=1
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and arrt.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="stor_code != null and stor_code != ''">
|
||||
and arrt.stor_code = #{stor_code}
|
||||
</if>
|
||||
<if test="stor_type_scode != null and stor_type_scode != ''">
|
||||
and arrt.stor_type_scode = #{stor_type_scode}
|
||||
</if>
|
||||
<if test="stor_type != null and stor_type != ''">
|
||||
and arrt.stor_type = #{stor_type}
|
||||
</if>
|
||||
<if test="is_used != null and is_used != ''">
|
||||
and arrt.is_used = #{is_used}
|
||||
</if>
|
||||
<if test="whstate_scode != null and whstate_scode != ''">
|
||||
and arrt.whstate_scode = #{whstate_scode}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -6,6 +6,9 @@ import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstoratt
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.mapper.StIvtBsrealstorattrMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 实物库属性表 服务实现类
|
||||
@@ -17,4 +20,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtBsrealstorattrServiceImpl extends ServiceImpl<StIvtBsrealstorattrMapper, StIvtBsrealstorattr> implements IStIvtBsrealstorattrService {
|
||||
|
||||
@Override
|
||||
public List<Map> queryStor(Map<String, Object> map) {
|
||||
return baseMapper.queryStor(map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package org.nl.wms.storage_manage.basedata.service.storage.impl;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtSectattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtSectattr;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.mapper.StIvtSectattrMapper;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 库区属性表 服务实现类
|
||||
@@ -17,4 +26,40 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtSectattrServiceImpl extends ServiceImpl<StIvtSectattrMapper, StIvtSectattr> implements IStIvtSectattrService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService iStIvtBsrealstorattrService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtSectattrService iStIvtSectattrService;
|
||||
|
||||
@Override
|
||||
public Object getSect(JSONObject whereJson) {
|
||||
List<Map> maps = iStIvtBsrealstorattrService.queryStor(whereJson);
|
||||
|
||||
JSONArray result = new JSONArray();
|
||||
|
||||
maps.forEach(item -> {
|
||||
JSONObject jsonStor = new JSONObject();
|
||||
jsonStor.put("value", item.get("stor_id"));
|
||||
jsonStor.put("label", item.get("stor_name"));
|
||||
|
||||
List<StIvtSectattr> attrList = iStIvtSectattrService.list(new QueryWrapper<StIvtSectattr>().eq("stor_id", item.get("stor_id")));
|
||||
|
||||
JSONArray objects = new JSONArray();
|
||||
if (attrList.size()>0) {
|
||||
attrList.forEach(json -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("value", json.getSect_id());
|
||||
jsonObject.put("label", json.getSect_name());
|
||||
objects.add(jsonObject);
|
||||
});
|
||||
jsonStor.put("children", objects);
|
||||
}
|
||||
|
||||
result.add(jsonStor);
|
||||
});
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("content", result);
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,4 +90,12 @@ public class IStivtlostorivnCpInController {
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/divStruct")
|
||||
@Log("分配")
|
||||
@ApiOperation("分配")
|
||||
public ResponseEntity<Object> divStruct(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpService.divStruct(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -108,4 +108,13 @@ public interface IStIvtIostorinvCpService extends IService<StIvtIostorinvCp> {
|
||||
* }
|
||||
*/
|
||||
void vehicleCheck(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 分配
|
||||
* @param whereJson
|
||||
* {
|
||||
* 分配明细
|
||||
* }
|
||||
*/
|
||||
void divStruct(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.nl.wms.storage_manage.productmanage.service.iostorInv.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -16,7 +16,7 @@ import java.math.BigDecimal;
|
||||
* @since 2023-05-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("st_ivt_iostorinvdtl_cp")
|
||||
public class StIvtIostorinvdtlCp implements Serializable {
|
||||
|
||||
|
||||
@@ -25,7 +25,9 @@ import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtBsrealstorattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisdtlCpService;
|
||||
@@ -33,8 +35,11 @@ import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinv
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.mapper.StIvtIostorinvCpMapper;
|
||||
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dto.IostorInvQuery;
|
||||
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -72,6 +77,12 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
@Autowired
|
||||
protected IMdPbStoragevehicleextService iMdPbStoragevehicleextService; // 载具扩展属性信息表服务
|
||||
|
||||
@Autowired
|
||||
protected DivRuleCpService divRuleCpService; // 成品分配规则服务类
|
||||
|
||||
@Autowired
|
||||
protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
|
||||
|
||||
|
||||
@Override
|
||||
public Object pageQuery(IostorInvQuery query, PageQuery page) {
|
||||
@@ -227,9 +238,9 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
// 5.回显分配明细表iostorinvdis_id标识
|
||||
iStIvtIostorinvdisdtlCpService.update(
|
||||
new StIvtIostorinvdisdtlCp().setIostorinvdis_id(disDao.getIostorinvdis_id()),
|
||||
new QueryWrapper<StIvtIostorinvdisdtlCp>()
|
||||
.eq("iostorinvdis_id", param.getString("iostorinvdis_id"))
|
||||
.eq("storagevehicle_code", disDao.getStoragevehicle_code())
|
||||
new QueryWrapper<StIvtIostorinvdisdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdisdtlCp::getIostorinvdis_id, param.getString("iostorinvdis_id"))
|
||||
.eq(StIvtIostorinvdisdtlCp::getStoragevehicle_code, disDao.getStoragevehicle_code())
|
||||
);
|
||||
|
||||
// 6.更新载具扩展属性表
|
||||
@@ -240,7 +251,8 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
vehicleDao.setUpdate_time(new Date());
|
||||
|
||||
iMdPbStoragevehicleextService.update(
|
||||
vehicleDao,new QueryWrapper<MdPbStoragevehicleext>().eq("storagevehicle_code", disDtlDao.getStoragevehicle_code())
|
||||
vehicleDao,new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, disDtlDao.getStoragevehicle_code())
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -279,17 +291,17 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
|
||||
// 1.校验载具是否存在
|
||||
MdPbStoragevehicleinfo daoVehicle = iMdPbStoragevehicleinfoService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleinfo>()
|
||||
.eq("storagevehicle_code", whereJson.getString("storagevehicle_code"))
|
||||
.eq("is_used", true)
|
||||
new QueryWrapper<MdPbStoragevehicleinfo>().lambda()
|
||||
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
.eq(MdPbStoragevehicleinfo::getIs_used, true)
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(daoVehicle)) throw new BadRequestException("此载具不存在或未启用");
|
||||
|
||||
// 2.校验载具是否已组盘
|
||||
MdPbStoragevehicleext daoVehicleExt = iMdPbStoragevehicleextService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>()
|
||||
.eq("storagevehicle_code", whereJson.getString("storagevehicle_code"))
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
);
|
||||
|
||||
if (ObjectUtil.isEmpty(daoVehicleExt)) {
|
||||
@@ -300,6 +312,48 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void divStruct(JSONObject whereJson) {
|
||||
/*
|
||||
1.判断此分配明细是否指定货位
|
||||
2.自动分配:
|
||||
1).根据分配规则找出一个货位
|
||||
3.更新此托盘上的所有分配明细
|
||||
4.更新单据状态
|
||||
5.更新点位状态
|
||||
6.更新库存、日物流表等、
|
||||
*/
|
||||
|
||||
String struct_id = whereJson.getString("struct_id");
|
||||
StIvtStructattr attrDao = new StIvtStructattr();
|
||||
|
||||
// 1.根据仓库、库区找出一个仓位
|
||||
if (ObjectUtil.isEmpty(struct_id)) {
|
||||
/* 自动分配 */
|
||||
|
||||
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN);
|
||||
attrDao = divRuleCpService.divRuleIn(whereJson);
|
||||
|
||||
} else {
|
||||
/* 手动分配 */
|
||||
|
||||
// 查出对应仓位
|
||||
attrDao = iStIvtStructattrService.getOne(
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStruct_id,struct_id)
|
||||
);
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(attrDao.getStruct_code())) throw new BadRequestException("未找到仓位!");
|
||||
|
||||
// 2.更新分配明细、分配、明细、主表
|
||||
updateDivIos(attrDao,whereJson);
|
||||
|
||||
// TODO 更新点位
|
||||
// TODO 更新库存、物流等
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
@@ -328,8 +382,10 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
stIvtIostorinvCp.setBiz_date(whereJson.getString("biz_date").substring(0,10));
|
||||
// 获取仓库信息
|
||||
QueryWrapper<StIvtBsrealstorattr> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("stor_id", whereJson.getString("stor_id"));
|
||||
wrapper.eq("is_used", true);
|
||||
wrapper.lambda()
|
||||
.eq(StIvtBsrealstorattr::getStor_id,whereJson.getString("stor_id"))
|
||||
.eq(StIvtBsrealstorattr::getIs_used, true);
|
||||
|
||||
StIvtBsrealstorattr bsrealDao = stIvtBsrealstorattrService.getOne(wrapper);
|
||||
if (ObjectUtil.isEmpty(bsrealDao)) throw new BadRequestException("仓库不存在或未启用!");
|
||||
|
||||
@@ -343,4 +399,96 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
|
||||
return stIvtIostorinvCp;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private void updateDivIos(StIvtStructattr attrDao,JSONObject whereJson) {
|
||||
/* 分配货位更新:
|
||||
更新分配明细、分配、明细、主表
|
||||
*/
|
||||
|
||||
// 1.更新此托盘下的所有分配明细表
|
||||
iStIvtIostorinvdisdtlCpService.update(
|
||||
new StIvtIostorinvdisdtlCp()
|
||||
.setSect_id(attrDao.getSect_id())
|
||||
.setSect_code(attrDao.getSect_code())
|
||||
.setSect_name(attrDao.getSect_name())
|
||||
.setStruct_id(attrDao.getStruct_id())
|
||||
.setStruct_code(attrDao.getStruct_code())
|
||||
.setStruct_name(attrDao.getStruct_name()),
|
||||
new QueryWrapper<StIvtIostorinvdisdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdisdtlCp::getIostorinvdis_id, whereJson.getString("iostorinvdis_id"))
|
||||
.eq(StIvtIostorinvdisdtlCp::getStoragevehicle_code, whereJson.getString("storagevehicle_code"))
|
||||
);
|
||||
|
||||
// 2.更新分配表
|
||||
iostorinvdisCpService.update(
|
||||
new StIvtIostorinvdisCp()
|
||||
.setSect_id(attrDao.getSect_id())
|
||||
.setSect_code(attrDao.getSect_code())
|
||||
.setSect_name(attrDao.getSect_name())
|
||||
.setStruct_id(attrDao.getStruct_id())
|
||||
.setStruct_code(attrDao.getStruct_code())
|
||||
.setStruct_name(attrDao.getStruct_name()),
|
||||
new QueryWrapper<StIvtIostorinvdisCp>().lambda()
|
||||
.eq(StIvtIostorinvdisCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id"))
|
||||
);
|
||||
|
||||
// 3.更新明细表
|
||||
BigDecimal unassign_qty = iostorinvdtlCpService.getOne(
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id"))
|
||||
).getUnassign_qty();
|
||||
|
||||
iostorinvdtlCpService.update(
|
||||
new StIvtIostorinvdtlCp()
|
||||
.setBill_status(IOSEnum.BILL_STATUS.code("分配完"))
|
||||
.setAssign_qty(unassign_qty)
|
||||
.setUnassign_qty(new BigDecimal(0)),
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinvdtl_id, whereJson.getString("iostorinvdtl_id"))
|
||||
);
|
||||
|
||||
// 4.更新主表
|
||||
updateMst(whereJson.getString("iostorinv_id"));
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public void updateMst(String iostorinv_id) {
|
||||
/*
|
||||
更新主表
|
||||
*/
|
||||
|
||||
StIvtIostorinvCp mstDao = this.baseMapper.selectOne(
|
||||
new QueryWrapper<StIvtIostorinvCp>().lambda()
|
||||
.eq(StIvtIostorinvCp::getIostorinv_id, iostorinv_id)
|
||||
);
|
||||
mstDao.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setUpdate_time(new Date());
|
||||
mstDao.setDis_id(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setDis_name(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setDis_time(DateUtil.now());
|
||||
|
||||
// 查询主表下所有明细
|
||||
List<StIvtIostorinvdtlCp> dtlDaoList = iostorinvdtlCpService.list(
|
||||
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
|
||||
.eq(StIvtIostorinvdtlCp::getIostorinv_id, iostorinv_id)
|
||||
);
|
||||
|
||||
// 判断是否都为分配完
|
||||
boolean is_true = dtlDaoList
|
||||
.stream()
|
||||
.allMatch(row -> row.getBill_status().equals(IOSEnum.BILL_STATUS.code("分配完")));
|
||||
|
||||
if (is_true) {
|
||||
// 更新主表为分配完
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
} else {
|
||||
// 更新主表为分配中
|
||||
mstDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
}
|
||||
|
||||
this.updateById(mstDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.nl.wms.storage_manage.productmanage.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 成品分配规则 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
public interface DivRuleCpService {
|
||||
|
||||
/**
|
||||
* 入库分配规则
|
||||
* @param whereJson
|
||||
* {
|
||||
* "stor_id":仓库标识
|
||||
* "sect_id":库区标识
|
||||
* "rule_type":规则类型(后续优化)
|
||||
* }
|
||||
* @return StIvtStructattr /
|
||||
*/
|
||||
StIvtStructattr divRuleIn(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.nl.wms.storage_manage.productmanage.util;
|
||||
|
||||
public class RuleUtil {
|
||||
|
||||
/*
|
||||
* 按照仓位顺序找一个仓位
|
||||
*/
|
||||
public static final String PRODUCTION_IN = "1";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
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 org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.IStIvtStructattrService;
|
||||
import org.nl.wms.storage_manage.basedata.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
|
||||
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 成品分配规则 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2023-05-11
|
||||
*/
|
||||
@Service
|
||||
public class DivRuleCpServiceImpl implements DivRuleCpService {
|
||||
|
||||
@Autowired
|
||||
protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
|
||||
|
||||
private StIvtStructattr attrDao;
|
||||
|
||||
@Override
|
||||
public StIvtStructattr divRuleIn(JSONObject whereJson) {
|
||||
|
||||
String stor_id = whereJson.getString("stor_id");
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
|
||||
if (ObjectUtil.isEmpty(stor_id)) throw new BadRequestException("仓库不能为空!");
|
||||
if (ObjectUtil.isEmpty(sect_id)) throw new BadRequestException("库区不能为空!");
|
||||
|
||||
switch (whereJson.getString("rule_type")) {
|
||||
case RuleUtil.PRODUCTION_IN :
|
||||
attrDao = iStIvtStructattrService.getOne(
|
||||
new QueryWrapper<StIvtStructattr>().lambda()
|
||||
.eq(StIvtStructattr::getStor_id, stor_id)
|
||||
.eq(StIvtStructattr::getSect_id, sect_id)
|
||||
.isNull(StIvtStructattr::getStoragevehicle_code)
|
||||
.eq(StIvtStructattr::getIs_used, "1") //TODO 暂时写死
|
||||
.eq(StIvtStructattr::getIs_delete, "0") //TODO 暂时写死
|
||||
.eq(StIvtStructattr::getLock_type, "1") //TODO 暂时写死
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return attrDao;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user