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);
}
}
}
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