Commit 452cea71 by liuyang

添加排序和导出,调整生产驾驶舱计算项目明细数据

parent 772ced56
......@@ -405,10 +405,10 @@
b.PARENT_ID ,
a.PLAN_INFO_NO,
concat(left(max(a.PLAN_COMPLETION_DATE), 4), '/', substring(max(a.PLAN_COMPLETION_DATE), 5, 2), '/', right(max(a.PLAN_COMPLETION_DATE), 2)) as JHDATE,
concat(format(ifnull((sum(b.NUM * b.UNIT_WT) / 1000), 0), 2), '吨') as JHCL,
concat(format(ifnull( sum(c.AMOUNT * b.UNIT_WT) / 1000 , 0 ), 2) , '吨') as SJCL,
concat(format((ifnull( sum(c.AMOUNT * b.UNIT_WT) / 1000 , 0 ) / ifnull( sum(b.NUM * b.UNIT_WT)/ 1000 , 0 ) * 100), 2), '%') as SCJD, <!--生产进度-->
concat(format((ifnull( sum(d.AMOUNT * d.UNIT_WEIGHT), 0 ) / ifnull( sum(b.NUM * b.UNIT_WT) , 0 ) * 100), 2), '%') as FHJD <!--出库进度-->
concat(format(ifnull(sum(b.NUM * b.UNIT_WT), 0), 2), '吨') as JHCL,
concat(format(ifnull(sum(c.AMOUNT * b.UNIT_WT), 0), 2) , '吨') as SJCL,
concat(format((ifnull(sum(c.AMOUNT * b.UNIT_WT), 0 ) / ifnull( sum(b.NUM * b.UNIT_WT), 0 ) * 100), 2), '%') as SCJD, <!--生产进度-->
concat(format((ifnull(sum(d.AMOUNT * d.UNIT_WEIGHT), 0 ) / ifnull( sum(b.NUM * b.UNIT_WT), 0 ) * 100), 2), '%') as FHJD <!--出库进度-->
from ${hpjxSchema}.T_HPSC003 a
left join
(
......
......@@ -5,15 +5,13 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -22,10 +20,8 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -130,5 +126,33 @@ public class ServiceHPKC002 extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "生产领料单",operType = "导出",operDesc = "导出操作")
public EiInfo export(EiInfo inEiInfo) {
CommonMethod.initBlock(inEiInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
List<Map> listMap = inEiInfo.getBlock(DdynamicEnum.FACTORY_RECORD_BLOCK_ID.getBlockId()).getRows();
Map params = HPXSTools.setAuthParam("HPKC002."+ ACConstants.SQL_QUERY, EiInfoUtils.getFirstRow(inEiInfo));
params.put(HPKC002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
final List<String> list = new ArrayList<>(
Arrays.asList("projCode","projName","reqNo","receiptDate","factoryCode", "factoryName", "inventType", "whCode","whName"
,"inventCode", "inventName", "amount", "unitWeight", "weight", "remark", "oldReqNo", "createdName", "createdTime"
));
inEiInfo = ExcelUtils.exportToExcel(ACConstants.SQL_COUNT, ACConstants.SQL_QUERY, params, list, new HPKC002());
List<Map> rows = inEiInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach(row ->{
if (row.containsKey("inventType")){
row.put("inventType", row.get("inventType").toString());
}
List<Map> factoryList = listMap.stream().filter(map -> row.get("factoryCode").equals(map.get("valueField"))).collect(Collectors.toList());
if (factoryList.size() > 0){
row.put("factoryName", factoryList.get(0).get("textField"));
}
});
Map<String,Object> hashMap = new HashMap<String, Object>(){{
put("inventType", "hpjx.hpkc.inventType");
}};
String codeSetCode = "CODESET_CODE in ('hpjx.hpkc.inventType')";
inEiInfo.getBlock(EiConstant.resultBlock).setRows(Iplat4jTools.EdCm01.initResultRows(rows, hashMap, codeSetCode));
return inEiInfo;
}
}
......@@ -5,20 +5,16 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -27,10 +23,8 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 其他入库单
......@@ -82,6 +76,9 @@ public class ServiceHPKC006 extends ServiceBase {
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
builder(inInfo, Arrays.asList("length asc","length desc" ,"width asc","width desc","thick asc","thick desc"
,"material asc","material desc"
,"coefficient asc","coefficient desc","unit asc","unit desc"));
inInfo = super.query(inInfo, HPKC006.QUERY, new HPKC006());
List sum = dao.query(HPSqlConstant.HPKC006.QUERY_SUM, queryRow);
inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
......@@ -231,5 +228,55 @@ public class ServiceHPKC006 extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "其他入库单",operType = "导出",operDesc = "导出操作")
public EiInfo export(EiInfo inEiInfo) {
CommonMethod.initBlock(inEiInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
List<Map> listMap = inEiInfo.getBlock(DdynamicEnum.FACTORY_RECORD_BLOCK_ID.getBlockId()).getRows();
Map params = HPXSTools.setAuthParam("HPKC006."+ ACConstants.SQL_QUERY, EiInfoUtils.getFirstRow(inEiInfo));
final List<String> list = new ArrayList<>(
Arrays.asList("otherEnterNo","receiptDate","factoryCode","factoryName","inventType", "whCode", "whName"
,"inventCode", "inventName", "spec", "amount", "unitWeight", "weight", "length", "width", "thick"
, "material", "coefficient", "unit", "remark", "createdName", "createdTime"
));
inEiInfo = ExcelUtils.exportToExcel(ACConstants.SQL_COUNT, ACConstants.SQL_QUERY, params, list, new HPKC006());
List<Map> rows = inEiInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach(row ->{
if (row.containsKey("inventType")){
row.put("inventType", row.get("inventType").toString());
}
List<Map> factoryList = listMap.stream().filter(map -> row.get("factoryCode").equals(map.get("valueField"))).collect(Collectors.toList());
if (factoryList.size() > 0){
row.put("factoryName", factoryList.get(0).get("textField"));
}
});
Map<String,Object> hashMap = new HashMap<String, Object>(){{
put("inventType", "hpjx.hpkc.inventType");
}};
String codeSetCode = "CODESET_CODE in ('hpjx.hpkc.inventType')";
inEiInfo.getBlock(EiConstant.resultBlock).setRows(Iplat4jTools.EdCm01.initResultRows(rows, hashMap, codeSetCode));
return inEiInfo;
}
public void builder(EiInfo eiInfo, List<String> sql) {
String[] orderBy = eiInfo.getBlock(EiConstant.resultBlock).getString(EiConstant.orderByStr).split(",");
if (orderBy.length > 0) {
StringBuilder orderByStr = new StringBuilder();
for (int i = 0; i < orderBy.length; i++) {
if (i != 0 && i != orderByStr.length() - 1) {
orderByStr.append(",");
}
String orderStr = orderBy[i].trim();
if (orderStr.length()>0){
List filter = sql.stream().filter(s -> s.contains(orderStr)).collect(Collectors.toList());
if (filter.size() > 0){
orderByStr.append("b.".concat(orderBy[i]));
}else {
orderByStr.append("a.".concat(orderBy[i]));
}
}
}
eiInfo.getBlock(EiConstant.resultBlock).set("orderBy", orderByStr);
}
}
}
......@@ -5,18 +5,17 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.tools.Iplat4jTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -25,10 +24,8 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 其他出库单
......@@ -236,5 +233,33 @@ public class ServiceHPKC007 extends ServiceBase {
}
return inInfo;
}
@OperationLogAnnotation(operModul = "其他出库单",operType = "导出",operDesc = "导出操作")
public EiInfo export(EiInfo inEiInfo) {
CommonMethod.initBlock(inEiInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null);
List<Map> listMap = inEiInfo.getBlock(DdynamicEnum.FACTORY_RECORD_BLOCK_ID.getBlockId()).getRows();
Map params = HPXSTools.setAuthParam("HPKC007."+ ACConstants.SQL_QUERY, EiInfoUtils.getFirstRow(inEiInfo));
params.put(HPKC002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
final List<String> list = new ArrayList<>(
Arrays.asList("otherOuterNo","receiptDate","inventType", "factoryCode", "factoryName", "inventType", "whCode","whName"
,"inventCode", "inventName", "amount", "unitWeight", "weight", "remark", "oldOuterNo", "createdName", "createdTime"
));
inEiInfo = ExcelUtils.exportToExcel(ACConstants.SQL_COUNT, ACConstants.SQL_QUERY, params, list, new HPKC007());
List<Map> rows = inEiInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach(row ->{
if (row.containsKey("inventType")){
row.put("inventType", row.get("inventType").toString());
}
List<Map> factoryList = listMap.stream().filter(map -> row.get("factoryCode").equals(map.get("valueField"))).collect(Collectors.toList());
if (factoryList.size() > 0){
row.put("factoryName", factoryList.get(0).get("textField"));
}
});
Map<String,Object> hashMap = new HashMap<String, Object>(){{
put("inventType", "hpjx.hpkc.inventType");
}};
String codeSetCode = "CODESET_CODE in ('hpjx.hpkc.inventType')";
inEiInfo.getBlock(EiConstant.resultBlock).setRows(Iplat4jTools.EdCm01.initResultRows(rows, hashMap, codeSetCode));
return inEiInfo;
}
}
......@@ -150,7 +150,7 @@
$order$
</isNotEmpty>
<isEmpty property="order">
ID desc
RECEIPT_DATE desc
</isEmpty>
</dynamic>
</sql>
......
......@@ -65,7 +65,7 @@
<EF:EFColumn ename="inventCode" cname="存货编码" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true" sort="false"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
......
......@@ -8,6 +8,19 @@ $(function () {
return showUserName(options.createdBy, options.createdName);
}
}],
exportGrid: {
beforeExport: function (gridInstance) {
return true;
},
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "生产领料单_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportServiceName: "HPKC002",
exportMethodName: "export",
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function (grid) {
},
onSuccess: function (e) {
......
......@@ -48,7 +48,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row">
<EF:EFGrid blockId="result" autoDraw="override" autoFit="true" isFloat="true" checkMode="row" sort="all">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" enable="false" width="120" align="center"
blockName="proj_record_block_id" textField="textField" valueField="valueField"
......
......@@ -120,6 +120,19 @@ $(function() {
return options.thick == 0 ? "-" : options.thick;
}
}],
exportGrid: {
beforeExport: function (gridInstance) {
return true;
},
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "其他出库单_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportServiceName: "HPKC006",
exportMethodName: "export",
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
......
......@@ -47,7 +47,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true" sort="all">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
......@@ -64,7 +64,7 @@
<EF:EFColumn ename="inventCode" cname="存货编码" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="150" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格Id" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true" sort="false"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
......
......@@ -12,6 +12,19 @@ $(function() {
return showUserName(options.createdBy, options.createdName);
}
}],
exportGrid: {
beforeExport: function (gridInstance) {
return true;
},
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "其他出库单_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportServiceName: "HPKC007",
exportMethodName: "export",
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
loadComplete: function (grid) {
},
onSuccess: function (e) {
......
......@@ -47,7 +47,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" sort="all">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="otherOuterNo" cname="出库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" editType="date" dateFormat="yyyy-MM-dd"
......
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