Commit 071d6bc4 by liuyang

2024-10-08 办公用品领用

parent 17abfe03
......@@ -2,14 +2,14 @@ package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -19,6 +19,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
......@@ -50,7 +51,28 @@ public class ServiceHPBG002 extends ServiceEPBase {
@OperationLogAnnotation(operModul = "办公用品入库",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG002.DELETE_FLAG);
try {
List<HPBG002> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG002.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HPBG002.FIELD_ID);
List<HPBG002A> hpbg002AList = HPBGTools.HpBg002a.getByParentId(ids);
for (HPBG002 hpbg002: resultRows) {
hpbg002.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg002.getId() == null || hpbg002.getId() == 0) {
continue;
}
List<HPBG002A> hpbg002As = hpbg002AList.stream().filter(hpbg002a1 -> hpbg002a1.getParentId().equals(hpbg002.getId())
&& hpbg002a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hpbg002As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HPBG002.DELETE, hpbg002);
hpbg002As = hpbg002AList.stream().filter(hpbg002a1 -> hpbg002a1.getParentId().equals(hpbg002.getId())).collect(Collectors.toList());
hpbg002As.forEach(hpbg002a -> DaoUtils.update(HPBG002A.DELETE, hpbg002a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "保存",operDesc = "操作")
......
......@@ -53,7 +53,7 @@ public class ServiceHPBG002A extends ServiceEPBase {
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow: resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
......
......@@ -4,9 +4,12 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
......@@ -61,4 +64,27 @@ public class ServiceHPBG002C extends ServiceEPBase {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002A.FIELD_STATUS, ReviewStatusEnum.UNSUBMITTED.getCode());
return super.query(inInfo, HPBG002A.QUERY,new HPBG002A(),false,new EiBlockMeta(),EiConstant.queryBlock,CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
for (Map resultRow: resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
hpbg002a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg002a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG002A.DELETE, hpbg002a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG003;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品领用
*/
public class ServiceHPBG003 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG003.QUERY,new HPBG003());
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<HPBG003> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG003.class);
List<Long> ids = ObjectUtils.listEpKey(resultRows, HPBG003.FIELD_ID);
List<HPBG003A> hpbg003AList = HPBGTools.HpBg003a.getByParentId(ids);
for (HPBG003 hpbg003: resultRows) {
hpbg003.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003.getId() == null || hpbg003.getId() == 0) {
continue;
}
List<HPBG003A> hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())
&& hpbg003a1.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode())).collect(Collectors.toList());
AssertUtils.isTrue(hpbg003As.size()>0, "数据已提交,无法删除!");
DaoUtils.update(HPBG003.DELETE, hpbg003);
hpbg003As = hpbg003AList.stream().filter(hpbg003a1 -> hpbg003a1.getParentId().equals(hpbg003.getId())).collect(Collectors.toList());
hpbg003As.forEach(hpbg003a -> DaoUtils.update(HPBG003A.DELETE, hpbg003a));
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HPBG003 hpbg003 = new HPBG003();
hpbg003.fromMap(resultRow);
if (hpbg003.getId() == null || hpbg003.getId() == 0){
this.add(hpbg003);
}else {
this.modify(hpbg003);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map detailRow : detailRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(detailRow);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
hpbg003a.setParentId(hpbg003.getId());
DaoUtils.insert(HPBG003A.INSERT, hpbg003a);
} else {
DaoUtils.update(HPBG003A.UPDATE, hpbg003a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + detailRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG003 hpbg003) {
hpbg003.setReceiveCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG003_RECEIVE_CODE));
DaoUtils.insert(HPBG003.INSERT, hpbg003);
}
/**
* 修改操作
*/
public void modify(HPBG003 hpbg003) {
DaoUtils.update(HPBG003.UPDATE, hpbg003);
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.*;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品领用
*/
public class ServiceHPBG003A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG003A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG003A.QUERY,new HPBG003A());
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow: resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
hpbg003a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg003a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG003A.DELETE, hpbg003a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
this.add(hpbg003a);
} else {
this.modify(hpbg003a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG003A hpbg003a) {
DaoUtils.insert(HPBG003A.INSERT, hpbg003a);
}
/**
* 修改操作
*/
public void modify(HPBG003A hpbg003a) {
DaoUtils.update(HPBG003A.UPDATE, hpbg003a);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG003A> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG003A.class);
List<String> itemCodes = ObjectUtils.listEpKey(resultRows, HPBG003A.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG003A hpbg003A : resultRows) {
AssertUtils.isTrue(hpbg003A.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法重复提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg003A.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg003A.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().subtract(hpbg003A.getReceiveQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg003A.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG003A.UPDATE_BY_STATUS, hpbg003A);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG003B extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ReviewStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bg.domain.HPBG003;
import com.baosight.hpjx.hp.bg.domain.HPBG003A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiBlockMeta;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG003C extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
Map<String,String> params = EiInfoUtils.getFirstRow(inInfo);
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
Long id = Long.parseLong(params.get(HPBG003.FIELD_ID));
HPBG003 hpbg003 = HPBGTools.HpBg003.get(id);
List<HPBG003A> hpbg003As = HPBGTools.HpBg003a.getByParentId(id, ReviewStatusEnum.UNSUBMITTED.getCode());
EiBlock resultBlock =new EiBlock(EiConstant.resultBlock);
resultBlock.setBlockMeta(new HPBG003().eiMetadata);
resultBlock.setRows(Collections.singletonList(hpbg003));
EiBlock detailBlock =new EiBlock(CommonConstant.Field.DETAIL);
detailBlock.setBlockMeta(new HPBG003A().eiMetadata);
detailBlock.setRows(hpbg003As);
inInfo.setBlock(resultBlock);
inInfo.setBlock(detailBlock);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG003A.FIELD_STATUS, ReviewStatusEnum.UNSUBMITTED.getCode());
return super.query(inInfo, HPBG003A.QUERY,new HPBG003A(),false,new EiBlockMeta(),EiConstant.queryBlock,CommonConstant.Field.DETAIL,CommonConstant.Field.DETAIL);
}
@OperationLogAnnotation(operModul = "办公用品领用",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
for (Map resultRow: resultRows) {
HPBG003A hpbg003a = new HPBG003A();
hpbg003a.fromMap(resultRow);
hpbg003a.setDeleteFlag(CommonConstant.YesNo.YES_1);
if (hpbg003a.getId() == null || hpbg003a.getId() == 0) {
continue;
}
AssertUtils.isTrue(hpbg003a.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法删除!");
DaoUtils.update(HPBG003A.DELETE, hpbg003a);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
......@@ -80,6 +80,9 @@
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -110,7 +113,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
ID desc
</isEmpty>
</dynamic>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG003
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
RECEIVE_DATE VARCHAR,
RECEIVE_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
RECEIVE_USER VARCHAR
-->
<sqlMap namespace="HPBG003">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
RECEIVE_DATE = #receiveDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveCode">
RECEIVE_CODE = #receiveCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUser">
RECEIVE_USER = #receiveUser#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG003">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0.否1.是 -->
RECEIVE_DATE as "receiveDate", <!-- 领用日期 -->
RECEIVE_CODE as "receiveCode", <!-- 领用单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
RECEIVE_USER as "receiveUser" <!-- 领用人员 -->
FROM ${hpjxSchema}.T_HPBG003 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
RECEIVE_DATE desc, ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG003 WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveDate">
RECEIVE_DATE = #receiveDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveCode">
RECEIVE_CODE = #receiveCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveUser">
RECEIVE_USER = #receiveUser#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG003 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
RECEIVE_DATE, <!-- 领用日期 -->
RECEIVE_CODE, <!-- 领用单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
RECEIVE_USER <!-- 领用人员 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#receiveDate#, #receiveCode#, #whCode#, #whName#, #receiveUser#)
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT MAX(ID) as "id" FROM ${hpjxSchema}.T_HPBG003
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG003 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG003
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
RECEIVE_DATE = #receiveDate#, <!-- 领用日期 -->
RECEIVE_CODE = #receiveCode#, <!-- 领用单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
RECEIVE_USER = #receiveUser# <!-- 领用人员 -->
WHERE
ID = #id#
</update>
</sqlMap>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-09-28 21:30:54
Version : 1.0
schema : hpjx
tableName : T_HPBG003A
ID BIGINT NOT NULL primarykey,
COMPANY_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT,
ITEM_TYPE TINYINT,
ITEM_CODE VARCHAR,
ITEM_NAME VARCHAR,
ITEM_MODEL VARCHAR,
ITEM_UNIT VARCHAR,
RECEIVE_QTY DECIMAL,
STATUS TINYINT,
PARENT_ID BIGINT
-->
<sqlMap namespace="HPBG003A">
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME like concat('%', #itemName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL like concat('%', #itemModel#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG003A">
SELECT
ID as "id",
COMPANY_CODE as "companyCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 更新人 -->
UPDATED_NAME as "updatedName", <!-- 更新人名称 -->
UPDATED_TIME as "updatedTime", <!-- 更新时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除0.否1.是 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
ITEM_NAME as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
RECEIVE_QTY as "receiveQty", <!-- 领用数量 -->
STATUS as "status", <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID as "parentId" <!-- 父级ID -->
FROM ${hpjxSchema}.T_HPBG003A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG003A WHERE 1=1
<include refid="condition" />
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemType">
ITEM_TYPE = #itemType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemCode">
ITEM_CODE = #itemCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemName">
ITEM_NAME = #itemName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemModel">
ITEM_MODEL = #itemModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="itemUnit">
ITEM_UNIT = #itemUnit#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiveQty">
RECEIVE_QTY = #receiveQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG003A (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
ITEM_TYPE, <!-- 用品分类 -->
ITEM_CODE, <!-- 用品编码 -->
ITEM_NAME, <!-- 用品名称 -->
ITEM_MODEL, <!-- 用品型号 -->
ITEM_UNIT, <!-- 用品单位 -->
RECEIVE_QTY, <!-- 领用数量 -->
STATUS, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID <!-- 父级ID -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #receiveQty#,
#status#, #parentId#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG003A WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = 1 <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<update id="update">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
ITEM_TYPE = #itemType#, <!-- 用品分类 -->
ITEM_CODE = #itemCode#, <!-- 用品编码 -->
ITEM_NAME = #itemName#, <!-- 用品名称 -->
ITEM_MODEL = #itemModel#, <!-- 用品型号 -->
ITEM_UNIT = #itemUnit#, <!-- 用品单位 -->
RECEIVE_QTY = #receiveQty#, <!-- 领用数量 -->
STATUS = #status#, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID = #parentId# <!-- 父级ID -->
WHERE
ID = #id#
</update>
<update id="updateBystatus">
UPDATE ${hpjxSchema}.T_HPBG003A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 审批状态0.未审核1.已审核 -->
WHERE
ID = #id#
</update>
</sqlMap>
package com.baosight.hpjx.hp.bg.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.bg.domain.HPBG001;
import com.baosight.hpjx.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
......@@ -49,5 +47,43 @@ public class HPBGTools {
List<HPBG002A> list = DaoBase.getInstance().query(HPBG002A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
public static List<HPBG002A> getByParentId(List<Long> parentIds){
AssertUtils.isTrue(parentIds.size()==0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentIds", parentIds);
params.put("deleteFlag", 0);
List<HPBG002A> list = DaoBase.getInstance().query(HPBG002A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
public static class HpBg003 {
public static HPBG003 get(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委外入库单ID不能为空!");
HPBG003 hpbg003 = (HPBG003) DaoBase.getInstance().get(HPBG003.QUERY,HPBG003.FIELD_ID, id);
return hpbg003;
}
}
public static class HpBg003a {
public static List<HPBG003A> getByParentId(Long parentId, Integer status){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentId", parentId);
params.put("status", status);
params.put("deleteFlag", 0);
List<HPBG003A> list = DaoBase.getInstance().query(HPBG003A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
public static List<HPBG003A> getByParentId(List<Long> parentIds){
AssertUtils.isTrue(parentIds.size()==0, "委外入库单ID不能为空!");
Map params = new HashMap();
params.put("parentIds", parentIds);
params.put("deleteFlag", 0);
List<HPBG003A> list = DaoBase.getInstance().query(HPBG003A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
}
......@@ -34,6 +34,11 @@ $(function() {
$("#BTN_UPDATE").on("click",updateFunc);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
item['depositDate'] = currShortDate()
......@@ -78,7 +83,7 @@ let query = function () {
function detailFunc(id) {
JSColorbox.open({
href: "HPBG002A?methodName=initLoad&id=" + id + "&efParentFormEname=HPBG002",
href: "HPBG002A?methodName=initLoad&inqu_status-0-parentId=" + id + "&efParentFormEname=HPBG002",
title: "<div style='text-align: center;'>办公入库详情</div>",
width: "80%",
height: "80%",
......@@ -108,7 +113,7 @@ function updateFunc() {
message("请选择一条数据");
return;
}
if (rows[0].reviewStatus == "3") {
if (rows[0].status == "3") {
message("已经提交的数据不能进行修改!");
return;
}
......@@ -166,6 +171,32 @@ function btnSaveFunc(btnNode) {
}
function deleteFunc(){
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
let flag = true;
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG002", "delete", true,
function (e) {
var status = e.getStatus();
if (status !== -1) {
NotificationUtil(e.msg);
query();
}else {
NotificationUtil(e.msg, "error");
}
}
);
}
});
}
}
/**
* 文件上传
*
......
......@@ -22,6 +22,7 @@
<EF:EFPage title="办公用品入库明细">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="itemName" cname="用品名称" placeholder="模糊查询用品名称" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="itemModel" cname="用品型号" placeholder="模糊查询用品型号" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="审批状态" colWidth="3" filter="contains">
......
......@@ -117,6 +117,25 @@ function cancelFunc() {
function btnSaveFunc() {
let flag = true;
flag = fieldValidation();
let rows = detailGrid.getDataItems();
if (rows.length < 1) {
message("请添加数据");
return false;
}
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
flag = false;
return false;
}
let invQty= item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"入库数量\"不能为0!");
flag = false;
return false;
}
})
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
......@@ -160,23 +179,6 @@ function fieldValidation() {
message("入库人员不能为空!");
return false;
}
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请添加数据");
return false;
}
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
return false;
}
let invQty= item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"入库数量\"不能为0!");
return false;
}
})
return true;
}
......
......@@ -117,6 +117,31 @@ function cancelFunc() {
function btnSaveFunc() {
let flag = true;
flag = fieldValidation();
let rows = detailGrid.getDataItems();
if (rows.length < 1) {
message("请添加数据");
return false;
}
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
flag = false;
return false;
}
let invQty= item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"入库数量\"不能为0!");
flag = false;
return false;
}
let status= item.get("status");
if(status == 3){
message("选中的第"+(index+1)+"行\"审批状态\"已提交,无法操作");
flag = false;
return false;
}
})
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
......@@ -156,7 +181,7 @@ function deleteResult1Func() {
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPBG002A", "delete", true,
JSUtils.submitGridsData("detail", "HPBG002C", "delete", true,
function (ei) {
if (ei.getStatus() >= 0) {
detailGrid.dataSource.page(1);
......@@ -190,27 +215,5 @@ function fieldValidation() {
message("入库人员不能为空!");
return false;
}
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请添加数据");
return false;
}
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
return false;
}
let invQty= item.get("invQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"入库数量\"不能为0!");
return false;
}
let status= item.get("status");
if(status == 3){
message("选中的第"+(index+1)+"行\"审批状态\"已提交,无法操作");
return false;
}
})
return true;
}
......@@ -41,6 +41,7 @@
<EF:EFRegion id="detail" title="记录详情">
<EF:EFGrid blockId="detail" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="parentId" cname="父级ID" hidden="true"/>
<EF:EFComboColumn ename="itemCode" cname="用品名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......@@ -49,11 +50,11 @@
<EF:EFOptions blockId="itemCode_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemName" cname="用品名称" hidden="true"/>
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" align="center" readonly="false" required="true">
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" enable="false" align="center" readonly="false" required="true">
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemModel" cname="用品型号" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemModel" cname="用品型号" width="120" enable="false" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="false" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="invQty" cname="入库数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}?$/"
......
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid = {
"result": {
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let BG003 = "BG003";
let template = "";
if (item.id) {
template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="detailFunc(' + item.id + ')">详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px"'
+ ' onclick="uploadFile(' + item.id + ',\''+BG003+'\')" >附件清单</a>';
}
return template;
}
}
],
loadComplete: function(grid) {
// 此 grid 对象
$("#QUERY").on("click", function () {
grid.dataSource.page(1);
});
$("#BTN_INSERT").on("click",addFunc);
$("#BTN_UPDATE").on("click",updateFunc);
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
item['sellDate'] = currShortDate()
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
btnSaveFunc(btnNode);
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
}
};
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
grid.closeCell();
}
})
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
function detailFunc(id) {
JSColorbox.open({
href: "HPBG003A?methodName=initLoad&&inqu_status-0-parentId=" + id + "&efParentFormEname=HPBG003",
title: "<div style='text-align: center;'>销售详情</div>",
width: "80%",
height: "80%",
callbackName: windowCallback
});
}
/**
* 新增
*/
function addFunc() {
JSColorbox.open({
href: "HPBG003B?methodName=initLoad&efParentFormEname=HPBG003",
title: "<div style='text-align: center;'>新增办公用品领用</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
/**
* 修改
*/
function updateFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length != 1) {
message("请选择一条数据");
return;
}
if (rows[0].status == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({
href: "HPBG003C?methodName=initLoad&inqu_status-0-id=" + rows[0].id + "&efParentFormEname=HPBG003",
title: "<div style='text-align: center;'>修改办公用品领用</div>",
width: "90%",
height: "90%",
callbackName: windowCallback
});
}
function btnSaveFunc(btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
let flag = true;
rows.forEach(function (item,index){
if (isBlank(item.sellDate)){
message("选中的第"+(index+1)+"行\"推广日期\",不能为空!");
flag = false;
return false;
}
if (isBlank(item.sourceFunds)){
message("选中的第"+(index+1)+"行\"推广名称\",不能为空!");
flag = false;
return false;
}
if (isBlank(item.goalAmount) || !isNumber(item.goalAmount)){
message("选中的第"+(index+1)+"行\"目标销售额\",不能为空!");
flag = false;
return false;
}
if (isBlank(item.budget) || !isNumber(item.budget)){
message("选中的第"+(index+1)+"行\"推广预算\",不能为空!");
flag = false;
return false;
}
})
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPYX010", "save",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
NotificationUtil(e.msg);
query();
}else {
NotificationUtil(e.msg, "error");
}
btnNode.attr("disabled", false);
}
);
}
});
}
}
function deleteFunc(){
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
let flag = true;
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG003", "delete", true,
function (e) {
var status = e.getStatus();
if (status !== -1) {
NotificationUtil(e.msg);
query();
}else {
NotificationUtil(e.msg, "error");
}
btnNode.attr("disabled", false);
}
);
}
});
}
}
/**
* 文件上传
*
* @param id 业务主键
* @param bizType 业务类型
*/
function uploadFile(id,bizType) {
JSColorbox.open({
href: "HPSB099?methodName=initLoad&inqu_status-0-matId="+id+"&inqu_status-0-bizType="+bizType,
title: "<div style='text-align: center;'>附件清单</div>",
width: "60%",
height: "50%",
//callbackName: uploadFileCallback
});
}
function windowCallback() {
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/28
Time: 21:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="办公用品领用">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker blockId="inqu_status" row="0" ename="receiveDate" cname="领用日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="receiveUser" cname="领用人员" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<%--blockName="factoryCodeBox_block_id"--%>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<EF:EFColumn ename="receiveDate" cname="领用日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="receiveCode" cname="领用单号" width="100" enable="false" readonly="true" align="center" required="false"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="100" readonly="false" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" hidden="true"/>
<EF:EFComboColumn ename="receiveUser" cname="领用人员" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" defaultValue="${loginName}"
maxLength="16" width="100" readonly="false" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn cname="创建人" ename="createdName" align="center" width="120" readonly="true" required="false"
enable="false"/>
<EF:EFColumn cname="创建时间" ename="createdTime" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid = {
"result": {
columns: [
],
loadComplete: function(grid) {
// 此 grid 对象
$("#QUERY").on("click", function () {
grid.dataSource.page(1);
});
$("#SUBMIT").on("click", submitFunc)
},
}
};
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
grid.closeCell();
}
})
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
function submitFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(isBlank(status) || status == 3){
message("选中的第"+(index+1)+"行\"已审批\",不能重复审批!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG003A", "submit", true,
function (ei) {
if (ei.getStatus() != -1){
query();
}
});
}
});
}
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/28
Time: 21:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="办公用品领用明细">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput blockId="inqu_status" row="0" ename="parentId" cname="父级ID" type="hidden"/>
<EF:EFInput blockId="inqu_status" row="0" ename="itemName" cname="用品名称" placeholder="模糊查询用品名称" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="itemModel" cname="用品型号" placeholder="模糊查询用品型号" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="审批状态" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('2','3')"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="itemCode" cname="用品编码" width="100" enable="false" readonly="true" align="center" required="false"/>
<EF:EFColumn ename="itemName" cname="用品名称" width="160" enable="true" readonly="false" align="center" required="true"/>
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" align="center" readonly="false" required="true" >
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemModel" cname="用品型号" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="receiveQty" cname="领用数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFComboColumn ename="status" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="2">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('2','3')"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function() {
var itemCodeBox = __eiInfo.getBlock("itemCode_block_id").getMappedRows();
$("#result-0-receiveDate").val(currShortDate());
$("#cancel").on("click", function () {
cancelFunc();
});
$("#btn_save").on("click", function () {
btnSaveFunc();
});
IPLATUI.EFGrid.detail = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
{
field: "itemCode",
filter: function (options) {
let whCode = $("#result-0-whCode").val();
if (whCode){
return _.filter(itemCodeBox, function (item) {
return item["param5Field"]==whCode ;
})
}
return options.values;
},
template: function (item) {
for (let i = 0; i < itemCodeBox.length; i++) {
if (itemCodeBox[i]['valueField'] === item['itemCode']){
return itemCodeBox[i]['textField'].split("-")[0];
}
}
return item["itemCode"]
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function(e) {
let item = e.items[0];
if (e.field === "itemCode") {
for (let i = 0; i < itemCodeBox.length; i++) {
if (itemCodeBox[i]['valueField'] === item['itemCode']) {
detailGrid.setCellValue(item,"itemName",itemCodeBox[i]['textField'].split("-")[0]);
detailGrid.setCellValue(item,"itemModel",itemCodeBox[i]['param1Field']);
detailGrid.setCellValue(item,"itemType",itemCodeBox[i]['param2Field']);
detailGrid.setCellValue(item,"itemUnit",itemCodeBox[i]['param3Field']);
break;
}
}
}
});
},
onAdd: function (e) {
let whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
e.preventDefault();
}
},
onSave: function (e) {
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFileFunc();
}
}
$("#DELETE_FILE").on("click", function () {
deleteFileFunc();
});
/**
* 下拉框事件
*/
IPLATUI.EFSelect = {
"result-0-whCode": {
// 点击下拉选项时触发
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = "";
if (valueField) {
textField = dataItem['textField'];
$("#result-0-whCode").val(valueField);
$("#result-0-whName").val(textField);
}
}
}
}
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
});
function cancelFunc() {
// 关闭弹窗
parent.JSColorbox.close();
}
function btnSaveFunc() {
let flag = true;
flag = fieldValidation();
let rows = detailGrid.getDataItems();
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
flag = false;
return false;
}
let invQty= item.get("receiveQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"入库数量\"不能为0!");
flag = false;
return false;
}
})
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HPBG003", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
}
function deleteFileFunc() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
rows.forEach(function (row) {
detailGrid.removeRows([row.rowNo]);// 刷新行号
})
refreshRowNo();
}
let refreshRowNo = function () {
let allRows = detailGrid.getDataItems();
for (let i = 0; i < allRows.length; i++) {
detailGrid.setCellValue(i, "rowNo", i);
detailGrid.refresh();
}
}
function fieldValidation() {
var receiveDate = $("#result-0-receiveDate").val();
if (isBlank(receiveDate)) {
message("请选择领用日期!");
return false;
}
var whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
return false;
}
var receiveUser = $("#result-0-receiveUser").val();
if (isBlank(receiveUser)) {
message("领用人员不能为空!");
return false;
}
return true;
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 10:00
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="新增办公用品领用">
<EF:EFRegion id="inqu" title="基本信息">
<div class="row">
<EF:EFDatePicker ename="result-0-receiveDate" cname="领用日期" colWidth="4" required="true"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFSelect cname="仓库名称" ename="result-0-whCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="请选择仓库" value=""/>
<EF:EFOptions blockId="wh_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-whName" cname="仓库名称" colWidth="4" readonly="true" type="hidden"/>
<EF:EFInput ename="result-0-receiveCode" cname="领用单号" colWidth="4" readonly="true" defaultValue="0"/>
<EF:EFSelect ename="result-0-receiveUser" cname="领用人员" colWidth="4" filter="contains"
required="true" defaultValue="${loginName}">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail" title="记录详情">
<EF:EFGrid blockId="detail" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFComboColumn ename="itemCode" cname="用品名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="itemCode_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemName" cname="用品名称" hidden="true"/>
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" enable="false" align="center" readonly="false" required="true">
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemModel" cname="用品型号" width="120" enable="false" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="false" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="receiveQty" cname="领用数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFComboColumn ename="status" cname="审批状态" width="80" enable="false" align="center" readonly="false" required="true" defaultValue="2">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('2','3')"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</EF:EFPage>
$(function() {
var itemCodeBox = __eiInfo.getBlock("itemCode_block_id").getMappedRows();
$("#result-0-sellDate").val(currShortDate())
$("#result-0-whCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-whCode"));
$("#result-0-whName").val(textField);
})
$("#cancel").on("click", function () {
cancelFunc();
});
$("#btn_save").on("click", function () {
btnSaveFunc();
});
IPLATUI.EFGrid.detail = {
pageable: {
pageSize: 20,
pageSizes: [10,20,30,50,100,200],
},
columns: [
{
field: "itemCode",
filter: function (options) {
let whCode = $("#result-0-whCode").val();
if (whCode){
return _.filter(itemCodeBox, function (item) {
return item["param5Field"]==whCode ;
})
}
return options.values;
},
template: function (item) {
for (let i = 0; i < itemCodeBox.length; i++) {
if (itemCodeBox[i]['valueField'] === item['itemCode']){
return itemCodeBox[i]['textField'].split("-")[0];
}
}
return item["itemCode"]
}
}
],
loadComplete: function (grid) {
grid.dataSource.bind("change", function(e) {
let item = e.items[0];
if (e.field === "itemCode") {
for (let i = 0; i < itemCodeBox.length; i++) {
if (itemCodeBox[i]['valueField'] === item['itemCode']) {
detailGrid.setCellValue(item,"itemName",itemCodeBox[i]['textField'].split("-")[0]);
detailGrid.setCellValue(item,"itemModel",itemCodeBox[i]['param1Field']);
detailGrid.setCellValue(item,"itemType",itemCodeBox[i]['param2Field']);
detailGrid.setCellValue(item,"itemUnit",itemCodeBox[i]['param3Field']);
break;
}
}
}
});
},
onAdd: function (e) {
let whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
e.preventDefault();
}
},
onSave: function (e) {
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteResult1Func();
}
}
$("#DELETE_FILE").on("click", function () {
deleteFileFunc();
});
/**
* 下拉框事件
*/
IPLATUI.EFSelect = {
"result-0-whCode": {
// 点击下拉选项时触发
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var textField = "";
if (valueField) {
textField = dataItem['textField'];
$("#result-0-whCode").val(valueField);
$("#result-0-whName").val(textField);
}
}
}
}
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
});
function cancelFunc() {
// 关闭弹窗
parent.JSColorbox.setValueCallback();
}
function btnSaveFunc() {
let flag = true;
flag = fieldValidation();
let rows = detailGrid.getDataItems();
if (rows.length < 1) {
message("请添加数据");
return false;
}
$.each(rows, function(index, item) {
let itemCode= item.get("itemCode");
if(isBlank(itemCode)){
message("选中的第"+(index+1)+"行\"用品名称\"不能为空!");
flag = false;
return false;
}
let invQty= item.get("receiveQty");
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"领用数量\"不能为0!");
flag = false;
return false;
}
let status= item.get("status");
if(status == 3){
message("选中的第"+(index+1)+"行\"审批状态\"已提交,无法操作");
flag = false;
return false;
}
})
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HPBG003", "save", {isAlldata:true,onSuccessCallback:parent.windowCallback});
}
});
}
function deleteFileFunc() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
rows.forEach(function (row) {
detailGrid.removeRows([rows.rowNo]);// 刷新行号
})
refreshRowNo();
}
let refreshRowNo = function () {
let allRows = detailGrid.getDataItems();
for (let i = 0; i < allRows.length; i++) {
detailGrid.setCellValue(i, "rowNo", i);
detailGrid.refresh();
}
}
function deleteResult1Func() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
flag = fieldValidation();
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("detail", "HPBG003C", "delete", true,
function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
})
}
});
}
}
function fieldValidation() {
var depositDate = $("#result-0-receiveDate").val();
if (isBlank(depositDate)) {
message("请选择领用日期!");
return false;
}
var whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
return false;
}
var depositUser = $("#result-0-receiveUser").val();
if (isBlank(depositUser)) {
message("领用人员不能为空!");
return false;
}
return true;
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 10:01
To change this template use File | Settings | File Templates.
--%>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script>
var ctx = "${ctx}";
</script>
<EF:EFPage title="修改办公用品领用">
<EF:EFRegion id="inqu" title="基本信息">
<div class="row">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<EF:EFDatePicker ename="result-0-receiveDate" cname="领用日期" colWidth="4" required="true"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput ename="result-0-receiveCode" cname="领用单号" colWidth="4" readonly="true" defaultValue="0"/>
<EF:EFSelect cname="仓库名称" ename="result-0-whCode" colWidth="4" required="true" filter="contains">
<EF:EFOption label="请选择仓库" value=""/>
<EF:EFOptions blockId="wh_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFSelect>
<EF:EFInput ename="result-0-whName" cname="仓库名称" colWidth="4" readonly="true" type="hidden"/>
<EF:EFSelect ename="result-0-receiveUser" cname="领用人员" colWidth="4" filter="contains"
required="true" defaultValue="${loginName}">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="detail" title="记录详情">
<EF:EFGrid blockId="detail" autoDraw="override" checkMode="row" isFloat="true" copyToAdd="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="parentId" cname="父级ID" hidden="true"/>
<EF:EFComboColumn ename="itemCode" cname="用品名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="itemCode_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemName" cname="用品名称" hidden="true"/>
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" align="center" readonly="false" required="true">
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemModel" cname="用品型号" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="true" readonly="false" align="center" required="false"/>
<EF:EFColumn ename="receiveQty" cname="领用数量" width="120" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFComboColumn ename="status" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="2">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('2','3')"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
<div class="row" style="display:flex;justify-content:center;">
<EF:EFButton ename="cancel" cname="取消" type="button" class="btn-center"/>
<EF:EFButton ename="btn_save" cname="保存" type="button" class="btn-center"/>
</div>
</EF:EFPage>
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