Commit eeed5d78 by 宋祥

1.用户工号和名称选择

parent e8da80e2
......@@ -80,6 +80,14 @@ public enum DdynamicEnum {
*/
MAT_CODE_BLOCK_ID("mat_code_block_id","matCode","matCode","HPPZ007.queryMatCodeComboBox"),
/**
* 模块:物料编码
* 用途:物料编码下拉框
* 编写:yk
*/
USER_BLOCK_ID("user_block_id","loginName","userName","HPXSUser.queryComboBox"),
//------------------------------------生产管理-----------------------------------
/**
* 模块:项目档案
......
......@@ -15,6 +15,8 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
......@@ -97,6 +99,15 @@ public class ServiceHPPZ006 extends ServiceBase {
fPz006.fromMap(resultRows.get(i));
AssertUtils.isNull(fPz006.getInventType(), "存货类型不能为空");
AssertUtils.isNull(fPz006.getInventCode(), "存货名称不能为空");
// 去除空格
fPz006.setSpec(StringUtils.trimToEmpty(fPz006.getSpec()));
// 重复校验
Map queryParam = new HashMap();
queryParam.put("inventCode", fPz006.getInventCode());
queryParam.put("spec", fPz006.getSpec());
List<HPPZ006> dbPz006 = dao.query(HPPZ006.QUERY, queryParam);
AssertUtils.isNotEmpty(dbPz006, String.format("存货编码[%]已存在规格[%s],请勿重复添加!", fPz006.getInventCode(),
fPz006.getSpec()));
}
}
......
......@@ -14,6 +14,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -25,11 +26,14 @@ import java.util.Map;
public class ServiceHPPZ007 extends ServiceBase {
/**
* 初始化页面
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), null);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ007().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
......@@ -48,9 +48,9 @@
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
<isNotNull prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
</isNotNull>
</sql>
<sql id="order">
......
......@@ -2,7 +2,7 @@
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPXSUser">
<sql id="conditions">
<sql id="condition">
<isNotEmpty prepend=" AND " property="loginName">
LOGIN_NAME = #loginName#
</isNotEmpty>
......@@ -18,6 +18,7 @@
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
AND loginName != 'admin'
</sql>
<!-- 查询用户信息 -->
......@@ -31,7 +32,17 @@
COMPANY_CODE as "companyCode" <!-- 企业编码 -->
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="conditions"/>
<include refid="condition"/>
</select>
<!-- 查询用户信息 -->
<select id="queryComboBox" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT
LOGIN_NAME as "loginName", <!-- 登录id -->
USER_NAME as "userName" <!-- 用户名 -->
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="condition"/>
</select>
<!-- 统计用户 -->
......@@ -39,7 +50,7 @@
SELECT COUNT(1)
FROM ${platSchema}.XS_USER
WHERE 1=1
<include refid="conditions"/>
<include refid="condition"/>
</select>
<!-- id查询 -->
......
......@@ -2,6 +2,7 @@ package com.baosight.hpjx.util;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.data.ibatis.dao.Dao;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -41,11 +42,10 @@ public class CommonMethod {
* 公用下拉方法
*/
public static void initBlock(EiInfo inInfo, List<DdynamicEnum> tableParams, Map<String, String> selectParams, Boolean isSplicingSymbol){
/* 新建一个块 将每个表查询到的结果放入单独的块中 */
EiBlock eiBlock;
/* 行数据 将每个数据源查询到的数据放到每个模块的行数据中 */
Map<String,String> row;
Map<String, String> row;
/* 每个数据源查询到的结果暂存在这个变量中 */
List results;
/* 将结果集中的每个结果暂存然后 强转为map */
......@@ -54,13 +54,17 @@ public class CommonMethod {
if (tableParams.size() <= 0) {
throw new NullPointerException();
}
// 增加企业编码隔离数据
if (selectParams == null) {
selectParams = new HashMap<>();
}
selectParams.put("companyCode", UserSessionUtils.getCompanyCode());
/* 遍历每个数据源 */
for (DdynamicEnum tableParam : tableParams) {
/* 编辑块名称 */
eiBlock = new EiBlock(tableParam.getBlockId());
/* 将所有查询到的结果放到暂存变量中 */
results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset,-999999);
results = dao.query(tableParam.getDbSource(), selectParams, EiConstant.defaultOffset, -999999);
for (Object result : results) {
row = new HashMap<>(3);
try {
......
......@@ -28,29 +28,13 @@ $(function() {
return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inventType", options.model["inventType"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryMaterialComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("material_record_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
let inInfo = new EiInfo();
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
inInfo.set("field", options.field);
inInfo.set("inventType", options.model["inventType"]);
refreshSelect(container, inInfo);
}
}, {
field: "inventRecordId",
......@@ -63,71 +47,29 @@ $(function() {
return "";
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
var dataSource;
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
let inInfo = new EiInfo();
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
refreshSelect(container, inInfo);
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
}, {
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}],
loadComplete: function (grid) {
//删除
$("#DELETE").on("click", function () {
var btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
var dataItems = resultGrid.getCheckedRows();
if (dataItems == null || dataItems == "") {
NotificationUtil({
msg: '选择要删除的数据'
}, "warning");
//释放禁用按钮
btnNode.attr("disabled", false);
return false;
}
IPLAT.submitNode($("#HPKC005"), "HPKC005", "delete", {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '删除成功'
});
// 绑定grid
resultGrid.setEiInfo(ei);
}
//释放禁用按钮
btnNode.attr("disabled", false);
},
onFail: function (ei) {
// 发生异常
console.log(ei);
//释放禁用按钮
btnNode.attr("disabled", false);
}
});
});
}
},
};
});
/**
......
......@@ -7,7 +7,18 @@ $(function() {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}]
}
});
......
......@@ -7,7 +7,18 @@ $(function() {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}]
}
});
......
......@@ -7,7 +7,18 @@ $(function() {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}]
}
});
......
......@@ -8,12 +8,12 @@
<EF:EFPage title="存货类型">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="存货名称" ename="inqu_status-0-inventName" colWidth="3"/>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFSelect>
<EF:EFInput cname="存货名称" ename="inqu_status-0-inventName" colWidth="3"/>
<EF:EFSelect cname="状态" ename="inqu_status-0-status" colWidth="3"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
<EF:EFOption label="全部" value=""/>
......@@ -26,11 +26,11 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="false" width="100" align="center"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="90" align="center" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" required="true"/>
<EF:EFComboColumn ename="status" cname="状态" align="center" width="100" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
......
......@@ -25,6 +25,16 @@ $(function() {
return options.length == 0 ? "-" : options.length;
}
}, {
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}, {
field: "inventCode",
template: function (dataItem) {
for (let i = 0; i < inventNameGlobalData.length; i++) {
......
......@@ -28,11 +28,11 @@
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center"
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" requird="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center"/>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" requird="true"/>
<EF:EFColumn ename="spec" cname="规格" width="120" align="center" maxLength="50"/>
<EF:EFColumn ename="length" cname="长" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="wide" cname="宽" width="100" align="right" format="{0:N2}" maxLength="10"/>
......
......@@ -7,7 +7,18 @@ $(function() {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
},
columns: [{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}, {
field: "updatedName",
template: function (options) {
return showUserName(options.updatedBy, options.updatedName);
}
}]
}
});
......
......@@ -31,7 +31,11 @@
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hppz.whType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="princ" cname="负责人" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="princ" cname="负责人" width="120" align="center" required="true"
blockName="user_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="status" cname="状态" width="100" align="center" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
......
......@@ -79,6 +79,58 @@ function getWindowHeight() {
}
/**
* 显示用户名称
*
* @param loginName
* @param userName
*/
function showUserName(loginName, userName) {
if (!isBlank(loginName) && !isBlank(userName)) {
return loginName + "-" + userName;
} else if (!isBlank(loginName)) {
return loginName;
} else if (!isBlank(userName)) {
return userName;
} else {
return "";
}
}
/**
* 刷新下拉框
*
* @param container
* @param inInfo
*/
function refreshSelect(container, inInfo) {
let grid = container.closest(".k-grid").data("kendoGrid");
let cellIndex = grid.cellIndex(container);
let input = $('<input />');
let field = inInfo.get("field");
input.attr("name", field);
input.attr("id", field);
input.appendTo(container);
let dataSource;
let serviceName = inInfo.get("serviceName");
let methodName = inInfo.get("methodName");
let blockId = inInfo.get("blockId");
EiCommunicator.send(serviceName, methodName, inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock(blockId).getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
}
/**
* cookie 操作
*
* @param c_name
......
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