Commit e692e838 by 宋祥

1.也去模块查询语句增加企业编码参数

parent 3ab3d937
......@@ -65,6 +65,13 @@ public enum DdynamicEnum {
SPEC_NAME_BLOCK_ID("spec_name_block_id", "spec", "spec", "HPPZ006.queryComboBoxSpecName"),
/**
* 模块:存货档案(单位)
* 用途:存货档案下拉框
* 编写:wwl
*/
UNIT_NAME_BLOCK_ID("unit_name_block_id", "unit", "unit", "HPPZ006.queryComboBoxUnit"),
/**
* 模块:仓库档案
* 用途:仓库档案下拉框
* 编写:wwl
......
......@@ -38,44 +38,6 @@ public class DaoUtils {
}
/**
* 查询
*
* @param sql
* @param obj
* @return
*/
public static List query(String sql, Object obj){
if (obj instanceof DaoEPBase) {
// 企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(obj, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入企业编码失败", e);
}
} else if (obj instanceof Map) {
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
((Map) obj).put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入企业编码失败", e);
}
}
return DaoBase.getInstance().query(sql, obj);
}
/**
* insert method.
*
* @param sql
......
......@@ -96,6 +96,9 @@ public class ServiceHPKC005 extends ServiceBase {
// 生成单据号
fKc005.setCheckNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.CHECK_NO));
DaoUtils.insert(HPKC005.INSERT, fKc005);
// 修改库存
HPKCTools.updateStock(fKc005.getWhCode(), fKc005.getInventRecordId(),
fKc005.getDiffAmount(), fKc005.getDiffWeight());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
......@@ -34,6 +34,7 @@ public class ServiceHPKC008 extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.UNIT_NAME_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC008().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
......@@ -206,5 +206,22 @@ public class ServiceHPPZ006 extends ServiceBase {
}
return inInfo;
}
/**
* 单位下拉框
*
* @param inInfo
* @return
*/
public EiInfo queryComboBoxUnit(EiInfo inInfo) {
try {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.UNIT_NAME_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo), false);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询规格失败");
}
return inInfo;
}
}
......@@ -198,4 +198,15 @@
ORDER BY ID
</select>
<!-- 单位下拉框 -->
<select id="queryComboBoxUnit" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT UNIT AS "unit"
FROM hpjx.t_hppz006
WHERE DELETE_FLAG = 0
AND STATUS = 1
<include refid="condition"/>
<include refid="customCondition"/>
ORDER BY ID
</select>
</sqlMap>
package com.baosight.iplat4j.core.data.ibatis.dao;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.service.soa.DomainQuery.PageStatus;
import com.baosight.iplat4j.core.util.ExceptionUtil;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:songx
* @date:2024/1/24,9:00
*/
public class SqlMapDaoLogProxy extends SqlMapDao {
public static final String QUERY = "query";
public SqlMapDaoLogProxy() {
}
public List query(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.query(name, parameters);
return ret;
} catch (RuntimeException var4) {
throw var4;
}
}
public List queryAll(String name, Object parameters) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.queryAll(name, parameters);
return ret;
} catch (RuntimeException var4) {
throw var4;
}
}
public List query(String name, Object parameters, int offset, int limit) {
try {
// 初始化参数
this.initParam(name, parameters);
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var6) {
throw var6;
}
}
public List query(String name, Object parameters, PageStatus pageStatus) {
int limit = pageStatus.getPageSize();
int offset = pageStatus.getPageNumber() * pageStatus.getPageSize();
try {
List ret = super.query(name, parameters, offset, limit);
return ret;
} catch (RuntimeException var7) {
ExceptionUtil.getRootCauseMessage(var7);
throw var7;
}
}
public int count(String name, Object parameters) {
String var3 = this.autoCount ? "query" : "count";
try {
// 初始化参数
this.initParam(name, parameters);
int ret = super.count(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public void insert(String name, Object object) {
String var3 = "insert";
try {
super.insert(name, object);
} catch (RuntimeException var5) {
throw var5;
}
}
public int update(String name, Object object) {
String var3 = "update";
try {
int ret = super.update(name, object);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int delete(String name, Object parameters) {
String var3 = "delete";
try {
int ret = super.delete(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int insertBatch(String name, Collection parameters) {
String operation = "insert";
try {
this.getStatementName(operation, name);
int ret = super.insertBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int updateBatch(String name, Collection parameters) {
String operation = "update";
try {
this.getStatementName(operation, name);
int ret = super.updateBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
public int deleteBatch(String name, Collection parameters) {
String operation = "delete";
try {
this.getStatementName(operation, name);
int ret = super.deleteBatch(name, parameters);
return ret;
} catch (RuntimeException var5) {
throw var5;
}
}
/**
* 初始化参数
*
* @param name
* @param parameters
*/
private void initParam(String name, Object parameters) {
// 查询登录用户信息时不设置企业编码,否则会形成死循环
// 仅限业务模块的查询需要设置企业编码
if ("HPXSUser.query".equals(name) || !name.startsWith("HP") || !(parameters instanceof Map)) {
return;
}
if (parameters == null) {
parameters = new HashMap();
}
// 企业编码
((Map) parameters).put("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
}
......@@ -19,12 +19,12 @@
<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_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFSelect cname="规格" ename="inqu_status-0-spec" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
......@@ -56,7 +56,7 @@
align="right" sumType="all" readonly="true"/>
<EF:EFColumn ename="diffWeight" cname="差异重量" enable="false" format="{0:N3}" maxLength="20" width="100"
align="right" sumType="all" readonly="true"/>
<EF:EFColumn ename="notes" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150" readonly="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
......@@ -40,7 +40,7 @@ $(window).load(function () {
var data = resultGrid.getDataItems();
if (action == true) {
resultGrid.setCellValue(rowNo, "entityAmount", parseFloat(data[rowNo]["amount"]));
resultGrid.setCellValue(i, "entityWeight", parseFloat(rowData[i]["weight"]));
resultGrid.setCellValue(rowNo, "entityWeight", parseFloat(data[rowNo]["weight"]));
}
});
......
let unitNameGlobalData = [];
$(function() {
// 查询
......@@ -7,7 +8,27 @@ $(function() {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200]
}
},
columns: [{
field: "unit",
template: function (dataItem) {
for (let i = 0; i < unitNameGlobalData.length; i++) {
if (unitNameGlobalData[i]['valueField'] === dataItem['unit']) {
return unitNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryComboBoxUnit");
inInfo.set("blockId", "unit_name_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}]
}
});
......@@ -16,6 +37,15 @@ $(function() {
* 页面加载时执行
*/
$(window).load(function () {
let inInfo = new EiInfo();
// 规格
EiCommunicator.send("HPPZ006", "queryComboBoxUnit", inInfo, {
onSuccess: function (ei) {
unitNameGlobalData = ei.getBlock("unit_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
......
......@@ -27,7 +27,7 @@
<EF:EFComboColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true">
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="unit" cname="单位" width="100" align="center" maxLength="2"/>
<EF:EFColumn ename="unit" cname="单位" width="100" align="center" required="true"/>
<EF:EFColumn ename="amount" cname="数量" width="120" align="right" format="{0:N3}" sumType="all"
required="true"/>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:C3}" required="true"/>
......
......@@ -37,8 +37,7 @@
<EF:EFColumn ename="material" cname="材质" width="100" align="center" required="true"/>
<EF:EFColumn ename="coefficient" cname="系数" width="100" align="right" format="{0:N2}" maxLength="10"/>
<EF:EFColumn ename="unit" cname="单位" width="100" align="center" required="true"/>
<EF:EFComboColumn ename="status" cname="状态" align="center" width="100" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFComboColumn ename="status" cname="状态" align="center" width="100" required="true">
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdName" cname="创建人名称" enable="false" width="100" align="center"/>
......
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