Merge remote-tracking branch 'origin/main'

This commit is contained in:
张明 2025-05-29 08:49:30 +08:00
commit 0a1bc358e6
10 changed files with 370 additions and 59 deletions

5
erm/component.xml Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding='gb2312'?>
<module displayname="erm" name="erm">
<dependencies>
</dependencies>
</module>

View File

@ -0,0 +1,140 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package nccloud.web.erm.action.billmanage;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import nc.bs.logging.Log;
import nc.nccloud.util.erm.expenseaccount.Func;
import nc.vo.ep.bx.JKBXHeaderVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nccloud.dto.baseapp.querytree.dataformat.Condition;
import nccloud.dto.baseapp.querytree.dataformat.PageInfo;
import nccloud.dto.baseapp.querytree.dataformat.QueryCondition;
import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO;
import nccloud.dto.baseapp.querytree.dataformat.Value;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.core.json.IJson;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;
import nccloud.framework.web.ui.model.row.Row;
import nccloud.framework.web.ui.pattern.grid.Grid;
import nccloud.framework.web.ui.pattern.grid.GridOperator;
import nccloud.pubitf.erm.billmanage.IBillManageService;
import nccloud.web.erm.action.lic.AbstractLicAction;
import nccloud.web.erm.util.expenseaccount.initbills.InitBillsUtil;
import org.apache.commons.lang3.StringUtils;
public class BillQueryAction extends AbstractLicAction {
private Log log = Log.getInstance(this.getClass());
public BillQueryAction() {
}
public Object doRealAction(IRequest request) {
JKBXHeaderVO[] jkbxvos = new JKBXHeaderVO[0];
Grid grid = new Grid();
PageInfo pageInfo = null;
try {
if (request == null) {
ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("20110011makebill", "020110011makebill-0000"));
}
IJson json = JsonFactory.create();
String read = request.read();
if (StringUtils.isEmpty(read)) {
ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("20110011makebill", "020110011makebill-0000"));
}
QueryTreeFormatVO info = (QueryTreeFormatVO)json.fromJson(read, QueryTreeFormatVO.class);
if (null == info) {
ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("20110011makebill", "020110011makebill-0000"));
}
if (info.getUserdefObj() != null) {
QueryCondition queryCon = new QueryCondition();
List<Condition> conditions = new ArrayList();
for(Map.Entry<String, Object> entry : info.getUserdefObj().entrySet()) {
Condition con = new Condition();
con.setField((String)entry.getKey());
Value value = new Value();
value.setFirstvalue((String)entry.getValue());
con.setValue(value);
conditions.add(con);
}
queryCon.setConditions(conditions);
info.setQuerycondition(queryCon);
}
IBillManageService billManageService = (IBillManageService)ServiceLocator.find(IBillManageService.class);
String[] pks = null;
if (info.getQuerycondition() != null) {
jkbxvos = (JKBXHeaderVO[])billManageService.queryBillInfoByPage(info).toArray(jkbxvos);
} else {
ExceptionUtils.wrapBusinessException("请传入查询条件");
}
if (jkbxvos == null || jkbxvos.length == 0) {
return null;
}
pks = new String[jkbxvos.length];
for(int i = 0; i < jkbxvos.length; ++i) {
if (jkbxvos[i] != null) {
pks[i] = jkbxvos[i].getPk_jkbx();
}
}
GridOperator go = new GridOperator("201104DJCX_LIST");
grid = go.toGrid(jkbxvos);
InitBillsUtil.proGridDigit(grid);
this.proGridDjztAndSpr(grid, pks);
pageInfo = info.getPageInfo();
} catch (Exception e) {
this.log.error(e);
ExceptionUtils.wrapException(e);
}
JSONObject jsonObj = new JSONObject();
jsonObj.put("pageInfo", pageInfo);
jsonObj.put("data", grid);
return jsonObj;
}
private void proGridDjztAndSpr(Grid grid, String[] pks) throws Exception {
IBillManageService service = (IBillManageService)ServiceLocator.find(IBillManageService.class);
Map<String, String> busiid_username = service.qryCurApproveman(Arrays.asList(pks));
Row[] rows = grid.getModel().getRows();
for(int i = 0; i < rows.length; ++i) {
String pk_billtype = Func.toString(rows[i].getCell("pk_billtype").getValue());
String djlxbm = Func.toString(rows[i].getCell("djlxbm").getValue());
if (!"264a".equalsIgnoreCase(djlxbm) && !"261X".equalsIgnoreCase(pk_billtype) && !"262X".equalsIgnoreCase(pk_billtype)) {
if ("3".equals(Func.toString(rows[i].getCell("djzt").getValue()))) {
rows[i].getCell("djzt").setDisplay(NCLangRes4VoTransl.getNCLangRes().getStrByID("20110012billmanage", "020110012billmanage-0002"));
}
} else if ("3".equals(Func.toString(rows[i].getCell("djzt").getValue()))) {
rows[i].getCell("djzt").setDisplay(NCLangRes4VoTransl.getNCLangRes().getStrByID("20110012billmanage", "020110012billmanage-0000"));
}
if (busiid_username != null && busiid_username.size() > 0) {
String pk_jkbx = Func.toString(rows[i].getCell("pk_jkbx").getValue());
if (!StringUtils.isEmpty((CharSequence)busiid_username.get(pk_jkbx))) {
rows[i].getCell("approver").setDisplay((String)busiid_username.get(pk_jkbx));
}
}
}
}
}

View File

@ -136,6 +136,17 @@ public class WrResource extends AbstractNCCRestResource {
vo.setChildren(WrItemVO.class, items.toArray(new WrItemVO[0]));
voList.add(vo);
IAPIWrMaintain server = NCLocator.getInstance().lookup(IAPIWrMaintain.class);
List<AggWrVO> aggWrVOS = TransferCodeToPKTool.transferAggVO(voList);
//翻译报告类型
BaseDAO baseDAO = new BaseDAO();
for (AggWrVO aggWrVO : aggWrVOS) {
List<BilltypeVO> collection = (List<BilltypeVO>) baseDAO.retrieveByClause(BilltypeVO.class, " pk_billtypecode='" + aggWrVO.getParentVO().getVtrantypecode() + "'");
if(collection==null||collection.size()==0){
throw new BusinessException("翻译报告类型失败,检查报告类型编码【"+aggWrVO.getParentVO().getVtrantypecode()+"");
}
aggWrVO.getParentVO().setVtrantypeid(collection.get(0).getPk_billtypeid());
aggWrVO.getParentVO().setDbilldate(new UFDate());
}
AggWrVO[] aggvos = server.saveAndApprove(voList.toArray(new AggWrVO[0]));
boolean successFlag = true;
StringBuilder errMsg = new StringBuilder();

View File

@ -11,6 +11,7 @@ import nc.bs.mmpsc.pscsettle.rule.SettleStatusUpdateRule;
import nc.bs.mmpsc.pscsettle.rule.approve.FillAuditInfoRule;
import nc.bs.mmpsc.pscsettle.rule.unapprove.FilterAdjustedRule;
import nc.bs.mmpub.rule.MMVOSagaFrozenValidateRule;
import nc.bs.mmpub.rule.MMVOToAPRule;
import nc.impl.pubapp.pattern.data.bill.template.UpdateBPTemplate;
import nc.impl.pubapp.pattern.rule.IFilterRule;
import nc.impl.pubapp.pattern.rule.IRule;
@ -30,6 +31,9 @@ public class SettleApproveBP {
}
private void addAfterRule(CompareAroundProcesser<AggSettleVO> processer, AggSettleVO[] originBills) {
IRule<AggSettleVO> var5 = new MMVOToAPRule(originBills);
processer.addAfterRule(var5);
}
private void addBeforeRule(CompareAroundProcesser<AggSettleVO> processer) {

View File

@ -0,0 +1,36 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package nc.bs.mmpub.rule;
import nc.bs.mmpsc.pscsettle.bp.SettleToAPBP;
import nc.impl.pubapp.pattern.data.vo.tool.VOConcurrentTool;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.util.mmf.framework.base.MMArrayUtil;
import nc.vo.mmpsc.pscsettle.entity.AggSettleVO;
public class MMVOToAPRule implements IRule<AggSettleVO> {
public MMVOToAPRule(AggSettleVO[] originBills) {
}
public void process(AggSettleVO[] vos) {
if (!MMArrayUtil.isEmpty(vos)) {
(new VOConcurrentTool()).checkTSWithDB(vos[0].getItemVO());
SettleToAPBP bp = new SettleToAPBP();
AggSettleVO[] retBills = bp.toAP(vos);
if (retBills.length>0){
System.out.println(1);
}
}
}
protected String getCheckField() {
return null;
}
}

View File

@ -320,17 +320,24 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
if (null == originVos || originVos.length == 0) {
ExceptionUtils.wrappBusinessException("根据传入数据未匹配到相关数据");
}
Map<String, String> delMap = new HashMap<>();
Map<String, List<String>> delBipMap = new HashMap<>();
for (Map<String, Object> objectMap : paramList) {
Map<String, Object> headdata = (Map<String, Object>) objectMap.get(HEADTABLE);
delMap.put(headdata.get("csaleorderid") + "", headdata.getOrDefault("delId", "") + "");
String csaleorderid = headdata.get("csaleorderid") + "";
List<Object> bodyArr = (List<Object>) objectMap.get(BODYTABLE);
List<String> delIds = new ArrayList<>();
for (Object body : bodyArr) {
Map<String, Object> bodydata = (Map<String, Object>) body;
if ((bodydata.getOrDefault("vbdef11", "") + "").isEmpty()) {
// 如果vbdef11为空则标记为新增行
bodydata.put("status", "add");
}
if (!(bodydata.getOrDefault("csaleorderbid", "") + "").isEmpty()) {
delIds.add(bodydata.get("csaleorderbid") + "");
}
}
if (!delIds.isEmpty()) {
delBipMap.put(csaleorderid, delIds);
}
}
@ -356,20 +363,17 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
SaleOrderVO bipVo = vosMap.get(primaryKey);
// 设置单据状态
hvo.setStatus(VOStatus.UPDATED);
String delId = delMap.get(primaryKey);
List<String> bipIds = delBipMap.get(primaryKey);
// 比较combinBillVOs中的BVO和vos中的BVO
for (SaleOrderBVO bvo : vo.getChildrenVO()) {
bvo.setStatus(VOStatus.UPDATED);
bvo.setStatus(VOStatus.DELETED);
String csaleorderbid = bvo.getCsaleorderbid();
// 设置删除的物料行的状态,在bip传的数据中找不到
if (StringUtils.isNotEmpty(delId)) {
String[] delIds = delId.split(",", -1);
String vbdef11 = bvo.getVbdef11();
// 如果BIP合同销售订单的主键在删除的数组中则设置为删除状态
if (Arrays.asList(delIds).contains(vbdef11)) {
bvo.setStatus(VOStatus.DELETED);
NCCForUAPLogger.debug("findDeletedBids:" + VOStatus.DELETED + ",csaleorderbid = " + csaleorderbid);
// 设置物料行的状态,在bip传的数据中找到则修改
if (bipIds != null && !bipIds.isEmpty()) {
// 明细行设置为修改状态
if (bipIds.contains(csaleorderbid)) {
bvo.setStatus(VOStatus.UPDATED);
}
}
}

View File

@ -508,4 +508,47 @@ public class SaleOrderResource extends NCCPubRestResource {
}
}
/**
* 合同管理系统修改ERP销售订单明细
*
* @author mzr
* @date 2025/05/28
*/
@POST
@Path("updateDefs")
@Consumes({"application/json"})
@Produces({"application/json"})
public JSONString updateDefs(List<Map<String, Object>> paramList) {
int num = 0;
try {
for (Map<String, Object> paramMap : paramList) {
String csaleorderbid = (String) paramMap.get("csaleorderbid");
if (StringUtils.isEmpty(csaleorderbid)) {
return ResultMessageUtil.exceptionToJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
}
StringBuilder sql = new StringBuilder("update so_saleorder_b set ");
SQLParameter parameter = new SQLParameter();
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
if (!"csaleorderbid".equals(entry.getKey())) {
sql.append(entry.getKey()).append(" = ?, ");
parameter.addParam(entry.getValue());
}
}
if (parameter.getCountParams() <= 0) {
return ResultMessageUtil.toJSON("传入参数为空,请检查", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
}
// 删除最后的", "
sql.delete(sql.length() - 2, sql.length());
sql.append(" where csaleorderbid = ?");
parameter.addParam(csaleorderbid);
BaseDAO baseDAO = new BaseDAO();
num += baseDAO.executeUpdate(sql.toString(), parameter);
}
} catch (Exception e) {
return ResultMessageUtil.exceptionToJSON(e);
}
return ResultMessageUtil.toJSON(num, "销售订单修改成功,共修改" + num + "");
}
}

View File

@ -230,12 +230,12 @@ public class InvoiceDownloadAction implements ICommonAction {
private String doGet(String requestUrl, Map<String, String> paramMap) throws IOException {
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(500);
cm.setDefaultMaxPerRoute(50);
cm.setMaxTotal(5000);
cm.setDefaultMaxPerRoute(500);
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(5000) // 连接池获取连接超时
.setConnectTimeout(5000) // 连接建立超时
.setSocketTimeout(20000) // 等待响应超时
RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(50000) // 连接池获取连接超时
.setConnectTimeout(50000) // 连接建立超时
.setSocketTimeout(200000) // 等待响应超时
.setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm)

View File

@ -125,22 +125,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
// 获取未推送合同销售订单更新的销售发票信息
String sql = " select '1' as flag,so_saleinvoice_b.cfirstbid,csaleinvoicebid " +
"from so_saleinvoice,so_saleinvoice_b " +
"where so_saleinvoice.csaleinvoiceid=so_saleinvoice_b.csaleinvoiceid " +
"and so_saleinvoice.fstatusflag=2 " +
"and nvl(so_saleinvoice_b.vbdef10,'N') in ('~','N') " +
"and nvl(so_saleinvoice.vdef13,'~') not in ('~') " +
"union all " +
"select " +
"'2' as flag, " +
"ic_saleout_b.cfirstbillbid as cfirstbid, " +
"ic_saleout_b.cgeneralbid as csaleinvoicebid " +
"from ic_saleout_h, " +
"ic_saleout_b " +
"where ic_saleout_h.cgeneralhid = ic_saleout_b.cgeneralhid " +
"and nvl(ic_saleout_b.vbdef4,'N') in ('~','N') " +
"and ic_saleout_b.cfirsttype = '30'";
String sql = " select * from v_bip_so_cron";
List<Map<String, String>> l_pk = (List<Map<String, String>>) new BaseDAO().executeQuery(sql.toString(), new MapListProcessor());
if (l_pk.isEmpty()) {

View File

@ -1,21 +1,15 @@
package nccloud.api.impl.mmbd.bom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
import nc.itf.bd.bom.bom0202.IBomBillQueryService;
import nc.itf.bd.bom.bom0202.IBomBusinessService;
import nc.itf.mmf.busi.measure.IMeasesureService;
import nc.itf.uif.pub.IUifService;
import nc.jdbc.framework.SQLParameter;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.mmbd.utils.factoryparam.MMBDFactoryParameter;
import nc.pubitf.uapbd.IMaterialPubService;
import nc.pubitf.uapbd.IMaterialPubService_C;
@ -27,23 +21,8 @@ import nc.util.mmf.busi.measure.MeasureVO;
import nc.util.mmf.busi.measure.NumScaleUtil;
import nc.util.mmf.busi.service.OrgUnitPubService;
import nc.util.mmf.framework.base.MMValueCheck;
import nc.vo.bd.bom.bom0202.entity.AggBomVO;
import nc.vo.bd.bom.bom0202.entity.BomActivityVO;
import nc.vo.bd.bom.bom0202.entity.BomItemSourceVO;
import nc.vo.bd.bom.bom0202.entity.BomItemVO;
import nc.vo.bd.bom.bom0202.entity.BomLossVO;
import nc.vo.bd.bom.bom0202.entity.BomOutputsVO;
import nc.vo.bd.bom.bom0202.entity.BomPosVO;
import nc.vo.bd.bom.bom0202.entity.BomReplVO;
import nc.vo.bd.bom.bom0202.entity.BomSelectVO;
import nc.vo.bd.bom.bom0202.entity.BomUseOrgVO;
import nc.vo.bd.bom.bom0202.entity.BomVO;
import nc.vo.bd.bom.bom0202.entity.BomWipVO;
import nc.vo.bd.bom.bom0202.enumeration.BackflushTimeEnum;
import nc.vo.bd.bom.bom0202.enumeration.BackflushTypeEnum;
import nc.vo.bd.bom.bom0202.enumeration.BomCategoryEnum;
import nc.vo.bd.bom.bom0202.enumeration.BomTypeEnum;
import nc.vo.bd.bom.bom0202.enumeration.VersionTypeEnum;
import nc.vo.bd.bom.bom0202.entity.*;
import nc.vo.bd.bom.bom0202.enumeration.*;
import nc.vo.bd.bom.bom0202.paramvo.BomHeadMtrlParam;
import nc.vo.bd.bom.bom0202.paramvo.BomHeadMtrlResult;
import nc.vo.bd.bom.bom0202.paramvo.BomMaterialParam;
@ -67,7 +46,15 @@ import nccloud.api.rest.utils.ResultMessageUtil;
import nccloud.vo.bd.bom.bom0202.validate.BomSavingValidation;
import org.json.JSONString;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
// 2025年5月28日 电缆组织金思维BOM版本号自动计算处理
private static final BaseDAO DAO = new BaseDAO();
private static String HEADTABLE = "bd_bom";
private static String BODYTABLE = "bd_bom_b";
@ -155,6 +142,10 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
}
// zhangxinah ÔÎïÁÏÖ÷¼ü½øÐз­Òë
dealWithMaterial(agg);
// 2025年5月28日 电缆组织金思维BOM版本号自动计算处理 By maolei
handleCableOrgJinSiWeiBomVersion(agg);
dataSupplement(agg, userCode);
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
@ -1526,4 +1517,96 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
item.setPk_useorg_v((String) agg.getParentVO().getAttributeValue("pk_org_v"));
}
}
private void handleCableOrgJinSiWeiBomVersion(AggBomVO agg) {
try {
String pk_org = (String) agg.getParent().getAttributeValue("pk_org");
String hcmaterialid = (String) agg.getParent().getAttributeValue("hcmaterialid");
String hversion = agg.getParent().getAttributeValue("hversion").toString();
String cbomid = (String) agg.getParent().getAttributeValue("cbomid");
String hvnote = (String) agg.getParent().getAttributeValue("hvnote");
// 检查必要字段
if (MMValueCheck.isEmpty(hcmaterialid) || MMValueCheck.isEmpty(hversion)) {
return;
}
// 判断是否为电缆组织组织编码C034且备注包含"金思维"
boolean isCableOrgJinSiWei = isCableOrganizationWithJinSiWei(pk_org, hvnote);
if (isCableOrgJinSiWei) {
// 计算版本号
String calculatedVersion = calculateBomVersion(pk_org, hcmaterialid );
agg.getParent().setAttributeValue("hversion", calculatedVersion);
}
} catch (Exception e) {
ExceptionUtils.wrappBusinessException("同步电缆组织金思维BOM版本号处理异常" + e.getMessage());
}
}
/**
* 判断是否为电缆组织且备注包含金思维
* @param pk_org 组织主键
* @param hvnote 备注信息
* @return 是否符合条件
*/
private boolean isCableOrganizationWithJinSiWei(String pk_org, String hvnote) {
if (MMValueCheck.isEmpty(pk_org)) {
return false;
}
try {
// 查询组织编码
String sql = "SELECT code FROM org_orgs WHERE pk_org = ?";
SQLParameter param = new SQLParameter();
param.addParam(pk_org);
String orgCode = (String) DAO.executeQuery(sql, param, new ColumnProcessor());
// 判断组织编码是否为C034
boolean isCableOrg = "C034".equals(orgCode);
// 判断备注是否包含"金思维"
boolean containsJinSiWei = MMValueCheck.isNotEmpty(hvnote) && hvnote.contains("金思维");
return isCableOrg && containsJinSiWei;
} catch (Exception e) {
// 查询异常时返回false
return false;
}
}
/**
* 计算BOM版本号
* @param pk_org 组织主键
* @param hcmaterialid 物料编码
* @return 计算出的版本号
*/
private String calculateBomVersion(String pk_org, String hcmaterialid ) throws BusinessException {
try {
// 构建查询条件
StringBuilder sql = new StringBuilder();
sql.append("SELECT MAX(TO_NUMBER(hversion)) as max_version ");
sql.append("FROM bd_bom ");
sql.append("WHERE pk_org = ? ");
SQLParameter param = new SQLParameter();
param.addParam(pk_org);
// 根据物料情况添加查询条件
sql.append("AND hcmaterialid = ? ");
param.addParam(hcmaterialid);
// 只查询数字版本号排除非数字版本
sql.append("AND REGEXP_LIKE(hversion, '^[0-9]+$') ");
Long maxVersion = (Long) DAO.executeQuery(sql.toString(), param, new ColumnProcessor());
// 如果查询不到数据默认版本号为1否则最大版本号加1
return String.valueOf((maxVersion != null ? maxVersion : 0) + 1);
} catch (Exception e) {
throw new BusinessException("计算BOM版本号异常" + e.getMessage());
}
}
}