20102728 康伟

kangwei : 补充 入库验收单审核列表接口

                导出pdf文件接口
1 个父辈 b5d77a45
正在显示 31 个修改的文件 包含 922 行增加132 行删除
...@@ -102,6 +102,29 @@ ...@@ -102,6 +102,29 @@
102 <artifactId>jsch</artifactId> 102 <artifactId>jsch</artifactId>
103 <version>0.1.55</version> 103 <version>0.1.55</version>
104 </dependency> 104 </dependency>
105
106
107 <!-- 导出pdf文件-->
108 <dependency>
109 <groupId>com.itextpdf</groupId>
110 <artifactId>itextpdf</artifactId>
111 <version>5.5.11</version>
112 </dependency>
113 <dependency>
114 <groupId>org.apache.velocity</groupId>
115 <artifactId>velocity</artifactId>
116 <version>1.7</version>
117 </dependency>
118 <dependency>
119 <groupId>com.itextpdf</groupId>
120 <artifactId>html2pdf</artifactId>
121 <version>4.0.3</version>
122 </dependency>
123 <dependency>
124 <groupId>com.itextpdf</groupId>
125 <artifactId>font-asian</artifactId>
126 <version>7.2.3</version>
127 </dependency>
105 </dependencies> 128 </dependencies>
106 129
107 <build> 130 <build>
......
...@@ -15,6 +15,7 @@ import com.skua.modules.erp.service.IDistributMaterialService; ...@@ -15,6 +15,7 @@ import com.skua.modules.erp.service.IDistributMaterialService;
15 import com.skua.modules.erp.service.IPurchaseMaterialService; 15 import com.skua.modules.erp.service.IPurchaseMaterialService;
16 import com.skua.modules.erp.vo.MaterialSearchVO; 16 import com.skua.modules.erp.vo.MaterialSearchVO;
17 import com.skua.modules.erp.vo.PurchaseMaterialVO; 17 import com.skua.modules.erp.vo.PurchaseMaterialVO;
18 import com.skua.modules.quartz.util.BaseUtil;
18 import com.skua.modules.supplies.entity.EquipmentSparepartSupplies; 19 import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
19 import com.skua.modules.supplies.entity.EquipmentSparepartType; 20 import com.skua.modules.supplies.entity.EquipmentSparepartType;
20 import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService; 21 import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService;
...@@ -44,6 +45,7 @@ public class ErpCommonController { ...@@ -44,6 +45,7 @@ public class ErpCommonController {
44 @Autowired 45 @Autowired
45 private IEquipmentSparepartTypeService equipmentSparepartTypeService; 46 private IEquipmentSparepartTypeService equipmentSparepartTypeService;
46 47
48
47 @AutoLog(value = "ERP-采购计划--物料列表") 49 @AutoLog(value = "ERP-采购计划--物料列表")
48 @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表") 50 @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表")
49 @RequestMapping(value = "/sparepartList", method = RequestMethod.GET) 51 @RequestMapping(value = "/sparepartList", method = RequestMethod.GET)
...@@ -76,6 +78,7 @@ public class ErpCommonController { ...@@ -76,6 +78,7 @@ public class ErpCommonController {
76 @RequestMapping(value = "/purchaseMaterialList", method = RequestMethod.GET) 78 @RequestMapping(value = "/purchaseMaterialList", method = RequestMethod.GET)
77 public Result<IPage<PurchaseMaterial>> purchaseMaterialList( 79 public Result<IPage<PurchaseMaterial>> purchaseMaterialList(
78 @RequestParam(name = "goodCode") String goodCode, 80 @RequestParam(name = "goodCode") String goodCode,
81 @RequestParam(name = "medicament") boolean medicament,
79 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, 82 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
80 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { 83 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
81 Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>(); 84 Result<IPage<PurchaseMaterial>> result = new Result<IPage<PurchaseMaterial>>();
...@@ -99,7 +102,38 @@ public class ErpCommonController { ...@@ -99,7 +102,38 @@ public class ErpCommonController {
99 Result<IPage<PurchaseMaterialVO>> result = new Result<IPage<PurchaseMaterialVO>>(); 102 Result<IPage<PurchaseMaterialVO>> result = new Result<IPage<PurchaseMaterialVO>>();
100 Page<PurchaseMaterialVO> page = new Page<PurchaseMaterialVO>(pageNo, pageSize); 103 Page<PurchaseMaterialVO> page = new Page<PurchaseMaterialVO>(pageNo, pageSize);
101 //String departId = BaseContextHandler.getRealDepartId();//当前部门编号 104 //String departId = BaseContextHandler.getRealDepartId();//当前部门编号
102 materialSearchVO.setDepartId( BaseContextHandler.getRealDepartId() ); 105 // materialSearchVO.setDepartId( BaseContextHandler.getRealDepartId() );
106 //如果为管理员,则跳过权限
107 if (!"1".equals(BaseContextHandler.get("userType"))) {
108 if (StringUtils.isNotEmpty( BaseContextHandler.getDeparts())) {
109 materialSearchVO.setDepartId( BaseUtil.quoteEach(BaseContextHandler.getDeparts() ,",")) ;//非管理员,获取权限部门集合
110 }else{
111 materialSearchVO.setDepartId(BaseContextHandler.getRealDepartId() ) ;//非管理员,获取权限部门集合
112 }
113 }
114 String sparepartTypeStr = "";
115 if(StringUtils.isNotEmpty(materialSearchVO.getSparepartType())){
116 //查询子集合
117 Set<String> sparepartTypeSet = equipmentSparepartTypeService.getAllChildrenSparepartTypeIds(materialSearchVO.getSparepartType() );
118 if(sparepartTypeSet.size() > 0 ){
119 // 使用String.join()方法转换Set为字符串,以逗号分隔
120 sparepartTypeStr = String.join(",", sparepartTypeSet);
121 }
122 materialSearchVO.setSparepartType(sparepartTypeStr) ;
123 }else{
124 if(materialSearchVO.isMedicament()){ //查询药剂物料清单
125 EquipmentSparepartType equipmentSparepartType = new EquipmentSparepartType();
126 equipmentSparepartType.setMedicament( materialSearchVO.isMedicament() );
127 List<EquipmentSparepartType> sparepartTypeList = equipmentSparepartTypeService.querySparepartTypeList(equipmentSparepartType);
128 if(sparepartTypeList != null && !sparepartTypeList.isEmpty()){
129 for(EquipmentSparepartType sparepartType : sparepartTypeList){
130 if(sparepartTypeStr.length() > 0 ) sparepartTypeStr+=",";
131 sparepartTypeStr += "'"+sparepartType.getId()+"'";
132 }
133 }
134 materialSearchVO.setSparepartType(sparepartTypeStr) ;
135 }
136 }
103 IPage<PurchaseMaterialVO> pageList = purchaseMaterialService.queryPurchaseMaterialListByIn(page,materialSearchVO); 137 IPage<PurchaseMaterialVO> pageList = purchaseMaterialService.queryPurchaseMaterialListByIn(page,materialSearchVO);
104 result.setSuccess(true); 138 result.setSuccess(true);
105 result.setResult(pageList); 139 result.setResult(pageList);
......
1 package com.skua.modules.erp.controller; 1 package com.skua.modules.erp.controller;
2 2
3 import java.util.Arrays; 3 import java.util.Arrays;
4 import java.util.Date;
5 import java.util.List; 4 import java.util.List;
6 5
7 import javax.servlet.http.HttpServletRequest; 6 import javax.servlet.http.HttpServletRequest;
8 7
9 import cn.hutool.core.date.DateUtil;
10 import com.skua.core.api.vo.Result; 8 import com.skua.core.api.vo.Result;
11 import com.skua.core.aspect.annotation.AutoLog; 9 import com.skua.core.aspect.annotation.AutoLog;
12 import com.skua.core.context.BaseContextHandler; 10 import com.skua.core.context.BaseContextHandler;
13 import com.skua.core.query.QueryGenerator; 11 import com.skua.core.query.QueryGenerator;
14 import com.skua.core.util.DateUtils; 12 import com.skua.core.util.DateUtils;
15 import com.skua.modules.erp.entity.ERPPurchaseContract; 13 import com.skua.modules.erp.entity.ERPPurchaseContract;
16 import com.skua.modules.erp.service.IEROPurchaseContractService; 14 import com.skua.modules.erp.service.IERPPurchaseContractService;
17 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 15 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
18 import com.baomidou.mybatisplus.core.metadata.IPage; 16 import com.baomidou.mybatisplus.core.metadata.IPage;
19 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 17 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
20 import com.skua.modules.erp.vo.PurchaseContractVO; 18 import com.skua.modules.erp.vo.PurchaseContractVO;
21 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
22 import org.apache.commons.lang3.StringUtils;
23 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.web.bind.annotation.*; 21 import org.springframework.web.bind.annotation.*;
25 import io.swagger.annotations.Api; 22 import io.swagger.annotations.Api;
...@@ -38,7 +35,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -38,7 +35,7 @@ import io.swagger.annotations.ApiOperation;
38 @RequestMapping("/web/erp/purchaseContract") 35 @RequestMapping("/web/erp/purchaseContract")
39 public class PurchaseContractController { 36 public class PurchaseContractController {
40 @Autowired 37 @Autowired
41 private IEROPurchaseContractService purchaseContractService; 38 private IERPPurchaseContractService purchaseContractService;
42 39
43 @AutoLog(value = "erp采购合同-分页列表查询") 40 @AutoLog(value = "erp采购合同-分页列表查询")
44 @ApiOperation(value="erp采购合同-分页列表查询", notes="erp采购合同-分页列表查询") 41 @ApiOperation(value="erp采购合同-分页列表查询", notes="erp采购合同-分页列表查询")
...@@ -99,6 +96,8 @@ public class PurchaseContractController { ...@@ -99,6 +96,8 @@ public class PurchaseContractController {
99 String errorGoodsCode = purchaseContractService.checkGoodCode(purchaseContractVO ,0 ); 96 String errorGoodsCode = purchaseContractService.checkGoodCode(purchaseContractVO ,0 );
100 if(errorGoodsCode != null ){ 97 if(errorGoodsCode != null ){
101 result.error500("校验失败,货号[ "+errorGoodsCode+" ]已经存在!"); 98 result.error500("校验失败,货号[ "+errorGoodsCode+" ]已经存在!");
99 }else if("404".equals(errorGoodsCode)){
100 result.error500("校验失败,货号必填!");
102 }else{ 101 }else{
103 purchaseContractService.savePurchaseContract(purchaseContractVO); 102 purchaseContractService.savePurchaseContract(purchaseContractVO);
104 result.success("添加成功!"); 103 result.success("添加成功!");
...@@ -122,6 +121,8 @@ public class PurchaseContractController { ...@@ -122,6 +121,8 @@ public class PurchaseContractController {
122 String errorGoodsCode = purchaseContractService.checkGoodCode(purchaseContractVO ,1 ); 121 String errorGoodsCode = purchaseContractService.checkGoodCode(purchaseContractVO ,1 );
123 if(errorGoodsCode != null ){ 122 if(errorGoodsCode != null ){
124 result.error500("校验失败,货号[ "+errorGoodsCode+" ]已经存在!"); 123 result.error500("校验失败,货号[ "+errorGoodsCode+" ]已经存在!");
124 }else if("404".equals(errorGoodsCode)){
125 result.error500("校验失败,货号必填!");
125 }else{ 126 }else{
126 purchaseContractService.updatePurchaseContract(purchaseContractVO); 127 purchaseContractService.updatePurchaseContract(purchaseContractVO);
127 result.success("修改成功!"); 128 result.success("修改成功!");
......
1 package com.skua.modules.erp.controller;
2
3
4 import cn.hutool.core.date.DateUtil;
5 import cn.hutool.core.util.CharsetUtil;
6 import cn.hutool.core.util.URLUtil;
7 import com.skua.modules.erp.util.PdfUtil;
8 import io.swagger.annotations.Api;
9 import org.apache.velocity.VelocityContext;
10 import org.springframework.web.bind.annotation.GetMapping;
11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RestController;
13
14 import javax.servlet.ServletOutputStream;
15 import javax.servlet.http.HttpServletResponse;
16 import java.util.*;
17
18 @Api(tags="erp-导出pdf文件")
19 @RestController
20 @RequestMapping("/velocity")
21 public class VelocityPdfController {
22
23 @GetMapping("/getPdf")
24 public void get(HttpServletResponse response){
25 response.reset();
26 response.setContentType("application/pdf");
27 String filename = System.currentTimeMillis()+".pdf";
28 // response.addHeader("Content-Disposition", "inline; filename=" + URLUtil.encode(filename, CharsetUtil.CHARSET_UTF_8));
29 response.addHeader("Content-Disposition", "attachment; filename=" + URLUtil.encode(filename, CharsetUtil.CHARSET_UTF_8));
30
31 VelocityContext context = new VelocityContext();
32
33 context.put("name", "彭也行");
34 context.put("gender", 1);
35 context.put("birthDate", DateUtil.formatDateTime(new Date()));
36 context.put("phone", "13666666666");
37
38 List<Map<String, Object>> eduList = new ArrayList<>();
39 // 小学
40 Map<String, Object> primarySchoolMap = new HashMap<>();
41 primarySchoolMap.put("name", "小学");
42 List<Map<String, Object>> scoreList = new ArrayList<>();
43 // 语文成绩
44 Map<String, Object> chineseScore = new HashMap<>();
45 chineseScore.put("subject", "语文");
46 chineseScore.put("num", 60);
47 // 数学成绩
48 Map<String, Object> mathScore = new HashMap<>();
49 mathScore.put("subject", "数学");
50 mathScore.put("num", 99);
51 scoreList.add(chineseScore);
52 scoreList.add(mathScore);
53 primarySchoolMap.put("itemList", scoreList);
54 primarySchoolMap.put("size", scoreList.size());
55
56 // 初中
57 Map<String, Object> middleSchoolMap = new HashMap<>();
58 middleSchoolMap.put("name", "初中");
59 List<Map<String, Object>> middleScoreList = new ArrayList<>();
60 // 语文成绩
61 Map<String, Object> middleChineseScore = new HashMap<>();
62 middleChineseScore.put("subject", "语文");
63 middleChineseScore.put("num", 60);
64 // 数学成绩
65 Map<String, Object> middleMathScore = new HashMap<>();
66 middleMathScore.put("subject", "数学");
67 middleMathScore.put("num", 99);
68 // 英语
69 Map<String, Object> middleEnScore = new HashMap<>();
70 middleEnScore.put("subject", "英语");
71 middleEnScore.put("num", 55);
72
73 middleScoreList.add(middleChineseScore);
74 middleScoreList.add(middleMathScore);
75 middleScoreList.add(middleEnScore);
76 middleScoreList.add(middleEnScore);
77 middleScoreList.add(middleEnScore);
78 middleScoreList.add(middleEnScore);
79 middleScoreList.add(middleEnScore);
80 middleScoreList.add(middleEnScore);
81 middleSchoolMap.put("itemList", middleScoreList);
82 middleSchoolMap.put("size", middleScoreList.size());
83
84 eduList.add(primarySchoolMap);
85 eduList.add(middleSchoolMap);
86 context.put("eduList", eduList);
87 try(ServletOutputStream outputStream = response.getOutputStream()){
88 PdfUtil.pdfFile(context, "static/demo.html", outputStream);
89 }catch (Exception e){
90 e.printStackTrace();
91 }
92 }
93
94 }
...@@ -28,12 +28,8 @@ public class MaterialAcceptanceForm { ...@@ -28,12 +28,8 @@ public class MaterialAcceptanceForm {
28 28
29 /**主键*/ 29 /**主键*/
30 @TableId(type = IdType.ID_WORKER_STR) 30 @TableId(type = IdType.ID_WORKER_STR)
31 @ApiModelProperty(value = "主键")
32 private String id;
33 /**入库单号*/
34 @Excel(name = "入库单号", width = 15)
35 @ApiModelProperty(value = "入库单号") 31 @ApiModelProperty(value = "入库单号")
36 private String materialInId; 32 private String id;
37 /**入库单号*/ 33 /**入库单号*/
38 @Excel(name = "入库单号", width = 15) 34 @Excel(name = "入库单号", width = 15)
39 @ApiModelProperty(value = "入库单号") 35 @ApiModelProperty(value = "入库单号")
...@@ -82,4 +78,9 @@ public class MaterialAcceptanceForm { ...@@ -82,4 +78,9 @@ public class MaterialAcceptanceForm {
82 @Excel(name = "备注", width = 15) 78 @Excel(name = "备注", width = 15)
83 @ApiModelProperty(value = "备注") 79 @ApiModelProperty(value = "备注")
84 private String remark; 80 private String remark;
81
82
83 @TableField(exist = false)
84 @ApiModelProperty(value = "到货日期")
85 private String arriveTime;
85 } 86 }
......
...@@ -46,10 +46,12 @@ public class MaterialIN { ...@@ -46,10 +46,12 @@ public class MaterialIN {
46 /**采购合同*/ 46 /**采购合同*/
47 @Excel(name = "采购合同", width = 15) 47 @Excel(name = "采购合同", width = 15)
48 @ApiModelProperty(value = "采购合同") 48 @ApiModelProperty(value = "采购合同")
49 @Dict(dictTable = "erp_purchase_contract", dicCode="id", dicText = "contract_code")
49 private String purchaseContractId; 50 private String purchaseContractId;
50 /**分销合同*/ 51 /**分销合同*/
51 @Excel(name = "分销合同", width = 15) 52 @Excel(name = "分销合同", width = 15)
52 @ApiModelProperty(value = "分销合同") 53 @ApiModelProperty(value = "分销合同")
54 @Dict(dictTable = "erp_distribut_contract", dicCode="id", dicText = "contract_code")
53 private String distributContractId; 55 private String distributContractId;
54 /**到货时间*/ 56 /**到货时间*/
55 @Excel(name = "到货时间", width = 15) 57 @Excel(name = "到货时间", width = 15)
......
...@@ -66,6 +66,8 @@ public class PurchasePlanItem implements Serializable{ ...@@ -66,6 +66,8 @@ public class PurchasePlanItem implements Serializable{
66 @Excel(name = "计划采购数量", width = 15) 66 @Excel(name = "计划采购数量", width = 15)
67 @ApiModelProperty(value = "计划采购数量") 67 @ApiModelProperty(value = "计划采购数量")
68 private String purchaseNum; 68 private String purchaseNum;
69
70
69 /**单价*/ 71 /**单价*/
70 @Excel(name = "单价", width = 15) 72 @Excel(name = "单价", width = 15)
71 @ApiModelProperty(value = "单价") 73 @ApiModelProperty(value = "单价")
...@@ -102,4 +104,19 @@ public class PurchasePlanItem implements Serializable{ ...@@ -102,4 +104,19 @@ public class PurchasePlanItem implements Serializable{
102 @TableField(exist=false) 104 @TableField(exist=false)
103 @ApiModelProperty(value = "所属厂站名称") 105 @ApiModelProperty(value = "所属厂站名称")
104 private String departName; 106 private String departName;
107
108 @TableField(exist=false)
109 @ApiModelProperty(value = "计划年")
110 private String applyYear;
111
112
113 @TableField(exist=false)
114 @Excel(name = "已采购数量", width = 15)
115 @ApiModelProperty(value = "已采购数量")
116 private String usePurchaseNum;
117
118 public String getUsePurchaseNum() {
119 if(usePurchaseNum == null ) usePurchaseNum = "0";
120 return usePurchaseNum;
121 }
105 } 122 }
......
...@@ -2,6 +2,7 @@ package com.skua.modules.erp.mapper; ...@@ -2,6 +2,7 @@ package com.skua.modules.erp.mapper;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
5 import com.skua.modules.erp.entity.MaterialIN;
5 import org.apache.ibatis.annotations.Param; 6 import org.apache.ibatis.annotations.Param;
6 import com.skua.modules.erp.entity.MaterialAcceptanceForm; 7 import com.skua.modules.erp.entity.MaterialAcceptanceForm;
7 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 8 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -11,4 +12,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +12,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
11 */ 12 */
12 public interface MaterialAcceptanceFormMapper extends BaseMapper<MaterialAcceptanceForm> { 13 public interface MaterialAcceptanceFormMapper extends BaseMapper<MaterialAcceptanceForm> {
13 14
15 /***
16 * 列表查询 验收单
17 * @param materialIN
18 * @return
19 */
20 public List<MaterialAcceptanceForm> queryArrivalRecordByList(MaterialIN materialIN);
14 } 21 }
......
...@@ -2,6 +2,8 @@ package com.skua.modules.erp.mapper; ...@@ -2,6 +2,8 @@ package com.skua.modules.erp.mapper;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
5 import com.baomidou.mybatisplus.core.metadata.IPage;
6 import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
5 import org.apache.ibatis.annotations.Param; 7 import org.apache.ibatis.annotations.Param;
6 import com.skua.modules.erp.entity.MaterialIN; 8 import com.skua.modules.erp.entity.MaterialIN;
7 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 9 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...@@ -11,4 +13,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +13,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
11 */ 13 */
12 public interface MaterialINMapper extends BaseMapper<MaterialIN> { 14 public interface MaterialINMapper extends BaseMapper<MaterialIN> {
13 15
16 /***
17 * 列表查询到货记录列表
18 * @param materialIN
19 * @return
20 */
21 List<ArrivalRecordExcelExportVO> queryArrivalRecordByList(MaterialIN materialIN);
22
23 /***
24 * 获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索
25 * @param page
26 * @param materialIN
27 * @return
28 */
29 public List<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, @Param("materialIN") MaterialIN materialIN);
14 } 30 }
......
...@@ -2,13 +2,28 @@ ...@@ -2,13 +2,28 @@
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.skua.modules.erp.mapper.MaterialAcceptanceFormMapper"> 3 <mapper namespace="com.skua.modules.erp.mapper.MaterialAcceptanceFormMapper">
4 4
5 <select id="queryByList" resultType="com.skua.modules.erp.vo.PurchasePlanItemVO"> 5 <select id="queryArrivalRecordByList" resultType="com.skua.modules.erp.entity.MaterialAcceptanceForm">
6 select 6 select mi.arrive_time , maf.* from erp_material_in mi ,erp_material_acceptance_form maf
7 t.arrive_time '到货日期', t.purchase_num '数量',t.measuring_unit '单位' , 7 where mi.id = maf.id
8 f.appearance_info '外观情况',f.matched_info '匹配情况' ,f.handle_msg '处理意见',f.sender_sign , f.receiver_sign,f.remark , 8 <where>
9 t.sparepart_name,t.sparepart_code ,t.sparepart_type,t.specification ,t.depart_id , 9 mi.audit_status =3
10 from erp_material_in t 10 <if test="startTime != null and startTime !=''">
11 left join erp_material_acceptance_form f on t.id = f.id 11 and mi.arrive_time &gt;= #{param.startTime}
12 where t.supplier_id = 100 and t.depart_id = 'af880d6a13404a67825e94bc0f2f3808' 12 </if>
13 <if test="endTime != null param.endTime !=''">
14 and mi.arrive_time &lt;= #{param.endTime}
15 </if>
16 <if test="departId != null departId !=''">
17 and mi.depart_id = #{departId}
18 </if>
19 <if test="supplierId != null supplierId !=''">
20 and mi.supplier_id = #{supplierId}
21 </if>
22 <if test="purchaseContractId != null purchaseContractId !=''">
23 and mi.purchase_contract_id = #{purchaseContractId}
24 </if>
25
26 </where>
27 order by maf.create_time asc
13 </select> 28 </select>
14 </mapper> 29 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,9 +3,65 @@ ...@@ -3,9 +3,65 @@
3 <mapper namespace="com.skua.modules.erp.mapper.MaterialINMapper"> 3 <mapper namespace="com.skua.modules.erp.mapper.MaterialINMapper">
4 4
5 <!--查询 入库单 --> 5 <!--查询 入库单 -->
6 <select id="queryByList" resultType="com.skua.modules.erp.entity.MaterialIN"> 6 <select id="queryArrivalRecordByList" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO">
7 select t.* 7 select d.depart_name, pc.contract_code 'purchaseContractCode', dc.contract_code 'distributContractCode' ,ss.sparepart_name,mi.*
8 from erp_material_in t 8 from erp_material_in mi
9 where t.supplier_id = 100 and t.depart_id = 'af880d6a13404a67825e94bc0f2f3808' 9 left join sys_depart d on d.id = mi.depart_id
10 left join erp_purchase_contract pc on pc.id = mi.purchase_contract_id
11 left join erp_distribut_contract dc on dc.id = mi.distribut_contract_id
12 left join equipment_sparepart_supplies ss on ss.id = mi.supplier_id
13 <where>
14 mi.audit_status =3
15 <if test="startTime != null and startTime !=''">
16 and mi.arrive_time &gt;= #{param.startTime}
17 </if>
18 <if test="endTime != null param.endTime !=''">
19 and mi.arrive_time &lt;= #{param.endTime}
20 </if>
21 <if test="goodCode != null goodCode !=''">
22 and mi.good_code like CONCAT('',#{goodCode},'%')
23 </if>
24 <if test="sparepartName != null sparepartName !=''">
25 and mi.sparepart_name like CONCAT('%',#{sparepartName},'%')
26 </if>
27 <if test="departId != null departId !=''">
28 and mi.depart_id = #{departId}
29 </if>
30 <if test="supplierId != null supplierId !=''">
31 and mi.supplier_id = #{supplierId}
32 </if>
33 </where>
34
35 </select>
36
37 <!--获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索 -->
38 <select id="queryArrivalRecordByList" resultType="com.skua.modules.erp.vo.ArrivalRecordExcelExportVO">
39 select sparepart_id , purchase_contract_id,depart_id ,supplier_id,
40 sum(purchase_num) 'purchase_num',measuring_unit,specification,sparepart_name,tax_amount,
41 purchase_price,distribut_price,sum(purchase_total_price) 'purchase_total_price',sum(distribut_total_price) 'distribut_total_price',sum(total_price_tax) 'total_price_tax'
42 from erp_material_in
43 <where>
44 mi.audit_status =3
45 <if test="startTime != null and startTime !=''">
46 and arrive_time &gt;= #{param.startTime}
47 </if>
48 <if test="endTime != null param.endTime !=''">
49 and arrive_time &lt;= #{param.endTime}
50 </if>
51 <if test="departId != null departId !=''">
52 and depart_id = #{departId}
53 </if>
54 <if test="supplierId != null supplierId !=''">
55 and supplier_id = #{supplierId}
56 </if>
57 <if test="purchaseContractId != null purchaseContractId !=''">
58 and purchase_contract_id = #{purchaseContractId}
59 </if>
60
61 </where>
62 group by sparepart_id , purchase_contract_id,depart_id,supplier_id
10 </select> 63 </select>
64
65
66
11 </mapper> 67 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -69,9 +69,9 @@ ...@@ -69,9 +69,9 @@
69 select pm.* 69 select pm.*
70 from erp_purchase_material pm , erp_purchase_contract pc 70 from erp_purchase_material pm , erp_purchase_contract pc
71 where pm.contract_id =pc.id 71 where pm.contract_id =pc.id
72 and pc.departs like concat('%', #{param.departId}, '%') 72 <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pc.departs like concat('%', #{param.departId}, '%')</if>
73 <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if> 73 <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if>
74 <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type = #{param.sparepartType}</if> 74 <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type in (${param.sparepartType}) </if>
75 <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like concat('%', #{param.sparepartName}, '%')</if> 75 <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like concat('%', #{param.sparepartName}, '%')</if>
76 )aaa 76 )aaa
77 left join erp_distribut_material dm on aaa.good_code = dm.good_code 77 left join erp_distribut_material dm on aaa.good_code = dm.good_code
......
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
3 <mapper namespace="com.skua.modules.erp.mapper.PurchasePlanMapper"> 3 <mapper namespace="com.skua.modules.erp.mapper.PurchasePlanMapper">
4 <!-- 统计查询--> 4 <!-- 统计查询-->
5 <select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchasePlanItem"> 5 <select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchasePlanItem">
6 select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text as 'sparepart_type_name' ,ss.sparepart_attribute,ss.sparepart_code, ss.specification,ss.measuring_unit, aaa.* from ( 6 select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text as 'sparepart_type_name' ,ss.sparepart_attribute,ss.sparepart_code, ss.specification,ss.measuring_unit, aaa.*,
7 select pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price' , group_concat(DISTINCT purpose ) purpose 7 (select sum(mi.purchase_num) from erp_material_in mi
8 where mi.sparepart_id = aaa.sparepart_id <if test="ev.applyYear != null and ev.applyYear != '' ">and year(mi.arrive_time) = #{ev.applyYear}</if> ) 'use_purchase_num'
9 from (
10 select pp.apply_year, pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price' , group_concat(DISTINCT purpose ) purpose
8 from erp_purchase_plan_item pi ,erp_purchase_plan pp 11 from erp_purchase_plan_item pi ,erp_purchase_plan pp
9 where 12 where
10 pp.id = pi.plan_id and pp.status = 3 13 pp.id = pi.plan_id and pp.status = 3
...@@ -41,7 +44,7 @@ ...@@ -41,7 +44,7 @@
41 </select> 44 </select>
42 45
43 <select id="statisticsPageBySparepartId" resultType="com.skua.modules.erp.vo.PurchasePlanStatisticsVO"> 46 <select id="statisticsPageBySparepartId" resultType="com.skua.modules.erp.vo.PurchasePlanStatisticsVO">
44 select pi.purpose, pi.purchase_num ,pi.measuring_unit, pi.sparepart_name, pi.specification,pi.sparepart_type, pi.unit_price , pi.total_price , pp.* 47 select pi.remark, pi.purpose, pi.purchase_num ,pi.measuring_unit, pi.sparepart_name, pi.specification,pi.sparepart_type, pi.unit_price , pi.total_price , pp.*
45 from erp_purchase_plan_item pi ,erp_purchase_plan pp 48 from erp_purchase_plan_item pi ,erp_purchase_plan pp
46 where pp.status = 3 and pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId} 49 where pp.status = 3 and pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
47 <if test="ev.sparepartType != null and ev.sparepartType != '' "> 50 <if test="ev.sparepartType != null and ev.sparepartType != '' ">
......
...@@ -16,26 +16,26 @@ import java.util.List; ...@@ -16,26 +16,26 @@ import java.util.List;
16 /** 16 /**
17 * 采购合同 17 * 采购合同
18 */ 18 */
19 public interface IEROPurchaseContractService extends IService<ERPPurchaseContract> { 19 public interface IERPPurchaseContractService extends IService<ERPPurchaseContract> {
20 /*** 20 /***
21 * 校验方法:校验是否唯一 21 * 校验方法:校验是否唯一
22 * @param purchaseContractVO 22 * @param purchaseContractVO
23 * @param checkCount 新增= 0 ,修改checkCount=1 23 * @param checkCount 新增= 0 ,修改checkCount=1
24 * @return 返回有问题的货号 24 * @return 返回有问题的货号
25 */ 25 */
26 public String checkGoodCode(PurchaseContractVO purchaseContractVO,int checkCount ); 26 String checkGoodCode(PurchaseContractVO purchaseContractVO,int checkCount );
27 /*** 27 /***
28 * 新增purchaseContractVO 28 * 新增purchaseContractVO
29 * @param purchaseContractVO 29 * @param purchaseContractVO
30 */ 30 */
31 public void savePurchaseContract(PurchaseContractVO purchaseContractVO); 31 void savePurchaseContract(PurchaseContractVO purchaseContractVO);
32 32
33 /** 33 /**
34 * 修改purchaseContractVO 34 * 修改purchaseContractVO
35 * @param purchaseContractVO 35 * @param purchaseContractVO
36 * @return 36 * @return
37 */ 37 */
38 public boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO); 38 boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO);
39 39
40 /*** 40 /***
41 * 删除purchaseContractVO 41 * 删除purchaseContractVO
...@@ -61,14 +61,14 @@ public interface IEROPurchaseContractService extends IService<ERPPurchaseContrac ...@@ -61,14 +61,14 @@ public interface IEROPurchaseContractService extends IService<ERPPurchaseContrac
61 * 审批 采购合同 61 * 审批 采购合同
62 * @param purchaseContractVO 62 * @param purchaseContractVO
63 */ 63 */
64 public void auditPurchaseContract(PurchaseContractVO purchaseContractVO); 64 void auditPurchaseContract(PurchaseContractVO purchaseContractVO);
65 65
66 /*** 66 /***
67 * 同步入库操作 67 * 同步入库操作
68 * @param purchaseContractVO 68 * @param purchaseContractVO
69 * @return 69 * @return
70 */ 70 */
71 public int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception; 71 int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception;
72 72
73 73
74 74
......
...@@ -2,10 +2,20 @@ package com.skua.modules.erp.service; ...@@ -2,10 +2,20 @@ package com.skua.modules.erp.service;
2 2
3 import com.skua.modules.erp.entity.MaterialAcceptanceForm; 3 import com.skua.modules.erp.entity.MaterialAcceptanceForm;
4 import com.baomidou.mybatisplus.extension.service.IService; 4 import com.baomidou.mybatisplus.extension.service.IService;
5 import com.skua.modules.erp.entity.MaterialIN;
6 import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
7
8 import java.util.List;
5 9
6 /** 10 /**
7 * 物料验收单 11 * 物料验收单
8 */ 12 */
9 public interface IMaterialAcceptanceFormService extends IService<MaterialAcceptanceForm> { 13 public interface IMaterialAcceptanceFormService extends IService<MaterialAcceptanceForm> {
10 14
15 /***
16 * 列表查询 验收单
17 * @param materialIN
18 * @return
19 */
20 List<MaterialAcceptanceForm> queryArrivalRecordByList(MaterialIN materialIN);
11 } 21 }
......
1 package com.skua.modules.erp.service; 1 package com.skua.modules.erp.service;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
3 import com.skua.modules.erp.entity.MaterialIN; 4 import com.skua.modules.erp.entity.MaterialIN;
4 import com.baomidou.mybatisplus.extension.service.IService; 5 import com.baomidou.mybatisplus.extension.service.IService;
6 import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
5 import com.skua.modules.erp.vo.MaterialINVO; 7 import com.skua.modules.erp.vo.MaterialINVO;
6 8
9 import java.util.List;
10
7 /** 11 /**
8 * 物料(药剂)入库 12 * 物料(药剂)入库
9 */ 13 */
...@@ -14,4 +18,21 @@ public interface IMaterialINService extends IService<MaterialIN> { ...@@ -14,4 +18,21 @@ public interface IMaterialINService extends IService<MaterialIN> {
14 * @param materialINVO 18 * @param materialINVO
15 */ 19 */
16 public void auditMaterialINVO(MaterialINVO materialINVO); 20 public void auditMaterialINVO(MaterialINVO materialINVO);
21
22 /***
23 * 列表查询到货记录列表
24 * @param materialIN
25 * @return
26 */
27 List<ArrivalRecordExcelExportVO> queryArrivalRecordByList(MaterialIN materialIN);
28
29 /***
30 * 获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索
31 * @param page
32 * @param materialIN
33 * @return
34 */
35 public IPage<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, MaterialIN materialIN) ;
36
37
17 } 38 }
......
...@@ -8,10 +8,11 @@ import com.skua.modules.erp.entity.*; ...@@ -8,10 +8,11 @@ import com.skua.modules.erp.entity.*;
8 import com.skua.modules.erp.mapper.ApproveRecordMapper; 8 import com.skua.modules.erp.mapper.ApproveRecordMapper;
9 import com.skua.modules.erp.mapper.ERPPurchaseContractMapper; 9 import com.skua.modules.erp.mapper.ERPPurchaseContractMapper;
10 import com.skua.modules.erp.mapper.PurchaseMaterialMapper; 10 import com.skua.modules.erp.mapper.PurchaseMaterialMapper;
11 import com.skua.modules.erp.service.IEROPurchaseContractService; 11 import com.skua.modules.erp.service.IERPPurchaseContractService;
12 import com.skua.modules.erp.vo.PurchaseContractVO; 12 import com.skua.modules.erp.vo.PurchaseContractVO;
13 import com.skua.modules.erp.vo.PurchaseMaterialVO;
14 import com.skua.modules.guest.util.DateUtil; 13 import com.skua.modules.guest.util.DateUtil;
14 import com.skua.modules.quartz.util.BaseUtil;
15 import org.apache.commons.lang3.StringUtils;
15 import org.springframework.beans.BeanUtils; 16 import org.springframework.beans.BeanUtils;
16 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
...@@ -27,7 +28,7 @@ import java.util.List; ...@@ -27,7 +28,7 @@ import java.util.List;
27 * 采购合同 28 * 采购合同
28 */ 29 */
29 @Service 30 @Service
30 public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContractMapper, ERPPurchaseContract> implements IEROPurchaseContractService { 31 public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContractMapper, ERPPurchaseContract> implements IERPPurchaseContractService {
31 32
32 @Resource 33 @Resource
33 private PurchaseMaterialMapper purchaseMaterialMapper;//物料清单 34 private PurchaseMaterialMapper purchaseMaterialMapper;//物料清单
...@@ -50,10 +51,14 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr ...@@ -50,10 +51,14 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
50 int count = 0; 51 int count = 0;
51 if( purchaseContractVO.getMaterialList()!= null && !purchaseContractVO.getMaterialList().isEmpty()){ 52 if( purchaseContractVO.getMaterialList()!= null && !purchaseContractVO.getMaterialList().isEmpty()){
52 for(PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){ 53 for(PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){
53 count = purchaseMaterialMapper.checkGoodCode(purchaseMaterial.getId(),purchaseMaterial.getGoodCode()); 54 if(StringUtils.isNotEmpty(purchaseMaterial.getGoodCode())){
54 if(count > checkCount ){ 55 count = purchaseMaterialMapper.checkGoodCode(purchaseMaterial.getId(),purchaseMaterial.getGoodCode());
55 result = purchaseMaterial.getGoodCode(); 56 if(count > checkCount ){
56 break; 57 result = purchaseMaterial.getGoodCode();
58 break;
59 }
60 }else{
61 result = "404";
57 } 62 }
58 } 63 }
59 } 64 }
...@@ -66,13 +71,19 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr ...@@ -66,13 +71,19 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
66 */ 71 */
67 public void savePurchaseContract(PurchaseContractVO purchaseContractVO){ 72 public void savePurchaseContract(PurchaseContractVO purchaseContractVO){
68 int count = this.baseMapper.insert( purchaseContractVO ); 73 int count = this.baseMapper.insert( purchaseContractVO );
74 //计算采购金额
75 String purchaseMoney = "0";
69 if(count > 0 && purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){ 76 if(count > 0 && purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
70 for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){ 77 for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
71 material.setId(null); 78 material.setId(null);
72 material.setContractId( purchaseContractVO.getId() ); 79 material.setContractId( purchaseContractVO.getId() );
73 purchaseMaterialMapper.insert( material ); 80 purchaseMaterialMapper.insert( material );
81 purchaseMoney = BaseUtil.add(purchaseMoney, material.getTotalPrice());
74 } 82 }
75 } 83 }
84
85 purchaseContractVO.setPurchaseMoney( purchaseMoney ) ;
86 this.baseMapper.updateById(purchaseContractVO ) ;
76 } 87 }
77 88
78 /** 89 /**
...@@ -81,20 +92,21 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr ...@@ -81,20 +92,21 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
81 * @return 92 * @return
82 */ 93 */
83 @Transactional 94 @Transactional
84
85 public boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO){ 95 public boolean updatePurchaseContract(PurchaseContractVO purchaseContractVO){
86 int count = this.baseMapper.updateById( purchaseContractVO );
87
88 // ge根据计划编号删除清单集合 96 // ge根据计划编号删除清单集合
89 purchaseMaterialMapper.delByContractId(purchaseContractVO.getId() ) ; 97 purchaseMaterialMapper.delByContractId(purchaseContractVO.getId() ) ;
90 98 //计算采购金额
91 if(count > 0 && purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){ 99 String purchaseMoney = "0";
100 if( purchaseContractVO.getMaterialList() != null && !purchaseContractVO.getMaterialList().isEmpty()){
92 for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){ 101 for(PurchaseMaterial material : purchaseContractVO.getMaterialList()){
93 material.setId(null); 102 material.setId(null);
94 material.setContractId( purchaseContractVO.getId() ); 103 material.setContractId( purchaseContractVO.getId() );
95 purchaseMaterialMapper.insert( material ); 104 purchaseMaterialMapper.insert( material );
105 purchaseMoney = BaseUtil.add(purchaseMoney, material.getTotalPrice());
96 } 106 }
97 } 107 }
108 purchaseContractVO.setPurchaseMoney( purchaseMoney );
109 int count = this.baseMapper.updateById( purchaseContractVO );
98 return count > 0 ? true :false; 110 return count > 0 ? true :false;
99 } 111 }
100 112
...@@ -212,6 +224,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr ...@@ -212,6 +224,7 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
212 throw new Exception("采购合同记录不存在"); 224 throw new Exception("采购合同记录不存在");
213 }*/ 225 }*/
214 purchaseContractVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库单号 226 purchaseContractVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库单号
227 log.debug("记录入库单号{"+equipmentInDTO.getId()+"},入库单号:"+equipmentInDTO.getInOrder());
215 this.baseMapper.updateById(purchaseContractVO ) ; 228 this.baseMapper.updateById(purchaseContractVO ) ;
216 return 1; 229 return 1;
217 } 230 }
......
1 package com.skua.modules.erp.service.impl; 1 package com.skua.modules.erp.service.impl;
2 2
3 import com.skua.modules.erp.entity.MaterialAcceptanceForm; 3 import com.skua.modules.erp.entity.MaterialAcceptanceForm;
4 import com.skua.modules.erp.entity.MaterialIN;
4 import com.skua.modules.erp.mapper.MaterialAcceptanceFormMapper; 5 import com.skua.modules.erp.mapper.MaterialAcceptanceFormMapper;
5 import com.skua.modules.erp.service.IMaterialAcceptanceFormService; 6 import com.skua.modules.erp.service.IMaterialAcceptanceFormService;
6 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
7 8
8 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9 10
11 import java.util.List;
12
10 /** 13 /**
11 * 物料验收单 14 * 物料验收单
12 */ 15 */
13 @Service 16 @Service
14 public class MaterialAcceptanceFormServiceImpl extends ServiceImpl<MaterialAcceptanceFormMapper, MaterialAcceptanceForm> implements IMaterialAcceptanceFormService { 17 public class MaterialAcceptanceFormServiceImpl extends ServiceImpl<MaterialAcceptanceFormMapper, MaterialAcceptanceForm> implements IMaterialAcceptanceFormService {
15 18
19 /***
20 * 列表查询 验收单
21 * @param materialIN
22 * @return
23 */
24 public List<MaterialAcceptanceForm> queryArrivalRecordByList(MaterialIN materialIN){
25 return this.baseMapper.queryArrivalRecordByList(materialIN);
26 }
16 } 27 }
......
1 package com.skua.modules.erp.service.impl; 1 package com.skua.modules.erp.service.impl;
2 2
3 import com.baomidou.mybatisplus.core.metadata.IPage;
3 import com.skua.core.context.BaseContextHandler; 4 import com.skua.core.context.BaseContextHandler;
4 import com.skua.modules.erp.entity.ApproveRecord; 5 import com.skua.modules.erp.entity.ApproveRecord;
5 import com.skua.modules.erp.entity.MaterialIN; 6 import com.skua.modules.erp.entity.MaterialIN;
6 import com.skua.modules.erp.mapper.ApproveRecordMapper; 7 import com.skua.modules.erp.mapper.ApproveRecordMapper;
7 import com.skua.modules.erp.mapper.MaterialINMapper; 8 import com.skua.modules.erp.mapper.MaterialINMapper;
8 import com.skua.modules.erp.service.IMaterialINService; 9 import com.skua.modules.erp.service.IMaterialINService;
10 import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO;
9 import com.skua.modules.erp.vo.MaterialINVO; 11 import com.skua.modules.erp.vo.MaterialINVO;
10 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
11 13
12 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 14 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13 15
14 import javax.annotation.Resource; 16 import javax.annotation.Resource;
17 import java.util.List;
15 18
16 /** 19 /**
17 * 物料(药剂)入库 20 * 物料(药剂)入库
...@@ -40,4 +43,31 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia ...@@ -40,4 +43,31 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
40 ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState()); 43 ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState());
41 recordMapper.insert( record ) ; 44 recordMapper.insert( record ) ;
42 } 45 }
46
47 /***
48 * 列表查询到货记录列表
49 * @param materialIN
50 * @return
51 */
52 public List<ArrivalRecordExcelExportVO> queryArrivalRecordByList(MaterialIN materialIN){
53 List<ArrivalRecordExcelExportVO> arrivalRecordExcelExportVOList = this.baseMapper.queryArrivalRecordByList(materialIN);
54 //遍历集合设置自增序号
55 if(arrivalRecordExcelExportVOList != null && !arrivalRecordExcelExportVOList.isEmpty()){
56 int index =1 ;
57 for( ArrivalRecordExcelExportVO excelExportVO :arrivalRecordExcelExportVOList){
58 excelExportVO.setIndex(index++);
59 }
60 }
61 return arrivalRecordExcelExportVOList;
62 }
63
64 /***
65 * 获取入库审批列表:根据部门、采购合同、供应商、药剂分组搜索
66 * @param page
67 * @param materialIN
68 * @return
69 */
70 public IPage<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, MaterialIN materialIN) {
71 return page.setRecords(baseMapper.selectAuditMaterialINByPage(page, materialIN));
72 }
43 } 73 }
......
1 package com.skua.modules.erp.util;
2 import com.itextpdf.html2pdf.ConverterProperties;
3 import com.itextpdf.html2pdf.HtmlConverter;
4 import com.itextpdf.kernel.font.PdfFont;
5 import com.itextpdf.kernel.font.PdfFontFactory;
6 import com.itextpdf.kernel.geom.PageSize;
7 import com.itextpdf.kernel.pdf.PdfDocument;
8 import com.itextpdf.kernel.pdf.PdfWriter;
9 import com.itextpdf.layout.font.FontProvider;
10 import org.apache.velocity.Template;
11 import org.apache.velocity.app.Velocity;
12 import org.apache.velocity.context.Context;
13 import org.apache.velocity.runtime.RuntimeConstants;
14 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
15
16 import java.io.OutputStream;
17 import java.io.StringWriter;
18 import java.nio.charset.StandardCharsets;
19
20 /**
21 * PDF工具
22 *
23 * @author ppp
24 * @date 2022/8/5
25 */
26 public class PdfUtil {
27
28 static {
29 // Velocity初始化
30 Velocity.setProperty(RuntimeConstants.OUTPUT_ENCODING, StandardCharsets.UTF_8);
31 Velocity.setProperty(RuntimeConstants.INPUT_ENCODING, StandardCharsets.UTF_8);
32 Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
33 Velocity.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
34 Velocity.init();
35 }
36
37
38 /**
39 * 据模板生成pfd格式文件
40 *
41 * @param context 上下文对象
42 * @param template pdf模板
43 * @param outputStream 生成ofd文件输出流
44 */
45 public static void pdfFile(Context context, String template, OutputStream outputStream) {
46 try (PdfWriter pdfWriter = new PdfWriter(outputStream)) {
47 PdfDocument pdfDocument = new PdfDocument(pdfWriter);
48 pdfDocument.setDefaultPageSize(PageSize.A4);
49
50 ConverterProperties properties = new ConverterProperties();
51 FontProvider fontProvider = new FontProvider();
52 // 字体设置,解决中文不显示问题
53 PdfFont sysFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H");
54 fontProvider.addFont(sysFont.getFontProgram(), "UniGB-UCS2-H");
55 properties.setFontProvider(fontProvider);
56
57 Template pfdTemplate = Velocity.getTemplate(template, "UTF-8");
58 StringWriter writer = new StringWriter();
59 pfdTemplate.merge(context, writer);
60 //System.out.println("***************writer.toString()***************************");
61 System.out.println(writer.toString());
62 HtmlConverter.convertToPdf(writer.toString(), pdfDocument, properties);
63 pdfDocument.close();
64 } catch (Exception e) {
65 throw new RuntimeException("PFD文件生成失败", e);
66 }
67 }
68
69 }
70
1 package com.skua.modules.erp.vo;
2
3 import com.skua.core.aspect.annotation.Dict;
4 import io.swagger.annotations.ApiModel;
5 import io.swagger.annotations.ApiModelProperty;
6 import lombok.Data;
7 import lombok.EqualsAndHashCode;
8 import lombok.experimental.Accessors;
9 import org.jeecgframework.poi.excel.annotation.Excel;
10
11 @Data
12 @EqualsAndHashCode(callSuper = false)
13 @Accessors(chain = true)
14 @ApiModel(value="ArrivalRecordVO到货验收记录", description="到货验收记录")
15 public class ArrivalRecordExcelExportVO {
16
17 /**序号*/
18 @Excel(name = "序号", width = 15 ,orderNum = "1")
19 @ApiModelProperty(value = "序号")
20 private Integer index;
21
22 /**到货时间*/
23 @Excel(name = "到货时间", width = 15,orderNum = "2")
24 @ApiModelProperty(value = "到货时间")
25 private String arriveTime;
26
27
28 /**所属机构*/
29 @Excel(name = "使用单位", width = 15 ,orderNum = "3")
30 @ApiModelProperty(value = "使用单位")
31 private String departName;
32
33
34 /**药剂(物料)名称*/
35 @Excel(name = "药剂(物料)名称", width = 15 ,orderNum = "4")
36 @ApiModelProperty(value = "药剂(物料)名称")
37 private String sparepartName;
38
39 /**计量单位*/
40 @Excel(name = "计量单位", width = 15,orderNum = "5")
41 @ApiModelProperty(value = "计量单位")
42 private String measuringUnit;
43 /**数量*/
44 @Excel(name = "数量", width = 15,orderNum = "6")
45 @ApiModelProperty(value = "数量")
46 private String purchaseNum;
47
48
49 /**供应商编号*/
50 @Excel(name = "供应商编号", width = 15,orderNum = "7")
51 @ApiModelProperty(value = "供应商编号")
52 private String supplierName;
53
54 /**货号*/
55 @Excel(name = "货号", width = 15,orderNum = "8")
56 @ApiModelProperty(value = "货号")
57 private String goodCode;
58
59 /**分销合同*/
60 @Excel(name = "分销合同号", width = 15 ,orderNum = "9")
61 @ApiModelProperty(value = "分销合同号")
62 private String distributContractCode;
63
64 /**采购合同*/
65 @Excel(name = "采购合同", width = 15,orderNum = "10")
66 @ApiModelProperty(value = "采购合同")
67 private String purchaseContractCode;
68 /**采购总价*/
69 @Excel(name = "采购总价", width = 15 ,orderNum = "11")
70 @ApiModelProperty(value = "采购总价")
71 private String purchaseTotalPrice;
72 /**分销总价*/
73 @Excel(name = "分销总价", width = 15,orderNum = "12")
74 @ApiModelProperty(value = "分销总价")
75 private String distributTotalPrice;
76 }
1 package com.skua.modules.erp.vo;
2
3 import io.swagger.annotations.ApiModel;
4 import io.swagger.annotations.ApiModelProperty;
5 import lombok.Data;
6 import lombok.EqualsAndHashCode;
7 import lombok.experimental.Accessors;
8 import org.jeecgframework.poi.excel.annotation.Excel;
9
10 @Data
11 @EqualsAndHashCode(callSuper = false)
12 @Accessors(chain = true)
13 @ApiModel(value="ArrivalRecordVO到货验收记录", description="到货验收记录")
14 public class ArrivalRecordPDFVO {
15
16 /**到货时间*/
17 @Excel(name = "到货时间", width = 15,orderNum = "2")
18 @ApiModelProperty(value = "到货时间")
19 private String arriveTime;
20
21
22 /**所属机构*/
23 @Excel(name = "使用单位", width = 15 ,orderNum = "3")
24 @ApiModelProperty(value = "使用单位")
25 private String departName;
26
27
28 /**药剂(物料)名称*/
29 @Excel(name = "药剂(物料)名称", width = 15 ,orderNum = "4")
30 @ApiModelProperty(value = "药剂(物料)名称")
31 private String sparepartName;
32
33 /**计量单位*/
34 @Excel(name = "计量单位", width = 15,orderNum = "5")
35 @ApiModelProperty(value = "计量单位")
36 private String measuringUnit;
37 /**数量*/
38 @Excel(name = "数量", width = 15,orderNum = "6")
39 @ApiModelProperty(value = "数量")
40 private String purchaseNum;
41
42
43 /**供应商编号*/
44 @Excel(name = "供应商编号", width = 15,orderNum = "7")
45 @ApiModelProperty(value = "供应商编号")
46 private String supplierName;
47
48 /**货号*/
49 @Excel(name = "货号", width = 15,orderNum = "8")
50 @ApiModelProperty(value = "货号")
51 private String goodCode;
52
53 /**分销合同*/
54 @Excel(name = "分销合同号", width = 15 ,orderNum = "9")
55 @ApiModelProperty(value = "分销合同号")
56 private String distributContractCode;
57
58 /**采购合同*/
59 @Excel(name = "采购合同", width = 15,orderNum = "10")
60 @ApiModelProperty(value = "采购合同")
61 private String purchaseContractCode;
62 /**采购总价*/
63 @Excel(name = "采购总价", width = 15 ,orderNum = "11")
64 @ApiModelProperty(value = "采购总价")
65 private String purchaseTotalPrice;
66 /**分销总价*/
67 @Excel(name = "分销总价", width = 15,orderNum = "12")
68 @ApiModelProperty(value = "分销总价")
69 private String distributTotalPrice;
70 }
...@@ -23,4 +23,7 @@ public class MaterialSearchVO { ...@@ -23,4 +23,7 @@ public class MaterialSearchVO {
23 23
24 @ApiModelProperty(value = "所属厂站") 24 @ApiModelProperty(value = "所属厂站")
25 private String departId; 25 private String departId;
26
27 @ApiModelProperty(value = "是否药剂")
28 private boolean medicament = false;
26 } 29 }
......
1 package com.skua.modules.quartz.util; 1 package com.skua.modules.quartz.util;
2 2
3 import org.apache.commons.lang3.StringUtils;
4
3 import java.math.BigDecimal; 5 import java.math.BigDecimal;
4 import java.text.DecimalFormat; 6 import java.text.DecimalFormat;
5 import java.text.ParseException; 7 import java.text.ParseException;
...@@ -212,6 +214,14 @@ public class BaseUtil { ...@@ -212,6 +214,14 @@ public class BaseUtil {
212 date = calendar.getTime(); 214 date = calendar.getTime();
213 return date; 215 return date;
214 } 216 }
217
218 // 加法
219 public static String add(String a, String b) {
220 if(StringUtils.isNotEmpty(a) && StringUtils.isNotEmpty(b)){
221 return String.valueOf(Double.parseDouble(a) + Double.parseDouble(b));
222 }
223 return "0";
224 }
215 /** 225 /**
216 * 进行加法运算 226 * 进行加法运算
217 * 227 *
......
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8"/>
5 </head>
6 <body>
7 <div class="contianer">
8 <div class="bg-img-container">
9 </div>
10 <h1>模板pdf</h1>
11 <div class="flex-div">
12 <p>表1</p>
13 </div>
14
15 <table border="1" cellSpacing="1">
16 <tr>
17 <th>姓名</th>
18 <td colspan="3">$!{name}</td>
19 </tr>
20 <tr>
21 <th #if($!{gender}==1) class="blue" #else class="red" #end>性别</th>
22 <td colspan="3">
23 #if($!{gender}==1)
24
25 #else
26
27 #end
28
29 <input type="checkbox" checked="checked">是否
30 </td>
31 </tr>
32 <tr>
33 <th>出生日期</th>
34 <td>$!{birthDate}</td>
35 <th>联系方式</th>
36 <td>$!{phone}</td>
37 </tr>
38 </table>
39 <h1>双重For循环取值</h1>
40 <div class="flex-div">
41 <p>表2</p>
42 </div>
43 <table border="1" cellSpacing="1">
44 <tr>
45 <th>学历</th>
46 <th>学科</th>
47 <td class="gray-bg">分数</td>
48 </tr>
49 #foreach($item in $eduList)
50 <tr>
51 <th #set($len= $item.size+1) rowspan="$len">$item.name</th>
52 #foreach($result in $item.itemList)
53 <tr>
54 <td>$velocityCount、$result.subject</td>
55 <td #if($result.num > 60) class="green" #else class="red" #end>$result.num</td>
56 </tr>
57 #end
58 </tr>
59 #end
60 </table>
61
62 </div>
63
64 </body>
65 <style>
66 .blue {
67 color: #244385;
68 margin-left: 30px;
69 }
70
71 .green {
72 color: #52c41a;
73 margin-left: 30px;
74 }
75
76 .red {
77 color: #c1181e;
78 margin-left: 30px;
79 }
80
81 .flex-div {
82 margin: 30px 0 15px;
83 display: flex;
84 align-items: center;
85 }
86
87 .line {
88 width: 540px;
89 height: 0px;
90 border: dashed 1px #edf0f5;
91 }
92
93 table {
94 width: 700px;
95 border-collapse: collapse;
96 /*border-spacing: 0;*/
97 border-left: 1px solid #edf0f5;
98 border-top: 1px solid #edf0f5;
99 }
100
101 th, td {
102 border-right: 1px solid #edf0f5;
103 border-bottom: 1px solid #edf0f5;
104 padding: 5px 15px;
105 }
106
107 h1 {
108 text-align: center;
109 font-family: 'Microsoft YaHei';
110 line-height: 60px;
111 letter-spacing: 8px;
112 color: #244385;
113 }
114
115 p {
116 font-family: 'Microsoft YaHei';
117 font-size: 20px;
118 font-weight: normal;
119 color: #244385;
120 margin: 0 16px;
121 }
122
123 th {
124 background-color: rgba(0, 0, 0, 0.01);
125 width: 90px;
126 min-width: 90px;
127 max-width: 90px;
128 text-align: left;
129 text-indent: 10px;
130 font-family: 'Microsoft YaHei';
131 font-size: 16px;
132 font-weight: normal;
133 font-stretch: normal;
134 line-height: 48px;
135 letter-spacing: 2px;
136 color: #666666;
137 }
138
139 td {
140 font-size: 16px;
141 color: #000000;
142 text-align: left;
143 text-indent: 10px;
144 padding-right: 20px;
145 height: 50px;
146 }
147
148 table,tr, th, td {
149 border: solid 1px #edf0f5;
150 }
151
152 .gray-bg {
153 background-color: rgba(0, 0, 0, 0.01);
154 }
155 </style>
156 </html>
157
158
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>送货单及物料验收单</title>
6 </head>
7 <body>
8 送货单及物料验收单(模版页面)
9 context.put("startTime", materialIN.getStartTime());//开始时间
10 context.put("endTime", materialIN.getEndTime());//结束时间
11 context.put("supplierName", "");//供应商名称
12 context.put("purchaseContractCode", "");//采购合同
13 context.put("sparepartName", "");//药剂名称
14 context.put("specification", "");//规格
15
16 context.put("sparepartName", "");//部门名称
17
18 dataList 列表数据
19 </body>
20 </html>
...\ No newline at end of file ...\ No newline at end of file
...@@ -22,5 +22,5 @@ public interface IEquipmentInService extends IService<EquipmentIn> { ...@@ -22,5 +22,5 @@ public interface IEquipmentInService extends IService<EquipmentIn> {
22 * 入库新增 22 * 入库新增
23 * @param equipmentInDTO 23 * @param equipmentInDTO
24 */ 24 */
25 public int saveEquipmentIn(EquipmentInDTO equipmentInDTO) throws Exception; 25 int saveEquipmentIn(EquipmentInDTO equipmentInDTO) throws Exception;
26 } 26 }
......
...@@ -60,98 +60,18 @@ public class EquipmentSparepartTypeController { ...@@ -60,98 +60,18 @@ public class EquipmentSparepartTypeController {
60 * 分页列表查询 60 * 分页列表查询
61 * 61 *
62 * @param equipmentSparepartType 62 * @param equipmentSparepartType
63 * @param pageNo
64 * @param pageSize
65 * @return 63 * @return
66 */ 64 */
67 @AutoLog(value = "设备物资类型-分页列表查询") 65 @AutoLog(value = "设备物资类型-树形集合")
68 @ApiOperation(value = "设备物资类型-分页列表查询", notes = "设备物资类型-分页列表查询") 66 @ApiOperation(value = "设备物资类型-树形集合", notes = "设备物资类型-树形集合")
69 @GetMapping(value = "/list") 67 @GetMapping(value = "/list")
70 public Result<List<EquipmentSparepartTypeVO>> queryPageList(EquipmentSparepartType equipmentSparepartType, 68 public Result<List<EquipmentSparepartTypeVO>> queryPageList(EquipmentSparepartType equipmentSparepartType) {
71 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
72 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
73 Result<List<EquipmentSparepartTypeVO>> result = new Result<>(); 69 Result<List<EquipmentSparepartTypeVO>> result = new Result<>();
74 QueryWrapper<EquipmentSparepartType> queryWrapper = new QueryWrapper<>(); 70 List<EquipmentSparepartTypeVO> voList = equipmentSparepartTypeService.querySparepartTypeListByTree(equipmentSparepartType);
75 queryWrapper.orderByAsc("sort");
76 String itemText = equipmentSparepartType.getItemText();
77 if (StringUtils.isNotBlank(itemText)) {
78 queryWrapper.like("item_text",itemText);
79 }
80 List<EquipmentSparepartType> equipmentSparepartTypeList = equipmentSparepartTypeService.list(queryWrapper);
81
82 if (equipmentSparepartType.isMedicament()) {//查询药剂类别
83 queryWrapper.eq("medicament",equipmentSparepartType.isMedicament());
84 //药剂的物料分类
85 List<EquipmentSparepartType> medicamentList = equipmentSparepartTypeService.list(queryWrapper);
86 equipmentSparepartTypeList = this.equipmentSparepartTypeListByMedicament(equipmentSparepartTypeList , medicamentList );
87 }
88 List<EquipmentSparepartTypeVO> voList = new ArrayList<>();
89 getTree(voList, equipmentSparepartTypeList, null);
90 result.setSuccess(true); 71 result.setSuccess(true);
91 result.setResult(voList); 72 result.setResult(voList);
92 return result; 73 return result;
93 } 74 }
94
95 /***
96 * 递归转换为tree结构
97 * @param voList
98 * @param entityList
99 * @param tmp
100 */
101 private void getTree(List<EquipmentSparepartTypeVO> voList, List<EquipmentSparepartType> entityList, EquipmentSparepartTypeVO tmp) {
102 for (EquipmentSparepartType item : entityList) {
103 String parentId = item.getParentId();
104 EquipmentSparepartTypeVO vo = new EquipmentSparepartTypeVO(item);
105 if (tmp == null && org.apache.commons.lang.StringUtils.isEmpty(parentId)) {
106 voList.add(vo);
107 if (!vo.isLeaf()) {
108 getTree(voList, entityList, vo);
109 }
110 } else if (tmp != null && parentId != null && parentId.equals(tmp.getId())) {
111 tmp.getChildren().add(vo);
112 if (!vo.isLeaf()) {
113 getTree(voList, entityList, vo);
114 }
115 }
116 }
117 }
118
119 /***
120 * 拼装 药剂的物料分类
121 * @param allTypeList
122 * @param medicamentList
123 * @return
124 */
125 private List<EquipmentSparepartType> equipmentSparepartTypeListByMedicament(List<EquipmentSparepartType> allTypeList ,List<EquipmentSparepartType> medicamentList ){
126 Set<EquipmentSparepartType> resultSet = new HashSet<>();
127 // List<EquipmentSparepartType> dataList = new ArrayList<>();
128 StringBuffer ancestors = new StringBuffer();
129 for( EquipmentSparepartType equipmentSparepartType : medicamentList){
130 ancestors.append(equipmentSparepartType.getAncestors()).append(",");
131 resultSet.add(equipmentSparepartType );
132 for( EquipmentSparepartType equipmentSparepartType2 : allTypeList){
133 // 添加下游数据
134 if(equipmentSparepartType2.getAncestors().contains( equipmentSparepartType.getAncestors() )){
135 resultSet.add(equipmentSparepartType2 );
136 }
137 }
138 // 将原始字符串按逗号分隔并放入LinkedHashSet中去重
139 Set<String> uniqueFruits = new LinkedHashSet<>(Arrays.asList(ancestors.toString().split(",")));
140 //添加上游数据
141 for(String id : uniqueFruits){
142 for( EquipmentSparepartType equipmentSparepartType3 : allTypeList){
143 if(id.equals( equipmentSparepartType3.getId() )){
144 resultSet.add(equipmentSparepartType3 ) ;
145 }
146 }
147 }
148 }
149 return new ArrayList<>(resultSet);
150 }
151
152
153
154
155 /** 75 /**
156 * 添加 76 * 添加
157 * 77 *
......
...@@ -2,7 +2,9 @@ package com.skua.modules.supplies.service; ...@@ -2,7 +2,9 @@ package com.skua.modules.supplies.service;
2 2
3 import com.baomidou.mybatisplus.extension.service.IService; 3 import com.baomidou.mybatisplus.extension.service.IService;
4 import com.skua.modules.supplies.entity.EquipmentSparepartType; 4 import com.skua.modules.supplies.entity.EquipmentSparepartType;
5 import com.skua.modules.supplies.vo.EquipmentSparepartTypeVO;
5 6
7 import java.util.List;
6 import java.util.Set; 8 import java.util.Set;
7 9
8 /** 10 /**
...@@ -33,4 +35,18 @@ public interface IEquipmentSparepartTypeService extends IService<EquipmentSparep ...@@ -33,4 +35,18 @@ public interface IEquipmentSparepartTypeService extends IService<EquipmentSparep
33 * @param newAncestors 35 * @param newAncestors
34 */ 36 */
35 void updateAncestors(String oldAncestors, String newAncestors); 37 void updateAncestors(String oldAncestors, String newAncestors);
38
39 /***
40 * 查询物料类别集合
41 * @param equipmentSparepartType
42 * @return
43 */
44 List<EquipmentSparepartType> querySparepartTypeList(EquipmentSparepartType equipmentSparepartType);
45
46 /***
47 * 查询物料类别集合
48 * @param equipmentSparepartType
49 * @return
50 */
51 List<EquipmentSparepartTypeVO> querySparepartTypeListByTree(EquipmentSparepartType equipmentSparepartType);
36 } 52 }
......
...@@ -3,7 +3,9 @@ package com.skua.modules.supplies.service.impl; ...@@ -3,7 +3,9 @@ package com.skua.modules.supplies.service.impl;
3 import java.util.*; 3 import java.util.*;
4 4
5 import com.skua.core.util.ConvertUtils; 5 import com.skua.core.util.ConvertUtils;
6 import com.skua.modules.supplies.vo.EquipmentSparepartTypeVO;
6 import com.skua.tool.dfs.MapDFS; 7 import com.skua.tool.dfs.MapDFS;
8 import org.apache.commons.lang3.StringUtils;
7 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
9 import org.springframework.transaction.annotation.Transactional; 11 import org.springframework.transaction.annotation.Transactional;
...@@ -72,4 +74,95 @@ public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSpar ...@@ -72,4 +74,95 @@ public class EquipmentSparepartTypeServiceImpl extends ServiceImpl<EquipmentSpar
72 this.baseMapper.updateAncestors(oldAncestors, newAncestors); 74 this.baseMapper.updateAncestors(oldAncestors, newAncestors);
73 } 75 }
74 76
77
78 /***
79 * 查询物料类别集合-返回树结构
80 * @param equipmentSparepartType
81 * @return
82 */
83 public List<EquipmentSparepartTypeVO> querySparepartTypeListByTree(EquipmentSparepartType equipmentSparepartType){
84 List<EquipmentSparepartType> equipmentSparepartTypeList = this.querySparepartTypeList(equipmentSparepartType);
85 List<EquipmentSparepartTypeVO> voList = new ArrayList<>();
86 getTree(voList, equipmentSparepartTypeList, null);
87
88 return voList;
89 }
90 /***
91 * 查询物料类别集合-返回列表
92 * @param equipmentSparepartType
93 * @return
94 */
95 public List<EquipmentSparepartType> querySparepartTypeList(EquipmentSparepartType equipmentSparepartType){
96 QueryWrapper<EquipmentSparepartType> queryWrapper = new QueryWrapper<>();
97 queryWrapper.orderByAsc("sort");
98 String itemText = equipmentSparepartType.getItemText();
99 if (StringUtils.isNotBlank(itemText)) {
100 queryWrapper.like("item_text",itemText);
101 }
102 List<EquipmentSparepartType> equipmentSparepartTypeList = this.list(queryWrapper);
103 if (equipmentSparepartType.isMedicament()) {//查询药剂类别
104 queryWrapper.eq("medicament",equipmentSparepartType.isMedicament());
105 //药剂的物料分类
106 List<EquipmentSparepartType> medicamentList = this.list(queryWrapper);
107 equipmentSparepartTypeList = this.equipmentSparepartTypeListByMedicament(equipmentSparepartTypeList , medicamentList );
108 }
109 return equipmentSparepartTypeList;
110 }
111 /***
112 * 递归转换为tree结构
113 * @param voList
114 * @param entityList
115 * @param tmp
116 */
117 private void getTree(List<EquipmentSparepartTypeVO> voList, List<EquipmentSparepartType> entityList, EquipmentSparepartTypeVO tmp) {
118 for (EquipmentSparepartType item : entityList) {
119 String parentId = item.getParentId();
120 EquipmentSparepartTypeVO vo = new EquipmentSparepartTypeVO(item);
121 if (tmp == null && org.apache.commons.lang.StringUtils.isEmpty(parentId)) {
122 voList.add(vo);
123 if (!vo.isLeaf()) {
124 getTree(voList, entityList, vo);
125 }
126 } else if (tmp != null && parentId != null && parentId.equals(tmp.getId())) {
127 tmp.getChildren().add(vo);
128 if (!vo.isLeaf()) {
129 getTree(voList, entityList, vo);
130 }
131 }
132 }
133 }
134
135 /***
136 * 拼装 药剂的物料分类
137 * @param allTypeList
138 * @param medicamentList
139 * @return
140 */
141 private List<EquipmentSparepartType> equipmentSparepartTypeListByMedicament(List<EquipmentSparepartType> allTypeList ,List<EquipmentSparepartType> medicamentList ){
142 Set<EquipmentSparepartType> resultSet = new HashSet<>();
143 // List<EquipmentSparepartType> dataList = new ArrayList<>();
144 StringBuffer ancestors = new StringBuffer();
145 for( EquipmentSparepartType equipmentSparepartType : medicamentList){
146 ancestors.append(equipmentSparepartType.getAncestors()).append(",");
147 resultSet.add(equipmentSparepartType );
148 for( EquipmentSparepartType equipmentSparepartType2 : allTypeList){
149 // 添加下游数据
150 if(equipmentSparepartType2.getAncestors().contains( equipmentSparepartType.getAncestors() )){
151 resultSet.add(equipmentSparepartType2 );
152 }
153 }
154 // 将原始字符串按逗号分隔并放入LinkedHashSet中去重
155 Set<String> uniqueFruits = new LinkedHashSet<>(Arrays.asList(ancestors.toString().split(",")));
156 //添加上游数据
157 for(String id : uniqueFruits){
158 for( EquipmentSparepartType equipmentSparepartType3 : allTypeList){
159 if(id.equals( equipmentSparepartType3.getId() )){
160 resultSet.add(equipmentSparepartType3 ) ;
161 }
162 }
163 }
164 }
165 return new ArrayList<>(resultSet);
166 }
167
75 } 168 }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!