Commit 279aa8a6 by liuyang

2024-10-08 办公用品台账,办公用品盘点

parent 98fe229c
......@@ -408,6 +408,13 @@ public enum DdynamicEnum {
* 编写:ly
*/
CUST_CODE_BLOCK_ID("custCode_block_id","custCode","custName","HPSC001.queryCustCodeBox"),
/**
* 模块:协同办公
* 用途:用户用品下拉框
* 编写:ly
*/
ITEM_CODE_BLOCK_ID("itemCode_block_id","itemCode","itemName","itemModel","itemType","itemUnit","invQty","whCode","whName","HPBG001.queryItemCodeBox"),
;
......
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.HPBG001;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.util.CommonMethod;
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 ServiceHPBG001 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);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG001.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG001.QUERY,new HPBG001());
}
@OperationLogAnnotation(operModul = "办公用品台账",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG001.DELETE_FLAG);
}
@OperationLogAnnotation(operModul = "办公用品台账",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG001 hpbg001 = new HPBG001();
hpbg001.fromMap(resultRow);
if (hpbg001.getId() == null || hpbg001.getId() == 0) {
this.add(hpbg001);
} else {
this.modify(hpbg001);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG001 hpbg001) {
hpbg001.setItemCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPBG001_ITEM_CODE));
DaoUtils.insert(HPBG001.INSERT, hpbg001);
}
/**
* 修改操作
*/
public void modify(HPBG001 hpbg001) {
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
}
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.HPBG004;
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 ServiceHPBG004 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,
DdynamicEnum.ITEM_CODE_BLOCK_ID
), null, false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPBG004.FIELD_DELETE_FLAG, CommonConstant.YesNo.NO_0);
return super.query(inInfo, HPBG004.QUERY,new HPBG004());
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HPBG004.DELETE_FLAG);
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "保存",operDesc = "操作")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (Map resultRow : resultRows) {
HPBG004 hpbg004 = new HPBG004();
hpbg004.fromMap(resultRow);
if (hpbg004.getId() == null || hpbg004.getId() == 0) {
this.add(hpbg004);
} else {
this.modify(hpbg004);
}
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增操作
*/
public void add(HPBG004 hpbg004) {
hpbg004.setStatus(ReviewStatusEnum.UNSUBMITTED.getCode());
DaoUtils.insert(HPBG004.INSERT, hpbg004);
}
/**
* 修改操作
*/
public void modify(HPBG004 hpbg004) {
DaoUtils.update(HPBG004.UPDATE, hpbg004);
}
@OperationLogAnnotation(operModul = "办公用品盘点",operType = "提交",operDesc = "提交操作")
public EiInfo submit(EiInfo inInfo) {
try {
List<HPBG004> resultRows = MapUtils.toDaoEPBases(inInfo,HPBG004.class);
List<String> itemCodes =ObjectUtils.listEpKey(resultRows, HPBG004.FIELD_ITEM_CODE);
List<HPBG001> hpbg001s = HPBGTools.HpBg001.getByItemCode(itemCodes);
// 写入数据
for (HPBG004 hpbg004 : resultRows) {
AssertUtils.isTrue(hpbg004.getStatus().equals(ReviewStatusEnum.SUBMITTED.getCode()), "数据已提交,无法提交!");
Map<String,HPBG001> hpbg001Map = hpbg001s.stream().filter(item -> item.getItemCode().equals(hpbg004.getItemCode())).collect(Collectors.toMap(HPBG001::getItemCode, item -> item));
if (!hpbg001Map.isEmpty()){
HPBG001 hpbg001 = hpbg001Map.get(hpbg004.getItemCode());
BigDecimal invQty = hpbg001.getInvQty().add(hpbg004.getProLossQty());
hpbg001.setInvQty(invQty.compareTo(BigDecimal.ZERO) < 0?BigDecimal.ZERO:invQty);
DaoUtils.update(HPBG001.UPDATE, hpbg001);
}
hpbg004.setStatus(ReviewStatusEnum.SUBMITTED.getCode());
DaoUtils.update(HPBG004.UPDATE_BY_STATUS, hpbg004);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
}
<?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_HPBG001
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,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
ITEM_TYPE TINYINT,
ITEM_CODE VARCHAR,
ITEM_NAME VARCHAR,
ITEM_MODEL VARCHAR,
ITEM_UNIT VARCHAR,
INV_QTY DECIMAL
-->
<sqlMap namespace="HPBG001">
<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="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</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="itemCodes">
ITEM_CODE IN <iterate close=")" open="(" conjunction="," property="itemCodes">#itemCodes[]#</iterate>
</isNotEmpty>
</sql>
<!--排除权限条件-->
<sql id="notCondition">
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</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>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bg.domain.HPBG001">
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.是 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
ITEM_NAME as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
INV_QTY as "invQty" <!-- 库存数量 -->
FROM ${hpjxSchema}.T_HPBG001 WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hpjxSchema}.T_HPBG001 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="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</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>
-->
<insert id="insert">
INSERT INTO ${hpjxSchema}.T_HPBG001 (ID,
COMPANY_CODE, <!-- 企业编码 -->
DEP_CODE, <!-- 部门编码 -->
CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 -->
DELETE_FLAG, <!-- 是否删除0.否1.是 -->
WH_CODE, <!-- 仓库编码 -->
WH_NAME, <!-- 仓库名称 -->
ITEM_TYPE, <!-- 用品分类 -->
ITEM_CODE, <!-- 用品编码 -->
ITEM_NAME, <!-- 用品名称 -->
ITEM_MODEL, <!-- 用品型号 -->
ITEM_UNIT, <!-- 用品单位 -->
INV_QTY <!-- 库存数量 -->
)
VALUES (#id#, #companyCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,
#whCode#, #whName#, #itemType#, #itemCode#, #itemName#, #itemModel#, #itemUnit#, #invQty#)
</insert>
<delete id="delete">
DELETE FROM ${hpjxSchema}.T_HPBG001 WHERE ID = #id#
</delete>
<update id="deleteFlag">
UPDATE ${hpjxSchema}.T_HPBG001
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_HPBG001
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
DELETE_FLAG = #deleteFlag#, <!-- 是否删除0.否1.是 -->
WH_CODE = #whCode#, <!-- 仓库编码 -->
WH_NAME = #whName#, <!-- 仓库名称 -->
ITEM_TYPE = #itemType#, <!-- 用品分类 -->
ITEM_CODE = #itemCode#, <!-- 用品编码 -->
ITEM_NAME = #itemName#, <!-- 用品名称 -->
ITEM_MODEL = #itemModel#, <!-- 用品型号 -->
ITEM_UNIT = #itemUnit#, <!-- 用品单位 -->
INV_QTY = #invQty# <!-- 库存数量 -->
WHERE
ID = #id#
</update>
<select id="queryItemCodeBox" parameterClass="java.util.HashMap" resultClass="com.baosight.hpjx.hp.bg.domain.HPBG001">
SELECT
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
ITEM_TYPE as "itemType", <!-- 用品分类 -->
ITEM_CODE as "itemCode", <!-- 用品编码 -->
CONCAT(ITEM_NAME,'-',ITEM_MODEL) as "itemName", <!-- 用品名称 -->
ITEM_MODEL as "itemModel", <!-- 用品型号 -->
ITEM_UNIT as "itemUnit", <!-- 用品单位 -->
INV_QTY as "invQty" <!-- 库存数量 -->
FROM ${hpjxSchema}.T_HPBG001
WHERE DELETE_FLAG = 0
<include refid="condition" />
</select>
</sqlMap>
package com.baosight.hpjx.hp.bg.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.bg.domain.HPBG001;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LiuYang
* @version 1.0 2024/10/8
* @description
*/
@Slf4j
public class HPBGTools {
public static class HpBg001 {
public static List<HPBG001> getByItemCode(List<String> itemCodes){
if (CollectionUtils.isEmpty(itemCodes)){
return new ArrayList<>();
}
Map params = new HashMap();
params.put("itemCodes", itemCodes);
params.put("deleteFlag", 0);
List<HPBG001> list = DaoBase.getInstance().query(HPBG001.QUERY, params);
return CollectionUtils.isEmpty(list)?new ArrayList<>():list;
}
}
}
$(function () {
var whRecordBox = __eiInfo.getBlock("wh_record_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let BG001 = "BG001";
let template = "";
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px"'
+ ' onclick="uploadFile(' + item.id + ',\''+BG001+'\')" >附件清单</a>';
}
return template;
}
}
],
loadComplete: function(grid) {
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "whCode") {
for (let i = 0; i < whRecordBox.length; i++) {
if (whRecordBox[i]['valueField'] === e.items[0]['whCode']) {
resultGrid.setCellValue(e.items[0],"whName",whRecordBox[i]['textField']);
break;
}
}
loadChange(grid, e,"itemName")
//resultGrid.refresh();
}
});
$("#submit").on("click", submitFunc)
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
//工厂类型下拉联动
$('input[name="inqu_status-0-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSB003", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
let dataEdition=ei.getBlock("groupCodeBox_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
downKeyUp();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let whCode= item.get("whCode");
let itemName= item.get("itemName");
let itemType= item.get("itemType");
let invQty= item.get("invQty");
if(isBlank(whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(itemName)){
message("选中的第"+(index+1)+"行\"用品名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(itemType)){
message("选中的第"+(index+1)+"行\"用品分类\",不能为空!");
flag = false;
return false;
}
if(isBlank(invQty) || !isNumber(invQty) || invQty <= 0){
message("选中的第"+(index+1)+"行\"库存数量\",不能为0!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG001", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
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 == 1){
message("选中的第"+(index+1)+"行\"已提交\",不能重复提交!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG001", "submit", true);
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
});
}
\ 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:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="itemType" cname="用品分类" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpbg.itemType" />
</EF:EFSelect>
<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"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" queryMethod="query" autoBind="true">
<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:EFComboColumn ename="whCode" cname="仓库名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="120" 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="itemType" cname="用品分类" width="80" align="center" readonly="false" required="true" defaultValue="1">
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<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: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:EFColumn cname="创建人" ename="createdName" align="center" width="100" 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="120" readonly="true" required="false"
enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
$(function () {
var whRecordBox = __eiInfo.getBlock("wh_record_block_id").getMappedRows();
var itemCodeBox = __eiInfo.getBlock("itemCode_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", query);
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 100],
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let BG004 = "BG004";
let template = "";
if (item.id) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px"'
+ ' onclick="uploadFile(' + item.id + ',\''+BG004+'\')" >附件清单</a>';
}
return template;
}
}, {
field: "itemCode",
filter: function (options) {
let whCode = options.model["whCode"];
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 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
let item = e.items[0];
if (e.field === "whCode") {
for (let i = 0; i < whRecordBox.length; i++) {
if (whRecordBox[i]['valueField'] === item['whCode']) {
resultGrid.setCellValue(item,"whName",whRecordBox[i]['textField']);
break;
}
}
}
if (e.field === "itemCode") {
for (let i = 0; i < itemCodeBox.length; i++) {
if (itemCodeBox[i]['valueField'] === item['itemCode']) {
resultGrid.setCellValue(item,"itemName",itemCodeBox[i]['textField'].split("-")[0]);
resultGrid.setCellValue(item,"itemModel",itemCodeBox[i]['param1Field']);
resultGrid.setCellValue(item,"itemType",itemCodeBox[i]['param2Field']);
resultGrid.setCellValue(item,"itemUnit",itemCodeBox[i]['param3Field']);
resultGrid.setCellValue(item,"paperQty",itemCodeBox[i]['param4Field']);
if (isBlank(item['whCode'])){
resultGrid.setCellValue(item,"whCode",itemCodeBox[i]['param5Field']);
resultGrid.setCellValue(item,"whName",itemCodeBox[i]['param6Field']);
}
break;
}
}
}
if (e.field === "actualQty"){
let proLossQty = item['actualQty'] - item['paperQty'];
resultGrid.setCellValue(item,"proLossQty",proLossQty);
}
});
$("#SUBMIT").on("click", submitFunc)
},
onAdd: function (e) {
$.each(e.items, function (index, item) {
item['takeStockDate'] = currShortDate()
});
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
save(btnNode);
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
//e.preventDefault();
//deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
}
}
}
//工厂类型下拉联动
$('input[name="inqu_status-0-factoryCode"]').change(function () {
var inInfo=new EiInfo();
var factoryCode=$("#inqu_status-0-factoryCode").val();
inInfo.set("factoryCode",factoryCode);
inInfo.set("groupType","prodGroup");
EiCommunicator.send("HPSB003", "queryFactoryCode", inInfo, {
onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode");
let dataEdition=ei.getBlock("groupCodeBox_block_id").getMappedRows();
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
optionLabel:"请选择",
dataSource: dataEdition,
template: "#=textField#"
});
}, onFail: function (ei) {
}
}, {async: false});
});
downKeyUp();
});
let query = function () {
resultGrid.dataSource.page(1);
}
/**
* 保存
*/
let save = function (btnNode) {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let whCode= item.get("whCode");
let itemName= item.get("itemName");
let actualQty= item.get("actualQty");
if(isBlank(whCode)){
message("选中的第"+(index+1)+"行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(itemName)){
message("选中的第"+(index+1)+"行\"用品名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(actualQty) || !isNumber(actualQty)){
message("选中的第"+(index+1)+"行\"实际数量\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPBG004", "save", true);
btnNode.attr("disabled", false);
}
});
}
}
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", "HPBG004", "submit", true);
}
});
}
}
/**
* 文件上传
*
* @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
});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/9/28
Time: 21:49
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%
String loginName = UserSession.getLoginName();
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<c:set var="loginName" value="<%=loginName%>" />
<script type="text/javascript" src="${ctx}/common/js/dayjs.min.js"></script>
<EF:EFPage title="办公用品盘点">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="itemType" cname="用品分类" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpbg.itemType" />
</EF:EFSelect>
<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"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" queryMethod="query" autoBind="true">
<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="takeStockDate" cname="盘点日期" width="120" enable="true" readonly="true" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="whCode" 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="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="whName" 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:EFColumn ename="itemModel" cname="用品型号" width="120" enable="false" readonly="true" align="center" required="true"/>
<EF:EFComboColumn ename="itemType" cname="用品分类" width="80" enable="false" align="center" readonly="false" required="true">
<EF:EFCodeOption codeName="hpjx.hpbg.itemType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="itemUnit" cname="用品单位" width="120" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="paperQty" cname="账面数量" width="120" enable="false" 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:EFColumn ename="actualQty" 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:EFColumn ename="proLossQty" cname="盈亏数量" width="120" enable="false" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,15}?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数!"/>
<EF:EFColumn ename="stoLoca" cname="存放位置" width="120" enable="true" readonly="true" align="center" required="false"/>
<EF:EFComboColumn ename="takeStockUser" cname="盘点人员" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" defaultValue="${loginName}"
maxLength="16" width="100" readonly="false" required="false"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="审批状态" width="80" align="center" readonly="false" required="true" defaultValue="0">
<EF:EFCodeOption codeName="hpjx.hpcw.reviewStatus" condition="ITEM_CODE IN ('2', '3')"/>
</EF:EFComboColumn>
</EF:EFGrid>
</EF:EFRegion>
</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