Commit d43340b6 by liuyang

2024-06-11 库存盘点单

parent 4bae64d6
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.kc.domain.HGKC005;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.yx.domain.HGYX001;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/6/11
*/
public class ServiceHGKC005 extends ServiceEPBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.WASTE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
//queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.INVENT_RECORD_BLOCK_ID,
DdynamicEnum.SPEC_RECORD_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_BLOCK_ID), queryMap);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC005().eiMetadata);
UserVO userVO = HGCWTools.HgCw002.getUserCompany();
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGYX001.FIELD_COMPANY_CODE, userVO.getUsercode());
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGYX001.FIELD_COMPANY_NAME, userVO.getUsername());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存盘点单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, HGKC005.FIELD_RECEIPT_DATE);
if (StringUtils.isNotEmpty(receiptDate)) {
queryRow.put(HGKC005.FIELD_RECEIPT_DATE, StringUtil.removeHorizontalLine(receiptDate));
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC005.FIELD_RECEIPT_DATE, StringUtil.removeHorizontalLine(receiptDate));
}
inInfo = super.query(inInfo, HGKC005.QUERY, new HGKC005());
List sum = dao.query(HGSqlConstant.HGKC005.QUERY_SUM, queryRow);
inInfo.getBlock(EiConstant.resultBlock).set(EiConstant.COLUMN_TOTAL_SUM, sum.get(0));
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "其他入库单", operType = "插入", operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 写入数据
this.saveData(resultRows);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 保存数据
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) {
for (Map resultRow : resultRows) {
HGKC005 fKc005 = new HGKC005();
fKc005.fromMap(resultRow);
if (fKc005.getId() == null || fKc005.getId() == 0) {
this.addData(fKc005);
} else {
// TODO 盘点不支持修改
}
}
}
/**
* 新增数据
*
* @param fKc005
*/
private void addData(HGKC005 fKc005) {
// 设置基础信息
this.setBaseInfo(fKc005);
// 生成单据号
fKc005.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CHECK_NO));
DaoUtils.insert(HGKC005.INSERT, fKc005);
// 修改库存
HGKCTools.updateStock(fKc005.getWhCode(), fKc005.getInventRecordId(),
fKc005.getDiffAmount(), fKc005.getDiffWeight(),fKc005.getCompanyCode(),fKc005.getCompanyName());
}
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HGKC005 fKc005 = new HGKC005();
fKc005.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fKc005.getInventCode(), "存货类型不能为空");
AssertUtils.isEmpty(fKc005.getWhCode(), "仓库名称不能为空");
AssertUtils.isEmpty(fKc005.getInventCode(), "存货名称不能为空");
AssertUtils.isNull(fKc005.getInventRecordId(), "规格不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc005.getBookAmount(), "账面数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc005.getEntityAmount(), "实物重量必须大于0");
}
}
/**
* 设置基础信息
*
* @param fKc005
*/
private void setBaseInfo(HGKC005 fKc005) {
// 去除日期字符串中的-
fKc005.setReceiptDate(StringUtil.removeHorizontalLine(fKc005.getReceiptDate()));
// 仓库名称
fKc005.setWhName(HGPZTools.HgPz007.get(fKc005.getWhCode()).getWhName());
// 存货名称
fKc005.setInventName(HGPZTools.HgPz005.getByCode(fKc005.getInventCode()).getInventName());
// 根据规格计算账面单重
BigDecimal unitWeight = HGPZTools.HgPz005.calcUnitWeight(fKc005.getInventRecordId());
fKc005.setBookUnitWeight(unitWeight);
fKc005.setEntityUnitWeight(unitWeight);
// 计算总重
fKc005.setBookWeight(fKc005.getBookAmount().multiply(unitWeight).divide(new BigDecimal("1000")));
fKc005.setEntityWeight(fKc005.getEntityAmount().multiply(unitWeight).divide(new BigDecimal("1000")));
// 差异数量
fKc005.setDiffAmount(fKc005.getEntityAmount().subtract(fKc005.getBookAmount()));
// 差异重量
fKc005.setDiffWeight(fKc005.getEntityWeight().subtract(fKc005.getBookWeight()));
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存盘点单",operType = "删除",operDesc = "删除")
@Override
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 盘点单号
List<String> checkNos = ObjectUtils.listKey(resultRows, HGKC005.FIELD_CHECK_NO);
// 锁记录
HGKCTools.HgKc005.lock(checkNos);
// 查询数据库记录
Map<String, HGKC005> mapKc005 = HGKCTools.HgKc005.map(checkNos);
// 删除数据
this.deleteData(resultRows, mapKc005);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 删除数据
*
* @param resultRows
* @param mapKc005
*/
private void deleteData(List<Map> resultRows, Map<String, HGKC005> mapKc005) {
for (int i = 0; i < resultRows.size(); i++) {
HGKC005 fKc005 = new HGKC005();
fKc005.fromMap(resultRows.get(i));
DaoUtils.update(HGKC005.DELETE, fKc005);
// 原盘点单
HGKC005 dbKc005 = mapKc005.get(fKc005.getCheckNo());
// 生成红冲记录
HGKC005 newKc005 = BeanUtils.copy(dbKc005, HGKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CHECK_NO));
newKc005.setDiffAmount(dbKc005.getDiffAmount().negate());
newKc005.setDiffWeight(dbKc005.getDiffWeight().negate());
newKc005.setOldCheckNo(dbKc005.getCheckNo());
newKc005.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HGKC005.INSERT, newKc005);
// 修改库存
HGKCTools.updateStock(fKc005);
}
}
}
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC005;
import com.baosight.hggp.hg.kc.domain.HGKC010;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.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.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/6/11
*/
public class ServiceHGKC005A extends ServiceEPBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.WASTE.getCode()};
/**
* 初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
//queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(
DdynamicEnum.INVENT_RECORD_BLOCK_ID,
DdynamicEnum.SPEC_RECORD_BLOCK_ID,
DdynamicEnum.INVENT_TYPE_BLOCK_ID), queryMap);
//CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC010().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询数据列表
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "库存查询", operType = "查询", operDesc = "库存盘点单-库存查询-查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0,HGKC005.FIELD_IS_AMOUNT,CommonConstant.YesNo.YES);
inInfo = super.query(inInfo, HGKC010.QUERY, new HGKC010());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 生产盘点单
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存查询",operType = "插入",operDesc = "库存盘点单-库存查询-生成盘点单")
public EiInfo select(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 库存ID
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC005.FIELD_ID);
// 行锁
HGKCTools.HgKc010.lock(ids);
// 获取库存信息
Map<Long, HGKC010> dbKc010Map = HGKCTools.HgKc010.map(ids);
// 状态校验
this.checkData(resultRows, dbKc010Map);
// 生成盘点单
this.saveData(resultRows, dbKc010Map);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "生成盘点单失败");
}
return inInfo;
}
/**
* 校验数据
*
* @param resultRows
* @param dbKc010Map
*/
private void checkData(List<Map> resultRows, Map<Long, HGKC010> dbKc010Map) {
for (Map row : resultRows) {
Long id = MapUtils.getLong(row, HGKC005.FIELD_ID);
HGKC010 dbKc010 = dbKc010Map.get(id);
AssertUtils.isNull(dbKc010, "库存号[" + id + "]不存在!");
// 校验数量
BigDecimal entityAmount = MapUtils.getBigDecimal(row, HGKC005.FIELD_ENTITY_AMOUNT);
AssertUtils.isGt(BigDecimal.ZERO, entityAmount, "库存号[" + id + "]实物数量不能小于0!");
}
}
/**
* 保存数据
*
* @param resultRows
* @param dbKc010Map
*/
private void saveData(List<Map> resultRows, Map<Long, HGKC010> dbKc010Map) {
for (Map row : resultRows) {
BigDecimal entityAmount = MapUtils.getBigDecimal(row,HGKC005.FIELD_ENTITY_AMOUNT);
String entityRemark = MapUtils.getString(row, "entityRemark");
Long kcId = MapUtils.getLong(row, HGKC005.FIELD_ID);
HGKC010 dbKc010 = dbKc010Map.get(kcId);
// 生成盘点单
HGKC005 newKc005 = BeanUtils.copy(dbKc010, HGKC005.class);
newKc005.setCheckNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CHECK_NO));
newKc005.setReceiptDate(DateUtils.shortDate());
newKc005.setEntityAmount(entityAmount);
newKc005.setEntityUnitWeight(dbKc010.getInvUnitWeight());
newKc005.setEntityWeight(dbKc010.getInvUnitWeight().multiply(entityAmount).divide(new BigDecimal("1000")));
newKc005.setBookAmount(dbKc010.getInvQty());
newKc005.setBookUnitWeight(dbKc010.getInvUnitWeight());
newKc005.setBookWeight(dbKc010.getInvWeight());
newKc005.setDiffAmount(entityAmount.subtract(dbKc010.getInvQty()));
newKc005.setDiffWeight(newKc005.getEntityWeight().subtract(dbKc010.getInvWeight()));
newKc005.setKcId(kcId);
newKc005.setRemark(entityRemark);
newKc005.setInventRecordId(dbKc010.getSpecId());
newKc005.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGKC005.INSERT, newKc005);
// 修改库存数量
HGKCTools.updateStock(newKc005);
}
}
}
<?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-06-12 10:57:29
Version : 1.0
schema : hggp
tableName : HGKC005
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
RECEIPT_DATE VARCHAR NOT NULL,
CHECK_NO VARCHAR NOT NULL,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
WH_CODE VARCHAR NOT NULL,
WH_NAME VARCHAR NOT NULL,
INVENT_TYPE VARCHAR,
INVENT_CODE VARCHAR,
INVENT_NAME VARCHAR,
INVENT_RECORD_ID BIGINT,
BOOK_AMOUNT DECIMAL,
BOOK_UNIT_WEIGHT DECIMAL,
BOOK_WEIGHT DECIMAL,
ENTITY_AMOUNT DECIMAL,
ENTITY_UNIT_WEIGHT DECIMAL,
ENTITY_WEIGHT DECIMAL,
DIFF_AMOUNT DECIMAL,
DIFF_WEIGHT DECIMAL,
KC_ID BIGINT,
STATUS TINYINT NOT NULL,
REMARK VARCHAR,
OLD_CHECK_NO VARCHAR,
CREATED_BY VARCHAR,
CREATED_NAME VARCHAR,
CREATED_TIME VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_NAME VARCHAR,
UPDATED_TIME VARCHAR,
DELETE_FLAG TINYINT
-->
<sqlMap namespace="HGKC005">
<typeAlias alias="HGKC005" type="com.baosight.hggp.hg.kc.domain.HGKC005"/>
<sql id="condition">
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkNo">
CHECK_NO LIKE CONCAT('%',#checkNo#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookAmount">
BOOK_AMOUNT = #bookAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookUnitWeight">
BOOK_UNIT_WEIGHT = #bookUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookWeight">
BOOK_WEIGHT = #bookWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityAmount">
ENTITY_AMOUNT = #entityAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityUnitWeight">
ENTITY_UNIT_WEIGHT = #entityUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityWeight">
ENTITY_WEIGHT = #entityWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="diffAmount">
DIFF_AMOUNT = #diffAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="diffWeight">
DIFF_WEIGHT = #diffWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="oldCheckNo">
OLD_CHECK_NO = #oldCheckNo#
</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>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="checkNos">
CHECK_NO IN <iterate close=")" open="(" conjunction="," property="checkNos">#checkNos[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hggpSchema}.HGPZ005 WHERE SPEC = '')
</isEqual>
<isNotEqual property="spec" compareValue="无规格">
INVENT_RECORD_ID IN (SELECT ID FROM ${hggpSchema}.HGPZ005 WHERE SPEC = #spec#)
</isNotEqual>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap" resultClass="HGKC005">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
CHECK_NO as "checkNo", <!-- 盘点单号 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 存货档案ID -->
BOOK_AMOUNT as "bookAmount", <!-- 账面数量 -->
BOOK_UNIT_WEIGHT as "bookUnitWeight", <!-- 单重 -->
BOOK_WEIGHT as "bookWeight", <!-- 账面重量 -->
ENTITY_AMOUNT as "entityAmount", <!-- 实物数量 -->
ENTITY_UNIT_WEIGHT as "entityUnitWeight", <!-- 单重 -->
ENTITY_WEIGHT as "entityWeight", <!-- 实物重量 -->
DIFF_AMOUNT as "diffAmount", <!-- 差异数量 -->
DIFF_WEIGHT as "diffWeight", <!-- 差异重量 -->
KC_ID as "kcId", <!-- 库存ID -->
STATUS as "status", <!-- 单据状态 0待审核 1已审核 -->
REMARK as "remark", <!-- 备注 -->
OLD_CHECK_NO as "oldCheckNo", <!-- 原盘点单号 -->
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.是 -->
FROM ${hggpSchema}.HGKC005 WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc, ID asc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGKC005 WHERE 1=1
<include refid="condition" />
<include refid="customCondition"/>
</select>
<select id="querySum" parameterClass="java.util.HashMap" resultClass="HGKC005">
SELECT
COALESCE(SUM(BOOK_AMOUNT), 0) AS "bookAmount", <!-- 账面数量 -->
COALESCE(SUM(BOOK_WEIGHT), 0) AS "bookWeight", <!-- 账面重量 -->
COALESCE(SUM(ENTITY_AMOUNT), 0) AS "entityAmount", <!-- 实物数量 -->
COALESCE(SUM(ENTITY_WEIGHT), 0) AS "entityWeight", <!-- 实物重量 -->
COALESCE(SUM(DIFF_AMOUNT), 0) AS "diffAmount", <!-- 差异数量 -->
COALESCE(SUM(DIFF_WEIGHT), 0) AS "diffWeight" <!-- 差异重量 -->
FROM ${hggpSchema}.HGKC005
WHERE 1=1
<include refid="condition"/>
<include refid="customCondition"/>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
RECEIPT_DATE = #receiptDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkNo">
CHECK_NO = #checkNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookAmount">
BOOK_AMOUNT = #bookAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookUnitWeight">
BOOK_UNIT_WEIGHT = #bookUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bookWeight">
BOOK_WEIGHT = #bookWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityAmount">
ENTITY_AMOUNT = #entityAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityUnitWeight">
ENTITY_UNIT_WEIGHT = #entityUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="entityWeight">
ENTITY_WEIGHT = #entityWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="diffAmount">
DIFF_AMOUNT = #diffAmount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="diffWeight">
DIFF_WEIGHT = #diffWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="kcId">
KC_ID = #kcId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="oldCheckNo">
OLD_CHECK_NO = #oldCheckNo#
</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>
-->
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC005 (
ACCOUNT_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
RECEIPT_DATE, <!-- 单据日期 -->
CHECK_NO, <!-- 盘点单号 -->
COMPANY_CODE, <!-- 公司编码 -->
COMPANY_NAME, <!-- 公司名称 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 存货档案ID -->
BOOK_AMOUNT, <!-- 账面数量 -->
BOOK_UNIT_WEIGHT, <!-- 单重 -->
BOOK_WEIGHT, <!-- 账面重量 -->
ENTITY_AMOUNT, <!-- 实物数量 -->
ENTITY_UNIT_WEIGHT, <!-- 单重 -->
ENTITY_WEIGHT, <!-- 实物重量 -->
DIFF_AMOUNT, <!-- 差异数量 -->
DIFF_WEIGHT, <!-- 差异重量 -->
KC_ID, <!-- 库存ID -->
STATUS, <!-- 单据状态 0待审核 1已审核 -->
REMARK, <!-- 备注 -->
OLD_CHECK_NO, <!-- 原盘点单号 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
UPDATED_BY, <!-- 更新人 -->
UPDATED_NAME, <!-- 更新人名称 -->
UPDATED_TIME, <!-- 更新时间 -->
DELETE_FLAG <!-- 是否删除0.否1.是 -->
)
VALUES (#accountCode#, #depCode#, #receiptDate#, #checkNo#, #companyCode#, #companyName#, #whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #inventRecordId#, #bookAmount#, #bookUnitWeight#, #bookWeight#, #entityAmount#, #entityUnitWeight#, #entityWeight#, #diffAmount#, #diffWeight#, #kcId#, #status#, #remark#, #oldCheckNo#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#)
</insert>
<delete id="delete">
UPDATE ${hggpSchema}.HGKC005 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGKC005
SET
ACCOUNT_CODE = #accountCode#, <!-- 企业编码 -->
DEP_CODE = #depCode#, <!-- 部门编码 -->
RECEIPT_DATE = #receiptDate#, <!-- 单据日期 -->
CHECK_NO = #checkNo#, <!-- 盘点单号 -->
COMPANY_CODE = #companyCode#, <!-- 公司编码 -->
COMPANY_NAME = #companyName#, <!-- 公司名称 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 存货档案ID -->
BOOK_AMOUNT = #bookAmount#, <!-- 账面数量 -->
BOOK_UNIT_WEIGHT = #bookUnitWeight#, <!-- 单重 -->
BOOK_WEIGHT = #bookWeight#, <!-- 账面重量 -->
ENTITY_AMOUNT = #entityAmount#, <!-- 实物数量 -->
ENTITY_UNIT_WEIGHT = #entityUnitWeight#, <!-- 单重 -->
ENTITY_WEIGHT = #entityWeight#, <!-- 实物重量 -->
DIFF_AMOUNT = #diffAmount#, <!-- 差异数量 -->
DIFF_WEIGHT = #diffWeight#, <!-- 差异重量 -->
KC_ID = #kcId#, <!-- 库存ID -->
STATUS = #status#, <!-- 单据状态 0待审核 1已审核 -->
REMARK = #remark#, <!-- 备注 -->
OLD_CHECK_NO = #oldCheckNo#, <!-- 原盘点单号 -->
CREATED_BY = #createdBy#, <!-- 创建人 -->
CREATED_NAME = #createdName#, <!-- 创建人名称 -->
CREATED_TIME = #createdTime#, <!-- 创建时间 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag# <!-- 是否删除0.否1.是 -->
WHERE
ID = #id#
</update>
<!-- 行锁 -->
<update id="lock">
UPDATE ${hggpSchema}.HGKC005
SET CREATED_TIME = CREATED_TIME
WHERE 1=1
<isNotEmpty prepend=" AND " property="checkNo">
CHECK_NO = #checkNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="checkNos">
CHECK_NO IN <iterate close=")" open="(" conjunction="," property="checkNos">#checkNos[]#</iterate>
</isNotEmpty>
</update>
<!-- 统计库存 -->
<select id="statDate" parameterClass="java.util.HashMap" resultClass="HGKC005">
SELECT
DEP_CODE AS "depCode",
COMPANY_CODE as "companyCode",
WH_CODE as "whCode",
INVENT_TYPE AS "inventType",
INVENT_CODE AS "inventCode",
INVENT_RECORD_ID AS "inventRecordId",
COALESCE(SUM(DIFF_AMOUNT), 0) AS "diffAmount",
COALESCE(SUM(DIFF_WEIGHT), 0) AS "diffWeight"
FROM ${hggpSchema}.HGKC005
WHERE 1=1
<isNotEmpty prepend=" AND " property="createdTimeFrom">
CREATED_TIME BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
GROUP BY DEP_CODE, COMPANY_CODE, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID
</select>
</sqlMap>
let whNameGlobalData = [];
let inventNameGlobalData = [];
let specGlobalData = [];
$(function() {
whNameGlobalData = __eiInfo.getBlock("wh_record_block_id").getMappedRows();
inventNameGlobalData = __eiInfo.getBlock("invent_record_block_id").getMappedRows();
specGlobalData = __eiInfo.getBlock("spec_record_block_id").getMappedRows();
IPLATUI.EFGrid = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
"result": {
/*toolbarConfig: {
// hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
// add: false, // 不显示新增按钮
add: false, // 不显示取消按钮
// save: true, // 不显示保存按钮
// delete: true, // 显示删除按钮
},*/
columns: [{
field: "receiptDate",
attributes: {
class: "i-input-readonly"
},
defaultValue: function () {
return currShortDate();
}
}, {
field: "whCode",
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
return whNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HGPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
if (inventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
return inventNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HGPZ005");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventRecordId",
template: function (dataItem) {
for (let i = 0; i < specGlobalData.length; i++) {
if (specGlobalData[i]['valueField'] === dataItem['inventRecordId']) {
return specGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("serviceName", "HGPZ005");
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}],
loadComplete: function (grid) {
},
onSave: function (e) {
// 阻止后台保存请求,使用自定义保存
e.preventDefault();
save();
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
}
// 查询
$("#QUERY").on("click", query);
// 挑选库存
$("#SELECT_STOCK").on("click", selectStock);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 仓库名称
//initWh()
// 存货名称
//initInvent()
// 规格
//initSpec()
// 查询
query();
});
/**
* 初始化仓库
*/
let initWh = function () {
let inInfo = new EiInfo();
// 1.原料,2.耗材,5.废料
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HGPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化存货
*/
let initInvent = function () {
let inInfo = new EiInfo();
// 1.原料,2.耗材,5.废料
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HGPZ005", "queryComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
// 1.原料,2.耗材,5.废料
inInfo.set("inqu_status-0-inventTypes", [1, 2, 5]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HGPZ005", "queryComboBoxAll", inInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_all_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
/**
* 挑选库存
*/
let selectStock = function () {
let companyCode = $("#inqu_status-0-companyCode").val();
let companyName = $("#inqu_status-0-companyName").val();
JSColorbox.open({
href: "HGKC005A?methodName=initLoad&inqu_status-0-companyCode=" + companyCode+"&inqu_status-0-companyNam="+companyName,
title: "<div style='text-align: center;'>库存查询</div>",
width: "90%",
height: "80%",
callbackName: selectStockCallback
});
}
/**
* 挑选库存回调
*/
let selectStockCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
for (let i = 0; i < rows.length; i++) {
if (isBlank(rows[i]['inventType'])) {
message("勾选的第" + (i + 1) + "行存货类型不能为空");
return;
}
if (isBlank(rows[i]['whCode'])) {
message("勾选的第" + (i + 1) + "行仓库名称不能为空");
return;
}
if (isBlank(rows[i]['inventCode'])) {
message("勾选的第" + (i + 1) + "行存货名称不能为空");
return;
}
if (isBlank(rows[i]['inventRecordId'])) {
message("勾选的第" + (i + 1) + "行规格不能为空");
return;
}
if (!isPositiveInteger(rows[i]['bookAmount'])) {
message("勾选的第" + (i + 1) + "行账面数量必须是大于0的整数");
return;
}
if (!isPositiveInteger(rows[i]['entityAmount'])) {
message("勾选的第" + (i + 1) + "行实物数量必须是大于0的整数");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC005", "save", true);
}
});
}
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/6/11
Time: 18:53
To change this template use File | Settings | File Templates.
--%>
<!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" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="库存盘点单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="inqu_status-0-receiptDate" colWidth="3"
role="date" format="yyyy-MM-dd"/>
<EF:EFInput cname="盘点单号" ename="inqu_status-0-checkNo" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_type_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" blockId="inqu_status"
startName="createdDateFrom" endName="createdDateTo" row="0" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8">
</EF:EFDateSpan>
</div>
<div class="row">
<EF:EFSelect cname="是否删除" ename="inqu_status-0-deleteFlag" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="checkNo" cname="盘点单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<%--<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" enable="true" readonly="true" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>--%>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="true" readonly="true" width="120" align="center"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="true" readonly="true" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="true" readonly="true" width="120" align="center"
blockName="invent_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="true" readonly="true" width="120" align="center"
blockName="spec_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="bookAmount" cname="账面数量" format="{0:N0}" maxLength="20" width="120" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="bookWeight" cname="账面重量(T)" enable="false" format="{0:N3}" maxLength="20" width="120"
align="right" sumType="all"/>
<EF:EFColumn ename="entityAmount" cname="实物数量" format="{0:N0}" maxLength="20" width="120" align="right"
sumType="all" required="true" readonly="true"/>
<EF:EFColumn ename="entityWeight" cname="实物重量(T)" enable="false" format="{0:N3}" maxLength="20" width="120"
align="right" sumType="all"/>
<EF:EFColumn ename="diffAmount" cname="差异数量" enable="false" format="{0:N0}" maxLength="20" width="120"
align="right" sumType="all" readonly="true"/>
<EF:EFColumn ename="diffWeight" cname="差异重量(T)" enable="false" format="{0:N3}" maxLength="20" width="120"
align="right" sumType="all" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" />
<EF:EFColumn ename="oldCheckNo" cname="原盘点单号" enable="false" hidden="true" width="140" align="center"/>
</EF:EFGrid>
<br/>
<span style='color: red;font-size: 13px;'>说明:差异数量=实物数量-账面数量;差异重量=实物重量-账面重量</span>
</EF:EFRegion>
</EF:EFPage>
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [],
dataBound: function () {
}
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
// 选择
$("#BTN_SELECT").on("click", select);
downKeyUp();
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 勾选全部事件
$("#ef_grid_result").on("click", "input.check-all", function (e) {
var action = $(this).prop("checked");
if (action == true) {
var rowData = $('#ef_grid_result').data("kendoGrid").getCheckedRows();
for (var i = 0; i < rowData.length; i++) {
resultGrid.setCellValue(i, "entityAmount", parseFloat(rowData[i]["invQty"]));
resultGrid.setCellValue(i, "entityWeight", parseFloat(rowData[i]["invWeight"]));
}
}
});
// 勾选一行的事件
$("#ef_grid_result").on("click", "input.check-one", function (e) {
var rowNo = $(this).closest("tr").index();
var action = $(this).prop("checked");
var data = resultGrid.getDataItems();
if (action == true) {
resultGrid.setCellValue(rowNo, "entityAmount", parseFloat(data[rowNo]["invQty"]));
resultGrid.setCellValue(rowNo, "entityWeight", parseFloat(data[rowNo]["invWeight"]));
}
});
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
};
/**
* 选择库存
*/
let select = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据")
return;
}
for (let i = 0; i < rows.length; i++) {
let entityAmount = rows[i]['entityAmount'];
let amount = rows[i]['amount'];
if (!isPositiveInteger(entityAmount)) {
message("勾选的第" + (i + 1) + "行实物数量必须是大于0的整数");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据生成盘点单吗? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC005A", "select",
true, function (e) {
var status = e.getStatus();
if (status !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
}
});
}
<!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" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="库存查询">
<EF:EFRegion id="inqu" title="查询区域" type="query">
<div class="row">
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_type_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="仓库名称" ename="inqu_status-0-whCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货名称" ename="inqu_status-0-inventCode" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-specId" cname="规格" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput blockId="inqu_status" row="0" ename="companyCode" cname="公司编码" type="hidden" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="companyName" cname="公司名称" type="hidden" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="库存ID" enable="false" width="60" align="center"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" enable="false" width="120" align="center"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="whName" cname="仓库名称" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFComboColumn ename="inventCode" cname="存货名称" enable="false" width="120" align="center"
blockName="invent_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFColumn ename="specId" cname="规格ID" width="120" enable="true" readonly="true" align="center" hidden="true" maxLength="50"/>
<EF:EFComboColumn ename="spec" cname="规格" enable="false" width="120" align="center"
blockName="spec_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="entityAmount" cname="实物数量" width="120" align="right" format="{0:N0}" required="true"/>
<EF:EFColumn ename="entityRemark" cname="盘点说明" width="150" editType="textarea" copy="true"/>
<EF:EFColumn ename="invQty" cname="库存数量" enable="false" width="120" align="right" format="{0:N0}"
sumType="all"/>
<EF:EFColumn ename="invUnitWeight" cname="库存单重(KG)" enable="false" width="120" align="right" format="{0:N0}" hidden="true"/>
<EF:EFColumn ename="invWeight" cname="库存重量(KG)" enable="false" width="120" align="right" format="{0:N3}"
sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="150" hidden="true"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
\ No newline at end of file
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