diff --git a/src/main/java/com/glxp/api/controller/basic/BasicBussinessTypeController.java b/src/main/java/com/glxp/api/controller/basic/BasicBussinessTypeController.java index f7322aca..7bd7886b 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicBussinessTypeController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicBussinessTypeController.java @@ -424,7 +424,14 @@ public class BasicBussinessTypeController extends BaseController { bussinessTypeFilterRequest.setEnable(true); //bussinessTypeFilterRequest.setMainAction(ConstantType.TYPE_PUT); List bussinessTypeEntities; - bussinessTypeEntities = basicBussinessTypeService.filterList(bussinessTypeFilterRequest); + + if (StrUtil.isNotEmpty(bussinessTypeFilterRequest.getInvCode())) { + bussinessTypeEntities = basicBussinessTypeService.filterJoinByInv(bussinessTypeFilterRequest); + } else { + bussinessTypeEntities = basicBussinessTypeService.filterList(bussinessTypeFilterRequest); + } + + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); pageSimpleResponse.setList(bussinessTypeEntities); return ResultVOUtils.success(pageSimpleResponse); diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java index b3efdb0c..2def07c6 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailResultController.java @@ -3,6 +3,7 @@ package com.glxp.api.controller.inout; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; @@ -46,6 +47,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; @@ -98,12 +101,20 @@ public class IoOrderDetailResultController extends BaseController { @AuthRuleAnnotation("") @GetMapping("/udiwms/inout/resultDetail/filterOrderList") public BaseResponse filterOrderList(FilterOrderDetailResultRequest orderDetailResultRequest) { + PageInfo pageInfo = new PageInfo<>(getOrderResult(orderDetailResultRequest)); + return ResultVOUtils.page(pageInfo); + } + + public List getOrderResult(FilterOrderDetailResultRequest orderDetailResultRequest) { + if (CollUtil.isNotEmpty(orderDetailResultRequest.getList())) { + return orderDetailResultRequest.getList(); + } FilterOrderRequest filterOrderRequest = new FilterOrderRequest(); filterOrderRequest.setVueType(orderDetailResultRequest.getActionType()); List actions = orderService.setActions(filterOrderRequest); if (CollUtil.isEmpty(actions)) { - return ResultVOUtils.success(""); + return Collections.emptyList(); } orderDetailResultRequest.setActions(actions); AuthAdmin authAdmin = customerService.getUserBean(); @@ -122,13 +133,39 @@ public class IoOrderDetailResultController extends BaseController { } String fromName = orderDetailResultResponse.getFromName(); orderDetailResultResponse.setFromName(fromName); + } + return list; + } - } - PageInfo pageInfo = new PageInfo<>(list); - return ResultVOUtils.page(pageInfo); + @GetMapping("/udiwms/inout/resultDetail/exportExcel") + public void exportTemplate(FilterOrderDetailResultRequest orderDetailResultRequest, HttpServletResponse response) throws IOException { + // 模拟数据库获取数据 + List list = getOrderResult(orderDetailResultRequest); + + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode("出入库明细" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx", StandardCharsets.UTF_8.name())); + + EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(list); + } + + + @PostMapping("/udiwms/inout/resultDetail/selectExportExcel") + public void selectExportExcel(@RequestBody FilterOrderDetailResultRequest orderDetailResultRequest, HttpServletResponse response) throws IOException { + // 模拟数据库获取数据 + List list = getOrderResult(orderDetailResultRequest); + + response.setCharacterEncoding(StandardCharsets.UTF_8.name()); + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.setHeader("Content-Disposition", + "attachment;filename=" + URLEncoder.encode("出入库明细" + DateUtil.format(new Date(), "yyyy-MM-dd") + ".xlsx", StandardCharsets.UTF_8.name())); + + EasyExcel.write(response.getOutputStream(), IoOrderDetailResultResponse.class).sheet().doWrite(list); } + /** * pda下载业务单据详情复核 */ diff --git a/src/main/java/com/glxp/api/entity/basic/BasicBusTypePreEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicBusTypePreEntity.java index 10370ec0..271fcfb6 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicBusTypePreEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicBusTypePreEntity.java @@ -123,7 +123,7 @@ public class BasicBusTypePreEntity { @TableField(value = "remark") private String remark; -// 创建单模式:1:送货至入库单模式;2.向上级补单模式;3.预验收转入库单模式,4.寄售转入库单模式 +// 创建单模式:1:送货至入库单模式;2.向上级补单模式;3.预验收转入库单模式,4.寄售转入库单模式,5.退货向上级补单模式 @TableField(value = "createType") private int createType; diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailBizEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailBizEntity.java index 69278047..ae21a804 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailBizEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailBizEntity.java @@ -136,7 +136,7 @@ public class IoOrderDetailBizEntity { * 单据数量 */ @TableField(value = "`count`") - private int count; + private Integer count; /** * 备注 diff --git a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailResultEntity.java b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailResultEntity.java index 54a63cf5..0f58f170 100644 --- a/src/main/java/com/glxp/api/entity/inout/IoOrderDetailResultEntity.java +++ b/src/main/java/com/glxp/api/entity/inout/IoOrderDetailResultEntity.java @@ -139,13 +139,13 @@ public class IoOrderDetailResultEntity { * 单据数量 */ @TableField(value = "`count`") - private int count; + private Integer count; /** * 扫码数量 */ @TableField(value = "reCount") - private int reCount; + private Integer reCount; /** * 备注 diff --git a/src/main/java/com/glxp/api/res/inout/IoOrderDetailResultResponse.java b/src/main/java/com/glxp/api/res/inout/IoOrderDetailResultResponse.java index c13aaa4e..ece704fa 100644 --- a/src/main/java/com/glxp/api/res/inout/IoOrderDetailResultResponse.java +++ b/src/main/java/com/glxp/api/res/inout/IoOrderDetailResultResponse.java @@ -1,6 +1,8 @@ package com.glxp.api.res.inout; import cn.hutool.core.util.StrUtil; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; import lombok.Data; import java.math.BigDecimal; @@ -17,6 +19,7 @@ public class IoOrderDetailResultResponse { /** * 订单号外键 */ + @ExcelProperty(value = "出入库单号", index = 1) private String orderIdFk; /** @@ -32,31 +35,37 @@ public class IoOrderDetailResultResponse { /** * DI */ + @ExcelProperty(value = "DI/物资编码", index = 2) private String nameCode; /** * 批次号 */ + @ExcelProperty(value = "批次号", index = 5) private String batchNo; /** * 生产日期 */ + @ExcelProperty(value = "生产日期", index = 10) private String productDate; /** * 失效日期 */ + @ExcelProperty(value = "失效日期", index = 11) private String expireDate; /** * 产品通用名称 */ + @ExcelProperty(value = "物资名称", index = 3) private String coName; /** * 注册证号 */ + @ExcelProperty(value = "注册/备案号", index = 14) private String certCode; /** @@ -67,16 +76,19 @@ public class IoOrderDetailResultResponse { /** * 生产企业 */ + @ExcelProperty(value = "生产企业", index = 13) private String manufacturer; /** * 计量单位 */ + @ExcelProperty(value = "计量单位", index = 8) private String measname; /** * 规格型号 */ + @ExcelProperty(value = "规格型号", index = 4) private String spec; /** @@ -123,8 +135,9 @@ public class IoOrderDetailResultResponse { * 扫码数量 */ private int reCount; - + @ExcelProperty(value = "入库数量", index = 6) private Integer inCount; + @ExcelProperty(value = "出库数量", index = 7) private Integer outCount; @@ -159,10 +172,14 @@ public class IoOrderDetailResultResponse { private String remark5; private int acceptCount; private String fromCorpName; + @ExcelProperty(value = "单据类型", index = 9) private String billTypeName; private String mainAction; + @ExcelProperty(value = "出入库时间", index = 12) private Date auditTime; private String fromInvName; + + @ExcelProperty(value = "往来单位", index = 0) private String fromName; /** diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index 67cbd0da..bde626af 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -213,13 +213,34 @@ public class IoChangeInoutService { InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(Constant.INV_PRE_CODE); outOrder.setFromInvCode(invWarehouseEntity.getCode()); outOrder.setFromDeptCode(invWarehouseEntity.getParentId()); - } else { + } else if (bussinessChangeTypeEntity.getCreateType() == 5) { //退货出库 outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); InvWarehouseEntity curInv = invWarehouseService.findByInvSubByCode(orderEntity.getInvCode()); InvWarehouseEntity upInv = invWarehouseService.findByInvSubByCode(curInv.getParentCode()); if (upInv != null) { outOrder.setFromInvCode(upInv.getCode()); outOrder.setFromDeptCode(upInv.getParentId()); + outOrder.setFromCorp(null); + } else { + outOrder.setCustomerId(corpName); + outOrder.setFromCorp(corpName); + } + //原先流程---使用流转单据默认仓库 +// outOrder.setFromInvCode(bussinessChangeTypeEntity.getDefaultInvCode()); +// outOrder.setFromDeptCode(bussinessChangeTypeEntity.getDefaultDeptCode()); + + } else { //向上级补单模式 + outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); + InvWarehouseEntity curInv = invWarehouseService.findByInvSubByCode(orderEntity.getInvCode()); + InvWarehouseEntity upInv = invWarehouseService.findByInvSubByCode(curInv.getParentCode()); + if (upInv != null) { + outOrder.setFromInvCode(upInv.getCode()); + outOrder.setFromDeptCode(upInv.getParentId()); + outOrder.setFromCorp(null); + } + if (StrUtil.isNotEmpty(bussinessChangeTypeEntity.getDefaultInvCode())) { + outOrder.setFromInvCode(bussinessChangeTypeEntity.getDefaultInvCode()); + outOrder.setFromDeptCode(bussinessChangeTypeEntity.getDefaultDeptCode()); } //原先流程---使用流转单据默认仓库 // outOrder.setFromInvCode(bussinessChangeTypeEntity.getDefaultInvCode());