Commit dd8026da by 宋祥

1.生产入库单页面调整

parent abfcdd85
package com.baosight.hpjx.core.dao; package com.baosight.hpjx.core.dao;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.xs.tools.HPXSUserTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils; import com.baosight.hpjx.util.DateUtils;
import com.baosight.iplat4j.core.data.DaoEPBase; import com.baosight.iplat4j.core.data.DaoEPBase;
...@@ -103,6 +105,24 @@ public class DaoUtils { ...@@ -103,6 +105,24 @@ public class DaoUtils {
} catch (Exception e) { } catch (Exception e) {
log.warn("写入创建人姓名失败", e); log.warn("写入创建人姓名失败", e);
} }
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
BeanUtils.setProperty(bean, "companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
try {
BeanUtils.setProperty(bean, "depCode", HPXSUserTools.getOrgId());
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime()); BeanUtils.setProperty(bean, "createdTime", DateUtils.shortDateTime());
...@@ -141,6 +161,24 @@ public class DaoUtils { ...@@ -141,6 +161,24 @@ public class DaoUtils {
} }
map.put("createdName", userName); map.put("createdName", userName);
map.put("updatedName", ""); map.put("updatedName", "");
// 创建人企业编码
try {
String companyCode;
try {
companyCode = UserSessionUtils.getCompanyCode();
} catch (Exception e) {
companyCode = "";
}
map.put("companyCode", companyCode);
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建人部门编码
try {
map.put("depCode", HPXSUserTools.getOrgId());
} catch (Exception e) {
log.warn("写入创建人企业编码失败", e);
}
// 创建时刻 // 创建时刻
try { try {
map.put("createdTime", DateUtils.shortDateTime()); map.put("createdTime", DateUtils.shortDateTime());
......
...@@ -20,6 +20,8 @@ public class HPConstant { ...@@ -20,6 +20,8 @@ public class HPConstant {
public static final String HPKC008_NUMBER = "HPKC008_NUMBER"; public static final String HPKC008_NUMBER = "HPKC008_NUMBER";
// 巡检单号 // 巡检单号
public static final String HPZL001_NUMBER = "HPZL001_NUMBER"; public static final String HPZL001_NUMBER = "HPZL001_NUMBER";
// 生产入库单号
public static final String HPKC003_PROD_NO = "HPKC003_PROD_NO";
} }
/** /**
......
...@@ -84,7 +84,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -84,7 +84,7 @@ public class HPKC009 extends DaoEPBase {
private String dateProc = " "; /* 日期*/ private String dateProc = " "; /* 日期*/
private String whCode = " "; /* 仓库编码*/ private String whCode = " "; /* 仓库编码*/
private String whName = " "; /* 仓库名称*/ private String whName = " "; /* 仓库名称*/
private String inventType = " "; /* 存货类型*/ private Integer inventType; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/ private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/ private String inventName = " "; /* 存货名称*/
private String spec = " "; /* 规格*/ private String spec = " "; /* 规格*/
...@@ -380,7 +380,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -380,7 +380,7 @@ public class HPKC009 extends DaoEPBase {
* get the inventType - 存货类型. * get the inventType - 存货类型.
* @return the inventType * @return the inventType
*/ */
public String getInventType() { public Integer getInventType() {
return this.inventType; return this.inventType;
} }
...@@ -389,7 +389,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -389,7 +389,7 @@ public class HPKC009 extends DaoEPBase {
* *
* @param inventType - 存货类型 * @param inventType - 存货类型
*/ */
public void setInventType(String inventType) { public void setInventType(Integer inventType) {
this.inventType = inventType; this.inventType = inventType;
} }
/** /**
...@@ -680,7 +680,7 @@ public class HPKC009 extends DaoEPBase { ...@@ -680,7 +680,7 @@ public class HPKC009 extends DaoEPBase {
setDateProc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DATE_PROC)), dateProc)); setDateProc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DATE_PROC)), dateProc));
setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode)); setWhCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_CODE)), whCode));
setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName)); setWhName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_WH_NAME)), whName));
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType)); setInventType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode)); setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName)); setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec)); setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
......
package com.baosight.hpjx.hp.kc.service; package com.baosight.hpjx.hp.kc.service;
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.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003; import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC009;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.THppz004;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil; import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author xuao * @author:songx
* @date 2024年01月12日 14:22 * @date:2024/1/22,10:48
*/ */
public class ServiceHPKC003 extends ServiceBase { public class ServiceHPKC003 extends ServiceBase {
/**
/** * 画面初始化
* 画面初始化. *
*/ * @param inInfo
public EiInfo initLoad(EiInfo inInfo) { * @return
HPKC003 hpkc003 = new HPKC003(); */
EiInfo outInfo = new EiInfo(); public EiInfo initLoad(EiInfo inInfo) {
outInfo.addBlock(EiConstant.resultBlock); try {
outInfo.getBlock(EiConstant.resultBlock).addBlockMeta(hpkc003.eiMetadata); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
return outInfo; CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), null);
} inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC003().eiMetadata);
} catch (Exception e) {
/** LogUtils.setDetailMsg(inInfo, e, "初始化失败");
* 查询操作. }
*/ return inInfo;
@Override }
public EiInfo query(EiInfo inInfo) {
/* 调用EI查询方法.*/ /**
EiInfo outInfo = super.query(inInfo, "HPKC003.query", new HPKC003()); * 查询操作
return outInfo; *
* @param inInfo
} * @return
*/
/** @Override
* 新增操作. public EiInfo query(EiInfo inInfo) {
*/ try {
@Override inInfo = super.query(inInfo, "HPKC003.query", new HPPZ009());
public EiInfo insert(EiInfo inInfo) { } catch (Exception e) {
try { LogUtils.setDetailMsg(inInfo, e, "查询失败");
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); }
return inInfo;
for (int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); i++) { }
// String inventName =inInfo.getCellStr(EiConstant.resultBlock,i,"inventName");
// String[] str = inventName.split("-"); /**
// inInfo.setCell(EiConstant.resultBlock,i,"inventCode", str[0]); * 新增操作
// inInfo.setCell(EiConstant.resultBlock,i,"inventName", str[1]); *
String documentDate = inInfo.getCellStr(EiConstant.resultBlock,i,"documentDate"); * @param inInfo
inInfo.setCell(EiConstant.resultBlock,i,"documentDate", StringUtil.removeHorizontalLine(documentDate)); * @return
*/
} @Override
inInfo.setStatus(EiConstant.STATUS_SUCCESS); public EiInfo insert(EiInfo inInfo) {
inInfo.setMsg("新增成功!"); CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
try {
} catch (PlatException e) { List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
e.printStackTrace(); // 数据写入
inInfo.setStatus(EiConstant.STATUS_FAILURE); for (int i = 0; i < resultRows.size(); i++) {
inInfo.setMsg("新增失败!原因参见详细错误描述!"); HPKC003 fKc003 = new HPKC003();
inInfo.setDetailMsg(e.getMessage()); fKc003.fromMap(resultRows.get(i));
logError("新增失败", e.getMessage()); fKc003.setDocumentDate(StringUtil.removeHorizontalLine(fKc003.getDocumentDate()));
return inInfo; // 仓库名称
} fKc003.setWhName(HPPZTools.getWhNameByCode(fKc003.getWhCode()));
return super.insert(inInfo,"HPKC003.insert"); // 物料名称
} fKc003.setInventName(HPPZTools.getInventNameByCode(fKc003.getInventCode()));
// 生成入库单号
fKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
/** DaoUtils.insert("HPKC003.insert", fKc003);
* 修改操作. }
*/ inInfo = this.query(inInfo);
public EiInfo update(EiInfo inInfo) { inInfo.setStatus(EiConstant.STATUS_DEFAULT);
try { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
CommonMethod.creatorInfo(inInfo,EiConstant.resultBlock); } catch (Exception e) {
HPKC003 hpkc003 = new HPKC003(); LogUtils.setDetailMsg(inInfo, e, "新增失败");
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); }
for (int i = 0; i < eiBlock.getRowCount(); i++) { return inInfo;
Map<?, ?> map = eiBlock.getRow(i); }
hpkc003.fromMap(map);
String documentDate = inInfo.getCellStr(EiConstant.resultBlock,i,"documentDate"); /**
inInfo.setCell(EiConstant.resultBlock,i,"documentDate", StringUtil.removeHorizontalLine(documentDate)); * 修改操作
this.dao.update("HPKC003.update", hpkc003.toMap()); *
} * @param inInfo
inInfo.setStatus(EiConstant.STATUS_SUCCESS); * @return
inInfo.setMsg("修改成功!"); */
} catch (PlatException e) { public EiInfo update(EiInfo inInfo) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); try {
inInfo.setMsg("操作失败!原因参见详细错误描述!"); CommonMethod.creatorInfo(inInfo, EiConstant.resultBlock);
inInfo.setDetailMsg(e.getMessage()); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
logError("修改失败", e.getMessage()); for (int i = 0; i < resultRows.size(); i++) {
return inInfo; HPKC003 fKc003 = new HPKC003();
} fKc003.fromMap(resultRows.get(i));
return query(inInfo); fKc003.setDocumentDate(StringUtil.removeHorizontalLine(fKc003.getDocumentDate()));
} // 仓库名称
fKc003.setWhName(HPPZTools.getWhNameByCode(fKc003.getWhCode()));
/** // 物料名称
* 删除操作. fKc003.setInventName(HPPZTools.getInventNameByCode(fKc003.getInventCode()));
*/ DaoUtils.update("HPKC003.update", fKc003);
public EiInfo delete(EiInfo eiInfo) { }
HPKC003 hpkc003 = new HPKC003(); inInfo = this.query(inInfo);
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
try { inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
for (int i = 0; i < eiBlock.getRowCount(); i++) { } catch (Exception e) {
Map<?, ?> map = eiBlock.getRow(i); LogUtils.setDetailMsg(inInfo, e, "修改失败");
hpkc003.fromMap(map); }
return inInfo;
this.dao.delete("HPKC003.delete", hpkc003.toMap()); }
}
} catch (PlatException e) { /**
eiInfo.setStatus(EiConstant.STATUS_FAILURE); * 删除操作
eiInfo.setMsg("删除失败,原因参见详细错误描述!"); *
eiInfo.setDetailMsg(e.getMessage()); * @param eiInfo
logError("删除失败!", e.getMessage()); * @return
return eiInfo; */
} public EiInfo delete(EiInfo eiInfo) {
HPKC003 hpkc003 = new HPKC003();
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
eiInfo.setMsg("删除成功!"); try {
return eiInfo; for (int i = 0; i < eiBlock.getRowCount(); i++) {
} Map<?, ?> map = eiBlock.getRow(i);
hpkc003.fromMap(map);
this.dao.delete("HPKC003.delete", hpkc003.toMap());
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(eiInfo, e, "删除失败");
}
return eiInfo;
}
} }
...@@ -30,24 +30,28 @@ import java.util.Map; ...@@ -30,24 +30,28 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @author YK *
* @date 2024年01月09日 10:18 * @author:songx
* @date:2024/1/22,10:51
*/ */
public class ServiceHPKC005 extends ServiceBase { public class ServiceHPKC005 extends ServiceBase {
/** /**
* 画面初始化. * 画面初始化
*/ *
public EiInfo initLoad(EiInfo inInfo) { * @param inInfo
HPKC005 HPKC005 = new HPKC005(); * @return
EiInfo outInfo = super.initLoad(inInfo, HPKC005); */
outInfo.addBlock(EiConstant.queryBlock).setCell(0, "receiptDate", CommonMethod.getCurrentSameYearMonth()); public EiInfo initLoad(EiInfo inInfo) {
outInfo.getBlock(EiConstant.resultBlock).getRows().clear(); HPKC005 HPKC005 = new HPKC005();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null); EiInfo outInfo = super.initLoad(inInfo, HPKC005);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null); outInfo.addBlock(EiConstant.queryBlock).setCell(0, "receiptDate", CommonMethod.getCurrentSameYearMonth());
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null); outInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outInfo; CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
} CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.WH_RECORD_QUERY_BLOCK_ID), null);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), null);
return outInfo;
}
/** /**
* 查询操作. * 查询操作.
......
...@@ -204,7 +204,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -204,7 +204,7 @@ public class ServiceHPKC009 extends ServiceBase {
+ aItem.getWhCode() + "#" + aItem.getMaterialType() + "#" + aItem.getWhCode() + "#" + aItem.getMaterialType() + "#"
+ aItem.getMaterialCode() + "#" + aItem.getSpec(); + aItem.getMaterialCode() + "#" + aItem.getSpec();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getMaterialType()); kc009.setInventType(Integer.parseInt(aItem.getMaterialType()));
kc009.setInventCode(aItem.getMaterialCode()); kc009.setInventCode(aItem.getMaterialCode());
kc009.setKcType(HPConstant.KcType.CG); kc009.setKcType(HPConstant.KcType.CG);
kc009.setDateType(queryMap.get("dateType").toString()); kc009.setDateType(queryMap.get("dateType").toString());
...@@ -251,8 +251,8 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -251,8 +251,8 @@ public class ServiceHPKC009 extends ServiceBase {
queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959"); queryMap.put("createdTimeTo", queryMap.get("yesterday") + "235959");
List<HPKC003> bItems = dao.query("HPKC003.statDate", queryMap); List<HPKC003> bItems = dao.query("HPKC003.statDate", queryMap);
Map<String, HPKC003> bItemMap = bItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC003> bItemMap = bItems.stream().collect(Collectors.toMap(item ->
item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWarehouseCode() + "#" item.getCompanyCode() + "#" + item.getDepCode() + "#" + item.getWhCode() + "#"
+ item.getMaterialType() + "#" + item.getMaterialCode(), item -> item)); + item.getInventType() + "#" + item.getInventCode(), item -> item));
// 1.3、发出 // 1.3、发出
List<HPKC004> cItems = dao.query("HPKC004.statDate", queryMap); List<HPKC004> cItems = dao.query("HPKC004.statDate", queryMap);
Map<String, HPKC004> cItemMap = cItems.stream().collect(Collectors.toMap(item -> Map<String, HPKC004> cItemMap = cItems.stream().collect(Collectors.toMap(item ->
...@@ -268,22 +268,22 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -268,22 +268,22 @@ public class ServiceHPKC009 extends ServiceBase {
// 根据期末库存生成收发存对象 // 根据期末库存生成收发存对象
for (HPKC003 aItem : aItems) { for (HPKC003 aItem : aItems) {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#" String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWarehouseCode() + "#" + aItem.getMaterialType() + "#" + aItem.getWhCode() + "#" + aItem.getInventType() + "#"
+ aItem.getMaterialCode(); + aItem.getInventCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setWhCode(aItem.getWarehouseCode()); kc009.setWhCode(aItem.getWhCode());
kc009.setInventType(aItem.getMaterialType() + ""); kc009.setInventType(aItem.getInventType());
kc009.setInventCode(aItem.getMaterialCode()); kc009.setInventCode(aItem.getInventCode());
kc009.setKcType(HPConstant.KcType.SC); kc009.setKcType(HPConstant.KcType.SC);
kc009.setDateType(queryMap.get("dateType").toString()); kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString()); kc009.setDateProc(queryMap.get("yesterDate").toString());
// 期末 // 期末
kc009.setEndAmount(new BigDecimal(aItem.getNumber())); kc009.setEndAmount(aItem.getAmount());
kc009.setEndWeight(new BigDecimal(aItem.getWeight())); kc009.setEndWeight(aItem.getWeight());
// 收入 // 收入
HPKC003 bItem = bItemMap.get(key); HPKC003 bItem = bItemMap.get(key);
kc009.setStockinAmount(bItem == null ? BigDecimal.ZERO : new BigDecimal(bItem.getNumber())); kc009.setStockinAmount(bItem == null ? BigDecimal.ZERO : bItem.getAmount());
kc009.setStockinWeight(bItem == null ? BigDecimal.ZERO : new BigDecimal(bItem.getWeight())); kc009.setStockinWeight(bItem == null ? BigDecimal.ZERO : bItem.getWeight());
// 发出 // 发出
HPKC004 cItem = cItemMap.get(key); HPKC004 cItem = cItemMap.get(key);
kc009.setStockoutAmount(cItem == null ? BigDecimal.ZERO : cItem.getAmount()); kc009.setStockoutAmount(cItem == null ? BigDecimal.ZERO : cItem.getAmount());
...@@ -338,7 +338,7 @@ public class ServiceHPKC009 extends ServiceBase { ...@@ -338,7 +338,7 @@ public class ServiceHPKC009 extends ServiceBase {
String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#" String key = aItem.getCompanyCode() + "#" + aItem.getDepCode() + "#"
+ aItem.getWhCode() + "#" + aItem.getMatType() + "#" + aItem.getMatCode(); + aItem.getWhCode() + "#" + aItem.getMatType() + "#" + aItem.getMatCode();
HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class); HPKC009 kc009 = BeanUtils.copy(aItem, HPKC009.class);
kc009.setInventType(aItem.getMatType()); kc009.setInventType(Integer.parseInt(aItem.getMatType()));
kc009.setInventCode(aItem.getMatCode()); kc009.setInventCode(aItem.getMatCode());
kc009.setKcType(HPConstant.KcType.QT); kc009.setKcType(HPConstant.KcType.QT);
kc009.setDateType(queryMap.get("dateType").toString()); kc009.setDateType(queryMap.get("dateType").toString());
......
...@@ -154,15 +154,10 @@ ...@@ -154,15 +154,10 @@
ORDER BY WH_CODE ORDER BY WH_CODE
</select> </select>
<select id="queryByWhCode" parameterClass="java.util.HashMap" <select id="queryByWhCode" resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
resultClass="com.baosight.hpjx.hp.pz.domain.HPPZ007">
SELECT WH_NAME as "whName" SELECT WH_NAME as "whName"
FROM hpjx.t_hppz007 WHERE 1=1 FROM hpjx.t_hppz007 WHERE 1=1
<isNotEmpty prepend=" AND " property="whCode"> AND WH_CODE = #whCode#
WH_CODE = #whCode#
</isNotEmpty>
</select> </select>
</sqlMap> </sqlMap>
...@@ -21,6 +21,34 @@ import java.util.stream.Collectors; ...@@ -21,6 +21,34 @@ import java.util.stream.Collectors;
public class HPPZTools { public class HPPZTools {
/** /**
* 查询存货名称
*
* @param inventCode
* @return
*/
public static String getInventNameByCode(String inventCode) {
AssertUtils.isEmpty(inventCode, "存货编码不能为空");
Map queryMap = new HashMap();
queryMap.put("inventCode", inventCode);
List<THppz004> pz004s = DaoBase.getInstance().query("HPPZ004.queryMatNameByCode", queryMap);
return CollectionUtils.isEmpty(pz004s) ? null : pz004s.get(0).getInventName();
}
/**
* 查询仓库名称
*
* @param whCode
* @return
*/
public static String getWhNameByCode(String whCode) {
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
Map queryMap = new HashMap();
queryMap.put("whCode", whCode);
List<HPPZ007> pz007s = DaoBase.getInstance().query("HPPZ007.queryByWhCode", queryMap);
return CollectionUtils.isEmpty(pz007s) ? null : pz007s.get(0).getWhName();
}
/**
* 查询存货信息 * 查询存货信息
* *
* @param inventCodes * @param inventCodes
......
...@@ -52,15 +52,11 @@ ...@@ -52,15 +52,11 @@
AND MEMBER_ID = #memberId# AND MEMBER_ID = #memberId#
</select> </select>
<!-- 用户组查询 --> <!-- 查询用户组织机构 -->
<select id="queryGroupEname" resultClass="java.util.LinkedHashMap"> <select id="queryOrgId" resultClass="java.util.LinkedHashMap">
SELECT SELECT ORG_ID AS "orgId"
ID as "id", <!-- id --> FROM ${platSchema}.TXSOG02
GROUP_ENAME as "groupEname", <!-- 用户组id --> WHERE USER_ID = #userId#
GROUP_CNAME as "groupCname" <!-- 用户组名字 -->
FROM ${platSchema}.XS_USER_GROUP
WHERE 1=1
AND ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</select> </select>
</sqlMap> </sqlMap>
package com.baosight.hpjx.hp.xs.tools; package com.baosight.hpjx.hp.xs.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
...@@ -26,4 +27,16 @@ public class HPXSUserTools { ...@@ -26,4 +27,16 @@ public class HPXSUserTools {
return CollectionUtils.isEmpty(results) ? 0 : results.get(0); return CollectionUtils.isEmpty(results) ? 0 : results.get(0);
} }
/**
* 查询用户组织机构
*
* @return
*/
public static String getOrgId() {
Map paramMap = new HashMap();
paramMap.put("userId", UserSession.getLoginName());
List<Map> results = DaoBase.getInstance().query("HPXSUser.queryOrgId", paramMap);
return CollectionUtils.isEmpty(results) ? "" : results.get(0).get("orgId").toString();
}
} }
let inventNameGlobalData = [];
$(function () { $(function () {
$("#QUERY").on("click", function () { $("#QUERY").on("click", query);
resultGrid.dataSource.page(1);
});
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
pageSize: 20, pageSize: 20,
pageSizes: [10, 20, 30, 50, 100, 200], pageSizes: [10, 20, 30, 50, 100, 200],
}, },
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) {
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("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
inventNameGlobalData = dataSource;
},
onFail: function (ei) {
}
}, {async: false});
input.kendoDropDownList({
valuePrimitive: true,
dataTextField: "textField",
dataValueField: "valueField",
dataSource: dataSource,
template: "#=textField#"
});
}
}]
}
}
}); });
/**
* 页面加载时执行
*/
$(window).load(function () {
// 存货名称
let inInfo = new EiInfo();
EiCommunicator.send("HPPZ004", "queryComboBox", inInfo, {
onSuccess: function (ei) {
inventNameGlobalData = ei.getBlock("invent_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
...@@ -6,40 +6,47 @@ ...@@ -6,40 +6,47 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="生产入库单"> <EF:EFPage title="生产入库单">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFDatePicker ename="inqu_status-0-documentDate" cname="单据日期" <EF:EFDatePicker ename="inqu_status-0-documentDate" cname="单据日期" colWidth="3" format="yyyy-MM-dd"
format="yyyy-MM-dd"/> readonly="true"/>
<EF:EFInput ename="inqu_status-0-productionNumber" cname="生产入库单号" colWidth="4" readonly="false"/> <EF:EFInput ename="inqu_status-0-prodNo" cname="生产入库单号" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-warehouseName" cname="仓库名称" colWidth="4" readonly="false"/> <EF:EFSelect ename="inqu_status-0-whCode" cname="仓库名称" colWidth="3" filter="contains" defultValue="">
</div> <EF:EFOption label="请选择" value=""/>
<EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton> <EF:EFOptions blockId="whName_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect ename="inqu_status-0-inventCode" cname="存货名称" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="请选择" value=""/>
<EF:EFOptions blockId="invent_name_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</div>
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true"> <EF:EFGrid blockId="result" autoDraw="false" isFloat="true" autoFit="true">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="id" cname="内码" hidden="true"/> <EF:EFColumn ename="prodNo" cname="生产入库单号" enable="false" width="130" align="center"/>
<EF:EFColumn ename="documentDate" cname="单据日期" editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" width="100" readonly="false" /> <EF:EFColumn ename="documentDate" cname="单据日期" width="100" align="center" editType="date"
<EF:EFColumn ename="productionNumber" cname="生产入库单号" width="100" readonly="false" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="warehouseCode" cname="仓库编码" width="100" readonly="false" required="true"/> <EF:EFComboColumn cname="仓库名称" ename="whCode" columnTemplate="#=textField#"
<EF:EFColumn ename="warehouseName" cname="仓库名称" width="100" readonly="false" required="true"/> itemTemplate="#=textField#" blockName="whName_block_id"
<EF:EFComboColumn ename="materialType" cname="物料类型" align="center" textField="textField" valueField="valueField"
columnTemplate="#=valueField#-#=textField#" optionLabel=" " align="center" filter="contains" width="100">
itemTemplate="#=valueField#-#=textField#" textField="textField" </EF:EFComboColumn>
valueField="valueField" width="100"> <EF:EFComboColumn cname="存货类型" ename="inventType" width="90" align="center">
<EF:EFOption label="--请选择--" value=""></EF:EFOption> <EF:EFCodeOption codeName="hpjx.hpkc.inventType"/>
<EF:EFOption label="待补充" value="1"></EF:EFOption> </EF:EFComboColumn>
</EF:EFComboColumn> <EF:EFColumn cname="存货名称" ename="inventCode" width="120" align="center"/>
<EF:EFColumn ename="materialCode" cname="物料编码" width="100" readonly="false" required="true"/> <EF:EFColumn cname="数量" ename="amount" width="100" align="right" format="{0:N3}"
<EF:EFColumn ename="materialName" cname="物料名称" width="100" readonly="false" required="true"/> sumType="all"/>
<EF:EFColumn ename="number" cname="数量" width="100" readonly="false" required="true"/> <EF:EFColumn cname="重量" ename="weight" width="100" align="right" format="{0:N3}"
<EF:EFColumn ename="weight" cname="重量" width="100" readonly="false" required="true"/> sumType="all"/>
<EF:EFColumn ename="remark" cname="备注" width="100" readonly="false" /> <EF:EFColumn ename="remark" cname="备注" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人名称" ename="createdName" enable="false" width="120" align="center"/>
</EF:EFGrid> <EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
</EF:EFRegion> editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage> </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