Compare commits
10 Commits
af5e267e07
...
155c549ad0
Author | SHA1 | Date |
---|---|---|
|
155c549ad0 | |
|
e8f76b652f | |
|
2a6219d219 | |
|
87c25fbf45 | |
|
691bbb8815 | |
|
c094e6bb4b | |
|
6adb7c637e | |
|
77b29e0664 | |
|
be1e1713c9 | |
|
3323304d95 |
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,839 @@
|
||||||
|
package nc.bs.gl.glvoucher.processor.fip;
|
||||||
|
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.dao.DAOException;
|
||||||
|
import nc.bs.framework.common.InvocationInfoProxy;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.bs.gl.dao.GLBaseDAO;
|
||||||
|
import nc.bs.gl.voucher.service.TempTableUtils;
|
||||||
|
import nc.gl.utils.GLNumUtils;
|
||||||
|
import nc.impl.gl.pub.TempTableCreater;
|
||||||
|
import nc.itf.gl.pub.ICashFlowCase;
|
||||||
|
import nc.jdbc.framework.processor.BeanListProcessor;
|
||||||
|
import nc.vo.fi.pub.SqlUtils;
|
||||||
|
import nc.vo.fip.external.FipBillSumRSVO;
|
||||||
|
import nc.vo.fip.service.FipRelationInfoVO;
|
||||||
|
import nc.vo.fipub.freevalue.GlAssVO;
|
||||||
|
import nc.vo.fipub.freevalue.Module;
|
||||||
|
import nc.vo.fipub.utils.StrTools;
|
||||||
|
import nc.vo.gateway60.itfs.AssByPkThreadCache;
|
||||||
|
import nc.vo.gl.cashflowcase.CashflowcaseVO;
|
||||||
|
import nc.vo.gl.glvoucher.AggNVoucherVO;
|
||||||
|
import nc.vo.gl.glvoucher.NDetailVO;
|
||||||
|
import nc.vo.gl.glvoucher.NVoucherVO;
|
||||||
|
import nc.vo.glcom.ass.AssVO;
|
||||||
|
import nc.vo.glcom.constant.GLVoucherKindConst;
|
||||||
|
import nc.vo.ml.NCLangRes4VoTransl;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.lang.UFDouble;
|
||||||
|
import nc.vo.pubapp.pattern.pub.MapList;
|
||||||
|
import nc.vo.voucher.fip.SchemeConst;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Types;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class NVoucherSumInDBProcessor extends NVoucherSumProcessor {
|
||||||
|
public NVoucherSumInDBProcessor(String pk_sumrule) {
|
||||||
|
super(pk_sumrule);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, NVoucherVO> mergedHead = new HashMap<>();
|
||||||
|
|
||||||
|
private MapList<String, NDetailVO> detailContainer = new MapList<>();
|
||||||
|
|
||||||
|
private MapList<String, String> groupedRelationIdMap = new MapList<>();
|
||||||
|
|
||||||
|
private MapList<String, FipRelationInfoVO> groupedRelationVOMap = new MapList<>();
|
||||||
|
|
||||||
|
private Map<String, AssVO[]> assVOMap = new HashMap<>();
|
||||||
|
|
||||||
|
private String groupTempTableName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FipBillSumRSVO> processSumData(List<FipBillSumRSVO> sumRSVOs) throws BusinessException {
|
||||||
|
fillGroupedRelationMap(sumRSVOs);
|
||||||
|
createGroupTempTable();
|
||||||
|
prepareGroupTempTableData();
|
||||||
|
generateMergedHead();
|
||||||
|
loadSchemeInfo();
|
||||||
|
sumDetail();
|
||||||
|
List<AggNVoucherVO> aggVouchers = constructVouchers();
|
||||||
|
|
||||||
|
List<FipBillSumRSVO> results = new ArrayList<>();
|
||||||
|
for(AggNVoucherVO aggVoucher : aggVouchers) {
|
||||||
|
NVoucherSupply4FipProcessor supplyProcessor = new NVoucherSupply4FipProcessor(aggVoucher);
|
||||||
|
supplyProcessor.process();
|
||||||
|
FipBillSumRSVO sumRSVO = new FipBillSumRSVO();
|
||||||
|
sumRSVO.setBillVO(aggVoucher);
|
||||||
|
NVoucherVO voucher = aggVoucher.getParentVO();
|
||||||
|
String groupId = (String)voucher.getAttributeValue("groupid");
|
||||||
|
sumRSVO.setRelationvos(groupedRelationVOMap.get(groupId).toArray(new FipRelationInfoVO[0]));
|
||||||
|
sumRSVO.setMessageinfo(generateMsgInfo(aggVoucher));
|
||||||
|
results.add(sumRSVO);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillGroupedRelationMap(Collection<FipBillSumRSVO> sumRsVOs) {
|
||||||
|
int groupIndex = 0; //分组号
|
||||||
|
for(FipBillSumRSVO sumRSVO : sumRsVOs) {
|
||||||
|
FipRelationInfoVO[] relationInfos = sumRSVO.getRelationvos();
|
||||||
|
if(relationInfos == null || relationInfos.length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String groupNO = generateGroupNO(++groupIndex);
|
||||||
|
for(FipRelationInfoVO relationInfo : relationInfos) {
|
||||||
|
groupedRelationIdMap.put(groupNO, relationInfo.getRelationID());
|
||||||
|
groupedRelationVOMap.put(groupNO, relationInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateGroupNO(int groupIndex) {
|
||||||
|
int maxLength = 8;
|
||||||
|
String groupNO = StrTools.supplementStr(groupIndex, maxLength, '0', true);
|
||||||
|
return groupNO;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createGroupTempTable() throws BusinessException {
|
||||||
|
String[] columns = new String[]{"pk_voucher", "pk_detail", "groupid"};
|
||||||
|
int[] coltype = new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR};
|
||||||
|
try {
|
||||||
|
groupTempTableName = TempTableCreater.createTempTable("tmp_gl_fipsum", columns, coltype);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new BusinessException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 准备分组临时表数据
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
private void prepareGroupTempTableData() throws BusinessException {
|
||||||
|
String[] columns = new String[] {"pk_voucher", "groupid"};
|
||||||
|
List<Object[]> datas = new ArrayList<>();
|
||||||
|
for(String groupId : groupedRelationIdMap.keySet()) {
|
||||||
|
List<String> pk_vouchers = groupedRelationIdMap.get(groupId);
|
||||||
|
for(String pk_voucher : pk_vouchers) {
|
||||||
|
Object[] data = new Object[] {pk_voucher, groupId};
|
||||||
|
datas.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new GLBaseDAO().excuteInsertBatch(groupTempTableName, columns, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成主表合并后数据
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
|
||||||
|
private void generateMergedHead() throws BusinessException {
|
||||||
|
String sql = generateMergeHeadSql();
|
||||||
|
List<NVoucherVO> vouchers = new GLBaseDAO().excuteQuery(sql, NVoucherVO.class);
|
||||||
|
if(vouchers==null || vouchers.size()==0) {
|
||||||
|
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("glnvoucher_0",
|
||||||
|
"0glnvoucher-0114")/* "查询不到临时凭证,可能是冻结状态" */);
|
||||||
|
}
|
||||||
|
//针对合并凭证,需要用的制单人转换模板制单人设置公式,其余单据不设置,用min取设置公式的制单人 sunfj
|
||||||
|
if(StrTools.isEmptyStr((vouchers.get(0)).getPk_prepared())) {
|
||||||
|
String sql2 = sql.replace("max(pk_prepared) as pk_prepared","min(pk_prepared) as pk_prepared " );
|
||||||
|
List<NVoucherVO> vouchers2 = new GLBaseDAO().excuteQuery(sql2, NVoucherVO.class);
|
||||||
|
if(vouchers2 != null && !vouchers2.isEmpty()) {
|
||||||
|
vouchers = vouchers2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(NVoucherVO voucher : vouchers) {
|
||||||
|
//补充制单人
|
||||||
|
if(StrTools.isEmptyStr(voucher.getPk_prepared())) {
|
||||||
|
voucher.setPk_prepared(InvocationInfoProxy.getInstance().getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(voucher.getVoucherkind() == null) {
|
||||||
|
voucher.setVoucherkind(GLVoucherKindConst.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(voucher.getPk_exratetype2() == null) {
|
||||||
|
// RateTypeVO rateTypeVO = new RateTypeThreadCache().getRateTypeByPk_Accountingbook(voucher.getPk_accountingbook());
|
||||||
|
// String pk_exratetype2 = RateUtil.getInstance(voucher.getPk_accountingbook()).getDefaultPk_exratetype();//TODO 添加缓存缓存
|
||||||
|
// voucher.setPk_exratetype2(rateTypeVO.getPk_ratetype());
|
||||||
|
}
|
||||||
|
|
||||||
|
//FIXME 重置adjustperiod,测试提问题:前台生成列表页面 期间都是空的受不了了
|
||||||
|
if(voucher.getAdjustperiod() == null && voucher.getPeriod()!=null) {
|
||||||
|
voucher.setAdjustperiod(voucher.getPeriod());
|
||||||
|
}
|
||||||
|
|
||||||
|
String groupid = (String)voucher.getAttributeValue("groupid");
|
||||||
|
if(mergedHead.get(groupid) != null) {
|
||||||
|
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("glnvoucher_0","0glnvoucher-0014")/*@res "数据中因为有些字段不同,有不能合并成一张凭证的情况,请检查下面的字段是否相同:集团,组织,财务核算账簿,凭证类别,交易类型,自定义项。"*/);
|
||||||
|
}
|
||||||
|
mergedHead.put(groupid, voucher);
|
||||||
|
}
|
||||||
|
|
||||||
|
combinSystem();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadSchemeInfo() throws BusinessException {
|
||||||
|
NVoucherVO voucher = mergedHead.values().toArray(new NVoucherVO[0])[0];
|
||||||
|
String pk_accountingbook = voucher.getPk_accountingbook();
|
||||||
|
String versionDate = voucher.getPrepareddate().toStdString();
|
||||||
|
loadSchemeInfo(pk_accountingbook, versionDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sumDetail() throws BusinessException {
|
||||||
|
String[] sumSqls = getSumSql();
|
||||||
|
String[] normalSqls = getNormalSql();
|
||||||
|
|
||||||
|
String[] sumConditions = getSumConditions();
|
||||||
|
String unSumCondition = getUnSumCondition();
|
||||||
|
|
||||||
|
if(sumConditions != null && sumConditions.length > 0) {
|
||||||
|
for(String sumCondition : sumConditions) {
|
||||||
|
String sql = sumSqls[0] + sumSqls[1] + sumSqls[2] + sumCondition + sumSqls[3] + sumSqls[4];
|
||||||
|
MapList<String, NDetailVO> results = queryDetailsBySql(sql);
|
||||||
|
//cat 现金流量
|
||||||
|
catCashFlowCaseForSum(results, sumSqls[3].substring(6), sumSqls[1], sumCondition);
|
||||||
|
mixDetail(detailContainer, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCombinSameAccount()) {
|
||||||
|
if(unSumCondition != null && unSumCondition.length() > 0) {
|
||||||
|
String sql = normalSqls[0] + normalSqls[1] + normalSqls[2] + unSumCondition + normalSqls[3] + normalSqls[4];
|
||||||
|
MapList<String, NDetailVO> results = queryDetailsBySql(sql);
|
||||||
|
//cat 现金流量
|
||||||
|
catCashFlowCase(results);
|
||||||
|
mixDetail(detailContainer, results);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
String sql = normalSqls[0] + normalSqls[1] + normalSqls[2] + unSumCondition + normalSqls[3] + normalSqls[4];
|
||||||
|
MapList<String, NDetailVO> results = queryDetailsBySql(sql);
|
||||||
|
//cat 现金流量
|
||||||
|
catCashFlowCase(results);
|
||||||
|
mixDetail(detailContainer, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造凭证
|
||||||
|
* modify 2022-02-23 没有分录返回主表信息
|
||||||
|
* @return
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
private List<AggNVoucherVO> constructVouchers() throws BusinessException{
|
||||||
|
List<AggNVoucherVO> results= new ArrayList<>();
|
||||||
|
//加载辅助核算信息
|
||||||
|
loadAssInfo();
|
||||||
|
//TODO 加载科目信息
|
||||||
|
|
||||||
|
String[] groupIds = groupedRelationIdMap.keySet().toArray(new String[0]);
|
||||||
|
Arrays.sort(groupIds);//分组id排序
|
||||||
|
|
||||||
|
for(String groupid : groupIds) {
|
||||||
|
|
||||||
|
NVoucherVO voucher = mergedHead.get(groupid);
|
||||||
|
List<NDetailVO> details = detailContainer.get(groupid);
|
||||||
|
|
||||||
|
if(details == null) {
|
||||||
|
details = new ArrayList<>();
|
||||||
|
}
|
||||||
|
//补充ASSVO
|
||||||
|
for(NDetailVO detail : details) {
|
||||||
|
if(StrTools.isEmptyStr(detail.getAssid())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(detail.getAssvos() == null) {
|
||||||
|
AssVO[] assVOs = assVOMap.get(detail.getAssid());
|
||||||
|
detail.setAssvos(assVOs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AggNVoucherVO aggVoucher = combinAggVoucher(voucher, details);
|
||||||
|
results.add(aggVoucher);
|
||||||
|
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成合并表头的sql
|
||||||
|
* TODO 交易类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String generateMergeHeadSql() {
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("select b.groupid as groupid,pk_group, pk_org,pk_accountingbook,pk_vouchertype, pk_tradetype, 'C0' as pk_billtype, ")
|
||||||
|
.append("max(year) as year, max(period) as period, 0 as no, max(prepareddate) as prepareddate, null as pk_system,")
|
||||||
|
.append(" null as tallydate, sum(attachment) as attachment, max(pk_prepared) as pk_prepared, null as checker, null as casher, ")
|
||||||
|
.append(" null as manager, min(signflag) as signflag, min(modifyflag) as modifyflag, 'N' as discardflag, max(addclass) as addclass,")
|
||||||
|
.append(" max(deleteclass) as deleteclass, min(DETAILMODFLAG) as detailModflag, ")
|
||||||
|
.append(" null as pk_billtype, ");
|
||||||
|
for(int i = 1; i<= 30; i++) {
|
||||||
|
sql.append(" vdef").append(i).append(",");
|
||||||
|
}
|
||||||
|
sql.append(" null as pk_voucher, max(pk_exratetype2) as pk_exratetype2 ");
|
||||||
|
|
||||||
|
sql.append("from gl_rtvoucher a inner join ").append(groupTempTableName).append(" b on a.pk_voucher = b.pk_voucher ");
|
||||||
|
sql.append("group by groupid,pk_group,pk_org,pk_accountingbook,pk_vouchertype,pk_tradetype,");
|
||||||
|
for(int i = 1; i<= 30; i++) {
|
||||||
|
sql.append(" vdef").append(i).append(",");
|
||||||
|
}
|
||||||
|
sql.deleteCharAt(sql.length() - 1);
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并制单系统
|
||||||
|
* @throws DAOException
|
||||||
|
*/
|
||||||
|
private void combinSystem() throws DAOException {
|
||||||
|
Map<String, String> combinSystemMap = queryCombinSystem();
|
||||||
|
for(String groupid : mergedHead.keySet()) {
|
||||||
|
NVoucherVO voucher = mergedHead.get(groupid);
|
||||||
|
voucher.setPk_system(combinSystemMap.get(groupid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询制单系统
|
||||||
|
* @return
|
||||||
|
* @throws DAOException
|
||||||
|
*/
|
||||||
|
private Map<String, String> queryCombinSystem() throws DAOException{
|
||||||
|
String sql = "select distinct groupid,pk_system from gl_rtvoucher a inner join "
|
||||||
|
+ groupTempTableName + " b on a.pk_voucher = b.pk_voucher where isnull(groupid, '~') <> '~'";
|
||||||
|
List<Map<String, Object>> groupSystemList = new GLBaseDAO().excuteQuery(sql);
|
||||||
|
|
||||||
|
MapList<String, String> groupedSystem = new MapList<>();
|
||||||
|
for(Map<String, Object> groupSystem : groupSystemList) {
|
||||||
|
String pk_system = (String)groupSystem.get("pk_system");
|
||||||
|
if(pk_system != null) {
|
||||||
|
groupedSystem.put((String)groupSystem.get("groupid"), pk_system.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
for(String groupid : groupedSystem.keySet()) {
|
||||||
|
List<String> systems = groupedSystem.get(groupid);
|
||||||
|
if(systems != null && systems.size() > 0) {
|
||||||
|
//去重
|
||||||
|
Set<String> systemSet = new LinkedHashSet<String>();
|
||||||
|
systemSet.addAll(systems);
|
||||||
|
|
||||||
|
result.put(groupid, StrTools.join(systemSet.iterator(), ","));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 select
|
||||||
|
* 1 from
|
||||||
|
* 2 where
|
||||||
|
* 3 group
|
||||||
|
* 4 order
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String[] getSumSql() {
|
||||||
|
String[] results = new String[5];
|
||||||
|
results[0] = generateSumSelectSql();
|
||||||
|
results[1] = " from gl_rtdetail a inner join " + groupTempTableName + " b on a.pk_voucher = b.pk_voucher ";
|
||||||
|
results[2] = " where a.dr = 0 ";
|
||||||
|
results[3] = generateSumGroupSql();
|
||||||
|
results[4] = " order by groupid ";
|
||||||
|
|
||||||
|
if(isCombinExplan()) {
|
||||||
|
results[0] = results[0].replaceFirst("a.explanation", "max(a.explanation)");
|
||||||
|
results[3] = results[3].replaceFirst(",a.explanation,", ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCombinPrice()) {
|
||||||
|
results[0] = results[0].replaceFirst("a.price", "sum(a.price)");
|
||||||
|
results[3] = results[3].replaceFirst(", a.price,", ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isCombinExrateInfo()) {
|
||||||
|
results[0] = results[0].replaceFirst("a." + NDetailVO.PK_EXRATETYPE2, "max(a." + NDetailVO.PK_EXRATETYPE2 + ")");
|
||||||
|
results[0] = results[0].replaceFirst("a." + NDetailVO.EXRATEDATE2, "max(a." + NDetailVO.EXRATEDATE2 + ")");
|
||||||
|
results[3] = results[3].replaceFirst(", " + NDetailVO.PK_EXRATETYPE2 + ",", ",");
|
||||||
|
results[3] = results[3].replaceFirst(", " + NDetailVO.EXRATEDATE2 + ",", ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 select
|
||||||
|
* 1 from
|
||||||
|
* 2 where
|
||||||
|
* 3 group
|
||||||
|
* 4 order
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String[] getNormalSql() {
|
||||||
|
String[] results = new String[5];
|
||||||
|
results[0] = generateNormalSelectSql();
|
||||||
|
results[1] = " from gl_rtdetail a inner join " + groupTempTableName + " b on a.pk_voucher = b.pk_voucher ";
|
||||||
|
results[2] = " where a.dr = 0 ";
|
||||||
|
results[3] = "";
|
||||||
|
results[4] = " order by groupid ";
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String[]> generateDetailFields() {
|
||||||
|
/**
|
||||||
|
* 第一个字段 为 a
|
||||||
|
* 第二个字段
|
||||||
|
* "null" => null as a
|
||||||
|
* null => a as a
|
||||||
|
* min => min(a) as a
|
||||||
|
* max => max(a) as a
|
||||||
|
* sum => sum(a) as a
|
||||||
|
*/
|
||||||
|
List<String[]> fields = new ArrayList<>();
|
||||||
|
fields.add(new String[] {NDetailVO.PK_DETAIL, "min"});
|
||||||
|
fields.add(new String[] {NDetailVO.NOV, "null"});
|
||||||
|
fields.add(new String[] {NDetailVO.OPPOSITESUBJ, "null"});
|
||||||
|
fields.add(new String[] {NDetailVO.BANKACCOUNT, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_VOUCHER, "null"});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_ORG, "min"});
|
||||||
|
fields.add(new String[] {NDetailVO.MODIFYFLAG, "min"});
|
||||||
|
fields.add(new String[] {NDetailVO.RECIEPTCLASS, "min"});
|
||||||
|
fields.add(new String[] {NDetailVO.DEBITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.DEBITQUANTITY, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.LOCALDEBITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.GROUPDEBITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.GLOBALDEBITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.CREDITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.CREDITQUANTITY, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.LOCALCREDITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.GROUPCREDITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.GLOBALCREDITAMOUNT, "sum"});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_ACCOUNTINGBOOK, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_UNIT, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_UNIT_V, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_VOUCHERTYPEV, null});
|
||||||
|
fields.add(new String[] {NDetailVO.YEARV, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PERIODV, null});
|
||||||
|
fields.add(new String[] {NDetailVO.EXPLANATION, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_ACCASOA, null});
|
||||||
|
fields.add(new String[] {NDetailVO.ASSID, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_CURRTYPE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PRICE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.EXCRATE2, null});
|
||||||
|
fields.add(new String[] {NDetailVO.EXCRATE3, null});
|
||||||
|
fields.add(new String[] {NDetailVO.EXCRATE4, null});
|
||||||
|
fields.add(new String[] {NDetailVO.CHECKSTYLE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.CHECKNO, null});
|
||||||
|
fields.add(new String[] {NDetailVO.CHECKDATE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.BILLTYPE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.BUSIRECONNO, null});
|
||||||
|
fields.add(new String[] {NDetailVO.NETBANKFLAG, null});
|
||||||
|
fields.add(new String[] {NDetailVO.VERIFYDATE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.VERIFYNO, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_LIABILITYCENTER, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_LIABILITYCENTER_V, null});
|
||||||
|
fields.add(new String[] {NDetailVO.PK_EXRATETYPE2, null});
|
||||||
|
fields.add(new String[] {NDetailVO.EXRATEDATE2, null});
|
||||||
|
fields.add(new String[] {NDetailVO.DUEDATE, null});
|
||||||
|
fields.add(new String[] {NDetailVO.ORDERSTR, "max"});
|
||||||
|
for(int i = 1; i <= 80 ;i ++) {
|
||||||
|
fields.add(new String[] {"vbdef" + i, null});
|
||||||
|
}
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateSumColumnStr(String tableAlias, String[] field) {
|
||||||
|
StringBuilder columnStr = new StringBuilder(" ");
|
||||||
|
String fieldName = field[0];
|
||||||
|
String oper = field[1];
|
||||||
|
if(oper == null) {
|
||||||
|
columnStr.append(tableAlias).append(".").append(fieldName);
|
||||||
|
}else if(oper.equals("null")) {
|
||||||
|
columnStr.append("null");
|
||||||
|
}else if(oper.equals("sum")) {
|
||||||
|
columnStr.append("sum(").append(tableAlias).append(".").append(fieldName).append(")");
|
||||||
|
}else if(oper.equals("min")) {
|
||||||
|
columnStr.append("min(").append(tableAlias).append(".").append(fieldName).append(")");
|
||||||
|
}else if(oper.equals("max")){
|
||||||
|
columnStr.append("max(").append(tableAlias).append(".").append(fieldName).append(")");
|
||||||
|
}
|
||||||
|
|
||||||
|
columnStr.append(" as ").append(fieldName);
|
||||||
|
return columnStr.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateSumSelectSql() {
|
||||||
|
StringBuilder selectSql = new StringBuilder("select ");
|
||||||
|
List<String[]> fields = generateDetailFields();
|
||||||
|
for(String[] field : fields) {
|
||||||
|
selectSql.append(generateSumColumnStr("a", field));
|
||||||
|
selectSql.append(", ");
|
||||||
|
}
|
||||||
|
selectSql.append("b.groupid as groupid ");
|
||||||
|
return selectSql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateSumGroupSql() {
|
||||||
|
StringBuilder groupSql = new StringBuilder();
|
||||||
|
groupSql.append(" group by b.groupid,a.pk_accountingbook,a.pk_unit,a.pk_unit_v,pk_vouchertypev,yearv,periodv,a.explanation,");
|
||||||
|
groupSql.append(" a.pk_accasoa, assid, pk_currtype, a.price, excrate2, excrate3,excrate4,bankaccount,checkstyle, checkno,");
|
||||||
|
groupSql.append(" checkdate, billtype, innerbusno, innerbusdate, busireconno,netbankflag, verifydate, verifyno, ");
|
||||||
|
groupSql.append(" pk_liabilitycenter, pk_liabilitycenter_v, duedate, ");
|
||||||
|
|
||||||
|
for(int i = 1; i <= 80; i++) {
|
||||||
|
groupSql.append("vbdef").append(i).append(",");
|
||||||
|
}
|
||||||
|
groupSql.append(" pk_exratetype2, exratedate2 ");
|
||||||
|
return groupSql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateNormalSelectSql() {
|
||||||
|
StringBuilder selectSql = new StringBuilder();
|
||||||
|
selectSql.append("select ");
|
||||||
|
List<String[]> fields = generateDetailFields();
|
||||||
|
for(String[] field : fields) {
|
||||||
|
selectSql.append(" a.").append(field[0]).append(" as ").append(field[0]);
|
||||||
|
selectSql.append(", ");
|
||||||
|
}
|
||||||
|
selectSql.append(" b.groupid as groupid ");
|
||||||
|
return selectSql.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造需要合并的查询条件
|
||||||
|
* @return
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
private String[] getSumConditions() throws BusinessException {
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
|
||||||
|
boolean isCombinAccount = isCombinSameAccount();
|
||||||
|
|
||||||
|
StringBuilder condition = new StringBuilder();
|
||||||
|
if(isCombinAccount) {//合并科目,排除例外科目
|
||||||
|
//科目条件
|
||||||
|
if(getExAccountPks() != null && getExAccountPks().length > 0) {
|
||||||
|
String inAccountSql = SqlUtils.getInStr("a.pk_accasoa", getExAccountPks(),Boolean.TRUE);
|
||||||
|
String notInAccountSql = inAccountSql.replaceFirst("in", "not in");
|
||||||
|
condition.append(" and ").append(notInAccountSql);
|
||||||
|
}
|
||||||
|
}else {//不合并科目,则只合并例外科目
|
||||||
|
if(getExAccountPks() == null || getExAccountPks().length == 0) {
|
||||||
|
return null;
|
||||||
|
}else {
|
||||||
|
String inAccountSql = SqlUtils.getInStr("a.pk_accasoa", getExAccountPks(),Boolean.TRUE);
|
||||||
|
condition.append(" and ").append(inAccountSql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//借贷条件
|
||||||
|
if(SchemeConst.COMBINTYPE_D.equals(getCominType())){
|
||||||
|
condition.append(" and ").append("(debitquantity<>0 or localdebitamount<>0 or groupdebitamount<>0 or globaldebitamount<>0) ");
|
||||||
|
conditions.add(condition.toString());
|
||||||
|
}else if(SchemeConst.COMBINTYPE_C.equals(getCominType())) {
|
||||||
|
condition.append(" and ").append("(creditquantity<>0 or localcreditamount<>0 or groupcreditamount<>0 or globalcreditamount<>0) ");
|
||||||
|
conditions.add(condition.toString());
|
||||||
|
}else {
|
||||||
|
if(isCombinDiffDirection()) {
|
||||||
|
conditions.add(condition.toString());
|
||||||
|
}else {
|
||||||
|
//借方条件
|
||||||
|
String conditionDebit = condition.toString() + " and (debitquantity<>0 or localdebitamount<>0 or groupdebitamount<>0 or globaldebitamount<>0) ";
|
||||||
|
conditions.add(conditionDebit);
|
||||||
|
//贷方条件
|
||||||
|
String conditionCredit = condition.toString() + " and (creditquantity<>0 or localcreditamount<>0 or groupcreditamount<>0 or globalcreditamount<>0) ";
|
||||||
|
conditions.add(conditionCredit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return conditions.toArray(new String[0]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造不需要合并的查询条件
|
||||||
|
* @return null 说明 不合并科目且没有例外科目,全部采用不合并逻辑处理
|
||||||
|
* @throws BusinessException
|
||||||
|
*/
|
||||||
|
private String getUnSumCondition() throws BusinessException {
|
||||||
|
StringBuilder condition = new StringBuilder();
|
||||||
|
|
||||||
|
if(isCombinSameAccount()) {
|
||||||
|
if(getExAccountPks() != null && getExAccountPks().length > 0) {
|
||||||
|
String inAccountSql = SqlUtils.getInStr("a.pk_accasoa", getExAccountPks(),Boolean.TRUE);
|
||||||
|
condition.append(inAccountSql);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(getExAccountPks() != null && getExAccountPks().length > 0) {
|
||||||
|
String inAccountSql = SqlUtils.getInStr("a.pk_accasoa", getExAccountPks(),Boolean.TRUE);
|
||||||
|
String notInAccountSql = inAccountSql.replaceFirst("in", "not in");
|
||||||
|
condition.append(notInAccountSql);
|
||||||
|
}else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SchemeConst.COMBINTYPE_D.equals(getCominType())) {
|
||||||
|
if(condition.length() > 0){
|
||||||
|
condition.append(" or ");
|
||||||
|
}
|
||||||
|
condition.append("(creditquantity<>0 or localcreditamount<>0 or groupcreditamount<>0 or globalcreditamount<>0) ");
|
||||||
|
}else if(SchemeConst.COMBINTYPE_C.equals(getCominType())) {
|
||||||
|
if(condition.length() > 0){
|
||||||
|
condition.append(" or ");
|
||||||
|
}
|
||||||
|
condition.append(" (debitquantity<>0 or localdebitamount<>0 or groupdebitamount<>0 or globaldebitamount<>0) ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(condition.length() > 0) {
|
||||||
|
condition.insert(0, " and (");
|
||||||
|
condition.append(") ");
|
||||||
|
}
|
||||||
|
|
||||||
|
return condition.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private MapList<String, NDetailVO> queryDetailsBySql(String sql) throws DAOException{
|
||||||
|
MapList<String, NDetailVO> results = new MapList<>();
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<NDetailVO> details = (List<NDetailVO>)new BaseDAO().executeQuery(sql, new BeanListProcessor(NDetailVO.class));
|
||||||
|
if(details != null && details.size() > 0) {
|
||||||
|
for(NDetailVO detail : details) {
|
||||||
|
results.put((String)detail.getAttributeValue("groupid"), detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mixDetail(MapList<String, NDetailVO> container, MapList<String, NDetailVO> queryResults) {
|
||||||
|
if(queryResults != null) {
|
||||||
|
for(String key : queryResults.keySet()) {
|
||||||
|
container.putAll(key, queryResults.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAllZero(NDetailVO detail) {
|
||||||
|
return GLNumUtils.allZero(
|
||||||
|
detail.getCreditquantity(), detail.getDebitquantity(),
|
||||||
|
detail.getCreditamount(), detail.getDebitamount(),
|
||||||
|
detail.getLocalcreditamount(), detail.getLocaldebitamount(),
|
||||||
|
detail.getGroupcreditamount(), detail.getGroupdebitamount(),
|
||||||
|
detail.getGlobalcreditamount(), detail.getGlobaldebitamount()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数顺序决定优先级
|
||||||
|
*
|
||||||
|
* result > 0 借
|
||||||
|
* result < 0 贷
|
||||||
|
* result == 0 平
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private int detailDirection(UFDouble... amounts) {
|
||||||
|
for(UFDouble amount : amounts) {
|
||||||
|
if(amount.compareTo(UFDouble.ZERO_DBL) != 0) {
|
||||||
|
return amount.compareTo(UFDouble.ZERO_DBL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int detailDirection(NDetailVO detail) {
|
||||||
|
UFDouble amount = GLNumUtils.sub(detail.getDebitamount(), detail.getCreditamount());
|
||||||
|
UFDouble quantity = GLNumUtils.sub(detail.getDebitquantity(), detail.getCreditquantity());
|
||||||
|
UFDouble localAmount = GLNumUtils.sub(detail.getLocaldebitamount(), detail.getLocalcreditamount());
|
||||||
|
UFDouble groupAmount = GLNumUtils.sub(detail.getGroupdebitamount(), detail.getGroupcreditamount());
|
||||||
|
UFDouble globalAmount = GLNumUtils.sub(detail.getGlobaldebitamount(), detail.getGlobalcreditamount());
|
||||||
|
return detailDirection(localAmount, groupAmount, globalAmount, amount, quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearAmount(NDetailVO detail, boolean isDebit) {
|
||||||
|
if(isDebit) {
|
||||||
|
detail.setDebitquantity(UFDouble.ZERO_DBL);
|
||||||
|
detail.setDebitamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setLocaldebitamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setGroupdebitamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setGlobaldebitamount(UFDouble.ZERO_DBL);
|
||||||
|
}else {
|
||||||
|
detail.setCreditquantity(UFDouble.ZERO_DBL);
|
||||||
|
detail.setCreditamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setLocalcreditamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setGroupcreditamount(UFDouble.ZERO_DBL);
|
||||||
|
detail.setGlobalcreditamount(UFDouble.ZERO_DBL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadAssInfo() throws BusinessException {
|
||||||
|
Set<String> assidSet = new HashSet<>();
|
||||||
|
for(String groupid : detailContainer.keySet()) {
|
||||||
|
List<NDetailVO> details = detailContainer.get(groupid);
|
||||||
|
if(details == null || details.size() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(NDetailVO detail : details) {
|
||||||
|
if(detail == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!StrTools.isEmptyStr(detail.getAssid())) {
|
||||||
|
assidSet.add(detail.getAssid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(assidSet.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// IFreevaluePub freevalue = (IFreevaluePub) NCLocator.getInstance().lookup(IFreevaluePub.class.getName());
|
||||||
|
// GlAssVO[] glAssVOs = freevalue.queryAllByIDs(assidSet.toArray(new String[0]),null,Module.GL);
|
||||||
|
GlAssVO[] glAssVOs = AssByPkThreadCache.getInstance().getAssVO(assidSet.toArray(new String[0]), Module.GL);
|
||||||
|
if(glAssVOs != null && glAssVOs.length>0) {
|
||||||
|
for(int i=0;i<glAssVOs.length;i++) {
|
||||||
|
String assID = glAssVOs[i].getAssID();
|
||||||
|
assVOMap.put(assID, glAssVOs[i].getAssVos());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void catCashFlowCaseForSum(MapList<String, NDetailVO> details, String groupByStr, String fromStr, String sumSqlWherePart) throws BusinessException {
|
||||||
|
if(details == null || details.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String querysql = "select a.pk_detail,min(a.pk_detail) over(partition " + groupByStr + ") as groupid " + fromStr + "" + (sumSqlWherePart == null ? "" : sumSqlWherePart);
|
||||||
|
|
||||||
|
String tablename = "T_DETAILGROUP";
|
||||||
|
String pkfield = "pk_detail";
|
||||||
|
String groupfield = "groupid";
|
||||||
|
try {
|
||||||
|
tablename = TempTableUtils.createTempTable(tablename, " " + pkfield + " varchar(40), " + groupfield + " varchar(40) ", null);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new BusinessException(e);
|
||||||
|
}
|
||||||
|
String insertsql = "insert into " + tablename + " (" + pkfield + "," + groupfield + ") (" + querysql + ")";
|
||||||
|
new GLBaseDAO().excuteUpdate(insertsql);
|
||||||
|
|
||||||
|
// 获得现金流量信息
|
||||||
|
String[] tableinfo = new String[] {
|
||||||
|
tablename, pkfield, groupfield
|
||||||
|
};
|
||||||
|
|
||||||
|
ICashFlowCase cashflowproxy = (ICashFlowCase) NCLocator.getInstance().lookup(ICashFlowCase.class.getName());
|
||||||
|
CashflowcaseVO[] cashvo = cashflowproxy.querySumCashflow4Fip(tableinfo);
|
||||||
|
|
||||||
|
if(cashvo == null || cashvo.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//补充币种信息
|
||||||
|
|
||||||
|
MapList<String, CashflowcaseVO> cashflowCaseMapList = new MapList<>();
|
||||||
|
for (CashflowcaseVO cashflowcaseVO : cashvo) {
|
||||||
|
cashflowCaseMapList.put(cashflowcaseVO.getPk_detail(), cashflowcaseVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<String> extGroup = new ArrayList<String>();// 需要展开不汇总的分组,这是由于该组分录合计为0可是又有现金流量造成的
|
||||||
|
|
||||||
|
for(String groupId : details.keySet()) {
|
||||||
|
List<NDetailVO> detailList = details.get(groupId);
|
||||||
|
List<NDetailVO> newDetails = new ArrayList<>();
|
||||||
|
for(NDetailVO detail : detailList) {
|
||||||
|
List<CashflowcaseVO> cashflowList = cashflowCaseMapList.get(detail.getPk_detail());
|
||||||
|
if(cashflowList == null || cashflowList.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cashFlowCaseFillCurrtype(cashflowList, detail.getPk_currtype());
|
||||||
|
|
||||||
|
if(isAllZero(detail)) {
|
||||||
|
extGroup.add(detail.getPk_detail());
|
||||||
|
}else {
|
||||||
|
// 金额的校验,有现金流量的分录不允许出现借贷合计为0的情况,因为借贷合计为0的分录可能被删除,会缺失部分现金流量数据
|
||||||
|
if(detailDirection(detail) == 0) {
|
||||||
|
NDetailVO newDetail = (NDetailVO) detail.clone();
|
||||||
|
clearAmount(detail, false);
|
||||||
|
clearAmount(newDetail, true);
|
||||||
|
newDetails.add(newDetail);
|
||||||
|
}
|
||||||
|
detail.setCashflow(cashflowList.toArray(new CashflowcaseVO[0]));
|
||||||
|
}
|
||||||
|
cashflowCaseMapList.remove(detail.getPk_detail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cashflowCaseMapList.size() > 0) {
|
||||||
|
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("glnvoucher_0","0glnvoucher-0015")/*@res "补现金流量出错,分录和现金流量表的分组不一致造成部分现金流量没有归属。"*//*-=notranslate=-*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
//FIXME 原有逻辑在这里将合并后借贷为0,现金流量不为0的分录补充了回来,但是后续并没有使用,这里先不补充
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void catCashFlowCase(MapList<String, NDetailVO> details) throws BusinessException {
|
||||||
|
if(details == null || details.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> pk_details = new ArrayList<>();
|
||||||
|
Map<String, String> detailCurrTypeMap = new HashMap<>();
|
||||||
|
for(String groupid : details.keySet()) {
|
||||||
|
for(NDetailVO detail : details.get(groupid)) {
|
||||||
|
pk_details.add(detail.getPk_detail());
|
||||||
|
detailCurrTypeMap.put(detail.getPk_detail(), detail.getPk_currtype());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ICashFlowCase cashflowproxy = (ICashFlowCase) NCLocator.getInstance().lookup(ICashFlowCase.class.getName());
|
||||||
|
CashflowcaseVO[] cashflowcasevos = cashflowproxy.queryByPKRtDetails(pk_details.toArray(new String[0]));
|
||||||
|
if(cashflowcasevos == null || cashflowcasevos.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果不是总帐凭证,那么这个接口读出来的CashflowcaseVO里有可能没有币种信息,需要补上
|
||||||
|
for(CashflowcaseVO caseVO : cashflowcasevos) {
|
||||||
|
if(caseVO != null && StrTools.isEmptyStr(caseVO.getM_pk_currtype())) {
|
||||||
|
caseVO.setM_pk_currtype(detailCurrTypeMap.get(caseVO.getPk_detail()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MapList<String, CashflowcaseVO> caseMapList = new MapList<>();
|
||||||
|
for(CashflowcaseVO caseVO : cashflowcasevos) {
|
||||||
|
caseMapList.put(caseVO.getPk_detail(), caseVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(String groupid : details.keySet()) {
|
||||||
|
for(NDetailVO detail : details.get(groupid)) {
|
||||||
|
List<CashflowcaseVO> caseVOs = caseMapList.get(detail.getPk_detail());
|
||||||
|
if(caseVOs == null || caseVOs.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
detail.setCashflow(caseVOs.toArray(new CashflowcaseVO[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cashFlowCaseFillCurrtype(List<CashflowcaseVO> cashflowCases, String defaultCurrtype) {
|
||||||
|
for(CashflowcaseVO caseVO : cashflowCases) {
|
||||||
|
if(caseVO != null && StrTools.isEmptyStr(caseVO.getM_pk_currtype())) {
|
||||||
|
caseVO.setM_pk_currtype(defaultCurrtype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,35 +1,27 @@
|
||||||
package nccloud.web.ic.pub.action;
|
package nccloud.web.ic.pub.action;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import nc.vo.ic.general.define.ICBillVO;
|
import nc.vo.ic.general.define.ICBillVO;
|
||||||
import nc.vo.pubapp.res.NCModule;
|
import nc.vo.pubapp.res.NCModule;
|
||||||
import nccloud.base.reflect.NCClass;
|
import nccloud.base.reflect.NCClass;
|
||||||
import nccloud.dto.ic.pub.entity.GeneralSumPrintInfo;
|
import nccloud.dto.ic.pub.entity.GeneralSumPrintInfo;
|
||||||
import nccloud.framework.core.io.WebFileType;
|
|
||||||
import nccloud.framework.core.json.IJson;
|
import nccloud.framework.core.json.IJson;
|
||||||
import nccloud.framework.web.container.SessionContext;
|
import nccloud.framework.web.container.SessionContext;
|
||||||
import nccloud.framework.web.json.JsonFactory;
|
import nccloud.framework.web.json.JsonFactory;
|
||||||
import nccloud.framework.web.processor.template.BillCardConvertProcessor;
|
import nccloud.framework.web.processor.template.BillCardConvertProcessor;
|
||||||
import nccloud.framework.web.processor.template.ExtBillCardConvertProcessor;
|
|
||||||
import nccloud.framework.web.ui.pattern.billcard.BillCard;
|
import nccloud.framework.web.ui.pattern.billcard.BillCard;
|
||||||
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCard;
|
|
||||||
import nccloud.pubitf.platform.print.IPrintInfo;
|
import nccloud.pubitf.platform.print.IPrintInfo;
|
||||||
import nccloud.pubitf.platform.print.vo.BatchPrintInfo;
|
import nccloud.pubitf.uap.print.vo.ExtendsBatchPrintVO;
|
||||||
import nccloud.web.platform.print.AbstractPrintAction;
|
import nccloud.uap.print.action.AbstractNoPreviewPrintAction;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description ³öÈë¿â»ã×Ü´òÓ¡
|
* @description ³öÈë¿â»ã×Ü´òÓ¡
|
||||||
* @author zhegnxinm
|
* @author zhegnxinm
|
||||||
* @date 2018-12-16 ÉÏÎç10:48:39
|
* @date 2018-12-16 ÉÏÎç10:48:39
|
||||||
* @version ncc1.0
|
* @version ncc1.0
|
||||||
*/
|
*/
|
||||||
public class GeneralSumPrintAction extends AbstractPrintAction {
|
public class GeneralSumPrintAction extends AbstractNoPreviewPrintAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPrintInfo convertPrintInfo(BatchPrintInfo info) {
|
public IPrintInfo convertPrintInfo(ExtendsBatchPrintVO info) {
|
||||||
IJson json = JsonFactory.create();
|
IJson json = JsonFactory.create();
|
||||||
GeneralSumPrintInfo newinfo = json.fromJson(info.getUserjson(), GeneralSumPrintInfo.class);
|
GeneralSumPrintInfo newinfo = json.fromJson(info.getUserjson(), GeneralSumPrintInfo.class);
|
||||||
newinfo.setFilename((info.getFilename() == null) ? "download-"
|
newinfo.setFilename((info.getFilename() == null) ? "download-"
|
||||||
|
@ -38,18 +30,14 @@ public class GeneralSumPrintAction extends AbstractPrintAction {
|
||||||
|
|
||||||
String appcode = info.getAppcode();
|
String appcode = info.getAppcode();
|
||||||
String billcardStr = newinfo.getBillcard();
|
String billcardStr = newinfo.getBillcard();
|
||||||
|
//注释此代码,如需放开请修改前端"./src/ic/ic/components/sumPrintModal/index.js"里扩展的列表汇总billcard传值
|
||||||
|
// BillCard billcard = json.fromJson(billcardStr,BillCard.class);
|
||||||
|
|
||||||
if (appcode == null) {
|
if (appcode == null) {
|
||||||
appcode = SessionContext.getInstance().getAppcode();
|
appcode = SessionContext.getInstance().getAppcode();
|
||||||
}
|
}
|
||||||
ICBillVO bill = null;
|
// BillCardConvertProcessor processor = new BillCardConvertProcessor();
|
||||||
if(appcode.equals("400800800")){
|
// ICBillVO bill = processor.fromBillCard(billcard);
|
||||||
ExtBillCard billcard = json.fromJson(billcardStr, ExtBillCard.class);
|
|
||||||
ExtBillCardConvertProcessor processor = new ExtBillCardConvertProcessor();
|
|
||||||
bill = processor.fromExtBillCard(billcard);
|
|
||||||
}else if("400801214".equals(appcode)){
|
|
||||||
BillCardConvertProcessor processor = new BillCardConvertProcessor();
|
|
||||||
List<ICBillVO> billVOList=new ArrayList<>();
|
|
||||||
newinfo.setAppcode(appcode);
|
newinfo.setAppcode(appcode);
|
||||||
newinfo.setIds(info.getOids());
|
newinfo.setIds(info.getOids());
|
||||||
newinfo.setNodeKey(info.getNodekey());
|
newinfo.setNodeKey(info.getNodekey());
|
||||||
|
@ -58,50 +46,20 @@ public class GeneralSumPrintAction extends AbstractPrintAction {
|
||||||
printServiceClazz.setName(getPrintServiceName());
|
printServiceClazz.setName(getPrintServiceName());
|
||||||
newinfo.setPrintServiceClazz(printServiceClazz);
|
newinfo.setPrintServiceClazz(printServiceClazz);
|
||||||
newinfo.setPrintTemplateID(info.getPrintTemplateID());
|
newinfo.setPrintTemplateID(info.getPrintTemplateID());
|
||||||
//ĹĐśĎbillcardĘǡńÎŞĘý×é
|
// newinfo.setData(new Object[] { bill });
|
||||||
if(billcardStr.startsWith("[")){
|
newinfo.setRealData("true");
|
||||||
BillCard[] billcardList = json.fromJson(billcardStr,BillCard[].class);
|
newinfo.setTotalPage(info.getTotalPage());
|
||||||
for(BillCard billcard:billcardList ){
|
|
||||||
bill = processor.fromBillCard(billcard);
|
|
||||||
billVOList.add(bill);
|
|
||||||
}
|
|
||||||
newinfo.setData(billVOList.toArray(new Object[0]));
|
|
||||||
}else{
|
|
||||||
BillCard billcard = json.fromJson(billcardStr,BillCard.class);
|
|
||||||
bill = processor.fromBillCard(billcard);
|
|
||||||
newinfo.setData(new Object[] { bill });
|
|
||||||
}
|
|
||||||
return newinfo;
|
|
||||||
}else{
|
|
||||||
BillCard billcard = json.fromJson(billcardStr,BillCard.class);
|
|
||||||
BillCardConvertProcessor processor = new BillCardConvertProcessor();
|
|
||||||
bill = processor.fromBillCard(billcard);
|
|
||||||
}
|
|
||||||
newinfo.setAppcode(appcode);
|
|
||||||
newinfo.setIds(info.getOids());
|
|
||||||
newinfo.setNodeKey(info.getNodekey());
|
|
||||||
NCClass printServiceClazz = new NCClass();
|
|
||||||
printServiceClazz.setModule(getPrintServiceModule());
|
|
||||||
printServiceClazz.setName(getPrintServiceName());
|
|
||||||
newinfo.setPrintServiceClazz(printServiceClazz);
|
|
||||||
newinfo.setPrintTemplateID(info.getPrintTemplateID());
|
|
||||||
newinfo.setData(new Object[] { bill });
|
|
||||||
return newinfo;
|
return newinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
|
|
||||||
public String getPrintServiceModule() {
|
public String getPrintServiceModule() {
|
||||||
return NCModule.IC.getName();
|
return NCModule.IC.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getPrintServiceName() {
|
public String getPrintServiceName() {
|
||||||
return "nccloud.pubimpl.ic.inbound.generalin.operator.GeneralSumPrintOperator";
|
return "nccloud.pubimpl.ic.inbound.generalin.operator.GeneralSumPrintOperator";
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebFileType getWebFileType() {
|
|
||||||
return WebFileType.Pdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,9 @@ import java.util.*;
|
||||||
|
|
||||||
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
|
|
||||||
private static final BaseDAO DAO = new BaseDAO();
|
// private static final BaseDAO DAO = new BaseDAO();
|
||||||
|
|
||||||
private static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
|
// private static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MaterialOutVO[] save(List<Map<String, Object>> paramList) throws BusinessException {
|
public MaterialOutVO[] save(List<Map<String, Object>> paramList) throws BusinessException {
|
||||||
|
@ -70,11 +70,11 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
// 翻译货位
|
// 翻译货位
|
||||||
ICAPILocationVOUtils.translate(vos);
|
ICAPILocationVOUtils.translate(vos);
|
||||||
|
|
||||||
boolean isSpecialCase = checkSpecialCondition(paramList);
|
// boolean isSpecialCase = checkSpecialCondition(paramList);
|
||||||
// 如果判定成功,处理金思维的材料出库,将来源的相关数据补充上
|
// 如果判定成功,处理金思维的材料出库,将来源的相关数据补充上
|
||||||
if (isSpecialCase) {
|
// if (isSpecialCase) {
|
||||||
processPickingPlanSpecialLogic(vos);
|
// processPickingPlanSpecialLogic(vos);
|
||||||
}
|
// }
|
||||||
//其他数据填充
|
//其他数据填充
|
||||||
new MaterialOutSaveFillValue().setDefaultValue(vos);
|
new MaterialOutSaveFillValue().setDefaultValue(vos);
|
||||||
|
|
||||||
|
@ -283,132 +283,132 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain{
|
||||||
/**
|
/**
|
||||||
* 检查是否满足特殊条件:需要同步的组织
|
* 检查是否满足特殊条件:需要同步的组织
|
||||||
*/
|
*/
|
||||||
private boolean checkSpecialCondition(List<Map<String, Object>> materialOutVOS) throws BusinessException {
|
// private boolean checkSpecialCondition(List<Map<String, Object>> materialOutVOS) throws BusinessException {
|
||||||
|
//
|
||||||
List<MaterialOutVO> aggVOList =
|
// List<MaterialOutVO> aggVOList =
|
||||||
TransferMapToVOTool.transferMapToAggVO(materialOutVOS, MaterialOutVO.class);
|
// TransferMapToVOTool.transferMapToAggVO(materialOutVOS, MaterialOutVO.class);
|
||||||
MaterialOutVO[] vos =
|
// MaterialOutVO[] vos =
|
||||||
aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
// aggVOList.toArray(new MaterialOutVO[aggVOList.size()]);
|
||||||
|
//
|
||||||
if(Objects.isNull(materialOutVOS)){
|
// if(Objects.isNull(materialOutVOS)){
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
for (MaterialOutVO materialOutVO : vos) {
|
// for (MaterialOutVO materialOutVO : vos) {
|
||||||
MaterialOutHeadVO head = materialOutVO.getHead();
|
// MaterialOutHeadVO head = materialOutVO.getHead();
|
||||||
// 提取组织
|
// // 提取组织
|
||||||
String pkOrg = head.getPk_org();
|
// String pkOrg = head.getPk_org();
|
||||||
// 翻译成code
|
// // 翻译成code
|
||||||
// String orgCode = transferCodeByPk(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_ORG, pkOrg);
|
//// String orgCode = transferCodeByPk(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_ORG, pkOrg);
|
||||||
// 使用统一的组织判断方法
|
// // 使用统一的组织判断方法
|
||||||
if(HTTP_POST_OTHER_SYS.checkIfIncludeOrg(pkOrg)){
|
//// if(HTTP_POST_OTHER_SYS.checkIfIncludeOrg(pkOrg)){
|
||||||
return true;
|
//// return true;
|
||||||
}
|
//// }
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理备料计划特殊逻辑
|
* 处理备料计划特殊逻辑
|
||||||
*/
|
*/
|
||||||
private void processPickingPlanSpecialLogic(MaterialOutVO[] vos) throws BusinessException {
|
// private void processPickingPlanSpecialLogic(MaterialOutVO[] vos) throws BusinessException {
|
||||||
|
//
|
||||||
for (MaterialOutVO vo : vos) {
|
// for (MaterialOutVO vo : vos) {
|
||||||
MaterialOutBodyVO[] bodyVOs = vo.getBodys();
|
// MaterialOutBodyVO[] bodyVOs = vo.getBodys();
|
||||||
if (bodyVOs != null) {
|
// if (bodyVOs != null) {
|
||||||
for (MaterialOutBodyVO bodyVO : bodyVOs) {
|
// for (MaterialOutBodyVO bodyVO : bodyVOs) {
|
||||||
// 获取物料编码
|
// // 获取物料编码
|
||||||
String materialCode = transferCodeByPk(MaterialVO.getDefaultTableName(), MaterialVO.CODE, MaterialVO.PK_MATERIAL, bodyVO.getCmaterialvid());
|
// String materialCode = transferCodeByPk(MaterialVO.getDefaultTableName(), MaterialVO.CODE, MaterialVO.PK_MATERIAL, bodyVO.getCmaterialvid());
|
||||||
if (StringUtils.isEmpty(materialCode)|| StringUtils.isEmpty(bodyVO.getCsourcebillbid())) {
|
// if (StringUtils.isEmpty(materialCode)|| StringUtils.isEmpty(bodyVO.getCsourcebillbid())) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
// 基于mmpickmview视图查询备料计划相关数据
|
// // 基于mmpickmview视图查询备料计划相关数据
|
||||||
String sql = buildPickingPlanQuery(materialCode,bodyVO.getCsourcebillbid());
|
// String sql = buildPickingPlanQuery(materialCode,bodyVO.getCsourcebillbid());
|
||||||
|
//
|
||||||
try {
|
// try {
|
||||||
List<Map<String, Object>> pickingPlanData = (List<Map<String, Object>>) DAO.executeQuery(sql, new MapListProcessor());
|
// List<Map<String, Object>> pickingPlanData = (List<Map<String, Object>>) DAO.executeQuery(sql, new MapListProcessor());
|
||||||
|
//
|
||||||
// 不唯一或者找不到,这样是有问题,抛出
|
// // 不唯一或者找不到,这样是有问题,抛出
|
||||||
if(pickingPlanData==null || pickingPlanData.isEmpty()){
|
// if(pickingPlanData==null || pickingPlanData.isEmpty()){
|
||||||
throw new BusinessException("根据生产订单明细主键和物料编码去查询bip的中间视图mmpickmview找不到数据,无法进行材料出库的上游主键赋值,请检查数据,报错SQL:"+sql);
|
// throw new BusinessException("根据生产订单明细主键和物料编码去查询bip的中间视图mmpickmview找不到数据,无法进行材料出库的上游主键赋值,请检查数据,报错SQL:"+sql);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(pickingPlanData.size()!=1){
|
// if(pickingPlanData.size()!=1){
|
||||||
throw new BusinessException("根据生产订单明细主键和物料编码去查询bip的中间视图mmpickmview不唯一,无法进行材料出库的上游主键赋值,请检查数据,报错SQL:"+sql);
|
// throw new BusinessException("根据生产订单明细主键和物料编码去查询bip的中间视图mmpickmview不唯一,无法进行材料出库的上游主键赋值,请检查数据,报错SQL:"+sql);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (pickingPlanData != null && !pickingPlanData.isEmpty()) {
|
// if (pickingPlanData != null && !pickingPlanData.isEmpty()) {
|
||||||
// 处理查询到的备料计划数据
|
// // 处理查询到的备料计划数据
|
||||||
processPickingPlanData(bodyVO, pickingPlanData);
|
// processPickingPlanData(bodyVO, pickingPlanData);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
throw new BusinessException("查询备料计划数据失败: " + e.getMessage(), e);
|
// throw new BusinessException("查询备料计划数据失败: " + e.getMessage(), e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建备料计划查询SQL(基于mmpickmview视图)
|
* 构建备料计划查询SQL(基于mmpickmview视图)
|
||||||
*/
|
*/
|
||||||
private String buildPickingPlanQuery(String materialCode,String cpmohid) {
|
// private String buildPickingPlanQuery(String materialCode,String cpmohid) {
|
||||||
StringBuilder sql = new StringBuilder();
|
// StringBuilder sql = new StringBuilder();
|
||||||
sql.append("SELECT ");
|
// sql.append("SELECT ");
|
||||||
sql.append(" CODE,"); // 物料编码
|
// sql.append(" CODE,"); // 物料编码
|
||||||
sql.append(" PK_BILLTYPECODE,"); // 备料计划交易类型编码
|
// sql.append(" PK_BILLTYPECODE,"); // 备料计划交易类型编码
|
||||||
sql.append(" CPICKMID,"); // 备料计划主键
|
// sql.append(" CPICKMID,"); // 备料计划主键
|
||||||
sql.append(" CMOID,"); // 流程生产订单行主键
|
// sql.append(" CMOID,"); // 流程生产订单行主键
|
||||||
sql.append(" CPMOHID,"); // 流程生产订单主键
|
// sql.append(" CPMOHID,"); // 流程生产订单主键
|
||||||
sql.append(" VROWNO,"); // 备料计划明细行号
|
// sql.append(" VROWNO,"); // 备料计划明细行号
|
||||||
sql.append(" CPICKM_BID "); // 备料计划明细主键
|
// sql.append(" CPICKM_BID "); // 备料计划明细主键
|
||||||
sql.append("FROM MMPICKMVIEW ");
|
// sql.append("FROM MMPICKMVIEW ");
|
||||||
sql.append("WHERE CODE = '").append(materialCode).append("' AND ")
|
// sql.append("WHERE CODE = '").append(materialCode).append("' AND ")
|
||||||
.append("cmoid ='").append(cpmohid).append("'");
|
// .append("cmoid ='").append(cpmohid).append("'");
|
||||||
return sql.toString();
|
// return sql.toString();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理备料计划数据
|
* 处理备料计划数据
|
||||||
*/
|
*/
|
||||||
private void processPickingPlanData(MaterialOutBodyVO bodyVO, List<Map<String, Object>> pickingPlanData) {
|
// private void processPickingPlanData(MaterialOutBodyVO bodyVO, List<Map<String, Object>> pickingPlanData) {
|
||||||
if (pickingPlanData == null || pickingPlanData.isEmpty()) {
|
// if (pickingPlanData == null || pickingPlanData.isEmpty()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Map<String, Object> firstRow = pickingPlanData.get(0);
|
// Map<String, Object> firstRow = pickingPlanData.get(0);
|
||||||
|
//
|
||||||
// 设置备料计划相关字段
|
// // 设置备料计划相关字段
|
||||||
if (firstRow.get("cpickmid") != null) {
|
// if (firstRow.get("cpickmid") != null) {
|
||||||
bodyVO.setCsourcebillhid(firstRow.get("cpickmid").toString()); // 来源单据ID
|
// bodyVO.setCsourcebillhid(firstRow.get("cpickmid").toString()); // 来源单据ID
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (firstRow.get("cpickm_bid") != null) {
|
// if (firstRow.get("cpickm_bid") != null) {
|
||||||
bodyVO.setCsourcebillbid(firstRow.get("cpickm_bid").toString()); // 来源单据行ID
|
// bodyVO.setCsourcebillbid(firstRow.get("cpickm_bid").toString()); // 来源单据行ID
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if (firstRow.get("pk_billtypecode") != null) {
|
// if (firstRow.get("pk_billtypecode") != null) {
|
||||||
bodyVO.setCsourcetranstype(firstRow.get("pk_billtypecode").toString()); // 交易类型编码
|
// bodyVO.setCsourcetranstype(firstRow.get("pk_billtypecode").toString()); // 交易类型编码
|
||||||
}
|
// }
|
||||||
bodyVO.setCsourcetype("55A3");
|
// bodyVO.setCsourcetype("55A3");
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询编码
|
* 根据主键查询编码
|
||||||
*/
|
*/
|
||||||
private String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException {
|
// private String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException {
|
||||||
if (nc.vo.cmp.util.StringUtils.isEmpty(pk)) {
|
// if (nc.vo.cmp.util.StringUtils.isEmpty(pk)) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
SqlBuilder sqlBuilder = new SqlBuilder();
|
// SqlBuilder sqlBuilder = new SqlBuilder();
|
||||||
sqlBuilder.append(" select " + selectField);
|
// sqlBuilder.append(" select " + selectField);
|
||||||
sqlBuilder.append(" from " + tableName);
|
// sqlBuilder.append(" from " + tableName);
|
||||||
sqlBuilder.append(" where ");
|
// sqlBuilder.append(" where ");
|
||||||
sqlBuilder.append(pkField, pk);
|
// sqlBuilder.append(pkField, pk);
|
||||||
Object o = DAO.executeQuery(sqlBuilder.toString(), new ColumnProcessor());
|
// Object o = DAO.executeQuery(sqlBuilder.toString(), new ColumnProcessor());
|
||||||
if (o == null) {
|
// if (o == null) {
|
||||||
throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】");
|
// throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】");
|
||||||
}
|
// }
|
||||||
return o.toString();
|
// return o.toString();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,14 @@ import java.util.TimeZone;
|
||||||
|
|
||||||
import nc.bs.framework.common.InvocationInfoProxy;
|
import nc.bs.framework.common.InvocationInfoProxy;
|
||||||
import nc.bs.framework.common.NCLocator;
|
import nc.bs.framework.common.NCLocator;
|
||||||
|
import nc.impl.pubapp.pattern.data.bill.BillQuery;
|
||||||
import nc.ui.pub.print.IDataSource;
|
import nc.ui.pub.print.IDataSource;
|
||||||
import nc.ui.pub.print.IMetaDataDataSource;
|
import nc.ui.pub.print.IMetaDataDataSource;
|
||||||
import nc.vo.ic.general.define.ICBillBodyVO;
|
import nc.vo.ic.general.define.ICBillBodyVO;
|
||||||
import nc.vo.ic.general.define.ICBillVO;
|
import nc.vo.ic.general.define.ICBillVO;
|
||||||
import nc.vo.ic.general.define.MetaNameConst;
|
import nc.vo.ic.general.define.MetaNameConst;
|
||||||
|
import nc.vo.ic.m45.entity.PurchaseInVO;
|
||||||
|
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||||
|
@ -27,71 +30,41 @@ import nc.vo.pubapp.scale.BillVOScaleProcessor;
|
||||||
import nc.vo.pubapp.scale.TotalValueVOScaleProcessor;
|
import nc.vo.pubapp.scale.TotalValueVOScaleProcessor;
|
||||||
import nc.vo.pubapp.util.DefaultVOMerger;
|
import nc.vo.pubapp.util.DefaultVOMerger;
|
||||||
import nc.vo.scmpub.res.billtype.ICBillType;
|
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||||
|
import nc.vo.scmpub.util.BillBodySortUtils;
|
||||||
|
import nc.vo.scmpub.util.ValueCheckUtil;
|
||||||
import nccloud.dto.ic.pub.entity.GeneralSumPrintInfo;
|
import nccloud.dto.ic.pub.entity.GeneralSumPrintInfo;
|
||||||
|
import nccloud.framework.core.json.IJson;
|
||||||
|
import nccloud.framework.web.json.JsonFactory;
|
||||||
|
import nccloud.pubitf.ic.pub.service.IICBillVOQueryService;
|
||||||
|
import nccloud.pubitf.platform.print.AbstractPrintService;
|
||||||
|
import nccloud.pubitf.platform.print.IPrintInfo;
|
||||||
|
import nccloud.pubitf.scmpub.pub.print.BaseMetaPrintTimesService;
|
||||||
|
import nccloud.pubitf.scmpub.pub.print.CombinePrintInfo;
|
||||||
|
import nccloud.pubitf.scmpub.pub.print.BaseMetaPrintTimesService.MetaDataSource;
|
||||||
|
import nccloud.pubitf.uap.print.vo.NoPreviewPrintInfo;
|
||||||
import nccloud.pubimpl.ic.inbound.purchasein.operator.PurchaseInVOPrecisionHandler;
|
import nccloud.pubimpl.ic.inbound.purchasein.operator.PurchaseInVOPrecisionHandler;
|
||||||
import nccloud.pubimpl.ic.outbound.materialout.operator.MaterialOutVOPrecisionHandler;
|
import nccloud.pubimpl.ic.outbound.materialout.operator.MaterialOutVOPrecisionHandler;
|
||||||
import nccloud.pubimpl.ic.outbound.saleout.operator.SaleOutVOPrecisionHandler;
|
import nccloud.pubimpl.ic.outbound.saleout.operator.SaleOutVOPrecisionHandler;
|
||||||
import nccloud.pubimpl.ic.pub.print.ICBasePrintVOPrecisionHandler;
|
import nccloud.pubimpl.ic.pub.print.ICBasePrintVOPrecisionHandler;
|
||||||
import nccloud.pubitf.ic.pub.service.IICBillVOQueryService;
|
|
||||||
import nccloud.pubitf.platform.print.AbstractPrintService;
|
|
||||||
import nccloud.pubitf.platform.print.IPrintInfo;
|
|
||||||
import nccloud.pubitf.scmpub.pub.print.CombinePrintInfo;
|
|
||||||
/**
|
/**
|
||||||
* @description 出入库汇总打印
|
|
||||||
* @author zhegnxinm
|
* @author zhegnxinm
|
||||||
* @date 2018-12-16 上午10:48:39
|
|
||||||
* @version ncc1.0
|
* @version ncc1.0
|
||||||
|
* @description 出入库汇总打印
|
||||||
|
* @date 2018-12-16 上午10:48:39
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GeneralSumPrintOperator extends AbstractPrintService{
|
public class GeneralSumPrintOperator extends BaseMetaPrintTimesService {
|
||||||
/**
|
|
||||||
* 打印前处理类(精度)
|
|
||||||
*/
|
|
||||||
private IBeforePrintDataProcess processor;
|
|
||||||
|
|
||||||
public Object[] getDatas(GeneralSumPrintInfo info) {
|
|
||||||
return info.getData();
|
|
||||||
}
|
|
||||||
private void processData(ICBillVO cvo){
|
|
||||||
ICBillVO[] vos = new ICBillVO[]{cvo};
|
|
||||||
//精度处理
|
|
||||||
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
|
||||||
BillVOScaleProcessor scale = new BillVOScaleProcessor(pk_group,vos);
|
|
||||||
TotalValueVOScaleProcessor totalScale = new TotalValueVOScaleProcessor(vos);
|
|
||||||
ICBasePrintVOPrecisionHandler handler = null;
|
|
||||||
if (vos[0].getHead().getBillType().getCode().equals(ICBillType.SaleOut.getCode())) {//销售出库
|
|
||||||
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
|
||||||
ICBillType.SaleOut, new String[] { vos[0].getHead().getCgeneralhid()});
|
|
||||||
if(aggvos == null || aggvos.length == 0) {
|
|
||||||
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
|
||||||
}
|
|
||||||
handler = new SaleOutVOPrecisionHandler(vos);
|
|
||||||
handler.processVos(scale, totalScale);
|
|
||||||
} else if (vos[0].getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {//材料出库
|
|
||||||
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
|
||||||
ICBillType.MaterialOut, new String[] { vos[0].getHead().getCgeneralhid()});
|
|
||||||
if(aggvos == null || aggvos.length == 0) {
|
|
||||||
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
|
||||||
}
|
|
||||||
handler = new MaterialOutVOPrecisionHandler(vos);
|
|
||||||
handler.processVos(scale, totalScale);
|
|
||||||
} else {//采购入库
|
|
||||||
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
|
||||||
ICBillType.PurchaseIn, new String[] { vos[0].getHead().getCgeneralhid()});
|
|
||||||
if(aggvos == null || aggvos.length == 0) {
|
|
||||||
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0","04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
|
||||||
}
|
|
||||||
handler = new PurchaseInVOPrecisionHandler(vos);
|
|
||||||
handler.processVos(scale, totalScale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public IDataSource[] getDataSources(IPrintInfo info) {
|
public IDataSource[] getDataSources(IPrintInfo info) {
|
||||||
GeneralSumPrintInfo printInfo = (GeneralSumPrintInfo) info;
|
GeneralSumPrintInfo printInfo = (GeneralSumPrintInfo) info;
|
||||||
|
|
||||||
// 获取数据
|
// 获取数据
|
||||||
Object[] datas = this.getDatas(printInfo);
|
Object[] datas = this.getDatas(printInfo.getIds());
|
||||||
|
if (ValueCheckUtil.isNullORZeroLength(datas)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 获取分组数据
|
||||||
List<Boolean> alGroupBy = printInfo.getAlGroupBy();
|
List<Boolean> alGroupBy = printInfo.getAlGroupBy();
|
||||||
// 得到分组字段
|
// 得到分组字段
|
||||||
ICBillVO cvo = (ICBillVO) datas[0];
|
ICBillVO cvo = (ICBillVO) datas[0];
|
||||||
|
@ -100,7 +73,6 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
|
||||||
saGroupField = processSaGroupField(saGroupField);
|
saGroupField = processSaGroupField(saGroupField);
|
||||||
DefaultVOMerger dvomerger = new DefaultVOMerger();
|
DefaultVOMerger dvomerger = new DefaultVOMerger();
|
||||||
dvomerger.setGroupingAttr(saGroupField);
|
dvomerger.setGroupingAttr(saGroupField);
|
||||||
|
|
||||||
// 得到Summing字段
|
// 得到Summing字段
|
||||||
String[] saSummingField = null;
|
String[] saSummingField = null;
|
||||||
if (cvo.getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {
|
if (cvo.getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {
|
||||||
|
@ -153,245 +125,132 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理打印多时区
|
|
||||||
*
|
|
||||||
* @param datas
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private Object[] processTimeZone(Object[] datas) {
|
|
||||||
String timeZonestr = InvocationInfoProxy.getInstance().getTimeZone();
|
|
||||||
TimeZone timeZone = TimeZone.getTimeZone(timeZonestr);
|
|
||||||
for (Object data : datas) {
|
|
||||||
if (data instanceof SuperVO) {
|
|
||||||
this.processSuperVOTimeZone((SuperVO) data, timeZone);
|
|
||||||
} else if (data instanceof AbstractBill) {
|
|
||||||
AbstractBill bill = (AbstractBill) data;
|
|
||||||
CircularlyAccessibleValueObject vo = bill.getParentVO();
|
|
||||||
this.processSuperVOTimeZone((SuperVO) vo, timeZone);
|
|
||||||
CircularlyAccessibleValueObject[] childrenVO = bill.getAllChildrenVO();
|
|
||||||
for (CircularlyAccessibleValueObject item : childrenVO) {
|
|
||||||
this.processSuperVOTimeZone((SuperVO) item, timeZone);
|
|
||||||
}
|
|
||||||
} else if (data instanceof AbstractDataView) {
|
|
||||||
AbstractDataView view = (AbstractDataView) data;
|
|
||||||
this.processViewVOTimeZone(view, timeZone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 处理视图VO的多时区
|
|
||||||
*
|
|
||||||
* @param view
|
|
||||||
* @param timeZone
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void processViewVOTimeZone(AbstractDataView view, TimeZone timeZone) {
|
|
||||||
String[] names = view.getAttributeNames();
|
|
||||||
for (String name : names) {
|
|
||||||
Object value = view.getAttributeValue(name);
|
|
||||||
if (value == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (value instanceof UFDate) {
|
|
||||||
UFDate date = (UFDate) value;
|
|
||||||
String stdString = date.toStdString(timeZone);
|
|
||||||
UFDate ufDate = new UFDate(stdString);
|
|
||||||
view.setAttributeValue(name, ufDate);
|
|
||||||
} else if (value instanceof UFDateTime) {
|
|
||||||
UFDateTime datetime = (UFDateTime) value;
|
|
||||||
String stdString = datetime.toStdString(timeZone);
|
|
||||||
UFDateTime ufDateTime = new UFDateTime(stdString);
|
|
||||||
view.setAttributeValue(name, ufDateTime);
|
|
||||||
} else if (value instanceof UFTime) {
|
|
||||||
UFTime time = (UFTime) value;
|
|
||||||
String stdString = time.toStdString(timeZone);
|
|
||||||
UFTime ufTime = new UFTime(stdString);
|
|
||||||
view.setAttributeValue(name, ufTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理SuperVO的多时区
|
|
||||||
*
|
|
||||||
* @param vo
|
|
||||||
* @param timeZone
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void processSuperVOTimeZone(SuperVO vo, TimeZone timeZone) {
|
|
||||||
String[] attributeNames = vo.getAttributeNames();
|
|
||||||
for (String name : attributeNames) {
|
|
||||||
Object value = vo.getAttributeValue(name);
|
|
||||||
if (value == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (value instanceof UFDate) {
|
|
||||||
UFDate date = (UFDate) value;
|
|
||||||
String stdString = date.toStdString(timeZone);
|
|
||||||
UFDate ufDate = new UFDate(stdString);
|
|
||||||
vo.setAttributeValue(name, ufDate);
|
|
||||||
|
|
||||||
} else if (value instanceof UFDateTime) {
|
|
||||||
UFDateTime datetime = (UFDateTime) value;
|
|
||||||
String stdString = datetime.toStdString(timeZone);
|
|
||||||
UFDateTime ufDateTime = new UFDateTime(stdString);
|
|
||||||
vo.setAttributeValue(name, ufDateTime);
|
|
||||||
} else if (value instanceof UFTime) {
|
|
||||||
UFTime time = (UFTime) value;
|
|
||||||
String stdString = time.toStdString(timeZone);
|
|
||||||
UFTime ufTime = new UFTime(stdString);
|
|
||||||
vo.setAttributeValue(name, ufTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 组装数据源
|
|
||||||
*
|
|
||||||
* @param datas
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected IDataSource[] getDataSource(Object[] datas) {
|
|
||||||
IDataSource[] ds = new IDataSource[datas.length];
|
|
||||||
for (int i = 0; i < datas.length; i++) {
|
|
||||||
ds[i] = new MetaDataSource(new Object[] { datas[i] });
|
|
||||||
}
|
|
||||||
return ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 获取数据
|
|
||||||
*
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
protected Object[] getDatas(CombinePrintInfo printInfo) {
|
|
||||||
return printInfo.getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @description 元数据数据源
|
|
||||||
* @author guozhq
|
|
||||||
* @date 2018-7-2 下午4:32:45
|
|
||||||
* @version ncc1.0
|
|
||||||
*/
|
|
||||||
private class MetaDataSource implements IMetaDataDataSource {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Fields serialVersionUID
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 6834183299513914654L;
|
|
||||||
|
|
||||||
private Object[] printData;
|
|
||||||
|
|
||||||
public MetaDataSource(Object[] printData) {
|
|
||||||
this.printData = printData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getItemValuesByExpress(String itemExpress) {
|
public Object[] getDatas(String[] ids) {
|
||||||
return null;
|
BillQuery<PurchaseInVO> query45 = new BillQuery<PurchaseInVO>(PurchaseInVO.class);
|
||||||
}
|
PurchaseInVO[] vos = query45.query(ids);
|
||||||
|
if (vos.length != 0) {
|
||||||
|
BillBodySortUtils.sort(vos);
|
||||||
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
||||||
|
BillVOScaleProcessor scale = new BillVOScaleProcessor(pk_group, vos);
|
||||||
|
TotalValueVOScaleProcessor totalScale = new TotalValueVOScaleProcessor(vos);
|
||||||
|
|
||||||
@Override
|
PurchaseInVOPrecisionHandler handler = new PurchaseInVOPrecisionHandler(vos);
|
||||||
public boolean isNumber(String itemExpress) {
|
handler.processVos(scale, totalScale);
|
||||||
return false;
|
return vos;
|
||||||
}
|
} else {
|
||||||
|
BillQuery<MaterialOutVO> query4D = new BillQuery<MaterialOutVO>(MaterialOutVO.class);
|
||||||
|
MaterialOutVO[] mvos = query4D.query(ids);
|
||||||
|
BillBodySortUtils.sort(mvos);
|
||||||
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
||||||
|
BillVOScaleProcessor scale = new BillVOScaleProcessor(pk_group, mvos);
|
||||||
|
TotalValueVOScaleProcessor totalScale = new TotalValueVOScaleProcessor(mvos);
|
||||||
|
|
||||||
@Override
|
PurchaseInVOPrecisionHandler handler = new PurchaseInVOPrecisionHandler(mvos);
|
||||||
public String[] getDependentItemExpressByExpress(String itemExpress) {
|
handler.processVos(scale, totalScale);
|
||||||
return null;
|
return mvos;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getAllDataItemExpress() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getAllDataItemNames() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModuleName() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object[] getMDObjects() {
|
|
||||||
// 处理前方法
|
|
||||||
if (GeneralSumPrintOperator.this.getProcessor() != null) {
|
|
||||||
return GeneralSumPrintOperator.this.getProcessor().processData(printData);
|
|
||||||
}
|
|
||||||
return printData;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 获取分组字段 方法功能描述:
|
||||||
* @description 打印前接口
|
|
||||||
* @author guozhq
|
|
||||||
* @date 2018-7-2 下午4:33:10
|
|
||||||
* @version ncc1.0
|
|
||||||
*/
|
|
||||||
public interface IBeforePrintDataProcess {
|
|
||||||
Object[] processData(Object[] datas);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IBeforePrintDataProcess getProcessor() {
|
|
||||||
return processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProcessor(IBeforePrintDataProcess processor) {
|
|
||||||
this.processor = processor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇总以后重置价格 方法功能描述:
|
|
||||||
* <p>
|
* <p>
|
||||||
* <b>参数说明</b>
|
* <b>参数说明</b>
|
||||||
*
|
*
|
||||||
* @param itemvosnew
|
* @return <p>
|
||||||
* <p>
|
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
* @author zhangsui
|
||||||
* @time 2011-7-19 上午08:35:43
|
* @time 2011-7-19 上午08:37:31
|
||||||
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
protected void reSetPrice(ICBillBodyVO[] itemvosnew,String type) {
|
protected String[] getGroupFields() {
|
||||||
if (itemvosnew != null) {
|
return new String[]{ICPubMetaNameConst.CMATERIALVID,
|
||||||
UFDouble udNum = null;
|
ICPubMetaNameConst.VBATCHCODE, ICPubMetaNameConst.CASTUNITID,
|
||||||
UFDouble udMny = null;
|
"vfree0", ICPubMetaNameConst.CLOCATIONID,
|
||||||
for (int k = 0; k < itemvosnew.length; k++) {
|
ICPubMetaNameConst.CVENDORID};
|
||||||
udNum = itemvosnew[k].getNnum();
|
}
|
||||||
udMny = (UFDouble) itemvosnew[k]
|
|
||||||
.getAttributeValue(MetaNameConst.NMNY);
|
|
||||||
if (type.equals(ICBillType.MaterialOut.getCode())) {
|
|
||||||
udMny = (UFDouble) itemvosnew[k]
|
|
||||||
.getAttributeValue(MetaNameConst.NCOSTMNY);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过选择框最终确定的分组字段 方法功能描述:
|
||||||
|
* <p>
|
||||||
|
* <b>参数说明</b>
|
||||||
|
*
|
||||||
|
* @param alGroupBy
|
||||||
|
* @param Fields
|
||||||
|
* @return <p>
|
||||||
|
* @author zhangsui
|
||||||
|
* @time 2011-7-19 上午08:41:30
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected String[] getSelGroupFields(List alGroupBy, String[] Fields) {
|
||||||
|
ArrayList alChooseGroup = new ArrayList();
|
||||||
|
for (int i = 0; i < alGroupBy.size() - 1; i++) {
|
||||||
|
if (((Boolean) alGroupBy.get(i)).booleanValue()) {
|
||||||
|
alChooseGroup.add(Fields[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] saGroupField = null;
|
||||||
|
if (alChooseGroup.size() > 0) {
|
||||||
|
saGroupField = new String[alChooseGroup.size()];
|
||||||
|
alChooseGroup.toArray(saGroupField);
|
||||||
|
}
|
||||||
|
return saGroupField;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对分组字段做特殊处理 方法功能描述:
|
||||||
|
* <p>
|
||||||
|
* <b>参数说明</b>
|
||||||
|
*
|
||||||
|
* @param saGroupField
|
||||||
|
* @return <p>
|
||||||
|
* @author zhangsui
|
||||||
|
* @time 2011-7-19 下午03:13:03
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
protected String[] processSaGroupField(String[] saGroupField) {
|
||||||
|
List<String> fields = Arrays.asList(saGroupField);
|
||||||
|
List<String> newfields = new ArrayList<String>();
|
||||||
|
if (fields.contains("vfree0")) {
|
||||||
|
for (int i = 0; i < saGroupField.length; i++) {
|
||||||
|
if (!"vfree0".equals(saGroupField[i])) {
|
||||||
|
newfields.add(saGroupField[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 1; i < 11; i++) {
|
||||||
|
newfields.add("vfree" + i);
|
||||||
|
}
|
||||||
|
return newfields.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
return saGroupField;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取汇总字段 方法功能描述:
|
||||||
|
* <p>
|
||||||
|
* <b>参数说明</b>
|
||||||
|
* 材料出库调用
|
||||||
|
*
|
||||||
|
* @param isselected
|
||||||
|
* @return <p>
|
||||||
|
* @author zhangsui
|
||||||
|
* @time 2011-7-19 上午08:35:12
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected String[] getSummingField(Boolean isselected) {
|
||||||
|
String[] saSummingField = null;
|
||||||
|
if ((isselected).booleanValue() == true) {
|
||||||
|
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
|
||||||
|
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
|
||||||
|
ICPubMetaNameConst.NSHOULDASSISTNUM, MetaNameConst.NCOSTMNY};
|
||||||
} else {
|
} else {
|
||||||
udMny = (UFDouble) itemvosnew[k]
|
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
|
||||||
.getAttributeValue(MetaNameConst.NMNY);
|
ICPubMetaNameConst.NNUM, MetaNameConst.NCOSTMNY};
|
||||||
}
|
|
||||||
if (udNum != null && udMny != null) {
|
|
||||||
itemvosnew[k].setAttributeValue(MetaNameConst.NPRICE,
|
|
||||||
(udMny.div(udNum)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return saSummingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取汇总字段 方法功能描述:采购入库调用
|
* 获取汇总字段 方法功能描述:采购入库调用
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -399,9 +258,9 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
|
||||||
*
|
*
|
||||||
* @param isselected
|
* @param isselected
|
||||||
* @return <p>
|
* @return <p>
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
* @author zhangsui
|
||||||
* @time 2011-7-19 上午08:35:12
|
* @time 2011-7-19 上午08:35:12
|
||||||
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
protected String[] getSummingField(Boolean isselected, String type) {
|
protected String[] getSummingField(Boolean isselected, String type) {
|
||||||
String[] saSummingField = null;
|
String[] saSummingField = null;
|
||||||
|
@ -439,106 +298,72 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
|
||||||
return saSummingField;
|
return saSummingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void processData(ICBillVO cvo) {
|
||||||
|
ICBillVO[] vos = new ICBillVO[]{cvo};
|
||||||
|
//精度处理
|
||||||
|
String pk_group = InvocationInfoProxy.getInstance().getGroupId();
|
||||||
|
BillVOScaleProcessor scale = new BillVOScaleProcessor(pk_group, vos);
|
||||||
|
TotalValueVOScaleProcessor totalScale = new TotalValueVOScaleProcessor(vos);
|
||||||
|
ICBasePrintVOPrecisionHandler handler = null;
|
||||||
|
if (vos[0].getHead().getBillType().getCode().equals(ICBillType.SaleOut.getCode())) {//销售出库
|
||||||
|
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
||||||
|
ICBillType.SaleOut, new String[]{vos[0].getHead().getCgeneralhid()});
|
||||||
|
if (aggvos == null || aggvos.length == 0) {
|
||||||
|
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
||||||
|
}
|
||||||
|
handler = new SaleOutVOPrecisionHandler(vos);
|
||||||
|
handler.processVos(scale, totalScale);
|
||||||
|
} else if (vos[0].getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {//材料出库
|
||||||
|
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
||||||
|
ICBillType.MaterialOut, new String[]{vos[0].getHead().getCgeneralhid()});
|
||||||
|
if (aggvos == null || aggvos.length == 0) {
|
||||||
|
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
||||||
|
}
|
||||||
|
handler = new MaterialOutVOPrecisionHandler(vos);
|
||||||
|
handler.processVos(scale, totalScale);
|
||||||
|
} else {//采购入库
|
||||||
|
ICBillVO[] aggvos = NCLocator.getInstance().lookup(IICBillVOQueryService.class).query(
|
||||||
|
ICBillType.PurchaseIn, new String[]{vos[0].getHead().getCgeneralhid()});
|
||||||
|
if (aggvos == null || aggvos.length == 0) {
|
||||||
|
ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0180")/*@res "当前数据已被删除,请到列表页面刷新!"*/);
|
||||||
|
}
|
||||||
|
handler = new PurchaseInVOPrecisionHandler(vos);
|
||||||
|
handler.processVos(scale, totalScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取汇总字段 方法功能描述:
|
* 汇总以后重置价格 方法功能描述:
|
||||||
* <p>
|
* <p>
|
||||||
* <b>参数说明</b>
|
* <b>参数说明</b>
|
||||||
* 材料出库调用
|
*
|
||||||
* @param isselected
|
* @param itemvosnew <p>
|
||||||
* @return <p>
|
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
* @author zhangsui
|
||||||
* @time 2011-7-19 上午08:35:12
|
* @time 2011-7-19 上午08:35:43
|
||||||
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
|
protected void reSetPrice(ICBillBodyVO[] itemvosnew, String type) {
|
||||||
|
if (itemvosnew != null) {
|
||||||
|
UFDouble udNum = null;
|
||||||
|
UFDouble udMny = null;
|
||||||
|
for (int k = 0; k < itemvosnew.length; k++) {
|
||||||
|
udNum = itemvosnew[k].getNnum();
|
||||||
|
udMny = (UFDouble) itemvosnew[k]
|
||||||
|
.getAttributeValue(MetaNameConst.NMNY);
|
||||||
|
if (type.equals(ICBillType.MaterialOut.getCode())) {
|
||||||
|
udMny = (UFDouble) itemvosnew[k]
|
||||||
|
.getAttributeValue(MetaNameConst.NCOSTMNY);
|
||||||
|
|
||||||
protected String[] getSummingField(Boolean isselected) {
|
|
||||||
String[] saSummingField = null;
|
|
||||||
if ((isselected).booleanValue() == true) {
|
|
||||||
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
|
|
||||||
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
|
|
||||||
ICPubMetaNameConst.NSHOULDASSISTNUM, MetaNameConst.NCOSTMNY };
|
|
||||||
} else {
|
} else {
|
||||||
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
|
udMny = (UFDouble) itemvosnew[k]
|
||||||
ICPubMetaNameConst.NNUM, MetaNameConst.NCOSTMNY };
|
.getAttributeValue(MetaNameConst.NMNY);
|
||||||
}
|
}
|
||||||
return saSummingField;
|
if (udNum != null && udMny != null) {
|
||||||
}
|
itemvosnew[k].setAttributeValue(MetaNameConst.NPRICE,
|
||||||
/**
|
(udMny.div(udNum)));
|
||||||
* 通过选择框最终确定的分组字段 方法功能描述:
|
|
||||||
* <p>
|
|
||||||
* <b>参数说明</b>
|
|
||||||
*
|
|
||||||
* @param alGroupBy
|
|
||||||
* @param Fields
|
|
||||||
* @return <p>
|
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
|
||||||
* @time 2011-7-19 上午08:41:30
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected String[] getSelGroupFields(List alGroupBy, String[] Fields) {
|
|
||||||
ArrayList alChooseGroup = new ArrayList();
|
|
||||||
for (int i = 0; i < alGroupBy.size() - 1; i++) {
|
|
||||||
if (((Boolean) alGroupBy.get(i)).booleanValue()) {
|
|
||||||
alChooseGroup.add(Fields[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String[] saGroupField = null;
|
|
||||||
if (alChooseGroup.size() > 0){
|
|
||||||
saGroupField = new String[alChooseGroup.size()];
|
|
||||||
alChooseGroup.toArray(saGroupField);
|
|
||||||
}
|
}
|
||||||
return saGroupField;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 对分组字段做特殊处理 方法功能描述:
|
|
||||||
* <p>
|
|
||||||
* <b>参数说明</b>
|
|
||||||
*
|
|
||||||
* @param saGroupField
|
|
||||||
* @return <p>
|
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
|
||||||
* @time 2011-7-19 下午03:13:03
|
|
||||||
*/
|
|
||||||
protected String[] processSaGroupField(String[] saGroupField) {
|
|
||||||
List<String> fields = Arrays.asList(saGroupField);
|
|
||||||
List<String> newfields = new ArrayList<String>();
|
|
||||||
if (fields.contains("vfree0")) {
|
|
||||||
for (int i = 0; i < saGroupField.length; i++) {
|
|
||||||
if (!"vfree0".equals(saGroupField[i])) {
|
|
||||||
newfields.add(saGroupField[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 1; i < 11; i++) {
|
|
||||||
newfields.add("vfree" + i);
|
|
||||||
}
|
|
||||||
return newfields.toArray(new String[0]);
|
|
||||||
}
|
|
||||||
return saGroupField;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取分组字段 方法功能描述:
|
|
||||||
* <p>
|
|
||||||
* <b>参数说明</b>
|
|
||||||
*
|
|
||||||
* @return <p>
|
|
||||||
* @since 6.0
|
|
||||||
* @author zhangsui
|
|
||||||
* @time 2011-7-19 上午08:37:31
|
|
||||||
*/
|
|
||||||
protected String[] getGroupFields() {
|
|
||||||
return new String[] { ICPubMetaNameConst.CMATERIALVID,
|
|
||||||
ICPubMetaNameConst.VBATCHCODE, ICPubMetaNameConst.CASTUNITID,
|
|
||||||
"vfree0", ICPubMetaNameConst.CLOCATIONID,
|
|
||||||
ICPubMetaNameConst.CVENDORID };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package nccloud.api.ic.m4d;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
|
|
||||||
|
public interface IAPIMaterialOutMaintain {
|
||||||
|
MaterialOutVO[] save(List<Map<String, Object>> var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] update(List<Map<String, Object>> var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] delete(MaterialOutVO[] var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] sign(MaterialOutVO[] var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] unSign(MaterialOutVO[] var1) throws BusinessException;
|
||||||
|
|
||||||
|
MaterialOutVO[] saveByRef(List<Map<String, Object>> var1) throws BusinessException;
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package nccloud.dto.ic.pub.entity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nccloud.pubitf.platform.print.vo.PrintInfo;
|
||||||
|
import nccloud.pubitf.uap.print.vo.NoPreviewPrintInfo;
|
||||||
|
/**
|
||||||
|
* @description 出入库汇总打印信息
|
||||||
|
* @author zhegnxinm
|
||||||
|
* @date 2018-12-16 上午10:48:39
|
||||||
|
* @version ncc1.0
|
||||||
|
*/
|
||||||
|
public class GeneralSumPrintInfo extends NoPreviewPrintInfo{
|
||||||
|
//打印数据
|
||||||
|
private Object[] data;
|
||||||
|
//前段传过来的数据
|
||||||
|
private String billcard;
|
||||||
|
//汇总类型
|
||||||
|
private List<Boolean> alGroupBy ;
|
||||||
|
//出入库类型
|
||||||
|
private String inOutType;
|
||||||
|
public String getInOutType() {
|
||||||
|
return inOutType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInOutType(String inOutType) {
|
||||||
|
this.inOutType = inOutType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Boolean> getAlGroupBy() {
|
||||||
|
return alGroupBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlGroupBy(List<Boolean> alGroupBy) {
|
||||||
|
this.alGroupBy = alGroupBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getSelect() {
|
||||||
|
return select;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelect(Object[] select) {
|
||||||
|
this.select = select;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object[] select;
|
||||||
|
public String getBillcard() {
|
||||||
|
return billcard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBillcard(String billcard) {
|
||||||
|
this.billcard = billcard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(Object[] data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -4,29 +4,30 @@ package nc.bs.mmpac.pickm.bp.rule;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import nc.bs.dao.BaseDAO;
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
import nc.bs.logging.Log;
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||||
import nc.impl.pubapp.pattern.rule.IRule;
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
import nc.pubitf.para.SysInitQuery;
|
import nc.pubitf.para.SysInitQuery;
|
||||||
import nc.vo.bd.defdoc.DefdocVO;
|
|
||||||
import nc.vo.bd.material.MaterialVO;
|
import nc.vo.bd.material.MaterialVO;
|
||||||
import nc.vo.bd.rt.rt0004.entity.RcVO;
|
|
||||||
import nc.vo.bd.stordoc.StordocVO;
|
|
||||||
import nc.vo.cmp.util.StringUtils;
|
import nc.vo.cmp.util.StringUtils;
|
||||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||||
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
import nc.vo.mmpac.pickm.entity.PickmHeadVO;
|
||||||
import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
import nc.vo.mmpac.pickm.entity.PickmItemVO;
|
||||||
import nc.vo.org.OrgVO;
|
import nc.vo.org.OrgVO;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
|
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||||
|
import nc.vo.pub.ISuperVO;
|
||||||
import nc.vo.pub.lang.UFBoolean;
|
import nc.vo.pub.lang.UFBoolean;
|
||||||
import nc.vo.pub.lang.UFDouble;
|
import nc.vo.pub.lang.UFDouble;
|
||||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||||
import nc.vo.scmpub.util.ArrayUtil;
|
import nc.vo.scmpub.util.ArrayUtil;
|
||||||
|
import nc.vo.util.CloneUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AfterApproveRuleSyncRZWMS implements IRule<AggPickmVO> {
|
public class AfterApproveRuleSyncRZWMS implements IRule<AggPickmVO> {
|
||||||
|
|
||||||
|
@ -40,8 +41,9 @@ public class AfterApproveRuleSyncRZWMS implements IRule<AggPickmVO> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
AggPickmVO[] cloneOrderVOS = (AggPickmVO[]) CloneUtil.deepClone(vos);
|
||||||
// 检查并筛选领料组织
|
// 检查并筛选领料组织
|
||||||
List<AggPickmVO> newAggPickmVOS = checkAndFilterBillSrcOrg(vos);
|
List<AggPickmVO> newAggPickmVOS = checkAndFilterBillSrcOrg(cloneOrderVOS);
|
||||||
if (newAggPickmVOS.isEmpty()) {
|
if (newAggPickmVOS.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -188,19 +190,74 @@ public class AfterApproveRuleSyncRZWMS implements IRule<AggPickmVO> {
|
||||||
|
|
||||||
private List<AggPickmVO> checkAndFilterBillSrcOrg(AggPickmVO[] aggPickmVOS) throws BusinessException {
|
private List<AggPickmVO> checkAndFilterBillSrcOrg(AggPickmVO[] aggPickmVOS) throws BusinessException {
|
||||||
List<AggPickmVO> aggvoList = new ArrayList<>();
|
List<AggPickmVO> aggvoList = new ArrayList<>();
|
||||||
|
List<AggPickmVO> finalList = new ArrayList<>();
|
||||||
|
|
||||||
for (AggPickmVO aggvo : aggPickmVOS) {
|
for (AggPickmVO aggvo : aggPickmVOS) {
|
||||||
String pkOrg = aggvo.getParentVO().getPk_org();
|
String pkOrg = aggvo.getParentVO().getPk_org();
|
||||||
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||||
//过滤上游不是生产订单和委外订单的备料计划
|
//过滤上游不是生产订单和委外订单的备料计划
|
||||||
String vfirstbilltype = aggvo.getParentVO().getVfirstbilltype();
|
String vfirstbilltype = aggvo.getParentVO().getVfirstbilltype();
|
||||||
|
String vdef20 = aggvo.getParentVO().getVdef20();
|
||||||
|
if(vdef20==null||"N".equals(vdef20)){
|
||||||
if ("C022".equals(orgCode)&& 1 == aggvo.getParentVO().getFbillstatus()&&aggvo.getChildrenVO()!=null && aggvo.getChildrenVO().length > 0) {
|
if ("C022".equals(orgCode)&& 1 == aggvo.getParentVO().getFbillstatus()&&aggvo.getChildrenVO()!=null && aggvo.getChildrenVO().length > 0) {
|
||||||
if("61".equals(vfirstbilltype)||"55A2".equals(vfirstbilltype)){
|
if("61".equals(vfirstbilltype)||"55A2".equals(vfirstbilltype)){
|
||||||
|
//2025年7月2日10点33分--新增不传--表体物料编码前三位为103时不传
|
||||||
|
//获取表体物料信息
|
||||||
aggvoList.add(aggvo);
|
aggvoList.add(aggvo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//再次筛选
|
||||||
|
//2025年7月2日10点33分--新增不传--表体物料编码前三位为103时不传
|
||||||
|
//获取表体物料信息
|
||||||
|
if(aggvoList.isEmpty()){
|
||||||
return aggvoList;
|
return aggvoList;
|
||||||
}
|
}
|
||||||
|
Set<String> materialpks=new HashSet<>();
|
||||||
|
for (AggPickmVO aggvo : aggvoList) {
|
||||||
|
PickmItemVO[] items = (PickmItemVO[]) aggvo.getChildren(PickmItemVO.class);
|
||||||
|
for (PickmItemVO item : items) {
|
||||||
|
String cbmaterialvid = item.getCbmaterialvid();
|
||||||
|
materialpks.add(cbmaterialvid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(materialpks.isEmpty()){
|
||||||
|
return aggvoList;
|
||||||
|
}
|
||||||
|
//根据物料id查询物料信息
|
||||||
|
MaterialVO[] vos = NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class).queryDataByPks(materialpks.toArray(new String[0]));
|
||||||
|
//组装Map
|
||||||
|
Map<String, String> materialMap = new HashMap<>();
|
||||||
|
if(vos==null || vos.length<1){
|
||||||
|
throw new BusinessException("Failed to query material info , please check !!!");
|
||||||
|
}
|
||||||
|
for (MaterialVO vo : vos) {
|
||||||
|
String cmaterialvid = vo.getPk_material();
|
||||||
|
String cmaterialcode =vo.getCode();
|
||||||
|
materialMap.put(cmaterialvid, cmaterialcode);
|
||||||
|
}
|
||||||
|
//筛选行数据
|
||||||
|
for (AggPickmVO aggvo : aggvoList) {
|
||||||
|
List<PickmItemVO> newItems = new ArrayList<>();
|
||||||
|
PickmItemVO[] items = (PickmItemVO[]) aggvo.getChildren(PickmItemVO.class);
|
||||||
|
for (PickmItemVO item : items) {
|
||||||
|
String cmaterialvid = item.getCbmaterialvid();
|
||||||
|
if (materialMap.containsKey(cmaterialvid)) {
|
||||||
|
String materialCode = materialMap.get(cmaterialvid);
|
||||||
|
if(!materialCode.startsWith("103")){
|
||||||
|
newItems.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!newItems.isEmpty()) {
|
||||||
|
aggvo.setChildren(PickmItemVO.class,newItems.toArray(new PickmItemVO[0]));
|
||||||
|
finalList.add(aggvo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finalList;
|
||||||
|
}
|
||||||
|
|
||||||
private void pushToRZMOMBy55A2(AggPickmVO[] aggPickmVOS) throws BusinessException {
|
private void pushToRZMOMBy55A2(AggPickmVO[] aggPickmVOS) throws BusinessException {
|
||||||
String rzwmsip = SysInitQuery.getParaString("GLOBLE00000000000000", "RZWMSIP");
|
String rzwmsip = SysInitQuery.getParaString("GLOBLE00000000000000", "RZWMSIP");
|
||||||
|
|
|
@ -3,14 +3,17 @@ package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import nc.bs.dao.BaseDAO;
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
import nc.bs.logging.Log;
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.mmpac.pmo.pac0002.bp.service.PMOBPService;
|
import nc.bs.mmpac.pmo.pac0002.bp.service.PMOBPService;
|
||||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||||
import nc.impl.pubapp.pattern.rule.IRule;
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
import nc.pubitf.para.SysInitQuery;
|
import nc.pubitf.para.SysInitQuery;
|
||||||
import nc.util.mmf.framework.base.MMValueCheck;
|
import nc.util.mmf.framework.base.MMValueCheck;
|
||||||
import nc.vo.bd.defdoc.DefdocVO;
|
import nc.vo.bd.defdoc.DefdocVO;
|
||||||
|
import nc.vo.bd.material.MaterialVO;
|
||||||
import nc.vo.cmp.util.StringUtils;
|
import nc.vo.cmp.util.StringUtils;
|
||||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
|
import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO;
|
||||||
|
@ -21,11 +24,9 @@ import nc.vo.pub.lang.UFBoolean;
|
||||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||||
import nc.vo.scmpub.util.ArrayUtil;
|
import nc.vo.scmpub.util.ArrayUtil;
|
||||||
|
import nc.vo.util.CloneUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程生产订单审批后推送RZ
|
* 流程生产订单审批后推送RZ
|
||||||
|
@ -46,8 +47,9 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
PMOAggVO[] cloneOrderVOS = (PMOAggVO[]) CloneUtil.deepClone(pmoAggVOS);
|
||||||
// 检查并筛选生产订单
|
// 检查并筛选生产订单
|
||||||
List<PMOAggVO> filteredOrders = checkAndFilterBillSrcOrg(pmoAggVOS);
|
List<PMOAggVO> filteredOrders = checkAndFilterBillSrcOrg(cloneOrderVOS);
|
||||||
if (filteredOrders.isEmpty()) {
|
if (filteredOrders.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -66,6 +68,7 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> {
|
||||||
private List<PMOAggVO> checkAndFilterBillSrcOrg(PMOAggVO[] pmoAggVOS) throws BusinessException {
|
private List<PMOAggVO> checkAndFilterBillSrcOrg(PMOAggVO[] pmoAggVOS) throws BusinessException {
|
||||||
List<PMOAggVO> aggvoList = new ArrayList<>();
|
List<PMOAggVO> aggvoList = new ArrayList<>();
|
||||||
List<String> tranidList = new ArrayList<String>();
|
List<String> tranidList = new ArrayList<String>();
|
||||||
|
List<PMOAggVO> finalList = new ArrayList<>();
|
||||||
for (PMOAggVO aggvo : pmoAggVOS) {
|
for (PMOAggVO aggvo : pmoAggVOS) {
|
||||||
PMOHeadVO headvo = aggvo.getParentVO();
|
PMOHeadVO headvo = aggvo.getParentVO();
|
||||||
String tranid = headvo.getCtrantypeid();
|
String tranid = headvo.getCtrantypeid();
|
||||||
|
@ -77,13 +80,14 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> {
|
||||||
if (tranidList.size() > 0) {
|
if (tranidList.size() > 0) {
|
||||||
bSaveApproveMap = PMOBPService.getIPMOTransTypeQueryService()
|
bSaveApproveMap = PMOBPService.getIPMOTransTypeQueryService()
|
||||||
.getBSaveApproveByTranTypeIDs(tranidList.toArray(new String[0]));
|
.getBSaveApproveByTranTypeIDs(tranidList.toArray(new String[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
for (PMOAggVO aggvo : pmoAggVOS) {
|
for (PMOAggVO aggvo : pmoAggVOS) {
|
||||||
String pkOrg = aggvo.getParentVO().getPk_org();
|
String pkOrg = aggvo.getParentVO().getPk_org();
|
||||||
Integer fbillstatus = aggvo.getParentVO().getFbillstatus();
|
Integer fbillstatus = aggvo.getParentVO().getFbillstatus();
|
||||||
String tranid = aggvo.getParentVO().getCtrantypeid();
|
String tranid = aggvo.getParentVO().getCtrantypeid();
|
||||||
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||||
|
String vtrantypecode = aggvo.getParentVO().getVtrantypecode();
|
||||||
|
if(!"55A2-Cxx-01".equals(vtrantypecode)){
|
||||||
if(this.flag){
|
if(this.flag){
|
||||||
if ("C022".equals(orgCode) && 1 == fbillstatus&&aggvo.getChildrenVO()!=null && aggvo.getChildrenVO().length>0) {
|
if ("C022".equals(orgCode) && 1 == fbillstatus&&aggvo.getChildrenVO()!=null && aggvo.getChildrenVO().length>0) {
|
||||||
aggvoList.add(aggvo);
|
aggvoList.add(aggvo);
|
||||||
|
@ -93,10 +97,56 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> {
|
||||||
aggvoList.add(aggvo);
|
aggvoList.add(aggvo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//再次筛选
|
||||||
|
//2025年7月2日10点33分--新增不传--表体物料编码前三位为103时不传
|
||||||
|
//获取表体物料信息
|
||||||
|
if(aggvoList.isEmpty()){
|
||||||
return aggvoList;
|
return aggvoList;
|
||||||
}
|
}
|
||||||
|
Set<String> materialpks=new HashSet<>();
|
||||||
|
for (PMOAggVO aggvo : aggvoList) {
|
||||||
|
for (PMOItemVO item : aggvo.getChildrenVO()) {
|
||||||
|
String cbmaterialvid = item.getCmaterialvid();
|
||||||
|
materialpks.add(cbmaterialvid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(materialpks.isEmpty()){
|
||||||
|
return aggvoList;
|
||||||
|
}
|
||||||
|
//根据物料id查询物料信息
|
||||||
|
MaterialVO[] vos = NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class).queryDataByPks(materialpks.toArray(new String[0]));
|
||||||
|
//组装Map
|
||||||
|
Map<String, String> materialMap = new HashMap<>();
|
||||||
|
if(vos==null || vos.length<1){
|
||||||
|
throw new BusinessException("Failed to query material info , please check !!!");
|
||||||
|
}
|
||||||
|
for (MaterialVO vo : vos) {
|
||||||
|
String cmaterialvid = vo.getPk_material();
|
||||||
|
String cmaterialcode =vo.getCode();
|
||||||
|
materialMap.put(cmaterialvid, cmaterialcode);
|
||||||
|
}
|
||||||
|
//筛选行数据
|
||||||
|
for (PMOAggVO aggvo : aggvoList) {
|
||||||
|
List<PMOItemVO> newItems = new ArrayList<>();
|
||||||
|
PMOItemVO[] items = (PMOItemVO[]) aggvo.getChildren(PMOItemVO.class);
|
||||||
|
for (PMOItemVO item : items) {
|
||||||
|
String cmaterialvid = item.getCmaterialvid();
|
||||||
|
if (materialMap.containsKey(cmaterialvid)) {
|
||||||
|
String materialCode = materialMap.get(cmaterialvid);
|
||||||
|
if(!materialCode.startsWith("103")){
|
||||||
|
newItems.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!newItems.isEmpty()) {
|
||||||
|
aggvo.setChildren(PMOItemVO.class,newItems.toArray(new PMOItemVO[0]));
|
||||||
|
finalList.add(aggvo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finalList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送数据到RZMOM系统
|
* 推送数据到RZMOM系统
|
||||||
|
@ -174,7 +224,8 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> {
|
||||||
// bzsm varchar(400) 备注说明
|
// bzsm varchar(400) 备注说明
|
||||||
detailItem.put("bzsm", body.getVnote());
|
detailItem.put("bzsm", body.getVnote());
|
||||||
// qfbj int 签发标记 默认0;上位ERP签发后传MOM时,签发仍=0;
|
// qfbj int 签发标记 默认0;上位ERP签发后传MOM时,签发仍=0;
|
||||||
detailItem.put("qfbj", body.getFitemstatus());
|
//默认1
|
||||||
|
detailItem.put("qfbj", 1);
|
||||||
// 计划产出数量
|
// 计划产出数量
|
||||||
detailItem.put("jhsl", body.getNmmastnum().getDouble());
|
detailItem.put("jhsl", body.getNmmastnum().getDouble());
|
||||||
//jhlx int 计划类型 必填 0成品入库、1半成品入库
|
//jhlx int 计划类型 必填 0成品入库、1半成品入库
|
||||||
|
|
|
@ -3,9 +3,11 @@ package nc.bs.pu.m21.action.rule.approve;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import nc.bs.dao.BaseDAO;
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
import nc.bs.logging.Log;
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||||
import nc.impl.pubapp.pattern.rule.IRule;
|
import nc.impl.pubapp.pattern.rule.IRule;
|
||||||
|
import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService;
|
||||||
import nc.jdbc.framework.processor.ColumnProcessor;
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
||||||
import nc.pubitf.para.SysInitQuery;
|
import nc.pubitf.para.SysInitQuery;
|
||||||
import nc.vo.bd.defdoc.DefdocVO;
|
import nc.vo.bd.defdoc.DefdocVO;
|
||||||
|
@ -24,9 +26,9 @@ import nc.vo.pub.lang.UFDouble;
|
||||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||||
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
import nc.vo.pubapp.pattern.pub.SqlBuilder;
|
||||||
import nc.vo.scmpub.util.ArrayUtil;
|
import nc.vo.scmpub.util.ArrayUtil;
|
||||||
|
import nc.vo.util.CloneUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static nccloud.openapi.ic.m4c.mapping.M4cFieldsEnum.cmaterialvid;
|
import static nccloud.openapi.ic.m4c.mapping.M4cFieldsEnum.cmaterialvid;
|
||||||
|
|
||||||
|
@ -47,9 +49,10 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<OrderVO> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
OrderVO[] cloneOrderVOS = (OrderVO[]) CloneUtil.deepClone(orderVOS);
|
||||||
//检查并筛选销售出库单据为互感器公司
|
//检查并筛选销售出库单据为互感器公司
|
||||||
List<OrderVO> newOrderVOS = checkAndFilterBillSrcOrg(orderVOS);
|
List<OrderVO> newOrderVOS = checkAndFilterBillSrcOrg(cloneOrderVOS);
|
||||||
if (newOrderVOS.isEmpty()) {
|
if (newOrderVOS==null||newOrderVOS.size()<1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//推送到锐制系统
|
//推送到锐制系统
|
||||||
|
@ -62,16 +65,66 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<OrderVO> {
|
||||||
|
|
||||||
private List<OrderVO> checkAndFilterBillSrcOrg(OrderVO[] OrderVOS) throws BusinessException {
|
private List<OrderVO> checkAndFilterBillSrcOrg(OrderVO[] OrderVOS) throws BusinessException {
|
||||||
List<OrderVO> aggvoList = new ArrayList<>();
|
List<OrderVO> aggvoList = new ArrayList<>();
|
||||||
|
List<OrderVO> finalList = new ArrayList<>();
|
||||||
|
|
||||||
for (OrderVO aggvo : OrderVOS) {
|
for (OrderVO aggvo : OrderVOS) {
|
||||||
String pkOrg = aggvo.getHVO().getPk_org();
|
String pkOrg = aggvo.getHVO().getPk_org();
|
||||||
Integer forderstatus = aggvo.getHVO().getForderstatus();
|
Integer forderstatus = aggvo.getHVO().getForderstatus();
|
||||||
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||||
|
String vdef20 = aggvo.getHVO().getVdef20();
|
||||||
|
if(vdef20==null||"N".equals(vdef20)){
|
||||||
if ("C022".equals(orgCode) && 3 == forderstatus && aggvo.getBVO()!=null && aggvo.getBVO().length > 0) {
|
if ("C022".equals(orgCode) && 3 == forderstatus && aggvo.getBVO()!=null && aggvo.getBVO().length > 0) {
|
||||||
aggvoList.add(aggvo);
|
aggvoList.add(aggvo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//再次筛选
|
||||||
|
//2025年7月2日10点33分--新增不传--表体物料编码前三位为103时不传
|
||||||
|
//获取表体物料信息
|
||||||
|
if(aggvoList.isEmpty()){
|
||||||
return aggvoList;
|
return aggvoList;
|
||||||
}
|
}
|
||||||
|
Set<String> materialpks=new HashSet<>();
|
||||||
|
for (OrderVO aggvo : aggvoList) {
|
||||||
|
for (OrderItemVO item : aggvo.getBVO()) {
|
||||||
|
String cmaterialvid = item.getPk_material();
|
||||||
|
materialpks.add(cmaterialvid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(materialpks.isEmpty()){
|
||||||
|
return aggvoList;
|
||||||
|
}
|
||||||
|
//根据物料id查询物料信息
|
||||||
|
MaterialVO[] vos = NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class).queryDataByPks(materialpks.toArray(new String[0]));
|
||||||
|
//组装Map
|
||||||
|
Map<String, String> materialMap = new HashMap<>();
|
||||||
|
if(vos==null || vos.length<1){
|
||||||
|
throw new BusinessException("Failed to query material info , please check !!!");
|
||||||
|
}
|
||||||
|
for (MaterialVO vo : vos) {
|
||||||
|
String cmaterialvid = vo.getPk_material();
|
||||||
|
String cmaterialcode =vo.getCode();
|
||||||
|
materialMap.put(cmaterialvid, cmaterialcode);
|
||||||
|
}
|
||||||
|
//筛选行数据
|
||||||
|
for (OrderVO aggvo : aggvoList) {
|
||||||
|
List<OrderItemVO> newItems = new ArrayList<>();
|
||||||
|
for (OrderItemVO item : aggvo.getBVO()) {
|
||||||
|
String cmaterialvid = item.getPk_material();
|
||||||
|
if (materialMap.containsKey(cmaterialvid)) {
|
||||||
|
String materialCode = materialMap.get(cmaterialvid);
|
||||||
|
if(!materialCode.startsWith("103")){
|
||||||
|
newItems.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!newItems.isEmpty()) {
|
||||||
|
aggvo.setBVO(newItems.toArray(new OrderItemVO[0]));
|
||||||
|
finalList.add(aggvo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return finalList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送数据到睿智MOM系统
|
* 推送数据到睿智MOM系统
|
||||||
|
|
|
@ -192,9 +192,9 @@ public class AfterApprovingSynchronizeRuleMES implements IRule<SaleOrderVO> {
|
||||||
// 销售订单新增两个字段 vbdef22-->MES客户订单号 vbdef13-->MES客户订单序号
|
// 销售订单新增两个字段 vbdef22-->MES客户订单号 vbdef13-->MES客户订单序号
|
||||||
detailItem.put("customNo", body.getVbdef22()); // 客户订单号
|
detailItem.put("customNo", body.getVbdef22()); // 客户订单号
|
||||||
detailItem.put("customSN", body.getVbdef13()); // 客户订单序号
|
detailItem.put("customSN", body.getVbdef13()); // 客户订单序号
|
||||||
|
detailItem.put("remarks", body.getVrownote());
|
||||||
// 添加是否定制
|
// 添加是否定制
|
||||||
detailItem.put("customized", body.getVbdef18());
|
detailItem.put("customized", body.getVbdef18());
|
||||||
detailItem.put("remarks", null);
|
|
||||||
// 添加自定义行号
|
// 添加自定义行号
|
||||||
JSONArray properties = new JSONArray();
|
JSONArray properties = new JSONArray();
|
||||||
JSONObject property = new JSONObject();
|
JSONObject property = new JSONObject();
|
||||||
|
@ -285,3 +285,4 @@ public class AfterApprovingSynchronizeRuleMES implements IRule<SaleOrderVO> {
|
||||||
return o.toString();
|
return o.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -75,6 +76,16 @@ public class CloseSoResource extends AbstractNCCRestResource {
|
||||||
ISaleOrderQueryAPI iSaleOrderQueryAPI= NCLocator.getInstance()
|
ISaleOrderQueryAPI iSaleOrderQueryAPI= NCLocator.getInstance()
|
||||||
.lookup(ISaleOrderQueryAPI.class);
|
.lookup(ISaleOrderQueryAPI.class);
|
||||||
SaleOrderVO[] billvos = iSaleOrderQueryAPI.queryVOByIDs(ids);
|
SaleOrderVO[] billvos = iSaleOrderQueryAPI.queryVOByIDs(ids);
|
||||||
|
billvos = Arrays.stream(billvos)
|
||||||
|
.filter(vo -> vo.getParentVO().getFstatusflag() != 4)
|
||||||
|
.toArray(SaleOrderVO[]::new);
|
||||||
|
if(billvos.length == 0){
|
||||||
|
errojson.put("status", "1");
|
||||||
|
errojson.put("message", "单据已经被关闭");
|
||||||
|
errojson.put("codeList", "");
|
||||||
|
return ResultMessageUtil.toJSON(errojson);
|
||||||
|
|
||||||
|
}
|
||||||
// ISCMBatchOprContext context = new SCMBatchOprContext();
|
// ISCMBatchOprContext context = new SCMBatchOprContext();
|
||||||
// context.setInterfaceName("nc.itf.so.m30.closemanage.ISaleOrderCloseManageMaintain");
|
// context.setInterfaceName("nc.itf.so.m30.closemanage.ISaleOrderCloseManageMaintain");
|
||||||
// context.setMethodName("closeSaleOrder");
|
// context.setMethodName("closeSaleOrder");
|
||||||
|
@ -130,7 +141,22 @@ public class CloseSoResource extends AbstractNCCRestResource {
|
||||||
// 直接获取每个元素的字符串形式
|
// 直接获取每个元素的字符串形式
|
||||||
stringArray[i] = array.getString(i);
|
stringArray[i] = array.getString(i);
|
||||||
}
|
}
|
||||||
SaleOrderViewVO[] result = this.buttonClick(stringArray, "billOpen");
|
|
||||||
|
SaleOrderViewVO[] vos = queryViewByBIDs(stringArray, "");
|
||||||
|
CombineViewToAggUtil<SaleOrderVO> combineViewToAggUtil = new CombineViewToAggUtil(SaleOrderVO.class, SaleOrderHVO.class, SaleOrderBVO.class);
|
||||||
|
SaleOrderVO[] bills = (SaleOrderVO[])combineViewToAggUtil.combineViewToAgg(vos, "csaleorderid");
|
||||||
|
|
||||||
|
bills = Arrays.stream(bills)
|
||||||
|
.filter(vo -> vo.getParentVO().getFstatusflag() == 4)
|
||||||
|
.toArray(SaleOrderVO[]::new);
|
||||||
|
if(bills.length == 0){
|
||||||
|
errojson.put("status", "1");
|
||||||
|
errojson.put("message", "打开成功");
|
||||||
|
errojson.put("codeList", "");
|
||||||
|
// 返回表示操作成功的JSON字符串
|
||||||
|
return ResultMessageUtil.toJSON(errojson);
|
||||||
|
}
|
||||||
|
SaleOrderViewVO[] result = this.buttonClick(bills, "billOpen");
|
||||||
if (result.length == 0 ){
|
if (result.length == 0 ){
|
||||||
errojson.put("status", "0");
|
errojson.put("status", "0");
|
||||||
errojson.put("message", "打开失败");
|
errojson.put("message", "打开失败");
|
||||||
|
@ -172,10 +198,7 @@ public class CloseSoResource extends AbstractNCCRestResource {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static SaleOrderViewVO[] buttonClick(String [] bids, String buttonType) throws BusinessException {
|
public static SaleOrderViewVO[] buttonClick(SaleOrderVO[] bills, String buttonType) throws BusinessException {
|
||||||
SaleOrderViewVO[] vos = queryViewByBIDs(bids, "");
|
|
||||||
CombineViewToAggUtil<SaleOrderVO> combineViewToAggUtil = new CombineViewToAggUtil(SaleOrderVO.class, SaleOrderHVO.class, SaleOrderBVO.class);
|
|
||||||
SaleOrderVO[] bills = (SaleOrderVO[])combineViewToAggUtil.combineViewToAgg(vos, "csaleorderid");
|
|
||||||
ISaleOrderCloseMaintainService service=NCLocator.getInstance()
|
ISaleOrderCloseMaintainService service=NCLocator.getInstance()
|
||||||
.lookup(ISaleOrderCloseMaintainService.class);
|
.lookup(ISaleOrderCloseMaintainService.class);
|
||||||
SaleOrderViewVO[] saleOrderViewVOS= service.billOpen(bills,false);
|
SaleOrderViewVO[] saleOrderViewVOS= service.billOpen(bills,false);
|
||||||
|
|
Loading…
Reference in New Issue