生成单据详情

master
anthonywj 2 years ago
parent e55b64da99
commit f086482fdd

@ -576,25 +576,25 @@ public class IoCodeTempController extends BaseController {
IoOrderEntity isExit = orderService.findById(orderId);
if (isExit == null) {
IoOrderEntity orderSaveRequest = new IoOrderEntity();
orderSaveRequest.setBillNo(orderId);
orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderSaveRequest.setMainAction(bussinessTypeEntity.getMainAction());
orderSaveRequest.setAction(bussinessTypeEntity.getAction());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setFromInvCode(addOrderRequest.getFromInvCode());
orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW);
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
orderEntity = new IoOrderEntity();
orderEntity.setBillNo(orderId);
orderEntity.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderEntity.setMainAction(bussinessTypeEntity.getMainAction());
orderEntity.setAction(bussinessTypeEntity.getAction());
orderEntity.setFromCorp(addOrderRequest.getFromCorp());
orderEntity.setFromInvCode(addOrderRequest.getFromInvCode());
orderEntity.setFromType(ConstantStatus.FROM_WEBNEW);
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT);
AuthAdmin authAdmin = getUser();
orderSaveRequest.setCreateUser(authAdmin.getId() + "");
orderSaveRequest.setCreateTime(new Date());
orderSaveRequest.setUpdateUser(authAdmin.getId() + "");
orderSaveRequest.setUpdateTime(new Date());
orderSaveRequest.setCustomerId(authAdmin.getCustomerId());
orderSaveRequest.setDeptCode(invWarehouseEntity.getParentId());
orderSaveRequest.setInvCode(addOrderRequest.getInvCode());
orderService.insertOrder(orderSaveRequest);
orderEntity.setCreateUser(authAdmin.getId() + "");
orderEntity.setCreateTime(new Date());
orderEntity.setUpdateUser(authAdmin.getId() + "");
orderEntity.setUpdateTime(new Date());
orderEntity.setCustomerId(authAdmin.getCustomerId());
orderEntity.setDeptCode(invWarehouseEntity.getParentId());
orderEntity.setInvCode(addOrderRequest.getInvCode());
orderService.insertOrder(orderEntity);
}
BaseResponse baseResponse = checkRelId(codeEnttity, unitFk);
@ -614,6 +614,7 @@ public class IoCodeTempController extends BaseController {
}
}
addCodeResult.setOrderId(orderId);
transInoutService.genOrderDetailCode(orderEntity, codeEnttity);
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.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.Data;
@Data
@ -24,7 +26,7 @@ public class IoOrderDetailCodeEntity implements Serializable {
* ID
*/
@TableField(value = "bindRlFk")
private String bindRlFk;
private Long bindRlFk;
/**
* DIUUID

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

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

@ -1,4 +1,14 @@
package com.glxp.api.service.inout;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import java.util.List;
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;
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
import java.util.List;
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;
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 {
List<IoOrderDetailResultEntity> findByOrderId(String orderId);
int insert(IoOrderDetailResultEntity orderDetailResultEntity);
int update(IoOrderDetailResultEntity orderDetailResultEntity);
}

@ -1,5 +1,6 @@
package com.glxp.api.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.glxp.api.constant.Constant;
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.PostOrderRequest;
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.IBasicBussinessTypeService;
import com.glxp.api.util.CustomUtil;
@ -26,6 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -43,6 +46,10 @@ public class IoTransInoutService {
IoCodeService codeService;
@Resource
UdiRlSupService udiRlSupService;
@Resource
IoOrderDetailCodeService orderDetailCodeService;
@Resource
UdiRelevanceService udiRelevanceService;
//手持终端上传生成扫码单据
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;
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;
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;
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 org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
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