Commit 17abfe03 by liuyang

2024-10-08 办公用品入库

parent 47a0bb58
package com.baosight.hpjx.hp.bg.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
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.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.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;
/**
* @author LiuYang
* @version 1.0 2024/9/28
* @description 办公用品入库
*/
public class ServiceHPBG002 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 HPBG002().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG002.QUERY,new HPBG002());
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG002.DELETE_FLAG);
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
Map resultRow = EiInfoUtils.getFirstRow(inInfo, EiConstant.resultBlock);
HPBG002 hpbg002 = new HPBG002();
hpbg002.fromMap(resultRow);
if (hpbg002.getId() == null || hpbg002.getId() == 0){
this.add(hpbg002);
}else {
this.modify(hpbg002);
}
List<Map> detailRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
// 写入数据
for (Map detailRow : detailRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(detailRow);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
hpbg002a.setParentId(hpbg002.getId());
DaoUtils.insert(HPBG002A.INSERT, hpbg002a);
} else {
DaoUtils.update(HPBG002A.UPDATE, hpbg002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + detailRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG002 hpbg002) {
hpbg002.setDepositCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG002_DEPOSIT_CODE));
DaoUtils.insert(HPBG002.INSERT, hpbg002);
}
/**
* 修改操作
*/
public void modify(HPBG002 hpbg002) {
DaoUtils.update(HPBG002.UPDATE, hpbg002);
}
}
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.HPBG001;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.domain.HPBG004;
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 ServiceHPBG002A extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID,
DdynamicEnum.WH_RECORD_BLOCK_ID,
DdynamicEnum.USER_BLOCK_ID
), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPBG002A().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG002A.QUERY,new HPBG002A());
}
@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;
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG002A hpbg002a = new HPBG002A();
hpbg002a.fromMap(resultRow);
if (hpbg002a.getId() == null || hpbg002a.getId() == 0) {
this.add(hpbg002a);
} else {
this.modify(hpbg002a);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG002A hpbg002a) {
DaoUtils.insert(HPBG002A.INSERT, hpbg002a);
}
/**
* 修改操作
*/
public void modify(HPBG002A hpbg002a) {
DaoUtils.update(HPBG002A.UPDATE, hpbg002a);
}
@OperationLogAnnotation(operModul = "办公用品入库",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG002A> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG002A.class);
List<String> itemCodes = ObjectUtils.listEpKey(resultRows, HPBG002A.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG002A hpbg002A : resultRows) {
AssertUtils.isTrue(hpbg002A.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法重复提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg002A.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg002A.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().add(hpbg002A.getInvQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg002A.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG002A.UPDATE_BY_STATUS, 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.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.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
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;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
public class ServiceHPBG002B 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.hp.bg.domain.HPBG002;
import com.baosight.hpjx.hp.bg.domain.HPBG002A;
import com.baosight.hpjx.hp.bg.tools.HPBGTools;
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 ServiceHPBG002C 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(HPBG002.FIELD_ID));
HPBG002 hpbg002 = HPBGTools.HpBg002.get(id);
List<HPBG002A> hpbg002As = HPBGTools.HpBg002a.getByParentId(id,ReviewStatusEnum.UNSUBMITTED.getCode());
EiBlock resultBlock =new EiBlock(EiConstant.resultBlock);
resultBlock.setBlockMeta(new HPBG002().eiMetadata);
resultBlock.setRows(Collections.singletonList(hpbg002));
EiBlock detailBlock =new EiBlock(CommonConstant.Field.DETAIL);
detailBlock.setBlockMeta(new HPBG002A().eiMetadata);
detailBlock.setRows(hpbg002As);
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, HPBG002A.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
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);
}
}
<?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_HPBG002
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,
DEPOSIT_DATE VARCHAR,
DEPOSIT_CODE VARCHAR,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
DEPOSIT_USER VARCHAR
-->
<sqlMap namespace="HPBG002">
<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="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE = #depositCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositUser">
DEPOSIT_USER = #depositUser#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG002">
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.是 -->
DEPOSIT_DATE as "depositDate", <!-- 入库日期 -->
DEPOSIT_CODE as "depositCode", <!-- 入库单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
DEPOSIT_USER as "depositUser" <!-- 入库人员 -->
FROM ${hpjxSchema}.T_HPBG002 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
DEPOSIT_DATE DESC, ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG002 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="depositDate">
DEPOSIT_DATE = #depositDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositCode">
DEPOSIT_CODE = #depositCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depositUser">
DEPOSIT_USER = #depositUser#
</isNotEmpty>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG002 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
DEPOSIT_DATE, <!-- 入库日期 -->
DEPOSIT_CODE, <!-- 入库单号 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
DEPOSIT_USER <!-- 入库人员 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#depositDate#, #depositCode#, #whCode#, #whName#, #depositUser#)
<selectKey resultClass="java.lang.Long" keyProperty="id" >
SELECT MAX(ID) as "id" FROM ${hpjxSchema}.T_HPBG002
</selectKey>
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG002 WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG002
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_HPBG002
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
DEPOSIT_DATE = #depositDate#, <!-- 入库日期 -->
DEPOSIT_CODE = #depositCode#, <!-- 入库单号 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
DEPOSIT_USER = #depositUser# <!-- 入库人员 -->
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_HPBG002A
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,
INV_QTY DECIMAL,
STATUS TINYINT,
PARENT_ID BIGINT
-->
<sqlMap namespace="HPBG002A">
<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="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG002A">
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", <!-- 用品单位 -->
INV_QTY as "invQty", <!-- 入库数量 -->
STATUS as "status", <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID as "parentId" <!-- 父级ID -->
FROM ${hpjxSchema}.T_HPBG002A WHERE 1=1
<include refid="condition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG002A 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="invQty">
INV_QTY = #invQty#
</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_HPBG002A (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, <!-- 用品单位 -->
INV_QTY, <!-- 入库数量 -->
STATUS, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID <!-- 父级ID -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #invQty#, #status#, #parentId#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG002A WHERE
ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG002A
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_HPBG002A
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#, <!-- 用品单位 -->
INV_QTY = #invQty#, <!-- 入库数量 -->
STATUS = #status#, <!-- 审批状态0.未审核1.已审核 -->
PARENT_ID = #parentId# <!-- 父级ID -->
WHERE
ID = #id#
</update>
<update id="updateBystatus">
UPDATE ${hpjxSchema}.T_HPBG002A
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
STATUS = #status# <!-- 审批状态0.未审核1.已审核 -->
WHERE
ID = #id#
</update>
</sqlMap>
...@@ -2,13 +2,13 @@ package com.baosight.hpjx.hp.bg.tools; ...@@ -2,13 +2,13 @@ package com.baosight.hpjx.hp.bg.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.bg.domain.HPBG001; 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.util.AssertUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author LiuYang * @author LiuYang
...@@ -30,4 +30,24 @@ public class HPBGTools { ...@@ -30,4 +30,24 @@ public class HPBGTools {
return CollectionUtils.isEmpty(list)?new ArrayList<>():list; return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
} }
} }
public static class HpBg002 {
public static HPBG002 get(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委外入库单ID不能为空!");
HPBG002 hpbg002 = (HPBG002) DaoBase.getInstance().get(HPBG002.QUERY,HPBG002.FIELD_ID, id);
return hpbg002;
}
}
public static class HpBg002a {
public static List<HPBG002A> 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<HPBG002A> list = DaoBase.getInstance().query(HPBG002A.QUERY,params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
} }
$(function() {
// 查询
$("#QUERY").on("click", function () {
query();
});
IPLATUI.EFGrid = {
"result": {
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let BG002 = "BG002";
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 + ',\''+BG002+'\')" >附件清单</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['depositDate'] = 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: "HPBG002A?methodName=initLoad&id=" + id + "&efParentFormEname=HPBG002",
title: "<div style='text-align: center;'>办公入库详情</div>",
width: "80%",
height: "80%",
callbackName: windowCallback
});
}
/**
* 新增
*/
function addFunc() {
JSColorbox.open({
href: "HPBG002B?methodName=initLoad&efParentFormEname=HPBG002",
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].reviewStatus == "3") {
message("已经提交的数据不能进行修改!");
return;
}
JSColorbox.open({
href: "HPBG002C?methodName=initLoad&inqu_status-0-id=" + rows[0].id + "&efParentFormEname=HPBG002",
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.depositDate)){
message("选中的第"+(index+1)+"行\"入库日期\",不能为空!");
flag = false;
return false;
}
if (isBlank(item.whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if (isBlank(item.depositUser)){
message("选中的第"+(index+1)+"行\"入库人员\",不能为空!");
flag = false;
return false;
}
})
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG002", "save", 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:48
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="sellDate" cname="入库日期" role="date"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="clientName" 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="sellUser" 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="depositDate" cname="入库日期" width="120" enable="true" readonly="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="depositCode" 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="depositUser" 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", "HPBG002A", "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:48
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="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" defaultValue="1">
<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="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}?$/"
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-depositDate").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();
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();
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HPBG002", "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 depositDate = $("#result-0-depositDate").val();
if (isBlank(depositDate)) {
message("请选择入库日期!");
return false;
}
var whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
return false;
}
var depositUser = $("#result-0-depositUser").val();
if (isBlank(depositUser)) {
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;
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/28
Time: 13:31
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="inqu1" title="基本信息">
<div class="row">
<EF:EFDatePicker ename="result-0-depositDate" cname="入库日期" colWidth="3" required="true"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFSelect cname="仓库名称" ename="result-0-whCode" colWidth="3" 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="3" readonly="true" type="hidden"/>
<EF:EFInput ename="result-0-depositCode" cname="入库单号" colWidth="3" readonly="true" defaultValue="0"/>
<EF:EFSelect ename="result-0-depositUser" cname="入库人员" colWidth="3" 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">
<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="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}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFComboColumn ename="status" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="2" hidden="true">
<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-whCode").change(function () {
let textField = IPLAT.EFSelect.text($("#result-0-whCode"));
$("#result-0-whName").val(textField);
})
$("#result-0-sellDate").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();
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();
if(flag)
JSUtils.confirm("确定对数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGrid("detail", "HPBG002", "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 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", "HPBG002A", "delete", true,
function (ei) {
if (ei.getStatus() >= 0) {
detailGrid.dataSource.page(1);
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
})
}
});
}
}
function fieldValidation() {
var depositDate = $("#result-0-depositDate").val();
if (isBlank(depositDate)) {
message("请选择入库日期!");
return false;
}
var whCode = $("#result-0-whCode").val();
if (isBlank(whCode)) {
message("请选择仓库名称!");
return false;
}
var depositUser = $("#result-0-depositUser").val();
if (isBlank(depositUser)) {
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;
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/29
Time: 10:05
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="inqu1" title="基本信息">
<div class="row">
<EF:EFInput ename="result-0-id" cname="id" type="hidden"/>
<EF:EFDatePicker ename="result-0-depositDate" cname="入库日期" colWidth="4" required="true"
format="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFInput ename="result-0-depositCode" 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-depositUser" 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" 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="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}?$/"
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