|
|
|
@ -12,6 +12,7 @@ import com.glxp.api.entity.collect.IoCollectOrderBiz;
|
|
|
|
|
import com.glxp.api.entity.collect.IoSplitDesOrder;
|
|
|
|
|
import com.glxp.api.entity.collect.IoSplitDesOrderCode;
|
|
|
|
|
import com.glxp.api.entity.collect.IoSplitDesOrderDetail;
|
|
|
|
|
import com.glxp.api.entity.inout.IoSplitCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoSplitFifoInv;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
@ -19,11 +20,13 @@ import com.glxp.api.req.collect.AddInvDesDetaiRequest;
|
|
|
|
|
import com.glxp.api.req.collect.IoSplitDesOrderRequest;
|
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.res.collect.IoSplitDesOrderResponse;
|
|
|
|
|
import com.glxp.api.service.inout.IoSplitCodeService;
|
|
|
|
|
import com.glxp.api.service.inout.IoSplitFifoCodeService;
|
|
|
|
|
import com.glxp.api.service.inout.IoSplitFifoInvService;
|
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
|
import com.glxp.api.util.IntUtil;
|
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
|
import okhttp3.internal.http2.ErrorCode;
|
|
|
|
|
import org.apache.poi.ss.formula.functions.Offset;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -142,6 +145,9 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
IoSplitFifoInvService ioSplitFifoInvService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoSplitCodeService splitCodeService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public Boolean destroyOut(AddInvDesDetaiRequest addInvDesDetaiRequest) {
|
|
|
|
@ -199,4 +205,39 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void splitDesOrder(AddInvDesDetaiRequest addInvDesDetaiRequest) {
|
|
|
|
|
|
|
|
|
|
IoSplitDesOrder collectOrder;
|
|
|
|
|
if (StrUtil.isNotEmpty(addInvDesDetaiRequest.getBillNo())) {
|
|
|
|
|
collectOrder = getByBillNo(addInvDesDetaiRequest.getBillNo());
|
|
|
|
|
} else {
|
|
|
|
|
collectOrder = IoSplitDesOrder.builder()
|
|
|
|
|
.billNo(gennerOrderUtils.createWdOrderNo(new OrderNoTypeBean(Constant.SPLIT_DES_ORDER, "yyyyMMdd")))
|
|
|
|
|
.busType("1")
|
|
|
|
|
.workPlaceCode(addInvDesDetaiRequest.getWorkPlaceCode())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.billTime(new Date())
|
|
|
|
|
.remark(addInvDesDetaiRequest.getRemark())
|
|
|
|
|
.status(1)
|
|
|
|
|
.createUser(addInvDesDetaiRequest.getCreateUser())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.updateUser(addInvDesDetaiRequest.getUpdateUser())
|
|
|
|
|
.build();
|
|
|
|
|
save(collectOrder);
|
|
|
|
|
}
|
|
|
|
|
IoSplitCodeEntity splitCodeEntity = splitCodeService.findByCode(addInvDesDetaiRequest.getCode(), addInvDesDetaiRequest.getWorkPlaceCode(), null);
|
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
|
throw new RuntimeException("该追溯码不存在!");
|
|
|
|
|
}
|
|
|
|
|
int count = IntUtil.value(splitCodeEntity.getRemainCount()) - IntUtil.value(addInvDesDetaiRequest.getOutCount());
|
|
|
|
|
if (count < 0) {
|
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
|
throw new RuntimeException("存量不足!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
splitCodeEntity.setRemainCount(count);
|
|
|
|
|
splitCodeService.updateById(splitCodeEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|