采购退货逻辑完善

jg-waiwang-pro
vayne 6 months ago
parent 9ba59efe59
commit f7e78bc51d

@ -164,6 +164,7 @@
<result column="carriageMode1" property="carriageMode1"/> <result column="carriageMode1" property="carriageMode1"/>
<result column="purchaseStatus" property="purchaseStatus"/> <result column="purchaseStatus" property="purchaseStatus"/>
<result column="wareHouseName" property="wareHouseName"/> <result column="wareHouseName" property="wareHouseName"/>
<result column="addressName" property="addressName"/>
</resultMap> </resultMap>
<resultMap id="contractInfo" type="jnpf.model.businessorder.ContractModel"> <resultMap id="contractInfo" type="jnpf.model.businessorder.ContractModel">
@ -675,11 +676,13 @@
'其他采购' '其他采购'
END AS orderType1, END AS orderType1,
b.NAME AS subjectName, b.NAME AS subjectName,
c.contract_name AS contractName c.contract_name AS contractName,
d.addressName
FROM FROM
jg_business_order a jg_business_order a
LEFT JOIN jg_subject_basic b ON a.first_subject_basic_id = b.id AND b.f_delete_mark IS NULL LEFT JOIN jg_subject_basic b ON a.first_subject_basic_id = b.id AND b.f_delete_mark IS NULL
LEFT JOIN jg_contract c ON a.contract_id = c.id AND c.f_delete_mark is NULL LEFT JOIN jg_contract c ON a.contract_id = c.id AND c.f_delete_mark is NULL
LEFT JOIN jg_business_address d ON a.receive_address = d.id AND d.f_delete_mark is null
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
</mapper> </mapper>

@ -422,4 +422,29 @@
${ew.customSqlSegment} AND e.f_status = 2 AND a.id not in (SELECT voucher_id from jg_warehousing_storage_poundlist where f_delete_mark is null) ${ew.customSqlSegment} AND e.f_status = 2 AND a.id not in (SELECT voucher_id from jg_warehousing_storage_poundlist where f_delete_mark is null)
</select> </select>
<select id="queryVoucherInfo" resultMap="voucherList">
select
a.*,
CASE
a.document_type
WHEN '1' THEN
'收货凭证'
WHEN '2' THEN
'发货凭证'
END AS documentType1,
CASE
a.voucher_type
WHEN '1' THEN
'磅单'
WHEN '2' THEN
'收据'
WHEN '3' THEN
'其他'
END AS voucherType1,
b.vehicle_number
from jg_voucher a
left join jg_vehicle b on a.vehicle_id = b.id and b.f_delete_mark is null
LEFT JOIN flow_task e ON a.id = e.f_process_id
where id = #{id} AND e.f_status = 2
</select>
</mapper> </mapper>

@ -33,4 +33,6 @@ public interface VoucherMapper extends BaseMapper<VoucherEntity> {
IPage<VoucherEntity> queryVoucherList(@Param("page") Page<VoucherEntity> page, @Param("voucherPagination")VoucherPagination voucherPagination, @Param("ew")QueryWrapper<VoucherEntity> voucherEntityQueryWrapper); IPage<VoucherEntity> queryVoucherList(@Param("page") Page<VoucherEntity> page, @Param("voucherPagination")VoucherPagination voucherPagination, @Param("ew")QueryWrapper<VoucherEntity> voucherEntityQueryWrapper);
IPage<VoucherEntity> queryVoucherPopup1(@Param("page") Page<VoucherEntity> page,@Param("ew") QueryWrapper<VoucherEntity> voucherEntityQueryWrapper); IPage<VoucherEntity> queryVoucherPopup1(@Param("page") Page<VoucherEntity> page,@Param("ew") QueryWrapper<VoucherEntity> voucherEntityQueryWrapper);
VoucherEntity queryVoucherInfo(String id);
} }

@ -58,4 +58,6 @@ public interface VoucherService extends IService<VoucherEntity> {
//查询采购发货凭证 //查询采购发货凭证
List<VoucherEntity> queryPurchaseDeliveryVoucherInfo(); List<VoucherEntity> queryPurchaseDeliveryVoucherInfo();
VoucherEntity queryVoucherInfo(String id);
} }

@ -632,4 +632,9 @@ public class VoucherServiceImpl extends ServiceImpl<VoucherMapper, VoucherEntity
public List<VoucherEntity> queryPurchaseDeliveryVoucherInfo() { public List<VoucherEntity> queryPurchaseDeliveryVoucherInfo() {
return voucherMapper.queryPurchaseDeliveryVoucher(); return voucherMapper.queryPurchaseDeliveryVoucher();
} }
@Override
public VoucherEntity queryVoucherInfo(String id) {
return voucherMapper.queryVoucherInfo(id);
}
} }

