ic_后端_材料出库单列表汇总打印_V3

This commit is contained in:
李正@用友 2025-06-30 14:34:47 +08:00 committed by mzr
parent 7cbc4cd0fb
commit 8f89aa5915
3 changed files with 292 additions and 446 deletions

View File

@ -1,35 +1,27 @@
package nccloud.web.ic.pub.action;
import com.alibaba.fastjson.JSON;
import nc.vo.ic.general.define.ICBillVO;
import nc.vo.pubapp.res.NCModule;
import nccloud.base.reflect.NCClass;
import nccloud.dto.ic.pub.entity.GeneralSumPrintInfo;
import nccloud.framework.core.io.WebFileType;
import nccloud.framework.core.json.IJson;
import nccloud.framework.web.container.SessionContext;
import nccloud.framework.web.json.JsonFactory;
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.extbillcard.ExtBillCard;
import nccloud.pubitf.platform.print.IPrintInfo;
import nccloud.pubitf.platform.print.vo.BatchPrintInfo;
import nccloud.web.platform.print.AbstractPrintAction;
import java.util.ArrayList;
import java.util.List;
import nccloud.pubitf.uap.print.vo.ExtendsBatchPrintVO;
import nccloud.uap.print.action.AbstractNoPreviewPrintAction;
/**
* @description ³öÈë¿â»ã×Ü´òÓ¡
* @author zhegnxinm
* @date 2018-12-16 ÉÏÎç10:48:39
* @version ncc1.0
*/
public class GeneralSumPrintAction extends AbstractPrintAction {
public class GeneralSumPrintAction extends AbstractNoPreviewPrintAction {
@Override
public IPrintInfo convertPrintInfo(BatchPrintInfo info) {
public IPrintInfo convertPrintInfo(ExtendsBatchPrintVO info) {
IJson json = JsonFactory.create();
GeneralSumPrintInfo newinfo = json.fromJson(info.getUserjson(), GeneralSumPrintInfo.class);
newinfo.setFilename((info.getFilename() == null) ? "download-"
@ -38,45 +30,14 @@ public class GeneralSumPrintAction extends AbstractPrintAction {
String appcode = info.getAppcode();
String billcardStr = newinfo.getBillcard();
//注释此代码如需放开请修改前端"./src/ic/ic/components/sumPrintModal/index.js"里扩展的列表汇总billcard传值
// BillCard billcard = json.fromJson(billcardStr,BillCard.class);
if (appcode == null) {
appcode = SessionContext.getInstance().getAppcode();
}
ICBillVO bill = null;
if(appcode.equals("400800800")){
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.setIds(info.getOids());
newinfo.setNodeKey(info.getNodekey());
NCClass printServiceClazz = new NCClass();
printServiceClazz.setModule(getPrintServiceModule());
printServiceClazz.setName(getPrintServiceName());
newinfo.setPrintServiceClazz(printServiceClazz);
newinfo.setPrintTemplateID(info.getPrintTemplateID());
//ĹĐśĎbillcardĘǡńÎŞĘý×é
if(billcardStr.startsWith("[")){
BillCard[] billcardList = json.fromJson(billcardStr,BillCard[].class);
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);
}
// BillCardConvertProcessor processor = new BillCardConvertProcessor();
// ICBillVO bill = processor.fromBillCard(billcard);
newinfo.setAppcode(appcode);
newinfo.setIds(info.getOids());
newinfo.setNodeKey(info.getNodekey());
@ -85,23 +46,20 @@ public class GeneralSumPrintAction extends AbstractPrintAction {
printServiceClazz.setName(getPrintServiceName());
newinfo.setPrintServiceClazz(printServiceClazz);
newinfo.setPrintTemplateID(info.getPrintTemplateID());
newinfo.setData(new Object[] { bill });
// newinfo.setData(new Object[] { bill });
newinfo.setRealData("true");
newinfo.setTotalPage(info.getTotalPage());
return newinfo;
}
@Override
public String getPrintServiceModule() {
return NCModule.IC.getName();
}
@Override
public String getPrintServiceName() {
return "nccloud.pubimpl.ic.inbound.generalin.operator.GeneralSumPrintOperator";
}
public WebFileType getWebFileType() {
return WebFileType.Pdf;
}
}

View File

@ -7,11 +7,14 @@ import java.util.TimeZone;
import nc.bs.framework.common.InvocationInfoProxy;
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.IMetaDataDataSource;
import nc.vo.ic.general.define.ICBillBodyVO;
import nc.vo.ic.general.define.ICBillVO;
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.pub.BusinessException;
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.util.DefaultVOMerger;
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.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.outbound.materialout.operator.MaterialOutVOPrecisionHandler;
import nccloud.pubimpl.ic.outbound.saleout.operator.SaleOutVOPrecisionHandler;
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
* @date 2018-12-16 上午10:48:39
* @version ncc1.0
* @description 出入库汇总打印
* @date 2018-12-16 上午10:48:39
*/
public class GeneralSumPrintOperator extends AbstractPrintService{
/**
* 打印前处理类精度
*/
private IBeforePrintDataProcess processor;
public class GeneralSumPrintOperator extends BaseMetaPrintTimesService {
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
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();
// 得到分组字段
ICBillVO cvo = (ICBillVO) datas[0];
@ -100,24 +73,23 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
saGroupField = processSaGroupField(saGroupField);
DefaultVOMerger dvomerger = new DefaultVOMerger();
dvomerger.setGroupingAttr(saGroupField);
// 得到Summing字段
String[] saSummingField = null;
if (cvo.getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {
saSummingField = getSummingField((Boolean) alGroupBy.get(2));
} else {
saSummingField = getSummingField((Boolean) alGroupBy.get(2),printInfo.getInOutType());
saSummingField = getSummingField((Boolean) alGroupBy.get(2), printInfo.getInOutType());
}
dvomerger.setSummingAttr(saSummingField);
//2025年6月27日11点22分 --扩展材料出库列表添加汇总合并
if(cvo.getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())){
this.dealSumInfoDev(dvomerger,datas);
}else{
if (cvo.getHead().getBillType().getCode().equals(ICBillType.MaterialOut.getCode())) {
this.dealSumInfoDev(dvomerger, datas);
} else {
// 对表体分组
try {
ICBillBodyVO[] itemvosnew = (ICBillBodyVO[]) dvomerger.mergeByGroup(cvo
.getBodys());
reSetPrice(itemvosnew,cvo.getHead().getBillType().getCode());
reSetPrice(itemvosnew, cvo.getHead().getBillType().getCode());
cvo.setChildrenVO(itemvosnew);
} catch (BusinessException e) {
ExceptionUtils.wrappException(e);
@ -127,7 +99,7 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
}
//是否敏感时区
boolean isSensitive = InvocationInfoProxy.getInstance().getSensitiveTimeZone();
if(isSensitive) {
if (isSensitive) {
datas = this.processTimeZone(datas);
}
// 组装数据源
@ -138,12 +110,12 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
private void dealSumInfoDev(DefaultVOMerger dvomerger, Object[] datas) {
// 对表体分组
try {
for(Object data : datas){
for (Object data : datas) {
ICBillVO cvo = (ICBillVO) data;
ICBillBodyVO[] itemvosnew = (ICBillBodyVO[]) dvomerger.mergeByGroup(cvo
.getBodys());
reSetPrice(itemvosnew,cvo.getHead().getBillType().getCode());
reSetPrice(itemvosnew, cvo.getHead().getBillType().getCode());
cvo.setChildrenVO(itemvosnew);
//精度处理
this.processData(cvo);
@ -153,223 +125,224 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
}
}
@Override
public Object[] getDatas(String[] ids) {
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);
PurchaseInVOPrecisionHandler handler = new PurchaseInVOPrecisionHandler(vos);
handler.processVos(scale, totalScale);
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);
PurchaseInVOPrecisionHandler handler = new PurchaseInVOPrecisionHandler(mvos);
handler.processVos(scale, totalScale);
return mvos;
}
}
/**
* 处理打印多时区
*
* @param datas
* @return
* 获取分组字段 方法功能描述
* <p>
* <b>参数说明</b>
*
* @return <p>
* @author zhangsui
* @time 2011-7-19 上午08:37:31
* @since 6.0
*/
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);
protected String[] getGroupFields() {
return new String[]{ICPubMetaNameConst.CMATERIALVID,
ICPubMetaNameConst.VBATCHCODE, ICPubMetaNameConst.CASTUNITID,
"vfree0", ICPubMetaNameConst.CLOCATIONID,
ICPubMetaNameConst.CVENDORID};
}
/**
* 通过选择框最终确定的分组字段 方法功能描述
* <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]);
}
} else if (data instanceof AbstractDataView) {
AbstractDataView view = (AbstractDataView) data;
this.processViewVOTimeZone(view, timeZone);
}
for (int i = 1; i < 11; i++) {
newfields.add("vfree" + i);
}
return newfields.toArray(new String[0]);
}
return datas;
return saGroupField;
}
/**
* 获取汇总字段 方法功能描述
* <p>
* <b>参数说明</b>
* 材料出库调用
*
* 处理视图VO的多时区
*
* @param view
* @param timeZone
*
* @param isselected
* @return <p>
* @author zhangsui
* @time 2011-7-19 上午08:35:12
* @since 6.0
*/
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);
}
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 {
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NCOSTMNY};
}
return saSummingField;
}
/**
* 处理SuperVO的多时区
*
* @param vo
* @param timeZone
* 获取汇总字段 方法功能描述采购入库调用
* <p>
* <b>参数说明</b>
*
* @param isselected
* @return <p>
* @author zhangsui
* @time 2011-7-19 上午08:35:12
* @since 6.0
*/
private void processSuperVOTimeZone(SuperVO vo, TimeZone timeZone) {
String[] attributeNames = vo.getAttributeNames();
for (String name : attributeNames) {
Object value = vo.getAttributeValue(name);
if (value == null) {
continue;
protected String[] getSummingField(Boolean isselected, String type) {
String[] saSummingField = null;
if ("in".equals(type)) {
if ((isselected).booleanValue() == true) {
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
ICPubMetaNameConst.NSHOULDASSISTNUM,
MetaNameConst.NMNY,
/**
* 杭州锦江集团有限公司:采购入库汇总打印时部分字段没汇总
*/
MetaNameConst.NORIGMNY, MetaNameConst.NCALCOSTMNY,
MetaNameConst.NTAXMNY, MetaNameConst.NORIGTAXMNY};
} else {
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NMNY};
}
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);
} else if ("out".equals(type)) {
if ((isselected).booleanValue() == true) {
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
ICPubMetaNameConst.NSHOULDASSISTNUM, MetaNameConst.NMNY};
} else {
saSummingField = new String[]{ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NMNY
/*
* 返回打印模板中可合并计算的字段
* 现客户合并计算norigtaxmny(原币价税合计)的和需要添加该字段的返回
*/
, MetaNameConst.NORIGMNY, MetaNameConst.NTAXMNY,
MetaNameConst.NORIGTAXMNY};
}
}
return saSummingField;
}
/**
*
* 组装数据源
*
* @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
public String[] getItemValuesByExpress(String itemExpress) {
return null;
}
@Override
public boolean isNumber(String itemExpress) {
return false;
}
@Override
public String[] getDependentItemExpressByExpress(String itemExpress) {
return null;
}
@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);
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 "当前数据已被删除,请到列表页面刷新!"*/);
}
return printData;
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);
}
}
/**
*
* @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>
* <b>参数说明</b>
*
* @param itemvosnew
* <p>
* @since 6.0
* @param itemvosnew <p>
* @author zhangsui
* @time 2011-7-19 上午08:35:43
* @since 6.0
*/
protected void reSetPrice(ICBillBodyVO[] itemvosnew,String type) {
protected void reSetPrice(ICBillBodyVO[] itemvosnew, String type) {
if (itemvosnew != null) {
UFDouble udNum = null;
UFDouble udMny = null;
@ -392,153 +365,5 @@ public class GeneralSumPrintOperator extends AbstractPrintService{
}
}
}
/**
* 获取汇总字段 方法功能描述采购入库调用
* <p>
* <b>参数说明</b>
*
* @param isselected
* @return <p>
* @since 6.0
* @author zhangsui
* @time 2011-7-19 上午08:35:12
*/
protected String[] getSummingField(Boolean isselected, String type) {
String[] saSummingField = null;
if ("in".equals(type)) {
if ((isselected).booleanValue() == true) {
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
ICPubMetaNameConst.NSHOULDASSISTNUM,
MetaNameConst.NMNY,
/**
* 杭州锦江集团有限公司:采购入库汇总打印时部分字段没汇总
*/
MetaNameConst.NORIGMNY, MetaNameConst.NCALCOSTMNY,
MetaNameConst.NTAXMNY, MetaNameConst.NORIGTAXMNY };
} else {
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NMNY };
}
} else if ("out".equals(type)) {
if ((isselected).booleanValue() == true) {
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, ICPubMetaNameConst.NASSISTNUM,
ICPubMetaNameConst.NSHOULDASSISTNUM, MetaNameConst.NMNY };
} else {
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NMNY
/*
* 返回打印模板中可合并计算的字段
* 现客户合并计算norigtaxmny(原币价税合计)的和需要添加该字段的返回
*/
, MetaNameConst.NORIGMNY, MetaNameConst.NTAXMNY,
MetaNameConst.NORIGTAXMNY };
}
}
return saSummingField;
}
/**
* 获取汇总字段 方法功能描述
* <p>
* <b>参数说明</b>
* 材料出库调用
* @param isselected
* @return <p>
* @since 6.0
* @author zhangsui
* @time 2011-7-19 上午08:35:12
*/
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 {
saSummingField = new String[] { ICPubMetaNameConst.NSHOULDNUM,
ICPubMetaNameConst.NNUM, MetaNameConst.NCOSTMNY };
}
return saSummingField;
}
/**
* 通过选择框最终确定的分组字段 方法功能描述
* <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 };
}
}

View File

@ -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;
}
}