Commit 442edf6f by 宋祥

1.修改默认前缀

parent 64890cd8
......@@ -3,12 +3,9 @@ package com.baosight.hpjx.hp.kc.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.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
......@@ -24,11 +21,13 @@ 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.data.DaoEPBase;
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.core.web.threadlocal.UserSession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
......@@ -55,7 +54,8 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "查询",operDesc = "初始化")
@Override
@OperationLogAnnotation(operModul = "库存收发存", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
......@@ -75,8 +75,8 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "库存收发存", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
......@@ -146,6 +146,7 @@ public class ServiceHPKC009 extends ServiceBase {
queryMap.put("yesterTo", yesterMonth.with(TemporalAdjusters.lastDayOfMonth())
.format(DateUtils.SHORT_DATE));
queryMap.put("yesterDate", yesterMonth.format(DateUtils.SHORT_MONTH));
// 期初库存查询条件需要取前两个月的收发存记录
queryMap.put("beforeDate", nowDate.minusMonths(2).format(DateUtils.SHORT_MONTH));
queryMap.put("dateType", CommonConstant.DateType.MONTH);
// 0.清除数据
......@@ -168,61 +169,48 @@ public class ServiceHPKC009 extends ServiceBase {
/**
* 统计库存收发存
*
* @param queryMap
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "插入",operDesc = "统计库存收发存")
private List<HPKC009> statData(Map queryMap) {
List<HPKC009> newKc009s = new ArrayList<>();
// 1.1、期末库存
queryMap.put("dateProc", queryMap.get("yesterTo"));
List<HPKC010A> endKcs = dao.query(HPKC010A.QUERY, queryMap);
Map<String, HPKC010A> endKcs = this.listInvData(queryMap, HPKC010A.QUERY);
// 1.2、采购入库
queryMap.put("createdTimeFrom", queryMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", queryMap.get("yesterTo") + "235959");
List<HPKC001> cgRks = dao.query(HPSqlConstant.HPKC001.STAT_DATE, queryMap);
Map<String, HPKC001> cgRkMap = cgRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.3、生产入库
// List<HPKC003> scRks = dao.query(HPSqlConstant.HPKC003.STAT_DATE, queryMap);
// Map<String, HPKC003> scRkMap = scRks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getPartType(), item.getPartCode(),
// item.getWhCode(), null), item -> item));
Map<String, HPKC001> cgRkMap = this.listInvData(queryMap, HPSqlConstant.HPKC001.STAT_DATE);
// 1.4、其他入库
List<HPKC006> qtRks = dao.query(HPSqlConstant.HPKC006.STAT_DATE, queryMap);
Map<String, HPKC006> qtRkMap = qtRks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
Map<String, HPKC006> qtRkMap = this.listInvData(queryMap, HPSqlConstant.HPKC006.STAT_DATE);
// 1.5、生产领料
List<HPKC002> scCks = dao.query(HPSqlConstant.HPKC002.STAT_DATE, queryMap);
Map<String, HPKC002> scCkMap = scCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
// 1.6、销售出库
// List<HPKC004> xsCks = dao.query(HPSqlConstant.HPKC004.STAT_DATE, queryMap);
// Map<String, HPKC004> xsCkMap = xsCks.stream().collect(Collectors.toMap(item ->
// buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventCode(), item.getSubInventCode(),
// item.getWhCode(), ""), item -> item));
Map<String, HPKC002> scCkMap = this.listInvData(queryMap, HPSqlConstant.HPKC002.STAT_DATE);
// 1.7、其它出库
List<HPKC007> qtCks = dao.query(HPSqlConstant.HPKC007.STAT_DATE, queryMap);
Map<String, HPKC007> qtCkMap = qtCks.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
Map<String, HPKC007> qtCkMap = this.listInvData(queryMap, HPSqlConstant.HPKC007.STAT_DATE);
// 1.8、盘点差异数量
List<HPKC005> pdDiffs = dao.query(HPSqlConstant.HPKC005.STAT_DATE, queryMap);
Map<String, HPKC005> pdDiffMap = pdDiffs.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
Map<String, HPKC005> pdDiffMap = this.listInvData(queryMap, HPSqlConstant.HPKC005.STAT_DATE);
// 1.9、期初库存
queryMap.put("dateProc", queryMap.get("beforeDate"));
List<HPKC009> initKcs = dao.query(HPKC009.QUERY, new HashMap<>());
Map<String, HPKC009> initKcMap = initKcs.stream().collect(Collectors.toMap(item ->
buildKey(item.getCompanyCode(), item.getDepCode(), item.getInventType(), item.getInventCode(),
item.getWhCode(), item.getInventRecordId()), item -> item));
Map<String, HPKC009> initKcMap = this.listInvData(queryMap, HPKC009.QUERY);
// 根据期末库存生成收发存对象
for (HPKC010A endKc : endKcs) {
String key = buildKey(endKc.getCompanyCode(), endKc.getDepCode(), endKc.getInventType(),
endKc.getInventCode(), endKc.getWhCode(), endKc.getInventRecordId());
return buildKcBean(queryMap, endKcs, cgRkMap, qtRkMap, scCkMap, qtCkMap, pdDiffMap, initKcMap);
}
/**
* 构建库存收发存对象
*
* @param queryMap
* @param endKcs
* @param cgRkMap
* @param qtCkMap
* @param scCkMap
* @param qtRkMap
* @param pdDiffMap
* @param initKcMap
* @return
*/
private List<HPKC009> buildKcBean(Map queryMap, Map<String, HPKC010A> endKcs, Map<String, HPKC001> cgRkMap,
Map<String, HPKC006> qtRkMap, Map<String, HPKC002> scCkMap, Map<String, HPKC007> qtCkMap,
Map<String, HPKC005> pdDiffMap, Map<String, HPKC009> initKcMap) {
List<HPKC009> newKc009s = new ArrayList<>();
for (Map.Entry<String, HPKC010A> entry : endKcs.entrySet()) {
String key = entry.getKey();
HPKC010A endKc = entry.getValue();
HPKC009 kc009 = BeanUtils.copy(endKc, HPKC009.class);
kc009.setDateType(queryMap.get("dateType").toString());
kc009.setDateProc(queryMap.get("yesterDate").toString());
......@@ -233,10 +221,6 @@ public class ServiceHPKC009 extends ServiceBase {
HPKC001 cgRk = cgRkMap.get(key);
kc009.setCgEnterAmount(cgRk == null ? BigDecimal.ZERO : cgRk.getAmount());
kc009.setCgEnterWeight(cgRk == null ? BigDecimal.ZERO : cgRk.getWeight());
// 1.3、生产入库
HPKC003 scRk = null;//scRkMap.get(key);
kc009.setScEnterAmount(scRk == null ? BigDecimal.ZERO : scRk.getAmount());
kc009.setScEnterWeight(scRk == null ? BigDecimal.ZERO : scRk.getWeight());
// 1.3、其他入库
HPKC006 qtRk = qtRkMap.get(key);
kc009.setQtEnterAmount(qtRk == null ? BigDecimal.ZERO : qtRk.getAmount());
......@@ -250,10 +234,6 @@ public class ServiceHPKC009 extends ServiceBase {
HPKC002 scCk = scCkMap.get(key);
kc009.setScOuterAmount(scCk == null ? BigDecimal.ZERO : scCk.getAmount());
kc009.setScOuterWeight(scCk == null ? BigDecimal.ZERO : scCk.getWeight());
// 1.6、销售出库
HPKC004 xsCk = null;//xsCkMap.get(key);
kc009.setXsOuterAmount(xsCk == null ? BigDecimal.ZERO : xsCk.getAmount());
kc009.setXsOuterWeight(xsCk == null ? BigDecimal.ZERO : xsCk.getWeight());
// 1.7、其他出库
HPKC007 qtCk = qtCkMap.get(key);
kc009.setQtOuterAmount(qtCk == null ? BigDecimal.ZERO : qtCk.getAmount());
......@@ -269,26 +249,45 @@ public class ServiceHPKC009 extends ServiceBase {
kc009.setPdDiffWeight(pdDiff == null ? BigDecimal.ZERO : pdDiff.getDiffWeight());
// 1.9、期初
HPKC009 initKc = initKcMap.get(key);
if (initKc != null) {
kc009.setInitAmount(initKc.getEndAmount());
kc009.setInitWeight(initKc.getEndWeight());
} else {
kc009.setInitAmount(kc009.getEndAmount().subtract(kc009.getPdDiffAmount())
.add(kc009.getOuterAmount()).subtract(kc009.getEnterAmount()));
kc009.setInitWeight(kc009.getEndWeight().subtract(kc009.getPdDiffWeight())
.add(kc009.getOuterWeight()).subtract(kc009.getEnterWeight()));
}
kc009.setInitAmount(initKc != null ? initKc.getEndAmount() : kc009.getEndAmount()
.subtract(kc009.getPdDiffAmount()).add(kc009.getOuterAmount()).subtract(kc009.getEnterAmount()));
kc009.setInitWeight(initKc != null ? initKc.getEndWeight() : kc009.getEndWeight()
.subtract(kc009.getPdDiffWeight()).add(kc009.getOuterWeight()).subtract(kc009.getEnterWeight()));
newKc009s.add(kc009);
}
return newKc009s;
}
/**
* 查询库存数据
*
* @param DataMap
* @param sqlId
* @param <T>
* @return
*/
private <T extends DaoEPBase> Map<String, T> listInvData(Map DataMap, String sqlId) {
Map queryMap = new HashMap();
if (HPKC010A.QUERY.equals(sqlId)) { // 期末库存
queryMap.put("dateProc", DataMap.get("yesterTo"));
} else if (HPKC009.QUERY.equals(sqlId)) { // 期初库存
queryMap.put("dateProc", DataMap.get("beforeDate"));
} else {
queryMap.put("createdTimeFrom", DataMap.get("yesterFrom") + "000000");
queryMap.put("createdTimeTo", DataMap.get("yesterTo") + "235959");
}
List<T> results = dao.query(sqlId, queryMap);
if (CollectionUtils.isEmpty(results)) {
return new HashMap<>();
}
return results.stream().collect(Collectors.toMap(item -> buildKey(item.toMap()), item -> item));
}
/**
* 设置基础信息
*
* @param kc009s
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "设置",operDesc = "设置基础信息")
private void setBaseInfo(List<HPKC009> kc009s) {
// 仓库名称
List<String> whCodes = kc009s.stream().map(HPKC009::getWhCode).collect(Collectors.toList());
......@@ -315,6 +314,17 @@ public class ServiceHPKC009 extends ServiceBase {
/**
* 构建KEY
*
* @param dataMap
* @return
*/
private String buildKey(Map dataMap) {
return buildKey(dataMap.get("companyCode"), dataMap.get("depCode"), dataMap.get("inventType"),
dataMap.get("inventCode"), dataMap.get("whCode"), dataMap.get("inventRecordId"));
}
/**
* 构建KEY
*
* @param companyCode
* @param depCode
* @param inventType
......@@ -323,7 +333,6 @@ public class ServiceHPKC009 extends ServiceBase {
* @param inventRecordId
* @return
*/
@OperationLogAnnotation(operModul = "库存收发存",operType = "设置",operDesc = "构建KEY")
private String buildKey(Object companyCode, Object depCode, Object inventType, Object inventCode,
Object whCode, Object inventRecordId) {
return ObjectUtils.trimToEmpty(companyCode) + "#"
......
......@@ -105,7 +105,6 @@ public class ServiceHPPZ006 extends ServiceBase {
*
* @param resultRows
*/
@OperationLogAnnotation(operModul = "存货档案",operType = "校验",operDesc = "校验保存的数据")
private void checkSaveData(List<Map> resultRows) {
for (int i = 0; i < resultRows.size(); i++) {
HPPZ006 fPz006 = new HPPZ006();
......
......@@ -7,7 +7,6 @@ import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.RsaUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -15,7 +14,6 @@ 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.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.constants.LoginConstants;
......@@ -37,7 +35,8 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "查询",operDesc = "初始化")
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPPZ009().eiMetadata);
......@@ -53,8 +52,8 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "查询",operDesc = "查询")
@Override
@OperationLogAnnotation(operModul = "企业管理", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPPZ009.query", new HPPZ009());
......@@ -123,10 +122,7 @@ public class ServiceHPPZ009 extends ServiceBase {
// 生成企业编码
fPz009.setCompanyCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.COMPANY_CODE));
fPz009.setDeleteFlag(CommonConstant.YesNo.NO_0);
fPz009.setCreatedBy(UserSession.getLoginName());
fPz009.setCreatedName(UserSession.getLoginCName());
fPz009.setCreatedTime(DateUtils.shortDateTime());
dao.insert(HPPZ009.INSERT, fPz009);
DaoUtils.insert(HPPZ009.INSERT, fPz009);
// 默认新增企业管理员账号
this.initUser(fPz009);
// 关联企业管理员角色
......@@ -149,8 +145,8 @@ public class ServiceHPPZ009 extends ServiceBase {
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "配置管理",operType = "新增",operDesc = "新增")
@Override
@OperationLogAnnotation(operModul = "配置管理", operType = "新增", operDesc = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
......@@ -240,7 +236,7 @@ public class ServiceHPPZ009 extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) {
HPPZ009 hppz009 = new HPPZ009();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update("HPPZ009.update", hppz009);
DaoUtils.update(HPPZ009.UPDATE, hppz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -270,7 +266,7 @@ public class ServiceHPPZ009 extends ServiceBase {
throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户",
fPz009.getCompanyName()));
}
DaoUtils.update("HPPZ009.delete", fPz009);
DaoUtils.update(HPPZ009.DELETE, fPz009);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
package com.baosight.xservices.xs.og.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import com.baosight.iplat4j.core.data.dao.DaoFactory;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -24,6 +26,7 @@ import com.baosight.xservices.xs.service.ServiceXSTreeNode;
import com.baosight.xservices.xs.up.utils.XSExcelUtils;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
......@@ -257,8 +260,8 @@ public class ServiceXSOG0801 extends ServiceBase {
}
// 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15
String companyCode = UserSessionUtils.getCompanyCode();
final String companyPrefix = LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
? "" : "[" + companyCode + "]";
HPPZ009 dbPz009 = StringUtils.isBlank(companyCode) ? null : HPPZTools.HpPz009.getByCode(companyCode);
final String companyPrefix = dbPz009 == null ? "" : "[" + dbPz009.getLoginPrefix() + "]";
resultBlock = inInfo.getBlock(EiConstant.resultBlock);
List rows = resultBlock.getRows();
rows.forEach((m) -> {
......
package com.baosight.xservices.xs.service;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -225,9 +227,9 @@ public class ServiceXS40 extends ServiceEPBase {
eiBlock.setRows(r1Block.getRows());
// 非管理员组织机构编码前缀增加企业编码 added by songx at 2024-01-15
String companyCode = UserSessionUtils.getCompanyCode();
final String companyPrefix = LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())
? "" : "[" + companyCode + "]";
for(int i = 0; i < eiBlock.getRowCount(); ++i) {
HPPZ009 dbPz009 = StringUtils.isBlank(companyCode) ? null : HPPZTools.HpPz009.getByCode(companyCode);
final String companyPrefix = dbPz009 == null ? "" : "[" + dbPz009.getLoginPrefix() + "]";
for (int i = 0; i < eiBlock.getRowCount(); ++i) {
Map<String, Object> inInfoRowMap = eiBlock.getRow(i);
inInfoRowMap.remove("groupId");
inInfoRowMap.put("groupEname", companyPrefix + inInfoRowMap.get("groupEname"));
......
......@@ -38,6 +38,12 @@ $(function () {
result4Grid.dataSource.page(1);
});
/**
* 查询锁定用户
*/
$("#QUERY_LOCK").on("click", function () {
result9Region.dataSource.page(1);
});
$(window).load(function () {
resultGrid.dataSource.page(1)
......
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