Commit e07966f6 by 宋祥

Merge remote-tracking branch 'origin/dev' into dev

parents 98576595 403b12a0
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.common.InventTypeEnun;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001; import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC009;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -24,7 +18,6 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator; ...@@ -24,7 +18,6 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author YK * @author YK
...@@ -40,7 +33,7 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -40,7 +33,7 @@ public class ServiceHPKC001 extends ServiceBase {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC001().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC001().eiMetadata);
inInfo.setBlock(InventTypeEnun.generatorEiBlock()); inInfo.setBlock(InventTypeEnun.generatorEiBlock());
...@@ -86,14 +79,12 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -86,14 +79,12 @@ public class ServiceHPKC001 extends ServiceBase {
insertEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(insertEntity.getMaterialType())); insertEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(insertEntity.getMaterialType()));
// 生成单据号 // 生成单据号
insertEntity.setDocumentCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC001_NUMBER)); insertEntity.setDocumentCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC001_NUMBER));
// 去除日期字符串中的-
insertEntity.setDocumentTime(StringUtil.removeHorizontalLine(insertEntity.getDocumentTime()));
insertEntity.setStatus(1); insertEntity.setStatus(1);
insertEntity.setApprovalStatus(0); insertEntity.setApprovalStatus(0);
DaoUtils.insert("HPKC001.insert", insertEntity); dao.insert("HPKC001.insert", insertEntity);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
...@@ -104,7 +95,7 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -104,7 +95,7 @@ public class ServiceHPKC001 extends ServiceBase {
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
...@@ -145,20 +136,20 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -145,20 +136,20 @@ public class ServiceHPKC001 extends ServiceBase {
updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName()); updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//物料类型 //物料类型
updateEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(updateEntity.getMaterialType())); updateEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(updateEntity.getMaterialType()));
DaoUtils.update("HPKC001.update", updateEntity); dao.insert("HPKC001.update", updateEntity);
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage()); inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage()); logError("修改失败", e.getMessage());
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
...@@ -187,14 +178,4 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -187,14 +178,4 @@ public class ServiceHPKC001 extends ServiceBase {
return eiInfo; return eiInfo;
} }
public EiInfo queryMaterialTypeSetName(EiInfo eiInfo) {
eiInfo.setBlock(InventTypeEnun.generatorEiBlock());
return eiInfo;
}
public EiInfo queryWhCodeSetName(EiInfo eiInfo) {
CommonMethod.initBlock(eiInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
return eiInfo;
}
} }
...@@ -2,19 +2,22 @@ package com.baosight.hpjx.hp.kc.service; ...@@ -2,19 +2,22 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnun; import com.baosight.hpjx.common.InventTypeEnun;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC002; import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.Arrays; import java.util.*;
import java.util.Map;
/** /**
* @author YK * @author YK
...@@ -27,17 +30,17 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -27,17 +30,17 @@ public class ServiceHPKC002 extends ServiceBase {
*/ */
@Override @Override
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
HPKC002 HPKC002 = new HPKC002(); try {
EiInfo outInfo = super.initLoad(inInfo, HPKC002); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC002().eiMetadata);
EiBlock block = outInfo.addBlock(EiConstant.queryBlock); inInfo.setBlock(InventTypeEnun.generatorEiBlock());
block.setCell(ACConstants.ROW_CODE_0, ACConstants.PARAM_WH_CODE, outInfo.getBlock(ACConstants.WH_CODE_BLOCK_ID).getRow(ACConstants.ROW_CODE_0).get(ACConstants.FIELD_VALUE)); } catch (PlatException e) {
block.setCell(ACConstants.ROW_CODE_0, ACConstants.PARAM_WH_CODE, outInfo.getBlock(ACConstants.WH_CODE_QUERY_BLOCK_ID).getRow(ACConstants.ROW_CODE_0).get(ACConstants.FIELD_VALUE)); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
outInfo.setBlock(InventTypeEnun.generatorEiBlock()); }
return outInfo; return inInfo;
} }
/** /**
...@@ -61,15 +64,29 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -61,15 +64,29 @@ public class ServiceHPKC002 extends ServiceBase {
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock);
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
String documentTime = inInfo.getCellStr(EiConstant.resultBlock,i,"documentTime"); this.checkSaveData(resultRows);
if(StringUtils.isNotBlank(documentTime)){ // 写入数据
inInfo.setCell(EiConstant.resultBlock,i,"documentTime", StringUtil.removeHorizontalLine(documentTime)); for (int i = 0; i < resultRows.size(); i++) {
} HPKC002 insertEntity = new HPKC002();
inInfo.setCell(EiConstant.resultBlock,i,"status", 1); insertEntity.fromMap(resultRows.get(i));
inInfo.setCell(EiConstant.resultBlock,i,"approvalStatus", 0); // 仓库名称
super.insert(inInfo,"HPKC002.insert"); Map params = new HashMap<>();
} params.put("whCode", insertEntity.getWhCode());
List query = dao.query("HPPZ007.queryByWhCode", params);
insertEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//物料类型
insertEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(insertEntity.getMaterialType()));
// 生成单据号
insertEntity.setDocumentCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
insertEntity.setStatus(1);
insertEntity.setApprovalStatus(0);
dao.insert("HPKC002.insert", insertEntity);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); inInfo.setMsg("操作失败!原因参见详细错误描述!");
...@@ -78,30 +95,53 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -78,30 +95,53 @@ public class ServiceHPKC002 extends ServiceBase {
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC002 entity = new HPKC002();
entity.fromMap(resultRows.get(i));
AssertUtils.isEmpty(entity.getMaterialType(), "物料类型不能为空");
AssertUtils.isEmpty(entity.getMaterialCode(), "物料不能为空");
AssertUtils.isEmpty(entity.getWhCode(), "仓库不能为空");
}
} }
/** /**
* 修改操作. * 修改操作.
*/ */
@Override @Override
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
try { try {
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); CommonMethod.udpateInfo(inInfo,EiConstant.resultBlock);
HPKC002 hpkc002 = new HPKC002(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); this.checkSaveData(resultRows);
for (int i = 0; i < eiBlock.getRowCount(); i++) { // 写入数据
Map<?, ?> map = eiBlock.getRow(i); for (int i = 0; i < resultRows.size(); i++) {
hpkc002.fromMap(map); HPKC002 updateEntity = new HPKC002();
String documentTime = inInfo.getCellStr(EiConstant.resultBlock,i,"documentTime"); updateEntity.fromMap(resultRows.get(i));
if(StringUtils.isNotBlank(documentTime)){ // 仓库名称
inInfo.setCell(EiConstant.resultBlock,i,"documentTime", StringUtil.removeHorizontalLine(documentTime)); Map params = new HashMap<>();
} params.put("whCode", updateEntity.getWhCode());
this.dao.update("HPKC002.update", hpkc002.toMap()); List query = dao.query("HPPZ007.queryByWhCode", params);
} updateEntity.setWhName(((HPPZ007) query.get(0)).getWhName());
//物料类型
updateEntity.setMaterialTypeName(InventTypeEnun.getNameByCode(updateEntity.getMaterialType()));
dao.insert("HPKC002.update", updateEntity);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); inInfo.setMsg("操作失败!原因参见详细错误描述!");
...@@ -109,7 +149,7 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -109,7 +149,7 @@ public class ServiceHPKC002 extends ServiceBase {
logError("修改失败", e.getMessage()); logError("修改失败", e.getMessage());
return inInfo; return inInfo;
} }
return query(inInfo); return inInfo;
} }
/** /**
...@@ -137,15 +177,4 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -137,15 +177,4 @@ public class ServiceHPKC002 extends ServiceBase {
eiInfo.setMsg("删除成功!"); eiInfo.setMsg("删除成功!");
return eiInfo; return eiInfo;
} }
public EiInfo queryMaterialTypeSetName(EiInfo eiInfo) {
eiInfo.setBlock(InventTypeEnun.generatorEiBlock());
return eiInfo;
}
public EiInfo queryWhCodeSetName(EiInfo eiInfo) {
CommonMethod.initBlock(eiInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
return eiInfo;
}
} }
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC001"> <sqlMap namespace="HPKC001">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001"> resultClass="com.baosight.hpjx.hp.kc.domain.HPKC001">
SELECT SELECT
...@@ -32,18 +55,7 @@ ...@@ -32,18 +55,7 @@
CUST_CODE as "custCode", <!-- 供应商编码 --> CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName" <!-- 供应商名称 --> CUST_NAME as "custName" <!-- 供应商名称 -->
FROM hpjx.t_hpkc001 WHERE 1=1 FROM hpjx.t_hpkc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -56,15 +68,7 @@ ...@@ -56,15 +68,7 @@
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc001 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
</select> </select>
<insert id="insert"> <insert id="insert">
......
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPKC002"> <sqlMap namespace="HPKC002">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialType">
MATERIAL_TYPE = #materialType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="materialCode">
MATERIAL_CODE = #materialCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" <select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002"> resultClass="com.baosight.hpjx.hp.kc.domain.HPKC002">
SELECT SELECT
...@@ -32,15 +55,7 @@ ...@@ -32,15 +55,7 @@
CUST_CODE as "custCode", <!-- 供应商编码 --> CUST_CODE as "custCode", <!-- 供应商编码 -->
CUST_NAME as "custName" <!-- 供应商名称 --> CUST_NAME as "custName" <!-- 供应商名称 -->
FROM hpjx.t_hpkc002 WHERE 1=1 FROM hpjx.t_hpkc002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -52,17 +67,10 @@ ...@@ -52,17 +67,10 @@
</select> </select>
<select id="count" resultClass="int"> <select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1 SELECT COUNT(*) FROM hpjx.t_hpkc002 WHERE 1=1
<isNotEmpty prepend=" AND " property="id"> <include refid="condition"/>
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentTime">
DOCUMENT_TIME = #documentTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="documentCode">
DOCUMENT_CODE LIKE CONCAT('%',CONCAT( #documentCode#,'%'))
</isNotEmpty>
</select> </select>
<insert id="insert"> <insert id="insert">
......
...@@ -15,10 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -15,10 +15,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/** /**
* @author:songx * @author:songx
...@@ -162,4 +159,23 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -162,4 +159,23 @@ public class ServiceHPPZ006 extends ServiceBase {
return inInfo; return inInfo;
} }
public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.INVENT_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
public EiInfo queryMaterialComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("inventType", eiInfo.getString("inventType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
} }
package com.baosight.hpjx.hp.pz.service; package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC007; import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.pz.domain.HPPZ007; import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -11,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -11,6 +13,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -132,4 +135,13 @@ public class ServiceHPPZ007 extends ServiceBase { ...@@ -132,4 +135,13 @@ public class ServiceHPPZ007 extends ServiceBase {
return inInfo; return inInfo;
} }
public EiInfo queryComboBox(EiInfo eiInfo) {
Map map = new HashMap();
map.put("whType", eiInfo.getString("whType"));
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.WH_RECORD_BLOCK_ID);
CommonMethod.initBlock(eiInfo, list, map);
return eiInfo;
}
} }
...@@ -36,9 +36,9 @@ $(function() { ...@@ -36,9 +36,9 @@ $(function() {
eiInfo.set("inventType", options.model["materialType"]); eiInfo.set("inventType", options.model["materialType"]);
var dataSource; var dataSource;
EiCommunicator.send("HPPZ006", "queryMaterialComboBox", eiInfo, { EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
dataSource = ei.getBlock("material_record_block_id").getMappedRows(); dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
materialCodeGlobalData = dataSource; materialCodeGlobalData = dataSource;
}, onFail: function (ei) { }, onFail: function (ei) {
} }
...@@ -139,21 +139,37 @@ $(function() { ...@@ -139,21 +139,37 @@ $(function() {
resultGrid.setCellValue(editorModel0, "unit", ""); resultGrid.setCellValue(editorModel0, "unit", "");
}); });
$("input[name='materialCode']").on('change', function (me) { $("input[name='materialCode']").on('change', function (me) {
var materialType = $("input[name='materialType']").val(); var materialCode = $("input[name='materialCode']").val();
var queryEiInfo = new EiInfo(); var queryEiInfo = new EiInfo();
queryEiInfo.set("inventType", materialType); queryEiInfo.set("inventCode", materialCode);
EiCommunicator.send("HPPZ006", "query", eiInfo, { EiCommunicator.send("HPPZ004", "query", eiInfo, {
onSuccess: function (eiInfo) { onSuccess: function (eiInfo) {
var status = eiInfo.getStatus(); var status = eiInfo.getStatus();
if (status != "-1") { if (status != "-1") {
console.log(eiInfo) console.log(eiInfo)
var materialName = eiInfo.blocks.result.rows[0][2]; var materialName = eiInfo.blocks.result.rows[0][14];
var materialCode = eiInfo.blocks.result.rows[0][3];
var spec = eiInfo.blocks.result.rows[0][6];
var unit = eiInfo.blocks.result.rows[0][12];
resultGrid.setCellValue(e.row, "materialCode", materialCode);
resultGrid.setCellValue(e.row, "materialName", materialName); resultGrid.setCellValue(e.row, "materialName", materialName);
resultGrid.setCellValue(e.row, "unit", unit); //清空物料信息
resultGrid.setCellValue(editorModel0, "spec", "");
resultGrid.setCellValue(editorModel0, "unit", "");
}
}, onFail: function (ei) {
}
}, {async: false});
});
$("input[name='spec']").on('change', function (me) {
var spec = $("input[name='spec']").val();
var materialCode = $("input[name='materialCode']").val();
var queryEiInfo = new EiInfo();
queryEiInfo.set("inventCode", materialCode);
queryEiInfo.set("spec", spec);
EiCommunicator.send("HPPZ006", "query", eiInfo, {
onSuccess: function (eiInfo) {
var status = eiInfo.getStatus();
if (status != "-1") {
console.log(eiInfo)
var unit = eiInfo.blocks.result.rows[0][23];
resultGrid.setCellValue(editorModel0, "unit", unit);
} }
}, onFail: function (ei) { }, onFail: function (ei) {
} }
...@@ -208,10 +224,21 @@ $(function() { ...@@ -208,10 +224,21 @@ $(function() {
}, },
onSuccess: function (e) { onSuccess: function (e) {
if (e.type != 'read') { if (e.type != 'read') {
// 新增、修改、删除的时候刷新页面 // 不显示notifications
resultGrid.dataSource.page(1); e.preventDefault();
// 重新查询Grid前,把新增、修改、删除操作成功的信息先弹出。
// 弹窗关闭后重新查询Grid
//resultGrid.dataSource.page(1);
IPLAT.alert({
// e.eiInfo 是EiInfo对象,可从浏览器F12的Console中查看。
message: e.eiInfo.getMsg(),
okFn: function (e) {
parent.window.location.href = IPLATUI.CONTEXT_PATH+'/web/HPKC001';
},
title: '成功'
});
} }
showPreview();
} }
}; };
...@@ -222,15 +249,16 @@ $(function() { ...@@ -222,15 +249,16 @@ $(function() {
*/ */
$(window).load(function () { $(window).load(function () {
// 存货名称 // 存货名称
let inInfo = new EiInfo(); let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ006", "queryMaterialComboBox", inInfo, { EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
materialCodeGlobalData = ei.getBlock("material_record_block_id").getMappedRows(); materialCodeGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
} }
}, {async: false}); }, {async: false});
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", inInfo, { let speceiInfo = new EiInfo();
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", speceiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows(); specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows();
}, },
...@@ -238,7 +266,8 @@ $(window).load(function () { ...@@ -238,7 +266,8 @@ $(window).load(function () {
} }
}, {async: false}); }, {async: false});
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, { let wheiInfo = new EiInfo();
EiCommunicator.send("HPPZ007", "queryComboBox", wheiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
whCodeGlobalData = ei.getBlock("wh_record_block_id").getMappedRows(); whCodeGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
}, },
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<div class="row"> <div class="row">
<EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" format="yyyy-MM-dd" required="true"/> <EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" format="yyyy-MM-dd" required="true"/>
<EF:EFInput ename="inqu_status-0-documentCode" cname="采购入库单号" colWidth="4" readonly="false"/> <EF:EFInput ename="inqu_status-0-documentCode" cname="采购入库单号" colWidth="4" readonly="false"/>
<EF:EFSelect cname="物料类型" blockId="inqu_status" ename="materialType" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" <EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称"
valueTemplate="#=textField#" filter="contains" valueTemplate="#=textField#" filter="contains"
required="false" defultValue="ALL" required="false" defultValue="ALL"
...@@ -18,6 +22,13 @@ ...@@ -18,6 +22,13 @@
<EF:EFOption label="请选择" value=""></EF:EFOption> <EF:EFOption label="请选择" value=""></EF:EFOption>
<EF:EFOptions blockId="whName_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="whName_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-materialCode" cname="物料名称"
valueTemplate="#=textField#" filter="contains"
required="false" defultValue="ALL"
template="#=textField#">
<EF:EFOption label="请选择" value=""></EF:EFOption>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -26,24 +37,15 @@ ...@@ -26,24 +37,15 @@
<EF:EFColumn ename="id" cname="主键id" hidden="true"/> <EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/> <EF:EFColumn ename="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/>
<EF:EFColumn ename="documentCode" cname="采购入库单号" width="100" readonly="false" align="center" required="false" enable="false" /> <EF:EFColumn ename="documentCode" cname="采购入库单号" width="100" readonly="false" align="center" required="false" enable="false" />
<EF:EFComboColumn ename="materialType" <EF:EFComboColumn ename="materialType" cname="物料类型" width="90" align="center">
cname="物料类型" <EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
columnTemplate="#=textField#"
itemTemplate="#=textField#"
blockName="customer_type_block_id"
textField="textField"
valueField="valueField"
align="center"
filter="contains"
width="100"
>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/> <EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/> <EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="materialCode" cname="物料编码" width="100" readonly="false" required="true"/> <EF:EFColumn ename="materialCode" cname="物料名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="materialName" cname="物料名称" width="100" readonly="false" enable="false" required="true"/> <EF:EFColumn ename="materialName" cname="物料名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/> <EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/>
<EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/> <EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/>
<EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/> <EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/>
<EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/> <EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/>
......
let materialCodeGlobalData = [];
let whCodeGlobalData = [];
let specGlobalData = [];
$(function() { $(function() {
var editorModel0 = ''; var editorModel0 = '';
var eiInfo = new EiInfo(); var eiInfo = new EiInfo();
var globalData = [];
var day1 = new Date();
day1.setTime(day1.getTime());
var s1 = day1.getFullYear() + "-" + (day1.getMonth() + 1) + "-" + day1.getDate();
$("#inqu_status-0-receiptDate").val(s1);
// 查询 // 查询
$("#QUERY").on("click", function () { $("#QUERY").on("click", function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询 resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}); });
IPLATUI.EFGrid = { IPLATUI.EFGrid.result = {
"result": { pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
},
columns: [ columns: [
{ {
field: "materialCode", field: "materialCode",
// template: function(dataItem) { template: function(dataItem) {
// for (var i = 0 ; i < globalData.length ; i++) { for (var i = 0 ; i < materialCodeGlobalData.length ; i++) {
// if ( globalData[i]['valueField'] === dataItem['materialCode']) { if ( materialCodeGlobalData[i]['valueField'] === dataItem['materialCode']) {
// return globalData[i]['textField']; return materialCodeGlobalData[i]['textField'];
// } }
// } }
// return ""; return "";
// }, },
editor: function (container, options) { editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid"); var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container); var cellIndex = grid.cellIndex(container);
...@@ -38,7 +39,7 @@ $(function() { ...@@ -38,7 +39,7 @@ $(function() {
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, { EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows(); dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
globalData = dataSource; materialCodeGlobalData = dataSource;
}, onFail: function (ei) { }, onFail: function (ei) {
} }
}, {async: false}); }, {async: false});
...@@ -51,138 +52,131 @@ $(function() { ...@@ -51,138 +52,131 @@ $(function() {
template: "#=textField#" template: "#=textField#"
}); });
}, },
},
{
field: "whCode",
template: function(dataItem) {
for (var i = 0 ; i < whCodeGlobalData.length ; i++) {
if ( whCodeGlobalData[i]['valueField'] === dataItem['whCode']) {
return whCodeGlobalData[i]['textField'];
} }
], }
onRowClick : function(e) { return "";
editorModel0 = e.row; },
$("input[name='whCode']").on('change', function (me) { editor: function (container, options) {
var whCode = $("input[name='whCode']").val(); var input = $('<input />');
var whCodeData; input.attr("name", options.field);
EiCommunicator.send("HPKC001", "queryWhCodeSetName", eiInfo, { input.attr("id", options.field);
input.appendTo(container);
var whEiInfo = new EiInfo();
whEiInfo.set("whType", options.model["materialType"]);
var dataSource;
EiCommunicator.send("HPPZ007", "queryComboBox", whEiInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
var queryData = ei.getBlock("wh_record_block_id").getMappedRows(); dataSource = ei.getBlock("wh_record_block_id").getMappedRows();
whCodeData = queryData; whCodeGlobalData = dataSource;
whCodeData.forEach(title => {
if(title.valueField == whCode){
var valueField = title.textField.substring(title.textField.lastIndexOf('-')+1);
resultGrid.setCellValue(editorModel0, "whName", valueField);
}
})
}, onFail: function (ei) { }, onFail: function (ei) {
} }
}, {async: false}); }, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
}); });
$("input[name='materialType']").on('change', function (me) { },
var materialType = $("input[name='materialType']").val(); },
var materialTypeData; {
EiCommunicator.send("HPKC001", "queryMaterialTypeSetName", eiInfo, { field: "spec",
onSuccess: function (ei) { template: function(dataItem) {
var queryData = ei.getBlock("customer_type_block_id").getMappedRows(); for (var i = 0 ; i < specGlobalData.length ; i++) {
materialTypeData = queryData; if ( specGlobalData[i]['valueField'] === dataItem['spec']) {
materialTypeData.forEach(title => { return specGlobalData[i]['textField'];
if(title.textField == materialType){
resultGrid.setCellValue(editorModel0, "materialTypeName", title.valueField);
} }
}) }
return "";
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
var specEiInfo = new EiInfo();
specEiInfo.set("inqu_status-0-inventCode", options.model["materialCode"]);
specEiInfo.set("inqu_status-0-inventType", options.model["materialType"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", specEiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_spec_block_id").getMappedRows();
specGlobalData = dataSource;
}, onFail: function (ei) { }, onFail: function (ei) {
} }
}, {async: false}); }, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
},
}
],
onRowClick : function(e) {
editorModel0 = e.row;
$("input[name='materialType']").on('change', function (me) {
//清空物料信息 //清空物料信息
resultGrid.setCellValue(editorModel0, "materialName", ""); resultGrid.setCellValue(editorModel0, "materialName", "");
resultGrid.setCellValue(editorModel0, "materialCode", ""); resultGrid.setCellValue(editorModel0, "materialCode", "");
resultGrid.setCellValue(editorModel0, "whCode", "");
resultGrid.setCellValue(editorModel0, "whName", "");
resultGrid.setCellValue(editorModel0, "spec", "");
resultGrid.setCellValue(editorModel0, "unit", "");
}); });
$("input[name='materialCode']").on('change', function (me) { $("input[name='materialCode']").on('change', function (me) {
var materialCode = $("input[name='materialCode']").val(); var materialCode = $("input[name='materialCode']").val();
var materialType = $("input[name='materialType']").val();
var queryEiInfo = new EiInfo(); var queryEiInfo = new EiInfo();
queryEiInfo.set("inventType", materialType); queryEiInfo.set("inventCode", materialCode);
var dataSource; EiCommunicator.send("HPPZ004", "query", eiInfo, {
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, { onSuccess: function (eiInfo) {
onSuccess: function (ei) { var status = eiInfo.getStatus();
var queryData = ei.getBlock("invent_name_block_id").getMappedRows(); if (status != "-1") {
dataSource = queryData; console.log(eiInfo)
dataSource.forEach(title => { var materialName = eiInfo.blocks.result.rows[0][14];
if(title.valueField == materialCode){ resultGrid.setCellValue(e.row, "materialName", materialName);
var valueField = title.textField.substring(title.textField.lastIndexOf('-')+1); //清空物料信息
resultGrid.setCellValue(editorModel0, "materialName", valueField); resultGrid.setCellValue(editorModel0, "spec", "");
} resultGrid.setCellValue(editorModel0, "unit", "");
}) }
}, onFail: function (ei) { }, onFail: function (ei) {
} }
}, {async: false}); }, {async: false});
}); });
}, $("input[name='spec']").on('change', function (me) {
loadComplete: function (grid) { var spec = $("input[name='spec']").val();
// 新增 var materialCode = $("input[name='materialCode']").val();
$("#BTN_INSERT").on("click", function () { var queryEiInfo = new EiInfo();
var btnNode = $(this); queryEiInfo.set("inventCode", materialCode);
//禁用按钮 queryEiInfo.set("spec", spec);
btnNode.attr("disabled", true); EiCommunicator.send("HPPZ006", "query", eiInfo, {
IPLAT.submitNode($("#HPKC002"), "HPKC002", "insert", { onSuccess: function (eiInfo) {
onSuccess: function (ei) { var status = eiInfo.getStatus();
if (ei["status"] == -1) { if (status != "-1") {
NotificationUtil(ei, "error"); console.log(eiInfo)
} else { var unit = eiInfo.blocks.result.rows[0][23];
// 绑定grid resultGrid.setCellValue(editorModel0, "unit", unit);
resultGrid.setEiInfo(ei);
NotificationUtil({
msg: '新增成功'
});
}
//释放禁用按钮
btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
},
onFail: function (ei) { // onFail 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
} }
}); }, onFail: function (ei) {
});
// 修改
$("#BTN_UPDATE").on("click", function () {
var rowCount = resultGrid.getCheckedRows();
// 检验是否选中数据
if (rowCount == null || rowCount == "") {
NotificationUtil({
msg : '请选择一条或多条数据'
}, "warning");
return false;
} }
var btnNode = $(this); }, {async: false});
//禁用按钮
btnNode.attr("disabled", true);
IPLAT.submitNode($("#HPKC002"), "HPKC002", "update", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '修改成功'
}); });
// 绑定grid
resultGrid.setEiInfo(ei);
}
//释放禁用按钮
btnNode.attr("disabled", false);
}, },
onFail: function (ei) { // onFail 表示失败回调函数 loadComplete: function (grid) {
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
//删除 //删除
$("#DELETE").on("click", function () { $("#DELETE").on("click", function () {
...@@ -214,6 +208,7 @@ $(function() { ...@@ -214,6 +208,7 @@ $(function() {
//释放禁用按钮 //释放禁用按钮
btnNode.attr("disabled", false); btnNode.attr("disabled", false);
resultGrid.dataSource.page(1);
}, },
onFail: function (ei) {// onFail onFail: function (ei) {// onFail
// 表示失败回调函数 // 表示失败回调函数
...@@ -226,12 +221,67 @@ $(function() { ...@@ -226,12 +221,67 @@ $(function() {
}); });
}); });
}
}, },
onSuccess: function (e) {
if (e.type != 'read') {
// 不显示notifications
e.preventDefault();
// 重新查询Grid前,把新增、修改、删除操作成功的信息先弹出。
// 弹窗关闭后重新查询Grid
//resultGrid.dataSource.page(1);
IPLAT.alert({
// e.eiInfo 是EiInfo对象,可从浏览器F12的Console中查看。
message: e.eiInfo.getMsg(),
okFn: function (e) {
parent.window.location.href = IPLATUI.CONTEXT_PATH+'/web/HPKC002';
},
title: '成功'
});
}
}
}; };
}); });
/**
* 页面加载时执行
*/
$(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
materialCodeGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
let speceiInfo = new EiInfo();
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", speceiInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
let wheiInfo = new EiInfo();
EiCommunicator.send("HPPZ007", "queryComboBox", wheiInfo, {
onSuccess: function (ei) {
whCodeGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<div class="row"> <div class="row">
<EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" format="yyyy-MM-dd" required="true"/> <EF:EFDatePicker ename="inqu_status-0-documentTime" cname="单据日期" format="yyyy-MM-dd" required="true"/>
<EF:EFInput ename="inqu_status-0-documentCode" cname="生产领料单号" colWidth="4" readonly="false"/> <EF:EFInput ename="inqu_status-0-documentCode" cname="生产领料单号" colWidth="4" readonly="false"/>
<EF:EFSelect cname="物料类型" blockId="inqu_status" ename="materialType" row="0" colWidth="3">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" <EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称"
valueTemplate="#=textField#" filter="contains" valueTemplate="#=textField#" filter="contains"
required="false" defultValue="ALL" required="false" defultValue="ALL"
...@@ -18,6 +22,13 @@ ...@@ -18,6 +22,13 @@
<EF:EFOption label="请选择" value=""></EF:EFOption> <EF:EFOption label="请选择" value=""></EF:EFOption>
<EF:EFOptions blockId="whName_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="whName_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-materialCode" cname="物料名称"
valueTemplate="#=textField#" filter="contains"
required="false" defultValue="ALL"
template="#=textField#">
<EF:EFOption label="请选择" value=""></EF:EFOption>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -25,39 +36,16 @@ ...@@ -25,39 +36,16 @@
<EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true"> <EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true">
<EF:EFColumn ename="id" cname="主键id" hidden="true"/> <EF:EFColumn ename="id" cname="主键id" hidden="true"/>
<EF:EFColumn ename="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/> <EF:EFColumn ename="documentTime" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyy-MM-dd']" width="100" required="true"/>
<EF:EFColumn ename="documentCode" cname="生产领料单号" width="100" readonly="false" align="center" required="true"/> <EF:EFColumn ename="documentCode" cname="生产领料单号" width="100" readonly="false" align="center" required="false" enable="false" />
<EF:EFComboColumn ename="whCode" <EF:EFComboColumn ename="materialType" cname="物料类型" width="90" align="center">
cname="仓库编码" <EF:EFCodeOption codeName="hpjx.hpkc.inventType" />
columnTemplate="#=textField#"
itemTemplate="#=textField#"
blockName="wh_record_block_id"
textField="textField"
valueField="valueField"
align="center"
filter="contains"
width="100"
required="true"
>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" width="120" readonly="true" align="center" enable="false" required="true"/>
<EF:EFComboColumn ename="materialType"
cname="物料类型"
columnTemplate="#=textField#"
itemTemplate="#=textField#"
blockName="customer_type_block_id"
textField="textField"
valueField="textField"
align="center"
filter="contains"
width="100"
required="true"
>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="materialTypeName" cname="物料类型名称" width="100" readonly="true" enable="false" required="true" /> <EF:EFColumn ename="whCode" cname="仓库名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="materialCode" cname="物料编码" width="100" readonly="false" required="true"/> <EF:EFColumn ename="whName" cname="仓库名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="materialName" cname="物料名称" width="100" readonly="false" required="true"/> <EF:EFColumn ename="materialCode" cname="物料名称" width="100" readonly="false" required="true"/>
<EF:EFColumn ename="materialName" cname="物料名称" width="100" readonly="false" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/> <EF:EFColumn ename="spec" cname="规格" width="120" readonly="false" align="center" required="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" required="true"/> <EF:EFColumn ename="unit" cname="单位" width="80" readonly="false" align="center" enable="false" required="true"/>
<EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/> <EF:EFColumn ename="quantity" cname="数量" width="80" defaultValue="0" data-regex="/^[0-9]\\\d*$/" data-errorprompt="请输入正整数" readonly="false" align="right" required="true"/>
<EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/> <EF:EFColumn ename="weight" cname="重量" defaultValue="0" data-rules="number" maxLength="20" width="100" align="right" readonly="false"/>
<EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/> <EF:EFColumn ename="remarks" cname="备注" width="100" readonly="false"/>
......
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