采购退货逻辑完善

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

@ -164,6 +164,7 @@
<result column="carriageMode1" property="carriageMode1"/>
<result column="purchaseStatus" property="purchaseStatus"/>
<result column="wareHouseName" property="wareHouseName"/>
<result column="addressName" property="addressName"/>
</resultMap>
<resultMap id="contractInfo" type="jnpf.model.businessorder.ContractModel">
@ -675,11 +676,13 @@
'其他采购'
END AS orderType1,
b.NAME AS subjectName,
c.contract_name AS contractName
c.contract_name AS contractName,
d.addressName
FROM
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_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}
</select>
</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)
</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>

@ -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> 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();
VoucherEntity queryVoucherInfo(String id);
}

@ -632,4 +632,9 @@ public class VoucherServiceImpl extends ServiceImpl<VoucherMapper, VoucherEntity
public List<VoucherEntity> queryPurchaseDeliveryVoucherInfo() {
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 = new WarehousingStorageEntity();
entity.setDocumentNo(generaterSwapUtil.getBillNumber("rukudanbianhao", false));
entity.setWarehousingStorageType("15");
entity.setWarehousingStorageStatus("2");
entity.setWarehousingStorageType("15");//采购收货单入库
entity.setWarehousingStorageStatus("3");//已入库
entity.setWarehousingId(receiptOrderForm.getId());
entity.setWarehouseId(receiptOrderForm.getWarehouseId());
entity.setWarehousingTime(DateUtil.getNowDate());
@ -671,17 +671,7 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
entity.setVersion(0);
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子表数据新增修改
if (receiptOrderForm.getDeliveryProductRelationList()!=null){
//统计收货数量
@ -706,6 +696,7 @@ public class WarehousingStorageServiceImpl extends ServiceImpl<WarehousingStorag
receiptOrderEntity.setReceiptNum(countNum);
receiptOrderEntity.setReceiptTime(DateUtil.getNowDate());
receiptOrderEntity.setExecuteDocumentId(entity.getDocumentNo()); //执行单据号
receiptOrderEntity.setReceiptStatus("3");//收货状态已完成
receiptOrderService.saveOrUpdate(receiptOrderEntity);
//查询采购订单,更新采购订单的状态和已收货数量和收货次数
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;
@Autowired
private WarehousingStorageProductService warehousingStorageProductService;
@Autowired
private ReceiptOrderService receiptOrderService;
/**
*
@ -649,6 +651,7 @@ public class VoucherController {
queryWrapper.lambda().eq(WarehousingNotificationEntity::getWarehousingType,"1");
queryWrapper.lambda().and(wrapper ->
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);
for (WarehousingNotificationEntity entity : noticeList){
@ -656,6 +659,7 @@ public class VoucherController {
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingId,entity.getId());
storageQueryWrapper.lambda().eq(WarehousingStorageEntity::getWarehousingStorageType,"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);
for (WarehousingStorageEntity storageEntity : warehousingStorageEntityList){
@ -666,32 +670,64 @@ public class VoucherController {
}
}
}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){
QueryWrapper<WarehousingStorageProductEntity> productQueryWrapper = new QueryWrapper<>();
productQueryWrapper.lambda().eq(WarehousingStorageProductEntity::getId,storagePoundlistEntity.getStorageProductId());
List<WarehousingStorageProductEntity> product = warehousingStorageProductService.list(productQueryWrapper);
storagePoundlistEntity.setWarehousingStorageProductEntityList(product);
}
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);
}
}
List<WarehousingStorageProductEntity> productList = warehousingStorageProductService.list(productQueryWrapper);
for (WarehousingStorageProductEntity product : productList){
product.setGrossWeight(storagePoundlistEntity.getGrossWeight());//毛重
product.setTareWeight(storagePoundlistEntity.getTareWeight());//皮重
product.setBuckleWeight(storagePoundlistEntity.getBuckleWeight());//扣重
product.setNetWeight(storagePoundlistEntity.getNetWeight());//净重
}
storagePoundlistEntity.setWarehousingStorageProductEntityList(productList);
}
for(WarehousingStoragePoundlistEntity poundlistEntity : storagePoundlistEntityList){
VoucherEntity voucherEntity = voucherService.queryVoucherInfo(poundlistEntity.getVoucherId());
poundlistEntity.setDocumentType1(voucherEntity.getDocumentType1());
poundlistEntity.setVoucherType1(voucherEntity.getVoucherType1());
poundlistEntity.setVehicleNumber(voucherEntity.getVehicleNumber());
}
// 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();
vo.setList(list);
vo.setList(storagePoundlistEntityList);
PaginationVO page = JsonUtil.getJsonToBean(voucherPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);

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

@ -2,6 +2,8 @@ package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@ -54,13 +56,28 @@ public class WarehousingStoragePoundlistEntity {
@TableField("F_TENANT_ID")
private String tenantId;
@TableField(exist = false)
@TableField("PRODUCT_ID")
private String productId;
@TableField(exist = false)
@TableField("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
@TableField(exist = false)
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")
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 prop="poundCode" label="磅单编号" align="left">
</el-table-column>
<el-table-column prop="vehicleName" label="车牌号" align="left">
</el-table-column>
<el-table-column prop="supplierName" 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> -->
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
@pagination="init" />

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

Loading…
Cancel
Save