@ -658,8 +658,8 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
// WarehousingStorageEntity entity = JsonUtil.getJsonToBean(receiptOrderForm, WarehousingStorageEntity.class); // WarehousingStorageEntity entity = JsonUtil.getJsonToBean(receiptOrderForm, WarehousingStorageEntity.class);
WarehousingStorageEntity entity = new WarehousingStorageEntity(); WarehousingStorageEntity entity = new WarehousingStorageEntity();
entity.setDocumentNo(generaterSwapUtil.getBillNumber("rukudanbianhao", false)); entity.setDocumentNo(generaterSwapUtil.getBillNumber("rukudanbianhao", false));
entity.setWarehousingStorageType("15"); entity.setWarehousingStorageType("15");//采购收货单入库
entity.setWarehousingStorageStatus("2"); entity.setWarehousingStorageStatus("3");//已入库
entity.setWarehousingId(receiptOrderForm.getId()); entity.setWarehousingId(receiptOrderForm.getId());
entity.setWarehouseId(receiptOrderForm.getWarehouseId()); entity.setWarehouseId(receiptOrderForm.getWarehouseId());
entity.setWarehousingTime(DateUtil.getNowDate()); entity.setWarehousingTime(DateUtil.getNowDate());
@ -671,17 +671,7 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
entity.setVersion(0); entity.setVersion(0);
this.saveOrUpdate(entity); this.saveOrUpdate(entity);
//WarehousingStoragePoundlist子表数据新增修改
if (receiptOrderForm.getDeliveryVoucherRelationList()!=null){
List<WarehousingStoragePoundlistEntity> tableField114 = JsonUtil.getJsonToList(receiptOrderForm.getDeliveryVoucherRelationList(),WarehousingStoragePoundlistEntity.class);
for(WarehousingStoragePoundlistEntity entitys : tableField114){
entitys.setId(RandomUtil.uuId());
entitys.setBusinessType("1");
entitys.setDocumentType("1");
entitys.setWarehousingStorageId(entity.getId());
warehousingStoragePoundlistService.saveOrUpdate(entitys);
}
}
//WarehousingStorageProduct子表数据新增修改 //WarehousingStorageProduct子表数据新增修改
if (receiptOrderForm.getDeliveryProductRelationList()!=null){ if (receiptOrderForm.getDeliveryProductRelationList()!=null){
//统计收货数量 //统计收货数量
@ -706,6 +696,7 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
receiptOrderEntity.setReceiptNum(countNum); receiptOrderEntity.setReceiptNum(countNum);
receiptOrderEntity.setReceiptTime(DateUtil.getNowDate()); receiptOrderEntity.setReceiptTime(DateUtil.getNowDate());
receiptOrderEntity.setExecuteDocumentId(entity.getDocumentNo()); //执行单据号 receiptOrderEntity.setExecuteDocumentId(entity.getDocumentNo()); //执行单据号
receiptOrderEntity.setReceiptStatus("3");//收货状态已完成
receiptOrderService.saveOrUpdate(receiptOrderEntity); receiptOrderService.saveOrUpdate(receiptOrderEntity);
//查询采购订单,更新采购订单的状态和已收货数量和收货次数 //查询采购订单,更新采购订单的状态和已收货数量和收货次数
if (StringUtils.isNotEmpty(receiptOrderEntity.getBusinessId())){ if (StringUtils.isNotEmpty(receiptOrderEntity.getBusinessId())){
@ -730,6 +721,27 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
} }
} }
} }
//WarehousingStoragePoundlist子表数据新增修改
if (receiptOrderForm.getDeliveryVoucherRelationList()!=null){
List<WarehousingStoragePoundlistEntity> tableField114 = JsonUtil.getJsonToList(receiptOrderForm.getDeliveryVoucherRelationList(),WarehousingStoragePoundlistEntity.class);
for(WarehousingStoragePoundlistEntity entitys : tableField114){
entitys.setId(RandomUtil.uuId());
entitys.setBusinessType("1");
entitys.setDocumentType("1");
entitys.setWarehousingStorageId(entity.getId());
//将商品子表id放入凭证子表
QueryWrapper<WarehousingStorageProductEntity> productQueryWrapper = new QueryWrapper<>();
productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getProductId, entitys.getProductId());
productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getStorageUnit, entitys.getUnit());
productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getWarehousingStorageId, entity.getId());
List<WarehousingStorageProductEntity> warehousingStorageProductEntity = warehousingStorageProductService.list(productQueryWrapper);
for (WarehousingStorageProductEntity product : warehousingStorageProductEntity) {
entitys.setStorageProductId(product.getId());
}
warehousingStoragePoundlistService.saveOrUpdate(entitys);
}
}
} }

