Commit d95e51b2 by 宋祥

1.其他入库规格可编辑,采购入库存货名称可编辑

parent c3aba608
...@@ -89,7 +89,7 @@ public class HPKC001 extends DaoEPBase { ...@@ -89,7 +89,7 @@ public class HPKC001 extends DaoEPBase {
private String receiptDate = " "; /* 单据日期*/ private String receiptDate = " "; /* 单据日期*/
private String whCode = " "; /* 仓库编码*/ private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/ private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/ private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private Long inventRecordId; /* 存货档案ID*/ private Long inventRecordId; /* 存货档案ID*/
...@@ -430,7 +430,7 @@ public class HPKC001 extends DaoEPBase { ...@@ -430,7 +430,7 @@ public class HPKC001 extends DaoEPBase {
* get the inventType - 存货类型. * get the inventType - 存货类型.
* @return the inventType * @return the inventType
*/ */
public String getInventType() { public Integer getInventType() {
return this.inventType; return this.inventType;
} }
...@@ -439,7 +439,7 @@ public class HPKC001 extends DaoEPBase { ...@@ -439,7 +439,7 @@ public class HPKC001 extends DaoEPBase {
* *
* @param inventType - 存货类型 * @param inventType - 存货类型
*/ */
public void setInventType(String inventType) { public void setInventType(Integer inventType) {
this.inventType = inventType; this.inventType = inventType;
} }
/** /**
...@@ -607,7 +607,7 @@ public class HPKC001 extends DaoEPBase { ...@@ -607,7 +607,7 @@ public class HPKC001 extends DaoEPBase {
setReceiptDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIPT_DATE)), receiptDate)); setReceiptDate(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_RECEIPT_DATE)), receiptDate));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode)); setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName)); 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)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId)); setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
......
...@@ -17,6 +17,7 @@ import com.baosight.hpjx.util.EiInfoUtils; ...@@ -17,6 +17,7 @@ import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil; 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.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;
...@@ -140,6 +141,12 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -140,6 +141,12 @@ public class ServiceHPKC001 extends ServiceBase {
private void addData(HPKC001 fKc001, HPPZ006 fPz006) { private void addData(HPKC001 fKc001, HPPZ006 fPz006) {
// 设置基础信息 // 设置基础信息
this.setBaseInfo(fKc001); 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); HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fPz006);
fKc001.setInventRecordId(dbPz006.getId()); fKc001.setInventRecordId(dbPz006.getId());
...@@ -164,9 +171,8 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -164,9 +171,8 @@ public class ServiceHPKC001 extends ServiceBase {
HPKC001 fKc001 = new HPKC001(); HPKC001 fKc001 = new HPKC001();
fKc001.fromMap(resultRow); fKc001.fromMap(resultRow);
AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空"); AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空");
AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空"); // AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0"); AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getWeight(), "重量必须大于0");
} }
} }
...@@ -181,7 +187,7 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -181,7 +187,7 @@ public class ServiceHPKC001 extends ServiceBase {
// 仓库名称 // 仓库名称
fKc001.setWhName(HPPZTools.HpPz007.getByCode(fKc001.getWhCode()).getWhName()); fKc001.setWhName(HPPZTools.HpPz007.getByCode(fKc001.getWhCode()).getWhName());
// 存货名称 // 存货名称
fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName()); // fKc001.setInventName(HPPZTools.HpPz004.getByCode(fKc001.getInventCode()).getInventName());
} }
/** /**
......
...@@ -18,6 +18,7 @@ import com.baosight.hpjx.util.EiInfoUtils; ...@@ -18,6 +18,7 @@ import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil; 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.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;
...@@ -83,6 +84,8 @@ public class ServiceHPKC006 extends ServiceBase { ...@@ -83,6 +84,8 @@ public class ServiceHPKC006 extends ServiceBase {
inInfo = super.query(inInfo, HPKC006.QUERY, new HPKC006()); inInfo = super.query(inInfo, HPKC006.QUERY, new HPKC006());
List sum = dao.query(HPSqlConstant.HPKC006.QUERY_SUM, queryRow); List sum = dao.query(HPSqlConstant.HPKC006.QUERY_SUM, queryRow);
inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0)); inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
// 设置规格信息
HPPZTools.HpPz006.setSpecInfo(inInfo, HPKC006.FIELD_INVENT_RECORD_ID);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -105,8 +108,10 @@ public class ServiceHPKC006 extends ServiceBase { ...@@ -105,8 +108,10 @@ public class ServiceHPKC006 extends ServiceBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPKC006 fKc006 = new HPKC006(); HPKC006 fKc006 = new HPKC006();
fKc006.fromMap(resultRow); fKc006.fromMap(resultRow);
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
if (fKc006.getId() == null || fKc006.getId() == 0) { if (fKc006.getId() == null || fKc006.getId() == 0) {
this.add(fKc006); this.add(fKc006, fPz006);
} else { } else {
// TODO 库存不支持修改 // TODO 库存不支持修改
} }
...@@ -124,18 +129,20 @@ public class ServiceHPKC006 extends ServiceBase { ...@@ -124,18 +129,20 @@ public class ServiceHPKC006 extends ServiceBase {
* 新增操作 * 新增操作
* *
* @param fKc006 * @param fKc006
* @param fPz006
* @return * @return
*/ */
private void add(HPKC006 fKc006) { private void add(HPKC006 fKc006, HPPZ006 fPz006) {
// 设置基础信息 // 设置基础信息
this.setBaseInfo(fKc006); 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(), HPPZ006 dbPz006 = HPPZTools.HpPz006.checkAndSave(fPz006);
fKc006.getLength(), fKc006.getWidth(), fKc006.getThick(), fKc006.getCoefficient(), fKc006.getMaterial(),
fKc006.getUnit()
);
// 根据规格计算单重 // 根据规格计算单重
fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(dbPz006)); fKc006.setUnitWeight(HPPZTools.HpPz006.calcUnitWeight(dbPz006));
// 计算总重 // 计算总重
...@@ -143,6 +150,8 @@ public class ServiceHPKC006 extends ServiceBase { ...@@ -143,6 +150,8 @@ public class ServiceHPKC006 extends ServiceBase {
fKc006.setInventRecordId(dbPz006.getId()); fKc006.setInventRecordId(dbPz006.getId());
fKc006.setInventCode(dbPz006.getInventCode()); fKc006.setInventCode(dbPz006.getInventCode());
fKc006.setDeleteFlag(CommonConstant.YesNo.NO_0); fKc006.setDeleteFlag(CommonConstant.YesNo.NO_0);
// 生成入库单号
fKc006.setOtherEnterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_ENTER_NO));
DaoUtils.insert(HPKC006.INSERT, fKc006); DaoUtils.insert(HPKC006.INSERT, fKc006);
// 修改库存 // 修改库存
HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(), HPKCTools.updateStock(fKc006.getWhCode(), fKc006.getInventRecordId(), fKc006.getAmount(),
......
...@@ -61,7 +61,7 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -61,7 +61,7 @@ public class ServiceHPPZ006 extends ServiceBase {
@Override @Override
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, "HPPZ006.query", new HPPZ006()); inInfo = super.query(inInfo, HPPZ006.QUERY, new HPPZ006());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
......
...@@ -318,7 +318,9 @@ public class HPPZTools { ...@@ -318,7 +318,9 @@ public class HPPZTools {
* @return * @return
*/ */
public static List<HPPZ006> list(List<Long> ids) { public static List<HPPZ006> list(List<Long> ids) {
AssertUtils.isNull(ids, "规格ID不能为空"); if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("ids", ids); queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPPZ006.QUERY, queryMap); return DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
...@@ -489,13 +491,7 @@ public class HPPZTools { ...@@ -489,13 +491,7 @@ public class HPPZTools {
*/ */
public static void setSpecInfo(EiInfo inInfo, String idName) { public static void setSpecInfo(EiInfo inInfo, String idName) {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
if (CollectionUtils.isEmpty(resultRows)) {
return;
}
List<Long> ids = ObjectUtils.listKey(resultRows, idName); List<Long> ids = ObjectUtils.listKey(resultRows, idName);
if (CollectionUtils.isEmpty(ids)) {
return;
}
Map<Long, HPPZ006> resultMap = map(ids); Map<Long, HPPZ006> resultMap = map(ids);
if (MapUtils.isEmpty(resultMap)) { if (MapUtils.isEmpty(resultMap)) {
return; return;
...@@ -513,6 +509,8 @@ public class HPPZTools { ...@@ -513,6 +509,8 @@ public class HPPZTools {
resultRow.put(HPPZ006.FIELD_WIDTH, dbPz006 == null ? "" : dbPz006.getWidth()); resultRow.put(HPPZ006.FIELD_WIDTH, dbPz006 == null ? "" : dbPz006.getWidth());
resultRow.put(HPPZ006.FIELD_THICK, dbPz006 == null ? "" : dbPz006.getThick()); resultRow.put(HPPZ006.FIELD_THICK, dbPz006 == null ? "" : dbPz006.getThick());
resultRow.put(HPPZ006.FIELD_COEFFICIENT, dbPz006 == null ? "" : dbPz006.getCoefficient()); 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());
} }
} }
......
package com.baosight.hpjx.util; package com.baosight.hpjx.util;
import org.apache.commons.collections.CollectionUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -110,6 +112,9 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils { ...@@ -110,6 +112,9 @@ public class ObjectUtils extends org.apache.commons.lang.ObjectUtils {
* @return * @return
*/ */
public static <T> List<T> listKey(List<Map> items, String keyName) { 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() return items.stream().map(item -> (T) item.get(keyName)).filter(ObjectUtils::isNotBlank).distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
......
...@@ -40,27 +40,31 @@ $(function() { ...@@ -40,27 +40,31 @@ $(function() {
refreshSelect(container, inInfo); refreshSelect(container, inInfo);
} }
}, { }, {
field: "inventCode", field: "inventName",
template: function (dataItem) { title: "存货名称",
for (let i = 0; i < inventNameGlobalData.length; i++) { template: function (dataItem) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) { for (let i = 0; i < inventNameGlobalData.length; i++) {
return inventNameGlobalData[i]['textField']; if (inventNameGlobalData[i]['textField'] === dataItem['inventName']) {
} dataItem['inventCode'] = inventNameGlobalData[i]['valueField']
} return inventNameGlobalData[i]['textField'];
return ""; } else {
}, dataItem['inventCode'] = '';
editor: function (container, options) { }
let inInfo = new EiInfo(); }
// 1.原料,2.耗材 return dataItem['inventName'];
inInfo.set("inqu_status-0-inventTypes", [1, 2]); },
inInfo.set("inqu_status-0-inventType", options.model["inventType"]); editor: function (container, options) {
inInfo.set("inqu_status-0-isSplicingSymbol", false); let inInfo = new EiInfo();
inInfo.set("serviceName", "HPPZ006"); // 1.原料,2.耗材,5.废料
inInfo.set("methodName", "queryMaterialComboBox"); inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("blockId", "material_record_block_id"); inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("field", options.field); inInfo.set("inqu_status-0-isSplicingSymbol", false);
refreshSelect(container, inInfo); 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", field: "spec",
template: function (dataItem) { template: function (dataItem) {
...@@ -86,55 +90,30 @@ $(function() { ...@@ -86,55 +90,30 @@ $(function() {
refreshInputSelect(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", field: "length",
template: function (dataItem) { template: function (options) {
for (let i = 0; i < inventAllGlobalData.length; i++) { return options.length == 0 ? "-" : options.length;
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param3Field'];
}
}
return dataItem['length'];
} }
}, { }, {
field: "width", field: "width",
template: function (dataItem) { template: function (options) {
for (let i = 0; i < inventAllGlobalData.length; i++) { return options.width == 0 ? "-" : options.width;
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param4Field'];
}
}
return dataItem['width'];
} }
}, { }, {
field: "thick", field: "thick",
template: function (dataItem) { template: function (options) {
for (let i = 0; i < inventAllGlobalData.length; i++) { return options.thick == 0 ? "-" : options.thick;
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param5Field'];
}
}
return dataItem['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 dataItem['material'];
}
}, {
field: "unit",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param2Field'];
}
}
return dataItem['unit'];
}
}], }],
loadComplete: function (grid) { loadComplete: function (grid) {
// 此grid对象 // 此grid对象
...@@ -267,7 +246,7 @@ let save = function () { ...@@ -267,7 +246,7 @@ let save = function () {
message("勾选的第" + (i + 1) + "行仓库名称不能为空"); message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return; return;
} }
if (isBlank(rows[i]['inventCode'])) { if (isBlank(rows[i]['inventName'])) {
message("勾选的第" + (i + 1) + "行存货名称不能为空"); message("勾选的第" + (i + 1) + "行存货名称不能为空");
return; return;
} }
...@@ -275,6 +254,21 @@ let save = function () { ...@@ -275,6 +254,21 @@ let save = function () {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数"); message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
return; 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 + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
......
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/> <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="inventRecordId" cname="规格ID" width="120" align="center" readonly="true" hidden="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/> <EF:EFColumn ename="spec" cname="规格" width="120" align="center" readonly="true"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right" <EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
......
...@@ -69,14 +69,17 @@ $(function() { ...@@ -69,14 +69,17 @@ $(function() {
refreshInputSelect(container, inInfo); refreshInputSelect(container, inInfo);
} }
}, { }, {
field: "inventRecordId", field: "spec",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) { 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']; return inventAllGlobalData[i]['textField'];
} else {
dataItem['inventRecordId'] = '';
} }
} }
return ""; return dataItem['spec'] == null ? "" : dataItem['spec'];
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); let inInfo = new EiInfo();
...@@ -87,7 +90,32 @@ $(function() { ...@@ -87,7 +90,32 @@ $(function() {
inInfo.set("methodName", "queryComboBoxSpec"); inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id"); inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field); 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) { loadComplete: function (grid) {
...@@ -98,30 +126,21 @@ $(function() { ...@@ -98,30 +126,21 @@ $(function() {
save(); save();
}, },
afterEdit: function (e) { afterEdit: function (e) {
if (e.field === "inventRecordId") { if (e.field == "spec") {
let inventRecordId = e.model.inventRecordId; var tr,index;
if (isBlank(inventRecordId)) { // 获取此model元素信息
return; var item = e.model;
} for (let i = 0; i < inventAllGlobalData.length; i++) {
let inInfo = new EiInfo(); if (inventAllGlobalData[i]['textField'] === item.spec) {
// ID为空的情况下需要返回一条空数据 resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field']);
inInfo.set("inqu_status-0-id", inventRecordId); resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field']);
EiCommunicator.send("HPPZ006", "query", inInfo, { resultGrid.setCellValue(item, 'length', inventAllGlobalData[i]['param3Field']);
onSuccess: function (ei) { resultGrid.setCellValue(item, 'width', inventAllGlobalData[i]['param4Field']);
let data = ei.blocks.result.rows; resultGrid.setCellValue(item, 'thick', inventAllGlobalData[i]['param5Field']);
if (data.length > 0) { resultGrid.setCellValue(item, 'coefficient', inventAllGlobalData[i]['param6Field']);
resultGrid.setCellValue(e.model, "length", data[0][8]) resultGrid.refresh();
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) {
} }
}, {async: false}); }
} }
}, },
onSuccess: function (e) { onSuccess: function (e) {
...@@ -231,7 +250,7 @@ let save = function () { ...@@ -231,7 +250,7 @@ let save = function () {
message("勾选的第" + (i + 1) + "行仓库名称不能为空"); message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return; return;
} }
if (isBlank(rows[i]['inventCode'])) { if (isBlank(rows[i]['inventName'])) {
message("勾选的第" + (i + 1) + "行存货名称不能为空"); message("勾选的第" + (i + 1) + "行存货名称不能为空");
return; return;
} }
...@@ -239,6 +258,21 @@ let save = function () { ...@@ -239,6 +258,21 @@ let save = function () {
message("勾选的第" + (i + 1) + "行数量必须是大于0的整数"); message("勾选的第" + (i + 1) + "行数量必须是大于0的整数");
return; 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 + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
......
...@@ -48,28 +48,28 @@ ...@@ -48,28 +48,28 @@
<EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/> <EF:EFColumn ename="otherEnterNo" cname="入库单号" enable="false" width="150" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" <EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true" readonly="true"/> 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"> readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '5')"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType" condition="ITEM_CODE IN ('1', '2', '5')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true" readonly="true"/> <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"/>
hidden="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" required="true" readonly="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" <EF:EFColumn ename="amount" cname="数量" format="{0:N0}" maxLength="20" width="100" align="right"
sumType="all" required="true" readonly="true"/> sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" 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="100" align="right" format="{0:N3}" <EF:EFColumn ename="weight" cname="重量" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/> 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"/> 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"/> 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"/> readonly="true"/>
<EF:EFColumn ename="material" cname="材质" width="120" align="center" required="false" readonly="true"/> <EF:EFColumn ename="material" cname="材质" width="80" align="center" required="false" readonly="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="120" align="center" format="{0:N3}" required="false" <EF:EFColumn ename="coefficient" cname="系数" width="80" align="center" format="{0:N3}" required="false"
readonly="true"/> readonly="true"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" 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"/> <EF:EFColumn ename="remark" cname="备注" width="150" maxLength="255" readonly="true"/>
......
...@@ -10,6 +10,11 @@ $(function() { ...@@ -10,6 +10,11 @@ $(function() {
pageSizes: [10, 20, 30, 50, 100, 200] pageSizes: [10, 20, 30, 50, 100, 200]
}, },
columns: [{ columns: [{
field: "spec",
template: function (options) {
return $.trim(options.spec) == "" ? "无规格" : options.spec;
}
}, {
field: "length", field: "length",
template: function (options) { template: function (options) {
return options.length == 0 ? "-" : options.length; return options.length == 0 ? "-" : options.length;
......
...@@ -45,6 +45,16 @@ function isPositiveInteger(input) { ...@@ -45,6 +45,16 @@ function isPositiveInteger(input) {
} }
/** /**
* 正数校验
*
* @param input
* @returns {boolean}
*/
function isPositiveNumber(input) {
return !isBlank(input) && isNumber(input) && (input > 0);
}
/**
* 消息提示 * 消息提示
* *
* @param msg * @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