rev:入库单创建人优化
This commit is contained in:
@@ -13,6 +13,7 @@ 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 com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||||
@@ -52,6 +53,8 @@ import org.nl.wms.sch.service.dto.PointDto;
|
|||||||
import org.nl.wms.sch.tasks.InTask;
|
import org.nl.wms.sch.tasks.InTask;
|
||||||
import org.nl.wms.st.inbill.service.StorPublicService;
|
import org.nl.wms.st.inbill.service.StorPublicService;
|
||||||
import org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl;
|
import org.nl.wms.st.returns.service.impl.InAndOutRetrunServiceImpl;
|
||||||
|
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.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,6 +127,8 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
|||||||
|
|
||||||
private IpdmBiSubpackagerelationService ipdmBiSubpackagerelationService;
|
private IpdmBiSubpackagerelationService ipdmBiSubpackagerelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object pageQuery(Map query, Pageable pageQuery) {
|
public Object pageQuery(Map query, Pageable pageQuery) {
|
||||||
@@ -260,7 +266,12 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@SneakyThrows
|
||||||
public void divStruct(Map whereJson) {
|
public void divStruct(Map whereJson) {
|
||||||
|
RLock lock = redissonClient.getLock(StIvtIostorinvServiceImpl.class.getName());
|
||||||
|
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||||
|
try {
|
||||||
|
if (tryLock) {
|
||||||
// 仓位表
|
// 仓位表
|
||||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||||
// 库区表
|
// 库区表
|
||||||
@@ -405,6 +416,14 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
|||||||
sendJson.put("task_id", task_id1);
|
sendJson.put("task_id", task_id1);
|
||||||
this.reIssueTask(sendJson);
|
this.reIssueTask(sendJson);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new BadRequestException("有入库单据正在分配中,请稍后在试");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
if (tryLock) {
|
||||||
|
lock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BstIvtBoxinfo getBstIvtBoxinfo(Map whereJson) {
|
private BstIvtBoxinfo getBstIvtBoxinfo(Map whereJson) {
|
||||||
@@ -648,6 +667,20 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
|||||||
*/
|
*/
|
||||||
private StIvtIostorinv updataMst(Map whereJson, StIvtIostorinv mstDao) {
|
private StIvtIostorinv updataMst(Map whereJson, StIvtIostorinv mstDao) {
|
||||||
|
|
||||||
|
// 明细-用于查找包装关系
|
||||||
|
ArrayList<HashMap> list = (ArrayList<HashMap>) whereJson.get("tableData");
|
||||||
|
|
||||||
|
List<JSONObject> rows = list.stream()
|
||||||
|
.map(row -> JSONObject.parseObject(JSON.toJSONString(row)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (ObjectUtil.isEmpty(rows)) {
|
||||||
|
throw new BadRequestException("出入库明细不能为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelation")
|
||||||
|
.query("package_box_sn = '" + rows.get(0).getString("package_box_sn") + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
|
||||||
// 仓库信息
|
// 仓库信息
|
||||||
StorattrDto storattrDto = storattrService.findById(Long.parseLong((String) whereJson.get("stor_id")));
|
StorattrDto storattrDto = storattrService.findById(Long.parseLong((String) whereJson.get("stor_id")));
|
||||||
|
|
||||||
@@ -655,9 +688,14 @@ public class StIvtIostorinvServiceImpl extends ServiceImpl<StIvtIostorinvMapper,
|
|||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||||
if (currentUserId.equals(IOSEnum.EXT_ACS.code("acs"))) {
|
if (currentUserId.equals(IOSEnum.EXT_ACS.code("acs"))) {
|
||||||
// 如果是外部系统创建人全部写系统参数
|
// 如果是外部系统创建人全部写系统参数: 如果包装关系上有创建人就用包装关系上的,如果没有就用默认的
|
||||||
|
if (ObjectUtil.isEmpty(jsonSub) || ObjectUtil.isEmpty(jsonSub.getString("create_id"))) {
|
||||||
currentUserId = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IOS_CONFIRM_USER").getValue();
|
currentUserId = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IOS_CONFIRM_USER").getValue();
|
||||||
currentNickName = IOSEnum.EXT_ACS.code("kc");
|
currentNickName = IOSEnum.EXT_ACS.code("kc");
|
||||||
|
} else {
|
||||||
|
currentUserId = jsonSub.getString("create_id");
|
||||||
|
currentNickName = jsonSub.getString("create_name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
|
|||||||
@@ -315,10 +315,21 @@ public class InBoxManageServiceImpl implements InBoxManageService {
|
|||||||
public void returnIn(JSONObject whereJson) {
|
public void returnIn(JSONObject whereJson) {
|
||||||
// 载具表
|
// 载具表
|
||||||
//api/twoPda/vehicle/returnIn
|
//api/twoPda/vehicle/returnIn
|
||||||
|
|
||||||
|
// 根据木箱号查询是否有托盘绑定关系,如果有则解绑
|
||||||
|
JSONObject jsonExt = WQLObject.getWQLObject("md_pb_storagevehicleext")
|
||||||
|
.query("pcsn = '" + whereJson.getString("box_no") + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(jsonExt)) {
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("pcsn", "");
|
||||||
|
WQLObject.getWQLObject("md_pb_storagevehicleext")
|
||||||
|
.update(param,"pcsn = '"+whereJson.getString("box_no")+"'");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 查询mes木箱信息,插入木箱信息表
|
* 查询mes木箱信息,插入木箱信息表
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("box_no") + "' AND status = '0'").getResultJSONArray(0);
|
JSONArray resultJSONArray = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + whereJson.getString("box_no") + "' AND status = '0'").getResultJSONArray(0);
|
||||||
if (ObjectUtil.isEmpty(resultJSONArray)) {
|
if (ObjectUtil.isEmpty(resultJSONArray)) {
|
||||||
throw new BadRequestException("未查询到子卷包装信息!");
|
throw new BadRequestException("未查询到子卷包装信息!");
|
||||||
|
|||||||
@@ -2032,6 +2032,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
} else {
|
} else {
|
||||||
throw new BadRequestException("托盘号有误,无法找到对应的托盘类型!");
|
throw new BadRequestException("托盘号有误,无法找到对应的托盘类型!");
|
||||||
}
|
}
|
||||||
|
// 更新子卷包装关系为生成
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("status", IOSEnum.IS_NOTANDYES.code("否"));
|
||||||
|
WQLObject.getWQLObject("pdm_bi_subpackagerelation")
|
||||||
|
.update(param,"package_box_sn = '"+jsonObject.getString("box_no")+"'");
|
||||||
|
|
||||||
jsonTaskParam.put("request_param", request_param);
|
jsonTaskParam.put("request_param", request_param);
|
||||||
TwoExceptionInTask bean = SpringContextHolder.getBean(TwoExceptionInTask.class);
|
TwoExceptionInTask bean = SpringContextHolder.getBean(TwoExceptionInTask.class);
|
||||||
bean.createTask(jsonTaskParam);
|
bean.createTask(jsonTaskParam);
|
||||||
|
|||||||
Reference in New Issue
Block a user