@ -123,6 +123,8 @@ public class VoucherController {
private WarehousingStoragePoundlistService warehousingStoragePoundlistService; private WarehousingStoragePoundlistService warehousingStoragePoundlistService;
@Autowired @Autowired
private WarehousingStorageProductService warehousingStorageProductService; private WarehousingStorageProductService warehousingStorageProductService;
@Autowired
private ReceiptOrderService receiptOrderService;
/** /**
* *
@ -649,6 +651,7 @@ public class VoucherController {
queryWrapper.lambda().eq(WarehousingNotificationEntity::getWarehousingType,"1"); queryWrapper.lambda().eq(WarehousingNotificationEntity::getWarehousingType,"1");
queryWrapper.lambda().and(wrapper -> queryWrapper.lambda().and(wrapper ->
wrapper.eq(WarehousingNotificationEntity::getWarehousingStatus,"3").or().eq(WarehousingNotificationEntity::getWarehousingStatus,"4")); wrapper.eq(WarehousingNotificationEntity::getWarehousingStatus,"3").or().eq(WarehousingNotificationEntity::getWarehousingStatus,"4"));
queryWrapper.inSql("id", "SELECT f_process_id FROM flow_task WHERE f_status = '2'");//通过审核的订单
//找出入库通知 //找出入库通知
List<WarehousingNotificationEntity> noticeList = warehousingNotificationService.list(queryWrapper); List<WarehousingNotificationEntity> noticeList = warehousingNotificationService.list(queryWrapper);
for (WarehousingNotificationEntity entity : noticeList){ for (WarehousingNotificationEntity entity : noticeList){
@ -656,6 +659,7 @@ public class VoucherController {
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingId,entity.getId()); storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingId,entity.getId());
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageType,"3");//采购入库 storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageType,"3");//采购入库
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageStatus,"3");//状态为已入库 storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageStatus,"3");//状态为已入库
storageQueryWrapper.inSql("id", "SELECT f_process_id FROM flow_task WHERE f_status = '2'");//通过审核的订单
//找出入库单 //找出入库单
List<WarehousingStorageEntity> warehousingStorageEntityList = warehousingStorageService.list(storageQueryWrapper); List<WarehousingStorageEntity> warehousingStorageEntityList = warehousingStorageService.list(storageQueryWrapper);
for (WarehousingStorageEntity storageEntity : warehousingStorageEntityList){ for (WarehousingStorageEntity storageEntity : warehousingStorageEntityList){
@ -666,32 +670,64 @@ public class VoucherController {
} }
} }
}else if (ObjectUtils.isNotEmpty(businessOrderEntity) && businessOrderEntity.getDeliveryType().equals("2")){ }else if (ObjectUtils.isNotEmpty(businessOrderEntity) && businessOrderEntity.getDeliveryType().equals("2")){
QueryWrapper<ReceiptOrderEntity> receiptOrderQueryWrapper = new QueryWrapper<>();
receiptOrderQueryWrapper.lambda().eq(ReceiptOrderEntity::getBusinessId,voucherPagination.getBusinessOrderId());
receiptOrderQueryWrapper.lambda().eq(ReceiptOrderEntity::getReceiptType,"1");
receiptOrderQueryWrapper.lambda().eq(ReceiptOrderEntity::getReceiptStatus,"3");
receiptOrderQueryWrapper.inSql("id", "SELECT f_process_id FROM flow_task WHERE f_status = '2'");//通过审核的订单
List<ReceiptOrderEntity> receiptOrderEntityList = receiptOrderService.list(receiptOrderQueryWrapper);
//循环收货单找出所有的入库单
for (ReceiptOrderEntity receiptOrderEntity : receiptOrderEntityList){
QueryWrapper<WarehousingStorageEntity> storageQueryWrapper = new QueryWrapper<>();
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingId,receiptOrderEntity.getId());
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageType,"15");//采购收货单入库
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageStatus,"3");//状态为已入库
//找出入库单
List<WarehousingStorageEntity> warehousingStorageEntityList = warehousingStorageService.list(storageQueryWrapper);
for (WarehousingStorageEntity warehousingStorageEntity : warehousingStorageEntityList){
QueryWrapper<WarehousingStoragePoundlistEntity> pountlistQueryWrapper = new QueryWrapper<>();
pountlistQueryWrapper.lambda().eq(WarehousingStoragePoundlistEntity::getWarehousingStorageId,warehousingStorageEntity.getId());
List<WarehousingStoragePoundlistEntity> warehousingStoragePoundlistEntityList = warehousingStoragePoundlistService.list(pountlistQueryWrapper);
storagePoundlistEntityList.addAll(warehousingStoragePoundlistEntityList);
}
}
} }
//将凭证和对应的商品封装 //将凭证和对应的商品封装
for (WarehousingStoragePoundlistEntity storagePoundlistEntity : storagePoundlistEntityList){ for (WarehousingStoragePoundlistEntity storagePoundlistEntity : storagePoundlistEntityList){
QueryWrapper<WarehousingStorageProductEntity> productQueryWrapper = new QueryWrapper<>(); QueryWrapper<WarehousingStorageProductEntity> productQueryWrapper = new QueryWrapper<>();
productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getId,storagePoundlistEntity.getStorageProductId()); productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getId,storagePoundlistEntity.getStorageProductId());
List<WarehousingStorageProductEntity> product = warehousingStorageProductService.list(productQueryWrapper); List<WarehousingStorageProductEntity> productList = warehousingStorageProductService.list(productQueryWrapper);
storagePoundlistEntity.setWarehousingStorageProductEntityList(product); for (WarehousingStorageProductEntity product : productList){
} product.setGrossWeight(storagePoundlistEntity.getGrossWeight());//毛重
List<VoucherEntity> list= voucherService.queryVoucherPopupByReturnInfo(voucherPagination); product.setTareWeight(storagePoundlistEntity.getTareWeight());//皮重
for (VoucherEntity entity : list) { product.setBuckleWeight(storagePoundlistEntity.getBuckleWeight());//扣重
if (StringUtil.isNotEmpty(entity.getProductId())){ product.setNetWeight(storagePoundlistEntity.getNetWeight());//净重
List<ProductWarehouseEntity> productWarehouseEntity = productWarehouseService.getProductByVoucherInfo(entity.getProductId()); }
for (ProductWarehouseEntity productEntity : productWarehouseEntity) { storagePoundlistEntity.setWarehousingStorageProductEntityList(productList);
productEntity.setUnit(entity.getUnit()); }
productEntity.setGrossWeight(entity.getGrossWeight()); for(WarehousingStoragePoundlistEntity poundlistEntity : storagePoundlistEntityList){
productEntity.setTareWeight(entity.getTareWeight()); VoucherEntity voucherEntity = voucherService.queryVoucherInfo(poundlistEntity.getVoucherId());
productEntity.setBuckleWeight(entity.getBuckleWeight()); poundlistEntity.setDocumentType1(voucherEntity.getDocumentType1());
productEntity.setNetWeight(entity.getNetWeight()); poundlistEntity.setVoucherType1(voucherEntity.getVoucherType1());
} poundlistEntity.setVehicleNumber(voucherEntity.getVehicleNumber());
entity.setProductWarehouseEntityList(productWarehouseEntity); }
} // List<VoucherEntity> list= voucherService.queryVoucherPopupByReturnInfo(voucherPagination);
} // for (VoucherEntity entity : list) {
// if (StringUtil.isNotEmpty(entity.getProductId())){
// List<ProductWarehouseEntity> productWarehouseEntity = productWarehouseService.getProductByVoucherInfo(entity.getProductId());
// for (ProductWarehouseEntity productEntity : productWarehouseEntity) {
// productEntity.setUnit(entity.getUnit());
// productEntity.setGrossWeight(entity.getGrossWeight());
// productEntity.setTareWeight(entity.getTareWeight());
// productEntity.setBuckleWeight(entity.getBuckleWeight());
// productEntity.setNetWeight(entity.getNetWeight());
// }
// entity.setProductWarehouseEntityList(productWarehouseEntity);
// }
// }
//返回对象 //返回对象
PageListVO vo = new PageListVO(); PageListVO vo = new PageListVO();
vo.setList(list); vo.setList(storagePoundlistEntityList);
PaginationVO page = JsonUtil.getJsonToBean(voucherPagination, PaginationVO.class); PaginationVO page = JsonUtil.getJsonToBean(voucherPagination, PaginationVO.class);
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);

@ -192,4 +192,6 @@ public class BusinessOrderEntity {
private String isTransferSource; private String isTransferSource;
@TableField(exist = false) @TableField(exist = false)
private String settlementMethod1; private String settlementMethod1;
@TableField(exist = false)
private String addressName;
} }

@ -2,6 +2,8 @@ package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -54,13 +56,28 @@ public class WarehousingStoragePoundlistEntity {
@TableField("F_TENANT_ID") @TableField("F_TENANT_ID")
private String tenantId; private String tenantId;
@TableField(exist = false) @TableField("PRODUCT_ID")
private String productId; private String productId;
@TableField(exist = false) @TableField("UNIT")
private String unit; private String unit;
@TableField("GROSS_WEIGHT")
private BigDecimal grossWeight;
@TableField("TARE_WEIGHT")
private BigDecimal tareWeight;
@TableField("BUCKLE_WEIGHT")
private BigDecimal buckleWeight;
@TableField("NET_WEIGHT")
private BigDecimal netWeight;
//对应的商品List //对应的商品List
@TableField(exist = false) @TableField(exist = false)
private List<WarehousingStorageProductEntity> warehousingStorageProductEntityList; private List<WarehousingStorageProductEntity> warehousingStorageProductEntityList;
@TableField(exist = false)
private String documentType1;
@TableField(exist = false)
private String voucherType1;
@TableField(exist = false)
private String vehicleNumber;
} }

@ -65,4 +65,15 @@ public class WarehousingStorageProductEntity {
@TableField("F_TENANT_ID") @TableField("F_TENANT_ID")
private String tenantId; private String tenantId;
/**
* 退
* */
@TableField(exist = false)
private BigDecimal grossWeight;
@TableField(exist = false)
private BigDecimal tareWeight;
@TableField(exist = false)
private BigDecimal buckleWeight;
@TableField(exist = false)
private BigDecimal netWeight;
} }

