Commit f882e1ea by 江和松

6个出/入库操作增加账期校验

parent ee9f0d9d
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;
}
}
......@@ -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.*;
......@@ -168,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());
......
......@@ -5,6 +5,7 @@ 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;
......@@ -50,7 +51,7 @@ 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());
......@@ -59,8 +60,9 @@ public class ServiceHGKC008 extends ServiceBase {
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;
......@@ -136,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");
}
}
}
}
......
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