Commit 39298ec2 by liuyang

2024-07-05 1.原材料入库成本核算 2.原材料出库成本核算 3.收发存汇总查询

parent 0d0980af
......@@ -99,9 +99,9 @@ public class DaoUtils {
public static int insertBatch(String sql, Collection parameters) {
parameters.forEach(obj->{
if (obj instanceof DaoEPBase) {
setRevisor((DaoEPBase) obj, true);
setCreator((DaoEPBase) obj);
} else if (obj instanceof Map) {
setRevisor((Map) obj, true);
setCreator((Map) obj);
}
});
return DaoBase.getInstance().insertBatch(sql, parameters);
......
......@@ -45,7 +45,7 @@ public class HGCB002 extends DaoEPBase {
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_SPEC_ID = "specId"; /* 规格ID*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格ID*/
public static final String FIELD_SPEC = "spec"; /* 规格*/
public static final String FIELD_UNIT = "unit"; /* 单位*/
public static final String FIELD_QUANTITY = "quantity"; /* 数量*/
......@@ -53,6 +53,7 @@ public class HGCB002 extends DaoEPBase {
public static final String FIELD_IS_ESTIMATE = "isEstimate"; /* 是否暂估:0-否 1-是*/
public static final String FIELD_PRICE = "price"; /* 单价*/
public static final String FIELD_AMOUNT = "amount"; /* 金额*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -91,6 +92,7 @@ public class HGCB002 extends DaoEPBase {
public static final String INSERT = "HGCB002.insert";
public static final String UPDATE = "HGCB002.update";
public static final String DELETE = "HGCB002.delete";
public static final String DELETE_PERIOD = "HGCB002.deleteByPeriod";
private Long id = new Long(0); /* ID*/
private String accountCode = " "; /* 企业编码*/
......@@ -115,7 +117,7 @@ public class HGCB002 extends DaoEPBase {
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long specId = new Long(0); /* 规格ID*/
private Long inventRecordId = new Long(0); /* 规格ID*/
private String spec = " "; /* 规格*/
private String unit = " "; /* 单位*/
private BigDecimal quantity = new BigDecimal("0"); /* 数量*/
......@@ -123,6 +125,7 @@ public class HGCB002 extends DaoEPBase {
private Integer isEstimate = 0; /* 是否暂估:0-否 1-是*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额*/
private Integer inventTypeDetail;
/**
* initialize the metadata.
......@@ -223,7 +226,7 @@ public class HGCB002 extends DaoEPBase {
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SPEC_ID);
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
eiColumn.setDescName("规格ID");
eiMetadata.addMeta(eiColumn);
......@@ -267,6 +270,9 @@ public class HGCB002 extends DaoEPBase {
eiColumn.setDescName("金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
}
......@@ -648,20 +654,20 @@ public class HGCB002 extends DaoEPBase {
this.inventName = inventName;
}
/**
* get the specId - 规格ID.
* @return the specId
* get the inventRecordId - 规格ID.
* @return the inventRecordId
*/
public Long getSpecId() {
return this.specId;
public Long getInventRecordId() {
return this.inventRecordId;
}
/**
* set the specId - 规格ID.
* set the inventRecordId - 规格ID.
*
* @param specId - 规格ID
* @param inventRecordId - 规格ID
*/
public void setSpecId(Long specId) {
this.specId = specId;
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
}
/**
* get the spec - 规格.
......@@ -775,6 +781,15 @@ public class HGCB002 extends DaoEPBase {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public Integer getInventTypeDetail() {
return inventTypeDetail;
}
public void setInventTypeDetail(Integer inventTypeDetail) {
this.inventTypeDetail = inventTypeDetail;
}
/**
* get the value from Map.
*
......@@ -806,7 +821,7 @@ public class HGCB002 extends DaoEPBase {
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpecId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_SPEC_ID)), specId));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
setUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UNIT)), unit));
setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_QUANTITY)), quantity));
......@@ -814,6 +829,7 @@ public class HGCB002 extends DaoEPBase {
setIsEstimate(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_ESTIMATE)), isEstimate));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
}
/**
......@@ -846,7 +862,7 @@ public class HGCB002 extends DaoEPBase {
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_SPEC_ID, StringUtils.toString(specId, eiMetadata.getMeta(FIELD_SPEC_ID)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_SPEC, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_SPEC)));
map.put(FIELD_UNIT, StringUtils.toString(unit, eiMetadata.getMeta(FIELD_UNIT)));
map.put(FIELD_QUANTITY, StringUtils.toString(quantity, eiMetadata.getMeta(FIELD_QUANTITY)));
......@@ -854,7 +870,7 @@ public class HGCB002 extends DaoEPBase {
map.put(FIELD_IS_ESTIMATE, StringUtils.toString(isEstimate, eiMetadata.getMeta(FIELD_IS_ESTIMATE)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
return map;
}
}
......@@ -44,7 +44,7 @@ public class HGCB003 extends DaoEPBase {
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_SPEC_ID = "specId"; /* 规格ID*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格ID*/
public static final String FIELD_SPEC = "spec"; /* 规格*/
public static final String FIELD_UNIT = "unit"; /* 单位*/
public static final String FIELD_QUANTITY = "quantity"; /* 数量*/
......@@ -52,6 +52,7 @@ public class HGCB003 extends DaoEPBase {
public static final String FIELD_IS_ESTIMATE = "isEstimate"; /* 是否暂估:0-否 1-是*/
public static final String FIELD_PRICE = "price"; /* 单价*/
public static final String FIELD_AMOUNT = "amount"; /* 金额*/
public static final String FIELD_INVENT_TYPE_DETAIL = "inventTypeDetail"; /*存货类型明细*/
public static final String COL_ID = "ID"; /* ID*/
public static final String COL_ACCOUNT_CODE = "ACCOUNT_CODE"; /* 企业编码*/
......@@ -90,6 +91,7 @@ public class HGCB003 extends DaoEPBase {
public static final String INSERT = "HGCB003.insert";
public static final String UPDATE = "HGCB003.update";
public static final String DELETE = "HGCB003.delete";
public static final String DELETE_PERIOD = "HGCB003.deleteByPeriod";
private Long id = new Long(0); /* ID*/
private String accountCode = " "; /* 企业编码*/
......@@ -113,7 +115,7 @@ public class HGCB003 extends DaoEPBase {
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long specId = new Long(0); /* 规格ID*/
private Long inventRecordId = new Long(0); /* 规格ID*/
private String spec = " "; /* 规格*/
private String unit = " "; /* 单位*/
private BigDecimal quantity = new BigDecimal("0"); /* 数量*/
......@@ -121,6 +123,7 @@ public class HGCB003 extends DaoEPBase {
private Integer isEstimate = 0; /* 是否暂估:0-否 1-是*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额*/
private Integer inventTypeDetail;
/**
* initialize the metadata.
......@@ -217,7 +220,7 @@ public class HGCB003 extends DaoEPBase {
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SPEC_ID);
eiColumn = new EiColumn(FIELD_INVENT_RECORD_ID);
eiColumn.setDescName("规格ID");
eiMetadata.addMeta(eiColumn);
......@@ -261,6 +264,9 @@ public class HGCB003 extends DaoEPBase {
eiColumn.setDescName("金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INVENT_TYPE_DETAIL);
eiColumn.setDescName("存货类型明细");
eiMetadata.addMeta(eiColumn);
}
......@@ -624,20 +630,20 @@ public class HGCB003 extends DaoEPBase {
this.inventName = inventName;
}
/**
* get the specId - 规格ID.
* @return the specId
* get the inventRecordId - 规格ID.
* @return the inventRecordId
*/
public Long getSpecId() {
return this.specId;
public Long getInventRecordId() {
return this.inventRecordId;
}
/**
* set the specId - 规格ID.
* set the inventRecordId - 规格ID.
*
* @param specId - 规格ID
* @param inventRecordId - 规格ID
*/
public void setSpecId(Long specId) {
this.specId = specId;
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
}
/**
* get the spec - 规格.
......@@ -751,6 +757,15 @@ public class HGCB003 extends DaoEPBase {
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public Integer getInventTypeDetail() {
return inventTypeDetail;
}
public void setInventTypeDetail(Integer inventTypeDetail) {
this.inventTypeDetail = inventTypeDetail;
}
/**
* get the value from Map.
*
......@@ -781,7 +796,7 @@ public class HGCB003 extends DaoEPBase {
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setSpecId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_SPEC_ID)), specId));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
setUnit(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_UNIT)), unit));
setQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_QUANTITY)), quantity));
......@@ -789,6 +804,7 @@ public class HGCB003 extends DaoEPBase {
setIsEstimate(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_ESTIMATE)), isEstimate));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setInventTypeDetail(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_INVENT_TYPE_DETAIL)), inventTypeDetail));
}
/**
......@@ -820,7 +836,7 @@ public class HGCB003 extends DaoEPBase {
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_SPEC_ID, StringUtils.toString(specId, eiMetadata.getMeta(FIELD_SPEC_ID)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_SPEC, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_SPEC)));
map.put(FIELD_UNIT, StringUtils.toString(unit, eiMetadata.getMeta(FIELD_UNIT)));
map.put(FIELD_QUANTITY, StringUtils.toString(quantity, eiMetadata.getMeta(FIELD_QUANTITY)));
......@@ -828,7 +844,7 @@ public class HGCB003 extends DaoEPBase {
map.put(FIELD_IS_ESTIMATE, StringUtils.toString(isEstimate, eiMetadata.getMeta(FIELD_IS_ESTIMATE)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
map.put(FIELD_INVENT_TYPE_DETAIL, StringUtils.toString(inventTypeDetail, eiMetadata.getMeta(FIELD_INVENT_TYPE_DETAIL)));
return map;
}
}
......@@ -42,6 +42,7 @@ public class HGCB004 extends DaoEPBase {
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_INVENT_RECORD_ID = "inventRecordId"; /* 规格ID*/
public static final String FIELD_SPEC = "spec"; /* 规格*/
public static final String FIELD_INIT_QUANTITY = "initQuantity"; /* 期初数量*/
public static final String FIELD_INIT_WEIGHT = "initWeight"; /* 期初重量*/
public static final String FIELD_INIT_AMOUNT = "initAmount"; /* 期初金额*/
......@@ -159,6 +160,7 @@ public class HGCB004 extends DaoEPBase {
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long inventRecordId = new Long(0); /* 规格ID*/
private String spec = " "; /* 规格*/
private BigDecimal initQuantity = new BigDecimal(0); /* 期初数量*/
private BigDecimal initWeight = new BigDecimal(0.000); /* 期初重量*/
private BigDecimal initAmount = new BigDecimal(0.000); /* 期初金额*/
......@@ -280,6 +282,10 @@ public class HGCB004 extends DaoEPBase {
eiColumn.setDescName("规格ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_SPEC);
eiColumn.setDescName("规格");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INIT_QUANTITY);
eiColumn.setType("N");
eiColumn.setScaleLength(0);
......@@ -842,6 +848,15 @@ public class HGCB004 extends DaoEPBase {
public void setInventRecordId(Long inventRecordId) {
this.inventRecordId = inventRecordId;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
/**
* get the initQuantity - 期初数量.
* @return the initQuantity
......@@ -1398,6 +1413,7 @@ public class HGCB004 extends DaoEPBase {
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInventRecordId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INVENT_RECORD_ID)), inventRecordId));
setSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_SPEC)), spec));
setInitQuantity(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INIT_QUANTITY)), initQuantity));
setInitWeight(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INIT_WEIGHT)), initWeight));
setInitAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INIT_AMOUNT)), initAmount));
......@@ -1460,6 +1476,7 @@ public class HGCB004 extends DaoEPBase {
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INVENT_RECORD_ID, StringUtils.toString(inventRecordId, eiMetadata.getMeta(FIELD_INVENT_RECORD_ID)));
map.put(FIELD_SPEC, StringUtils.toString(spec, eiMetadata.getMeta(FIELD_SPEC)));
map.put(FIELD_INIT_QUANTITY, StringUtils.toString(initQuantity, eiMetadata.getMeta(FIELD_INIT_QUANTITY)));
map.put(FIELD_INIT_WEIGHT, StringUtils.toString(initWeight, eiMetadata.getMeta(FIELD_INIT_WEIGHT)));
map.put(FIELD_INIT_AMOUNT, StringUtils.toString(initAmount, eiMetadata.getMeta(FIELD_INIT_AMOUNT)));
......
package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
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.HGCB004;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.utils.HGUtils;
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.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.Arrays;
......@@ -47,12 +51,43 @@ public class ServiceHGCB002 extends ServiceEPBase {
return super.query(inInfo, HGCB002.QUERY, new HGCB002());
}
@OperationLogAnnotation(operModul = "原材料入库成本核算",operType = "删除",operDesc = "删除操作")
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HGCB002.DELETE);
}
@OperationLogAnnotation(operModul = "原材料入库成本核算",operType = "查询",operDesc = "数据同步操作")
public EiInfo select(EiInfo inInfo) {
try {
Map params= EiInfoUtils.getFirstRow(inInfo);
HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(params.get(HGCB002.FIELD_COMPANY_CODE).toString());
params.put(HGCW001.FIELD_ACCOUNT_CODE, hgcw001.getAccountCode());
params.put(HGCW001.FIELD_ACCOUNT_PERIOD, hgcw001.getAccountPeriod());
HGUtils.setCondition(params);
HGCB001 hgcw001Today = HGCBTools.HgCb001.select(params);
if (hgcw001Today != null && hgcw001Today.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]状态为关账状态,数据同步失败!", hgcw001Today.getCompanyCode(), hgcw001Today.getAccountPeriod()));
}
HGCB001 hgcw001Last = HGCBTools.HgCb001.selectLast(params);
if (hgcw001Last != null && hgcw001Last.getAccountPeriodStatus() == 1) {
throw new PlatException(String.format("公司[%s]上月会计期[%s]为开账状态,数据同步失败!", hgcw001Last.getCompanyCode(), hgcw001Last.getAccountPeriod()));
}
HGCBTools.HgCb002.select(params);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "原材料入库成本核算",operType = "查询",operDesc = "查询业务账期")
public EiInfo selectAll(EiInfo inInfo) {
try {
Map params= EiInfoUtils.getFirstRow(inInfo);
HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(params.get(HGCB002.FIELD_COMPANY_CODE).toString());
EiInfoUtils.addBlock(inInfo,"hgcw001_block_id", hgcw001, HGCW001.class);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cb.domain.HGCB001;
import com.baosight.hggp.hg.cb.domain.HGCB003;
import com.baosight.hggp.hg.cb.tools.HGCBTools;
import com.baosight.hggp.hg.cw.domain.HGCW001;
import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
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.ServiceEPBase;
import java.util.Arrays;
import java.util.Map;
/**
......@@ -26,6 +28,7 @@ public class ServiceHGCB003 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.initLoad(inInfo, EiConstant.resultBlock, new HGCB003());
EiInfoUtils.addBlock(inInfo,"company_code_block_id", UserSessionUtils.getRoleCompany(), Company.class);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -43,11 +46,26 @@ public class ServiceHGCB003 extends ServiceEPBase {
}
public EiInfo select(EiInfo inInfo) {
try{
Map params= EiInfoUtils.getFirstRow(inInfo);
HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(params.get(HGCB003.FIELD_COMPANY_CODE).toString());
params.put(HGCW001.FIELD_ACCOUNT_CODE, hgcw001.getAccountCode());
params.put(HGCW001.FIELD_ACCOUNT_PERIOD, hgcw001.getAccountPeriod());
HGUtils.setCondition(params);
HGCB001 hgcw001Today = HGCBTools.HgCb001.select(params);
if (hgcw001Today != null && hgcw001Today.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]状态为关账状态,数据同步失败!", hgcw001Today.getCompanyCode(), hgcw001Today.getAccountPeriod()));
}
HGCB001 hgcw001Last = HGCBTools.HgCb001.selectLast(params);
if (hgcw001Last != null && hgcw001Last.getAccountPeriodStatus() == 1) {
throw new PlatException(String.format("公司[%s]上月会计期[%s]为开账状态,数据同步失败!", hgcw001Last.getCompanyCode(), hgcw001Last.getAccountPeriod()));
}
HGCBTools.HgCb003.select(params);
}catch (Exception e){
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
}
return inInfo;
}
@Override
public EiInfo delete(EiInfo inInfo) {
return super.delete(inInfo, HGCB003.DELETE);
}
}
......@@ -3,6 +3,7 @@ package com.baosight.hggp.hg.cb.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
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.HGCB004;
......@@ -14,6 +15,8 @@ import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.domain.HGPZ007;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -39,12 +42,13 @@ public class ServiceHGCB004 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
EiInfoUtils.addBlock(inInfo,"company_code_block_id", UserSessionUtils.getRoleCompany(), Company.class);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_TYPE_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID), null);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCB004().eiMetadata);
} catch (PlatException e) {
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
......@@ -73,17 +77,23 @@ public class ServiceHGCB004 extends ServiceEPBase {
* @return
*/
@OperationLogAnnotation(operModul = "收发存汇总",operType = "同步数据",operDesc = "同步数据")
public EiInfo synchData(EiInfo inInfo) {
public EiInfo select(EiInfo inInfo) {
try {
Map<String, Object> queryRow = EiInfoUtils.getFirstRow(inInfo);
HGCW001 hgcw001 = HGCWTools.HgCw001.getMaxAccountPeriod(queryRow.get(HGCB002.FIELD_COMPANY_CODE).toString());
queryRow.put(HGCB004.FIELD_ACCOUNT_CODE, hgcw001.getAccountCode());
queryRow.put(HGCB004.FIELD_ACCOUNT_PERIOD, hgcw001.getAccountPeriod());
List<HGCB004> cb004s =HGCBTools.HgCb004.synchData(queryRow);
Map params = EiInfoUtils.getFirstRow(inInfo);
HGUtils.setCondition(params);
HGCB001 hgcw001Today = HGCBTools.HgCb001.select(params);
if (hgcw001Today != null && hgcw001Today.getAccountPeriodStatus() == 0) {
throw new PlatException(String.format("公司[%s]会计期[%s]状态为关账状态,数据同步失败!", hgcw001Today.getCompanyCode(), hgcw001Today.getAccountPeriod()));
}
HGCB001 hgcw001Last = HGCBTools.HgCb001.selectLast(params);
if (hgcw001Last != null && hgcw001Last.getAccountPeriodStatus() == 1) {
throw new PlatException(String.format("公司[%s]上月会计期[%s]为开账状态,数据同步失败!", hgcw001Last.getCompanyCode(), hgcw001Last.getAccountPeriod()));
}
HGCBTools.HgCb004.synchData(params);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + cb004s.size() + "]条数据同步成功!");
inInfo.setMsg("操作成功!本次数据同步成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "同步数据失败");
LogUtils.setDetailMsg(inInfo, e, "数据同步失败");
}
return inInfo;
}
......
......@@ -68,6 +68,51 @@
DEP_CODE = #depCode#
</isNotEmpty>
</sql>
<sql id="lastCondition">
<include refid="HGXSDataAuth.authCondition"/>
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountYear">
ACCOUNT_YEAR = #accountYear#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
ACCOUNT_PERIOD = (select DATE_FORMAT(DATE_SUB(concat(#accountPeriod#,'01'), INTERVAL 1 MONTH), '%Y%m'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriodStatus">
ACCOUNT_PERIOD_STATUS = #accountPeriodStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.cb.domain.HGCB001">
......@@ -199,10 +244,38 @@
ID = #id#
</update>
<select id="getSwitchRowNum" resultClass="com.baosight.hggp.hg.cw.domain.HGCB001">
<select id="getSwitchRowNum" resultClass="com.baosight.hggp.hg.cb.domain.HGCB001">
SELECT * FROM ${hggpSchema}.HGCB001 WHERE ACCOUNT_PERIOD_STATUS = 1
</select>
<select id="getLastRow" parameterClass="java.util.HashMap" resultClass="com.baosight.hggp.hg.cb.domain.HGCB001">
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:开账 -->
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}.HGCB001 WHERE 1=1
<include refid="lastCondition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
ID asc
</isEmpty>
</dynamic>
</select>
<update id="updateSwitchRow">
UPDATE ${hggpSchema}.HGCB001
SET
......
......@@ -62,36 +62,30 @@
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
UNIT as "unit", <!-- 单位 -->
QUANTITY as "quantity", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 -->
IS_ESTIMATE as "isEstimate", <!-- 是否暂估:0-否 1-是 -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount" <!-- 金额 -->
AMOUNT as "amount", <!-- 金额 -->
INVENT_TYPE_DETAIL as "inventTypeDetail" <!-- 存货类型明细 -->
</sql>
<sql id="columnLast">
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
ACCOUNT_YEAR as "accountYear", <!-- 会计年度 -->
ACCOUNT_PERIOD as "accountPeriod", <!-- 会计期 -->
BIZ_TYPE as "bizType", <!-- 业务类型 -->
RECEIPT_DATE as "receiptDate", <!-- 单据日期 -->
RECEIPT_CODE as "receiptCode", <!-- 单据号 -->
RECEIVE_NO as "receiveNo", <!-- 收货单号 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
UNIT as "unit", <!-- 单位 -->
INVENT_TYPE_DETAIL as "inventTypeDetail",
sum(QUANTITY) as "quantity", <!-- 数量 -->
sum(WEIGHT) as "weight", <!-- 重量 -->
IS_ESTIMATE as "isEstimate", <!-- 是否暂估:0-否 1-是 -->
CASE WHEN IFNULL(SUM(QUANTITY), 0) = 0 THEN 0 ELSE SUM(AMOUNT)/SUM(QUANTITY) END as "price", <!-- 单价 -->
sum(AMOUNT) as "amount" <!-- 金额 -->
</sql>
......@@ -166,8 +160,8 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="specId">
SPEC_ID = #specId#
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
......@@ -190,6 +184,12 @@
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
......@@ -206,12 +206,18 @@
SELECT <include refid="column" />
FROM ${hggpSchema}.HGCB002 WHERE 1=1
<include refid="condition" />
<isNotEmpty prepend=" AND " property="accountDate">
ACCOUNT_PERIOD = $accountDate$
</isNotEmpty>
<include refid="order"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGCB002 WHERE 1=1
<include refid="condition" />
<isNotEmpty prepend=" AND " property="accountDate">
ACCOUNT_PERIOD = $accountDate$
</isNotEmpty>
</select>
<select id="queryDetail" parameterClass="java.util.HashMap" resultClass="HGCB002">
......@@ -223,7 +229,8 @@
WH_CODE as "whCode", <!-- 仓库编码 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
SPEC_ID as "specId", <!-- 规格ID -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
INVENT_TYPE_DETAIL as "inventTypeDetail",
SPEC as "spec", <!-- 规格 -->
SUM(QUANTITY) as "quantity", <!-- 数量 -->
SUM(WEIGHT) as "weight", <!-- 重量 -->
......@@ -231,14 +238,17 @@
SUM(AMOUNT) as "amount" <!-- 金额 -->
FROM ${hggpSchema}.HGCB002 WHERE 1=1
<include refid="condition" />
group by ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, ACCOUNT_PERIOD, WH_CODE, INVENT_TYPE, INVENT_CODE, SPEC_ID, SPEC, IS_ESTIMATE
group by ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, ACCOUNT_PERIOD, WH_CODE, INVENT_TYPE, INVENT_CODE, INVENT_RECORD_ID,INVENT_TYPE_DETAIL, SPEC, IS_ESTIMATE
</select>
<!--查询上月-->
<select id="queryLast" parameterClass="java.util.HashMap" resultClass="HGCB002">
SELECT <include refid="columnLast" />
FROM ${hggpSchema}.HGCB002 WHERE 1=1
<include refid="condition" />
group by ACCOUNT_CODE, COMPANY_CODE, COMPANY_NAME, ACCOUNT_YEAR, ACCOUNT_PERIOD, BIZ_TYPE, RECEIPT_DATE, RECEIPT_CODE, RECEIVE_NO, WH_CODE, WH_NAME, INVENT_TYPE, INVENT_CODE, INVENT_NAME, SPEC_ID, SPEC, UNIT, IS_ESTIMATE
<isNotEmpty prepend=" AND " property="accountDate">
ACCOUNT_PERIOD = $accountDate$
</isNotEmpty>
group by ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, COMPANY_NAME, ACCOUNT_YEAR, ACCOUNT_PERIOD, WH_CODE, INVENT_CODE, INVENT_RECORD_ID,INVENT_TYPE_DETAIL, SPEC
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
......@@ -366,19 +376,20 @@
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
INVENT_RECORD_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
UNIT, <!-- 单位 -->
QUANTITY, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
IS_ESTIMATE, <!-- 是否暂估:0-否 1-是 -->
PRICE, <!-- 单价 -->
AMOUNT <!-- 金额 -->
AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #accountYear#, #accountPeriod#, #bizType#,
#receiptDate#, #receiptCode#, #receiveNo#, #whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#,
#unit#, #quantity#, #weight#, #isEstimate#, #price#, #amount#)
#receiptDate#, #receiptCode#, #receiveNo#, #whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #inventRecordId#, #spec#,
#unit#, #quantity#, #weight#, #isEstimate#, #price#, #amount#, #inventTypeDetail#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGCB002
</selectKey>
......@@ -387,6 +398,14 @@
<delete id="delete">
DELETE FROM ${hggpSchema}.HGCB002 WHERE ID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete id="deleteByPeriod">
DELETE FROM ${hggpSchema}.HGCB002
WHERE ACCOUNT_CODE = #accountCode#
AND COMPANY_CODE = #companyCode#
AND ACCOUNT_YEAR = #accountYear#
AND ACCOUNT_PERIOD = #accountPeriod#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGCB002
......@@ -413,14 +432,15 @@
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
SPEC_ID = #specId#, <!-- 规格ID -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 规格ID -->
SPEC = #spec#, <!-- 规格 -->
UNIT = #unit#, <!-- 单位 -->
QUANTITY = #quantity#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
IS_ESTIMATE = #isEstimate#, <!-- 是否暂估:0-否 1-是 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount# <!-- 金额 -->
AMOUNT = #amount#, <!-- 金额 -->
INVENT_TYPE_DETAIL = #inventTypeDetail#
WHERE
ID = #id#
</update>
......
......@@ -61,14 +61,15 @@
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
UNIT as "unit", <!-- 单位 -->
QUANTITY as "quantity", <!-- 数量 -->
WEIGHT as "weight", <!-- 重量 -->
IS_ESTIMATE as "isEstimate", <!-- 是否暂估:0-否 1-是 -->
PRICE as "price", <!-- 单价 -->
AMOUNT as "amount" <!-- 金额 -->
AMOUNT as "amount", <!-- 金额 -->
INVENT_TYPE_DETAIL as "inventTypeDetail" <!-- 存货类型明细 -->
</sql>
<sql id="condition">
<include refid="HGXSDataAuth.authCondition"/>
......@@ -138,8 +139,8 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="specId">
SPEC_ID = #specId#
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
......@@ -162,6 +163,12 @@
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetails">
INVENT_TYPE_DETAIL IN <iterate close=")" open="(" conjunction="," property="inventTypeDetails">#inventTypeDetails[]#</iterate>
</isNotEmpty>
</sql>
<sql id="order">
<dynamic prepend="ORDER BY">
......@@ -191,18 +198,23 @@
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
ACCOUNT_YEAR as "accountYear", <!-- 会计年度 -->
ACCOUNT_PERIOD as "accountPeriod", <!-- 会计期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
SPEC_ID as "specId", <!-- 规格ID -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
INVENT_TYPE_DETAIL as "inventTypeDetail",
SPEC as "spec", <!-- 规格 -->
SUM(QUANTITY) as "quantity", <!-- 数量 -->
SUM(WEIGHT) as "weight", <!-- 重量 -->
IS_ESTIMATE as "isEstimate", <!-- 是否暂估:0-否 1-是 -->
SUM(AMOUNT) as "amount" <!-- 金额 -->
FROM ${hggpSchema}.HGCB003 WHERE 1=1
<include refid="condition" />
GROUP BY ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, ACCOUNT_PERIOD, WH_CODE, INVENT_TYPE, INVENT_CODE, SPEC_ID, IS_ESTIMATE
GROUP BY ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, COMPANY_NAME, ACCOUNT_YEAR, ACCOUNT_PERIOD, WH_CODE, WH_NAME, INVENT_TYPE, INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID,INVENT_TYPE_DETAIL, SPEC
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
......@@ -320,24 +332,33 @@
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
SPEC_ID, <!-- 规格ID -->
INVENT_RECORD_ID, <!-- 规格ID -->
SPEC, <!-- 规格 -->
UNIT, <!-- 单位 -->
QUANTITY, <!-- 数量 -->
WEIGHT, <!-- 重量 -->
IS_ESTIMATE, <!-- 是否暂估:0-否 1-是 -->
PRICE, <!-- 单价 -->
AMOUNT <!-- 金额 -->
AMOUNT, <!-- 金额 -->
INVENT_TYPE_DETAIL
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #accountYear#, #accountPeriod#, #bizType#,
#receiptDate#, #receiptCode#, #whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #specId#, #spec#,
#unit#, #quantity#, #weight#, #isEstimate#, #price#, #amount#)
#receiptDate#, #receiptCode#, #whCode#, #whName#, #inventType#, #inventCode#, #inventName#, #inventRecordId#, #spec#,
#unit#, #quantity#, #weight#, #isEstimate#, #price#, #amount#, #inventTypeDetail#)
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGCB003 WHERE ID = #id#
</delete>
<!-- 按时间删除数据 -->
<delete id="deleteByPeriod">
DELETE FROM ${hggpSchema}.HGCB003
WHERE ACCOUNT_CODE = #accountCode#
AND COMPANY_CODE = #companyCode#
AND ACCOUNT_YEAR = #accountYear#
AND ACCOUNT_PERIOD = #accountPeriod#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGCB003
......@@ -363,14 +384,15 @@
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
SPEC_ID = #specId#, <!-- 规格ID -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 规格ID -->
SPEC = #spec#, <!-- 规格 -->
UNIT = #unit#, <!-- 单位 -->
QUANTITY = #quantity#, <!-- 数量 -->
WEIGHT = #weight#, <!-- 重量 -->
IS_ESTIMATE = #isEstimate#, <!-- 是否暂估:0-否 1-是 -->
PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount# <!-- 金额 -->
AMOUNT = #amount#, <!-- 金额 -->
INVENT_TYPE_DETAIL = #inventTypeDetail#
WHERE
ID = #id#
</update>
......
......@@ -81,6 +81,7 @@
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
INIT_QUANTITY as "initQuantity", <!-- 期初数量 -->
INIT_WEIGHT as "initWeight", <!-- 期初重量 -->
INIT_AMOUNT as "initAmount", <!-- 期初金额 -->
......@@ -160,7 +161,7 @@
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
WH_NAME like concat('%',#whName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
......@@ -169,11 +170,14 @@
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
INVENT_NAME like concat('%',#inventName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="initQuantity">
INIT_QUANTITY = #initQuantity#
</isNotEmpty>
......@@ -386,7 +390,52 @@
</select>
<!--查询上月-->
<select id="queryLast" parameterClass="java.util.HashMap" resultClass="HGCB004">
SELECT <include refid="column" />
SELECT
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
ACCOUNT_PERIOD as "accountPeriod", <!-- 日期 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE_DETAIL as "inventTypeDetail", <!-- 存货类型明细 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INVENT_RECORD_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
SUM(INIT_QUANTITY) as "initQuantity", <!-- 期初数量 -->
SUM(INIT_WEIGHT) as "initWeight", <!-- 期初重量 -->
SUM(INIT_AMOUNT) as "initAmount", <!-- 期初金额 -->
SUM(CG_ENTER_QUANTITY) as "cgEnterQuantity", <!-- 采购入库数量 -->
SUM(CG_ENTER_WEIGHT) as "cgEnterWeight", <!-- 采购入库重量 -->
SUM(CG_ENTER_AMOUNT) as "cgEnterAmount", <!-- 采购入库金额 -->
SUM(SC_ENTER_QUANTITY) as "scEnterQuantity", <!-- 生产入库数量 -->
SUM(SC_ENTER_WEIGHT) as "scEnterWeight", <!-- 生产入库重量 -->
SUM(SC_ENTER_AMOUNT) as "scEnterAmount", <!-- 生产入库金额 -->
SUM(QT_ENTER_QUANTITY) as "qtEnterQuantity", <!-- 其它入库数量 -->
SUM(QT_ENTER_WEIGHT) as "qtEnterWeight", <!-- 其它入库重量 -->
SUM(QT_ENTER_AMOUNT) as "qtEnterAmount", <!-- 其它入库重量 -->
SUM(ENTER_QUANTITY) as "enterQuantity", <!-- 入库数量 -->
SUM(ENTER_WEIGHT) as "enterWeight", <!-- 入库重量 -->
SUM(ENTER_AMOUNT) as "enterAmount", <!-- 入库金额 -->
SUM(SC_OUTER_QUANTITY) as "scOuterQuantity", <!-- 生产领料数量 -->
SUM(SC_OUTER_WEIGHT) as "scOuterWeight", <!-- 生产领料重量 -->
SUM(SC_OUTER_AMOUNT) as "scOuterAmount", <!-- 生产领料金额 -->
SUM(XS_OUTER_QUANTITY) as "xsOuterQuantity", <!-- 销售出库数量 -->
SUM(XS_OUTER_WEIGHT) as "xsOuterWeight", <!-- 销售出库重量 -->
SUM(XS_OUTER_AMOUNT) as "xsOuterAmount", <!-- 销售出库金额 -->
SUM(QT_OUTER_QUANTITY) as "qtOuterQuantity", <!-- 其它出库数量 -->
SUM(QT_OUTER_WEIGHT) as "qtOuterWeight", <!-- 其它出库重量 -->
SUM(QT_OUTER_AMOUNT) as "qtOuterAmount", <!-- 其它出库数量 -->
SUM(OUTER_QUANTITY) as "outerQuantity", <!-- 出库数量 -->
SUM(OUTER_WEIGHT) as "outerWeight", <!-- 出库重量 -->
SUM(OUTER_AMOUNT) as "outerAmount", <!-- 出库金额 -->
SUM(PD_DIFF_QUANTITY) as "pdDiffQuantity", <!-- 盘点差异数量 -->
SUM(PD_DIFF_WEIGHT) as "pdDiffWeight", <!-- 盘点差异重量 -->
SUM(PD_DIFF_AMOUNT) as "pdDiffAmount", <!-- 盘点差异金额 -->
SUM(END_QUANTITY) as "endQuantity", <!-- 期末数量 -->
SUM(END_WEIGHT) as "endWeight", <!-- 期末重量 -->
SUM(END_AMOUNT) as "endAmount" <!-- 期末金额 -->
FROM ${hggpSchema}.HGCB004 WHERE 1=1
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
......@@ -398,7 +447,48 @@
DATE_TYPE = #dateType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
ACCOUNT_PERIOD = DATE_FORMAT(DATE_SUB(concat(#accountPeriod#,'01'), INTERVAL 1 MONTH), '%Y%m')
ACCOUNT_PERIOD = (select DATE_FORMAT(DATE_SUB(concat(#accountPeriod#,'01'), INTERVAL 1 MONTH), '%Y%m'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
GROUP BY ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, COMPANY_NAME, ACCOUNT_PERIOD, WH_CODE, WH_NAME, INVENT_TYPE_DETAIL, INVENT_CODE, INVENT_NAME, INVENT_RECORD_ID, SPEC
</select>
<select id="querySum1" parameterClass="java.util.HashMap" resultClass="HGCB004">
SELECT
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "inventRecordId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
UNIT as "unit", <!-- 单位 -->
INVENT_TYPE_DETAIL as "inventTypeDetail"
FROM ${hggpSchema}.HGKC010
WHERE 1=1 and DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
......@@ -596,6 +686,7 @@
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
INVENT_RECORD_ID, <!-- 规格ID -->
SPEC,
INIT_QUANTITY, <!-- 期初数量 -->
INIT_WEIGHT, <!-- 期初重量 -->
INIT_AMOUNT, <!-- 期初金额 -->
......@@ -631,8 +722,8 @@
END_AMOUNT <!-- 期末金额 -->
)
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#,
#updatedTime#, #companyCode#, #companyName#, #dateType#, #accountPeriod#, #whCode#, #whName#, #inventType#,#inventTypeDetail#,
#inventCode#, #inventName#, #inventRecordId#, #initQuantity#, #initWeight#, #initAmount#, #cgEnterQuantity#,
#updatedTime#, #companyCode#, #companyName#, #dateType#, #accountPeriod#, #whCode#, #whName#, #inventType#, #inventTypeDetail#,
#inventCode#, #inventName#, #inventRecordId#, #spec#, #initQuantity#, #initWeight#, #initAmount#, #cgEnterQuantity#,
#cgEnterWeight#, #cgEnterAmount#, #scEnterQuantity#, #scEnterWeight#, #scEnterAmount#, #qtEnterQuantity#,
#qtEnterWeight#, #qtEnterAmount#, #enterQuantity#, #enterWeight#, #enterAmount#, #scOuterQuantity#,
#scOuterWeight#, #scOuterAmount#, #xsOuterQuantity#, #xsOuterWeight#, #xsOuterAmount#, #qtOuterQuantity#,
......@@ -671,6 +762,7 @@
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INVENT_RECORD_ID = #inventRecordId#, <!-- 规格ID -->
SPEC = #spec#,
INIT_QUANTITY = #initQuantity#, <!-- 期初数量 -->
INIT_WEIGHT = #initWeight#, <!-- 期初重量 -->
INIT_AMOUNT = #initAmount#, <!-- 期初金额 -->
......
......@@ -274,12 +274,19 @@
ACCOUNT_CODE as "accountCode",
COMPANY_CODE as "companyCode",
ACCOUNT_YEAR as "accountYear",
MAX(ACCOUNT_PERIOD) as "accountPeriod"
ACCOUNT_PERIOD as "accountPeriod",
ACCOUNT_PERIOD_DATE_START as "accountPeriodDateStart",
ACCOUNT_PERIOD_DATE_END as "accountPeriodDateEnd"
from ${hggpSchema}.HGCW001
where 1=1
<include refid="condition" />
group by
ACCOUNT_CODE, COMPANY_CODE, ACCOUNT_YEAR
where ACCOUNT_PERIOD_STATUS = 0
AND ACCOUNT_CODE = #accountCode#
AND COMPANY_CODE = #companyCode#
AND ACCOUNT_PERIOD = (
select MAX(ACCOUNT_PERIOD) from ${hggpSchema}.HGCW001
where ACCOUNT_CODE = #accountCode#
and COMPANY_CODE = #companyCode#
and ACCOUNT_PERIOD_STATUS = 0
)
</select>
</sqlMap>
......@@ -35,9 +35,8 @@ public class HGCWTools {
public static HGCW001 getMaxAccountPeriod(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("companyCode", companyCode);
params.put("accountPeriodStatus",0);
List<HGCW001> list = DaoBase.getInstance().query("HGCW001.getMaxAccountPeriod", params);
AssertUtils.isEmpty(list, "未找到公司对应的会计期");
AssertUtils.isEmpty(list, "未找到公司对应的会计期");
return list.get(0);
}
}
......
......@@ -273,7 +273,7 @@
WHERE
ID = #id#
</update>
<!--查询月累计入库数据-->
<select id="queryList" resultClass="com.baosight.hggp.hg.kc.domain.HGKC001">
SELECT <include refid="column"/>
FROM ${hggpSchema}.HGKC001
......@@ -288,12 +288,18 @@
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
LEFT(DEPOSIT_DATE,6) = #accountPeriod#
<isNotEmpty prepend=" AND " property="receiveNo">
RECEIVE_NO = #receiveNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTimeFrom">
DEPOSIT_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
INVENT_TYPE_DETAIL = #inventTypeDetail#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="submitStatus">
SUBMIT_STATUS = #submitStatus#
</isNotEmpty>
<include refid="orderBy"/>
</select>
......
......@@ -460,6 +460,10 @@
DEP_CODE as "depCode", <!-- 部门编码 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
PRDT_CODE as "prdtCode", <!-- 产品编码 -->
PRDT_NAME as "prdtName", <!-- 产品名称 -->
PRDT_SPEC as "prdtSpec", <!-- 产品规格 -->
INVENT_TYPE_DETAIL as "inventTypeDetail",
SUM(INV_QTY) as "invQty", <!-- 数量 -->
SUM(INV_WEIGHT) as "invWeight", <!-- 重量 -->
SUM(AMOUNT) as "amount" <!-- 金额 -->
......@@ -471,8 +475,8 @@
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountPeriod">
LEFT(DEPOSIT_DATE,6) = #accountPeriod#
<isNotEmpty prepend=" AND " property="createdTimeFrom">
DEPOSIT_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
......@@ -486,7 +490,7 @@
<isEmpty prepend=" AND " property="submitStatus">
SUBMIT_STATUS = 1
</isEmpty>
GROUP BY ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, WH_CODE
GROUP BY ACCOUNT_CODE, DEP_CODE, COMPANY_CODE, WH_CODE,PRDT_CODE,PRDT_NAME,PRDT_SPEC,INVENT_TYPE_DETAIL
</select>
</sqlMap>
......@@ -250,6 +250,8 @@
a.INVENT_RECORD_ID as "inventRecordId",
a.INVENT_TYPE as "inventType",
a.INVENT_CODE AS "inventCode",
a.SPEC as "spec",
a.INVENT_TYPE_DETAIL as "inventTypeDetail",
COALESCE(SUM(a.QUANTITY), 0) AS "quantity",
COALESCE(SUM(a.WEIGHT), 0) AS "weight",
COALESCE(SUM(a.AMOUNT)) as "amount"
......@@ -264,8 +266,8 @@
<isNotEmpty prepend=" AND " property="whCode">
b.WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty property=" AND " prepend="accountPeriod">
LEFT(b.RECEIPT_DATE,6) = #accountPeriod#
<isNotEmpty prepend=" AND " property="createdTimeFrom">
b.RECEIPT_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventTypeDetail">
a.INVENT_TYPE_DETAIL = #inventTypeDetail#
......@@ -276,7 +278,7 @@
<isEmpty prepend=" AND " property="submitStatus">
b.STATUS = 1
</isEmpty>
GROUP BY a.ACCOUNT_CODE, a.DEP_CODE, a.COMPANY_CODE, b.WH_CODE, a.INVENT_RECORD_ID, a.INVENT_TYPE, a.INVENT_CODE
GROUP BY a.ACCOUNT_CODE, a.DEP_CODE, a.COMPANY_CODE, b.WH_CODE, a.INVENT_RECORD_ID, a.INVENT_TYPE, a.INVENT_CODE, a.SPEC,a.INVENT_TYPE_DETAIL
</select>
</sqlMap>
......@@ -377,7 +377,7 @@
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.COMPANY_NAME as "companyName", <!-- 公司名称 -->
B.FIELD_OTHER_ENTER_DATE as "otherEnterDate", <!-- 其他入库日期 -->
B.OTHER_ENTER_DATE as "otherEnterDate", <!-- 其他入库日期 -->
A.OTHER_ENTER_NO as "otherEnterNo", <!-- 其他入库单号 -->
A.WH_CODE as "whCode", <!-- 仓库编码 -->
A.WH_NAME as "whName", <!-- 仓库名称 -->
......@@ -424,8 +424,8 @@
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterDate">
LEFT(B.OTHER_ENTER_DATE,6) = #otherEnterDate#
<isNotEmpty prepend=" AND " property="createdTimeFrom">
B.OTHER_ENTER_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherEnterNo">
A.OTHER_ENTER_NO = #otherEnterNo#
......
......@@ -419,8 +419,8 @@
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutDate">
B.OTHER_OUT_DATE = #otherOutDate#
<isNotEmpty prepend=" AND " property="createdTimeFrom">
B.OTHER_OUT_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutNo">
B.OTHER_OUT_NO = #otherOutNo#
......
......@@ -304,8 +304,8 @@
<isNotEmpty prepend=" AND " property="whCode">
A.WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="receiptDate">
B.RECEIPT_DATE = #receiptDate#
<isNotEmpty prepend=" AND " property="createdTimeFrom">
B.RECEIPT_DATE BETWEEN #createdTimeFrom# AND #createdTimeTo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="applyCode">
B.APPLY_CODE = #applyCode#
......
......@@ -142,6 +142,32 @@
<include refid="condition"/>
</select>
<select id="querySum" resultClass="com.baosight.hggp.hg.kc.domain.HGKC010">
SELECT
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
DELETE_FLAG as "deleteFlag", <!-- 0-未删除,1-已删除 -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
COMPANY_NAME as "companyName", <!-- 公司名称 -->
WH_CODE as "whCode", <!-- 仓库编码 -->
WH_NAME as "whName", <!-- 仓库名称 -->
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
SPEC_ID as "specId", <!-- 规格ID -->
SPEC as "spec", <!-- 规格 -->
MATERIAL as "material", <!-- 材质 -->
UNIT as "unit", <!-- 单位 -->
INV_QTY as "invQty", <!-- 库存数量 -->
INV_UNIT_WEIGHT as "invUnitWeight", <!-- 库存单重 -->
INV_WEIGHT as "invWeight", <!-- 库存重量 -->
INVENT_TYPE_DETAIL as "inventTypeDetail"
FROM ${hggpSchema}.HGKC010
WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGKC010 (
ACCOUNT_CODE, <!-- 企业编码 -->
......
......@@ -13,6 +13,7 @@
<sqlMap resource="com/baosight/hggp/hg/xs/sql/HGXSDataAuth.xml"/>
<!--成本-->
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB001.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB002.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB003.xml"/>
<sqlMap resource="com/baosight/hggp/hg/cb/sql/HGCB004.xml"/>
......
......@@ -57,7 +57,7 @@ $(function (){
grid.dataSource.bind("change", function(e) {
// 判断父级节点是否发生变化
if (e.field === "price") {
let items = e.items[0];
let items = e.items;
for (let i = 0; i < items.length; i++) {
let amount = items[i].price * items[i].quantity;
resultGrid.setCellValue(e.items[i],"amount",amount);
......@@ -154,26 +154,28 @@ function showDetail(id) {
JSColorbox.open({
href: "HGCB002A?methodName=initLoad",
title: "<div style='text-align: center;'>选择公司</div>",
width: "60%",
height: "60%",
width: "30%",
height: "45%",
callbackName: windowCallback
});
}
function windowCallback(companyCode) {
synchData(companyCode);
function windowCallback(item) {
synchData(item);
// 关闭弹窗
JSColorbox.close();
// 刷新列表
query();
}
/**
* 确认
*/
let synchData = function (companyCode) {
let synchData = function (item) {
let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode);
info.set("inqu_status-0-companyCode", item.companyCode);
info.set("inqu_status-0-accountYear", item.accountYear);
info.set("inqu_status-0-accountPeriod", item.accountPeriod);
info.set("inqu_status-0-createdTimeFrom", item.accountPeriodDateStart);
info.set("inqu_status-0-createdTimeTo", item.accountPeriodDateEnd);
EiCommunicator.send("HGCB002", "select", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
......@@ -182,6 +184,8 @@ let synchData = function (companyCode) {
} else {
NotificationUtil(ei);
}
// 刷新列表
query();
} else {
NotificationUtil(ei, "error");
}
......
......@@ -24,7 +24,7 @@
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="company_code_block_id" textField="companyName" valueField="companyCode"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="业务类型" colWidth="3" filter="contains">
<EF:EFSelect blockId="inqu_status" row="0" ename="bizType" cname="业务类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgcb.bizType"/>
</EF:EFSelect>
......@@ -45,13 +45,13 @@
<EF:EFOptions blockId="company_code_block_id" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="accountPeriod" cname="会计期" enable="false" width="120" align="center"
editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']"/>
editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']" required="true"/>
<EF:EFComboColumn ename="bizType" cname="业务类型" width="120" enable="true" align="center" required="true">
<EF:EFCodeOption codeName="hggp.hgcb.bizType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="receiptDate" cname="单据日期" width="120" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" readonly="false" required="true"/>
<EF:EFColumn ename="receiptCode" cname="单据号" enable="false" width="120" align="center" required="true"/>
<EF:EFColumn ename="receiptCode" cname="单据号" enable="false" width="140" align="center" required="true"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......@@ -76,7 +76,7 @@
displayType="0.000" sort="true" align="right" maxLength="17" required="true" defaultValue="0"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="computeType" cname="是否暂估" width="100" enable="true" align="center" required="true">
<EF:EFComboColumn ename="isEstimate" cname="是否暂估" width="100" enable="true" align="center" required="true">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="120" enable="true" format="{0:N3}" editType="text"
......
$(function() {
let companyCodeBox = __eiInfo.getBlock("roleCompany").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#CONFIRM").on("click", function () {
confirm();
});
});
/**
* 确认
*/
let confirm = function () {
let companyCode = $("#inqu_status-0-companyCode").val();
if (companyCode.length < 1) {
message("请选择公司");
return;
}
parent.JSColorbox.setValueCallback(companyCode);
let hgcw001 = queryHgcw001(companyCode);
let companyName;
let accountPeriod = hgcw001[0].accountPeriod;
for (let i = 0; i <companyCodeBox.length ; i++) {
if (companyCodeBox[i].companyCode == hgcw001[0].companyCode) {
companyName = companyCodeBox[i].companyName;
break;
}
}
JSUtils.confirm("确定要对[" + companyName + " 会计期"+accountPeriod+"]做\"数据同步\"操作? ", {
ok: function () {
parent.JSColorbox.setValueCallback(hgcw001[0]);
}
});
});
});
let queryHgcw001 = function (companyCode){
var hgcw001_block_id =[];
let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode);
EiCommunicator.send("HGCB002", "selectAll", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
hgcw001_block_id = ei.getBlock("hgcw001_block_id").getMappedRows();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
},{async: false});
return hgcw001_block_id;
}
\ No newline at end of file
$(function (){
var companyCodeBox = __eiInfo.getBlock("company_code_block_id").getMappedRows();
var whCodeBox = __eiInfo.getBlock("wh_code_block_id").getMappedRows();
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", function (e) {
query();
})
$("#SYNC").on("click", function () {
showDetail();
});
IPLATUI.EFGrid= {
"result": {
pageable: {
......@@ -37,7 +44,7 @@ $(function (){
exportGrid: {
exportFileName: function (gridInstance) {
// 导出的文件名包含时间戳 yyyy-MM-dd HH:mm:ss
return "原材料库成本核算_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
return "原材料库成本核算_" + kendo.toString(new Date(), IPLAT.FORMAT.DATE_14_PR);
},
exportFileType: "xls", // 默认值是xls,可选值为pdf[规划中]
exportBlockId: "result", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
......@@ -146,27 +153,29 @@ function showDetail(id) {
JSColorbox.open({
href: "HGCB002A?methodName=initLoad",
title: "<div style='text-align: center;'>选择公司</div>",
width: "60%",
height: "60%",
width: "30%",
height: "45%",
callbackName: windowCallback
});
}
function windowCallback(companyCode) {
synchData(companyCode);
function windowCallback(item) {
synchData(item);
// 关闭弹窗
JSColorbox.close();
// 刷新列表
query();
}
/**
* 确认
*/
let synchData = function (companyCode) {
let synchData = function (item) {
let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode);
EiCommunicator.send("HGCB004", "synchData", info, {
info.set("inqu_status-0-companyCode", item.companyCode);
info.set("inqu_status-0-accountYear", item.accountYear);
info.set("inqu_status-0-accountPeriod", item.accountPeriod);
info.set("inqu_status-0-createdTimeFrom", item.accountPeriodDateStart);
info.set("inqu_status-0-createdTimeTo", item.accountPeriodDateEnd);
EiCommunicator.send("HGCB003", "select", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
......@@ -174,6 +183,8 @@ let synchData = function (companyCode) {
} else {
NotificationUtil(ei);
}
// 刷新列表
query();
} else {
NotificationUtil(ei, "error");
}
......
......@@ -22,11 +22,11 @@
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="company_code_block_id" textField="companyName" valueField="companyCode"/>
</EF:EFSelect>
<EF:EFSelect blockId="inqu_status" row="0" ename="status" cname="业务类型" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.status"/>
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="accountPeriod" cname="会计期" colWidth="3"
format="yyyy-MM" depth="year" start="year" required="true"/>
......@@ -37,7 +37,7 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>--%>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
......@@ -76,8 +76,8 @@
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
data-regex="/^-?[0-9]{1,15}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置15位整数和3位小数!"/>
<EF:EFComboColumn ename="computeType" cname="是否暂估" width="80" enable="true" align="center" required="true">
<EF:EFCodeOption codeName="hggp.hgsj.computeType"/>
<EF:EFComboColumn ename="isEstimate" cname="是否暂估" width="80" enable="true" align="center" hidden="true" required="true">
<EF:EFCodeOption codeName="hggp.common.yesNo"/>
</EF:EFComboColumn>
<EF:EFColumn ename="price" cname="单价" width="100" enable="true" format="{0:N3}" editType="text"
displayType="0.000" sort="true" align="right" maxLength="17" required="false" defaultValue="0"
......
$(function (){
$(".row").children().attr("class", "col-md-3");
$("#QUERY").on("click", function (e) {
query();
})
IPLATUI.EFGrid= {
"result": {
pageable: {
......@@ -97,18 +101,22 @@ function showDetail() {
});
}
function windowCallback(companyCode) {
synchData(companyCode);
function windowCallback(item) {
synchData(item);
JSColorbox.close();
}
/**
* 确认
*/
let synchData = function (companyCode) {
let synchData = function (item) {
let info = new EiInfo();
info.set("inqu_status-0-companyCode", companyCode);
EiCommunicator.send("HGCB004", "synchData", info, {
info.set("inqu_status-0-companyCode", item.companyCode);
info.set("inqu_status-0-accountYear", item.accountYear);
info.set("inqu_status-0-accountPeriod", item.accountPeriod);
info.set("inqu_status-0-createdTimeFrom", item.accountPeriodDateStart);
info.set("inqu_status-0-createdTimeTo", item.accountPeriodDateEnd);
EiCommunicator.send("HGCB004", "select", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
......
......@@ -22,14 +22,15 @@
<div class="row">
<EF:EFSelect blockId="inqu_status" row="0" ename="companyCode" cname="公司名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="company_code_block_id" textField="companyName" valueField="companyCode"/>
</EF:EFSelect>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="accountPeriod" cname="会计期" colWidth="3"
format="yyyy-MM" depth="year" start="year" required="true"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<%--<EF:EFSelect blockId="inqu_status" row="0" ename="whCode" cname="仓库名称" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="wh_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
</EF:EFSelect>--%>
<EF:EFInput blockId="inqu_status" row="0" ename="whName" cname="仓库名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput blockId="inqu_status" row="0" ename="inventName" cname="存货名称" placeholder="模糊查询" colWidth="3"/>
</div>
</EF:EFRegion>
......@@ -38,30 +39,32 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFColumn ename="accountCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<%--<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>--%>
<EF:EFComboColumn ename="companyCode" cname="公司名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" width="200" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="companyBox_block_id" textField="textField" valueField="valueField"/>
<EF:EFOptions blockId="company_code_block_id" textField="companyName" valueField="companyCode"/>
</EF:EFComboColumn>
<EF:EFColumn ename="accountPeriod" cname="会计期" enable="false" width="120" align="center"
editType="date" dateFormat="yyyy-MM" parseFormats="['yyyyMM']"/>
<EF:EFComboColumn ename="whCode" cname="仓库名称"
<%--<EF:EFComboColumn ename="whCode" cname="仓库名称"
columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField"
maxLength="16" readonly="false" width="140" required="true"
align="center" filter="contains" sort="true">
<EF:EFOptions blockId="wh_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFComboColumn>
</EF:EFComboColumn>--%>
<EF:EFColumn ename="whName" cname="仓库名称" width="140" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="inventCode" cname="物料编码" width="120" enable="true" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="inventName" cname="物料名称" width="120" enable="true" readonly="true" align="center" required="true"/>
<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
<EF:EFColumn ename="spec" cname="规格" width="120" enable="true" readonly="true" align="center" required="true"/>
<%--<EF:EFComboColumn ename="spec" cname="规格" enable="true" width="120" align="center" required="true"
blockName="spec_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
</EF:EFComboColumn>--%>
<EF:EFColumn ename="inventRecordId" cname="规格ID" width="80" enable="true" readonly="false" type="hidden" align="center"/>
<EF:EFColumn ename="initQuantity" cname="期初数量" width="100" enable="true" format="{0:N0}" editType="text"
displayType="0" sort="true" align="right" maxLength="15" required="false" defaultValue="0"
......
......@@ -21,11 +21,11 @@ $(function () {
if(item.inventCode){
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
template = inventRecordBoxBlocks[i]['valueField'];
return inventRecordBoxBlocks[i]['valueField'];
}
}
}
return template;
return item.inventCode;
},
editor: function (container, options) {
var input = $('<input />');
......@@ -51,11 +51,11 @@ $(function () {
if(item.partSpec){
for(let i=0;i<specBoxBlocks.length;i++){
if(item.partSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
return specBoxBlocks[i]['valueField'];
}
}
}
return template;
return item.partSpec;
},
editor: function (container, options) {
var input = $('<input />');
......
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