Commit 221a854d by yukang

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

parents c7877de4 96deb3b4
...@@ -49,22 +49,24 @@ public enum DdynamicEnum { ...@@ -49,22 +49,24 @@ public enum DdynamicEnum {
* 编写:wwl * 编写:wwl
*/ */
INVENT_SPEC_BLOCK_ID("invent_spec_block_id", "id", "spec", "HPPZ006.queryComboBoxSpec"), INVENT_SPEC_BLOCK_ID("invent_spec_block_id", "id", "spec", "HPPZ006.queryComboBoxSpec"),
/** /**
* 模块:存货档案(ALL) * 模块:存货档案(ALL)
* 用途:存货档案下拉框 * 用途:存货档案下拉框
* 编写:wwl * 编写:wwl
*/ */
INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "HPPZ006.queryComboBoxAll"), INVENT_ALL_BLOCK_ID("invent_all_block_id", "id", "spec", "material", "unit", "length", "width", "thick",
"HPPZ006.queryComboBoxAll"),
/**
* 模块:存货档案部件名称 /**
* 用途:存货档案部件名称下拉框 * 模块:存货档案部件名称
* 编写:wwl * 用途:存货档案部件名称下拉框
*/ * 编写:wwl
INVENT_PRDT_NAME_BLOCK_ID("invent_prdt_name_block_id","id","inventCode","inventName","HPPZ006.queryPrdtComboBoxAll"), */
INVENT_PRDT_NAME_BLOCK_ID("invent_prdt_name_block_id", "id", "inventCode", "inventName",
/** "HPPZ006.queryPrdtComboBoxAll"),
/**
* 模块:存货档案(规格) * 模块:存货档案(规格)
* 用途:存货档案下拉框 * 用途:存货档案下拉框
* 编写:wwl * 编写:wwl
......
...@@ -7,7 +7,6 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -7,7 +7,6 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.tools.HPKCTools; import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006; import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -16,12 +15,12 @@ import com.baosight.hpjx.util.EiInfoUtils; ...@@ -16,12 +15,12 @@ import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
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;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -30,6 +29,8 @@ import java.util.List; ...@@ -30,6 +29,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 存货档案管理
*
* @author:songx * @author:songx
* @date:2024/1/22,15:17 * @date:2024/1/22,15:17
*/ */
...@@ -77,18 +78,8 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -77,18 +78,8 @@ public class ServiceHPPZ006 extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
//this.checkSaveData(resultRows);
// 写入数据 // 写入数据
for (int i = 0; i < resultRows.size(); i++) { this.saveData(resultRows);
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
if (fPz006.getId() == null || fPz006.getId() == 0) {
this.add(fPz006);
} else {
this.modify(fPz006);
}
}
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
...@@ -97,28 +88,42 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -97,28 +88,42 @@ public class ServiceHPPZ006 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 保存数据
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRow);
// 设置规格
if (StringUtils.isBlank(fPz006.getSpec())) {
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
}
// 去除空格
fPz006.setSpec(StringUtils.trimToEmpty(fPz006.getSpec()));
// 判断新增或修改
if (fPz006.getId() == null || fPz006.getId() == 0) {
this.add(fPz006);
} else {
this.modify(fPz006);
}
}
}
/** /**
* 新增操作 * 新增操作
* *
* @param fPz006 * @param fPz006
* @return * @return
*/ */
public void add(HPPZ006 fPz006) { private void add(HPPZ006 fPz006) {
AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空"); // 校验数据
AssertUtils.isEmpty(fPz006.getInventCode(), "存货名称不能为空"); this.checkAddData(fPz006);
// 去除空格
fPz006.setSpec(StringUtils.trimToEmpty(fPz006.getSpec()));
// 重复校验
Map queryParam = new HashMap();
queryParam.put("inventCode", fPz006.getInventCode());
queryParam.put("spec", fPz006.getSpec());
List<HPPZ006> dbPz006 = dao.query(HPPZ006.QUERY, queryParam);
AssertUtils.isNotEmpty(dbPz006, String.format("存货编码[%s]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(),
fPz006.getSpec()));
// 存货名称 // 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName()); fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
DaoUtils.insert(HPPZ006.INSERT, fPz006); DaoUtils.insert(HPPZ006.INSERT, fPz006);
} }
...@@ -128,114 +133,53 @@ public class ServiceHPPZ006 extends ServiceBase { ...@@ -128,114 +133,53 @@ public class ServiceHPPZ006 extends ServiceBase {
* @param fPz006 * @param fPz006
* @return * @return
*/ */
@OperationLogAnnotation(operModul = "存货档案",operType = "修改",operDesc = "修改")
public void modify(HPPZ006 fPz006) { public void modify(HPPZ006 fPz006) {
// 校验是否存在库存 this.checkModifyData(fPz006);
List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId());
AssertUtils.isEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId()));
// 存货名称 // 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName()); fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006); DaoUtils.update(HPPZ006.UPDATE, fPz006);
} }
/**
* 新增操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据写入
this.checkSaveData(resultRows);
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(),fPz006.getWidth(),fPz006.getThick()));
DaoUtils.insert(HPPZ006.INSERT, fPz006);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/** /**
* 校验保存的数据 * 校验保存的数据
* *
* @param resultRows * @param fPz006
*/ */
private void checkSaveData(List<Map> resultRows) { private void checkAddData(HPPZ006 fPz006) {
for (int i = 0; i < resultRows.size(); i++) { AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空");
HPPZ006 fPz006 = new HPPZ006(); AssertUtils.isEmpty(fPz006.getInventCode(), "存货名称不能为空");
fPz006.fromMap(resultRows.get(i)); // 重复校验
AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空"); String msg;
AssertUtils.isEmpty(fPz006.getInventCode(), "存货名称不能为空"); Map queryParam = new HashMap();
// 去除空格 queryParam.put("inventCode", fPz006.getInventCode());
fPz006.setSpec(StringUtils.trimToEmpty(fPz006.getSpec())); if (StringUtils.isBlank(fPz006.getSpec())) {
// 重复校验 queryParam.put("notSpec", CommonConstant.YesNo.YES);
Map queryParam = new HashMap(); msg = String.format("存货编码[%s]已存在无规格,请勿重复添加!", fPz006.getInventCode());
queryParam.put("inventCode", fPz006.getInventCode()); } else {
queryParam.put("spec", fPz006.getSpec()); queryParam.put("spec", fPz006.getSpec());
List<HPPZ006> dbPz006 = dao.query(HPPZ006.QUERY, queryParam); msg = String.format("存货编码[%s]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(), fPz006.getSpec());
AssertUtils.isNotEmpty(dbPz006, String.format("存货编码[%s]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(),
fPz006.getSpec()));
} }
} List<HPPZ006> dbPz006 = dao.query(HPPZ006.QUERY, queryParam);
AssertUtils.isNotEmpty(dbPz006, msg);
/**
* 修改操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkUpdateData(resultRows);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
fPz006.fromMap(resultRows.get(i));
// 存货名称
fPz006.setInventName(HPPZTools.HpPz004.getByCode(fPz006.getInventCode()).getInventName());
fPz006.setSpec(HPPZTools.HpPz006.jointSpec(fPz006.getLength(), fPz006.getWidth(), fPz006.getThick()));
DaoUtils.update(HPPZ006.UPDATE, fPz006);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
} }
/** /**
* 修改数据校验 * 修改数据校验
* *
* @param resultRows * @param fPz006
*/ */
private void checkUpdateData(List<Map> resultRows) { private void checkModifyData(HPPZ006 fPz006) {
for (Map resultRow : resultRows) { // 校验是否存在库存
HPPZ006 fPz006 = new HPPZ006(); List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId());
fPz006.fromMap(resultRow); AssertUtils.isNotEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId()));
// 校验是否存在库存 // 重复校验
List<HPKC010> dbKc010s = HPKCTools.HpKc010.listBySpec(fPz006.getId()); Map queryParam = new HashMap();
AssertUtils.isEmpty(dbKc010s, String.format("档案[%s]已存在库存数量,不能进行修改", fPz006.getId())); queryParam.put("inventCode", fPz006.getInventCode());
} queryParam.put("spec", fPz006.getSpec());
List<HPPZ006> dbPz006s = dao.query(HPPZ006.QUERY, queryParam);
AssertUtils.isTrue(CollectionUtils.isNotEmpty(dbPz006s)
&& !dbPz006s.get(0).getId().equals(fPz006.getId()),
String.format("存货编码[%s]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(), fPz006.getSpec()));
} }
/** /**
......
...@@ -79,6 +79,14 @@ ...@@ -79,6 +79,14 @@
<isNotEmpty prepend=" AND " property="inventTypes"> <isNotEmpty prepend=" AND " property="inventTypes">
INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate> INVENT_TYPE IN <iterate close=")" open="(" conjunction="," property="inventTypes">#inventTypes[]#</iterate>
</isNotEmpty> </isNotEmpty>
<isNotNull prepend=" AND " property="notSpec">
<isEqual property="notSpec" compareValue="Y">
SPEC = ''
</isEqual>
</isNotNull>
<isNotNull prepend=" AND " property="spec">
SPEC = #spec#
</isNotNull>
</sql> </sql>
<sql id="order"> <sql id="order">
...@@ -252,6 +260,9 @@ ...@@ -252,6 +260,9 @@
SELECT DISTINCT SELECT DISTINCT
ID AS "id", ID AS "id",
(CASE WHEN SPEC = '' THEN '无规格' ELSE SPEC END) AS "spec", (CASE WHEN SPEC = '' THEN '无规格' ELSE SPEC END) AS "spec",
LENGTH AS "length" , <!-- 长 -->
WIDTH AS "width" , <!-- 宽 -->
THICK AS "thick" , <!-- 厚 -->
MATERIAL AS "material" , <!-- 材质 --> MATERIAL AS "material" , <!-- 材质 -->
UNIT AS "unit" <!-- 单位 --> UNIT AS "unit" <!-- 单位 -->
FROM hpjx.t_hppz006 FROM hpjx.t_hppz006
......
...@@ -12,6 +12,7 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007; ...@@ -12,6 +12,7 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009; import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ011; import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -316,8 +317,9 @@ public class HPPZTools { ...@@ -316,8 +317,9 @@ public class HPPZTools {
if (dbPz006.getThick() != null) { if (dbPz006.getThick() != null) {
unitWeight = unitWeight.multiply(dbPz006.getThick()); unitWeight = unitWeight.multiply(dbPz006.getThick());
} }
// 乘以系数 // 乘以系数,除以1000000=重量(千克KG)
return unitWeight.multiply(dbPz006.getCoefficient()).setScale(3, RoundingMode.HALF_UP); return unitWeight.multiply(dbPz006.getCoefficient()).divide(new BigDecimal("1000000"))
.setScale(3, RoundingMode.HALF_UP);
} }
/** /**
...@@ -331,15 +333,22 @@ public class HPPZTools { ...@@ -331,15 +333,22 @@ public class HPPZTools {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if (length != null && length.compareTo(BigDecimal.ZERO) != 0) { if (length != null && length.compareTo(BigDecimal.ZERO) != 0) {
sb.append(length.stripTrailingZeros().toPlainString()); sb.append(length.stripTrailingZeros().toPlainString());
sb.append("*");
} }
if (width != null && width.compareTo(BigDecimal.ZERO) != 0) { if (width != null && width.compareTo(BigDecimal.ZERO) != 0) {
if (StringUtils.isNotBlank(sb)) {
sb.append("*");
}
sb.append(width.stripTrailingZeros().toPlainString()); sb.append(width.stripTrailingZeros().toPlainString());
sb.append("*");
} }
if (thick != null && thick.compareTo(BigDecimal.ZERO) != 0) { if (thick != null && thick.compareTo(BigDecimal.ZERO) != 0) {
if (StringUtils.isNotBlank(sb)) {
sb.append("*");
}
sb.append(thick.stripTrailingZeros().toPlainString()); sb.append(thick.stripTrailingZeros().toPlainString());
} }
if (StringUtils.isNotBlank(sb)) {
sb.append("(MM)");
}
return sb.toString(); return sb.toString();
} }
......
...@@ -6,12 +6,15 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -6,12 +6,15 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao; import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiColumn;
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.ioc.spring.PlatApplicationContext; import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.util.DateUtils; import com.baosight.iplat4j.core.util.DateUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession; import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -65,8 +68,9 @@ public class CommonMethod { ...@@ -65,8 +68,9 @@ public class CommonMethod {
eiBlock = new EiBlock(tableParam.getBlockId()); eiBlock = new EiBlock(tableParam.getBlockId());
/* 将所有查询到的结果放到暂存变量中 */ /* 将所有查询到的结果放到暂存变量中 */
results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset, -999999); results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset, -999999);
List<Map> resultRows = new ArrayList<>();
for (Object result : results) { for (Object result : results) {
row = new HashMap<>(3); row = new HashMap<>();
try { try {
tryValue = (Map) result; tryValue = (Map) result;
}catch (ClassCastException e){ }catch (ClassCastException e){
...@@ -80,19 +84,21 @@ public class CommonMethod { ...@@ -80,19 +84,21 @@ public class CommonMethod {
row.put(HPConstants.PARAM3_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam3()))); 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.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.PARAM5_FIELD, (tryValue.get(tableParam.getValue()) + HPConstants.SPLICING_SYMBOL + tryValue.get(tableParam.getParam5())));
}else{ } else {
row.put(HPConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText()))); row.put(HPConstants.TEXT_FIELD, String.valueOf(tryValue.get(tableParam.getText())));
row.put(HPConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1()))); row.put(HPConstants.PARAM1_FIELD, String.valueOf(tryValue.get(tableParam.getParam1())));
row.put(HPConstants.PARAM2_FIELD, String.valueOf(tryValue.get(tableParam.getParam2()))); row.put(HPConstants.PARAM2_FIELD, String.valueOf(tryValue.get(tableParam.getParam2())));
row.put(HPConstants.PARAM3_FIELD, String.valueOf(tryValue.get(tableParam.getParam3()))); 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.PARAM4_FIELD, String.valueOf(tryValue.get(tableParam.getParam4())));
row.put(HPConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5()))); row.put(HPConstants.PARAM5_FIELD, String.valueOf(tryValue.get(tableParam.getParam5())));
} }
eiBlock.addRow(row); resultRows.add(row);
} }
inInfo.setBlock(eiBlock); eiBlock.addBlockMeta(initCodeMeta(HPConstants.TEXT_FIELD, HPConstants.VALUE_FIELD));
} eiBlock.addRows(resultRows);
inInfo.setBlock(eiBlock);
}
} }
public static void creatorInfo(EiInfo eiInfo, String resultBlock){ public static void creatorInfo(EiInfo eiInfo, String resultBlock){
...@@ -184,16 +190,36 @@ public class CommonMethod { ...@@ -184,16 +190,36 @@ public class CommonMethod {
int days = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); int days = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
String yearMonthDay; String yearMonthDay;
if (month==0){ if (month==0){
yearMonthDay=year-1+"-12"; yearMonthDay = year - 1 + "-12";
} } else if (month < 10 && month > 0 && days < 10 && days > 0) {
else if (month<10 && month>0 && days<10 && days>0){ yearMonthDay = year + "-0" + month + "-0" + days;
yearMonthDay=year+"-0"+month+"-0"+days; } else {
yearMonthDay = year + "-" + month + "-" + days;
} }
else { return yearMonthDay;
yearMonthDay=year+"-"+month+"-"+days;
} }
return yearMonthDay;
} /**
* 构造下拉框的数据项.
*
* @param labelName
* @param valueName
* @return
*/
private static EiBlockMeta initCodeMeta(String labelName, String valueName) {
EiColumn eiColumn;
EiBlockMeta eiMetadata = new EiBlockMeta();
eiColumn = new EiColumn(labelName);
eiColumn.setFieldLength(30);
eiColumn.setDescName("textField");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(valueName);
eiColumn.setFieldLength(150);
eiColumn.setDescName("valueField");
eiMetadata.addMeta(eiColumn);
return eiMetadata;
}
} }
...@@ -125,8 +125,7 @@ $(function() { ...@@ -125,8 +125,7 @@ $(function() {
save(); save();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
......
...@@ -91,8 +91,7 @@ $(function() { ...@@ -91,8 +91,7 @@ $(function() {
save(); save();
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
......
...@@ -125,8 +125,7 @@ $(function() { ...@@ -125,8 +125,7 @@ $(function() {
} }
}, },
onSuccess: function (e) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'update' if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'insert'
||e.eiInfo.extAttr.methodName == 'delete' ){ ||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
......
...@@ -72,37 +72,37 @@ let save = function () { ...@@ -72,37 +72,37 @@ let save = function () {
let phoneName= item.get("phoneName"); let phoneName= item.get("phoneName");
let address= item.get("address"); let address= item.get("address");
let status= item.get("status"); let status= item.get("status");
if(custType===""){ if(isBlank(custType)){
message("选中的第"+(index+1)+"行\"供应商类型\",不能为空!"); message("选中的第"+(index+1)+"行\"供应商类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(custName===""){ if(isBlank(custName)){
message("选中的第"+(index+1)+"行\"供应商名称\",不能为空!"); message("选中的第"+(index+1)+"行\"供应商名称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(companyName===""){ if(isBlank(companyName)){
message("选中的第"+(index+1)+"行\"公司\",不能为空!"); message("选中的第"+(index+1)+"行\"公司\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(headName===""){ if(isBlank(headName)){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!"); message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(phoneName===""){ if(isBlank(phoneName)){
message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!"); message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(address===""){ if(isBlank(address)){
message("选中的第"+(index+1)+"行\"地址\",不能为空!"); message("选中的第"+(index+1)+"行\"地址\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(status===""){ if(isBlank(status)){
message("选中的第"+(index+1)+"行\"状态\",不能为空!"); message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false; flag = false;
return false; return false;
......
...@@ -73,37 +73,37 @@ let save = function () { ...@@ -73,37 +73,37 @@ let save = function () {
let phoneName= item.get("phoneName"); let phoneName= item.get("phoneName");
let address= item.get("address"); let address= item.get("address");
let status= item.get("status"); let status= item.get("status");
if(custType===""){ if(isBlank(custType)){
message("选中的第"+(index+1)+"行\"客户类型\",不能为空!"); message("选中的第"+(index+1)+"行\"客户类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(custName===""){ if(isBlank(custName)){
message("选中的第"+(index+1)+"行\"公司简称\",不能为空!"); message("选中的第"+(index+1)+"行\"公司简称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(companyName===""){ if(isBlank(companyName)){
message("选中的第"+(index+1)+"行\"公司全称\",不能为空!"); message("选中的第"+(index+1)+"行\"公司全称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(headName===""){ if(isBlank(headName)){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!"); message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(phoneName===""){ if(isBlank(phoneName)){
message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!"); message("选中的第"+(index+1)+"行\"负责人联系方式\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(address===""){ if(isBlank(address)){
message("选中的第"+(index+1)+"行\"地址\",不能为空!"); message("选中的第"+(index+1)+"行\"地址\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(status===""){ if(isBlank(status)){
message("选中的第"+(index+1)+"行\"状态\",不能为空!"); message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false; flag = false;
return false; return false;
......
...@@ -69,17 +69,17 @@ let save = function () { ...@@ -69,17 +69,17 @@ let save = function () {
let inventType= item.get("inventType"); let inventType= item.get("inventType");
let inventName= item.get("inventName"); let inventName= item.get("inventName");
let status= item.get("status"); let status= item.get("status");
if(inventType===""){ if(isBlank(inventType)){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!"); message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(inventName===""){ if(isBlank(inventName)){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!"); message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(status===""){ if(isBlank(status)){
message("选中的第"+(index+1)+"行\"状态\",不能为空!"); message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false; flag = false;
return false; return false;
......
...@@ -45,29 +45,13 @@ $(function() { ...@@ -45,29 +45,13 @@ $(function() {
return ""; return "";
}, },
editor: function (container, options) { editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid"); let inInfo = new EiInfo();
var cellIndex = grid.cellIndex(container); inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
var input = $('<input />'); inInfo.set("serviceName", "HPPZ004");
input.attr("name", options.field); inInfo.set("methodName", "queryComboBox");
input.attr("id", options.field); inInfo.set("blockId", "invent_name_block_id");
input.appendTo(container); inInfo.set("field", options.field);
let eiInfo = new EiInfo(); refreshSelect(container, inInfo);
eiInfo.set("inqu_status-0-inventType", options.model["inventType"]);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
} }
}], }],
onSuccess: function (e) { onSuccess: function (e) {
...@@ -124,46 +108,54 @@ let save = function () { ...@@ -124,46 +108,54 @@ let save = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
let flag = true; for (let i = 0; i < rows.length; i++) {
$.each(rows, function(index, item) { let row = rows[i];
let inventType= item.get("inventType"); if (isBlank(row["inventType"])) {
let inventCode= item.get("inventCode"); message("选中的第" + (i + 1) + "行\"存货类型\",不能为空!");
let material= item.get("material");
let unit= item.get("unit");
let status= item.get("status");
if(inventType===""){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false;
return false; return false;
} }
if(inventCode===""){ if (isBlank(row["inventCode"])) {
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!"); message("选中的第" + (i + 1) + "行\"存货名称\",不能为空!");
flag = false;
return false; return false;
} }
if(material===""){ if (isBlank(row["material"])) {
message("选中的第"+(index+1)+"行\"材质\",不能为空!"); message("选中的第" + (i + 1) + "行\"材质\",不能为空!");
flag = false;
return false; return false;
} }
if(unit===""){ if (isBlank(row["unit"])) {
message("选中的第"+(index+1)+"行\"单位\",不能为空!"); message("选中的第" + (i + 1) + "行\"单位\",不能为空!");
flag = false;
return false; return false;
} }
if(status===""){ if (isBlank(row["status"])) {
message("选中的第"+(index+1)+"行\"状态\",不能为空!"); message("选中的第" + (i + 1) + "行\"状态\",不能为空!");
flag = false; return false;
}
let length = row["length"];
if (!isBlank(length) && !isNumber(length)) {
message("选中的第" + (i + 1) + "行\"\",必须是数值!");
return false;
}
let width = row["width"];
if (!isBlank(width) && !isNumber(width)) {
message("选中的第" + (i + 1) + "行\"\",必须是数值!");
return false;
}
let thick = row["thick"];
if (!isBlank(thick) && !isNumber(thick)) {
message("选中的第" + (i + 1) + "行\"\",必须是数值!");
return false;
}
let coefficient = row["coefficient"];
if (!isBlank(coefficient) && !isNumber(coefficient)) {
message("选中的第" + (i + 1) + "行\"\",必须是数值!");
return false; return false;
} }
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ006", "save", true);
}
});
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPPZ006", "save", true);
}
});
} }
/** /**
......
...@@ -26,19 +26,20 @@ ...@@ -26,19 +26,20 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="档案ID" enable="false" width="60" align="center"/> <EF:EFColumn ename="id" cname="档案ID" enable="false" width="60" align="center"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true"> <EF:EFComboColumn ename="inventType" cname="存货类型" width="80" align="center" required="true"
readonly="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/> <EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true"/> <EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50" enable="false"/> <EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="length" cname="长" width="100" align="right" format="{0:N2}" maxLength="10"/> <EF:EFColumn ename="length" cname="长(MM)" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="width" cname="宽" width="100" align="right" format="{0:N2}" maxLength="10"/> <EF:EFColumn ename="width" cname="宽(MM)" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="thick" cname="厚" width="100" align="right" format="{0:N2}" maxLength="10"/> <EF:EFColumn ename="thick" cname="厚(MM)" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="material" cname="材质" width="100" align="center" required="true"/> <EF:EFColumn ename="material" cname="材质" width="100" align="center" required="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N2}" maxLength="10" <EF:EFColumn ename="coefficient" cname="系数" width="80" align="right" format="{0:N2}" maxLength="10"
defaultValue="1"/> defaultValue="1"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center" required="true"/> <EF:EFColumn ename="unit" cname="单位" width="80" align="center" required="true"/>
<EF:EFComboColumn ename="status" cname="状态" align="center" width="80" required="true"> <EF:EFComboColumn ename="status" cname="状态" align="center" width="80" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/> <EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人名称" enable="false" width="140" align="center"/> <EF:EFColumn ename="createdName" cname="创建人名称" enable="false" width="140" align="center"/>
......
...@@ -70,22 +70,22 @@ let save = function () { ...@@ -70,22 +70,22 @@ let save = function () {
let whType= item.get("whType"); let whType= item.get("whType");
let princ= item.get("princ"); let princ= item.get("princ");
let status= item.get("status"); let status= item.get("status");
if(whName===""){ if(isBlank(whName)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!"); message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(whType===""){ if(isBlank(whType)){
message("选中的第"+(index+1)+"行\"仓库类型\",不能为空!"); message("选中的第"+(index+1)+"行\"仓库类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(princ===""){ if(isBlank(princ)){
message("选中的第"+(index+1)+"行\"负责人\",不能为空!"); message("选中的第"+(index+1)+"行\"负责人\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(status===""){ if(isBlank(status)){
message("选中的第"+(index+1)+"行\"状态\",不能为空!"); message("选中的第"+(index+1)+"行\"状态\",不能为空!");
flag = false; flag = false;
return false; return false;
......
...@@ -4,6 +4,12 @@ $(function () { ...@@ -4,6 +4,12 @@ $(function () {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 50, 70, 100], pageSizes: [10, 20, 50, 70, 100],
}, },
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
},
onSave: function (e) { onSave: function (e) {
// 阻止后台保存请求,使用自定义保存 // 阻止后台保存请求,使用自定义保存
e.preventDefault(); e.preventDefault();
......
...@@ -214,28 +214,28 @@ let save = function () { ...@@ -214,28 +214,28 @@ let save = function () {
let inventRecordId= item.get("inventRecordId"); let inventRecordId= item.get("inventRecordId");
let inventType= item.get("inventType"); let inventType= item.get("inventType");
let warnNum= item.get("warnNum"); let warnNum= item.get("warnNum");
if(inventType===""){ if(isBlank(inventType)){
message("选中的第"+(index+1)+"行\"存货类型\",不能为空!"); message("选中的第"+(index+1)+"行\"存货类型\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(whCode===""){ if(isBlank(whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!"); message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(inventCode===""){ if(isBlank(inventCode)){
message("选中的第"+(index+1)+"行\"存货名称\",不能为空!"); message("选中的第"+(index+1)+"行\"存货名称\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(inventRecordId===""){ if(isBlank(inventRecordId)){
message("选中的第"+(index+1)+"行\"规格\",不能为空!"); message("选中的第"+(index+1)+"行\"规格\",不能为空!");
flag = false; flag = false;
return false; return false;
} }
if(warnNum===""){ if(!isPositiveInteger(warnNum)){
message("选中的第"+(index+1)+"行\"预警值\"不能为空!"); message("选中的第"+(index+1)+"行\"预警值\"必须是大于0的整数!");
flag = false; flag = false;
return false; return false;
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row"> <EF:EFGrid blockId="result" autoDraw="override" checkMode="row">
<EF:EFColumn ename="id" cname="任务ID" enable="false" width="80" align="center"/> <EF:EFColumn ename="id" cname="任务ID" enable="false" width="80" align="center"/>
<EF:EFColumn ename="prodTaskNo" cname="任务单号" enable="false" hidden="true"/> <EF:EFColumn ename="prodTaskNo" cname="任务单号" enable="false" hidden="true"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" required="true" <EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true"
filter="contains" readonly="true"> filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
......
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