Commit be982b8d by yukang

Merge branch 'dev' of https://gitlab.baocloud.cn/bggf/smart/hp-smart into dev

# Conflicts:
#	src/main/java/com/baosight/hpjx/hp/sc/service/ServiceHPSC005A.java
parents 60f240e6 acd22d14
......@@ -56,7 +56,7 @@ public enum DdynamicEnum {
* 编写:wwl
*/
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick",
"HPPZ006.queryComboBoxAll"),
"coefficient", "HPPZ006.queryComboBoxAll"),
/**
* 模块:存货档案部件名称
......@@ -220,6 +220,8 @@ public enum DdynamicEnum {
private String param4;
private String param5;
private String param6;
/** 数据源 */
private final String dbSource;
......@@ -272,6 +274,20 @@ public enum DdynamicEnum {
this.param5 = param5;
this.dbSource = dbSource;
}
DdynamicEnum(String blockId, String value, String text, String param1, String param2, String param3, String param4,
String param5, String param6,String dbSource) {
this.blockId = blockId;
this.value = value;
this.text = text;
this.param1 = param1;
this.param2 = param2;
this.param3 = param3;
this.param4 = param4;
this.param5 = param5;
this.param6 = param6;
this.dbSource = dbSource;
}
DdynamicEnum(String blockId, String value, String text, String dbSource){
this.blockId = blockId;
......@@ -337,4 +353,12 @@ public enum DdynamicEnum {
public void setParam5(String param5) {
this.param5 = param5;
}
public String getParam6() {
return param6;
}
public void setParam6(String param6) {
this.param6 = param6;
}
}
......@@ -50,7 +50,9 @@ public class HPConstants {
/** 前后台交互下拉框字段 字段名 dzg */
public static final String PARAM5_FIELD = "param5Field";
/** 前后台交互下拉框字段 字段名 dzg */
public static final String PARAM6_FIELD = "param6Field";
/** 前后台交互下拉框字段 字段名 dzg */
public static final String VALUE_FIELD = "valueField";
......
......@@ -89,7 +89,7 @@ public class HPKC001 extends DaoEPBase {
private String receiptDate = " "; /* 单据日期*/
private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/
private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId; /* 存货档案ID*/
......@@ -430,7 +430,7 @@ public class HPKC001 extends DaoEPBase {
* get the inventType - 存货类型.
* @return the inventType
*/
public String getInventType() {
public Integer getInventType() {
return this.inventType;
}
......@@ -439,7 +439,7 @@ public class HPKC001 extends DaoEPBase {
*
* @param inventType - 存货类型
*/
public void setInventType(String inventType) {
public void setInventType(Integer inventType) {
this.inventType = inventType;
}
/**
......@@ -607,7 +607,7 @@ public class HPKC001 extends DaoEPBase {
setReceiptDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIPT_DATE)), receiptDate));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
......
......@@ -8,6 +8,7 @@ import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
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;
......@@ -16,6 +17,7 @@ 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.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -80,6 +82,8 @@ public class ServiceHPKC001 extends ServiceBase {
inInfo = super.query(inInfo, HPKC001.QUERY, new HPKC001());
// List sum = dao.query(HPSqlConstant.HPKC001.QUERY_SUM, queryRow);
// inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
// 设置规格信息
HPPZTools.HpPz006.setSpecInfo(inInfo, HPKC001.FIELD_INVENT_RECORD_ID);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -118,8 +122,10 @@ public class ServiceHPKC001 extends ServiceBase {
for (Map resultRow : resultRows) {
HPKC001 fKc001 = new HPKC001();
fKc001.fromMap(resultRow);
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
if (fKc001.getId() == null || fKc001.getId() == 0) {
this.addData(fKc001);
this.addData(fKc001, fPz006);
} else {
// TODO 采购入库不支持修改
}
......@@ -130,12 +136,25 @@ public class ServiceHPKC001 extends ServiceBase {
* 写入数据
*
* @param fKc001
* @param fPz006
*/
private void addData(HPKC001 fKc001) {
private void addData(HPKC001 fKc001, HPPZ006 fPz006) {
// 设置基础信息
this.setBaseInfo(fKc001);
// 检查存货名称是新增还是已存在
if (StringUtils.isBlank(fKc001.getInventCode())) {
String inventCode = HPPZTools.HpPz004.checkAndSave(fKc001.getInventType(), fKc001.getInventName());
fKc001.setInventCode(inventCode);
fPz006.setInventCode(inventCode);
}
// 检查规格是否已存在,不存在就新增
HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fPz006);
fKc001.setInventRecordId(dbPz006.getId());
// 计算重量
this.calcWeight(fKc001);
// 生成入库单号
fKc001.setPurchaseNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC001_NUMBER));
fKc001.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC001.INSERT, fKc001);
// 修改库存
HPKCTools.updateStock(fKc001.getWhCode(), fKc001.getInventRecordId(), fKc001.getAmount(),
......@@ -152,10 +171,8 @@ public class ServiceHPKC001 extends ServiceBase {
HPKC001 fKc001 = new HPKC001();
fKc001.fromMap(resultRow);
AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空");
AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空");
// AssertUtils.isNull(fKc001.getInventRecordId(), "规格不能为空");
// AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getWeight(), "重量必须大于0");
}
}
......@@ -170,7 +187,15 @@ public class ServiceHPKC001 extends ServiceBase {
// 仓库名称
fKc001.setWhName(HPPZTools.HpPz007.getByCode(fKc001.getWhCode()).getWhName());
// 存货名称
fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
// fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
}
/**
* 计算重量
*
* @param fKc001
*/
private void calcWeight(HPKC001 fKc001) {
// 根据规格计算单重
fKc001.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(fKc001.getInventRecordId()));
// 计算总重
......
......@@ -104,8 +104,10 @@ public class ServiceHPKC002 extends ServiceBase {
HPKC002 dbKc002 = dbMapKc002.get(fKc002.getReqNo());
HPKC002 newKc002 = BeanUtils.copy(dbKc002, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setAmount(dbKc002.getAmount());
newKc002.setWeight(dbKc002.getWeight());
newKc002.setAmount(dbKc002.getAmount().negate());
newKc002.setWeight(dbKc002.getWeight().negate());
newKc002.setProjCode(dbKc002.getProjCode());
newKc002.setHpsc006Id(dbKc002.getHpsc006Id());
newKc002.setOldReqNo(dbKc002.getReqNo());
newKc002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC002.INSERT, newKc002);
......
......@@ -109,6 +109,8 @@ public class ServiceHPKC004 extends ServiceBase {
newKc004.setAmount(dbKc004.getAmount().negate());
newKc004.setWeight(dbKc004.getWeight().negate());
newKc004.setOldSaleNo(dbKc004.getSaleNo());
newKc004.setProjCode(dbKc004.getProjCode());
newKc004.setProjName(dbKc004.getProjName());
newKc004.setIsPrint(CommonConstant.YesNo.NO_0);
newKc004.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC004.INSERT, newKc004);
......
......@@ -18,6 +18,7 @@ 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.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -83,6 +84,8 @@ public class ServiceHPKC006 extends ServiceBase {
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));
// 设置规格信息
HPPZTools.HpPz006.setSpecInfo(inInfo, HPKC006.FIELD_INVENT_RECORD_ID);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......@@ -105,8 +108,10 @@ public class ServiceHPKC006 extends ServiceBase {
for (Map resultRow : resultRows) {
HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRow);
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
if (fKc006.getId() == null || fKc006.getId() == 0) {
this.add(fKc006);
this.add(fKc006, fPz006);
} else {
// TODO 库存不支持修改
}
......@@ -124,18 +129,20 @@ public class ServiceHPKC006 extends ServiceBase {
* 新增操作
*
* @param fKc006
* @param fPz006
* @return
*/
private void add(HPKC006 fKc006) {
private void add(HPKC006 fKc006, HPPZ006 fPz006) {
// 设置基础信息
this.setBaseInfo(fKc006);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
// 检查存货名称是新增还是已存在
if (StringUtils.isBlank(fKc006.getInventCode())) {
String inventCode = HPPZTools.HpPz004.checkAndSave(fKc006.getInventType(), fKc006.getInventName());
fKc006.setInventCode(inventCode);
fPz006.setInventCode(inventCode);
}
// 检查规格,如果不存在就新增
HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fKc006.getInventType(), fKc006.getInventName(),
fKc006.getLength(), fKc006.getWidth(), fKc006.getThick(), fKc006.getCoefficient(), fKc006.getMaterial(),
fKc006.getUnit()
);
HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fPz006);
// 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(dbPz006));
// 计算总重
......@@ -143,6 +150,8 @@ public class ServiceHPKC006 extends ServiceBase {
fKc006.setInventRecordId(dbPz006.getId());
fKc006.setInventCode(dbPz006.getInventCode());
fKc006.setDeleteFlag(CommonConstant.YesNo.NO_0);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
DaoUtils.insert(HPKC006.INSERT, fKc006);
// 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(),
......
......@@ -61,7 +61,7 @@ public class ServiceHPPZ006 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPPZ006.query", new HPPZ006());
inInfo = super.query(inInfo, HPPZ006.QUERY, new HPPZ006());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -266,6 +266,7 @@
LENGTH AS "length" , <!-- 长 -->
WIDTH AS "width" , <!-- 宽 -->
THICK AS "thick" , <!-- 厚 -->
COEFFICIENT AS "coefficient" , <!-- 系数 -->
MATERIAL AS "material" , <!-- 材质 -->
UNIT AS "unit" <!-- 单位 -->
FROM hpjx.t_hppz006
......
......@@ -287,18 +287,40 @@ public class HPPZTools {
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
AssertUtils.isNull(results, String.format("规格[%s]不存在", id));
AssertUtils.isEmpty(results, String.format("规格[%s]不存在", id));
return results.get(0);
}
/**
* 查询
*
* @param inventCode
* @param spec
* @return
*/
public static HPPZ006 getBySpec(String inventCode, String spec) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
if (StringUtils.isBlank(spec)) {
queryMap.put("notSpec", CommonConstant.YesNo.YES);
} else {
queryMap.put("spec", spec);
}
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
/**
* 查询
*
* @param ids
* @return
*/
public static List<HPPZ006> list(List<Long> ids) {
AssertUtils.isNull(ids, "规格ID不能为空");
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
......@@ -360,6 +382,19 @@ public class HPPZTools {
/**
* 拼接规格
*
* @param pz006
*/
public static void jointSpec(HPPZ006 pz006) {
if (StringUtils.isNotBlank(pz006.getSpec())) {
return;
}
pz006.setSpec(jointSpec(pz006.getLength(), pz006.getWidth(), pz006.getThick()));
}
/**
* 拼接规格
*
* @param length
* @param width
* @param thick
......@@ -386,6 +421,26 @@ public class HPPZTools {
}
/**
* 检查不存在就新增
*
* @param newPz006
* @return
*/
public static HPPZ006 checkAndSave(HPPZ006 newPz006) {
// 检查存货名称是否存在
jointSpec(newPz006);
HPPZ006 specPz006 = getBySpec(newPz006.getInventCode(), newPz006.getSpec());
if (specPz006 != null) {
return specPz006;
} else {
// 生成编码
newPz006.setStatus(CommonConstant.YesNo.YES_1.intValue());
DaoUtils.insert(HPPZ006.INSERT, newPz006);
return newPz006;
}
}
/**
* 判断存货档案是否存在,如果存在返回存货档案,否则新增并返回存货档案
*
* @param inventType 存货类型
......@@ -433,13 +488,7 @@ public class HPPZTools {
*/
public static void setSpecInfo(EiInfo inInfo, String idName) {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
if (CollectionUtils.isEmpty(resultRows)) {
return;
}
List<Long> ids = ObjectUtils.listKey(resultRows, idName);
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map<Long, HPPZ006> resultMap = map(ids);
if (MapUtils.isEmpty(resultMap)) {
return;
......@@ -447,10 +496,18 @@ public class HPPZTools {
for (Map resultRow : resultRows) {
Long id = MapUtils.getLong(resultRow, idName);
HPPZ006 dbPz006 = resultMap.get(id);
resultRow.put(HPPZ006.FIELD_SPEC, dbPz006 == null ? "" : dbPz006.getSpec());
if (dbPz006 == null) {
resultRow.put(HPPZ006.FIELD_SPEC, "");
} else {
resultRow.put(HPPZ006.FIELD_SPEC, "".equals(StringUtils.trim(dbPz006.getSpec()))
? "无规格" : dbPz006.getSpec());
}
resultRow.put(HPPZ006.FIELD_LENGTH, dbPz006 == null ? "" : dbPz006.getLength());
resultRow.put(HPPZ006.FIELD_WIDTH, dbPz006 == null ? "" : dbPz006.getWidth());
resultRow.put(HPPZ006.FIELD_THICK, dbPz006 == null ? "" : dbPz006.getThick());
resultRow.put(HPPZ006.FIELD_COEFFICIENT, dbPz006 == null ? "" : dbPz006.getCoefficient());
resultRow.put(HPPZ006.FIELD_MATERIAL, dbPz006 == null ? "" : dbPz006.getMaterial());
resultRow.put(HPPZ006.FIELD_UNIT, dbPz006 == null ? "" : dbPz006.getUnit());
}
}
......
......@@ -84,7 +84,7 @@ public class CommonMethod {
row.put(HPConstants.PARAM3_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam6())));
} else {
row.put(HPConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText())));
row.put(HPConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1())));
......@@ -92,6 +92,7 @@ public class CommonMethod {
row.put(HPConstants.PARAM3_FIELD, String.valueOf(tryValue.get(tableParam.getParam3())));
row.put(HPConstants.PARAM4_FIELD, String.valueOf(tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5())));
row.put(HPConstants.PARAM6_FIELD, String.valueOf(tryValue.get(tableParam.getParam6())));
}
resultRows.add(row);
}
......
package com.baosight.hpjx.util;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -110,6 +112,9 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
* @return
*/
public static <T> List<T> listKey(List<Map> items, String keyName) {
if (CollectionUtils.isEmpty(items)) {
return null;
}
return items.stream().map(item -> (T) item.get(keyName)).filter(ObjectUtils::isNotBlank).distinct()
.collect(Collectors.toList());
}
......
......@@ -40,27 +40,31 @@ $(function() {
refreshSelect(container, inInfo);
}
}, {
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
// 1.原料,2.耗材
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
field: "inventName",
title: "存货名称",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['textField'] === dataItem['inventName']) {
dataItem['inventCode'] = inventNameGlobalData[i]['valueField']
return inventNameGlobalData[i]['textField'];
} else {
dataItem['inventCode'] = '';
}
}
return dataItem['inventName'];
},
editor: function (container, options) {
let inInfo = new EiInfo();
// 1.原料,2.耗材,5.废料
inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ004");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "invent_name_block_id");
inInfo.set("field", options.field);
refreshInputSelect(container, inInfo);
}
}, {
field: "spec",
template: function (dataItem) {
......@@ -83,73 +87,50 @@ $(function() {
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
refreshInputSelect(container, inInfo);
}
}, {
field: "unitWeight",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "weight",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "length",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param3Field'];
}
}
return "";
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "width",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param4Field'];
}
}
return "";
template: function (options) {
return options.width == 0 ? "-" : options.width;
}
}, {
field: "thick",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param5Field'];
}
}
return "";
template: function (options) {
return options.thick == 0 ? "-" : options.thick;
}
}, {
field: "material",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param1Field'];
}
}
return "";
}
}, {
field: "unit",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param2Field'];
}
}
return "";
}
}],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
if (e.field == "inventRecordId") {
if (e.field == "spec") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field'])
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field'])
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field'])
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field'])
if (inventAllGlobalData[i]['textField'] === item.spec) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field']);
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field']);
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field']);
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field']);
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field']);
resultGrid.setCellValue(item, 'coefficient', inventAllGlobalData[i]['param6Field']);
resultGrid.refresh();
}
}
}
......@@ -265,18 +246,29 @@ let save = function () {
message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return;
}
if (isBlank(rows[i]['inventCode'])) {
if (isBlank(rows[i]['inventName'])) {
message("勾选的第" + (i + 1) + "行存货名称不能为空");
return;
}
if (isBlank(rows[i]['inventRecordId'])) {
message("勾选的第" + (i + 1) + "行规格不能为空");
return;
}
if (!isPositiveInteger(rows[i]['amount'])) {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
return;
}
let length = rows[i]['length'];
if (!isBlank(length) && (!isNumber(length) || length < 0)) {
message("勾选的第" + (i + 1) + "行长必须是不小于0的数字");
return;
}
let width = rows[i]['width'];
if (!isBlank(width) && (!isNumber(width) || width < 0)) {
message("勾选的第" + (i + 1) + "行宽必须是不小于0的数字");
return;
}
let thick = rows[i]['thick'];
if (!isBlank(width) && (!isNumber(thick) || thick < 0)) {
message("勾选的第" + (i + 1) + "行厚必须是不小于0的数字");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
......
......@@ -44,28 +44,30 @@
</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" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="purchaseNo" cname="采购单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="90" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
<EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" 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"/>
<EF:EFColumn ename="length" cname="长(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<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="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量(KG)" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N3}" readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
......
......@@ -68,7 +68,10 @@
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N0}" maxLength="20" width="100"
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" format="{0:N0}" maxLength="20" width="100"
align="right"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right"/>
......
......@@ -46,6 +46,9 @@
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" width="300" align="center" defaultValue="" required="true"
filter="contains" >
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField" />
......
......@@ -45,6 +45,9 @@
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="20" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="projCode" cname="项目名称" width="300" align="center" defaultValue="" required="true"
filter="contains" >
<EF:EFOptions blockId="proj_record_block_id" valueField="valueField" textField="textField" />
......
......@@ -66,8 +66,13 @@ let select = function () {
}
for (let i = 0; i < rows.length; i++) {
let entityAmount = rows[i]['entityAmount'];
let amount = rows[i]['amount'];
if (!isPositiveInteger(entityAmount)) {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
message("勾选的第" + (i + 1) + "行实物数量必须是大于0的整数");
return;
}
if (parseFloat(entityAmount) > parseFloat(amount)) {
message("第" + (i + 1) + "行实物数量不能大于库存数量");
return;
}
}
......
......@@ -69,14 +69,17 @@ $(function() {
refreshInputSelect(container, inInfo);
}
}, {
field: "inventRecordId",
field: "spec",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
if (inventAllGlobalData[i]['textField'] === dataItem['spec']) {
dataItem['inventRecordId'] = inventAllGlobalData[i]['valueField']
return inventAllGlobalData[i]['textField'];
} else {
dataItem['inventRecordId'] = '';
}
}
return "";
return dataItem['spec'] == null ? "" : dataItem['spec'];
},
editor: function (container, options) {
let inInfo = new EiInfo();
......@@ -87,7 +90,32 @@ $(function() {
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
refreshInputSelect(container, inInfo);
}
}, {
field: "unitWeight",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "weight",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "width",
template: function (options) {
return options.width == 0 ? "-" : options.width;
}
}, {
field: "thick",
template: function (options) {
return options.thick == 0 ? "-" : options.thick;
}
}],
loadComplete: function (grid) {
......@@ -98,30 +126,21 @@ $(function() {
save();
},
afterEdit: function (e) {
if (e.field === "inventRecordId") {
let inventRecordId = e.model.inventRecordId;
if (isBlank(inventRecordId)) {
return;
}
let inInfo = new EiInfo();
// ID为空的情况下需要返回一条空数据
inInfo.set("inqu_status-0-id", inventRecordId);
EiCommunicator.send("HPPZ006", "query", inInfo, {
onSuccess: function (ei) {
let data = ei.blocks.result.rows;
if (data.length > 0) {
resultGrid.setCellValue(e.model, "length", data[0][8])
resultGrid.setCellValue(e.model, "width", data[0][9])
resultGrid.setCellValue(e.model, "thick", data[0][10])
resultGrid.setCellValue(e.model, "material", data[0][11])
resultGrid.setCellValue(e.model, "coefficient", data[0][12])
resultGrid.setCellValue(e.model, "unit", data[0][13])
}
firstLoad = 0;
},
onFail: function (ei) {
if (e.field == "spec") {
var tr,index;
// 获取此model元素信息
var item = e.model;
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['textField'] === item.spec) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field']);
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field']);
resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field']);
resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field']);
resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field']);
resultGrid.setCellValue(item, 'coefficient', inventAllGlobalData[i]['param6Field']);
resultGrid.refresh();
}
}, {async: false});
}
}
},
onSuccess: function (e) {
......@@ -231,7 +250,7 @@ let save = function () {
message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return;
}
if (isBlank(rows[i]['inventCode'])) {
if (isBlank(rows[i]['inventName'])) {
message("勾选的第" + (i + 1) + "行存货名称不能为空");
return;
}
......@@ -239,6 +258,21 @@ let save = function () {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
return;
}
let length = rows[i]['length'];
if (!isBlank(length) && (!isNumber(length) || length < 0)) {
message("勾选的第" + (i + 1) + "行长必须是不小于0的数字");
return;
}
let width = rows[i]['width'];
if (!isBlank(width) && (!isNumber(width) || width < 0)) {
message("勾选的第" + (i + 1) + "行宽必须是不小于0的数字");
return;
}
let thick = rows[i]['thick'];
if (!isBlank(width) && (!isNumber(thick) || thick < 0)) {
message("勾选的第" + (i + 1) + "行厚必须是不小于0的数字");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
......
......@@ -48,28 +48,28 @@
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
<EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '5')"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"
hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center" 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="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" width="100" align="right" format="{0:N3}"
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="重量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="length" cname="长" width="120" align="center" format="{0:N3}" required="false"
<EF:EFColumn ename="length" cname="长" width="100" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="width" cname="宽" width="120" align="center" format="{0:N3}" required="false"
<EF:EFColumn ename="width" cname="宽" width="100" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="thick" cname="厚" width="120" align="center" format="{0:N3}" required="false"
<EF:EFColumn ename="thick" cname="厚" width="100" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="120" align="center" format="{0:N3}" required="false"
<EF:EFColumn ename="material" cname="材质" width="80" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="center" format="{0:N3}" required="false"
readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" maxLength="255" readonly="true"/>
......
......@@ -10,6 +10,11 @@ $(function() {
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "spec",
template: function (options) {
return $.trim(options.spec) == "" ? "无规格" : options.spec;
}
}, {
field: "length",
template: function (options) {
return options.length == 0 ? "-" : options.length;
......
......@@ -45,6 +45,16 @@ function isPositiveInteger(input) {
}
/**
* 正数校验
*
* @param input
* @returns {boolean}
*/
function isPositiveNumber(input) {
return !isBlank(input) && isNumber(input) && (input > 0);
}
/**
* 消息提示
*
* @param msg
......
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