diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index fd242a6b..dbd9872f 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -75,6 +75,8 @@ public class IoOrderController extends BaseController { IoAddInoutService ioAddInoutService; @Resource IoCheckInoutService ioCheckInoutService; + @Resource + IoOrderInvoiceService orderInvoiceService; /** * 查询单据列表 @@ -133,7 +135,6 @@ public class IoOrderController extends BaseController { if (StrUtil.isNotEmpty(filterOrderRequest.getSupInoivceSearch())) { orderService.setInvoiceFiltes(filterOrderRequest); } - if (filterOrderRequest.getSourceLocalType() != null) { if (filterOrderRequest.getSourceLocalType() == 1) { filterOrderRequest.setSourceTypes(Arrays.asList(1, 2, 3, 4, 5)); @@ -141,7 +142,6 @@ public class IoOrderController extends BaseController { filterOrderRequest.setSourceTypes(Arrays.asList(6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17)); } } - String customerId = getCustomerId(); if (!customerId.equals("110")) { filterOrderRequest.setFromCorp(customerId); @@ -152,20 +152,9 @@ public class IoOrderController extends BaseController { if (ioOrderResponse.getCheckStatus() == null) { ioOrderResponse.setCheckStatus(0 + ""); } - FilterOrderDetailCodeRequest filterOrderDetailCodeRequest = new FilterOrderDetailCodeRequest(); - filterOrderDetailCodeRequest.setOrderIdFk(ioOrderResponse.getBillNo()); - List ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(filterOrderDetailCodeRequest); - BigDecimal amount = new BigDecimal(0.00); - for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) { - if (ioOrderDetailCodeRespons.getReCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) { - amount = amount.add(new BigDecimal(ioOrderDetailCodeRespons.getReCount()).multiply(ioOrderDetailCodeRespons.getPrice())); - } - } - ioOrderResponse.setAllAmount(amount); - + ioOrderResponse = orderInvoiceService.findRegStausByBillNo(ioOrderResponse); } - PageInfo pageInfo = new PageInfo<>(list); return ResultVOUtils.page(pageInfo); } diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index 5f78b08a..f51e9071 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -703,25 +703,25 @@ public class IoOrderDetailBizController extends BaseController { @GetMapping("/udiwms/inout/bizDetail/filterBizOrderList") public BaseResponse filterBizOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest) { List ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(orderDetailBizRequest); - for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) { - if (ioOrderDetailCodeRespons.getReCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) { - ioOrderDetailCodeRespons.setAmount(new BigDecimal(ioOrderDetailCodeRespons.getReCount()).multiply(ioOrderDetailCodeRespons.getPrice())); + List orderInvoiceEntities = ioOrderInvoiceService.findByBillNo(orderDetailBizRequest.getOrderIdFk()); + for (IoOrderDetailCodeResponse orderDetailCodeEntity : ioOrderDetailCodeResponses) { + if (orderDetailCodeEntity.getReCount() != 0 && orderDetailCodeEntity.getPrice() != null) { + orderDetailCodeEntity.setAmount(new BigDecimal(orderDetailCodeEntity.getReCount()).multiply(orderDetailCodeEntity.getPrice())); } String msg = ""; - IoOrderInvoiceRequest ioOrderInvoiceEntity = new IoOrderInvoiceRequest(); - ioOrderInvoiceEntity.setOrderIdFk(ioOrderDetailCodeRespons.getOrderIdFk()); - ioOrderInvoiceEntity.setBatchNo(ioOrderDetailCodeRespons.getBatchNo()); - ioOrderInvoiceEntity.setBindRlFk(ioOrderDetailCodeRespons.getBindRlFk().toString()); - List ioOrderInvoiceEntityList = ioOrderInvoiceService.selectOrderInvoice(ioOrderInvoiceEntity); - for (IoOrderInvoiceEntity obj : ioOrderInvoiceEntityList) { - if (StrUtil.isNotEmpty(obj.getInvoiceEncode())) { - msg += "," + obj.getInvoiceEncode(); + for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) { + if (StrUtil.trimToEmpty(orderInvoiceEntity.getBatchNo()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo())) + && StrUtil.trimToEmpty(orderInvoiceEntity.getBindRlFk()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBindRlFk() + ""))) { + orderDetailCodeEntity.setRegStatus(true); + if (StrUtil.isNotEmpty(orderInvoiceEntity.getInvoiceEncode())) { + msg += "," + orderInvoiceEntity.getInvoiceEncode(); + } } } if (msg.length() > 1) { msg = msg.substring(1); } - ioOrderDetailCodeRespons.setInvoiceCodes(msg); + orderDetailCodeEntity.setInvoiceCodes(msg); } PageInfo pageInfo = new PageInfo<>(ioOrderDetailCodeResponses); return ResultVOUtils.page(pageInfo); diff --git a/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java b/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java index d183c89e..c30b546f 100644 --- a/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java +++ b/src/main/java/com/glxp/api/dao/inout/IoOrderDetailBizDao.java @@ -26,6 +26,7 @@ public interface IoOrderDetailBizDao extends BaseMapperPlus getfilterOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest); List filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest); + IoOrderInvoiceResponse selectByinvoiceId(Long id); /** diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java index c6d65f66..f8a383fb 100644 --- a/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java +++ b/src/main/java/com/glxp/api/res/inout/IoOrderResponse.java @@ -252,6 +252,8 @@ public class IoOrderResponse { private String relKey; //关联单据唯一键 private Integer suppleCount; //补单次数 + private int invoiceStatus;//发票登记状态0:未登记,1:未全部登记;2:已全部登记 + public String getFromName() { diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index 28a84ce7..bf2f491c 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -423,7 +423,6 @@ public class IoCheckInoutService { bizEntity.setCheckSuccess(true); codeEntity.setCheckSuccess(true); codeEntity.setPrice(bizEntity.getPrice()); - orderInvoiceService.updateRegStatus(codeEntity); } break; } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java index c85b5250..5b0a9ffa 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderDetailBizService.java @@ -45,6 +45,7 @@ public interface IoOrderDetailBizService { List checkOrderList(String orderId); List filterListInv(FilterOrderDetailBizRequest orderDetailBizRequest); + IoOrderInvoiceResponse selectByinvoiceId(Long id); Boolean updateOrderDetailBiz(IoOrderDetailBizEntity ioOrderDetailBizEntity); diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java b/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java index 74dc0e40..836e73f4 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java @@ -5,6 +5,7 @@ import com.glxp.api.entity.inout.IoCodeRelEntity; import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; +import com.glxp.api.res.inout.IoOrderResponse; import java.util.List; @@ -24,5 +25,7 @@ public interface IoOrderInvoiceService extends IService { // 更新发票状态 boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity); + IoOrderResponse findRegStausByBillNo(IoOrderResponse orderResponse); + boolean findRegStausByProduct(String billNo); } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java index b3b0a0dd..2e3f1115 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java @@ -1,6 +1,7 @@ package com.glxp.api.service.inout.impl; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.dao.inout.IoCodeRelMapper; @@ -10,6 +11,7 @@ import com.glxp.api.entity.inout.IoCodeRelEntity; import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; +import com.glxp.api.res.inout.IoOrderResponse; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -81,4 +83,45 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl orderInvoiceEntities = ioOrderInvoiceMapper.selectList(new QueryWrapper().eq("orderIdFk", orderResponse.getBillNo())); + List orderDetailCodeEntities = orderDetailCodeDao.selectList(new QueryWrapper().eq("orderIdFk", orderResponse.getBillNo())); + if (CollUtil.isNotEmpty(orderDetailCodeEntities)) { + BigDecimal amount = new BigDecimal(0.00); + for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) { + for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) { + if (StrUtil.trimToEmpty(orderInvoiceEntity.getBatchNo()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBatchNo())) + && StrUtil.trimToEmpty(orderInvoiceEntity.getBindRlFk()).equals(StrUtil.trimToEmpty(orderDetailCodeEntity.getBindRlFk() + ""))) { + orderDetailCodeEntity.setRegStatus(true); + } + } + if (orderDetailCodeEntity.getReCount() != 0 && orderDetailCodeEntity.getPrice() != null) { + amount = amount.add(new BigDecimal(orderDetailCodeEntity.getReCount()).multiply(orderDetailCodeEntity.getPrice())); + } + } + orderResponse.setAllAmount(amount); + } else + return orderResponse; + + int isAll = 0; + for (IoOrderDetailCodeEntity orderDetailCodeEntity : orderDetailCodeEntities) { + if (orderDetailCodeEntity.isRegStatus()) { + isAll++; + } + } + if (orderDetailCodeEntities.size() == isAll) + orderResponse.setInvoiceStatus(2);//已全部登记 + else if(isAll >0){ + orderResponse.setInvoiceStatus(1);//未全部登记 + } + return orderResponse; + + } + + @Override + public boolean findRegStausByProduct(String billNo) { + return false; + } } diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml index 4f6bc310..c42012c9 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDao.xml @@ -3,17 +3,17 @@ select io.*, - (select name from basic_bussiness_type bus where bus.action = io.action) billTypeName, - (select name from auth_dept ad where ad.code = io.deptCode) deptName, - (select name from auth_warehouse aw where aw.code = io.invCode) invName, - (select employeeName from auth_user au where au.id = io.createUser) createUserName, - (select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName, - (select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName, - (select employeeName from auth_user au4 where au4.id = io.checkUser) checkUserName, - (select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName, - (select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName, - (select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName, - (select name from basic_corp bc where bc.erpId = io.customerId) customerName, - (SELECT count(*) FROM io_order_detail_code WHERE io_order_detail_code.orderIdFk = io.billNo - and io_order_detail_code.regStatus = 1 - ) AS allCout, - (SELECT count(*) FROM io_order_detail_code WHERE io_order_detail_code.orderIdFk = io.billNo - and io_order_detail_code.regStatus = 0 - ) As partCount + (select name from basic_bussiness_type bus where bus.action = io.action) billTypeName, + (select name from auth_dept ad where ad.code = io.deptCode) deptName, + (select name from auth_warehouse aw where aw.code = io.invCode) invName, + (select employeeName from auth_user au where au.id = io.createUser) createUserName, + (select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName, + (select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName, + (select employeeName from auth_user au4 where au4.id = io.checkUser) checkUserName, + (select name from auth_dept ad2 where ad2.code = io.fromDeptCode) fromDeptName, + (select name from auth_warehouse aw2 where aw2.code = io.fromInvCode) fromInvName, + (select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName, + (select name from basic_corp bc where bc.erpId = io.customerId) customerName, + (SELECT count(*) + FROM io_order_detail_code + WHERE io_order_detail_code.orderIdFk = io.billNo + and io_order_detail_code.regStatus = 1 + ) AS allCout, + (SELECT count(*) + FROM io_order_detail_code + WHERE io_order_detail_code.orderIdFk = io.billNo + and io_order_detail_code.regStatus = 0 + ) As partCount from io_order as io @@ -162,7 +166,7 @@ AND (SELECT NAME FROM auth_warehouse aw2 WHERE aw2.CODE = io.fromInvCode) like - concat('%', #{corpName}, '%') + concat('%', #{corpName}, '%') AND action = #{action} @@ -250,12 +254,12 @@ and ( - `action` in + `action` in #{item} and status = 7 - ) + ) @@ -264,22 +268,19 @@ #{item} and status = 10) - or ( - `action` in + or ( + `action` in #{item} and status = 7) - ) + ) - - - @@ -410,28 +410,24 @@ - - - - - - diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml index 90dec082..ef29a18a 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml @@ -113,10 +113,7 @@