生成单据详情

master
anthonywj 2 years ago
parent e55b64da99
commit f086482fdd

@ -576,25 +576,25 @@ public class IoCodeTempController extends BaseController {
IoOrderEntity isExit = orderService.findById(orderId); IoOrderEntity isExit = orderService.findById(orderId);
if (isExit == null) { if (isExit == null) {
IoOrderEntity orderSaveRequest = new IoOrderEntity(); orderEntity = new IoOrderEntity();
orderSaveRequest.setBillNo(orderId); orderEntity.setBillNo(orderId);
orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId()); orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderSaveRequest.setMainAction(bussinessTypeEntity.getMainAction()); orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
orderSaveRequest.setAction(bussinessTypeEntity.getAction()); orderEntity.setAction(bussinessTypeEntity.getAction());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp()); orderEntity.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setFromInvCode(addOrderRequest.getFromInvCode()); orderEntity.setFromInvCode(addOrderRequest.getFromInvCode());
orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW); orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT); orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
AuthAdmin authAdmin = getUser(); AuthAdmin authAdmin = getUser();
orderSaveRequest.setCreateUser(authAdmin.getId() + ""); orderEntity.setCreateUser(authAdmin.getId() + "");
orderSaveRequest.setCreateTime(new Date()); orderEntity.setCreateTime(new Date());
orderSaveRequest.setUpdateUser(authAdmin.getId() + ""); orderEntity.setUpdateUser(authAdmin.getId() + "");
orderSaveRequest.setUpdateTime(new Date()); orderEntity.setUpdateTime(new Date());
orderSaveRequest.setCustomerId(authAdmin.getCustomerId()); orderEntity.setCustomerId(authAdmin.getCustomerId());
orderSaveRequest.setDeptCode(invWarehouseEntity.getParentId()); orderEntity.setDeptCode(invWarehouseEntity.getParentId());
orderSaveRequest.setInvCode(addOrderRequest.getInvCode()); orderEntity.setInvCode(addOrderRequest.getInvCode());
orderService.insertOrder(orderSaveRequest); orderService.insertOrder(orderEntity);
} }
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk); BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
@ -614,6 +614,7 @@ public class IoCodeTempController extends BaseController {
} }
} }
addCodeResult.setOrderId(orderId); addCodeResult.setOrderId(orderId);
transInoutService.genOrderDetailCode(orderEntity, codeEnttity);
return ResultVOUtils.success(addCodeResult); return ResultVOUtils.success(addCodeResult);
} }

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import lombok.Data; import lombok.Data;
@Data @Data
@ -24,7 +26,7 @@ public class IoOrderDetailCodeEntity implements Serializable {
* ID * ID
*/ */
@TableField(value = "bindRlFk") @TableField(value = "bindRlFk")
private String bindRlFk; private Long bindRlFk;
/** /**
* DIUUID * DIUUID

@ -13,7 +13,7 @@ import lombok.Data;
@Data @Data
@TableName(value = "io_order") @TableName(value = "io_order")
public class IoOrderEntity implements Serializable { public class IoOrderEntity implements Serializable {
@TableId(value = "id", type = IdType.INPUT) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
/** /**

@ -2,6 +2,7 @@ package com.glxp.api.res.basic;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
@ -81,7 +82,7 @@ public class UdiRelevanceResponse {
private String basicPrductRemak6; private String basicPrductRemak6;
private String basicPrductRemak7; private String basicPrductRemak7;
private String basicPrductRemak8; private String basicPrductRemak8;
private String price; private BigDecimal price;
//关联查询字典 //关联查询字典
private String unitFk; //供应商ID private String unitFk; //供应商ID

@ -1,4 +1,14 @@
package com.glxp.api.service.inout; package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import java.util.List;
public interface IoOrderDetailBizService { public interface IoOrderDetailBizService {
List<IoOrderDetailBizEntity> findByOrderId(String orderId);
int insert(IoOrderDetailBizEntity orderDetailBizEntity);
int update(IoOrderDetailBizEntity orderDetailBizEntity);
} }

@ -1,4 +1,15 @@
package com.glxp.api.service.inout; package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import java.util.List;
public interface IoOrderDetailCodeService { public interface IoOrderDetailCodeService {
List<IoOrderDetailCodeEntity> findByOrderId(String orderId);
int insert(IoOrderDetailCodeEntity orderDetailCodeEntity);
int update(IoOrderDetailCodeEntity orderDetailCodeEntity);
} }

@ -1,4 +1,16 @@
package com.glxp.api.service.inout; package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderDetailResultEntity;
import java.util.List;
public interface IoOrderDetailResultService { public interface IoOrderDetailResultService {
List<IoOrderDetailResultEntity> findByOrderId(String orderId);
int insert(IoOrderDetailResultEntity orderDetailResultEntity);
int update(IoOrderDetailResultEntity orderDetailResultEntity);
} }

@ -1,5 +1,6 @@
package com.glxp.api.service.inout; package com.glxp.api.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.glxp.api.constant.Constant; import com.glxp.api.constant.Constant;
import com.glxp.api.constant.ConstantStatus; import com.glxp.api.constant.ConstantStatus;
@ -15,6 +16,7 @@ import com.glxp.api.req.basic.FilterCompanyProductRelevanceRequest;
import com.glxp.api.req.inout.PdaCodeEntity; import com.glxp.api.req.inout.PdaCodeEntity;
import com.glxp.api.req.inout.PostOrderRequest; import com.glxp.api.req.inout.PostOrderRequest;
import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.basic.UdiRelevanceResponse;
import com.glxp.api.service.basic.UdiRelevanceService;
import com.glxp.api.service.basic.UdiRlSupService; import com.glxp.api.service.basic.UdiRlSupService;
import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.util.CustomUtil; import com.glxp.api.util.CustomUtil;
@ -26,6 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -43,6 +46,10 @@ public class IoTransInoutService {
IoCodeService codeService; IoCodeService codeService;
@Resource @Resource
UdiRlSupService udiRlSupService; UdiRlSupService udiRlSupService;
@Resource
IoOrderDetailCodeService orderDetailCodeService;
@Resource
UdiRelevanceService udiRelevanceService;
//手持终端上传生成扫码单据 //手持终端上传生成扫码单据
public void creatOrderByPda(PostOrderRequest postOrderRequest) { public void creatOrderByPda(PostOrderRequest postOrderRequest) {
@ -197,9 +204,45 @@ public class IoTransInoutService {
//生成扫码单据详情 //生成扫码单据详情
public void transInout(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) { public void genOrderDetailCode(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity) {
List<IoOrderDetailCodeEntity> ioOrderDetailCodeEntities = orderDetailCodeService.findByOrderId(orderEntity.getBillNo());
UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectGroupById(codeTempEntity.getRelId());
if (CollUtil.isEmpty(ioOrderDetailCodeEntities)) {
orderDetailCodeService.insert(buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse));
} else {
ioOrderDetailCodeEntities.forEach(orderDetailCodeEntity ->
{
if (orderDetailCodeEntity.getBindRlFk() == udiRelevanceResponse.getId() && orderDetailCodeEntity.getBatchNo().equals(codeTempEntity.getBatchNo())) {
orderDetailCodeEntity.setCount(orderDetailCodeEntity.getCount() + codeTempEntity.getCount());
orderDetailCodeEntity.setReCount(orderDetailCodeEntity.getReCount() + codeTempEntity.getReCount());
orderDetailCodeService.update(orderDetailCodeEntity);
} else {
orderDetailCodeService.insert(buildEntity(orderEntity, codeTempEntity, udiRelevanceResponse));
}
});
}
}
IoOrderDetailCodeEntity buildEntity(IoOrderEntity orderEntity, IoCodeTempEntity codeTempEntity, UdiRelevanceResponse udiRelevanceResponse) {
IoOrderDetailCodeEntity ioOrderDetailCodeEntity = new IoOrderDetailCodeEntity();
ioOrderDetailCodeEntity.setOrderIdFk(orderEntity.getBillNo());
ioOrderDetailCodeEntity.setBindRlFk(udiRelevanceResponse.getId());
ioOrderDetailCodeEntity.setUuidFk(udiRelevanceResponse.getUuid());
ioOrderDetailCodeEntity.setBatchNo(codeTempEntity.getBatchNo());
ioOrderDetailCodeEntity.setNameCode(codeTempEntity.getNameCode());
ioOrderDetailCodeEntity.setProductDate(codeTempEntity.getProduceDate());
ioOrderDetailCodeEntity.setExpireDate(codeTempEntity.getExpireDate());
ioOrderDetailCodeEntity.setCoName(udiRelevanceResponse.getCpmctymc());
ioOrderDetailCodeEntity.setCertCode(udiRelevanceResponse.getZczbhhzbapzbh());
ioOrderDetailCodeEntity.setYlqxzcrbarmc(udiRelevanceResponse.getYlqxzcrbarmc());
ioOrderDetailCodeEntity.setManufacturer(udiRelevanceResponse.getManufactory());
ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getMeasname());
ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getGgxh());
ioOrderDetailCodeEntity.setPrice(udiRelevanceResponse.getPrice());
ioOrderDetailCodeEntity.setCount(codeTempEntity.getCount());
ioOrderDetailCodeEntity.setReCount(codeTempEntity.getReCount());
return ioOrderDetailCodeEntity;
} }
} }

@ -1,4 +1,34 @@
package com.glxp.api.service.inout.impl; package com.glxp.api.service.inout.impl;
public class IoOrderDetailBizServiceImpl { import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inout.IoOrderDetailBizDao;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.service.inout.IoOrderDetailBizService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class IoOrderDetailBizServiceImpl implements IoOrderDetailBizService {
@Resource
IoOrderDetailBizDao ioOrderDetailBizDao;
@Override
public List<IoOrderDetailBizEntity> findByOrderId(String orderId) {
return ioOrderDetailBizDao.selectList(new QueryWrapper<IoOrderDetailBizEntity>().eq("orderIdFk", orderId));
}
@Override
public int insert(IoOrderDetailBizEntity orderDetailBizEntity) {
return ioOrderDetailBizDao.insert(orderDetailBizEntity);
}
@Override
public int update(IoOrderDetailBizEntity orderDetailBizEntity) {
return ioOrderDetailBizDao.updateById(orderDetailBizEntity);
}
} }

@ -1,4 +1,33 @@
package com.glxp.api.service.inout.impl; package com.glxp.api.service.inout.impl;
public class IoOrderDetailCodeServiceImpl { import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.service.inout.IoOrderDetailCodeService;
import com.glxp.api.service.inout.IoOrderDetailResultService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class IoOrderDetailCodeServiceImpl implements IoOrderDetailCodeService {
@Resource
IoOrderDetailCodeDao ioOrderDetailCodeDao;
@Override
public List<IoOrderDetailCodeEntity> findByOrderId(String orderId) {
return ioOrderDetailCodeDao.selectList(new QueryWrapper<IoOrderDetailCodeEntity>().eq("orderIdFk", orderId));
}
@Override
public int insert(IoOrderDetailCodeEntity orderDetailCodeEntity) {
return ioOrderDetailCodeDao.insert(orderDetailCodeEntity);
}
@Override
public int update(IoOrderDetailCodeEntity orderDetailCodeEntity) {
return ioOrderDetailCodeDao.updateById(orderDetailCodeEntity);
}
} }

@ -1,8 +1,36 @@
package com.glxp.api.service.inout.impl; package com.glxp.api.service.inout.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.glxp.api.dao.inout.IoOrderDetailBizDao;
import com.glxp.api.dao.inout.IoOrderDetailCodeDao;
import com.glxp.api.dao.inout.IoOrderDetailResultDao;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import com.glxp.api.entity.inout.IoOrderDetailResultEntity;
import com.glxp.api.service.inout.IoOrderDetailResultService; import com.glxp.api.service.inout.IoOrderDetailResultService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service @Service
public class IoOrderDetailResultServiceImpl implements IoOrderDetailResultService { public class IoOrderDetailResultServiceImpl implements IoOrderDetailResultService {
@Resource
IoOrderDetailResultDao orderDetailResultDao;
@Override
public List<IoOrderDetailResultEntity> findByOrderId(String orderId) {
return orderDetailResultDao.selectList(new QueryWrapper<IoOrderDetailResultEntity>().eq("orderIdFk", orderId));
}
@Override
public int insert(IoOrderDetailResultEntity orderDetailResultEntity) {
return orderDetailResultDao.insert(orderDetailResultEntity);
}
@Override
public int update(IoOrderDetailResultEntity orderDetailResultEntity) {
return orderDetailResultDao.updateById(orderDetailResultEntity);
}
} }

Loading…
Cancel
Save