Commit fd05d0ae by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents cc13e013 67649b9a
package com.baosight.hggp.common;
import java.util.*;
/**
* @Author wwl
* @Date 2024/1/10 14:29
*/
public enum AccountPeriodStatusEnum {
OPEN(1,"开账"),
CLOSE(0,"关账");
private Integer code;
private String value;
AccountPeriodStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public static AccountPeriodStatusEnum getEnumByCode(Integer code){
for (AccountPeriodStatusEnum en : AccountPeriodStatusEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public static String getNameByCode(Integer code){
AccountPeriodStatusEnum en = getEnumByCode(code);
if(Objects.nonNull(en)){
return en.getValue();
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
......@@ -153,16 +153,19 @@ public class UserSessionUtils extends UserSession {
}
List<String> companyCodes = userGroups.stream().map(UserGroup::getCompanyCode)
.filter(StringUtils::isNotBlank).collect(Collectors.toList());
// 查询组织信息
List<Org> orgs = HGXSTools.XsOrg.list(companyCodes);
Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach( code -> {
orgs.addAll(HGXSTools.XsOrg.queryByParent(code,OrgTypeEnum.COMPANY.getCode()));
});
return orgs.stream().filter(o->StringUtils.equals(o.getOrgType(),OrgTypeEnum.COMPANY.getCode())).map(item -> new Company(item.getOrgId(), item.getOrgCname())).collect(Collectors.collectingAndThen(
Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue),
// 将Map转回List
m -> new ArrayList<>(m.values())
));
if(CollectionUtils.isNotEmpty(companyCodes)) {
// 查询组织信息
List<Org> orgs = HGXSTools.XsOrg.list(companyCodes);
Optional.ofNullable(companyCodes).orElse(new ArrayList<>()).stream().forEach(code -> {
orgs.addAll(HGXSTools.XsOrg.queryByParent(code, OrgTypeEnum.COMPANY.getCode()));
});
return orgs.stream().filter(o -> StringUtils.equals(o.getOrgType(), OrgTypeEnum.COMPANY.getCode())).map(item -> new Company(item.getOrgId(), item.getOrgCname())).collect(Collectors.collectingAndThen(
Collectors.toMap(Company::getCompanyCode, Function.identity(), (oldValue, newValue) -> oldValue),
// 将Map转回List
m -> new ArrayList<>(m.values())
));
}
return new ArrayList<Company>();
}
/**
......
......@@ -2,7 +2,6 @@ package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.domain.HGCB002;
import com.baosight.hggp.hg.cb.domain.HGCB005;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001;
......
......@@ -4,21 +4,21 @@
Version : 1.0
schema : hggp
tableName : HGCW001
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
ACCOUNT_YEAR VARCHAR,
ACCOUNT_PERIOD VARCHAR,
ACCOUNT_PERIOD_STATUS TINYINT,
ACCOUNT_PERIOD_DATE_START VARCHAR,
ACCOUNT_PERIOD_DATE_END VARCHAR,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
ACCOUNT_YEAR VARCHAR,
ACCOUNT_PERIOD VARCHAR,
ACCOUNT_PERIOD_STATUS TINYINT,
ACCOUNT_PERIOD_DATE_START VARCHAR,
ACCOUNT_PERIOD_DATE_END VARCHAR,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
DEP_CODE VARCHAR
-->
<sqlMap namespace="HGCW001">
......@@ -81,7 +81,7 @@
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW001">
SELECT
ID as "id",
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
......@@ -289,4 +289,47 @@
)
</select>
<select id="queryByBussines" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cw.domain.HGCW001">
SELECT
ID as "id",
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
ACCOUNT_YEAR as "accountYear", <!-- 会计年度 -->
ACCOUNT_PERIOD as "accountPeriod", <!-- 会计期 -->
ACCOUNT_PERIOD_STATUS as "accountPeriodStatus", <!-- 会计期状态0:关账1:开账 -->
ACCOUNT_PERIOD_DATE_START as "accountPeriodDateStart", <!-- 账期开始日期 -->
ACCOUNT_PERIOD_DATE_END as "accountPeriodDateEnd", <!-- 账期结束日期 -->
CREATED_BY as "createdBy", <!-- 记录创建者 -->
CREATED_NAME as "createdName", <!-- 记录创建名称 -->
CREATED_TIME as "createdTime", <!-- 记录创建时间 -->
UPDATED_BY as "updatedBy", <!-- 记录修改者 -->
UPDATED_NAME as "updatedName", <!-- 记录修改名称 -->
UPDATED_TIME as "updatedTime", <!-- 记录修改时间 -->
DEP_CODE as "depCode" <!-- 部门编码 -->
FROM ${hggpSchema}.HGCW001 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bussinessTime">
<![CDATA[ ACCOUNT_PERIOD_DATE_START >= #bussinessTime# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="bussinessTime">
<![CDATA[ ACCOUNT_PERIOD_DATE_END <= #bussinessTime# ]]>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodStatus">
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID desc
</isEmpty>
</dynamic>
</select>
</sqlMap>
package com.baosight.hggp.hg.cw.tools;
import com.baosight.hggp.common.AccountPeriodStatusEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
......@@ -13,6 +14,7 @@ import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
......@@ -45,6 +47,18 @@ public class HGCWTools {
List<HGCW001> results = DaoBase.getInstance().query(HGCW001.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static HGCW001 getAccountPeriod(String companyCode,String bussinessTime) {
AssertUtils.isTrue(StringUtils.isBlank(bussinessTime), "业务日期不能为空!");
AssertUtils.isTrue(StringUtils.isBlank(companyCode), "业务公司不能为空!");
Map<String, Object> params = new HashMap<>();
params.put("companyCode", companyCode);
params.put("bussinessTime", bussinessTime);
params.put("accountPeriodStatus", AccountPeriodStatusEnum.OPEN.getCode());
List<HGCW001> list = DaoBase.getInstance().query("HGCW001.queryByBussines", params);
AssertUtils.isEmpty(list, "未找到公司符合"+bussinessTime+"开账的账期");
return list.get(0);
}
}
public static class HgCw002 {
......@@ -624,8 +638,8 @@ public class HGCWTools {
});
return results;
}
}
public static class HgCw014 {
......
......@@ -7,6 +7,7 @@ import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cg.tools.HGCGTools;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC001;
import com.baosight.hggp.hg.kc.domain.HGKC003;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
......@@ -196,6 +197,8 @@ public class ServiceHGKC001 extends ServiceBase {
Map<?, ?> map = eiBlock.getRow(i);
hgkc001.fromMap(map);
hgkc001 = HGKCTools.HgKc001.getId(hgkc001.getId());
//查看是否能获取到账期,获取不到就提示
HGCWTools.HgCw001.getAccountPeriod(hgkc001.getCompanyCode(),hgkc001.getDepositDate());
hgkc001.setSubmitStatus(HGConstant.ProductStatus.YTJ);
// 校验数据
this.checkSubmitData(hgkc001);
......
......@@ -6,6 +6,7 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC003;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
......@@ -152,6 +153,8 @@ public class ServiceHGKC003 extends ServiceBase {
Map<?, ?> map = eiBlock.getRow(i);
hgkc003.fromMap(map);
hgkc003 = HGKCTools.HgKc003.getId(hgkc003.getId());
//查看是否能获取到账期,获取不到就提示
HGCWTools.HgCw001.getAccountPeriod(hgkc003.getCompanyCode(),hgkc003.getDepositDate());
hgkc003.setSubmitStatus(HGConstant.ProductStatus.YTJ);
// 校验数据
this.checkSubmitData(hgkc003);
......
......@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.kc.domain.HGKC004A;
import com.baosight.hggp.hg.kc.domain.HGKC010;
......@@ -166,6 +167,8 @@ public class ServiceHGKC004 extends ServiceEPBase {
hgkc004.fromMap(map);
HGKC004 kc004 = HGKCTools.HgKc004.getId(hgkc004.getId());
//查看是否能获取到账期,获取不到就提示
HGCWTools.HgCw001.getAccountPeriod(kc004.getCompanyCode(),kc004.getReceiptDate());
List<HGKC004A> hgkc004s = HGKCTools.HgKc004.getDetailById(hgkc004.getId());
AssertUtils.isEmpty(hgkc004s, "销售出库单明细不存在!");
for (HGKC004A hgkc004A : hgkc004s) {
......
......@@ -170,6 +170,10 @@ public class ServiceHGKC006 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc006.fromMap(map);
hgkc006 = HGKCTools.HgKc006.getById(hgkc006.getId());
//查看是否能获取到账期,获取不到就提示
HGCWTools.HgCw001.getAccountPeriod(hgkc006.getCompanyCode(),hgkc006.getOtherEnterDate());
DaoUtils.update(HGKC006.CHECK, hgkc006.toMap());
}
List<HGKC006A> hgkc006AList = HGKCTools.HgKc006A.getHgkc006aList(hgkc006.getId());
......
......@@ -11,10 +11,8 @@ import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.domain.HGKC007;
import com.baosight.hggp.hg.kc.domain.HGKC007;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
......@@ -153,6 +151,8 @@ public class ServiceHGKC007 extends ServiceBase {
*/
private void modify(HGKC007 hgkc007) throws Exception {
DaoUtils.update(HGKC007.UPDATE, hgkc007);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc007A.updateWhCodeByPrimaryId(hgkc007);
}
/**
......@@ -166,6 +166,8 @@ public class ServiceHGKC007 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc007.fromMap(map);
HGKC007 getKc007 = HGKCTools.HgKc007.getById(hgkc007.getId());
HGCWTools.HgCw001.getAccountPeriod(getKc007.getCompanyCode(),getKc007.getOtherOutDate());
DaoUtils.update(HGKC007.CHECK, hgkc007.toMap());
}
List<HGKC007A> hgkc007AList = HGKCTools.HgKc007A.getHgkc007aList(hgkc007.getId());
......
package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.InventTypeDetailEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ004;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
......@@ -47,8 +51,18 @@ public class ServiceHGKC008 extends ServiceBase {
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGKC008.QUERY, new HGKC008());
//移动端需要主表查询明细需要的下拉框
String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_WH_CODE);
Map map = new HashMap();
map.put(HGKC008A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC008A.FIELD_WH_CODE, whCode);
map.put(HGPZ004.FIELD_INVENT_TYPE_DETAILS, InventTypeDetailEnum.getInentTypeThree());
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID),map,false
);
EiInfoUtils.addBlock(inInfo,"roleCompany", UserSessionUtils.getRoleCompany(), Company.class);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
......@@ -78,6 +92,8 @@ public class ServiceHGKC008 extends ServiceBase {
this.checkSaveData(hgkc008);
if(Objects.nonNull(hgkc008.getId())&&hgkc008.getId()!=0){
DaoUtils.update(HGKC008.UPDATE, hgkc008);
//同时修改子表的仓库数据、公司数据
HGKCTools.HgKc008A.updateWhCodeByReceiveId(hgkc008);
}else {
//生成生产领料编号
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
......@@ -122,6 +138,9 @@ public class ServiceHGKC008 extends ServiceBase {
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc008.fromMap(map);
//查看是否能获取到账期,获取不到就提示
HGKC008 getKc008 = HGKCTools.HgKc008.getById(hgkc008.getId());
HGCWTools.HgCw001.getAccountPeriod(getKc008.getCompanyCode(),getKc008.getReceiptDate());
DaoUtils.update(HGKC008.UPDATE_STATUS, hgkc008);
}
List<HGKC008A> hgkc008AList = HGKCTools.HgKc008A.getHgkc008aList(hgkc008.getId());
......
......@@ -57,7 +57,7 @@ public class ServiceHGKC008A extends ServiceBase {
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 蓝图ids
// 明细ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008A.FIELD_ID);
DaoUtils.update(HGKC008A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
......@@ -131,13 +131,16 @@ public class ServiceHGKC008A extends ServiceBase {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isNull(hgkc008a.getReceiveId(), "未获取到生产领料单ID信息");
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0");
}
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
}
AssertUtils.isTrue(hgkc008a.getInvWeight().compareTo(BigDecimal.ZERO) == 0, "重量不能为0");
if(Objects.nonNull(hgkc008a.getId())&&hgkc008a.getId()!=0){
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0");
}
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
}
}
}
}
......
......@@ -98,6 +98,9 @@
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql>
<sql id="idCondition">
......
......@@ -752,6 +752,30 @@ public class HGKCTools {
List<HGKC007A> results = DaoBase.getInstance().query(HGKC007A.QUERY, paramMap);
return results;
}
public static List<HGKC007A> updateWhCodeByPrimaryId(HGKC007 kc007) {
Map paramMap = new HashMap();
paramMap.put("primaryId", kc007.getId());
List<HGKC007A> results = DaoBase.getInstance().query(HGKC007A.QUERY, paramMap);
results.forEach(o->{
o.setWhName(kc007.getWhName());
o.setWhCode(kc007.getWhCode());
o.setCompanyCode(kc007.getCompanyCode());
o.setCompanyName(kc007.getCompanyName());
o.setProjCode(kc007.getProjCode());
o.setProjName(kc007.getProjName());
});
if (!CollectionUtil.isEmpty(results)){
List<String> inventCodes = results.stream().map(o -> o.getInventCode()).collect(Collectors.toList());
List<HGKC010> kc010List = HGKCTools.HgKc010.getListByBussiness(kc007.getCompanyCode(),kc007.getWhCode(),inventCodes);
results.forEach(o ->{
HGKC010 kc010 = kc010List.stream().filter(k -> k.getInventCode().equals(o.getInventCode())).findAny().orElse(null);
AssertUtils.isTrue(Objects.isNull(kc010), "仓库("+kc007.getWhCode()+"|"+kc007.getWhName()+"),不存在存货信息:("+o.getInventCode()+"|"+o.getInventName()+")");
});
DaoUtils.updateBatch(HGKC007A.UPDATE, results);
}
return results;
}
}
......@@ -798,6 +822,31 @@ public class HGKCTools {
return results;
}
public static List<HGKC008A> updateWhCodeByReceiveId(HGKC008 kc008) {
Map paramMap = new HashMap();
paramMap.put("receiveId", kc008.getId());
List<HGKC008A> results = DaoBase.getInstance().query(HGKC008A.QUERY, paramMap);
results.forEach(o->{
o.setWhName(kc008.getWhName());
o.setWhCode(kc008.getWhCode());
o.setCompanyCode(kc008.getCompanyCode());
o.setCompanyName(kc008.getCompanyName());
o.setProjCode(kc008.getProjCode());
o.setProjName(kc008.getProjName());
});
if (!CollectionUtil.isEmpty(results)){
List<String> inventCodes = results.stream().map(o -> o.getInventCode()).collect(Collectors.toList());
List<HGKC010> kc010List = HGKCTools.HgKc010.getListByBussiness(kc008.getCompanyCode(),kc008.getWhCode(),inventCodes);
results.forEach(o ->{
HGKC010 kc010 = kc010List.stream().filter(k -> k.getInventCode().equals(o.getInventCode())).findAny().orElse(null);
AssertUtils.isTrue(Objects.isNull(kc010), "仓库("+kc008.getWhCode()+"|"+kc008.getWhName()+"),不存在存货信息:("+o.getInventCode()+"|"+o.getInventName()+")");
});
DaoUtils.updateBatch(HGKC008A.UPDATE, results);
}
return results;
}
}
/**
......@@ -861,6 +910,23 @@ public class HGKCTools {
}
/**
* @param companyCode
* @param whCode
* @param inventCodes
*/
public static List<HGKC010> getListByBussiness(String companyCode, String whCode, List<String> inventCodes) {
AssertUtils.isEmpty(companyCode, "公司编码不能为空");
AssertUtils.isEmpty(whCode, "仓库编码不能为空");
AssertUtils.isEmpty(inventCodes, "物料编码不能为空");
Map paramMap = new HashMap();
paramMap.put("companyCode", companyCode);
paramMap.put("whCode", whCode);
paramMap.put("inventCodes", inventCodes);
List<HGKC010> results = DaoBase.getInstance().query(HGKC010.QUERY, paramMap);
return results;
}
/**
* 查询
*
* @param ids
......
......@@ -391,6 +391,7 @@ public class HGSCTools {
public static HGSC005A getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "计划明细ID不能为空!");
HGSC005A results = (HGSC005A)DaoBase.getInstance().get(HGSC005A.QUERY, HGSC005A.FIELD_id, id);
AssertUtils.isTrue(Objects.isNull(results), "计划明细信息为空!");
return results;
}
......
......@@ -60,10 +60,9 @@ public class ServiceXSOG0801A extends ServiceEPBase {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.COMPANY.getCode(),
OrgTypeEnum.FACTORY.getCode(), OrgTypeEnum.DEPT.getCode());
} else if (OrgTypeEnum.FACTORY.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s')", OrgTypeEnum.DEPT.getCode());
condition = String.format(" ITEM_CODE IN ('%s', '%s')", OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode());
} else if (OrgTypeEnum.DEPT.getCode().equals(org.getOrgType())) {
condition = String.format(" ITEM_CODE IN ('%s', '%s', '%s')", OrgTypeEnum.DEPT.getCode(),
OrgTypeEnum.PROD_GROUP.getCode(), OrgTypeEnum.CUT_GROUP.getCode());
condition = String.format(" ITEM_CODE IN ('%s')", OrgTypeEnum.DEPT.getCode());
} else {
condition = " ITEM_CODE = 'NOT CODE'";
}
......
......@@ -12,6 +12,10 @@
<%@ page import="com.baosight.iplat4j.core.web.threadlocal.UserSession" %>
<%@ page import="com.baosight.iplat4j.core.service.soa.XLocalManager" %>
<%@ page import="com.baosight.iplat4j.ed.service.PlatApplicationDynamicContext" %>
<%@ page import="com.baosight.hggp.hg.xs.tools.HGXSTools" %>
<%@ page import="com.baosight.hggp.hg.xs.domain.Org" %>
<%@ page import="java.util.List" %>
<%@ page import="org.apache.commons.collections.CollectionUtils" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
......@@ -21,8 +25,29 @@
UserSession.web2Service(request);
String userName = UserSession.getLoginCName();
String loginName = UserSession.getLoginName();
List<Org> orgList =HGXSTools.XsOrg.queryByUser();
String companyName = "";
String orgName = "";
String orgInfo = "";
if(CollectionUtils.isNotEmpty(orgList)){
Org org = orgList.get(0);
companyName = org.getCompanyName();
orgName = org.getOrgCname();
if(StringUtils.isNotBlank(companyName)) {
orgInfo = companyName;
if (!StringUtils.equals(org.getCompanyCode(), org.getOrgEname()) && StringUtils.isNotBlank(orgName)) {
orgInfo += "-" + orgName;
}
}
if(StringUtils.isBlank(orgName)){
orgName = companyName;
}
}
request.setAttribute("userName", userName);
request.setAttribute("loginName", loginName);
request.setAttribute("companyName", companyName);
request.setAttribute("orgName", orgName);
request.setAttribute("orgInf", orgInfo);
String efSecurityToken = null;
Boolean SideBarIsMini = PlatApplicationContext.getProperty("SideBarIsMini")==null?false: Boolean.valueOf(PlatApplicationContext.getProperty("SideBarIsMini"));
......@@ -118,6 +143,11 @@
<c:set var="loadingIcon" value="<%=loadingIcon%>" scope="session"/>
<c:set var="SideBarIsMini" value="<%=SideBarIsMini%>" />
<c:set var="loginName" value="<%=loginName%>" />
<c:set var="companyName" value="<%=companyName%>" />
<c:set var="orgName" value="<%=orgName%>" />
<c:set var="orgInfo" value="<%=orgInfo%>" />
<!--[if IE 9]>
<html class="ie9 no-focus" xmlns="http://www.w3.org/1999/xhtml">
<![endif]-->
......@@ -167,8 +197,8 @@
<script src="${iPlatStaticURL}/iplatui/assets/js/iplat.ui.bootstrap.min.js"></script>
<script src="${iPlatStaticURL}/iplatui/js/iplat.ui.min.js"></script>
<script src="${iPlatStaticURL}/iPlatV7-index.js"></script>
<%-- <link href="${iPlatStaticURL}/Layx/layx.css" rel="stylesheet" type="text/css" />--%>
<%-- <script src="${iPlatStaticURL}/Layx/layx.js" type="text/javascript"></script>--%>
<link href="${iPlatStaticURL}/Layx/layx.css" rel="stylesheet" type="text/css" />
<script src="${iPlatStaticURL}/Layx/layx.js" type="text/javascript"></script>
<%-- <script src="${iPlatStaticURL}/EM/NT/websocket.js"></script>--%>
</head>
......@@ -317,8 +347,12 @@
<span>${loginName}</span>
</li>
<li>
<span class="information">公司:</span>
<span class="detail-info user-org">${companyName}</span>
</li>
<li>
<span class="information">组织机构:</span>
<span class="detail-info user-org"></span>
<span class="detail-info user-org">${orgName}</span>
</li>
<%--<li data-accountset="true">
<span class="information k-link change-org">公司别:</span>
......
......@@ -14,6 +14,81 @@ $(function () {
},
columns: [
{
field: "inventCode",
template: function (item) {
let template = "";
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
item.inventName = inventRecordBoxBlocks[i]['textField'];
template = inventRecordBoxBlocks[i]['valueField'];
}
}
}
return item.inventCode;
},
editor: function (container, options) {
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: inventRecordBoxBlocks,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#[#:param3Field#]",
valueTemplate: "[#:valueField#]#:textField#[#:param3Field#]",
template: "[#:valueField#]#:textField#[#:param3Field#]",
filter: "contains"
});
}
},
{
field: "prdtSpec",
template: function (item) {
let template = "";
if(item.prdtSpec){
for(let i=0;i<specBoxBlocks.length;i++){
if(item.prdtSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
}
}
}
return item.prdtSpec;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGKC010", "querySpecBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("spec_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
}
},
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
......@@ -37,6 +112,88 @@ $(function () {
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
var item = e.items[0];
//数量计算
if (e.field == "invQty") {
if(item.invQty && item.invUnitWeight){
let totalWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', totalWeight)
}
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
loadChange(grid,e,"price");
}
//单价计算
if (e.field == "price") {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
if (e.field == "inventType") {
//选择后,先加载此方法,再加载属性中的方法,所以存货类型加载时,先修改存货编号下拉框的查询
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode",item.whCode);
inInfo.set("inqu_status-0-companyCode",item.companyCode);
inInfo.set("inqu_status-0-inventType",item.inventType);
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
inventRecordBoxBlocks = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
resultGrid.setCellValue(item, 'inventCode', "")
resultGrid.setCellValue(item, 'inventName', "")
resultGrid.setCellValue(item, 'prdtSpecId', "")
resultGrid.setCellValue(item, 'prdtSpec', "")
resultGrid.setCellValue(item, 'prdtLength', "")
resultGrid.setCellValue(item, 'prdtWidth', "")
resultGrid.setCellValue(item, 'prdtThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"inventCode");
}
if (e.field == "inventCode") {
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'inventType', inventRecordBoxBlocks[i]['param1Field']);
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField']);
resultGrid.setCellValue(item, 'prdtSpecId', inventRecordBoxBlocks[i]['param2Field']);
resultGrid.setCellValue(item, 'prdtSpec', inventRecordBoxBlocks[i]['param3Field']);
resultGrid.setCellValue(item, 'prdtLength', inventRecordBoxBlocks[i]['param4Field']);
resultGrid.setCellValue(item, 'prdtWidth', inventRecordBoxBlocks[i]['param5Field']);
resultGrid.setCellValue(item, 'prdtThick', inventRecordBoxBlocks[i]['param6Field']);
resultGrid.setCellValue(item, 'invQty', inventRecordBoxBlocks[i]['param7Field']);
resultGrid.setCellValue(item, 'invUnitWeight', inventRecordBoxBlocks[i]['param8Field']);
resultGrid.setCellValue(item, 'invWeight', inventRecordBoxBlocks[i]['param9Field']);
resultGrid.setCellValue(item, 'inventTypeDetail', inventRecordBoxBlocks[i]['param10Field']);
break
}
}
loadChange(grid,e,"price");
}
if (e.field == "prdtSpec") {
for(let i=0;i<specBoxBlocks.length;i++){
if(item.prdtSpec === specBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'prdtLength', specBoxBlocks[i]['param1Field'])
resultGrid.setCellValue(item, 'prdtWidth', specBoxBlocks[i]['param2Field'])
resultGrid.setCellValue(item, 'prdtThick', specBoxBlocks[i]['param3Field'])
resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param6Field'])
resultGrid.setCellValue(item, 'prdtSpecId', specBoxBlocks[i]['param7Field'])
break
}
}
resultGrid.setCellValue(item, 'price', "")
resultGrid.setCellValue(item, 'amount', "")
loadChange(grid,e,"invQty");
}
});
},
onSave: function (e) {
......
......@@ -38,7 +38,7 @@
<EF:EFColumn ename="inventTypeDetail" cname="存货类型大类" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="存货编码" width="220" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="160" align="center" required="true" enable="false"/>
<EF:EFColumn ename="prdtSpec" cname="规格" width="120" align="center" enable="true" required="true"/>
<EF:EFColumn ename="prdtSpec" cname="规格" width="120" align="center" enable="false" required="false" />
<EF:EFColumn ename="inventRecordId" cname="规格id" width="120" align="center" required="true" enable="false" hidden="true"/>
<EF:EFColumn ename="prdtLength" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="prdtWidth" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
......
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