销售问题

product
杨世强 2 years ago
parent 7fadcaeee1
commit 3118563d03

@ -91,91 +91,6 @@ public class CollectionController {
return ActionResult.success(result);
}
/* *//**
*
*
* @param ids
* @return
*//*
@PostMapping("/commit/{ids}")
@Transactional
public ActionResult commit(@PathVariable("ids") String ids) {
String[] idList = ids.split(",");
for (String id : idList) {
CollectionEntity collectionEntity = collectionService.getInfo(id);
if (collectionEntity.getStatus().equals("1")){
return ActionResult.fail("已提交");
}
if (collectionEntity.getStatus().equals("2")){
return ActionResult.fail("已认款");
}
if (collectionEntity.getStatus().equals("0")) {
QueryWrapper<Collection_item0Entity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Collection_item0Entity::getCollectionId, id);
List<Collection_item0Entity> collection_item0EntityList = collection_item0Service.list(queryWrapper);//查询收款单子表信息
for (Collection_item0Entity collection_item0Entity : collection_item0EntityList) {
BigDecimal sum = new BigDecimal(0);
SaleorderitemEntity saleordercetEntity = saleorderitemService.getById(collection_item0Entity.getSalesorderId());//查询销售订单信息
if (saleordercetEntity.getAmountCollected() == null) {
saleordercetEntity.setAmountCollected(new BigDecimal(0));
}
// if (saleordercetEntity.getAmountCollected().equals(saleordercetEntity.getPrice())) {
// return ActionResult.fail("已回款金额等于金额");
// }
if (collectionEntity.getAmountCollected() == null || collectionEntity.getAmountCollected().compareTo(BigDecimal.ZERO) < 1) {
return ActionResult.fail("请先输入回款金额");
} else {
sum = saleordercetEntity.getAmountCollected().add(collection_item0Entity.getAmount());
if (sum.compareTo(saleordercetEntity.getPrice()) > 0) {
return ActionResult.fail("总回款金额大于金额");
}
}
QueryWrapper<Salesorder_item0Entity> queryWrapper1 = new QueryWrapper<>();
queryWrapper1.lambda().eq(Salesorder_item0Entity::getSalesOrderId,saleordercetEntity.getId());
List<Salesorder_item0Entity> list = salesorder_item0Service.list(queryWrapper1);
List<PoundlistEntity> poundlist = new ArrayList<>();
for (Salesorder_item0Entity saleItem : list){
PoundlistEntity poundlistEntity = collectionService.queryPoundInfo(saleItem.getPoundlistId());
if (ObjectUtils.isNotEmpty(poundlistEntity)) {
poundlist.add(poundlistEntity);
}
}
if (poundlist.size() > 0) {
poundlist = poundlist.stream().sorted(Comparator.comparing(PoundlistEntity::getAdvance).reversed()
.thenComparing(Comparator.comparing(PoundlistEntity::getPoundDate))).collect(Collectors.toList());
}else{
return ActionResult.fail("磅单为空");
}
BigDecimal amount = new BigDecimal(0);
List<PoundlistEntity> poundlist1 = new ArrayList<>();
for (PoundlistEntity pound : poundlist){
if (pound.getSalesPrice()!=null && pound.getSettlement()!=null) {
amount = amount.add(pound.getSalesPrice().multiply(pound.getSettlement()));
if (amount.compareTo(sum) < 1) {
poundlist1.add(pound);
}else{
break;
}
}
}
for (PoundlistEntity poundlistEntity : poundlist1){
poundlistEntity.setIsCollection("1");
if (poundlistEntity.getPaymentDate() == null){
poundlistEntity.setPaymentDate(new Date());
}
poundlistService.updateById(poundlistEntity);
}
saleordercetEntity.setAmountCollected(sum);
// saleordercetEntity.setStatus("3");
saleorderitemService.updateById(saleordercetEntity);
collectionEntity.setStatus("1");
collectionService.updateById(collectionEntity);
return ActionResult.success("提交成功");
}
}
}
return ActionResult.fail("请选择一条数据");
}*/
/**
*
@ -261,27 +176,6 @@ public class CollectionController {
}
}
return ActionResult.fail("请选择一条数据");
// String[] idList = ids.split(",");
// for (String id : idList) {
// CollectionEntity collectionEntity = collectionService.getInfo(id);
// if (ObjectUtils.isNotEmpty(collectionEntity)) {
// if (collectionEntity.getStatus().equals("0")) {
// return ActionResult.fail("请先提交");
// }
// if (collectionEntity.getStatus().equals("2")) {
// return ActionResult.fail("已认款,无需再次提交");
// }
// if (collectionEntity.getAmountCollected() == null || collectionEntity.getAmountCollected().compareTo(BigDecimal.ZERO) < 1) {
// return ActionResult.fail("请先输入收款金额");
// }
// collectionEntity.setStatus("2");
// collectionService.updateById(collectionEntity);
// return ActionResult.success("认款成功");
// } else {
// return ActionResult.fail("数据为空");
// }
// }
// return ActionResult.fail("请选择一条数据");
}
/**
*

@ -157,11 +157,41 @@ public class PoundlistController {
poundlistListVO.setPrice("0");
}
}
if(StringUtils.isEmpty(poundlistListVO.getSalesPrice())){
poundlistListVO.setSalesPrice("0");
}
if(StringUtils.isEmpty(poundlistListVO.getSaleRate())){
poundlistListVO.setSaleRate("0");
}
poundlistListVO.setPrice(poundlistListVO.getPurchasePrice());
poundlistListVO.setRate("0");
poundlistListVO.setPountType(poundlistListVO.getPoundType());
poundlistListVO.setAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSettlement()) * Double.parseDouble(poundlistListVO.getPrice())));
poundlistListVO.setNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getAmount()) * 0.87));
poundlistListVO.setSaleAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSettlement()) * Double.parseDouble(poundlistListVO.getSalesPrice())));
switch (poundlistListVO.getSaleRate()) {
case "0":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.87));
break;
case "1":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.91));
break;
case "2":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.94));
break;
case "3":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.95));
break;
case "4":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.97));
break;
case "5":
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 1));
break;
default:
poundlistListVO.setSaleNotAmount(String.valueOf(Double.parseDouble(poundlistListVO.getSaleAmount()) * 0.87));
break;
}
poundlistListVO.setRateAmount(String.valueOf(Double.parseDouble(poundlistListVO.getAmount()) - Double.parseDouble(poundlistListVO.getNotAmount())));
}
PageListVO vo=new PageListVO();

@ -227,5 +227,10 @@ public class PoundlistEntity {
private String salesContractNo;
@TableField(exist = false)
private String purchaseorderItem0Id;
@TableField(exist = false)
private String salesorderItem0Id;
@TableField(exist = false)
private String saleRate;
}

@ -248,6 +248,13 @@ public class PoundlistListVO{
@JsonProperty("rateAmount")
private String rateAmount;
@JsonProperty("saleAmount")
private String saleAmount;
@JsonProperty("saleNotAmount")
private String saleNotAmount;
@JsonProperty("saleRate")
private String saleRate;
/** 创建时间 **/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonProperty("creatorTime")
@ -256,4 +263,7 @@ public class PoundlistListVO{
@JsonProperty("purchaseorderItem0Id")
private String purchaseorderItem0Id;
@JsonProperty("salesorderItem0Id")
private String salesorderItem0Id;
}

