Commit 93604351 by wuwenlong

bugfix;

parent 4853573f
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 拆单派工
......@@ -39,8 +44,14 @@ public class ServiceHGSC006C extends ServiceBase {
String orderDetailId = MapUtils.getString(queryMap, HGSC006A.FIELD_id);
HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(Long.valueOf(orderDetailId));
inInfo.addBlock(CommonConstant.Field.DETAIL).addRow(hgsc006A);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007().eiMetadata);
String companyCode = hgsc006A.getCompanyCode();
List<Org> factoryList = HGXSTools.XsOrg.queryByParent(companyCode, OrgTypeEnum.FACTORY.getCode());
List<HGSC098> groupList = queryGroupList(Optional.ofNullable(factoryList).orElse(new ArrayList<>())
.stream().map(Org::getFactoryCode).collect(Collectors.toList()),hgsc006A.getProductType());
EiInfoUtils.addBlock(inInfo, "factory_record_block_id", factoryList, Org.class);
EiInfoUtils.addBlock(inInfo, "group_record_block_id", groupList, HGSC098.class);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
inInfo.setStatus(500);
......@@ -48,6 +59,50 @@ public class ServiceHGSC006C extends ServiceBase {
return inInfo;
}
private List<HGSC098> queryGroupList(List<String> factoryCodes, Integer productType){
List<HGSC098> groupList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(factoryCodes)) {
ProductTypeEnum productTypeEnum = ProductTypeEnum.getEnumByCode(productType);
OrgTypeEnum orgType;
switch (productTypeEnum) {
case STRUCT:
orgType = OrgTypeEnum.PROD_GROUP;
break;
case PART:
orgType = OrgTypeEnum.CUT_GROUP;
break;
default:
throw new PlatException("产品类型异常!");
}
Map<String,Object> paramMap = new HashMap();
paramMap.put("factoryCodes", factoryCodes);
paramMap.put("orgType", orgType.getCode());
groupList = dao.query("HGSC098.query", paramMap);
}
return groupList;
}
/**
* 部门下拉框
* @param inInfo
* @return
*/
public EiInfo groupRecordComboBox(EiInfo inInfo){
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String factoryCode = MapUtils.getString(queryMap, "factoryCode");
String productType = MapUtils.getString(queryMap, "productType");
List<HGSC098> groupList = queryGroupList(new ArrayList<String>(){{add(factoryCode);}},Integer.parseInt(productType));
EiInfoUtils.addBlock(inInfo,"group_record_block_id", groupList, HGSC098.class);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
/**
* 查询操作.
*
......
......@@ -139,4 +139,7 @@ public class ServiceHGSC098 extends ServiceBase {
}
return inInfo;
}
}
......@@ -5,6 +5,9 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
......
let factoryGroupGlobalData = [];
$(function () {
var factoryGlobalData = __eiInfo.getBlock("factory_record_block_id").getMappedRows();
let groupGlobalData = __eiInfo.getBlock("group_record_block_id").getMappedRows();
IPLATUI.EFGrid = {
"result" : {
......@@ -13,25 +14,69 @@ $(function () {
class: "i-input-readonly"
}
}, {
field: "factoryCode",
template: function (dataItem) {
for (let i = 0; i < factoryGlobalData.length; i++) {
if (factoryGlobalData[i]['factoryCode'] === dataItem['factoryCode']) {
return factoryGlobalData[i]['factoryName'];
}
}
return "";
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: factoryGlobalData,
minLength: 0,
dataTextField: "factoryName",
dataValueField: "factoryCode",
optionLabelTemplate: "#:factoryName#",
valueTemplate: "#:factoryName#",
template: "#:factoryName#",
filter: "contains"
});
}
}, {
field: "groupCode",
template: function (dataItem) {
for (let i = 0; i < factoryGroupGlobalData.length; i++) {
if (factoryGroupGlobalData[i]['valueField'] === dataItem['orgNo']) {
return factoryGroupGlobalData[i]['textField'];
for (let i = 0; i < groupGlobalData.length; i++) {
if (groupGlobalData[i]['groupCode'] === dataItem['groupCode']) {
return groupGlobalData[i]['groupName'];
}
}
return "";
},
editor: function (container, options) {
let dataSource;
let inInfo = new EiInfo();
inInfo.set("result-0-parentOrgId", options.model["factoryCode"]);
// 1:生产组
inInfo.set("inqu_status-0-productType", 'prodGroup');
inInfo.set("serviceName", "HPXSOrg");
inInfo.set("methodName", "queryGroupComboBox");
inInfo.set("blockId", "group_record_block_id");
inInfo.set("inqu_status-0-factoryCode", options.model["factoryCode"]);
inInfo.set("inqu_status-0-productType", $("#detail-0-productType").val());
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
EiCommunicator.send(HGSC006C, groupRecordComboBox, inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("group_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
let grid = container.closest(".k-grid").data("kendoGrid");
let cellIndex = grid.cellIndex(container);
let input = $('<input />');
let field = inInfo.get("field");
input.attr("name", field);
input.attr("id", field);
input.appendTo(container);
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "groupName",
dataValueField: "groupCode",
dataSource: dataSource,
template: "#=groupName#",
filter: "contains"
});
}
},{
field: "createdTime",
......@@ -65,23 +110,6 @@ $(function () {
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 生产组名称
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-productType", 'prodGroup');
EiCommunicator.send("HPXSOrg", "queryGroupComboBox", inInfo, {
onSuccess: function (ei) {
factoryGroupGlobalData = ei.getBlock("group_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
......
......@@ -7,9 +7,11 @@
<EF:EFPage title="拆单派工">
<EF:EFRegion id="inqu" title="订单详情">
<EF:EFInput ename="inqu_status-0-projCode" cname="项目号" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productType" cname="产品类型" type="hidden"/>
<EF:EFInput ename="detail-0-projCode" cname="项目号" type="hidden"/>
<EF:EFInput ename="detail-0-productType" cname="产品类型" type="hidden"/>
<EF:EFInput ename="detail-0-id" cname="订单明细ID" type="hidden"/>
<EF:EFInput ename="detail-0-companyCode" cname="公司编码" type="hidden"/>
<div class="row">
<EF:EFInput ename="detail-0-projCode" cname="项目号" colWidth="4" readonly="true"/>
<EF:EFInput ename="detail-0-projName" cname="项目名称" colWidth="4" readonly="true"/>
......
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