Merge remote-tracking branch 'origin/main'

This commit is contained in:
张明 2025-05-30 09:19:35 +08:00
commit 34728b28ff
4 changed files with 361 additions and 2 deletions

View File

@ -722,6 +722,7 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain {
targetBVO.setVbdef19(sourceBVO.getVbdef19()); // 计划开工日期
targetBVO.setVbdef20(sourceBVO.getVbdef20()); // 计划完工日期
targetBVO.setVbdef14(sourceBVO.getVbdef14()); // 合同销售订单变更明细id
targetBVO.setCrowno(sourceBVO.getCrowno()); // 行号
}

View File

@ -0,0 +1,217 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package nccloud.web.uapbd.customer.baseinfo.action;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.logging.Logger;
import nc.bs.uif2.LockFailedException;
import nc.bs.uif2.VersionConflictException;
import nc.itf.bd.cust.assign.ICustAssignService;
import nc.itf.bd.cust.baseinfo.ICustBaseInfoQueryService;
import nc.itf.bd.cust.baseinfo.ICustBaseInfoService;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.MapProcessor;
import nc.uap.utils.ResHelper;
import nc.vo.bd.cust.*;
import nc.vo.bd.errorlog.ErrLogReturnValue;
import nc.vo.bd.supplier.SupplierVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.org.OrgVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.SuperVO;
import nc.vo.pub.lang.UFDateTime;
import nccloud.baseapp.core.log.NCCForUAPLogger;
import nccloud.commons.lang.StringUtils;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;
import nccloud.framework.web.processor.template.ExtBillCardConvertProcessor;
import nccloud.framework.web.ui.model.row.Row;
import nccloud.framework.web.ui.pattern.billcard.ExtSpecilAggBill;
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCard;
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCardOperator;
import nccloud.framework.web.ui.pattern.grid.Grid;
import nccloud.web.uapbd.customer.baseinfo.utils.CustSupExceptionHandle;
import nccloud.web.uapbd.customer.baseinfo.utils.CustomerExtendAggBill;
import nccloud.web.uapbd.customer.baseinfo.utils.CustomerResultMessage;
import nccloud.web.uapbd.customer.baseinfo.utils.CustomerService;
import nccloud.web.uapbd.supplier.supplier.action.SupplierCommonUtil;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.*;
public class CustomerSaveAction implements ICommonAction {
public CustomerSaveAction() {
}
public Object doAction(IRequest request) {
CustomerExtendAggBill fromJson = (CustomerExtendAggBill) JsonFactory.create().fromJson(request.read(), CustomerExtendAggBill.class);
ExtBillCard extspecilAggBill = fromJson.getExtspecilAggBill();
String step = fromJson.getStep();
boolean checkflag = fromJson.isCheckflag();
boolean createVersion = fromJson.isCreateversion();
String pagecode = fromJson.getPagecode();
List<String> exceptAreas = new ArrayList();
exceptAreas.add("custAddress");
exceptAreas.add("custBankaccbas");
exceptAreas.add("10140LM");
exceptAreas.add("customerassign_list");
exceptAreas.add("cust_sale_simple");
exceptAreas.add("cust_creditctl_simple");
exceptAreas.add("cust_finance_simple");
exceptAreas.add("customer_list_checkbyorg");
exceptAreas.add("versionList");
ExtBillCardConvertProcessor ebcp = new ExtBillCardConvertProcessor(exceptAreas);
ExtBillCardOperator ec = new ExtBillCardOperator(pagecode);
new CustomerResultMessage();
ExtBillCard ebc = null;
ExtSpecilAggBill bill = (ExtSpecilAggBill) ebcp.fromExtBillCard(extspecilAggBill);
CustomerVO customerVO = (CustomerVO) bill.getHead();
CustlinkmanVO[] custlikCustlinkmanVOs = (CustlinkmanVO[]) bill.getBodys(CustlinkmanVO.class);
CustCountrytaxesVO[] custCountrytaxesVOs = (CustCountrytaxesVO[]) bill.getBodys(CustCountrytaxesVO.class);
customerVO.setCustcontacts(custlikCustlinkmanVOs);
customerVO.setCusttaxtypes(custCountrytaxesVOs);
if ("2".equals(customerVO.getCalibrationstate()) && customerVO.getLatestcaltime() == null) {
customerVO.setLatestcaltime(new UFDateTime());
}
if (!SupplierCommonUtil.checkRegisterfund(customerVO.getRegisterfund())) {
ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("nccriauapbd0", "0nccriauapbd00466"));
}
CustomerService cs = new CustomerService();
try {
if (StringUtils.isNotBlank(step) && "one".equals(step)) {
if (createVersion) {
customerVO = ((ICustBaseInfoService) ServiceLocator.find(ICustBaseInfoService.class)).createCustomerVersion(customerVO);
} else if (StringUtils.isNotBlank(customerVO.getPk_customer())) {
CustomerVO[] temp = ((ICustBaseInfoQueryService) ServiceLocator.find(ICustBaseInfoQueryService.class)).queryDataByPkSet(new String[]{customerVO.getPk_customer()});
if (temp == null || temp.length == 0) {
ExceptionUtils.wrapException(new BusinessException("没有找到对应的客户信息"));
}
customerVO = cs.updateCustomer(customerVO, checkflag);
} else {
if (customerVO.getCustcontacts() != null && customerVO.getCustcontacts().length > 0) {
for (CustlinkmanVO custlinkmanvo : customerVO.getCustcontacts()) {
custlinkmanvo.setPk_customer((String) null);
}
}
if (customerVO.getCusttaxtypes() != null && customerVO.getCusttaxtypes().length > 0) {
for (CustCountrytaxesVO custCountrytaxesVO : customerVO.getCusttaxtypes()) {
custCountrytaxesVO.setPk_customer((String) null);
}
}
if (fromJson.getCopy_pk_customer() != null) {
customerVO = cs.insertCustomerVO(customerVO, checkflag);
((ICustAssignService) ServiceLocator.find(ICustAssignService.class)).copyCustomerAssignData(customerVO, fromJson.getCopy_pk_customer());
} else {
customerVO = cs.insertCustomerVO(customerVO, checkflag);
}
}
}
if (StringUtils.isNotBlank(step) && "two_yes".equals(step)) {
SupplierVO supplierVO = fromJson.getSupplierVO();
if (StringUtils.isNotBlank(customerVO.getPk_customer())) {
customerVO = cs.updateCustomerAndRelaToSup(customerVO, supplierVO);
} else {
Map<String, SuperVO> resultMap = cs.insertCustAndRelaToSup(customerVO, supplierVO);
customerVO = (CustomerVO) resultMap.get("customer");
}
}
if (StringUtils.isNotBlank(step) && "two_no".equals(step)) {
if (StringUtils.isNotBlank(customerVO.getPk_customer())) {
customerVO = cs.updateCustomer(customerVO, checkflag);
} else {
customerVO = cs.insertCustomerVO(customerVO, checkflag);
}
}
bill.putvo(CustlinkmanVO.class, customerVO.getCustcontacts());
customerVO.setCustcontacts((CustlinkmanVO[]) null);
bill.putvo(CustbankVO.class, customerVO.getCustbanks());
customerVO.setCustbanks((CustbankVO[]) null);
bill.putvo(CustCountrytaxesVO.class, customerVO.getCusttaxtypes());
customerVO.setCusttaxtypes((CustCountrytaxesVO[]) null);
bill.setHead(customerVO);
ec.setTransFlag(true);
ebc = ec.toCard(bill, exceptAreas);
Grid grid = ebc.getBody("custtaxtypes");
if (grid != null) {
List<Row> listRows = grid.getModel().getListRows();
Map<String, String> executeQuery = null;
if (listRows != null && listRows.size() > 0) {
for (Row row : listRows) {
if (row.getCell("pk_taxes").getValue() != null) {
String value = row.getCell("pk_taxes").getValue().toString();
executeQuery = (Map) ((IUAPQueryBS) ServiceLocator.find(IUAPQueryBS.class)).executeQuery("select custtaxesname from bd_custaxes where pk_custaxes = '" + value + "'", new MapProcessor());
row.getCell("pk_taxes").setDisplay(executeQuery != null ? (String) executeQuery.get("custtaxesname") : "");
}
}
}
}
// 自动分配组织
String[] customerPks = {customerVO.getPk_customer()};
OrgVO[] virtulaOrg = getVirtulaOrg();
String[] assignOrgPks = Arrays.stream(virtulaOrg).map(OrgVO::getPk_org).toArray(String[]::new);
// assignOrgPks = new String[]{"0001A1100000000026HI", "0001A110000000002H9M"};
ErrLogReturnValue errLogReturnValue = cs.getAssignService().assignCustomerByPks(customerPks, assignOrgPks, null);
Logger.error("CustomerSaveAction-errLogReturnValue = " + errLogReturnValue.getErrLogResult());
// NCCForUAPLogger.debug("customerPks = " + customerPks[0]);
// NCCForUAPLogger.debug("assignOrgPks = " + Arrays.toString(assignOrgPks));
// NCCForUAPLogger.debug("CustomerSaveAction-errLogReturnValue = " + errLogReturnValue.getErrLogResult());
} catch (Exception e) {
if (e instanceof UndeclaredThrowableException) {
Throwable undeclaredThrowable = ((UndeclaredThrowableException) e).getUndeclaredThrowable();
InvocationTargetException ie = (InvocationTargetException) undeclaredThrowable;
Throwable targetException = ie.getTargetException();
if (targetException instanceof CustSupBusiException) {
CustSupBusiException cuBusiException = (CustSupBusiException) targetException;
CustomerResultMessage crm = CustSupExceptionHandle.handleCustSupException(cuBusiException);
return crm;
}
if (targetException instanceof VersionConflictException) {
VersionConflictException versionConflictException = (VersionConflictException) targetException;
Object busiObject = versionConflictException.getBusiObject();
ExceptionUtils.wrapBusinessException(ResHelper.getString("nccriauapbd0", "0nccriauapbd00030"));
} else if (targetException instanceof LockFailedException) {
ExceptionUtils.wrapBusinessException(ResHelper.getString("nccriauapbd0", "0nccriauapbd00030"));
} else {
ExceptionUtils.wrapException(targetException);
}
} else {
ExceptionUtils.wrapException(e);
}
}
return ebc;
}
/**
* 查询组织信息
*
* @author mzr
* @date 2025/05/29
*/
public OrgVO[] getVirtulaOrg() throws BusinessException {
String groupID = InvocationInfoProxy.getInstance().getGroupId();
// NCCForUAPLogger.debug("groupID = " + groupID);
// enablestate 启用状态 isbusinessunit 是否业务单元数据
String condition = "pk_group = '" + groupID + "' and ENABLESTATE = '2' and isbusinessunit='Y'";
Collection<OrgVO> collection = (new BaseDAO()).retrieveByClause(OrgVO.class, condition, "code");
return collection.toArray(new OrgVO[0]);
}
}

