Commit ebdfb907 by 宋祥

1.其他出库单逻辑开发

parent 142153e3
package com.baosight.hpjx.core.security;
import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -19,6 +20,7 @@ import java.util.concurrent.ConcurrentMap;
public class UserSessionUtils extends UserSession {
private static ConcurrentMap companyMap = new ConcurrentHashMap();
private static ConcurrentMap depMap = new ConcurrentHashMap();
/**
* 获取用户信息
......@@ -54,13 +56,35 @@ public class UserSessionUtils extends UserSession {
*/
public static String getCompanyCode() {
String loginName = getLoginName();
if (loginName == null) {
return null;
}
String companyCode = MapUtils.getString(companyMap, loginName);
if (StringUtils.isBlank(companyCode)) {
companyCode = getUser().getCompanyCode();
companyCode = companyCode == null ? "" : companyCode;
if (companyCode == null) {
User user = getUser();
companyCode = user == null || user.getCompanyCode() == null ? "" : user.getCompanyCode();
companyMap.put(loginName, companyCode);
}
return companyCode;
}
/**
* 获取登录用户的部门编码
*
* @return
*/
public static String getDepCode() {
String loginName = getLoginName();
if (loginName == null) {
return null;
}
String depCode = MapUtils.getString(depMap, loginName);
if (depCode == null) {
depCode = HPXSUserTools.getOrgId();
depCode = depCode == null ? "" : depCode.trim();
depMap.put(loginName, depCode);
}
return depCode;
}
}
......@@ -38,6 +38,8 @@ public class HPConstant {
public static final String WH_CODE = "WH_CODE";
// 其他入库单号
public static final String OTHER_ENTER_NO = "OTHER_ENTER_NO";
// 其他出库单号
public static final String OTHER_OUTER_NO = "OTHER_OUTER_NO";
}
/**
......
......@@ -21,6 +21,20 @@ public class HPSqlConstant {
}
/**
* HPKC007 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/
public class HPKC007 {
// 查询
public static final String QUERY_SUM = "HPKC007.querySum";
// 锁
public static final String LOCK = "HPKC007.lock";
}
/**
* HPKC009 SQL 定义
*
* @author:songx
......
......@@ -197,8 +197,8 @@ public class ServiceHPKC006 extends ServiceBase {
DaoUtils.update(HPKC006.DELETE, fKc006);
// 修改库存
HPKC006 dbKc006 = mapKc006.get(fKc006.getOtherEnterNo());
HPKCTools.updateStock(dbKc006.getWhCode(), dbKc006.getInventRecordId(), dbKc006.getAmount(),
dbKc006.getWeight());
HPKCTools.updateStock(dbKc006.getWhCode(), dbKc006.getInventRecordId(), dbKc006.getAmount().negate(),
dbKc006.getWeight().negate());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock;
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.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
......@@ -27,6 +45,10 @@ public class ServiceHPKC007 extends ServiceBase {
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.MATERIAL_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC007().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -35,96 +57,162 @@ public class ServiceHPKC007 extends ServiceBase {
}
/**
* 查询操作.
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/
EiInfo outInfo = super.query(inInfo, "HPKC007.query", new HPKC007());
return outInfo;
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
inInfo = super.query(inInfo, HPKC007.QUERY, new HPKC006());
List sum = dao.query(HPSqlConstant.HPKC006.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
*/
@Override
public EiInfo insert(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HPKC007 hpkc007 = new HPKC007();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpkc007.fromMap(map);
this.dao.insert("HPKC007.insert", hpkc007.toMap());
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 数据写入
for (int i = 0; i < resultRows.size(); i++) {
HPKC007 fKc007 = new HPKC007();
fKc007.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc007);
// 生成出库单号
fKc007.setOtherOuterNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.OTHER_OUTER_NO));
DaoUtils.insert(HPKC007.INSERT, fKc007);
// 修改库存
HPKCTools.updateStock(fKc007.getWhCode(), fKc007.getInventRecordId(), fKc007.getAmount().negate(),
fKc007.getWeight().negate());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 修改操作.
* 修改操作
*
* @param inInfo
* @return
*/
public EiInfo update(EiInfo inInfo) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
HPKC007 hpkc007 = new HPKC007();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpkc007.fromMap(map);
this.dao.update("HPKC007.update", hpkc007.toMap());
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkSaveData(resultRows);
// 入库单号
List<String> otherOuterNos = ObjectUtils.listKey(resultRows, "otherOuterNo");
// 锁记录
HPKCTools.lockKc007(otherOuterNos);
// 查询数据库记录
Map<String, HPKC007> mapKc007 = HPKCTools.mapKc007(otherOuterNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC007 fKc007 = new HPKC007();
fKc007.fromMap(resultRows.get(i));
// 设置基础信息
this.setBaseInfo(fKc007);
DaoUtils.update(HPKC007.UPDATE, fKc007);
// 计算差异数量与重量
HPKC007 dbKc007 = mapKc007.get(fKc007.getOtherOuterNo());
BigDecimal diffAmount = fKc007.getAmount().subtract(dbKc007.getAmount());
BigDecimal diffWeight = fKc007.getWeight().subtract(dbKc007.getWeight());
// 修改库存
HPKCTools.updateStock(fKc007.getWhCode(), fKc007.getInventRecordId(), diffAmount.negate(),
diffWeight.negate());
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
LogUtils.setDetailMsg(inInfo, e, "修改失败");
}
return inInfo;
}
return query(inInfo);
/**
* 校验保存的数据
*
* @param resultRows
*/
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPKC007 fKc007 = new HPKC007();
fKc007.fromMap(resultRows.get(i));
AssertUtils.isEmpty(fKc007.getWhCode(), "仓库名称不能为空");
AssertUtils.isNull(fKc007.getInventCode(), "存货名称不能为空");
AssertUtils.isNull(fKc007.getInventRecordId(), "规格不能为空");
AssertUtils.isGt(BigDecimal.ZERO, fKc007.getAmount(), "数量必须大于0");
AssertUtils.isGt(BigDecimal.ZERO, fKc007.getWeight(), "重量必须大于0");
}
}
/**
* 删除操作.
* 设置基础信息
*
* @param fKc007
*/
public EiInfo delete(EiInfo eiInfo) {
HPKC007 hpkc007 = new HPKC007();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpkc007.fromMap(map);
private void setBaseInfo(HPKC007 fKc007) {
// 去除日期字符串中的-
fKc007.setReceiptDate(StringUtil.removeHorizontalLine(fKc007.getReceiptDate()));
// 仓库名称
fKc007.setWhName(HPPZTools.getPz007ByCode(fKc007.getWhCode()).getWhName());
// 物料名称
fKc007.setInventName(HPPZTools.getPz004ByCode(fKc007.getInventCode()).getInventName());
}
this.dao.delete("HPKC007.delete", hpkc007.toMap());
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 入库单号
List<String> otherOuterNos = ObjectUtils.listKey(resultRows, "otherOuterNo");
// 锁记录
HPKCTools.lockKc007(otherOuterNos);
// 查询数据库记录
Map<String, HPKC007> mapKc007 = HPKCTools.mapKc007(otherOuterNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC007 fKc007 = new HPKC007();
fKc007.fromMap(resultRows.get(i));
DaoUtils.update(HPKC007.DELETE, fKc007);
// 修改库存
HPKC007 dbKc007 = mapKc007.get(fKc007.getOtherOuterNo());
HPKCTools.updateStock(dbKc007.getWhCode(), dbKc007.getInventRecordId(), dbKc007.getAmount(),
dbKc007.getWeight());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
return inInfo;
}
}
......@@ -325,7 +325,7 @@ public class ServiceHPKC009 extends ServiceBase {
List<HPKC007> cItems = dao.query("HPKC007.statDate", queryMap);
Map<String, HPKC007> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMatType() + "#" + item.getMatCode(), item -> item));
+ item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.4、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
queryMap.put("kcType", HPConstant.KcType.QT);
......
......@@ -180,7 +180,7 @@ public class ServiceHPKC010 extends ServiceBase {
try {
checkUpdateStockParam(companyCode,whCode,inventRecordId,amount,weight);
HPKC010 newObj = generatorBaseInfo(companyCode,whCode,inventRecordId,amount,weight);
List<Map> list = dao.query("queryByCondition",new HashMap<String,Object>(){{
List<Map> list = dao.query("HPKC010.queryByCondition",new HashMap<String,Object>(){{
put("companyCode",companyCode);
put("whCode",whCode);
put("inventRecordId",inventRecordId);
......@@ -192,7 +192,7 @@ public class ServiceHPKC010 extends ServiceBase {
throw new PlatException("当前库存为空,库存变更数量与重量不能小于等于0!");
}
generatorBaseInfo(newObj);
DaoUtils.insert("insert",newObj);
DaoUtils.insert("HPKC010.insert",newObj);
}else{
//修改
HPKC010 oldObj = new HPKC010();
......@@ -207,7 +207,7 @@ public class ServiceHPKC010 extends ServiceBase {
oldObj.setUpdatedBy(newObj.getUpdatedBy());
oldObj.setUpdatedName(newObj.getUpdatedName());
oldObj.setUpdatedTime(newObj.getUpdatedTime());
int result = DaoUtils.update("updateStock",oldObj);
int result = DaoUtils.update("HPKC010.updateStock",oldObj);
if(result!=1){
throw new PlatException("库存更新失败,库存已发生变更或系统异常,请重试!");
}
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -66,6 +67,50 @@ public class HPKCTools {
}
/**
* 锁
*
* @param otherOuterNos
* @return
*/
public static void lockKc007(List<String> otherOuterNos) {
if (CollectionUtils.isEmpty(otherOuterNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("otherOuterNos", otherOuterNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC007.LOCK, queryMap);
}
/**
* 查询其他入库信息
*
* @param otherOuterNos
* @return
*/
public static List<HPKC007> listKc007(List<String> otherOuterNos) {
if (CollectionUtils.isEmpty(otherOuterNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("otherOuterNos", otherOuterNos);
return DaoBase.getInstance().query(HPKC007.QUERY, queryMap);
}
/**
* 查询其他入库信息
*
* @param otherOuterNos
* @return
*/
public static Map<String, HPKC007> mapKc007(List<String> otherOuterNos) {
List<HPKC007> results = listKc007(otherOuterNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC007::getOtherOuterNo, item -> item));
}
/**
* 更新库存
*
* @param whCode
......
......@@ -52,7 +52,7 @@ public class ServiceHPPZ004 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPPZ004.query", new HPPZ003());
inInfo = super.query(inInfo, "HPPZ004.query", new HPPZ004());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -3,7 +3,6 @@ package com.baosight.hpjx.hp.pz.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
......@@ -50,7 +49,7 @@ public class ServiceHPPZ007 extends ServiceBase {
@Override
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HPPZ007.QUERY, new HPKC007());
inInfo = super.query(inInfo, HPPZ007.QUERY, new HPPZ007());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
......
......@@ -19,12 +19,6 @@
UPDATED_TIME as "updatedTime" <!-- 修改时间 -->
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="whCodes">
WH_CODE IN <iterate close=")" open="(" conjunction="," property="whCodes">#whCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
......@@ -53,6 +47,12 @@
</isNotEmpty>
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="whCodes">
WH_CODE IN <iterate close=")" open="(" conjunction="," property="whCodes">#whCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......
......@@ -157,7 +157,7 @@ public class AssertUtils {
* @param message
*/
public static void isGt(BigDecimal a, BigDecimal b, String message) {
if (a.compareTo(b) < 1) {
if (a.compareTo(b) == 1) {
throw new PlatException(message);
}
}
......
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)) {
return;
}
if (parameters == null) {
parameters = new HashMap();
}
// 企业编码
((Map) parameters).put("companyCode", UserSessionUtils.getCompanyCode());
// 部门编码
// ((Map) parameters).put("depCode", UserSessionUtils.getDepCode());
}
}
......@@ -19,29 +19,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("inventType", options.model["inventType"]);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryMaterialComboBox");
inInfo.set("blockId", "material_record_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}, {
field: "inventRecordId",
......@@ -54,30 +38,13 @@ $(function() {
return "";
},
editor: function (container, options) {
refreshsel
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) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("serviceName", "HPPZ006");
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}],
loadComplete: function (grid) {
......
$(function () {
var inventNameGlobalData = [];
var specGlobalData = [];
$(function() {
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
"result": {
columns: [{
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("inventType", options.model["inventType"]);
inInfo.set("serviceName", "HPPZ006");
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", "HPPZ006");
inInfo.set("methodName", "queryComboBoxSpec");
inInfo.set("blockId", "invent_spec_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}],
loadComplete: function (grid) {
}
}
}
// 查询
$("#QUERY").on("click", query);
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200],
/**
* 页面加载时执行
*/
$(window).load(function () {
// 存货名称
let eiInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 规格
EiCommunicator.send("HPPZ006", "queryComboBoxSpec", eiInfo, {
onSuccess: function (ei) {
specGlobalData = ei.getBlock("invent_spec_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1); // 点击查询按钮,从第1页开始查询
}
......@@ -4,58 +4,60 @@
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="仓库档案">
<EF:EFRegion id="inqu" title="查询条件"><%-- type="query" efRegionShowClear="true" efRegionSave="true"--%>
<style>
.row {
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<div class="row"> <%-- blockId="inqu_status" row="0" --%>
<EF:EFDatePicker ename="receiptDate" cname="单据日期"
format="yyyy-MM-dd" depth="year" />
<EF:EFInput blockId="inqu_status" ename="otherEnthouse" cname="其他出库单号" row="0"/>
<EF:EFInput blockId="inqu_status" ename="whName" cname="仓库名称" row="0"/>
<EF:EFSelect cname="单据状态" optionLabel="全部" blockId="inqu_status" ename="status" row="0">
<EF:EFOption label="审核" value="1"/>
<EF:EFOption label="反审" value="0"/>
<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" readonly="true"/>
<EF:EFInput cname="出库单号" ename="inqu_status-0-otherOuterNo" colWidth="3"/>
<EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="存货类型" ename="inqu_status-0-inventType" colWidth="3" filter="contains"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</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="material_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-spec" cname="规格" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="receiptTime" cname="单据日期"/>
<EF:EFColumn ename="otherEnthouse" cname="其他出库单号"/>
<EF:EFColumn ename="whCode" cname="仓库编码"/>
<EF:EFColumn ename="whName" cname="仓库名称"/>
<EF:EFColumn ename="matType" cname="物料类型"/>
<EF:EFColumn ename="matCode" cname="物料编码"/>
<EF:EFColumn ename="matName" cname="物料名称"/>
<EF:EFColumn ename="amount" cname="数量"/>
<EF:EFColumn ename="weight" cname="重量"/>
<EF:EFComboColumn align="center" ename="status" cname="操作">
<EF:EFOption label="审核" value="1"/>
<EF:EFOption label="反审" value="0"/>
<EF:EFColumn ename="otherOuterNo" cname="出库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd"
parseFormats="['yyyyMMdd']" width="90" align="center" required="true"/>
<EF:EFComboColumn ename="whCode" cname="仓库编码" width="120" columnTemplate="#=textField#"
itemTemplate="#=textField#" blockName="wh_record_block_id"
textField="textField" valueField="valueField"
align="center" filter="contains" required="true">
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
columnTemplate="#=valueField#-#=textField#" itemTemplate="#=valueField#-#=textField#">
<EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格" width="120" align="center"/>
<EF:EFColumn ename="amount" cname="数量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="weight" cname="重量" format="{0:N3}" maxLength="20" width="100" align="right"
sumType="all" required="true"/>
<EF:EFColumn ename="remark" cname="备注" width="150"/>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时刻" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/KC/HPKC007.js"></script>
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