|
|
|
@ -9,9 +9,7 @@ import com.glxp.api.constant.ConstantType;
|
|
|
|
|
import com.glxp.api.entity.auth.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBusTypePreEntity;
|
|
|
|
|
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoCodeTempEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.*;
|
|
|
|
|
import com.glxp.api.entity.inv.InvProductDetailEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.service.auth.InvWarehouseService;
|
|
|
|
@ -58,18 +56,21 @@ public class IoChangeInoutService {
|
|
|
|
|
SystemParamConfigService systemParamConfigService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoCodeTempService codeTempService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderInvoiceService ioOrderInvoiceService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderDetailBizService orderDetailBizService;
|
|
|
|
|
|
|
|
|
|
public void changeOrder(IoOrderEntity orderEntity) {
|
|
|
|
|
|
|
|
|
|
BasicBusTypePreEntity basicBusTypePreEntity = basicBusTypePreService.findByOriginAction(orderEntity.getAction());
|
|
|
|
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderEntity.getBillNo());
|
|
|
|
|
if (basicBusTypePreEntity != null) {
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity);
|
|
|
|
|
} else {
|
|
|
|
|
//结束,不生成库存,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (basicBusTypePreEntity != null) {
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity, true);
|
|
|
|
|
}
|
|
|
|
|
//结束,不生成库存,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -86,7 +87,7 @@ public class IoChangeInoutService {
|
|
|
|
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderEntity.getBillNo());
|
|
|
|
|
if (basicBusTypePreEntity.getSupplementAll()) {//全量补单
|
|
|
|
|
invProductDetailService.insertList(invProductDetailEntities);
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity);
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity, false);
|
|
|
|
|
} else { //缺量补单
|
|
|
|
|
List<IoCodeEntity> inList = new ArrayList<>();
|
|
|
|
|
for (IoCodeEntity warehouseEntity : codeEnttities) {
|
|
|
|
@ -108,7 +109,7 @@ public class IoChangeInoutService {
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode());
|
|
|
|
|
invProductDetailService.insert(invProductDetailEntity);
|
|
|
|
|
}
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, inList, orderEntity);
|
|
|
|
|
buildInOrder(basicBusTypePreEntity, inList, orderEntity, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -140,7 +141,7 @@ public class IoChangeInoutService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成单据
|
|
|
|
|
public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity) {
|
|
|
|
|
public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity, boolean isGenInovice) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isEmpty(orderEntity.getRelKey())) {
|
|
|
|
@ -231,6 +232,8 @@ public class IoChangeInoutService {
|
|
|
|
|
outOrder.setCreateUser(null);
|
|
|
|
|
outOrder.setReviewUser(null);
|
|
|
|
|
orderService.insertOrder(outOrder);
|
|
|
|
|
|
|
|
|
|
//生成条码
|
|
|
|
|
List<IoCodeTempEntity> codeTempEntities = new ArrayList<>();
|
|
|
|
|
for (IoCodeEntity warehouseEntity : temps) {
|
|
|
|
|
IoCodeTempEntity codeTempEntity = new IoCodeTempEntity();
|
|
|
|
@ -242,6 +245,19 @@ public class IoChangeInoutService {
|
|
|
|
|
codeTempEntities.add(codeTempEntity);
|
|
|
|
|
}
|
|
|
|
|
codeTempService.insertBatch(codeTempEntities);
|
|
|
|
|
if (isGenInovice) {
|
|
|
|
|
//生成发票信息
|
|
|
|
|
List<IoOrderInvoiceEntity> invoiceEntities = ioOrderInvoiceService.findByBillNo(orderEntity.getBillNo());
|
|
|
|
|
if (CollUtil.isNotEmpty(invoiceEntities)) {
|
|
|
|
|
for (IoOrderInvoiceEntity orderInvoiceEntity : invoiceEntities) {
|
|
|
|
|
orderInvoiceEntity.setOrderIdFk(outOrder.getBillNo());
|
|
|
|
|
orderInvoiceEntity.setId(null);
|
|
|
|
|
orderInvoiceEntity.setBizIdFk(null);
|
|
|
|
|
orderInvoiceEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderInvoiceService.insertInvoice(orderInvoiceEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据单据设置状态 1:草稿
|
|
|
|
|
if (bussinessChangeTypeEntity.getAuditStatus() == 1) {
|
|
|
|
|