View File

@ -0,0 +1,141 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package nccloud.web.uapbd.customer.baseinfo.action;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.logging.Logger;
import nc.itf.bd.cust.baseinfo.ICustBaseInfoService;
import nc.pub.billcode.itf.IBillcodeManage;
import nc.pub.billcode.vo.BillCodeContext;
import nc.vo.bd.cust.CustCountrytaxesVO;
import nc.vo.bd.cust.CustlinkmanVO;
import nc.vo.bd.cust.CustomerVO;
import nc.vo.bd.errorlog.ErrLogReturnValue;
import nc.vo.org.OrgVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDateTime;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.container.SessionContext;
import nccloud.framework.web.ui.pattern.billcard.ExtSpecilAggBill;
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCard;
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCardOperator;
import nccloud.web.uapbd.customer.baseinfo.utils.CustomerService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class CustomerSaveAddAction implements ICommonAction {
public CustomerSaveAddAction() {
}
public Object doAction(IRequest request) {
ExtBillCardOperator ec = new ExtBillCardOperator();
List<String> exceptAreas = new ArrayList();
exceptAreas.add("custAddress");
exceptAreas.add("custBankaccbas");
exceptAreas.add("10140LM");
exceptAreas.add("customerassign_list");
exceptAreas.add("cust_sale_simple");
exceptAreas.add("cust_creditctl_simple");
exceptAreas.add("cust_finance_simple");
exceptAreas.add("customer_list_checkbyorg");
ExtSpecilAggBill bill = (ExtSpecilAggBill) ec.toBill(request);
ExtBillCard ebc = null;
CustomerVO customerVO = (CustomerVO) bill.getHead();
CustlinkmanVO[] custlikCustlinkmanVOs = (CustlinkmanVO[]) bill.getBodys(CustlinkmanVO.class);
CustCountrytaxesVO[] custCountrytaxesVOs = (CustCountrytaxesVO[]) bill.getBodys(CustCountrytaxesVO.class);
if (custlikCustlinkmanVOs != null && custlikCustlinkmanVOs.length > 0) {
for (CustlinkmanVO custlinkmanvo : custlikCustlinkmanVOs) {
custlinkmanvo.setPk_customer((String) null);
}
}
if (custCountrytaxesVOs != null && custCountrytaxesVOs.length > 0) {
for (CustCountrytaxesVO custCountrytaxesVO : custCountrytaxesVOs) {
custCountrytaxesVO.setPk_customer((String) null);
}
}
customerVO.setCustcontacts(custlikCustlinkmanVOs);
customerVO.setCusttaxtypes(custCountrytaxesVOs);
if ("2".equals(customerVO.getCalibrationstate()) && customerVO.getLatestcaltime() == null) {
customerVO.setLatestcaltime(new UFDateTime());
}
CustomerService cs = new CustomerService();
ICustBaseInfoService getiCustBaseInfoService = cs.getiCustBaseInfoService();
IBillcodeManage billcodeManage = cs.getBillcodeManage();
String pk_group = SessionContext.getInstance().getClientInfo().getPk_group();
String billcode = "";
try {
customerVO.setIssupplier(UFBoolean.FALSE);
customerVO.setCuststate(1);
customerVO.setFrozenflag(UFBoolean.FALSE);
customerVO.setIsfreecust(UFBoolean.FALSE);
customerVO.setPk_group(pk_group);
customerVO.setPk_org(pk_group);
customerVO = getiCustBaseInfoService.insertCustomerVO(customerVO, false);
CustomerVO saveAddRe = new CustomerVO();
BillCodeContext billCodeContext = billcodeManage.getBillCodeContext("customer", pk_group, pk_group);
if (billCodeContext != null && billCodeContext.isPrecode()) {
billcode = billcodeManage.getPreBillCode_RequiresNew("customer", pk_group, pk_group);
}
saveAddRe.setCode(billcode);
saveAddRe.setIssupplier(UFBoolean.FALSE);
saveAddRe.setCuststate(1);
saveAddRe.setFrozenflag(UFBoolean.FALSE);
saveAddRe.setPk_country("0001Z010000000079UJJ");
saveAddRe.setPk_format("FMT0Z000000000000000");
saveAddRe.setPk_timezone("0001Z010000000079U2P");
saveAddRe.setIsfreecust(UFBoolean.FALSE);
saveAddRe.setPk_org(customerVO.getPk_org());
saveAddRe.setPk_group(customerVO.getPk_group());
bill.putvo(CustlinkmanVO.class, new CustlinkmanVO[0]);
bill.putvo(CustCountrytaxesVO.class, new CustCountrytaxesVO[0]);
bill.setHead(saveAddRe);
ebc = ec.toCard(bill, exceptAreas);
ec.setTransFlag(true);
ebc.setUserjson(billCodeContext == null ? "" : "" + billCodeContext.isEditable());
// 自动分配组织
String[] customerPks = {customerVO.getPk_customer()};
OrgVO[] virtulaOrg = getVirtulaOrg();
String[] assignOrgPks = Arrays.stream(virtulaOrg).map(OrgVO::getPk_org).toArray(String[]::new);
// assignOrgPks = new String[]{"0001A1100000000026HI", "0001A110000000002H9M"};
ErrLogReturnValue errLogReturnValue = cs.getAssignService().assignCustomerByPks(customerPks, assignOrgPks, null);
Logger.error("CustomerSaveAddAction-errLogReturnValue = " + errLogReturnValue.getErrLogResult());
} catch (BusinessException e) {
ExceptionUtils.wrapException(e);
}
return ebc;
}
/**
* 查询组织信息
*
* @author mzr
* @date 2025/05/29
*/
public OrgVO[] getVirtulaOrg() throws BusinessException {
String groupID = InvocationInfoProxy.getInstance().getGroupId();
// NCCForUAPLogger.debug("groupID = " + groupID);
// enablestate 启用状态 isbusinessunit 是否业务单元数据
String condition = "pk_group = '" + groupID + "' and ENABLESTATE = '2' and isbusinessunit='Y'";
Collection<OrgVO> collection = (new BaseDAO()).retrieveByClause(OrgVO.class, condition, "code");
return collection.toArray(new OrgVO[0]);
}
}