@ -36,10 +36,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="poundCode" label="磅单编号" align="left"> <el-table-column prop="poundCode" label="磅单编号" align="left">
</el-table-column> </el-table-column>
<el-table-column prop="vehicleName" label="车牌号" align="left"> <el-table-column prop="vehicleNumber" label="车牌号" align="left">
</el-table-column>
<el-table-column prop="supplierName" label="供应商名字" align="left">
</el-table-column> </el-table-column>
<!-- <el-table-column prop="supplierName" label="供应商名字" align="left">
</el-table-column> -->
</JNPF-table> </JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
@pagination="init" /> @pagination="init" />

@ -1327,10 +1327,12 @@ export default {
}) })
}, },
initVoucherList(list) { initVoucherList(list) {
debugger
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const e = list[i]; const e = list[i];
debugger
let item = { let item = {
voucherId: e.id, voucherId: e.voucherId,
voucherCode: e.voucherCode, voucherCode: e.voucherCode,
documentType: e.documentType, documentType: e.documentType,
voucherType: e.voucherType, voucherType: e.voucherType,
@ -1345,11 +1347,11 @@ export default {
buckleWeight: e.buckleWeight, buckleWeight: e.buckleWeight,
netWeight: e.netWeight, netWeight: e.netWeight,
businessType: '2', businessType: '2',
list: JSON.parse(JSON.stringify(e.productWarehouseEntityList)), list: JSON.parse(JSON.stringify(e.warehousingStorageProductEntityList)),
} }
this.dataForm.deliveryVoucherRelationList.push(item) this.dataForm.deliveryVoucherRelationList.push(item)
let productEntity = {} let productEntity = {}
e.productWarehouseEntityList.forEach(item => { e.warehousingStorageProductEntityList.forEach(item => {
if (item.orderMainUnitIds) { if (item.orderMainUnitIds) {
var unitName = JSON.parse(item.orderMainUnitIds); var unitName = JSON.parse(item.orderMainUnitIds);
var optArray = []; var optArray = [];
@ -1401,7 +1403,7 @@ export default {
this.dataForm.purchaseOrderInfo = [] this.dataForm.purchaseOrderInfo = []
this.dataForm.purchaseOrderInfo[0] = val2 this.dataForm.purchaseOrderInfo[0] = val2
this.dataForm.subjectId = val2.firstSubjectBasicId this.dataForm.subjectId = val2.firstSubjectBasicId
this.dataForm.deliveryAddress = val2.receiveAddress this.dataForm.deliveryAddress = val2.addressName
this.dataForm.enterpriseId = val2.enterpriseId this.dataForm.enterpriseId = val2.enterpriseId
this.dataForm.warehouseId = val2.deliveryWarehouse this.dataForm.warehouseId = val2.deliveryWarehouse
this.dataForm.shippingAddress = val2.deliveryAddress this.dataForm.shippingAddress = val2.deliveryAddress

Loading…
Cancel
Save