diff --git a/SC-boot/linkage-scm/src/main/java/jnpf/invoices/controller/InvoicesController.java b/SC-boot/linkage-scm/src/main/java/jnpf/invoices/controller/InvoicesController.java index 0a952349..73a43b13 100644 --- a/SC-boot/linkage-scm/src/main/java/jnpf/invoices/controller/InvoicesController.java +++ b/SC-boot/linkage-scm/src/main/java/jnpf/invoices/controller/InvoicesController.java @@ -24,6 +24,7 @@ import jnpf.poundlist.service.PoundlistService; import jnpf.purchaseback.entity.PurchaseorderEntity; import jnpf.purchaseback.service.PurchaseorderService; import jnpf.purchaseorder.entity.Purchaseorder_item0Entity; +import jnpf.purchaseorder.service.Purchaseorder_item0Service; import jnpf.purchaseorder.service.PurchaseorderitemService; import jnpf.supplier.entity.SupplierEntity; import jnpf.supplier.service.SupplierService; @@ -57,6 +58,7 @@ import jnpf.util.GeneraterSwapUtil; import java.math.BigDecimal; import java.util.*; +import java.util.stream.Collectors; import jnpf.util.file.UploadUtil; import jnpf.util.enums.FileTypeEnum; @@ -103,6 +105,8 @@ public class InvoicesController { private ContractFileService contractFileService; @Autowired private SupplierService supplierService; + @Autowired + private Purchaseorder_item0Service purchaseorder_item0Service; /** * 列表 * @@ -143,20 +147,20 @@ public class InvoicesController { @PostMapping @Transactional public ActionResult create(@RequestBody @Valid InvoicesCrForm invoicesCrForm) throws DataException { - String mainId =RandomUtil.uuId(); - UserInfo userInfo=userProvider.get(); + String mainId = RandomUtil.uuId(); + UserInfo userInfo = userProvider.get(); //invoicesCrForm.setDocumentNo(generaterSwapUtil.getBillNumber("yffp", false)); InvoicesEntity entity = JsonUtil.getJsonToBean(invoicesCrForm, InvoicesEntity.class); entity.setId(mainId); invoicesService.save(entity); - List InvoicesItem1List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem1List(),InvoicesItem1Entity.class); - for(InvoicesItem1Entity entitys : InvoicesItem1List){ + List InvoicesItem1List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem1List(), InvoicesItem1Entity.class); + for (InvoicesItem1Entity entitys : InvoicesItem1List) { entitys.setId(RandomUtil.uuId()); entitys.setInvoicesId(entity.getId()); invoicesItem1Service.save(entitys); } - List InvoicesItem0List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem0List(),InvoicesItem0Entity.class); - for(InvoicesItem0Entity entitys : InvoicesItem0List){ + List InvoicesItem0List = JsonUtil.getJsonToList(invoicesCrForm.getInvoicesitem0List(), InvoicesItem0Entity.class); + for (InvoicesItem0Entity entitys : InvoicesItem0List) { entitys.setId(RandomUtil.uuId()); entitys.setInvoicesId(entity.getId()); invoicesItem0Service.save(entitys); @@ -167,28 +171,37 @@ public class InvoicesController { purchaseorderEntity.setInvoiceAmount(entity.getInvoiceAmount()); purchaseorderEntity.setInvoiceNum(entity.getInvoiceQuantity()); purchaseorderService.updateById(purchaseorderEntity); + List Purchaseorder_item0List = purchaseorderitemService.GetPurchaseorder_item0List(entity.getPurchaseorderId()); List poundlistEntityList = purchaseorderitemService.getPoundList(entity.getPurchaseorderId()); - Purchaseorder_item0Entity orderItem = Purchaseorder_item0List.stream().filter(item0 -> ObjectUtil.equals(item0.getPoundlistId(), poundlistEntityList.get(0).getId())).findAny().get(); - BigDecimal total = orderItem.getAmount(); - 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; + if (purchaseorderEntity.getAmount().compareTo(entity.getInvoiceAmount()) == 0) { + for (PoundlistEntity poundlistEntity: poundlistEntityList) { + poundlistEntity.setIsInvoicing("1"); + poundlistEntity.setInputDate(new Date()); } - } - for (int j = 0;j ObjectUtil.equals(item0.getPoundlistId(), poundlistEntityList.get(0).getId())).findAny().get(); + BigDecimal total = orderItem.getAmount(); + 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("创建成功"); } diff --git a/SC-web/src/views/dashboard/admin/index.vue b/SC-web/src/views/dashboard/admin/index.vue index 612e58ea..5ad5509c 100644 --- a/SC-web/src/views/dashboard/admin/index.vue +++ b/SC-web/src/views/dashboard/admin/index.vue @@ -3,8 +3,8 @@
- 今日磅单指数 - 磅单实时交易情况 + 今日经营指数 + 实时交易情况
  • @@ -50,14 +50,6 @@ - -
    @@ -120,6 +112,9 @@ export default { opinionData: ["3", "2", "4", "4", "5"], massageList: [], tadayPoundist: {}, + pageSize: 10, + currentPage: 1, + intervalID: undefined, } }, computed: { @@ -133,6 +128,10 @@ export default { this.getTadayPoundist() this.getData() this.getMsg() + this.intervalStrat() + }, + beforeDestroy() { + this.intervalDel(); }, methods: { getData() { @@ -157,18 +156,35 @@ export default { url: "/api/messageCenter/MessageCenter/getMobileList", method: "post", data: { - currentPage: 1, - pageSize: 9, + currentPage: this.currentPage, + pageSize: this.pageSize, }, }).then(res => { if (res.code == 200) { let _list = res.data.list; this.massageList = _list; + if (this.massageList.length === this.pageSize) { + this.currentPage = this.currentPage + 1; + } else { + this.currentPage = 1; + } //console.log(_list) } }).catch(() => { }) }, + intervalStrat() { + this.intervalDel(); + this.intervalID = setInterval(() => { + this.getMsg(); + }, 5000); + + }, + intervalDel() { + if (this.intervalID) { + clearInterval(this.intervalID); + } + }, getTadayPoundist() { request({ url: "/api/messageCenter/MessageCenter/getTadayPoundist",