View File

@ -137,7 +137,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
String flag = map.get("flag");
StringBuffer sb = new StringBuffer();
if("2".equals(flag)){
sb.append(" select ic_saleout_b.cgeneralbid as csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11, so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_b.narrangemonum, so_saleorder_b.ntotalreturnnum, so_saleorder_b.ntotalrednum," +
sb.append(" select ic_saleout_b.cgeneralbid as csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11, so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_exe.narrangemonum, so_saleorder_exe.ntotalreturnnum, so_saleorder_exe.ntotalrednum," +
" so_saleorder_exe.ntotalarmny as totalaccrued ,so_saleorder_exe.ntotalinvoicenum as billqty, NVL(so_saleorder_exe.ntotaloutnum, 0) as totaloutqty ");
sb.append(" from so_saleorder_exe,ic_saleout_b,ic_saleout_h,so_saleorder_b,so_saleorder ");
sb.append(" where so_saleorder_exe.csaleorderbid=ic_saleout_b.cfirstbillbid ");
@ -148,7 +148,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
sb.append(" and nvl(so_saleorder.vdef9,'~') not in ('~') ");
sb.append(" and so_saleorder_exe.csaleorderbid='").append(map.get("cfirstbid")).append("'");
}else{
sb.append(" select so_saleinvoice_b.csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11,so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_b.narrangemonum, so_saleorder_b.ntotalreturnnum, so_saleorder_b.ntotalrednum, so_saleorder_exe.ntotalarmny as totalaccrued ,so_saleorder_exe.ntotalinvoicenum as billqty, NVL(so_saleorder_exe.ntotaloutnum, 0) as totaloutqty ");
sb.append(" select so_saleinvoice_b.csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11,so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_exe.narrangemonum, so_saleorder_exe.ntotalreturnnum, so_saleorder_exe.ntotalrednum, so_saleorder_exe.ntotalarmny as totalaccrued ,so_saleorder_exe.ntotalinvoicenum as billqty, NVL(so_saleorder_exe.ntotaloutnum, 0) as totaloutqty ");
sb.append(" from so_saleorder_exe,so_saleinvoice_b,so_saleinvoice,so_saleorder_b,so_saleorder ");
sb.append(" where so_saleorder_exe.csaleorderbid=so_saleinvoice_b.csrcbid ");
sb.append(" and so_saleinvoice.csaleinvoiceid=so_saleinvoice_b.csaleinvoiceid and so_saleinvoice.fstatusflag=2 ");