rev:改切、报废出库自动分配变更为手动分配
This commit is contained in:
@@ -10,7 +10,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import org.nl.b_lms.pdm_manage.enums.SUBEnum;
|
import org.nl.b_lms.pdm_manage.enums.SUBEnum;
|
||||||
|
import org.nl.b_lms.sch.tasks.TwoExcepionalMoveTask;
|
||||||
import org.nl.b_lms.sch.tasks.TwoOutExceptionalTask;
|
import org.nl.b_lms.sch.tasks.TwoOutExceptionalTask;
|
||||||
import org.nl.b_lms.sch.tasks.TwoOutTask;
|
import org.nl.b_lms.sch.tasks.TwoOutTask;
|
||||||
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||||
@@ -42,12 +44,15 @@ import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
|||||||
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
import org.nl.wms.pda.mps.eum.RegionTypeEnum;
|
||||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||||
import org.nl.wms.util.TranUtil;
|
import org.nl.wms.util.TranUtil;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collector;
|
import java.util.stream.Collector;
|
||||||
@@ -130,6 +135,9 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TwoInBussManageService twoInBussManageService;
|
private TwoInBussManageService twoInBussManageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public String insertMst(JSONObject whereJson) {
|
public String insertMst(JSONObject whereJson) {
|
||||||
@@ -211,6 +219,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@SneakyThrows
|
||||||
public void allDiv(JSONObject whereJson) {
|
public void allDiv(JSONObject whereJson) {
|
||||||
/*
|
/*
|
||||||
* 分配规则:
|
* 分配规则:
|
||||||
@@ -267,6 +276,10 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
throw new BadRequestException("库存不足!");
|
throw new BadRequestException("库存不足!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RLock lock = redissonClient.getLock("all_divTwo");
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
// 用于插入分配明细的集合
|
// 用于插入分配明细的集合
|
||||||
List<StIvtIostorinvdis> disDaoList = new ArrayList<>();
|
List<StIvtIostorinvdis> disDaoList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -299,7 +312,14 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
|
|
||||||
// 更新主表状态
|
// 更新主表状态
|
||||||
updateMstStatus(mstDao.getIostorinv_id());
|
updateMstStatus(mstDao.getIostorinv_id());
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("其他出库单当前正在分配货位,请等待几秒再进行操作!");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -402,6 +422,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@SneakyThrows
|
||||||
public void cancelDiv(JSONObject whereJson) {
|
public void cancelDiv(JSONObject whereJson) {
|
||||||
// 任务表
|
// 任务表
|
||||||
WQLObject taskService = WQLObject.getWQLObject("sch_base_task");
|
WQLObject taskService = WQLObject.getWQLObject("sch_base_task");
|
||||||
@@ -415,6 +436,11 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
* 删除分配明细:查询此明细下的相同木箱的分配明细
|
* 删除分配明细:查询此明细下的相同木箱的分配明细
|
||||||
*/
|
*/
|
||||||
// 判断是什么类型 全部取消-0,自动取消-1,删除分配明细-3
|
// 判断是什么类型 全部取消-0,自动取消-1,删除分配明细-3
|
||||||
|
RLock lock = redissonClient.getLock("all_cancelDivTwo");
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
List<JSONObject> disList;
|
List<JSONObject> disList;
|
||||||
|
|
||||||
JSONObject jsonDisParam = new JSONObject();
|
JSONObject jsonDisParam = new JSONObject();
|
||||||
@@ -565,6 +591,16 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
|
|||||||
jsonLockParam.put("operate", IOSEnum.IO_TYPE.code("出库"));
|
jsonLockParam.put("operate", IOSEnum.IO_TYPE.code("出库"));
|
||||||
|
|
||||||
outBussManageService.lockStruct(paramLockList,jsonLockParam);
|
outBussManageService.lockStruct(paramLockList,jsonLockParam);
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("其他出库单当前正在取消分配,请等待几秒再进行操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
|||||||
jo_mst.put("update_optid", currentUserId + "");
|
jo_mst.put("update_optid", currentUserId + "");
|
||||||
jo_mst.put("update_optname", nickName);
|
jo_mst.put("update_optname", nickName);
|
||||||
jo_mst.put("update_time", now);
|
jo_mst.put("update_time", now);
|
||||||
|
|
||||||
//更新主表
|
//更新主表
|
||||||
wo_mst.update(jo_mst);
|
wo_mst.update(jo_mst);
|
||||||
}
|
}
|
||||||
@@ -271,7 +272,8 @@ public class ProductScrapServiceImpl implements ProductScrapService {
|
|||||||
String iostorinv_id = checkOutBillService.insertDtl(jsonOutMst);
|
String iostorinv_id = checkOutBillService.insertDtl(jsonOutMst);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("iostorinv_id", iostorinv_id);
|
jsonObject.put("iostorinv_id", iostorinv_id);
|
||||||
checkOutBillService.allDiv(jsonObject);
|
// 变更为手动分配
|
||||||
|
// checkOutBillService.allDiv(jsonObject);
|
||||||
|
|
||||||
// 更新主表为完成
|
// 更新主表为完成
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
|
|||||||
@@ -287,7 +287,8 @@ public class RecutPlanServiceImpl implements RecutPlanService {
|
|||||||
JSONObject out_jo = new JSONObject();
|
JSONObject out_jo = new JSONObject();
|
||||||
out_jo.put("iostorinv_id", iostorinv_id);
|
out_jo.put("iostorinv_id", iostorinv_id);
|
||||||
out_jo.put("div_type", "1");
|
out_jo.put("div_type", "1");
|
||||||
iStIvtIostorinvOutService.allDiv(out_jo);
|
// 改为手动分配
|
||||||
|
// iStIvtIostorinvOutService.allDiv(out_jo);
|
||||||
} else {
|
} else {
|
||||||
jsonMst.put("tableData", dtls);
|
jsonMst.put("tableData", dtls);
|
||||||
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
|
String iostorinv_id = checkOutBillService.insertDtl(jsonMst);
|
||||||
@@ -295,7 +296,8 @@ public class RecutPlanServiceImpl implements RecutPlanService {
|
|||||||
//调用自动分配
|
//调用自动分配
|
||||||
JSONObject out_jo = new JSONObject();
|
JSONObject out_jo = new JSONObject();
|
||||||
out_jo.put("iostorinv_id", iostorinv_id);
|
out_jo.put("iostorinv_id", iostorinv_id);
|
||||||
checkOutBillService.allDiv(out_jo);
|
// 改为手动分配
|
||||||
|
// checkOutBillService.allDiv(out_jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.utils.CodeUtil;
|
import org.nl.common.utils.CodeUtil;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
@@ -39,6 +40,8 @@ import org.nl.wms.st.outbill.util.ThreadManage;
|
|||||||
import org.nl.wms.st.returns.service.InAndOutReturnService;
|
import org.nl.wms.st.returns.service.InAndOutReturnService;
|
||||||
import org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl;
|
import org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl;
|
||||||
import org.nl.wms.util.TranUtil;
|
import org.nl.wms.util.TranUtil;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -50,6 +53,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -67,6 +71,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
private final OutTask outTask;
|
private final OutTask outTask;
|
||||||
private final HandMoveStorAcsTask moveStorAcsTask;
|
private final HandMoveStorAcsTask moveStorAcsTask;
|
||||||
private final InAndOutReturnService inAndOutReturnService;
|
private final InAndOutReturnService inAndOutReturnService;
|
||||||
|
private final RedissonClient redissonClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
public Map<String, Object> pageQuery(Map whereJson, Pageable page, String[] stor_id, String[] bill_status, String[] bill_type) {
|
||||||
@@ -1521,6 +1526,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@SneakyThrows
|
||||||
public void allDiv(JSONObject whereJson) {
|
public void allDiv(JSONObject whereJson) {
|
||||||
//出库分配表
|
//出库分配表
|
||||||
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||||
@@ -1531,8 +1537,6 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
//库区表
|
//库区表
|
||||||
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
|
WQLObject wo_sect = WQLObject.getWQLObject("st_ivt_sectattr");
|
||||||
|
|
||||||
//定义需要更新的仓位集合
|
|
||||||
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
|
|
||||||
String iostorinv_id = whereJson.getString("iostorinv_id");
|
String iostorinv_id = whereJson.getString("iostorinv_id");
|
||||||
//查询主表信息
|
//查询主表信息
|
||||||
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
|
||||||
@@ -1568,6 +1572,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
throw new BadRequestException("当前订单无可分配出库明细");
|
throw new BadRequestException("当前订单无可分配出库明细");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RLock lock = redissonClient.getLock("all_divOne");
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
|
//定义需要更新的仓位集合
|
||||||
|
HashMap<String, JSONObject> Struct_map = new HashMap<String, JSONObject>();
|
||||||
for (int i = 0; i < dtls.size(); i++) {
|
for (int i = 0; i < dtls.size(); i++) {
|
||||||
JSONObject dtl = dtls.getJSONObject(i);
|
JSONObject dtl = dtls.getJSONObject(i);
|
||||||
double unassign_qty = dtl.getDoubleValue("unassign_qty");
|
double unassign_qty = dtl.getDoubleValue("unassign_qty");
|
||||||
@@ -1783,6 +1794,14 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
storPublicService.updateStructAndPoint(from_start);
|
storPublicService.updateStructAndPoint(from_start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("其他出库单当前正在分配货位,请等待几秒再进行操作!");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2384,6 +2403,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@SneakyThrows
|
||||||
public void allCancel(JSONObject whereJson) {
|
public void allCancel(JSONObject whereJson) {
|
||||||
//出库分配表
|
//出库分配表
|
||||||
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||||
@@ -2415,6 +2435,12 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
if (ObjectUtil.isEmpty(diss)) {
|
if (ObjectUtil.isEmpty(diss)) {
|
||||||
throw new BadRequestException("不存在可以取消的出库分配明细");
|
throw new BadRequestException("不存在可以取消的出库分配明细");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RLock lock = redissonClient.getLock("all_cancelDivOne");
|
||||||
|
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
for (int i = 0; i < diss.size(); i++) {
|
for (int i = 0; i < diss.size(); i++) {
|
||||||
JSONObject dis = diss.getJSONObject(i);
|
JSONObject dis = diss.getJSONObject(i);
|
||||||
HashMap<String, String> map = new HashMap<>();
|
HashMap<String, String> map = new HashMap<>();
|
||||||
@@ -2523,6 +2549,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("其他出库单当前正在取消分配,请等待几秒再进行操作!");
|
||||||
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user