|
|
@ -34,7 +34,6 @@ import com.glxp.api.req.inout.OrderEditRequest;
|
|
|
|
import com.glxp.api.req.thrsys.UdiwmsOrderRequest;
|
|
|
|
import com.glxp.api.req.thrsys.UdiwmsOrderRequest;
|
|
|
|
import com.glxp.api.res.inout.IoOrderResponse;
|
|
|
|
import com.glxp.api.res.inout.IoOrderResponse;
|
|
|
|
import com.glxp.api.res.inout.OrderNoResult;
|
|
|
|
import com.glxp.api.res.inout.OrderNoResult;
|
|
|
|
import com.glxp.api.service.basic.BasicCorpService;
|
|
|
|
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
import com.glxp.api.service.inout.*;
|
|
|
|
import com.glxp.api.service.inv.*;
|
|
|
|
import com.glxp.api.service.inv.*;
|
|
|
@ -95,7 +94,7 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private HttpOkClient httpOkClient;
|
|
|
|
private HttpOkClient httpOkClient;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
BasicCorpDao basicCorpDao;
|
|
|
|
private BasicCorpDao basicCorpDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<IoOrderEntity> selectAll() {
|
|
|
|
public List<IoOrderEntity> selectAll() {
|
|
|
@ -191,43 +190,52 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
} else if (basicBussinessTypeEntity.isAdvanceType()) {
|
|
|
|
} else if (basicBussinessTypeEntity.isAdvanceType()) {
|
|
|
|
//是否寄售,删除寄售库存
|
|
|
|
//是否寄售,删除寄售库存
|
|
|
|
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
|
|
|
|
List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo);
|
|
|
|
for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
|
|
|
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
|
|
|
|
//更新库存
|
|
|
|
for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
|
|
|
InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
|
|
|
|
//更新库存
|
|
|
|
if (invProductEntity != null) {
|
|
|
|
InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
|
|
|
|
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
if (invProductEntity != null) {
|
|
|
|
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
|
|
|
|
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setInCount(count);
|
|
|
|
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setInCount(count);
|
|
|
|
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setOutCount(count);
|
|
|
|
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
|
|
|
|
|
|
|
|
invProductEntity.setOutCount(count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//计算实际数量
|
|
|
|
|
|
|
|
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
|
|
|
|
|
|
|
|
invPreProductService.update(invProductEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
invPreProductService.update(invProductEntity);
|
|
|
|
//删除库存详情
|
|
|
|
|
|
|
|
invPreProductDetailService.deleteByOrderId(billNo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//删除库存详情
|
|
|
|
|
|
|
|
invPreProductDetailService.deleteByOrderId(billNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//删除普通库存
|
|
|
|
//删除普通库存
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo);
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo);
|
|
|
|
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
|
|
|
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
|
|
|
|
//更新库存
|
|
|
|
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
|
|
|
InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
|
|
|
|
//更新库存
|
|
|
|
if (invProductEntity != null) {
|
|
|
|
InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode());
|
|
|
|
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
if (invProductEntity != null) {
|
|
|
|
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
|
|
|
|
if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setInCount(count);
|
|
|
|
int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount();
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setInCount(count);
|
|
|
|
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) {
|
|
|
|
invProductEntity.setOutCount(count);
|
|
|
|
int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount();
|
|
|
|
|
|
|
|
invProductEntity.setOutCount(count);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//计算实际数量
|
|
|
|
|
|
|
|
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
|
|
|
|
|
|
|
|
invProductService.update(invProductEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
invProductService.update(invProductEntity);
|
|
|
|
//删除库存详情
|
|
|
|
|
|
|
|
invProductDetailService.deleteByOrderId(billNo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//删除库存详情
|
|
|
|
|
|
|
|
invProductDetailService.deleteByOrderId(billNo);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -499,7 +507,7 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
filterOrderRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);
|
|
|
|
filterOrderRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Constant.ORDER_STATUS_NEW_ORDER:
|
|
|
|
case Constant.ORDER_STATUS_NEW_ORDER:
|
|
|
|
filterOrderRequest.setStatuses(Arrays.asList(1, 2, 4));
|
|
|
|
filterOrderRequest.setStatuses(Arrays.asList(1, 2, 4));
|
|
|
|
filterOrderRequest.setDealStatuses(Arrays.asList(1, 2));
|
|
|
|
filterOrderRequest.setDealStatuses(Arrays.asList(1, 2));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Constant.ORDER_STATUS_UN_CHECK:
|
|
|
|
case Constant.ORDER_STATUS_UN_CHECK:
|
|
|
@ -545,15 +553,23 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
//查询单据类型名称
|
|
|
|
//查询单据类型名称
|
|
|
|
String busTypeName = basicBussinessTypeDao.selectNameByAction(order.getAction());
|
|
|
|
String busTypeName = basicBussinessTypeDao.selectNameByAction(order.getAction());
|
|
|
|
response.setBillTypeName(busTypeName);
|
|
|
|
response.setBillTypeName(busTypeName);
|
|
|
|
//查询往来单位名称
|
|
|
|
|
|
|
|
BasicCorpEntity corpEntity = basicCorpDao.selectByErpId(order.getFromCorp());
|
|
|
|
|
|
|
|
response.setFromName(corpEntity.getName());
|
|
|
|
|
|
|
|
//查询部门名称
|
|
|
|
//查询部门名称
|
|
|
|
String deptName = deptDao.selectNameByCode(order.getDeptCode());
|
|
|
|
String deptName = deptDao.selectNameByCode(order.getDeptCode());
|
|
|
|
response.setDeptName(deptName);
|
|
|
|
response.setDeptName(deptName);
|
|
|
|
//查询仓库名称
|
|
|
|
//查询仓库名称
|
|
|
|
String invName = invWarehouseDao.selectNameByCode(order.getInvCode());
|
|
|
|
String invName = invWarehouseDao.selectNameByCode(order.getInvCode());
|
|
|
|
response.setInvName(invName);
|
|
|
|
response.setInvName(invName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询往来单位名称
|
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(order.getFromCorp())) {
|
|
|
|
|
|
|
|
BasicCorpEntity corpEntity = basicCorpDao.selectByErpId(order.getFromCorp());
|
|
|
|
|
|
|
|
response.setFromCorpName(corpEntity.getName());
|
|
|
|
|
|
|
|
} else if (StrUtil.isNotBlank(order.getFromInvCode())) {
|
|
|
|
|
|
|
|
String fromInvName = invWarehouseDao.selectNameByCode(order.getFromInvCode());
|
|
|
|
|
|
|
|
response.setFromCorpName(fromInvName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
responseList.add(response);
|
|
|
|
responseList.add(response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return responseList;
|
|
|
|
return responseList;
|
|
|
@ -673,11 +689,12 @@ public class IoOrderServiceImpl implements IoOrderService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<IoOrderEntity> orders = new ArrayList<>();
|
|
|
|
ArrayList<IoOrderEntity> orders = new ArrayList<>();
|
|
|
|
if (CollUtil.isNotEmpty(orders)) {
|
|
|
|
if (CollUtil.isNotEmpty(billNos)) {
|
|
|
|
List<IoOrderEntity> list = orderDao.selectList(new QueryWrapper<IoOrderEntity>().in("billNo", billNos).orderByDesc("id"));
|
|
|
|
List<IoOrderEntity> list = orderDao.selectList(new QueryWrapper<IoOrderEntity>().in("billNo", billNos).orderByDesc("id"));
|
|
|
|
orders.addAll(list);
|
|
|
|
orders.addAll(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
orders.add(order);
|
|
|
|
//将查询入口单据放在第一位的顺序
|
|
|
|
|
|
|
|
orders.add(0, order);
|
|
|
|
return orders;
|
|
|
|
return orders;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|