@ -39,6 +39,7 @@ public class PoundlistPagination extends Pagination {
private Date endDate;
private String purchaseOrderId;
private String salesOrderId;
private List<String> poundlistIds;
/**
* id

@ -15,6 +15,9 @@ import jnpf.base.UserInfo;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.exception.DataException;
import jnpf.saleorder.entity.SaleorderitemEntity;
import jnpf.saleorder.service.SaleorderitemService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import jnpf.saleback.model.saleback.*;
import jnpf.saleback.model.saleback.SalebackPagination;
@ -71,6 +74,9 @@ public class SalebackController {
@Autowired
private Saleback_item0Service saleback_item0Service;
@Autowired
private SaleorderitemService saleorderitemService;
// /**
// * 流程创建
@ -147,6 +153,8 @@ public class SalebackController {
for(Saleback_item0Entity entitys : Saleback_item0List){
entitys.setId(RandomUtil.uuId());
entitys.setSalesBackId(entity.getId());
entitys.setCreatorTime(new Date());
entitys.setCreatorUserName(userInfo.getUserId());
saleback_item0Service.save(entitys);
}
return ActionResult.success("创建成功");
@ -378,6 +386,7 @@ public class SalebackController {
public ActionResult<SalebackInfoVO> detailInfo2(@PathVariable("id") String id){
SalebackEntity entity= salebackService.getInfo(id);
SalebackInfoVO vo=JsonUtil.getJsonToBean(entity, SalebackInfoVO.class);
vo.setSaleId(vo.getSalesOrderId());
List<Saleback_item0Entity> saleback_item0Models = salebackService.querySaleBackItemInfo(id);
//子表数据转换
List<Saleback_item0Model> jg_salesback_item0ModelList = JsonUtil.getJsonToList(saleback_item0Models,Saleback_item0Model.class);
@ -386,6 +395,12 @@ public class SalebackController {
Map<String,Object> salesOrderIdMap = new HashMap<>();
vo.setSalesOrderId(generaterSwapUtil.getPopupSelectValue("383568951197606085","id","document_no",vo.getSalesOrderId(),salesOrderIdMap));
vo.setCreatorUserName(generaterSwapUtil.userSelectValue(vo.getCreatorUserName()));
// SaleorderitemEntity saleorderitemEntity = saleorderitemService.getById(vo.getSalesOrderId());
// if (ObjectUtils.isNotEmpty(saleorderitemEntity)){
// if (saleorderitemEntity.getCustomerId() != null){
//
// }
// }
return ActionResult.success(vo);
}

@ -145,6 +145,11 @@ public class Saleback_item0Entity {
@TableField(exist = false)
private String noPrice;
/** 磅单日期 **/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@TableField(exist = false)
private Date poundDate;

@ -65,6 +65,22 @@ public class SalebackInfoVO{
@JsonProperty("creatorUserName")
private String creatorUserName;
/** 销售订单ID **/
@JsonProperty("saleId")
private String saleId;
/** 客户 **/
@JsonProperty("customerName")
private String customerName;
/** 合同 **/
@JsonProperty("contractName")
private String contractName;
/** 对方合同号 **/
@JsonProperty("contractNo")
private String contractNo;
/** 子表数据 **/
@JsonProperty("saleback_item0List")
private List<Saleback_item0Model> saleback_item0List;

@ -63,14 +63,18 @@ public class Saleback_item0Model {
@JsonProperty("salesorderItem0Id")
private String salesorderItem0Id;
/** 磅单ID **/
@JsonProperty("poundlistId")
private String poundlistId;
/** 客户 **/
@JsonProperty("customerName")
private String customerName;
@TableField(exist = false)
@TableField("vehicleName")
private String vehicleName;
@TableField(exist = false)
@TableField("materialName")
private String materialName;
@TableField(exist = false)
@TableField("businessName")
private String businessName;
/** 是否垫资 **/
@ -102,5 +106,10 @@ public class Saleback_item0Model {
@JsonProperty("noPrice")
private String noPrice;
/** 磅单日期 **/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonProperty("poundDate")
private Date poundDate;
}

@ -56,7 +56,8 @@ WHERE
</select>
<select id="queryByKeyword" resultType="jnpf.poundlist.entity.PoundlistEntity">
SELECT a.*,b.ticketno vehicleName,c.supplier_name supplierName,d.supplier_nm customerName,e.item_name materialName,f.contract_name salesName,g.contract_name purchaseName,h.F_RealName businessName,i.name naturalName,g.contract_no purchaseContractNo,f.contract_no salesContractNo, j.id purchaseorderItem0Id
SELECT a.*,b.ticketno vehicleName,c.supplier_name supplierName,d.supplier_nm customerName,e.item_name materialName,f.contract_name salesName,g.contract_name purchaseName,h.F_RealName businessName,
i.name naturalName,g.contract_no purchaseContractNo,f.contract_no salesContractNo, j.id purchaseorderItem0Id,k.id salesorderItem0Id,k.rate saleRate
from jg_poundlist a
LEFT JOIN jg_vehicle b on a.vehicle_id = b.id
LEFT JOIN jg_supplier c on a.supplier_id = c.id
@ -67,6 +68,7 @@ WHERE
LEFT JOIN base_user h on a.business_id = h.f_id
LEFT JOIN jg_natural i on a.natural_id = i.id
LEFT JOIN jg_purchaseorder_item0 j on a.id = j.poundlist_id
LEFT JOIN jg_salesorder_item0 k on a.id = k.poundlist_id
where a.is_examine = '1'
<if test="poundlistPagination.keyword != null and poundlistPagination.keyword != ''">
AND (b.ticketno LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR c.supplier_name LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR d.supplier_nm LIKE CONCAT('%',#{poundlistPagination.keyword},'%'))
@ -111,6 +113,9 @@ WHERE
<if test="poundlistPagination.purchaseOrderId != null and poundlistPagination.purchaseOrderId != ''">
AND a.id IN (SELECT poundlist_id from jg_purchaseorder_item0 where purchaseorder_id = #{poundlistPagination.purchaseOrderId})
</if>
<if test="poundlistPagination.salesOrderId != null and poundlistPagination.salesOrderId != ''">
AND a.id IN (SELECT poundlist_id from jg_salesorder_item0 where sales_order_id = #{poundlistPagination.salesOrderId})
</if>
<if test="poundlistPagination.poundlistIds != null and poundlistPagination.poundlistIds.size()!=0">
AND a.id NOT IN
<foreach collection="poundlistPagination.poundlistIds" index="index" item="item" open="(" separator="," close=")">

@ -34,6 +34,8 @@
<select id="querySaleBackItem" resultType="jnpf.saleback.entity.Saleback_item0Entity">
SELECT
a.id,
a.poundlist_id as poundlistId,
a.salesorder_item0_id as salesorderItem0Id,
b.rate,
b.price,
b.no_price as noPrice,

@ -24,7 +24,7 @@
<el-col :span="8">
<el-form-item label="合同名称" prop="contractId">
<popupSelect v-model="dataForm.contractId" placeholder="请选择" clearable field="contractId"
interfaceId="399835312982972805" :bissId="dataForm.code" :columnOptions="contractNamecolumnOptions" propsValue="id"
interfaceId="399835312982972805" :bissId="dataForm.customerId" :columnOptions="contractNamecolumnOptions" propsValue="id"
relationField="contract_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" @change="contractSelect"
>
</popupSelect>
@ -463,6 +463,7 @@
this.dataForm.collection_item0List = [];
},
popupSelect2(a, b) {
let amountCollectedSum = 0;
for (let i = 0; i < this.dataForm.collection_item0List.length; i++) {
debugger
if (a == this.dataForm.collection_item0List[i].salesorderId) {
@ -476,9 +477,10 @@
this.dataForm.collection_item0List[i].creatorTime = b.creator_time;
this.dataForm.collection_item0List[i].amount = parseFloat(b.price) - parseFloat(b.amount_collected);
this.dataForm.collection_item0List[i].creatorTime = new Date().getTime();
debugger
amountCollectedSum = amountCollectedSum + parseFloat(this.dataForm.collection_item0List[i].amount);
}
}
this.dataForm.amountCollected = amountCollectedSum;
},
collection_item0Exist() {
let isOk = true;
@ -594,6 +596,7 @@
},
delcollection_item0List(index) {
this.dataForm.collection_item0List.splice(index, 1);
this.amountSum();
},
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForm));

@ -333,7 +333,7 @@
for (let i = 0; i < this.dataForm.saleback_item0List.length; i++) {
excludeFields.push(this.dataForm.saleback_item0List[i].vehicleId);
if(a == this.dataForm.saleback_item0List[i].vehicleId){
this.dataForm.saleback_item0List[i].vehicleId = b.vehicle_id;
// this.dataForm.saleback_item0List[i].vehicleId = b.vehicle_id;
this.dataForm.saleback_item0List[i].materialId = b.material_id;
this.dataForm.saleback_item0List[i].settlement = b.settlement;
this.dataForm.saleback_item0List[i].unit = b.unit;
@ -343,6 +343,7 @@
this.dataForm.saleback_item0List[i].pountType = b.pound_type;
this.dataForm.saleback_item0List[i].businessId = b.business_id;
this.dataForm.saleback_item0List[i].salesorderItem0Id = b.saleitemId;
this.dataForm.saleback_item0List[i].poundlistId = b.poundlistId;
this.rateOptions.find((item) => {
if (this.dataForm.saleback_item0List[i].rate == item.id) {
this.dataForm.saleback_item0List[i].notAmount = this.dataForm.saleback_item0List[i].amount*item.fullName/100

@ -331,11 +331,15 @@
return sums;
},
popupSelectChange2(a, b){
var sumPrice = 0;
var sumNum = 0;
var excludeFields = [];
for (let i = 0; i < this.dataForm.saleback_item0List.length; i++) {
excludeFields.push(this.dataForm.saleback_item0List[i].vehicleId);
if(a == this.dataForm.saleback_item0List[i].id){
this.dataForm.saleback_item0List[i].vehicleId = b.vehicle_id;
debugger
// excludeFields.push(this.dataForm.saleback_item0List[i].vehicleId);
if(a == this.dataForm.saleback_item0List[i].vehicleId){
debugger
// this.dataForm.saleback_item0List[i].vehicleId = b.vehicle_id;
this.dataForm.saleback_item0List[i].materialId = b.material_id;
this.dataForm.saleback_item0List[i].settlement = b.settlement;
this.dataForm.saleback_item0List[i].unit = b.unit;
@ -345,14 +349,20 @@
this.dataForm.saleback_item0List[i].pountType = b.pound_type;
this.dataForm.saleback_item0List[i].businessId = b.business_id;
this.dataForm.saleback_item0List[i].salesorderItem0Id = b.saleitemId;
this.dataForm.saleback_item0List[i].poundlistId = b.poundlistId;
this.rateOptions.find((item) => {
if (this.dataForm.saleback_item0List[i].rate == item.id) {
this.dataForm.saleback_item0List[i].notAmount = this.dataForm.saleback_item0List[i].amount*item.fullName/100
}
})
sumNum = sumNum + parseFloat(b.settlement);
sumPrice = sumPrice + parseFloat(this.dataForm.saleback_item0List[i].amount);
}
}
this.dataForm.refundNum = sumNum;
this.dataForm.refundAmount = sumPrice;
this.excludeFields = excludeFields;
debugger
},
popupSelectChange(e,d){
this.dataForm.currency = d.currency;

Loading…
Cancel
Save