Commit 88334e37 authored by 鲁鑫's avatar 鲁鑫

ECN变更打印模版调整

parent 86d2a2a5
......@@ -87,4 +87,8 @@ ALTER TABLE `topsun_dev`.`sap_purchase_item`
ADD COLUMN `AFNAM_ID` varchar(128) NULL COMMENT '申请人ID' AFTER `KOSTL_NAME`;
ALTER TABLE `topsun_dev`.`ep_change_form_impl_item`
ADD COLUMN `follow_matter` varchar(128) NULL COMMENT '跟进事项' AFTER `date`;
\ No newline at end of file
ADD COLUMN `follow_matter` varchar(128) NULL COMMENT '跟进事项' AFTER `date`;
--2024-10-11 ECN具体生效日期
ALTER TABLE `topsun_dev`.`ep_change_form`
ADD COLUMN `effective_date` datetime NULL COMMENT '具体生效日期' AFTER `material_reason_for_change`;
\ No newline at end of file
......@@ -429,10 +429,10 @@ function getExtendedData(processAction) {
}
function print(){
if ($("#statusId").val() != 3){
Public.tip("请审批完成再打印!");
return;
}
// if ($("#statusId").val() != 3){
// Public.tip("请审批完成再打印!");
// return;
// }
var url='/epChangeForm/print.load';
Public.openPostWindow(web_app.name+url,{id :$("#id").val()});
}
......@@ -32,17 +32,18 @@
<x:inputC name="changePerson" required="false" label="变更申请部门/姓名" labelCol="2" fieldCol="2" wrapper="select"/>
</div>
<div class="hg-form-row">
<x:checkboxListC name="reasonForChange" list="reasonForChangeList" required="true" label="变更原因" labelCol="2" fieldCol="6"/>
<x:checkboxListC name="reasonForChange" list="reasonForChangeList" required="true" label="变更类型" labelCol="2" fieldCol="6"/>
<x:inputC name="otherReasonDesc" required="false" label="其他原因描述" labelCol="2" fieldCol="2"/>
</div>
<div class="hg-form-row">
<x:textareaC name="changeMatter" required="false" label="变更事项" rows="3" labelCol="2" fieldCol="10"/>
</div>
<div class="hg-form-row">
<x:textareaC name="reasonDesc" required="false" label="原因描述" rows="3" labelCol="2" fieldCol="10"/>
<x:textareaC name="reasonDesc" required="false" label="变更原因" rows="3" labelCol="2" fieldCol="10"/>
</div>
<div class="hg-form-row">
<x:checkboxListC name="changeEffective" dictionary="changeEffective" required="true" label="生效日期" labelCol="2" fieldCol="10"/>
<x:checkboxListC name="changeEffective" dictionary="changeEffective" required="true" label="生效日期" labelCol="2" fieldCol="6"/>
<x:inputC name="effectiveDate" required="false" label="生效日期" labelCol="2" fieldCol="2" wrapper="datetime"/>
</div>
<x:title title="CURRENT SPEC 目前产品信息" name="group"/>
<div class="hg-form-row">
......
......@@ -34,9 +34,9 @@ function loadGrid() {
{display: "变更事项", name: "changeMatter", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "产品代号", name: "pd", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "产品名称", name: "productName", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "变更原因", name: "reasonForChangeTextView", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "变更类型", name: "reasonForChangeTextView", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "成品变更原因", name: "reasonDesc", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "原材料变更原因", name: "materialReasonForChangeTextView", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "原因描述", name: "reasonDesc", width: 150, minWidth: 60, type: "string", align: "left"},
{display: "申请人", name: "personMemberName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "申请部门", name: "deptName", width: 120, minWidth: 60, type: "string", align: "left"},
{display: "状态码", name: "code", width: 100, minWidth: 60, type: "string", align: "left"},
......@@ -103,10 +103,10 @@ function printHandler(){
if (!row) {
return;
}
if (row.status != 3){
Public.tip("请审批完成再打印!");
return;
}
// if (row.status != 3){
// Public.tip("请审批完成再打印!");
// return;
// }
var url='/epChangeForm/print.load';
Public.openPostWindow(web_app.name+url,{id :row.id});
}
......@@ -320,10 +320,10 @@ function getExtendedData(processAction) {
}
function print(){
if ($("#statusId").val() != 3){
Public.tip("请审批完成再打印!");
return;
}
// if ($("#statusId").val() != 3){
// Public.tip("请审批完成再打印!");
// return;
// }
var url='/epChangeForm/print.load';
Public.openPostWindow(web_app.name+url,{id :$("#id").val()});
}
......@@ -31,14 +31,14 @@
<x:inputC name="changePerson" required="false" label="变更申请部门/姓名" labelCol="2" fieldCol="2" wrapper="select"/>
</div>
<div class="hg-form-row">
<x:checkboxListC name="materialReasonForChange" dictionary="materialReasonForChange" required="true" label="变更原因" labelCol="2" fieldCol="6"/>
<x:checkboxListC name="materialReasonForChange" dictionary="materialReasonForChange" required="true" label="变更类型" labelCol="2" fieldCol="6"/>
<x:inputC name="otherReasonDesc" required="false" label="其他原因描述" labelCol="2" fieldCol="2"/>
</div>
<div class="hg-form-row">
<x:textareaC name="changeMatter" required="false" label="变更事项" rows="3" labelCol="2" fieldCol="10"/>
</div>
<div class="hg-form-row">
<x:textareaC name="reasonDesc" required="false" label="原因描述" rows="3" labelCol="2" fieldCol="10"/>
<x:textareaC name="reasonDesc" required="false" label="变更原因" rows="3" labelCol="2" fieldCol="10"/>
</div>
<div class="hg-form-row">
<x:checkboxListC name="changeEffective" dictionary="changeEffective" required="true" label="生效日期" labelCol="2" fieldCol="10"/>
......
......@@ -31,29 +31,26 @@
</table>
<div class="title" style="background: #CC8F81;text-align: center">General Information 基本信息</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<#--<colgroup>
<col width='16%' />
<col width='17%' />
<col width='17%' />
<col width='17%' />
<col width='16%' />
<col width='17%' />
<col width="16%" />
</colgroup>
<tr>
<td class="center">DATE日期:</td>
<td class="center"><@formatDate date=fillinDate/></td>
<td class="center">BRAND品牌名称:</td>
<td class="center">${brandName?default("")?html}</td>
<td class="center">CHANGE REQUESTED BY (DEPT/NAME)变更申请部门/姓名:</td>
<td class="center">${deptName?default("")?html}</td>
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
</colgroup>-->
<colgroup>
<col width='100%' />
<col width='14%' />
<col width='33%' />
<col width='51%' />
</colgroup>
<tr>
<td class="left">REASON FOR CHANGE变更原因:${reasonDesc?default("")?html}</td>
<td class="left">DATE日期:<br/><@formatDate date=fillinDate/></td>
<#--<td class="center"><@formatDate date=fillinDate/></td>-->
<td class="left">BRAND品牌名称:<br/>${brandName?default("")?html}</td>
<#--<td class="center">${brandName?default("")?html}</td>-->
<td class="left">CHANGE REQUESTED BY (DEPT/NAME)变更申请部门/姓名:<br/>${deptName?default("")?html}</td>
<#--<td class="center">${deptName?default("")?html}</td>-->
</tr>
</table>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
......@@ -61,17 +58,30 @@
<col width='100%' />
</colgroup>
<tr>
<td class="left">${reasonForChange?default("")?html}</td>
<td class="left">${otherReasonDesc?default("")?html}</td>
<td class="left">REASON FOR CHANGE变更原因:${reasonDesc?default("")?html}
<br/>
${reasonForChange?replace("nbsp", "&nbsp;&nbsp;&nbsp;&nbsp;")!default("")?html}
<span style="text-decoration: underline">其他:${otherReasonDesc?default("")?html}</span>
</td>
</tr>
</table>
<#--<table cellspacing="0px" cellpadding="0px" class="tableBorder">-->
<#-- <colgroup>-->
<#-- <col width='100%' />-->
<#-- </colgroup>-->
<#-- <tr>-->
<#-- <td class="left">${reasonForChange?default("")?html}</td>-->
<#-- <td class="left">${otherReasonDesc?default("")?html}</td>-->
<#-- </tr>-->
<#--</table>-->
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='100%' />
</colgroup>
<tr>
<td class="left">CHANGE EFFECTIVE 生效日期:
<span style="text-decoration: underline">${changeEffective?default("")?html}</span>
<td class="left">CHANGE EFFECTIVE 生效日期:<@formatDate date=effectiveDate/>
<br/>
${changeEffective?replace("nbsp", "&nbsp;&nbsp;&nbsp;&nbsp;")!default("")?html}
</td>
</tr>
</table>
......@@ -79,25 +89,22 @@
<div class="title" style="background: yellow;text-align: left">CURRENT SPEC 目前产品信息</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='22%' />
<col width='78%' />
<col width='14%' />
<col width='84%' />
</colgroup>
<tr>
<td class="left">
PD#
产品代号#:</td>
PD# 产品代号#:</td>
<td class="left">${pd?default("")?html}</td>
</tr>
<tr>
<td class="left">
PRODUCT NAME
产品名称:</td>
PRODUCT NAME<br/>产品名称:</td>
<td class="left">${productName?default("")?html}</td>
</tr>
<tr>
<td class="left">
PROCESS
制程工艺:</td>
PROCESS制程工艺:</td>
<td class="left">${process?default("")?html}</td>
</tr>
<tr>
......@@ -112,25 +119,22 @@
<div class="title" style="background: yellow;text-align: left">REVISED SPEC 变更后产品信息</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='22%' />
<col width='78%' />
<col width='14%' />
<col width='84%' />
</colgroup>
<tr>
<td class="left">
PD#
产品代号#:</td>
PD# 产品代号#:</td>
<td class="left">${changedPd?default("")?html}</td>
</tr>
<tr>
<td class="left">
PRODUCT NAME
产品名称:</td>
PRODUCT NAME<br/>产品名称:</td>
<td class="left">${changedProductName?default("")?html}</td>
</tr>
<tr>
<td class="left">
PROCESS
制程工艺:</td>
PROCESS制程工艺:</td>
<td class="left">${changedProcess?default("")?html}</td>
</tr>
<tr>
......@@ -149,9 +153,9 @@
<div class="title" style="background: #CC8F81;text-align: center">Approvals / Checks 确认</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<colgroup>
<col width='25%' />
<col width='20%' />
<col width='55%' />
<col width='22%' />
<col width='28%' />
<col width='50%' />
</colgroup>
<tr>
<td class="center" style="background: yellow">审批节点</td>
......@@ -162,7 +166,7 @@
<#list approvals as detail>
<tr>
<td class="left">${detail.approvalName?default("")?html}</td>
<td class="left">${detail.handledDate?default("")?html}</td>
<td class="center">${detail.handledDate?default("")?html}</td>
<td class="left">${detail.opinion?default("")?html}</td>
</tr>
</#list>
......@@ -176,26 +180,35 @@
</table>
<div class="title" style="background: #CC8F81;text-align: center">Implementation 执行人(版具/模具等)</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<#-- <colgroup>-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- </colgroup>-->
<colgroup>
<col width='14%' />
<col width='25%' />
<col width='25%' />
<col width='25%' />
<col width='25%' />
<col width='10%' />
<col width='18%' />
<col width='33%' />
</colgroup>
<tr>
<td class="center" style="background: yellow">部门</td>
<td class="center" style="background: yellow">执行人</td>
<td class="center" style="background: yellow">跟进事项</td>
<td class="center" style="background: yellow">签名确认</td>
<td class="center" style="background: yellow">DATE日期</td>
<td class="center" style="background: yellow">COMMENTS评论</td>
</tr>
<#if implItemMaps?? && implItemMaps?size gt 0>
<#list implItemMaps as detail>
<tr>
<td class="center">${detail.deptName?default("")?html}</td>
<td class="center">${detail.followMatter?default("")?html}</td>
<td class="center">${detail.executor?default("")?html}</td>
<td class="center">${detail.confirmTextView?default("")?html}</td>
<td class="center">${detail.date?default("")?html}</td>
<td class="center">${detail.comment?default("")?html}</td>
</tr>
</#list>
<#else>
......@@ -204,31 +217,46 @@
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
</tr>
</#if>
</table>
<div class="title" style="background: #CC8F81;text-align: center">Stock / Inventory 库存</div>
<table cellspacing="0px" cellpadding="0px" class="tableBorder">
<#-- <colgroup>-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- <col width='25%' />-->
<#-- </colgroup>-->
<#-- <colgroup>-->
<#-- <col width='14%' />-->
<#-- <col width='51%' />-->
<#-- <col width='16%' />-->
<#-- <col width='17%' />-->
<#-- </colgroup>-->
<colgroup>
<col width='14%' />
<col width='25%' />
<col width='25%' />
<col width='25%' />
<col width='25%' />
<col width='10%' />
<col width='18%' />
<col width='33%' />
</colgroup>
<tr>
<td class="center" style="background: yellow">部门</td>
<td class="center" style="background: yellow">专属原材料/半成品/在制品/成品数量(张)</td>
<td class="center" style="background: yellow">签名确认</td>
<td class="center" style="background: yellow">DATE日期</td>
<td class="center" style="background: yellow">COMMENTS评论</td>
</tr>
<#if stockItemMaps?? && stockItemMaps?size gt 0>
<#list stockItemMaps as detail>
<tr>
<td class="center">${detail.deptName?default("")?html}</td>
<td class="center">${detail.description?default("")?html}</td>
<td class="center">${detail.confirmTextView?default("")?html}</td>
<td class="center">${detail.executor?default("")?html}</td>
<td class="center">${detail.date?default("")?html}</td>
<td class="center">${detail.comment?default("")?html}</td>
</tr>
</#list>
<#else>
......@@ -237,6 +265,7 @@
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
<td class="center">&nbsp;</td>
</tr>
</#if>
</table>
......
......@@ -13,6 +13,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
......@@ -134,4 +136,21 @@ public class Function extends AbstractDaoFunction {
String sql = this.getSqlByname("fundApproval");
return this.sqlExecutorDao.queryToList(sql, OrgUnit.class,bizId);
}
/**
* 根据业务id查询指定的执行人
* @param bizId
* @return
*/
public List<OrgUnit> fundECNApproval(String bizId){
Assert.hasText(bizId, "参数id不能为空。");
String sql = this.getSqlByname("fundECNItemApproval");
String sqlStock = this.getSqlByname("fundECNStockItemApproval");
List<OrgUnit> orgUnits = this.sqlExecutorDao.queryToList(sql, OrgUnit.class, bizId);
List<OrgUnit> orgUnitStocks = this.sqlExecutorDao.queryToList(sqlStock, OrgUnit.class, bizId);
orgUnits.addAll(orgUnitStocks);
HashSet<OrgUnit> orgUnitHashSet = new HashSet<>(orgUnits);
ArrayList<OrgUnit> orgUnitArrayList = new ArrayList<>(orgUnitHashSet);
return orgUnitArrayList;
}
}
......@@ -23,4 +23,6 @@ public interface EpChangeFormApplication {
Map<String, Object> slicedEpChangeFormList(EpChangeFormQueryRequest queryRequest);
List<Map<String,Object>> queryApprovalPersons(String bizId);
Map<String, Object> print(EpChangeFormQueryRequest queryRequest);
}
......@@ -3,7 +3,10 @@ package com.huigou.topsun.ep.change.application.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huigou.cache.DictUtil;
import com.huigou.cache.SystemCache;
import com.huigou.data.domain.model.CommonDomainConstants;
import com.huigou.data.domain.query.QueryPageRequest;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.ep.change.application.EpChangeFormApplication;
......@@ -26,14 +29,22 @@ import com.huigou.uasp.bpm.engine.domain.model.ProcUnitHandler;
import com.huigou.uasp.bpm.engine.domain.model.TaskExtension;
import com.huigou.util.ClassHelper;
import com.huigou.util.DateUtil;
import com.huigou.util.StringUtil;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import sun.misc.BASE64Encoder;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
......@@ -43,6 +54,7 @@ import java.util.*;
*/
@Service("epChangeFormApplication")
public class EpChangeFormApplicationImpl extends FlowBroker implements EpChangeFormApplication {
private final static Logger LOG = LoggerFactory.getLogger(EpChangeFormApplicationImpl.class);
@Autowired
private EpChangeFormRepository epChangeFormRepository;
@Autowired
......@@ -121,12 +133,11 @@ public class EpChangeFormApplicationImpl extends FlowBroker implements EpChangeF
}
}
changeFormImplItemApplication.saveEpChangeFormImplItems(bizId,formImplItemList);
}
if ("库存".equals(subProcUnitName)){
//匹配仓库环节审批完,更新确认状态是时间
List<EpChangeFormStockItem> stockItemList = epChangeFormStockItemRepository.findByEpChangeFormId(bizId);
for (EpChangeFormStockItem epChangeFormStockItem : stockItemList) {
if (org.getDeptId().equals(epChangeFormStockItem.getDeptId())){
if (org.getId().equals(epChangeFormStockItem.getExecutorId())){
epChangeFormStockItem.setConfirm("1");
epChangeFormStockItem.setDate(new Date());
}
......@@ -238,6 +249,104 @@ public class EpChangeFormApplicationImpl extends FlowBroker implements EpChangeF
return this.sqlExecutorDao.queryToListMap(queryDescriptor.getSql(),bizId);
}
@Override
public Map<String, Object> print(EpChangeFormQueryRequest queryRequest) {
Map<String, Object> objectMap = this.slicedEpChangeFormList(queryRequest);
List<Map<String, Object>> objectMaps = (List<Map<String, Object>>) objectMap.get("Rows");
Map<String,Object> map = objectMaps.get(0);
map.put("deptName",map.get("deptName")+"-"+map.get("personMemberName"));
//处理产成品变更类型和原材料变更类型
//例如:√ BRAND CHANGE 客户变更 BSN PROCESS CHANGE 内部工艺变更 PRODUCT MATERIAL CHANGE 产品材质变更
// TEMPLATE CHANGE 版具变更 MATERIAL CHANGE 原材料变更 OTHERS 其它
String reasonForChange = "";
Map<String, String> reasonForChangeMap = new HashMap<>();
String reasonForChangePD = (String) map.get("reasonForChange");
String reasonForChangeMaterial = (String) map.get("materialReasonForChange");
if (StringUtil.isNotBlank(reasonForChangePD)){
reasonForChange = reasonForChangePD;
reasonForChangeMap = DictUtil.getDictionary("reasonForChange");
}
if (StringUtil.isNotBlank(reasonForChangeMaterial)){
reasonForChange = reasonForChangeMaterial;
reasonForChangeMap = DictUtil.getDictionary("materialReasonForChange");
}
String[] split = reasonForChange.split(",");
List<String> strings = Arrays.asList(split);
StringBuilder change = new StringBuilder();
Map<String, String> finalReasonForChangeMap = reasonForChangeMap;
finalReasonForChangeMap.keySet().forEach(key->{
if (strings.contains(key)){
change.append(" √ ");
}
if (StringUtil.isNotBlank(reasonForChangeMaterial)){
change.append(finalReasonForChangeMap.get(key)).append("nbsp");
}
if (StringUtil.isNotBlank(reasonForChangePD)){
change.append(key).append(" ").append(finalReasonForChangeMap.get(key)).append("nbsp");
}
});
map.put("reasonForChange",change.toString());
//处理生效日期类型
//例如:√ IMMEDIATE 立即变更 RUNNING CHANGE 正常变更(用完后变更) SEASON 换季更改
Map<String, String> changeEffective = DictUtil.getDictionary("changeEffective");
StringBuilder effective = new StringBuilder();
String[] splitE = map.get("changeEffective").toString().split(",");
List<String> stringList = Arrays.asList(splitE);
changeEffective.keySet().forEach(key->{
if (stringList.contains(key)){
effective.append(" √ ");
}
effective.append(key).append(" ").append(changeEffective.get(key)).append("nbsp");
});
map.put("changeEffective",effective.toString());
File file = new File(SystemCache.getRealPath() +"/images/bsnLogo.png");
try {
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[inputFile.available()];
inputFile.read(buffer);
inputFile.close();
BASE64Encoder base64Encoder = new BASE64Encoder();
String encode = base64Encoder.encode(buffer);
map.put("bsnPng",encode);
}catch (Exception e) {
LOG.error("异常信息:" + e.getMessage());
}
// 获取Grid数据
QueryPageRequest pageModel = queryRequest.getPageModel();
pageModel.setPageSize(20);
queryRequest.setPageModel(pageModel);
queryRequest.setEpChangeFormId(queryRequest.getId());
//查询Implementation 执行人(版具/模具等)
Map<String, Object> implItemMap = changeFormImplItemApplication.findByEpChangeFormId(queryRequest);
//查询Stock / Inventory 库存
Map<String, Object> stockItemMap = changeFormStockItemApplication.findByEpChangeFormId(queryRequest);
//查询审批人
List<Map<String, Object>> mapList = this.queryApprovalPersons(queryRequest.getId());
List<Map<String, Object>> implItemMaps = (List<Map<String, Object>>) implItemMap.get("Rows");
implItemMaps.forEach(itemMap->{
mapList.forEach(approvalMap -> {
if (approvalMap.get("handlerName").equals(itemMap.get("executor"))){
itemMap.put("comment",approvalMap.get("opinion"));
}
});
});
List<Map<String, Object>> stockItemMaps = (List<Map<String, Object>>) stockItemMap.get("Rows");
stockItemMaps.forEach(itemMap->{
mapList.forEach(approvalMap -> {
if (approvalMap.get("handlerName").equals(itemMap.get("executor"))){
itemMap.put("comment",approvalMap.get("opinion"));
}
});
});
map.put("printTime", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(LocalDateTime.now()));
map.put("implItemMaps", implItemMaps);
map.put("stockItemMaps", stockItemMaps);
map.put("approvals", mapList);
return map;
}
public void feedBackSaleEcn(EpChangeForm epChangeForm){
Map<String,Object> map = new HashMap<>();
//日志记录
......
package com.huigou.topsun.ep.change.controller;
import com.huigou.cache.DictUtil;
import com.huigou.cache.SystemCache;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.data.domain.query.QueryPageRequest;
import com.huigou.topsun.ep.change.application.EpChangeFormApplication;
import com.huigou.topsun.ep.change.application.EpChangeFormImplItemApplication;
import com.huigou.topsun.ep.change.application.EpChangeFormStockItemApplication;
import com.huigou.topsun.ep.change.domain.EpChangeForm;
import com.huigou.topsun.ep.change.domain.query.EpChangeFormQueryRequest;
import com.huigou.topsun.ep.order.controller.EpSaleOrderCancelController;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bpm.engine.application.ActApplication;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import sun.misc.BASE64Encoder;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -42,7 +29,6 @@ import java.util.Map;
@Controller
@ControllerMapping("/epChangeForm")
public class EpChangeFormController extends CommonController {
private final static Logger LOG = LoggerFactory.getLogger(EpChangeFormController.class);
@Override
protected String getPagePath() {
return "/biz/topsun/ep/change/";
......@@ -54,8 +40,6 @@ public class EpChangeFormController extends CommonController {
private EpChangeFormImplItemApplication changeFormImplItemApplication;
@Autowired
private EpChangeFormStockItemApplication changeFormStockItemApplication;
@Autowired
private ActApplication actApplication;
public String forwardEpChangeFormList(){
return forward("epChangeFormList");
......@@ -142,57 +126,7 @@ public class EpChangeFormController extends CommonController {
String id = sdo.getId();
EpChangeFormQueryRequest queryRequest = sdo.toQueryRequest(EpChangeFormQueryRequest.class);
queryRequest.setId(id);
Map<String, Object> objectMap = this.epChangeFormApplication.slicedEpChangeFormList(queryRequest);
List<Map<String, Object>> objectMaps = (List<Map<String, Object>>) objectMap.get("Rows");
Map<String,Object> map = objectMaps.get(0);
map.put("deptName",map.get("deptName")+"-"+map.get("personMemberName"));
String[] split = map.get("reasonForChange").toString().split(",");
String[] splitText = map.get("reasonForChangeTextView").toString().split(",");
List<String> strings = Arrays.asList(split);
List<String> stringTexts = Arrays.asList(splitText);
StringBuilder change = new StringBuilder();
for (int i = 0; i < strings.size(); i++) {
String s = strings.get(i);
change.append(" √ ").append(s).append(" ").append(stringTexts.get(i));
}
map.put("reasonForChange",change.toString());
StringBuilder effective = new StringBuilder();
String[] splitE = map.get("changeEffective").toString().split(",");
String[] splitETextView = map.get("changeEffectiveTextView").toString().split(",");
List<String> stringList = Arrays.asList(splitE);
List<String> stringListTextView = Arrays.asList(splitETextView);
for (int i = 0; i < stringList.size(); i++) {
String s = stringList.get(i);
effective.append(" √ ").append(s).append(" ").append(stringListTextView.get(i));
}
map.put("changeEffective",effective.toString());
File file = new File(SystemCache.getRealPath() +"/images/bsnLogo.png");
try {
FileInputStream inputFile = new FileInputStream(file);
byte[] buffer = new byte[inputFile.available()];
inputFile.read(buffer);
inputFile.close();
BASE64Encoder base64Encoder = new BASE64Encoder();
String encode = base64Encoder.encode(buffer);
map.put("bsnPng",encode);
}catch (Exception e) {
LOG.error("异常信息:" + e.getMessage());
}
// 获取Grid数据
QueryPageRequest pageModel = queryRequest.getPageModel();
pageModel.setPageSize(20);
queryRequest.setPageModel(pageModel);
queryRequest.setEpChangeFormId(id);
Map<String, Object> implItemMap = changeFormImplItemApplication.findByEpChangeFormId(queryRequest);
Map<String, Object> stockItemMap = changeFormStockItemApplication.findByEpChangeFormId(queryRequest);
List<Map<String, Object>> mapList = this.epChangeFormApplication.queryApprovalPersons(id);
List<Map<String, Object>> implItemMaps = (List<Map<String, Object>>) implItemMap.get("Rows");
List<Map<String, Object>> stockItemMaps = (List<Map<String, Object>>) stockItemMap.get("Rows");
map.put("printTime", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format(LocalDateTime.now()));
map.put("implItemMaps", implItemMaps);
map.put("stockItemMaps", stockItemMaps);
map.put("approvals", mapList);
Map<String,Object> map = this.epChangeFormApplication.print(queryRequest);
String pintPage = String.format("/print/topsun/epChangeForm.ftl");
return outputAndProcUnitHandlerPDF(pintPage, id, map);
}
......
......@@ -6,6 +6,7 @@ import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* @Auther: xin.lu
......@@ -55,6 +56,12 @@ public class EpChangeForm extends FlowBillAbstractEntity {
@Column(name = "change_effective")
private String changeEffective;
/**
* 具体生效日期
*/
@Column(name = "effective_date")
private Date effectiveDate;
//CURRENT SPEC 目前产品信息
/**
......
......@@ -77,6 +77,21 @@
<sql name="findDepartException">
SELECT duty_dept full_id,duty_dept_name full_name from sap_exception_report t WHERE t.id = ?
</sql>
</query>
<!--查询ECN执行人-->
<sql name="fundECNItemApproval">
SELECT o.FULL_ID, o.FULL_NAME FROM sa_oporg o
LEFT JOIN ep_change_form_impl_item ii ON ii.executor_id = o.id
LEFT JOIN ep_change_form cf ON cf.id = ii.ep_change_form_id
WHERE cf.id = ?
</sql>
<!--查询ECN库存执行人-->
<sql name="fundECNStockItemApproval">
SELECT o.FULL_ID, o.FULL_NAME FROM sa_oporg o
LEFT JOIN ep_change_form_stock_item si ON si.executor_id = o.id
LEFT JOIN ep_change_form cf ON cf.id = si.ep_change_form_id
WHERE cf.id = ?
</sql>
</query>
</query-mappings>
\ No newline at end of file
......@@ -39,10 +39,11 @@
wf_procunithandler t WHERE t.BIZ_ID = ? ORDER BY t.GROUP_ID ASC-->
SELECT
CONCAT( t.SUB_PROC_UNIT_NAME, ":", t.HANDLER_NAME ) AS approval_name,
t.HANDLER_NAME,
t.HANDLED_DATE,
t.OPINION
FROM
wf_procunithandler t WHERE t.BIZ_ID = ? ORDER BY t.GROUP_ID ASC
wf_procunithandler t WHERE t.BIZ_ID = ? and t.RESULT = 1 and t.SUB_PROC_UNIT_ID != 'executorId' ORDER BY t.GROUP_ID,t.HANDLED_DATE ASC
</sql-query>
</query>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment