委外加工入库保存openapi接口
This commit is contained in:
parent
4dd007bbf2
commit
10e7dcacd3
|
@ -0,0 +1,152 @@
|
|||
<?xml version="1.0" encoding="gb2312"?>
|
||||
<module name="SCM_IC_EJB60">
|
||||
<public>
|
||||
<!--粒劃 ⻌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m45.IAPIPurchaseInMaitain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m45.APIPurchaseInMaitainImpl</implementation>
|
||||
</component>
|
||||
<!--粒劃 ⻌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m45.IAPIPurchaseInQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m45.APIPurchaseInQueryImpl</implementation>
|
||||
</component>
|
||||
<!--莉傖ⅲ ⻌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m46.IAPIProductInMaitain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m46.APIProductInMaitainImpl</implementation>
|
||||
</component>
|
||||
<!--莉傖ⅲ ⻌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m46.IAPIProductInQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m46.APIProductInQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--[坳 ⻌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4a.IAPIGeneralInMaitain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4a.APIGeneralInMaitainImpl</implementation>
|
||||
</component>
|
||||
<!--[坳 ⻌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4a.IAPIGeneralInQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4a.APIGeneralInQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--覃畢 ⻌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4e.IAPITransInMaitain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4e.APITransInMaitainImpl</implementation>
|
||||
</component>
|
||||
<!--覃畢 ⻌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4e.IAPITransInQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4e.APITransInQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--汜莉惆煙 ⻌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4x.IAPIDiscardInMaitain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4x.APIDiscardInMaitainImpl</implementation>
|
||||
</component>
|
||||
<!--汜莉惆煙 ⻌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4x.IAPIDiscardInQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4x.APIDiscardInQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--堤踱扠ワ等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4455.IAPISapplyBillMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4455.APISapplyBillMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--堤踱扠ワ等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4455.IAPISapplyBillQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4455.APISapplyBillQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--[坳堤踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4i.IAPIGeneralOutMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4i.APIGeneralOutMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--[坳堤踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4i.IAPIGeneralOutQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4i.APIGeneralOutQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--种忮堤踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4c.IAPISaleOutMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4c.APISaleOutMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--种忮堤踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4c.IAPISaleOutQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4c.APISaleOutQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--第蹋堤踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4d.IAPIMaterialOutMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4d.APIMaterialOutMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--第蹋堤踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4d.IAPIMaterialOutQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4d.APIMaterialOutQueryImpl</implementation>
|
||||
</component>
|
||||
|
||||
<!--蛌踱等峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4k.IAPIWhsTransMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4k.APIWhsTransMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--蛌踱等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4k.IAPIWhsTransQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4k.APIWhsTransQueryIpml</implementation>
|
||||
</component>
|
||||
|
||||
<!--測菜堍煤楷⑺峎誘-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4816.IAPIPrePaidInvoiceMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4816.APIPrePaidInvoiceMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--億弇覃淕等-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4q.IAPILocadjustMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4q.APILocadjustMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--攫萸等紱釬-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4r.IAPIInvcountMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4r.APIInvcountMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--攫萸等脤戙-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m4r.IAPIInvcountQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.m4r.APIInvcountQueryImpl</implementation>
|
||||
</component>
|
||||
<!--脤戙珋湔講-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.onhand.IAPIOnhandQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.onhand.APIOnhandQueryIpml</implementation>
|
||||
</component>
|
||||
<!--脤戙褫蚚講-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.atp.IAPIATPQuery</interface>
|
||||
<implementation>nccloud.api.impl.ic.atp.ATPQueryIpml</implementation>
|
||||
</component>
|
||||
|
||||
<!--巹俋樓馱 ⻌踱等-->
|
||||
<component priority="0" singleton="true" remote="true" tx="CMT" supportAlias="true">
|
||||
<interface>nccloud.api.ic.m47.IAPISubcontInMaintain</interface>
|
||||
<implementation>nccloud.api.impl.ic.m47.APISubcontInMaintainImpl</implementation>
|
||||
</component>
|
||||
<!--巹俋樓馱 ⻌踱等-->
|
||||
</public>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="gb2312"?>
|
||||
<module>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m45.PurchaseInResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m46.ProductInResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4a.GeneralInResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4e.TransInResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4x.DiscardInResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4455.SapplyBillResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4i.GeneralOutResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4c.SaleOutResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4d.MaterialOutResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4k.WhstransResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4816.PrePaidInvoiceResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4q.LocadjustResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m4r.InvcountResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.onhand.OnhandResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.atp.ATPResource" exinfo=""/>
|
||||
</rest>
|
||||
<rest>
|
||||
<resource classname="nccloud.openapi.ic.m47.SubcontInResource" exinfo=""/>
|
||||
</rest>
|
||||
</module>
|
|
@ -0,0 +1,45 @@
|
|||
package nccloud.api.impl.ic.m47;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.itf.ic.m47.ISubcontInMaintain;
|
||||
import nc.vo.ic.m47.entity.SubcontInVO;
|
||||
import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule;
|
||||
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||
import nccloud.api.ic.m47.IAPISubcontInMaintain;
|
||||
import nccloud.api.impl.ic.m47.check.CheckSubcontInSaveValidator;
|
||||
import nccloud.api.impl.ic.m47.fill.SubcontInSaveFillValue;
|
||||
import nccloud.openapi.ic.util.ICAPILocationVOUtils;
|
||||
import nccloud.openapi.scmpub.pub.TransferCodeToPKTool;
|
||||
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Classname APISubcontInMaintainImpl
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 9:46
|
||||
* @Created by ame
|
||||
*/
|
||||
public class APISubcontInMaintainImpl implements IAPISubcontInMaintain {
|
||||
@Override
|
||||
public SubcontInVO[] save(List<Map<String, Object>> subcontInVOList) throws Exception {
|
||||
List<SubcontInVO> aggVOList = TransferMapToVOTool.transferMapToAggVO(subcontInVOList, SubcontInVO.class);
|
||||
SubcontInVO[] vos = aggVOList.toArray(new SubcontInVO[0]);
|
||||
// 设置货位序列号VO
|
||||
ICAPILocationVOUtils.setLocationVO(ICBillType.PurchaseIn.getCode(), vos);
|
||||
// 1、传入数据基本非空校验
|
||||
BillVOsCheckRule checker =
|
||||
new BillVOsCheckRule(new CheckSubcontInSaveValidator());
|
||||
checker.check(vos);
|
||||
// 2、编码翻译成pk
|
||||
aggVOList = TransferCodeToPKTool.transferAggVO(aggVOList);
|
||||
// 翻译货位
|
||||
ICAPILocationVOUtils.translate(vos);
|
||||
|
||||
new SubcontInSaveFillValue().setDefaultValue(vos);
|
||||
SubcontInVO[] insert = NCLocator.getInstance().lookup(ISubcontInMaintain.class).insert(vos);
|
||||
return insert;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package nccloud.api.impl.ic.m47.check;
|
||||
|
||||
import nc.vo.ic.m47.entity.SubcontInBodyVO;
|
||||
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
||||
import nc.vo.pub.IAttributeMeta;
|
||||
import nc.vo.pub.ISuperVO;
|
||||
import nc.vo.pub.ValidationException;
|
||||
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
|
||||
import nc.vo.pubapp.pattern.pub.MapList;
|
||||
import nc.vo.scmpub.check.vovalidate.VONullValidate;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Classname CheckSubcontInSaveValidator
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 9:54
|
||||
* @Created by ame
|
||||
*/
|
||||
public class CheckSubcontInSaveValidator extends VONullValidate {
|
||||
@Override
|
||||
public String[] getHeadNotNullFields() {
|
||||
// TODO Auto-generated method stub
|
||||
//组织,仓库,出入库类型编码
|
||||
String[] headnames =
|
||||
{
|
||||
ICPubMetaNameConst.PK_ORG, ICPubMetaNameConst.CWAREHOUSEID, ICPubMetaNameConst.VTRANTYPECODE
|
||||
};
|
||||
return headnames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBodyNotNullFields() {
|
||||
String[] bodynames = {
|
||||
ICPubMetaNameConst.CMATERIALVID, ICPubMetaNameConst.NSHOULDASSISTNUM
|
||||
// , ICPubMetaNameConst.CASTUNITID
|
||||
};
|
||||
return bodynames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapList<String, String> getMultiBodyNotNullFields() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void otherCheck(AbstractBill billVO, List<ValidationException> exceptions) {
|
||||
// check(billVO, null, new String[]{
|
||||
// ICPubMetaNameConst.NNUM,
|
||||
// SubcontInBodyVO.NORIGTAXMNY
|
||||
// }, exceptions);
|
||||
}
|
||||
|
||||
protected void check(AbstractBill bill, String[] headnullkeys,
|
||||
String[] bodynullkeys, List<ValidationException> exceptions) {
|
||||
// 检查表头
|
||||
|
||||
// 检查表体
|
||||
checkBody(bill, bodynullkeys, exceptions);
|
||||
}
|
||||
|
||||
private void checkBody(AbstractBill bill, String[] bodynullkeys,
|
||||
List<ValidationException> exceptions) {
|
||||
if (bodynullkeys != null) {
|
||||
int row = 1;
|
||||
ISuperVO[] supervos = bill.getChildren(SubcontInBodyVO.class);
|
||||
Set<String> messagelist = new HashSet<String>();
|
||||
for (ISuperVO vo : supervos) {
|
||||
Set<String> nullbodyset = new HashSet<String>();
|
||||
for (String bodynullkey : bodynullkeys) {
|
||||
if (vo.getAttributeValue(bodynullkey) == null) {
|
||||
IAttributeMeta attribute = vo.getMetaData().getAttribute(bodynullkey);
|
||||
nullbodyset.add(attribute.getColumn().getLabel());
|
||||
}
|
||||
}
|
||||
if (nullbodyset.size() > 0 && nullbodyset.size() == bodynullkeys.length) {
|
||||
String message =
|
||||
"表体第" + row + "行以下字段不能同时为空:" + getshow(nullbodyset, "、");/*-=notranslate=-*/
|
||||
messagelist.add(message);
|
||||
}
|
||||
row++;
|
||||
}
|
||||
if (messagelist.size() > 0) {
|
||||
exceptions.add(new ValidationException(getshow(messagelist, "\r\n")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getshow(Set<String> nullfields, String partition) {
|
||||
StringBuffer str = new StringBuffer();
|
||||
for (String field : nullfields) {
|
||||
str.append(field + partition);
|
||||
}
|
||||
str.deleteCharAt(str.length() - 1);
|
||||
return str.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package nccloud.api.impl.ic.m47.fill;
|
||||
|
||||
import nc.bs.ic.pub.base.ICRule;
|
||||
import nc.vo.ic.m47.entity.SubcontInVO;
|
||||
import nc.vo.ic.pub.rule.ICBodyNshouldassistnumCal;
|
||||
import nc.vo.ic.pub.rule.ICCountryInfoFillRule;
|
||||
import nc.vo.ic.pub.rule.ICCvendoridFillRule;
|
||||
import nc.vo.ic.pub.rule.ICCwarehouseidFillRule;
|
||||
import nc.vo.ic.pub.rule.ICMaterialFullRule;
|
||||
import nc.vo.ic.pub.rule.ICNchangestdrateFillRule;
|
||||
import nc.vo.ic.pub.rule.ICNtaxrateFillRule;
|
||||
import nc.vo.ic.pub.rule.ICOrgFillRule;
|
||||
import nc.vo.ic.pub.rule.ICTranstypeFillRule;
|
||||
import nc.vo.ic.pub.rule.processer.ICAroundProcesser;
|
||||
import nccloud.api.impl.ic.m47.rule.Choose47DefaultFillRule;
|
||||
|
||||
/**
|
||||
* @Classname SubcontInSaveFillValue
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 10:10
|
||||
* @Created by ame
|
||||
*/
|
||||
public class SubcontInSaveFillValue {
|
||||
public void setDefaultValue(SubcontInVO[] vos) {
|
||||
ICAroundProcesser<SubcontInVO> processer =
|
||||
new ICAroundProcesser<SubcontInVO>();
|
||||
|
||||
// 组织
|
||||
ICRule<SubcontInVO> rule = new ICOrgFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 国家
|
||||
rule = new ICCountryInfoFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 表头供应商
|
||||
rule = new ICCvendoridFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 仓库
|
||||
rule = new ICCwarehouseidFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 交易类型
|
||||
rule = new ICTranstypeFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 物料
|
||||
rule = new ICMaterialFullRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 财务组织等默认值填充
|
||||
rule = new Choose47DefaultFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 设置汇率
|
||||
rule = new ICNchangestdrateFillRule<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
// 数量,金额,汇率,税率处理
|
||||
rule = new ICBodyNshouldassistnumCal<SubcontInVO>();
|
||||
processer.addFillvalueRule(rule);
|
||||
|
||||
processer.fillvalue(vos);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package nccloud.api.impl.ic.m47.rule;
|
||||
|
||||
import nc.bs.ic.pub.base.ICRule;
|
||||
import nc.pubitf.uapbd.CurrencyRateUtilHelper;
|
||||
import nc.vo.ic.general.define.ICBillFlag;
|
||||
import nc.vo.ic.m47.entity.SubcontInBodyVO;
|
||||
import nc.vo.ic.m47.entity.SubcontInHeadVO;
|
||||
import nc.vo.ic.m47.entity.SubcontInVO;
|
||||
import nc.vo.ic.org.OrgInfoQuery;
|
||||
import nc.vo.ic.pub.define.ICPubMetaNameConst;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.pubapp.AppContext;
|
||||
import nc.vo.pubapp.pattern.pub.PubAppTool;
|
||||
|
||||
/**
|
||||
* @Classname Choose47DefaultFillRule
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 10:19
|
||||
* @Created by ame
|
||||
*/
|
||||
public class Choose47DefaultFillRule<E extends SubcontInVO> extends ICRule<E> {
|
||||
|
||||
@Override
|
||||
public void process(E[] vos) {
|
||||
for (E billvo : vos) {
|
||||
// 填充默认值
|
||||
setDefultInfo(billvo);
|
||||
// 设置财务组织,币种
|
||||
setFanaceorgValue(billvo);
|
||||
}
|
||||
}
|
||||
|
||||
private void setFanaceorgValue(SubcontInVO vo) {
|
||||
SubcontInHeadVO head = vo.getHead();
|
||||
String pk_org = head.getPk_org();
|
||||
if (pk_org != null) {
|
||||
String cfinanceoid =
|
||||
new OrgInfoQuery().getFinanceOrgIDByCalBodyID(pk_org);
|
||||
String cfinancevid =
|
||||
new OrgInfoQuery().getFinanceOrgVIDByCalBodyID(pk_org);
|
||||
String pk_orgv = head.getPk_org_v();
|
||||
String cwareid = head.getCwarehouseid();
|
||||
|
||||
String ccurrencyid = CurrencyRateUtilHelper.getInstance()
|
||||
.getLocalCurrtypeByOrgID(cfinanceoid);
|
||||
SubcontInBodyVO[] bodys = vo.getBodys();
|
||||
for (SubcontInBodyVO body : bodys) {
|
||||
|
||||
// 有来源的单据行不设置默认值,只有自制入才设置默认值
|
||||
String csourcebillbid = body.getCsourcebillbid();
|
||||
if (!PubAppTool.isNull(csourcebillbid)) {
|
||||
continue;
|
||||
}
|
||||
// 币种
|
||||
if (null == body.getAttributeValue(SubcontInBodyVO.CORIGCURRENCYID)) {
|
||||
body.setAttributeValue(SubcontInBodyVO.CORIGCURRENCYID, ccurrencyid);// TODO
|
||||
body.setAttributeValue(SubcontInBodyVO.NCHANGESTDRATE, UFDouble.ONE_DBL);
|
||||
}
|
||||
body.setAttributeValue(SubcontInBodyVO.CCURRENCYID, ccurrencyid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setDefultInfo(SubcontInVO vo) {
|
||||
// 单据状态
|
||||
vo.getHead().setAttributeValue(ICPubMetaNameConst.FBILLFLAG,
|
||||
ICBillFlag.FREE.value());
|
||||
UFDate busdate = AppContext.getInstance().getBusiDate();
|
||||
String pk_group = (String) vo.getParentVO()
|
||||
.getAttributeValue(ICPubMetaNameConst.PK_GROUP);
|
||||
// 单据日期
|
||||
if (null == vo.getParentVO()
|
||||
.getAttributeValue(ICPubMetaNameConst.DBILLDATE)) {
|
||||
vo.getParentVO().setAttributeValue(ICPubMetaNameConst.DBILLDATE, busdate);
|
||||
}
|
||||
// 制单人
|
||||
if (null == vo.getParentVO()
|
||||
.getAttributeValue(ICPubMetaNameConst.OPERATOR)) {
|
||||
vo.getParentVO().setAttributeValue(ICPubMetaNameConst.OPERATOR,
|
||||
AppContext.getInstance().getPkUser());
|
||||
}
|
||||
// 集团
|
||||
if (null == pk_group) {
|
||||
pk_group = AppContext.getInstance().getPkGroup();
|
||||
vo.getParentVO().setAttributeValue(ICPubMetaNameConst.PK_GROUP, pk_group);
|
||||
}
|
||||
for (SubcontInBodyVO body : vo.getBodys()) {
|
||||
// 入库日期
|
||||
UFDate dbizdate = body.getDbizdate();
|
||||
if (null == dbizdate) {
|
||||
body.setDbizdate(busdate);
|
||||
}
|
||||
body.setPk_org(vo.getParentVO().getPk_org());
|
||||
body.setPk_org_v(vo.getParentVO().getPk_org_v());
|
||||
body.setPk_group(pk_group);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package nccloud.api.ic.m47;
|
||||
|
||||
import nc.vo.ic.m47.entity.SubcontInVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Classname IAPISubcontInMaintain
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 9:45
|
||||
* @Created by ame
|
||||
*/
|
||||
public interface IAPISubcontInMaintain {
|
||||
|
||||
SubcontInVO[] save(List<Map<String, Object>> subcontInVOList) throws Exception;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package nccloud.openapi.ic.m47;
|
||||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.vo.ic.m47.entity.SubcontInVO;
|
||||
import nc.vo.scmpub.res.billtype.ICBillType;
|
||||
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
||||
import nccloud.api.ic.m47.IAPISubcontInMaintain;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.openapi.ic.util.ICAPILocationVOUtils;
|
||||
import nccloud.openapi.scmpub.pub.NCCPubRestResource;
|
||||
import nccloud.openapi.scmpub.pub.TransferMapToVOTool;
|
||||
import org.json.JSONString;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Classname SubcontInResource
|
||||
* @Description TODO
|
||||
* @Version 1.0.0
|
||||
* @Date 2025/5/15 8:54
|
||||
* @Created by sdlizheng
|
||||
*/
|
||||
@Path("ic/subcontin")
|
||||
public class SubcontInResource extends NCCPubRestResource {
|
||||
|
||||
private static String HEADTABLE = "ic_subcontin_h";
|
||||
private static String BODYTABLE = "ic_subcontin_b";
|
||||
|
||||
@POST
|
||||
@Path("operation/save")
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString save(Map<String, Object> param) {
|
||||
List<Map<String, Object>> paramList = new ArrayList();
|
||||
paramList.add(param);
|
||||
JSONString result = this.save(paramList);
|
||||
return result;
|
||||
}
|
||||
@POST
|
||||
@Path("save")
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString save(List<Map<String, Object>> paramList){
|
||||
try {
|
||||
for (Map<String, Object> map : paramList) {
|
||||
if (!map.containsKey(HEADTABLE) || !map.containsKey(BODYTABLE)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
}
|
||||
SubcontInVO[] save = NCLocator.getInstance().lookup(IAPISubcontInMaintain.class).save(paramList);
|
||||
return ResultMessageUtil.toJSON(save, "保存成功");
|
||||
}catch (Exception e){
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue