Merge remote-tracking branch 'origin/main'

product
chuang 2 years ago
commit b79a452034

@ -24,6 +24,7 @@ import jnpf.poundlist.service.PoundlistService;
import jnpf.purchaseback.entity.PurchaseorderEntity; import jnpf.purchaseback.entity.PurchaseorderEntity;
import jnpf.purchaseback.service.PurchaseorderService; import jnpf.purchaseback.service.PurchaseorderService;
import jnpf.purchaseorder.entity.Purchaseorder_item0Entity; import jnpf.purchaseorder.entity.Purchaseorder_item0Entity;
import jnpf.purchaseorder.service.Purchaseorder_item0Service;
import jnpf.purchaseorder.service.PurchaseorderitemService; import jnpf.purchaseorder.service.PurchaseorderitemService;
import jnpf.supplier.entity.SupplierEntity; import jnpf.supplier.entity.SupplierEntity;
import jnpf.supplier.service.SupplierService; import jnpf.supplier.service.SupplierService;
@ -57,6 +58,7 @@ import jnpf.util.GeneraterSwapUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import jnpf.util.file.UploadUtil; import jnpf.util.file.UploadUtil;
import jnpf.util.enums.FileTypeEnum; import jnpf.util.enums.FileTypeEnum;
@ -103,6 +105,8 @@ public class InvoicesController {
private ContractFileService contractFileService; private ContractFileService contractFileService;
@Autowired @Autowired
private SupplierService supplierService; private SupplierService supplierService;
@Autowired
private Purchaseorder_item0Service purchaseorder_item0Service;
/** /**
* *
* *
@ -143,20 +147,20 @@ public class InvoicesController {
@PostMapping @PostMapping
@Transactional @Transactional
public ActionResult create(@RequestBody @Valid InvoicesCrForm invoicesCrForm) throws DataException { public ActionResult create(@RequestBody @Valid InvoicesCrForm invoicesCrForm) throws DataException {
String mainId =RandomUtil.uuId(); String mainId = RandomUtil.uuId();
UserInfo userInfo=userProvider.get(); UserInfo userInfo = userProvider.get();
//invoicesCrForm.setDocumentNo(generaterSwapUtil.getBillNumber("yffp", false)); //invoicesCrForm.setDocumentNo(generaterSwapUtil.getBillNumber("yffp", false));
InvoicesEntity entity = JsonUtil.getJsonToBean(invoicesCrForm, InvoicesEntity.class); InvoicesEntity entity = JsonUtil.getJsonToBean(invoicesCrForm, InvoicesEntity.class);
entity.setId(mainId); entity.setId(mainId);
invoicesService.save(entity); invoicesService.save(entity);
List<InvoicesItem1Entity> InvoicesItem1List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem1List(),InvoicesItem1Entity.class); List<InvoicesItem1Entity> InvoicesItem1List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem1List(), InvoicesItem1Entity.class);
for(InvoicesItem1Entity entitys : InvoicesItem1List){ for (InvoicesItem1Entity entitys : InvoicesItem1List) {
entitys.setId(RandomUtil.uuId()); entitys.setId(RandomUtil.uuId());
entitys.setInvoicesId(entity.getId()); entitys.setInvoicesId(entity.getId());
invoicesItem1Service.save(entitys); invoicesItem1Service.save(entitys);
} }
List<InvoicesItem0Entity> InvoicesItem0List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem0List(),InvoicesItem0Entity.class); List<InvoicesItem0Entity> InvoicesItem0List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem0List(), InvoicesItem0Entity.class);
for(InvoicesItem0Entity entitys : InvoicesItem0List){ for (InvoicesItem0Entity entitys : InvoicesItem0List) {
entitys.setId(RandomUtil.uuId()); entitys.setId(RandomUtil.uuId());
entitys.setInvoicesId(entity.getId()); entitys.setInvoicesId(entity.getId());
invoicesItem0Service.save(entitys); invoicesItem0Service.save(entitys);
@ -167,28 +171,37 @@ public class InvoicesController {
purchaseorderEntity.setInvoiceAmount(entity.getInvoiceAmount()); purchaseorderEntity.setInvoiceAmount(entity.getInvoiceAmount());
purchaseorderEntity.setInvoiceNum(entity.getInvoiceQuantity()); purchaseorderEntity.setInvoiceNum(entity.getInvoiceQuantity());
purchaseorderService.updateById(purchaseorderEntity); purchaseorderService.updateById(purchaseorderEntity);
List<Purchaseorder_item0Entity> Purchaseorder_item0List = purchaseorderitemService.GetPurchaseorder_item0List(entity.getPurchaseorderId()); List<Purchaseorder_item0Entity> Purchaseorder_item0List = purchaseorderitemService.GetPurchaseorder_item0List(entity.getPurchaseorderId());
List<PoundlistEntity> poundlistEntityList = purchaseorderitemService.getPoundList(entity.getPurchaseorderId()); List<PoundlistEntity> poundlistEntityList = purchaseorderitemService.getPoundList(entity.getPurchaseorderId());
Purchaseorder_item0Entity orderItem = Purchaseorder_item0List.stream().filter(item0 -> ObjectUtil.equals(item0.getPoundlistId(), poundlistEntityList.get(0).getId())).findAny().get(); if (purchaseorderEntity.getAmount().compareTo(entity.getInvoiceAmount()) == 0) {
BigDecimal total = orderItem.getAmount(); for (PoundlistEntity poundlistEntity: poundlistEntityList) {
int i = 0; poundlistEntity.setIsInvoicing("1");
while (entity.getInvoiceAmount().compareTo(total) >= 0){ poundlistEntity.setInputDate(new Date());
i++;
if(i < poundlistEntityList.size()){
String poundlistId = poundlistEntityList.get(i).getId();
orderItem = Purchaseorder_item0List.stream().filter(item0 -> ObjectUtil.equals(item0.getPoundlistId(), poundlistId)).findAny().get();
total = total.add(orderItem.getAmount());
}else{
break;
} }
} poundlistService.updateBatchById(poundlistEntityList);
for (int j = 0;j<poundlistEntityList.size();j++) { }else {
if(j < i){ Purchaseorder_item0Entity orderItem = Purchaseorder_item0List.stream().filter(item0 -> ObjectUtil.equals(item0.getPoundlistId(), poundlistEntityList.get(0).getId())).findAny().get();
poundlistEntityList.get(j).setIsInvoicing("1"); BigDecimal total = orderItem.getAmount();
poundlistEntityList.get(j).setInputDate(new Date()); int i = 0;
while (entity.getInvoiceAmount().compareTo(total) >= 0) {
i++;
if (i < poundlistEntityList.size()) {
String poundlistId = poundlistEntityList.get(i).getId();
orderItem = Purchaseorder_item0List.stream().filter(item0 -> ObjectUtil.equals(item0.getPoundlistId(), poundlistId)).findAny().get();
total = total.add(orderItem.getAmount());
} else {
break;
}
}
for (int j = 0; j < poundlistEntityList.size(); j++) {
if (j < i) {
poundlistEntityList.get(j).setIsInvoicing("1");
poundlistEntityList.get(j).setInputDate(new Date());
}
poundlistEntityList.get(j).setPurchaseStatus("1");
poundlistService.updateById(poundlistEntityList.get(j));
} }
poundlistEntityList.get(j).setPurchaseStatus("1");
poundlistService.updateById(poundlistEntityList.get(j));
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }

@ -3,8 +3,8 @@
<PortalLayoutB :layout="layout" v-if="type === 0" /> <PortalLayoutB :layout="layout" v-if="type === 0" />
<div class="sale"> <div class="sale">
<div class="sale_title"> <div class="sale_title">
<span> 今日磅单指数</span> <span>今日经营指数</span>
<span>磅单实时交易情况</span> <span>实时交易情况</span>
</div> </div>
<ul class="sale_items"> <ul class="sale_items">
<li> <li>
@ -50,14 +50,6 @@
<line-chart-b /> <line-chart-b />
</el-col> </el-col>
</el-row> </el-row>
<!-- <el-row style="background:#fff;padding:0 16px;margin-bottom:10px;border-radius: 4px;">
<div class="dateSelect">
<el-date-picker v-model="value1" type="date" placeholder="选择日期" size="small">
</el-date-picker>
</div>
<line-chart />
</el-row> -->
<!-- <PortalLayoutC :layout="layout" v-if="type === 0" /> -->
<el-row :gutter="10" class="notice"> <el-row :gutter="10" class="notice">
<el-col :span="12"> <el-col :span="12">
<div class="notice_left"> <div class="notice_left">
@ -120,6 +112,9 @@ export default {
opinionData: ["3", "2", "4", "4", "5"], opinionData: ["3", "2", "4", "4", "5"],
massageList: [], massageList: [],
tadayPoundist: {}, tadayPoundist: {},
pageSize: 10,
currentPage: 1,
intervalID: undefined,
} }
}, },
computed: { computed: {
@ -133,6 +128,10 @@ export default {
this.getTadayPoundist() this.getTadayPoundist()
this.getData() this.getData()
this.getMsg() this.getMsg()
this.intervalStrat()
},
beforeDestroy() {
this.intervalDel();
}, },
methods: { methods: {
getData() { getData() {
@ -157,18 +156,35 @@ export default {
url: "/api/messageCenter/MessageCenter/getMobileList", url: "/api/messageCenter/MessageCenter/getMobileList",
method: "post", method: "post",
data: { data: {
currentPage: 1, currentPage: this.currentPage,
pageSize: 9, pageSize: this.pageSize,
}, },
}).then(res => { }).then(res => {
if (res.code == 200) { if (res.code == 200) {
let _list = res.data.list; let _list = res.data.list;
this.massageList = _list; this.massageList = _list;
if (this.massageList.length === this.pageSize) {
this.currentPage = this.currentPage + 1;
} else {
this.currentPage = 1;
}
//console.log(_list) //console.log(_list)
} }
}).catch(() => { }).catch(() => {
}) })
}, },
intervalStrat() {
this.intervalDel();
this.intervalID = setInterval(() => {
this.getMsg();
}, 5000);
},
intervalDel() {
if (this.intervalID) {
clearInterval(this.intervalID);
}
},
getTadayPoundist() { getTadayPoundist() {
request({ request({
url: "/api/messageCenter/MessageCenter/getTadayPoundist", url: "/api/messageCenter/MessageCenter/getTadayPoundist",

Loading…
Cancel
Save