单据流转设置关联UUID,方便后续关联查询(单据编辑)

master
anthonywj 2 years ago
parent 9a7e2eb57c
commit 3691dd54b7

@ -1,6 +1,7 @@
package com.glxp.api.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus;
@ -64,12 +65,11 @@ public class IoChangeInoutService {
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderEntity.getBillNo());
if (basicBusTypePreEntity != null) {
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity);
}else {
} else {
//结束,不生成库存,
}
}
@ -141,6 +141,12 @@ public class IoChangeInoutService {
//生成单据
public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity) {
if (StrUtil.isEmpty(orderEntity.getRelKey())) {
orderEntity.setRelKey(UUID.fastUUID().toString(true));
orderService.update(orderEntity);
}
if (useInList.size() <= 0) {
return;
}

@ -1,6 +1,7 @@
package com.glxp.api.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.ConstantStatus;
@ -716,6 +717,11 @@ public class IoCheckInoutService {
}
}
if (preInOrder.size() > 0) {
if (StrUtil.isEmpty(orderEntity.getRelKey())) {
orderEntity.setRelKey(UUID.fastUUID().toString(true));
}
String preInBillNo = "";
boolean isBreak = false;
for (String key : preInOrder.keySet()) {
@ -723,6 +729,7 @@ public class IoCheckInoutService {
preInBillNo = preInBillNo + "," + key;
IoOrderEntity preInEntity = orderService.findByBillNo(key);
preInEntity.setPreOutBillNo(orderEntity.getBillNo());
preInEntity.setRelKey(orderEntity.getRelKey());
orderService.update(preInEntity);
BasicBussinessTypeEntity preBusType = basicBussinessTypeService.findByAction(preInEntity.getAction());
//预验收不删除单号,方便后续查询

@ -703,28 +703,31 @@ public class IoOrderServiceImpl implements IoOrderService {
* @return
*/
private List<IoOrderEntity> getAllOrder(IoOrderEntity order) {
Set<String> billNos = new HashSet<>();
billNos.add(order.getBillNo());
getLinkedBillNo(order.getBillNo(), billNos);
//去除本单的单据号
Iterator<String> iterator = billNos.iterator();
while (iterator.hasNext()) {
if (iterator.next().equals(order.getBillNo())) {
iterator.remove();
break;
}
}
ArrayList<IoOrderEntity> orders = new ArrayList<>();
if (CollUtil.isNotEmpty(billNos)) {
List<IoOrderEntity> list = orderDao.selectList(new QueryWrapper<IoOrderEntity>().in("billNo", billNos).orderByDesc("id"));
orders.addAll(list);
}
// Set<String> billNos = new HashSet<>();
// billNos.add(order.getBillNo());
List<IoOrderEntity> orderEntities = orderDao.selectList(new QueryWrapper<IoOrderEntity>().eq("relKey", order.getRelKey()));
// getLinkedBillNo(order.getBillNo(), billNos);
//
// //去除本单的单据号
// Iterator<String> iterator = billNos.iterator();
// while (iterator.hasNext()) {
// if (iterator.next().equals(order.getBillNo())) {
// iterator.remove();
// break;
// }
// }
//
// ArrayList<IoOrderEntity> orders = new ArrayList<>();
// if (CollUtil.isNotEmpty(billNos)) {
// List<IoOrderEntity> list = orderDao.selectList(new QueryWrapper<IoOrderEntity>().in("billNo", billNos).orderByDesc("id"));
// orders.addAll(list);
// }
//将查询入口单据放在第一位的顺序
orders.add(0, order);
return orders;
// orders.add(0, order);
return orderEntities;
}
/**

Loading…
Cancel
Save