Commit 54ac9b08 by yukang

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

# Conflicts:
#	src/main/webapp/HP/SC/HPSC003.js
parents 9d2b2972 e168f4a4
...@@ -153,7 +153,7 @@ public class ServiceHPKC001 extends ServiceBase { ...@@ -153,7 +153,7 @@ public class ServiceHPKC001 extends ServiceBase {
fKc001.fromMap(resultRow); fKc001.fromMap(resultRow);
AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空"); AssertUtils.isEmpty(fKc001.getWhCode(), "仓库名称不能为空");
AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空"); AssertUtils.isEmpty(fKc001.getInventCode(), "存货名称不能为空");
AssertUtils.isNull(fKc001.getInventRecordId(), "规格不能为空"); // AssertUtils.isNull(fKc001.getInventRecordId(), "规格不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0"); AssertUtils.isGt(BigDecimal.ZERO, fKc001.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc001.getWeight(), "重量必须大于0"); AssertUtils.isGt(BigDecimal.ZERO, fKc001.getWeight(), "重量必须大于0");
} }
......
...@@ -104,14 +104,14 @@ public class ServiceHPKC002 extends ServiceBase { ...@@ -104,14 +104,14 @@ public class ServiceHPKC002 extends ServiceBase {
HPKC002 dbKc002 = dbMapKc002.get(fKc002.getReqNo()); HPKC002 dbKc002 = dbMapKc002.get(fKc002.getReqNo());
HPKC002 newKc002 = BeanUtils.copy(dbKc002, HPKC002.class); HPKC002 newKc002 = BeanUtils.copy(dbKc002, HPKC002.class);
newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER)); newKc002.setReqNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC002_NUMBER));
newKc002.setAmount(dbKc002.getAmount().negate()); newKc002.setAmount(dbKc002.getAmount());
newKc002.setWeight(dbKc002.getWeight().negate()); newKc002.setWeight(dbKc002.getWeight());
newKc002.setOldReqNo(dbKc002.getReqNo()); newKc002.setOldReqNo(dbKc002.getReqNo());
newKc002.setDeleteFlag(CommonConstant.YesNo.YES_1); newKc002.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC002.INSERT, newKc002); DaoUtils.insert(HPKC002.INSERT, newKc002);
// 修改库存 // 修改库存
HPKCTools.updateStock(dbKc002.getWhCode(), dbKc002.getInventRecordId(), HPKCTools.updateStock(dbKc002.getWhCode(), dbKc002.getInventRecordId(),
dbKc002.getAmount().negate(), dbKc002.getUnitWeight(), dbKc002.getWeight().negate()); dbKc002.getAmount(), dbKc002.getUnitWeight(), dbKc002.getWeight());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<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>
......
...@@ -12,8 +12,14 @@ import com.baosight.hpjx.hp.pz.domain.HPPZ007; ...@@ -12,8 +12,14 @@ 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.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils; import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -23,10 +29,13 @@ import java.util.List; ...@@ -23,10 +29,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/** /**
* @author:songx * @author:songx
* @date:2024/1/16,10:48 * @date:2024/1/16,10:48
*/ */
@Slf4j
public class HPPZTools { public class HPPZTools {
/** /**
...@@ -274,14 +283,41 @@ public class HPPZTools { ...@@ -274,14 +283,41 @@ public class HPPZTools {
* @return * @return
*/ */
public static HPPZ006 get(Long id) { public static HPPZ006 get(Long id) {
AssertUtils.isNull(id, "仓库编码不能为空"); AssertUtils.isNull(id, "规格ID不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("id", id); queryMap.put("id", id);
List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap); List<HPPZ006> results = DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
AssertUtils.isNull(results, String.format("规格[%s]不存在", id)); AssertUtils.isNull(results, String.format("规格[%s]不存在", id));
return results.get(0); return results.get(0);
} }
/**
* 查询
*
* @param ids
* @return
*/
public static List<HPPZ006> list(List<Long> ids) {
AssertUtils.isNull(ids, "规格ID不能为空");
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPPZ006.QUERY, queryMap);
}
/**
* 查询
*
* @param ids
* @return
*/
public static Map<Long, HPPZ006> map(List<Long> ids) {
List<HPPZ006> results = list(ids);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPPZ006::getId, item -> item));
}
/** /**
* 计算单重 * 计算单重
* *
...@@ -388,6 +424,57 @@ public class HPPZTools { ...@@ -388,6 +424,57 @@ public class HPPZTools {
return newPz006; return newPz006;
} }
} }
/**
* 设置用户信息
*
* @param inInfo
* @param idName
*/
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;
}
for (Map resultRow : resultRows) {
Long id = MapUtils.getLong(resultRow, idName);
HPPZ006 dbPz006 = resultMap.get(id);
resultRow.put(HPPZ006.FIELD_SPEC, dbPz006 == null ? "" : 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());
}
}
/**
* 设置规格
*
* @param bean
* @param keyName
*/
public static void setSpecInfo(DaoEPBase bean, String keyName) {
try {
String inventRecordId = BeanUtils.getProperty(bean, keyName);
if (StringUtils.isBlank(inventRecordId)) {
return;
}
HPPZ006 dbPz06 = get(Long.parseLong(inventRecordId));
BeanUtils.setProperty(bean, HPPZ006.FIELD_SPEC, dbPz06.getSpec());
BeanUtils.setProperty(bean, HPPZ006.FIELD_LENGTH, dbPz06.getLength());
BeanUtils.setProperty(bean, HPPZ006.FIELD_WIDTH, dbPz06.getWidth());
BeanUtils.setProperty(bean, HPPZ006.FIELD_THICK, dbPz06.getThick());
} catch (Throwable e) {
log.warn("设置规格失败:{}", e.getMessage(), e);
}
}
} }
/** /**
......
...@@ -121,6 +121,7 @@ public class ServiceHPSC003 extends ServiceBase { ...@@ -121,6 +121,7 @@ public class ServiceHPSC003 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) { for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
HPSC003.fromMap(map); HPSC003.fromMap(map);
HPSC003.setPlanCompletionDate(DateUtils.formatShort(HPSC003.getPlanCompletionDate()));
DaoUtils.update("HPSC003.update", HPSC003.toMap()); DaoUtils.update("HPSC003.update", HPSC003.toMap());
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
...@@ -65,6 +65,33 @@ ...@@ -65,6 +65,33 @@
<include refid="customCondition"/> <include refid="customCondition"/>
</select> </select>
<!-- 查询父级信息(递归) -->
<select id="queryParent" resultClass="com.baosight.hpjx.hp.xs.domain.Org">
SELECT
T3.ORG_ID as "orgId", T3.ORG_CNAME as "orgCname",
T3.PARENT_ORG_ID as "parentOrgId", T3.ORG_TYPE as "orgType"
FROM (
SELECT
@CODES as CODES,
(SELECT @CODES:=GROUP_CONCAT(PARENT_ORG_ID) FROM IPLAT.TXSOG01 WHERE FIND_IN_SET(ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) as T1,
@LEVEL:=@LEVEL+1 as level
FROM IPLAT.TXSOG01,
(select @CODES:=#orgId#, @LEVEL:= 0) T4
where @CODES is not null
) T2,
IPLAT.TXSOG01 T3
WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
<isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType#
</isNotEmpty>
AND COMPANY_CODE = #companyCode#
ORDER BY T2.LEVEL, T3.ORG_ID
</select>
<!-- 查询组织信息 --> <!-- 查询组织信息 -->
<select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT SELECT
...@@ -90,31 +117,32 @@ ...@@ -90,31 +117,32 @@
<include refid="order"/> <include refid="order"/>
</select> </select>
<!-- 查询组信息(递归) --> <!-- 查询子集组信息,包括生产组和下料组(递归) -->
<select id="queryGroupComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryGroupComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT SELECT
T2.LEVEL AS "level", T3.ORG_ID AS "orgId", T3.ORG_CNAME AS "orgCname" T2.LEVEL AS "level", T3.ORG_ID AS "orgId", T3.ORG_CNAME AS "orgCname",
T3.FACTORY_CODE AS "factoryCode", T5.FACTORY_NAME AS "factoryName"
FROM ( FROM (
SELECT SELECT
@CODES AS CODES, @CODES AS CODES,
(SELECT @CODES := GROUP_CONCAT(ORG_ID) (SELECT @CODES:=GROUP_CONCAT(ORG_ID)
FROM ${platSchema}.TXSOG01 FROM ${platSchema}.TXSOG01
WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES) WHERE FIND_IN_SET(PARENT_ORG_ID, @CODES)
AND COMPANY_CODE = #companyCode#
AND IS_DELETED = 0
) AS T1, ) AS T1,
@LEVEL:= @LEVEL+1 AS LEVEL @LEVEL:=@LEVEL+1 AS LEVEL
FROM ${platSchema}.TXSOG01, FROM ${platSchema}.TXSOG01,
(SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4 (SELECT @CODES:=#parentOrgId#, @LEVEL:= 0) T4
WHERE @CODES IS NOT NULL WHERE @CODES IS NOT NULL
) T2, ) T2,
${platSchema}.TXSOG01 T3 ${platSchema}.TXSOG01 T3
LEFT JOIN ${platSchema}.TXSOG01 T5 ON T3.FACTORY_CODE = T5.ORG_ID
WHERE 1=1 WHERE 1=1
AND FIND_IN_SET(T3.ORG_ID, T2.CODES) AND FIND_IN_SET(T3.ORG_ID, T2.CODES)
AND ORG_TYPE IN ('prodGroup', 'cutGroup') AND T3.ORG_TYPE IN ('prodGroup', 'cutGroup', 'factory')
<isNotEmpty prepend=" AND " property="orgType"> <isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType# T3.ORG_TYPE = #orgType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
ORDER BY T2.LEVEL, T3.ORG_ID ORDER BY T2.LEVEL, T3.ORG_ID
</select> </select>
......
package com.baosight.hpjx.hp.xs.tools; package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.hp.xs.domain.Org; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
...@@ -80,6 +81,38 @@ public class HPXSTools { ...@@ -80,6 +81,38 @@ public class HPXSTools {
List<Org> results = DaoBase.getInstance().query("HPXSOrg.query", paramMap); List<Org> results = DaoBase.getInstance().query("HPXSOrg.query", paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0); return CollectionUtils.isEmpty(results) ? null : results.get(0);
} }
/**
* 查询
*
* @param orgId
* @return
*/
public static List<Org> queryParent(String orgId) {
AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在父级信息", orgId));
return results;
}
/**
* 查询所属厂区
*
* @param orgId
* @return
*/
public static Org queryFactory(String orgId) {
AssertUtils.isNull(orgId, "组织ID不能为空");
Map queryMap = new HashMap();
queryMap.put("orgId", orgId);
queryMap.put("orgType", OrgTypeEnum.FACTORY.getCode());
List<Org> results = DaoBase.getInstance().query("HPXSOrg.queryParent", queryMap);
AssertUtils.isNull(results, String.format("组织[%s]不存在厂区信息", orgId));
return results.get(0);
}
} }
} }
...@@ -7,6 +7,8 @@ import com.baosight.hpjx.core.security.UserSessionUtils; ...@@ -7,6 +7,8 @@ import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.core.tools.CodeValueTools; import com.baosight.hpjx.core.tools.CodeValueTools;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.DateUtils; import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
...@@ -96,13 +98,23 @@ public class ServiceXSOG0801A extends ServiceEPBase { ...@@ -96,13 +98,23 @@ public class ServiceXSOG0801A extends ServiceEPBase {
// 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15 // 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
resultRows.forEach((row) -> { resultRows.forEach((row) -> {
String orgCode = SequenceGenerator.getNextSequence(HPConstant.SequenceId.ORG_CODE); String orgId = SequenceGenerator.getNextSequence(HPConstant.SequenceId.ORG_CODE);
row.put("orgId", orgCode); row.put("orgId", orgId);
row.put("orgEname", orgCode); row.put("orgEname", orgId);
row.put("companyCode", companyCode); row.put("companyCode", companyCode);
row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate"))); row.put("establishDate", DateUtils.formatShort(MapUtils.getString(row, "establishDate")));
row.put("parentOrgId", queryRow.get("parentOrgId")); row.put("parentOrgId", queryRow.get("parentOrgId"));
row.put("recCreator", UserSession.getLoginName()); row.put("recCreator", UserSession.getLoginName());
// 厂区代码
if (OrgTypeEnum.FACTORY.getCode().equals(row.get("orgType"))) {
row.put("factoryCode", orgId);
row.put("factoryName", row.get("orgCname"));
} else {
// 查询所属厂
Org factoryOrg = HPXSTools.XsOrg.queryFactory(queryRow.get("parentOrgId").toString());
row.put("factoryCode", factoryOrg.getOrgId());
row.put("factoryName", factoryOrg.getOrgCname());
}
}); });
EiInfo call = new EiInfo(); EiInfo call = new EiInfo();
call.set("list", resultRows); call.set("list", resultRows);
......
...@@ -286,12 +286,14 @@ ...@@ -286,12 +286,14 @@
REC_REVISE_TIME, <!-- 记录修改时刻 --> REC_REVISE_TIME, <!-- 记录修改时刻 -->
ARCHIVE_FLAG, <!-- 归档标记 --> ARCHIVE_FLAG, <!-- 归档标记 -->
IS_DELETED, <!-- 逻辑删除(1-已删除|0-正常状态) --> IS_DELETED, <!-- 逻辑删除(1-已删除|0-正常状态) -->
COMPANY_CODE <!-- 企业编码 --> COMPANY_CODE, <!-- 企业编码 -->
FACTORY_CODE,
FACTORY_NAME
) VALUES ( ) VALUES (
#orgId#, #orgEname#, #orgCname#, #orgBriefName#, #orgType#, #parentOrgId#, #orgId#, #orgEname#, #orgCname#, #orgBriefName#, #orgType#, #parentOrgId#,
#establishDate#, #orgLevel#, #orgNodeType#, #sortIndex#, #recCreator#, #establishDate#, #orgLevel#, #orgNodeType#, #sortIndex#, #recCreator#,
#recCreateTime#, #recRevisor#, #recReviseTime#, #archiveFlag#, #isDeleted#, #recCreateTime#, #recRevisor#, #recReviseTime#, #archiveFlag#, #isDeleted#,
#companyCode# #companyCode#, #factoryCode#, #factoryName#
) )
</insert> </insert>
......
...@@ -269,6 +269,8 @@ public class ServiceXSOrgManage extends ServiceEPBase { ...@@ -269,6 +269,8 @@ public class ServiceXSOrgManage extends ServiceEPBase {
insertMap.put("archiveFlag", " "); insertMap.put("archiveFlag", " ");
insertMap.put("isDeleted", "0"); insertMap.put("isDeleted", "0");
insertMap.put("companyCode", inInfoRowMap.get("companyCode")); insertMap.put("companyCode", inInfoRowMap.get("companyCode"));
insertMap.put("factoryCode", inInfoRowMap.get("factoryCode"));
insertMap.put("factoryName", inInfoRowMap.get("factoryName"));
if (insertFlag) { if (insertFlag) {
this.dao.insert("XSOG01.insert", insertMap); this.dao.insert("XSOG01.insert", insertMap);
} else { } else {
......
...@@ -62,14 +62,17 @@ $(function() { ...@@ -62,14 +62,17 @@ $(function() {
refreshSelect(container, inInfo); refreshSelect(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']) {
return inventAllGlobalData[i]['textField']; dataItem['inventRecordId'] = inventAllGlobalData[i]['valueField']
} return inventAllGlobalData[i]['textField'];
} else {
dataItem['inventRecordId'] = '';
}
} }
return ""; return dataItem['spec'];
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); let inInfo = new EiInfo();
...@@ -83,6 +86,36 @@ $(function() { ...@@ -83,6 +86,36 @@ $(function() {
refreshSelect(container, inInfo); refreshSelect(container, inInfo);
} }
}, { }, {
field: "length",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param3Field'];
}
}
return "";
}
}, {
field: "width",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param4Field'];
}
}
return "";
}
}, {
field: "thick",
template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) {
if (inventAllGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return inventAllGlobalData[i]['param5Field'];
}
}
return "";
}
}, {
field: "material", field: "material",
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < inventAllGlobalData.length; i++) { for (let i = 0; i < inventAllGlobalData.length; i++) {
...@@ -114,6 +147,9 @@ $(function() { ...@@ -114,6 +147,9 @@ $(function() {
if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) { if (inventAllGlobalData[i]['valueField'] === item.inventRecordId) {
resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field']) resultGrid.setCellValue(item, 'material', inventAllGlobalData[i]['param1Field'])
resultGrid.setCellValue(item, 'unit', inventAllGlobalData[i]['param2Field']) 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'])
} }
} }
} }
......
...@@ -55,13 +55,17 @@ ...@@ -55,13 +55,17 @@
</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="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventRecordId" 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="material" cname="材质" width="120" align="center" enable="false"/>
<EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/> <EF:EFColumn ename="unit" cname="单位" width="120" align="center" enable="false"/>
<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"
required="true" readonly="true"/> required="true" readonly="true"/>
<EF:EFColumn ename="unitWeight" cname="单重" enable="false" width="100" align="right" format="{0:N3}"/> <EF:EFColumn ename="unitWeight" cname="单重(KG)" 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="weight" cname="重量(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="备注" width="150" 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="oldPurchaseNo" cname="原采购单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
......
...@@ -40,6 +40,14 @@ $(function () { ...@@ -40,6 +40,14 @@ $(function () {
return template; return template;
} }
}], }],
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveResult(btnNode);
},
onSuccess: function (e) { onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'update' if (e.eiInfo.extAttr.methodName == 'update'
|| e.eiInfo.extAttr.methodName == 'insert') { || e.eiInfo.extAttr.methodName == 'insert') {
...@@ -72,69 +80,12 @@ $(function () { ...@@ -72,69 +80,12 @@ $(function () {
// delete: true, // 显示删除按钮 // delete: true, // 显示删除按钮
}, },
onSave: function (e) { onSave: function (e) {
var rowCount = detailGrid.getCheckedRows(); // 阻止默认请求,使用自定义保存
// 检验是否选中数据 e.preventDefault();
if (rowCount == null || rowCount == "") { let btnNode = $(this);
NotificationUtil({
msg: '请选择一条或多条数据'
}, "warning");
}
let flag = false;
for (let i = 0; i <rowCount.length; i++) {
let startT = new Date(rowCount[i].planCommentDate).getTime();
let endT = new Date(rowCount[i].planCompletionDate).getTime();
if (startT > endT) {
flag = true;
break
}
}
if (flag){
e.preventDefault();
NotificationUtil({
msg: '计划结束时间不能小于计划开始时间'
}, "warning");
return;
}
var btnNode = $(this);
//禁用按钮 //禁用按钮
btnNode.attr("disabled", true); btnNode.attr("disabled", true);
IPLAT.submitNode($("#HPSC003"), "HPSC003", "updatePlanDetail", { saveDetail(btnNode);
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '修改成功'
});
// 绑定grid
detailGrid.setEiInfo(ei);
resultGrid.dataSource.page(resultGrid.dataSource._page);
}
//释放禁用按钮
btnNode.attr("disabled", false);
},
onFail: function (ei) { // onFail 表示失败回调函数
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
},
afterEdit: function (e) {
if (e.field === "planCompletionDate") {
let startT = new Date(e.model.planCommentDate).getTime();
let endT = new Date(e.model.planCompletionDate).getTime();
if (startT > endT) {
e.preventDefault();
NotificationUtil({
msg: '计划结束时间不能小于计划开始时间'
}, "warning");
}
}
}, },
columns: [{ columns: [{
field: "operator", field: "operator",
...@@ -283,3 +234,76 @@ function check_time(model,rows){ ...@@ -283,3 +234,76 @@ function check_time(model,rows){
} }
return true; return true;
} }
/**
* 保存汇总
*/
function saveResult(btn) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let planCompletionDate= item.get("planCompletionDate");
if(isBlank(planCompletionDate)){
message("选中的第"+(index+1)+"行\"计划结束时间\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC003", "update", true);
//释放禁用按钮
btn.attr("disabled", false);
}
});
}
}
/**
* 保存明细
*/
function saveDetail(btn) {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let planCommentDate= item.get("planCommentDate");
let planCompletionDate= item.get("planCompletionDate");
if(isBlank(planCommentDate)){
message("选中的第"+(index+1)+"行\"计划开始时间\",不能为空!");
flag = false;
return false;
}
if(isBlank(planCompletionDate)){
message("选中的第"+(index+1)+"行\"计划结束时间\",不能为空!");
flag = false;
return false;
}
let startT = new Date(planCommentDate).getTime();
let endT = new Date(planCompletionDate).getTime();
if (startT > endT) {
message("选中的第"+(index+1)+"行\"计划开始时间\"不能大于\"计划结束时间\"!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPSC003", "updatePlanDetail", true);
//释放禁用按钮
btn.attr("disabled", false);
}
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment