|
|
|
@ -22,10 +22,12 @@ import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderResponse;
|
|
|
|
|
import com.glxp.api.res.inv.BindInvSpaceRequest;
|
|
|
|
|
import com.glxp.api.res.inv.InvPlaceDetailResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPlaceOrderService;
|
|
|
|
|
import com.glxp.api.service.inv.InvPlaceService;
|
|
|
|
|
import com.glxp.api.util.BeanCopyUtils;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -62,7 +64,10 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
private InvPlaceOrderDetailDao invPlaceOrderDetailDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private UdiRelevanceService udiRelevanceService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
private GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -82,62 +87,62 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
//查询仓库的部门ID
|
|
|
|
|
// String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=new ArrayList<>();
|
|
|
|
|
List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>();
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//拆解库存表
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity=new InvPreInProductDetailEntity();
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity();
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode",""));
|
|
|
|
|
ew.gt("inCount",0);
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(invPreInProductDetailEntity.getInCount()>0){
|
|
|
|
|
String nameCode=invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount=getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount);
|
|
|
|
|
if (invPreInProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invPreInProductDetailDao.updateById(invPreInProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity1=invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
if(invPreInProductDetailEntity1!=null){
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount);
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity1 = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity1 != null) {
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount);
|
|
|
|
|
invPreInProductDetailDao.updateById(invPreInProductDetailEntity1);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setId(null);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(reCount);
|
|
|
|
|
invPreInProductDetailEntity.setOutCount(0);
|
|
|
|
|
if (bindInvSpaceRequest.getType()==3){
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
invPreInProductDetailDao.insert(invPreInProductDetailEntity);
|
|
|
|
@ -149,58 +154,58 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//拆解库存表
|
|
|
|
|
InvPreProductDetailEntity invPreInProductDetailEntity=new InvPreProductDetailEntity();
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreProductDetailEntity invPreInProductDetailEntity = new InvPreProductDetailEntity();
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode",""));
|
|
|
|
|
ew.gt("inCount",0);
|
|
|
|
|
invPreInProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
invPreInProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(invPreInProductDetailEntity.getInCount()>0){
|
|
|
|
|
String nameCode=invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount=getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount);
|
|
|
|
|
if (invPreInProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invPreProductDetailDao.updateById(invPreInProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvPreProductDetailEntity invPreInProductDetailEntity1=invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
if(invPreInProductDetailEntity1!=null){
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount);
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvPreProductDetailEntity invPreInProductDetailEntity1 = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity1 != null) {
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount);
|
|
|
|
|
invPreProductDetailDao.updateById(invPreInProductDetailEntity1);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setId(null);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setOutCount(0);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(reCount);
|
|
|
|
|
if (bindInvSpaceRequest.getType()==3){
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
invPreProductDetailDao.insert(invPreInProductDetailEntity);
|
|
|
|
@ -210,57 +215,57 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//拆解库存表
|
|
|
|
|
InvProductDetailEntity invPreInProductDetailEntity=new InvProductDetailEntity();
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvProductDetailEntity invPreInProductDetailEntity = new InvProductDetailEntity();
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invProductDetailDao.selectOne(ew);
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode",""));
|
|
|
|
|
ew.gt("inCount",0);
|
|
|
|
|
invPreInProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity=invProductDetailDao.selectOne(ew);
|
|
|
|
|
}
|
|
|
|
|
if(invPreInProductDetailEntity.getInCount()>0){
|
|
|
|
|
String nameCode=invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount=getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount);
|
|
|
|
|
invPreInProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
}
|
|
|
|
|
if (invPreInProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invProductDetailDao.updateById(invPreInProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code",invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvProductDetailEntity invPreInProductDetailEntity1=invProductDetailDao.selectOne(ew);
|
|
|
|
|
if(invPreInProductDetailEntity1!=null){
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount);
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
} else {
|
|
|
|
|
ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InvProductDetailEntity invPreInProductDetailEntity1 = invProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity1 != null) {
|
|
|
|
|
invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount);
|
|
|
|
|
invProductDetailDao.updateById(invPreInProductDetailEntity1);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setId(null);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setOutCount(0);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(reCount);
|
|
|
|
|
if (bindInvSpaceRequest.getType()==3){
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode());
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode());
|
|
|
|
|
}
|
|
|
|
|
invProductDetailDao.insert(invPreInProductDetailEntity);
|
|
|
|
@ -271,12 +276,12 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum();
|
|
|
|
|
QueryWrapper<InvPlaceOrderEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("recordId",bindInvSpaceRequest.getOrderId());
|
|
|
|
|
InvPlaceOrderEntity invPlaceOrderEntity=new InvPlaceOrderEntity();
|
|
|
|
|
QueryWrapper<InvPlaceOrderEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
InvPlaceOrderEntity invPlaceOrderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId());
|
|
|
|
|
invPlaceOrderEntity.setCount(total);
|
|
|
|
|
invPlaceOrderDao.update(invPlaceOrderEntity,ew);
|
|
|
|
|
invPlaceOrderDao.update(invPlaceOrderEntity, ew);
|
|
|
|
|
|
|
|
|
|
// if (CollUtil.isNotEmpty(list)) {
|
|
|
|
|
// List<Integer> ids = list.stream().map(InvProductDetailEntity::getId).collect(Collectors.toList());
|
|
|
|
@ -314,42 +319,42 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
//查询仓库的部门ID
|
|
|
|
|
// String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=new ArrayList<>();
|
|
|
|
|
List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId",bindInvSpaceRequest.getOId());
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity=new InvPreInProductDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId", bindInvSpaceRequest.getOId());
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity();
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invPreInProductDetailDao.update(invPreInProductDetailEntity,ew);
|
|
|
|
|
invPreInProductDetailDao.update(invPreInProductDetailEntity, ew);
|
|
|
|
|
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId",bindInvSpaceRequest.getOId());
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity=new InvPreProductDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId", bindInvSpaceRequest.getOId());
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity();
|
|
|
|
|
invPreProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invPreProductDetailDao.update(invPreProductDetailEntity,ew);
|
|
|
|
|
invPreProductDetailDao.update(invPreProductDetailEntity, ew);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId",bindInvSpaceRequest.getOId());
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity=new InvProductDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("orderId", bindInvSpaceRequest.getOId());
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
|
|
|
|
|
invProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invProductDetailDao.update(invProductDetailEntity,ew);
|
|
|
|
|
invProductDetailDao.update(invProductDetailEntity, ew);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum();
|
|
|
|
|
QueryWrapper<InvPlaceOrderEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("recordId",bindInvSpaceRequest.getOrderId());
|
|
|
|
|
InvPlaceOrderEntity invPlaceOrderEntity=new InvPlaceOrderEntity();
|
|
|
|
|
QueryWrapper<InvPlaceOrderEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
InvPlaceOrderEntity invPlaceOrderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId());
|
|
|
|
|
invPlaceOrderEntity.setCount(total);
|
|
|
|
|
invPlaceOrderDao.update(invPlaceOrderEntity,ew);
|
|
|
|
|
invPlaceOrderDao.update(invPlaceOrderEntity, ew);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -480,84 +485,161 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
@Override
|
|
|
|
|
public String checkCount(BindInvSpaceRequest bindInvSpaceRequest) {
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", bindInvSpaceRequest.getInvCode()));
|
|
|
|
|
Integer count=0;
|
|
|
|
|
Integer count = 0;
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
count=invPreInProductDetailEntity.getInCount();
|
|
|
|
|
}else{
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
count = invPreInProductDetailEntity.getInCount();
|
|
|
|
|
} else {
|
|
|
|
|
count = invPreInProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode());
|
|
|
|
|
}
|
|
|
|
|
if(count==null || count<=0){
|
|
|
|
|
if (count == null || count <= 0) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){
|
|
|
|
|
QueryWrapper ew=new QueryWrapper();
|
|
|
|
|
ew.eq("recordId",bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if(invPlaceOrderDetailEntity==null){
|
|
|
|
|
invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity();
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew = new QueryWrapper();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if(invPlaceOrderDetailEntity.getCount()>=count){
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= count) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity=invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
count=invPreProductDetailEntity.getInCount();
|
|
|
|
|
}else{
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
count = invPreProductDetailEntity.getInCount();
|
|
|
|
|
} else {
|
|
|
|
|
count = invPreProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count==null || count<=0){
|
|
|
|
|
if (count == null || count <= 0) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){
|
|
|
|
|
QueryWrapper ew=new QueryWrapper();
|
|
|
|
|
ew.eq("recordId",bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if(invPlaceOrderDetailEntity==null){
|
|
|
|
|
invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity();
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew = new QueryWrapper();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if(invPlaceOrderDetailEntity.getCount()>=count){
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= count) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL){
|
|
|
|
|
if(bindInvSpaceRequest.getType()==3){
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>();
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity=invProductDetailDao.selectOne(ew);
|
|
|
|
|
count=invProductDetailEntity.getInCount();
|
|
|
|
|
}else{
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) {
|
|
|
|
|
if (bindInvSpaceRequest.getType() == 3) {
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
count = invProductDetailEntity.getInCount();
|
|
|
|
|
} else {
|
|
|
|
|
count = invProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count==null || count<=0){
|
|
|
|
|
if (count == null || count <= 0) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew = new QueryWrapper();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= count) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String checkOutCount(BindInvSpaceRequest bindInvSpaceRequest) {
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", bindInvSpaceRequest.getInvCode()));
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.select("count");
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity.getCount() <= 0) {
|
|
|
|
|
return "该产品没存在该货架上!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew1 = new QueryWrapper();
|
|
|
|
|
ew1.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew1.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= invPreInProductDetailEntity.getCount()) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.select("count");
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreProductDetailEntity.getCount() <= 0) {
|
|
|
|
|
return "该产品没存在该货架上!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew1 = new QueryWrapper();
|
|
|
|
|
ew1.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew1.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= invPreProductDetailEntity.getCount()) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){
|
|
|
|
|
QueryWrapper ew=new QueryWrapper();
|
|
|
|
|
ew.eq("recordId",bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew.eq("code",bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew);
|
|
|
|
|
if(invPlaceOrderDetailEntity==null){
|
|
|
|
|
invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity();
|
|
|
|
|
}
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) {
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
ew.select("count");
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invProductDetailEntity.getCount() <= 0) {
|
|
|
|
|
return "该产品没存在该货架上!";
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) {
|
|
|
|
|
QueryWrapper ew1 = new QueryWrapper();
|
|
|
|
|
ew1.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
ew1.eq("code", bindInvSpaceRequest.getCode());
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1);
|
|
|
|
|
if (invPlaceOrderDetailEntity == null) {
|
|
|
|
|
invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(0);
|
|
|
|
|
}
|
|
|
|
|
if(invPlaceOrderDetailEntity.getCount()>=count){
|
|
|
|
|
if (invPlaceOrderDetailEntity.getCount() >= invProductDetailEntity.getCount()) {
|
|
|
|
|
return "该产品库存不足!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -565,11 +647,13 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getActCount(String nameCode) {
|
|
|
|
|
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(nameCode);
|
|
|
|
|
int count = getActCount(udiRelevanceResponse);
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getActCount(UdiRelevanceResponse udiRelevanceResponse) {
|
|
|
|
|
int actCount;
|
|
|
|
|
if (!udiRelevanceResponse.getUseDy() && (udiRelevanceResponse.getDiType() == null || udiRelevanceResponse.getDiType() != 2)) {
|
|
|
|
@ -590,4 +674,352 @@ public class InvPlaceServiceImpl implements InvPlaceService {
|
|
|
|
|
|
|
|
|
|
return actCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse unbindInvOrderSpace(BindInvSpaceRequest bindInvSpaceRequest) {
|
|
|
|
|
//查询仓库的部门ID
|
|
|
|
|
// String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>();
|
|
|
|
|
int total=0;
|
|
|
|
|
if (bindInvSpaceRequest.getOutCount() > 0) {
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//去掉库存
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (invPreInProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invPreInProductDetailDao.updateById(invPreInProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
//如果库存为空就删了该数据
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity != null && invPreInProductDetailEntity.getInCount() == 0 && invPreInProductDetailEntity.getOutCount() == 0
|
|
|
|
|
&& invPreInProductDetailEntity.getCount() == 0 && invPreInProductDetailEntity.getReCount() == 0) {
|
|
|
|
|
invPreInProductDetailDao.deleteById(invPreInProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果有存在数据就加没有就新建
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreInProductDetailEntity != null) {
|
|
|
|
|
nameCode = invPreInProductDetailEntity.getNameCode();
|
|
|
|
|
reCount = getActCount(nameCode);
|
|
|
|
|
invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() + 1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() + reCount);
|
|
|
|
|
invPreInProductDetailDao.updateById(invPreInProductDetailEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew);
|
|
|
|
|
invPreInProductDetailEntity.setId(null);
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
invPreInProductDetailEntity.setInCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setCount(1);
|
|
|
|
|
invPreInProductDetailEntity.setReCount(reCount);
|
|
|
|
|
invPreInProductDetailEntity.setOutCount(0);
|
|
|
|
|
invPreInProductDetailDao.insert(invPreInProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//去掉库存
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (invPreProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invPlaceOrderDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invPreProductDetailEntity.setInCount(invPreProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invPreProductDetailEntity.setCount(invPreProductDetailEntity.getCount() - 1);
|
|
|
|
|
invPreProductDetailEntity.setReCount(invPreProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invPreProductDetailDao.updateById(invPreProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
//如果库存为空就删了该数据
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreProductDetailEntity != null && invPreProductDetailEntity.getInCount() == 0 && invPreProductDetailEntity.getOutCount() == 0
|
|
|
|
|
&& invPreProductDetailEntity.getCount() == 0 && invPreProductDetailEntity.getReCount() == 0) {
|
|
|
|
|
invPreProductDetailDao.deleteById(invPreProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果有存在数据就加没有就新建
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invPreProductDetailEntity != null) {
|
|
|
|
|
nameCode = invPreProductDetailEntity.getNameCode();
|
|
|
|
|
reCount = getActCount(nameCode);
|
|
|
|
|
invPreProductDetailEntity.setInCount(invPreProductDetailEntity.getInCount() + 1);
|
|
|
|
|
invPreProductDetailEntity.setCount(invPreProductDetailEntity.getCount() + 1);
|
|
|
|
|
invPreProductDetailEntity.setReCount(invPreProductDetailEntity.getReCount() + reCount);
|
|
|
|
|
invPreProductDetailDao.updateById(invPreProductDetailEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew);
|
|
|
|
|
invPreProductDetailEntity.setId(null);
|
|
|
|
|
invPreProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
invPreProductDetailEntity.setInCount(1);
|
|
|
|
|
invPreProductDetailEntity.setCount(1);
|
|
|
|
|
invPreProductDetailEntity.setReCount(reCount);
|
|
|
|
|
invPreProductDetailEntity.setOutCount(0);
|
|
|
|
|
invPreProductDetailDao.insert(invPreProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId()));
|
|
|
|
|
for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) {
|
|
|
|
|
|
|
|
|
|
for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) {
|
|
|
|
|
//去掉库存
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.gt("inCount", 0);
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (invProductDetailEntity.getInCount() > 0) {
|
|
|
|
|
String nameCode = invProductDetailEntity.getNameCode();
|
|
|
|
|
int reCount = getActCount(nameCode);
|
|
|
|
|
invProductDetailEntity.setInCount(invProductDetailEntity.getInCount() - 1);
|
|
|
|
|
invProductDetailEntity.setCount(invProductDetailEntity.getCount() - 1);
|
|
|
|
|
invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() - reCount);
|
|
|
|
|
invProductDetailDao.updateById(invProductDetailEntity);
|
|
|
|
|
|
|
|
|
|
//如果库存为空就删了该数据
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invProductDetailEntity != null && invProductDetailEntity.getInCount() == 0 && invProductDetailEntity.getOutCount() == 0
|
|
|
|
|
&& invProductDetailEntity.getCount() == 0 && invProductDetailEntity.getReCount() == 0) {
|
|
|
|
|
invProductDetailDao.deleteById(invProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果有存在数据就加没有就新建
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", ""));
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
if (invProductDetailEntity != null) {
|
|
|
|
|
nameCode = invProductDetailEntity.getNameCode();
|
|
|
|
|
reCount = getActCount(nameCode);
|
|
|
|
|
invProductDetailEntity.setInCount(invProductDetailEntity.getInCount() + 1);
|
|
|
|
|
invProductDetailEntity.setCount(invProductDetailEntity.getCount() + 1);
|
|
|
|
|
invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() + reCount);
|
|
|
|
|
invProductDetailDao.updateById(invProductDetailEntity);
|
|
|
|
|
} else {
|
|
|
|
|
ew.clear();
|
|
|
|
|
ew.eq("code", invPlaceOrderDetailEntity.getCode());
|
|
|
|
|
ew.last("limit 1");
|
|
|
|
|
invProductDetailEntity = invProductDetailDao.selectOne(ew);
|
|
|
|
|
invProductDetailEntity.setId(null);
|
|
|
|
|
invProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
invProductDetailEntity.setInCount(1);
|
|
|
|
|
invProductDetailEntity.setCount(1);
|
|
|
|
|
invProductDetailEntity.setReCount(reCount);
|
|
|
|
|
invProductDetailEntity.setOutCount(0);
|
|
|
|
|
invProductDetailDao.insert(invProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum();
|
|
|
|
|
} else {
|
|
|
|
|
if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) {
|
|
|
|
|
|
|
|
|
|
QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity();
|
|
|
|
|
invPreInProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
List<InvPreInProductDetailEntity> invProductDetailEntityList=invPreInProductDetailDao.selectList(ew);
|
|
|
|
|
//操作人ID
|
|
|
|
|
String userId = customerService.getUserIdStr();
|
|
|
|
|
String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd"));
|
|
|
|
|
//插入主表
|
|
|
|
|
InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
orderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
orderEntity.setRecordId(recordId);
|
|
|
|
|
orderEntity.setType(4);
|
|
|
|
|
orderEntity.setCreateUser(userId);
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
invPlaceOrderDao.insert(orderEntity);
|
|
|
|
|
for (InvPreInProductDetailEntity productDetailEntity : invProductDetailEntityList) {
|
|
|
|
|
for (int i=0;i<productDetailEntity.getCount();i++){
|
|
|
|
|
//插入附表
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
invPlaceOrderDetailEntity.setRecordId(recordId);
|
|
|
|
|
invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + "");
|
|
|
|
|
invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(1);
|
|
|
|
|
invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity);
|
|
|
|
|
total++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
invPreInProductDetailDao.update(invPreInProductDetailEntity, ew);
|
|
|
|
|
bindInvSpaceRequest.setOrderId(recordId);
|
|
|
|
|
} else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity();
|
|
|
|
|
invPreProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
List<InvPreProductDetailEntity> invProductDetailEntityList=invPreProductDetailDao.selectList(ew);
|
|
|
|
|
//操作人ID
|
|
|
|
|
String userId = customerService.getUserIdStr();
|
|
|
|
|
String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd"));
|
|
|
|
|
//插入主表
|
|
|
|
|
InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
orderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
orderEntity.setRecordId(recordId);
|
|
|
|
|
orderEntity.setType(4);
|
|
|
|
|
orderEntity.setCreateUser(userId);
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
invPlaceOrderDao.insert(orderEntity);
|
|
|
|
|
for (InvPreProductDetailEntity productDetailEntity : invProductDetailEntityList) {
|
|
|
|
|
for (int i=0;i<productDetailEntity.getCount();i++){
|
|
|
|
|
//插入附表
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
invPlaceOrderDetailEntity.setRecordId(recordId);
|
|
|
|
|
invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + "");
|
|
|
|
|
invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(1);
|
|
|
|
|
invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity);
|
|
|
|
|
total++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
invPreProductDetailDao.update(invPreProductDetailEntity, ew);
|
|
|
|
|
bindInvSpaceRequest.setOrderId(recordId);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
|
|
|
|
|
invProductDetailEntity.setInvSpaceCode("");
|
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntityList=invProductDetailDao.selectList(ew);
|
|
|
|
|
//操作人ID
|
|
|
|
|
String userId = customerService.getUserIdStr();
|
|
|
|
|
String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd"));
|
|
|
|
|
//插入主表
|
|
|
|
|
InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
orderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
orderEntity.setRecordId(recordId);
|
|
|
|
|
orderEntity.setType(4);
|
|
|
|
|
orderEntity.setCreateUser(userId);
|
|
|
|
|
orderEntity.setCreateTime(new Date());
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
|
invPlaceOrderDao.insert(orderEntity);
|
|
|
|
|
for (InvProductDetailEntity productDetailEntity : invProductDetailEntityList) {
|
|
|
|
|
for (int i=0;i<productDetailEntity.getCount();i++){
|
|
|
|
|
//插入附表
|
|
|
|
|
InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity();
|
|
|
|
|
invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
invPlaceOrderDetailEntity.setRecordId(recordId);
|
|
|
|
|
invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + "");
|
|
|
|
|
invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate());
|
|
|
|
|
invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode());
|
|
|
|
|
invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo());
|
|
|
|
|
invPlaceOrderDetailEntity.setCount(1);
|
|
|
|
|
invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity);
|
|
|
|
|
total++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
invProductDetailDao.update(invProductDetailEntity, ew);
|
|
|
|
|
bindInvSpaceRequest.setOrderId(recordId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<InvPlaceOrderEntity> ew = new QueryWrapper<>();
|
|
|
|
|
ew.eq("recordId", bindInvSpaceRequest.getOrderId());
|
|
|
|
|
InvPlaceOrderEntity invPlaceOrderEntity = new InvPlaceOrderEntity();
|
|
|
|
|
invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId());
|
|
|
|
|
invPlaceOrderEntity.setCount(total);
|
|
|
|
|
invPlaceOrderDao.update(invPlaceOrderEntity, ew);
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|