单据流程相关迁移到UDI管理系统
parent
aca8b1b682
commit
0b746a5a09
@ -1,9 +1,14 @@
|
|||||||
package com.glxp.api.dao.inout;
|
package com.glxp.api.dao.inout;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.glxp.api.dao.BaseMapperPlus;
|
||||||
import com.glxp.api.entity.inout.IoCodeLostEntity;
|
import com.glxp.api.entity.inout.IoCodeLostEntity;
|
||||||
|
import com.glxp.api.res.inout.IoCodeLostResponse;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface IoCodeLostMapper extends BaseMapper<IoCodeLostEntity> {
|
public interface IoCodeLostMapper extends BaseMapperPlus<IoCodeLostMapper, IoCodeLostEntity, IoCodeLostEntity> {
|
||||||
|
List<IoCodeLostResponse> selectLost(IoCodeLostEntity ioCodeLostEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.glxp.api.dao.inout;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.dao.BaseMapperPlus;
|
||||||
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface IoOrderInvoiceMapper extends BaseMapperPlus<IoOrderInvoiceMapper, IoOrderInvoiceEntity, IoOrderInvoiceEntity> {
|
||||||
|
|
||||||
|
boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package com.glxp.api.entity.inout;
|
||||||
|
|
||||||
|
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 lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "io_order_invoice")
|
||||||
|
public class IoOrderInvoiceEntity {
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号外键
|
||||||
|
*/
|
||||||
|
@TableField(value = "orderIdFk")
|
||||||
|
private String orderIdFk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "machineNo")
|
||||||
|
private String machineNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票代码
|
||||||
|
*/
|
||||||
|
@TableField(value = "invoiceCode")
|
||||||
|
private String invoiceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "invoiceEncode")
|
||||||
|
private String invoiceEncode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "invoiceDate")
|
||||||
|
private String invoiceDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票价格
|
||||||
|
*/
|
||||||
|
@TableField(value = "price")
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新是日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateTime")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "`createUser`")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "createTime")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateUser")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
@TableField(value = "bindRlFk")
|
||||||
|
private String bindRlFk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
@TableField(value = "batchNo")
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "productDate")
|
||||||
|
private String productDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失效日期
|
||||||
|
*/
|
||||||
|
@TableField(value = "expireDate")
|
||||||
|
private String expireDate;
|
||||||
|
|
||||||
|
@TableField(value = "licenseUrl")
|
||||||
|
private String licenseUrl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
public static final String COL_ID = "id";
|
||||||
|
|
||||||
|
public static final String COL_ORDERIDFK = "orderIdFk";
|
||||||
|
|
||||||
|
public static final String COL_MACHINENO = "machineNo";
|
||||||
|
|
||||||
|
public static final String COL_INVOICECODE = "invoiceCode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEENCODE = "invoiceEncode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEDATE = "invoiceDate";
|
||||||
|
|
||||||
|
public static final String COL_PRICE = "price";
|
||||||
|
|
||||||
|
public static final String COL_UPDATETIME = "updateTime";
|
||||||
|
|
||||||
|
public static final String COL_CREATEUSER = "createUser";
|
||||||
|
|
||||||
|
public static final String COL_CREATETIME = "createTime";
|
||||||
|
|
||||||
|
public static final String COL_UPDATEUSER = "updateUser";
|
||||||
|
|
||||||
|
public static final String COL_REMARK = "remark";
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.glxp.api.req.inout;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2023/3/15 10:02
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IoOrderInvoiceRequest {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private String orderIdFk;
|
||||||
|
|
||||||
|
|
||||||
|
private String machineNo;
|
||||||
|
|
||||||
|
|
||||||
|
private String invoiceCode;
|
||||||
|
|
||||||
|
|
||||||
|
private String invoiceEncode;
|
||||||
|
|
||||||
|
|
||||||
|
private String invoiceDate;
|
||||||
|
|
||||||
|
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
|
||||||
|
private String bindRlFk;
|
||||||
|
|
||||||
|
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
|
||||||
|
private String productDate;
|
||||||
|
|
||||||
|
|
||||||
|
private String expireDate;
|
||||||
|
|
||||||
|
private String licenseUrl;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
public static final String COL_ID = "id";
|
||||||
|
|
||||||
|
public static final String COL_ORDERIDFK = "orderIdFk";
|
||||||
|
|
||||||
|
public static final String COL_MACHINENO = "machineNo";
|
||||||
|
|
||||||
|
public static final String COL_INVOICECODE = "invoiceCode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEENCODE = "invoiceEncode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEDATE = "invoiceDate";
|
||||||
|
|
||||||
|
public static final String COL_PRICE = "price";
|
||||||
|
|
||||||
|
public static final String COL_UPDATETIME = "updateTime";
|
||||||
|
|
||||||
|
public static final String COL_CREATEUSER = "createUser";
|
||||||
|
|
||||||
|
public static final String COL_CREATETIME = "createTime";
|
||||||
|
|
||||||
|
public static final String COL_UPDATEUSER = "updateUser";
|
||||||
|
|
||||||
|
public static final String COL_REMARK = "remark";
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.glxp.api.res.inout;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2023/3/22 11:08
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IoCodeLostResponse {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
|
||||||
|
private String produceDate;
|
||||||
|
|
||||||
|
|
||||||
|
private String expireDate;
|
||||||
|
|
||||||
|
|
||||||
|
private String serialNo;
|
||||||
|
|
||||||
|
|
||||||
|
private String supId;
|
||||||
|
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
//产品名称
|
||||||
|
private String cpmctymc;
|
||||||
|
//规格型号
|
||||||
|
private String ggxh;
|
||||||
|
|
||||||
|
public static final String COL_ID = "id";
|
||||||
|
|
||||||
|
public static final String COL_CODE = "code";
|
||||||
|
|
||||||
|
public static final String COL_BATCHNO = "batchNo";
|
||||||
|
|
||||||
|
public static final String COL_PRODUCEDATE = "produceDate";
|
||||||
|
|
||||||
|
public static final String COL_EXPIREDATE = "expireDate";
|
||||||
|
|
||||||
|
public static final String COL_SERIALNO = "serialNo";
|
||||||
|
|
||||||
|
public static final String COL_SUPID = "supId";
|
||||||
|
|
||||||
|
public static final String COL_CREATETIME = "createTime";
|
||||||
|
|
||||||
|
public static final String COL_UPDATETIME = "updateTime";
|
||||||
|
|
||||||
|
public static final String COL_REMARK = "remark";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package com.glxp.api.res.inout;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName(value = "io_order_invoice")
|
||||||
|
public class IoOrderInvoiceResponse {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号外键
|
||||||
|
*/
|
||||||
|
private String orderIdFk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器编码
|
||||||
|
*/
|
||||||
|
private String machineNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票代码
|
||||||
|
*/
|
||||||
|
private String invoiceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票编码
|
||||||
|
*/
|
||||||
|
private String invoiceEncode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开票日期
|
||||||
|
*/
|
||||||
|
private String invoiceDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发票价格
|
||||||
|
*/
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新是日期
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
private String bindRlFk;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产日期
|
||||||
|
*/
|
||||||
|
private String productDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失效日期
|
||||||
|
*/
|
||||||
|
private String expireDate;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private String cpmctymc;
|
||||||
|
|
||||||
|
private String ggxh;
|
||||||
|
private String licenseUrl;
|
||||||
|
|
||||||
|
|
||||||
|
public static final String COL_ID = "id";
|
||||||
|
|
||||||
|
public static final String COL_ORDERIDFK = "orderIdFk";
|
||||||
|
|
||||||
|
public static final String COL_MACHINENO = "machineNo";
|
||||||
|
|
||||||
|
public static final String COL_INVOICECODE = "invoiceCode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEENCODE = "invoiceEncode";
|
||||||
|
|
||||||
|
public static final String COL_INVOICEDATE = "invoiceDate";
|
||||||
|
|
||||||
|
public static final String COL_PRICE = "price";
|
||||||
|
|
||||||
|
public static final String COL_UPDATETIME = "updateTime";
|
||||||
|
|
||||||
|
public static final String COL_CREATEUSER = "createUser";
|
||||||
|
|
||||||
|
public static final String COL_CREATETIME = "createTime";
|
||||||
|
|
||||||
|
public static final String COL_UPDATEUSER = "updateUser";
|
||||||
|
|
||||||
|
public static final String COL_REMARK = "remark";
|
||||||
|
}
|
@ -0,0 +1,253 @@
|
|||||||
|
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;
|
||||||
|
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.inv.InvProductDetailEntity;
|
||||||
|
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
||||||
|
import com.glxp.api.service.auth.InvWarehouseService;
|
||||||
|
import com.glxp.api.service.basic.IBasicBusTypePreService;
|
||||||
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
||||||
|
import com.glxp.api.service.inv.InvProductDetailService;
|
||||||
|
import com.glxp.api.service.system.SystemParamConfigService;
|
||||||
|
import com.glxp.api.util.CustomUtil;
|
||||||
|
import com.glxp.api.util.DateUtil;
|
||||||
|
import com.glxp.api.util.GennerOrderUtils;
|
||||||
|
import com.glxp.api.util.OrderNoTypeBean;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据流转
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class IoChangeInoutService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IBasicBusTypePreService basicBusTypePreService;
|
||||||
|
@Resource
|
||||||
|
IoCodeService codeService;
|
||||||
|
@Resource
|
||||||
|
IoOrderService orderService;
|
||||||
|
@Resource
|
||||||
|
InvProductDetailService invProductDetailService;
|
||||||
|
@Resource
|
||||||
|
IBasicBussinessTypeService basicBussinessTypeService;
|
||||||
|
@Resource
|
||||||
|
GennerOrderUtils gennerOrderUtils;
|
||||||
|
@Resource
|
||||||
|
IoAddInoutService addInoutService;
|
||||||
|
@Resource
|
||||||
|
IoCheckInoutService ioCheckInoutService;
|
||||||
|
@Resource
|
||||||
|
InvWarehouseService invWarehouseService;
|
||||||
|
@Resource
|
||||||
|
SystemParamConfigService systemParamConfigService;
|
||||||
|
@Resource
|
||||||
|
IoCodeTempService codeTempService;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
//结束,不生成库存,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//后续做修改
|
||||||
|
public void changeBusOrder(IoOrderEntity orderEntity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//普通出入库单据流转
|
||||||
|
public void genNewOrder(IoOrderEntity orderEntity, List<InvProductDetailEntity> invProductDetailEntities) {
|
||||||
|
|
||||||
|
BasicBusTypePreEntity basicBusTypePreEntity = basicBusTypePreService.findByOriginAction(orderEntity.getAction());
|
||||||
|
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderEntity.getBillNo());
|
||||||
|
if (basicBusTypePreEntity.getSupplementAll()) {//全量补单
|
||||||
|
invProductDetailService.insertList(invProductDetailEntities);
|
||||||
|
buildInOrder(basicBusTypePreEntity, codeEnttities, orderEntity);
|
||||||
|
} else { //缺量补单
|
||||||
|
List<IoCodeEntity> inList = new ArrayList<>();
|
||||||
|
for (IoCodeEntity warehouseEntity : codeEnttities) {
|
||||||
|
Integer invCount = getInvCount(warehouseEntity);
|
||||||
|
Integer count = warehouseEntity.getMyReCount();
|
||||||
|
if (invCount > 0) {//仓库已存在该产品
|
||||||
|
if (count > invCount) { //当前数量>结余数量,说明该产品是无序列号或者是多级包装
|
||||||
|
if (count > invCount) { //该产品实际数量大于结余数量,说明是多级包装,直接补
|
||||||
|
inList.add(warehouseEntity);
|
||||||
|
} else if (warehouseEntity.getSerialNo() == null) { //无序列号(多级包装无序列号的已在上一步被排除),补齐数量
|
||||||
|
int lea = count - invCount;
|
||||||
|
warehouseEntity.setCount(lea / (count)); //
|
||||||
|
inList.add(warehouseEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { //结余数量《=0直接补
|
||||||
|
inList.add(warehouseEntity);
|
||||||
|
}
|
||||||
|
InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode());
|
||||||
|
invProductDetailService.insert(invProductDetailEntity);
|
||||||
|
}
|
||||||
|
buildInOrder(basicBusTypePreEntity, inList, orderEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvProductDetailEntity filterInvByCode(List<InvProductDetailEntity> invProductDetailEntities, String
|
||||||
|
code) {
|
||||||
|
for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) {
|
||||||
|
if (invProductDetailEntity.getCode().equals(code)) {
|
||||||
|
return invProductDetailEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算当前库存数量
|
||||||
|
public int getInvCount(IoCodeEntity codeEntity) {
|
||||||
|
|
||||||
|
List<InvProductDetailEntity> resultLists = invProductDetailService.selectByUnique(codeEntity.getRelId(), codeEntity.getBatchNo(), codeEntity.getSupId(), codeEntity.getDeptCode(), codeEntity.getInvCode());
|
||||||
|
int invCount = 0;
|
||||||
|
if (CollUtil.isNotEmpty(resultLists)) {
|
||||||
|
for (InvProductDetailEntity invProductDetailEntity : resultLists) {
|
||||||
|
if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
||||||
|
invCount = invCount - invProductDetailEntity.getReCount();
|
||||||
|
} else {
|
||||||
|
invCount = invCount + invProductDetailEntity.getReCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return invCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成单据
|
||||||
|
public void buildInOrder(BasicBusTypePreEntity bussinessChangeTypeEntity, List<IoCodeEntity> useInList, IoOrderEntity orderEntity) {
|
||||||
|
if (useInList.size() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, List<IoCodeEntity>> filterSupMaps = new HashMap<>();
|
||||||
|
BasicBussinessTypeEntity targetBustypeEntity = basicBussinessTypeService.findByAction(bussinessChangeTypeEntity.getAction());
|
||||||
|
//过滤供应商
|
||||||
|
if (targetBustypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
||||||
|
for (IoCodeEntity warehouseEntity : useInList) {
|
||||||
|
if (warehouseEntity.getSupId() != null) {
|
||||||
|
if (filterSupMaps.get(warehouseEntity.getSupId()) == null) {
|
||||||
|
List<IoCodeEntity> temps = new ArrayList<>();
|
||||||
|
temps.add(warehouseEntity);
|
||||||
|
filterSupMaps.put(warehouseEntity.getSupId(), temps);
|
||||||
|
} else {
|
||||||
|
filterSupMaps.get(warehouseEntity.getSupId()).add(warehouseEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 原先单据流程
|
||||||
|
filterSupMaps.put("test", useInList);
|
||||||
|
// filterSupMaps.put(bussinessChangeTypeEntity.getDefaultInvCode(), useInList);
|
||||||
|
}
|
||||||
|
//根据往来单位生成入库单
|
||||||
|
for (String corpName : filterSupMaps.keySet()) {
|
||||||
|
List<IoCodeEntity> temps;
|
||||||
|
temps = filterSupMaps.get(corpName);
|
||||||
|
IoOrderEntity outOrder = new IoOrderEntity();
|
||||||
|
BeanUtils.copyProperties(orderEntity, outOrder);
|
||||||
|
outOrder.setId(null);
|
||||||
|
outOrder.setSupplementNo(null);//补单需置空
|
||||||
|
if (bussinessChangeTypeEntity.getBeforeTime() != null)
|
||||||
|
outOrder.setCreateTime(DateUtil.getBeforeDay(DateUtil.fromDate(orderEntity), bussinessChangeTypeEntity.getBeforeTime()));
|
||||||
|
else
|
||||||
|
outOrder.setCreateTime(DateUtil.fromDate(orderEntity));
|
||||||
|
outOrder.setAction(targetBustypeEntity.getAction());
|
||||||
|
outOrder.setMainAction(targetBustypeEntity.getMainAction());
|
||||||
|
outOrder.setBusType(targetBustypeEntity.getBusType());
|
||||||
|
outOrder.setFromType(ConstantStatus.FROM_CHANGE);
|
||||||
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(targetBustypeEntity.getPrefix()), "yyyyMMdd"));
|
||||||
|
outOrder.setBillNo(orderNo);
|
||||||
|
|
||||||
|
if (targetBustypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
||||||
|
outOrder.setCustomerId(corpName);
|
||||||
|
outOrder.setFromCorp(corpName);
|
||||||
|
outOrder.setFromInvCode(null);
|
||||||
|
outOrder.setFromDeptCode(null);
|
||||||
|
} else {
|
||||||
|
outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID);
|
||||||
|
|
||||||
|
|
||||||
|
InvWarehouseEntity curInv = invWarehouseService.findByInvSubByCode(orderEntity.getInvCode());
|
||||||
|
InvWarehouseEntity upInv = invWarehouseService.findByInvSubByCode(curInv.getParentCode());
|
||||||
|
outOrder.setFromInvCode(upInv.getCode());
|
||||||
|
outOrder.setFromDeptCode(upInv.getParentId());
|
||||||
|
//原先流程---使用流转单据默认仓库
|
||||||
|
// outOrder.setFromInvCode(bussinessChangeTypeEntity.getDefaultInvCode());
|
||||||
|
// outOrder.setFromDeptCode(bussinessChangeTypeEntity.getDefaultDeptCode());
|
||||||
|
outOrder.setFromCorp(null);
|
||||||
|
}
|
||||||
|
outOrder.setCorpOrderId(CustomUtil.getId() + "x");
|
||||||
|
//原先流程---使用流转单据默认仓库
|
||||||
|
// InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(bussinessChangeTypeEntity.getInvCode());
|
||||||
|
// outOrder.setInvCode(invWarehouseEntity.getCode());
|
||||||
|
// outOrder.setDeptCode(invWarehouseEntity.getParentId());
|
||||||
|
|
||||||
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(orderEntity.getInvCode());
|
||||||
|
outOrder.setInvCode(invWarehouseEntity.getCode());
|
||||||
|
outOrder.setDeptCode(invWarehouseEntity.getParentId());
|
||||||
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("additional_auto_submit");
|
||||||
|
if ("1".equals(systemParamConfigEntity.getParamValue())) {
|
||||||
|
outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
||||||
|
} else {
|
||||||
|
outOrder.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//互填单号
|
||||||
|
orderEntity.setUllageSupNo(outOrder.getBillNo());
|
||||||
|
orderEntity.setUpdateTime(new Date());
|
||||||
|
orderService.update(orderEntity);
|
||||||
|
outOrder.setOriginUllageSupNo(orderEntity.getBillNo());
|
||||||
|
outOrder.setCreateUser(null);
|
||||||
|
outOrder.setReviewUser(null);
|
||||||
|
orderService.insertOrder(outOrder);
|
||||||
|
List<IoCodeTempEntity> codeTempEntities = new ArrayList<>();
|
||||||
|
for (IoCodeEntity warehouseEntity : temps) {
|
||||||
|
IoCodeTempEntity codeTempEntity = new IoCodeTempEntity();
|
||||||
|
BeanUtils.copyProperties(warehouseEntity, codeTempEntity);
|
||||||
|
codeTempEntity.setId(null);
|
||||||
|
codeTempEntity.setOrderId(outOrder.getBillNo());
|
||||||
|
codeTempEntity.setAction(outOrder.getAction());
|
||||||
|
codeTempEntity.setMainAction(outOrder.getMainAction());
|
||||||
|
codeTempEntities.add(codeTempEntity);
|
||||||
|
}
|
||||||
|
codeTempService.insertBatch(codeTempEntities);
|
||||||
|
|
||||||
|
//根据单据设置状态 1:草稿
|
||||||
|
if (bussinessChangeTypeEntity.getAuditStatus() == 1) {
|
||||||
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
|
||||||
|
orderService.update(orderEntity);
|
||||||
|
} else if (bussinessChangeTypeEntity.getAuditStatus() == 2 || bussinessChangeTypeEntity.getAuditStatus() == 3) {
|
||||||
|
addInoutService.dealProcess(outOrder);
|
||||||
|
if (!ioCheckInoutService.checkManual(outOrder.getBillNo())) {
|
||||||
|
ioCheckInoutService.check(outOrder.getBillNo());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.glxp.api.service.inout;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
||||||
|
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
|
||||||
|
|
||||||
|
public interface IoOrderInvoiceService {
|
||||||
|
|
||||||
|
boolean deleteByInvId(Integer id);
|
||||||
|
|
||||||
|
boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest);
|
||||||
|
|
||||||
|
boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.glxp.api.service.inout.impl;
|
||||||
|
|
||||||
|
import com.glxp.api.dao.inout.IoOrderInvoiceMapper;
|
||||||
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
||||||
|
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
|
||||||
|
import com.glxp.api.service.inout.IoOrderInvoiceService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class IoOrderInvoiceServiceImpl implements IoOrderInvoiceService {
|
||||||
|
@Resource
|
||||||
|
IoOrderInvoiceMapper ioOrderInvoiceMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteByInvId(Integer id) {
|
||||||
|
return this.ioOrderInvoiceMapper.deleteById(id)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateByInvId(IoOrderInvoiceRequest ioOrderInvoiceRequest) {
|
||||||
|
IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity();
|
||||||
|
BeanUtils.copyProperties(ioOrderInvoiceRequest,ioOrderInvoiceEntity);
|
||||||
|
return this.ioOrderInvoiceMapper.updateById(ioOrderInvoiceEntity)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean insertInvoice(IoOrderInvoiceEntity ioOrderInvoiceEntity) {
|
||||||
|
return ioOrderInvoiceMapper.insertInvoice(ioOrderInvoiceEntity);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,28 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.glxp.api.dao.inout.IoCodeLostMapper">
|
<mapper namespace="com.glxp.api.dao.inout.IoCodeLostMapper">
|
||||||
|
<select id="selectLost" parameterType="com.glxp.api.entity.inout.IoCodeLostEntity"
|
||||||
|
resultType="com.glxp.api.res.inout.IoCodeLostResponse">
|
||||||
|
select io_code_lost.*, basic_products.cpmctymc, basic_products.ggxh
|
||||||
|
from io_code_lost
|
||||||
|
LEFT JOIN basic_products on io_code_lost.nameCode = basic_products.nameCode
|
||||||
|
<where>
|
||||||
|
<if test="code != '' and code != null">
|
||||||
|
and code like concat('%', #{code}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="cpmctymc != '' and cpmctymc != null">
|
||||||
|
and basic_products.cpmctymc like concat('%', #{cpmctymc}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="ggxh != '' and ggxh != null">
|
||||||
|
and basic_products.ggxh like concat('%', #{ggxh}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="batchNo != '' and batchNo != null">
|
||||||
|
and batchNo like concat('%', #{batchNo}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
AND date_format(io_code_lost.createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.glxp.api.dao.inout.IoOrderInvoiceMapper">
|
||||||
|
<insert id="insertInvoice" parameterType="com.glxp.api.entity.inout.IoOrderInvoiceEntity">
|
||||||
|
INSERT INTO io_order_invoice(orderIdFk, bindRlFk, batchNo, productDate, expireDate)
|
||||||
|
values (#{orderIdFk},
|
||||||
|
#{bindRlFk},
|
||||||
|
#{batchNo},
|
||||||
|
#{productDate},
|
||||||
|
#{expireDate})
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue