Ver código fonte

erp导出资本项目,erp导出成本项目,根据查询项目名称查询

yue 5 anos atrás
pai
commit
308342e4ef

+ 5 - 5
src/main/java/com/jeeplus/modules/sg/picking/activiti/entity/Acquisition.java

@@ -23,7 +23,7 @@ public class Acquisition extends ActEntity<Acquisition> {
     //审核通过时间
     private Date managerTime;
     //项目类型
-    private String itemType;
+    private String proType;
 
     public String getProjectId() {
         return projectId;
@@ -93,11 +93,11 @@ public class Acquisition extends ActEntity<Acquisition> {
         this.managerTime = managerTime;
     }
 
-    public String getItemType() {
-        return itemType;
+    public String getProType() {
+        return proType;
     }
 
-    public void setItemType(String itemType) {
-        this.itemType = itemType;
+    public void setProType(String proType) {
+        this.proType = proType;
     }
 }

+ 1 - 1
src/main/java/com/jeeplus/modules/sg/picking/activiti/mapper/PickIngMapper.java

@@ -44,7 +44,7 @@ public interface PickIngMapper extends BaseMapper<PickIng> {
      * */
     List<Acquisition> findErpType(List<String> list);
 
-    List<CapitalExport> exportList(List<Acquisition> list);
+    List<CapitalExport> exportList(@Param("list") List<Acquisition> list,@Param("projectId") String projectId);
 
     void updateErpAfter(List<Acquisition> list);
 }

+ 4 - 2
src/main/java/com/jeeplus/modules/sg/picking/activiti/mapper/xml/PickIngMapper.xml

@@ -163,7 +163,7 @@
 	</insert>
 
 	<select id="findErpType" resultType="com.jeeplus.modules.sg.picking.activiti.entity.Acquisition">
-		select a.id,a.proc_ins_id,b.item_type
+		select a.id,a.proc_ins_id,b.pro_type
 		from md_acquisition_process as a
 		LEFT JOIN xm_project_details as b
 		on a.project_id = b.id where a.id
@@ -195,7 +195,9 @@
 				#{item.id}
 			</foreach>
 		)
-
+		<if test="projectId != null and projectId != ''">
+			AND c.require_name LIKE concat('%',#{projectId},'%')
+		</if>
 	</select>
 	
 	<update id="updateErpAfter">

+ 4 - 0
src/main/java/com/jeeplus/modules/sg/picking/activiti/mapper/xml/ShowListMapper.xml

@@ -244,6 +244,7 @@
 		a.id,
 		a.proc_ins_id,
 		b.require_name as projectId,
+		b.pro_type as proType,
 		a.version,
 		a.the_number,
 		a.select_number,
@@ -255,6 +256,9 @@
 		left join xm_project_details as b
 		on a.project_id = b.id
 		where exportStatus = '1'
+		<if test="projectId != null and projectId != ''">
+			AND b.require_name LIKE concat('%',#{projectId},'%')
+		</if>
 		order by managerTime desc,exportAfter desc
 	</select>
 

+ 4 - 4
src/main/java/com/jeeplus/modules/sg/picking/activiti/service/PickIngService.java

@@ -169,8 +169,8 @@ public class PickIngService extends CrudService<PickIngMapper, PickIng> {
 	 * 成本项目导出
 	 * */
 	@Transactional(readOnly = false)
-	public List<CapitalExport> cbList(List<Acquisition> list) {
-		List<CapitalExport> capitalExports = pickIngMapper.exportList(list);
+	public List<CapitalExport> cbList(List<Acquisition> list, String projectId) {
+		List<CapitalExport> capitalExports = pickIngMapper.exportList(list,  projectId);
 		int i = 0;
 		for (CapitalExport c : capitalExports) {
 			//项目定义号
@@ -199,8 +199,8 @@ public class PickIngService extends CrudService<PickIngMapper, PickIng> {
 	 * 资本项目导出
 	 * */
 	@Transactional(readOnly = false)
-	public List<CapitalExport> zbList(List<Acquisition> list) {
-		List<CapitalExport> capitalExports = pickIngMapper.exportList(list);
+	public List<CapitalExport> zbList(List<Acquisition> list, String projectId) {
+		List<CapitalExport> capitalExports = pickIngMapper.exportList(list,projectId);
 		int i = 0;
 		for (CapitalExport c : capitalExports) {
 			//项目定义号

+ 59 - 21
src/main/java/com/jeeplus/modules/sg/picking/activiti/web/PickIngController.java

@@ -12,6 +12,7 @@ import com.jeeplus.modules.act.service.ActProcessService;
 import com.jeeplus.modules.act.service.ActTaskService;
 import com.jeeplus.modules.sg.audit.information.entity.Information;
 import com.jeeplus.modules.sg.audit.information.entity.OutInformation;
+import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil;
 import com.jeeplus.modules.sg.managementcenter.activiti.entity.FindTask;
 import com.jeeplus.modules.sg.managementcenter.activiti.service.ConstructionService;
 import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
@@ -37,7 +38,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
+import java.net.URLDecoder;
 import java.util.*;
 
 @Controller
@@ -495,10 +498,18 @@ public class PickIngController extends BaseController {
         return j;
     }
 
+    /**
+     * 成本
+     * */
     @ResponseBody
     @RequestMapping(value = "exportErpData")
-    public AjaxJson exportErpData(String id, HttpServletRequest request, HttpServletResponse response) {
+    public AjaxJson exportErpData(String id,String projectId, HttpServletRequest request, HttpServletResponse response) {
         AjaxJson j = new AjaxJson();
+        try {
+            projectId = URLDecoder.decode(projectId,"UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
         List<String> beforeId = new ArrayList<>();
         if (id != null && !"".equals(id)) {
             String[] split = id.split(",");
@@ -508,50 +519,77 @@ public class PickIngController extends BaseController {
         } else {
             beforeId = showListService.selectAllId();
         }
-
-
-
         //获取选择的id查询出属于什么项目
         List<Acquisition> erpType = pickIngService.findErpType(beforeId);
-        //资本项目列表
-        List<Acquisition> zbList = new ArrayList<>();
         //成本项目列表
         List<Acquisition> cbList = new ArrayList<>();
         //循环数据,根据类型分组
         for (Acquisition acquisition:erpType) {
-            String itemType = acquisition.getItemType();
-            if ("资本项目".equals(itemType)) {
-                zbList.add(acquisition);
-            }
-            if ("成本项目".equals(itemType)) {
+            String itemType = acquisition.getProType();
+            if ("配网成本".equals(itemType)) {
                 cbList.add(acquisition);
             }
         }
-        //根据不同类型导出不同的文件
-        if (zbList.size()>0) {
+        if (cbList.size()>0) {
             try {
-                String fileName = "导出本ERP" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
-                List<CapitalExport> capitalExports = pickIngService.zbList(zbList);
-                new ExportExcel("导出本ERP", CapitalExport.class).setDataList(capitalExports).write(response, fileName).dispose();
+                String fileName = "导出本ERP" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
+                List<CapitalExport> capitalExports = pickIngService.cbList(cbList,projectId);
+                new ExportExcel("导出本ERP", CapitalExport.class).setDataList(capitalExports).write(response, fileName).dispose();
                 j.setSuccess(true);
                 j.setMsg("导出成功!");
             } catch (IOException e) {
                 e.printStackTrace();
             }
+        }
+        //需改导出状态及导出时间
+        return j;
+    }
 
+    /**
+     * 资本
+     * */
+    @ResponseBody
+    @RequestMapping(value = "exportZb")
+    public AjaxJson exportZb(String id,String projectId, HttpServletRequest request, HttpServletResponse response) {
+        AjaxJson j = new AjaxJson();
+        try {
+            projectId = URLDecoder.decode(projectId,"UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
         }
-        if (cbList.size()>0) {
+        boolean flag = false;
+        List<String> beforeId = new ArrayList<>();
+        if (id != null && !"".equals(id)) {
+            String[] split = id.split(",");
+            for (String a : split) {
+                beforeId.add(a);
+            }
+        } else {
+            beforeId = showListService.selectAllId();
+        }
+        //获取选择的id查询出属于什么项目
+        List<Acquisition> erpType = pickIngService.findErpType(beforeId);
+        //资本项目列表
+        List<Acquisition> zbList = new ArrayList<>();
+        //循环数据,根据类型分组
+        for (Acquisition acquisition:erpType) {
+            String itemType = acquisition.getProType();
+            if ("配网资本".equals(itemType)) {
+                zbList.add(acquisition);
+            }
+        }
+        //根据不同类型导出不同的文件
+        if (zbList.size()>0) {
             try {
-                String fileName = "导出成本ERP" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
-                List<CapitalExport> capitalExports = pickIngService.cbList(zbList);
-                new ExportExcel("导出成本ERP", CapitalExport.class).setDataList(capitalExports).write(response, fileName).dispose();
+                String fileName = "导出本ERP" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
+                List<CapitalExport> capitalExports = pickIngService.zbList(zbList,projectId);
+                new ExportExcel("导出本ERP", CapitalExport.class).setDataList(capitalExports).write(response, fileName).dispose();
                 j.setSuccess(true);
                 j.setMsg("导出成功!");
             } catch (IOException e) {
                 e.printStackTrace();
             }
         }
-
         //需改导出状态及导出时间
         return j;
     }

+ 24 - 2
src/main/webapp/webpage/modules/sg/picking/activiti/exportErp.js

@@ -67,8 +67,11 @@ $(document).ready(function() {
 				},
 				{
 					field: 'projectId',
-					title: '物料名称',
+					title: '项目名称',
 				}, {
+					field: 'proType',
+					title: '项目类型',
+				},{
 					field: 'version',
 					title: '模块版本',
 				}, {
@@ -130,11 +133,30 @@ $(document).ready(function() {
 		$('#informationTable').bootstrapTable('refresh');
 	}
 
+	/**
+	 * 成本
+	 * */
 	function exportErp(id){
 		if(id == undefined){
 			id = getIdSelections();
 		}
-		jp.downloadFile('${ctx}/picking/activiti/exportErpData?id=' + id);
+		var val = encodeURI(encodeURI($("#projectId").val()));
+		/*成本*/
+		jp.downloadFile('${ctx}/picking/activiti/exportErpData?id=' + id + '&projectId=' + val);
 		refresh();
 	}
+
+	/**
+	 * 资本
+	 * */
+	function exportErp2(id){
+		if(id == undefined){
+			id = getIdSelections();
+		}
+		var val = encodeURI(encodeURI($("#projectId").val()));
+		/*资本*/
+		jp.downloadFile('${ctx}/picking/activiti/exportZb?id=' + id + '&projectId=' + val);
+		refresh();
+	}
+
 </script>

+ 11 - 2
src/main/webapp/webpage/modules/sg/picking/activiti/exportErp.jsp

@@ -18,14 +18,23 @@
 				<div class="accordion-inner">
 					<form:form id="searchForm" modelAttribute="acquisition" class="form form-horizontal well clearfix">
 						<div class="col-xs-12 col-sm-6 col-md-4">
-							<label class="label-item single-overflow pull-left" title="项目定义号:">项目定义号:</label>
+							<label class="label-item single-overflow pull-left" title="项目名称:">项目名称:</label>
 							<form:input path="projectId" htmlEscape="false" class="form-control"/>
 						</div>
+						<div class="col-xs-12 col-sm-6 col-md-4">
+							<div style="margin-top:26px">
+								<a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>
+								<a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>
+							</div>
+						</div>
 					</form:form>
 				</div>
 			</div>
 			<button style="margin: 10px 0px 0px 10px;" id="exportErp" class="btn btn-warning" onclick="exportErp()">
-				<i class="fa fa-file-excel-o"></i>导出erp
+				<i class="fa fa-file-excel-o"></i>导出成本erp
+			</button>
+			<button style="margin: 10px 0px 0px 10px;" id="exportErp2" class="btn btn-warning" onclick="exportErp2()">
+				<i class="fa fa-file-excel-o"></i>导出资本erp
 			</button>
 			<table id="informationTable"  data-toolbar="#toolbar" class="table"></table>
 		</div>