Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
63bf1ff82d
|
@ -11,15 +11,22 @@ import nc.bs.arap.util.BillAccountCalendarUtils;
|
|||
import nc.bs.arap.util.BillDateUtils;
|
||||
import nc.bs.arap.validator.CrossRuleCheckValidator;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.gathering.GatheringBillItemVO;
|
||||
import nc.vo.arap.utils.StringUtil;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction {
|
||||
|
@ -71,10 +78,21 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction
|
|||
UFDouble changeMoney = money.sub(oriMoney);
|
||||
// 몽앴饋簡땐데id혼꿴璂饋簡땐데
|
||||
BaseDAO dao = new BaseDAO();
|
||||
String sql = "select vbillcode,nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" + def3
|
||||
+ "'";
|
||||
List<String> defMap = checkOrgCtrl();
|
||||
if (defMap.isEmpty() ) {
|
||||
return ;
|
||||
}
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql1, new MapProcessor());
|
||||
String code = saleMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
Map saleMap = (Map) dao.executeQuery(sql, new MapProcessor());
|
||||
if (defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
return;
|
||||
}
|
||||
// 饋簡땐데송江북셕
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
// 饋簡땐데茄셥澗운쏜띨
|
||||
|
@ -119,4 +137,19 @@ public class GatheringbillEditSaveBatchBSAction extends BillUpdateBatchBSAction
|
|||
this.checkOtherSystemBill(bills, orginBills);
|
||||
(new CrossRuleCheckValidator()).validate(bills);
|
||||
}
|
||||
private List<String> checkOrgCtrl() {
|
||||
List<String> list = new ArrayList<>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='org-ctrl' and dr=0 ) and dr=0";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
for (DefdocVO defdocVO : defdocVOs) {
|
||||
list.add(defdocVO.getCode());
|
||||
}
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,22 @@ import nc.bs.arap.util.BillDateUtils;
|
|||
import nc.bs.arap.util.BillMoneyVUtils;
|
||||
import nc.bs.arap.validator.CrossRuleCheckValidator;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.vo.arap.basebill.BaseBillVO;
|
||||
import nc.vo.arap.gathering.GatheringBillItemVO;
|
||||
import nc.vo.arap.utils.StringUtil;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
||||
|
@ -84,7 +92,24 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
|||
BaseDAO dao = new BaseDAO();
|
||||
String sql = "select vbillcode,nreceivedmny,ntotalorigmny from so_saleorder where dr = 0 and csaleorderid = '" +def3+"'";
|
||||
|
||||
Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
|
||||
|
||||
List<String> defMap = checkOrgCtrl();
|
||||
if (defMap.isEmpty() ) {
|
||||
return ;
|
||||
}
|
||||
String sql1="SELECT org_salesorg.CODE ,so_saleorder.dbilldate, so_saleorder.pk_org, so_saleorder.vbillcode,so_saleorder.nreceivedmny,so_saleorder.ntotalorigmny FROM so_saleorder LEFT JOIN org_salesorg ON org_salesorg.PK_SALESORG = so_saleorder.PK_ORG where so_saleorder.dr = 0 and so_saleorder.csaleorderid = '" +def3+"'";
|
||||
Map saleMap = (Map)dao.executeQuery(sql1, new MapProcessor());
|
||||
String code = saleMap.get("code").toString();
|
||||
LocalDateTime dbilldate = LocalDateTime.parse(saleMap.get("dbilldate").toString(),
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
LocalDateTime targetDate = LocalDateTime.parse("2025-06-27 00:00:00",
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
if (defMap.contains(code) && dbilldate.isBefore(targetDate)) {
|
||||
return;
|
||||
}
|
||||
// Map saleMap = (Map)dao.executeQuery(sql, new MapProcessor());
|
||||
//销售订单价税合计
|
||||
UFDouble ntotalorigmny = UFDouble.ZERO_DBL;
|
||||
//销售订单实际收款金额
|
||||
|
@ -101,4 +126,19 @@ public class GatheringbillSaveBatchBSAction extends BillInsertBatchBSAction {
|
|||
}
|
||||
}
|
||||
}
|
||||
private List<String> checkOrgCtrl() {
|
||||
List<String> list = new ArrayList<>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='org-ctrl' and dr=0 ) and dr=0";
|
||||
try {
|
||||
DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere);
|
||||
if (defdocVOs != null && defdocVOs.length > 0) {
|
||||
for (DefdocVO defdocVO : defdocVOs) {
|
||||
list.add(defdocVO.getCode());
|
||||
}
|
||||
}
|
||||
} catch (DAOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,9 +128,6 @@ public class N_F3_SAVE extends N_BASE_ACTION {
|
|||
private static final String ZERO_YUAN = "零元整";
|
||||
|
||||
public static String toChineseAmount(BigDecimal number) {
|
||||
// if (number == null || number.compareTo(BigDecimal.ZERO) < 0) {
|
||||
// throw new IllegalArgumentException("请输入非负数字");
|
||||
// }
|
||||
boolean isNegative = number.compareTo(BigDecimal.ZERO) < 0;
|
||||
if (isNegative) {
|
||||
number = number.abs(); // 转为正数
|
||||
|
@ -149,6 +146,8 @@ public class N_F3_SAVE extends N_BASE_ACTION {
|
|||
} else {
|
||||
char[] intChars = integerPart.toCharArray();
|
||||
int len = intChars.length;
|
||||
int zeroCount = 0; // 记录连续的零的个数
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
int digit = intChars[i] - '0';
|
||||
int digitPosition = len - i - 1;
|
||||
|
@ -156,18 +155,33 @@ public class N_F3_SAVE extends N_BASE_ACTION {
|
|||
int positionInSection = digitPosition % 4;
|
||||
|
||||
if (digit != 0) {
|
||||
// 如果前面有连续的零,添加一个零
|
||||
if (zeroCount > 0) {
|
||||
chineseInteger.append(CHINESE_CHARS[0]);
|
||||
zeroCount = 0;
|
||||
}
|
||||
|
||||
chineseInteger.append(CHINESE_CHARS[digit]);
|
||||
if (positionInSection > 0) {
|
||||
chineseInteger.append(DIGIT_UNITS[positionInSection]);
|
||||
}
|
||||
}
|
||||
|
||||
// 每四位添加一个大数单位
|
||||
if (positionInSection == 0) {
|
||||
if (digit != 0 || chineseInteger.length() == 0) {
|
||||
chineseInteger.append(LARGE_NUMBERS[section]);
|
||||
}
|
||||
} else {
|
||||
zeroCount++;
|
||||
|
||||
// 每四位的末尾,即使是零也要添加大数单位
|
||||
if (positionInSection == 0 && zeroCount < 4) {
|
||||
chineseInteger.append(LARGE_NUMBERS[section]);
|
||||
}
|
||||
}
|
||||
if (digit == 0) {
|
||||
chineseInteger.append(CHINESE_CHARS[digit]);
|
||||
|
||||
// 每四位的末尾重置零计数
|
||||
if (positionInSection == 0) {
|
||||
zeroCount = 0;
|
||||
}
|
||||
}
|
||||
// 移除多余的零和重复的单位
|
||||
|
@ -214,6 +228,11 @@ public class N_F3_SAVE extends N_BASE_ACTION {
|
|||
return ZERO_YUAN;
|
||||
}
|
||||
|
||||
// 添加负号(如果需要)
|
||||
if (isNegative) {
|
||||
return "负" + chineseInteger.toString();
|
||||
}
|
||||
|
||||
return chineseInteger.toString();
|
||||
}
|
||||
|
||||
|
@ -242,6 +261,14 @@ public class N_F3_SAVE extends N_BASE_ACTION {
|
|||
}
|
||||
}
|
||||
}
|
||||
// 移除连续的大数单位
|
||||
for (String largeNum : LARGE_NUMBERS) {
|
||||
if (!largeNum.isEmpty()) {
|
||||
while (sb.indexOf(largeNum + largeNum) != -1) {
|
||||
sb.replace(sb.indexOf(largeNum + largeNum), sb.indexOf(largeNum + largeNum) + largeNum.length() * 2, largeNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -818,6 +818,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
if (headvo.getRate() == null) {
|
||||
headvo.setRate(UFDouble.ONE_DBL);
|
||||
}
|
||||
|
||||
// 结算方式名称
|
||||
Object balatypeName = "";
|
||||
// 金额
|
||||
|
@ -835,13 +836,18 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
List<Map<String, Object>> itemMaps = (List) billMap.get("items");
|
||||
List<GatheringBillItemVO> itemvos = new ArrayList<GatheringBillItemVO>();
|
||||
if (itemMaps != null && itemMaps.size() > 0) {
|
||||
for (Map<String, Object> item : itemMaps) {
|
||||
GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class);
|
||||
customer = itemvo.getCustomer();
|
||||
}
|
||||
// for (Map<String, Object> item : itemMaps) {
|
||||
// GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class);
|
||||
// customer = itemvo.getCustomer();
|
||||
// }
|
||||
}
|
||||
|
||||
try {
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
// SELECT pk_adminorg FROM org_adminorg WHERE code='C042'
|
||||
|
||||
String org =hybo.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
|
||||
headvo.setIsinit(new UFBoolean(false));
|
||||
// 默认 收款类型 默认合同收款单
|
||||
Object pk_billtypecode = hybo.findColValue("bd_billtype", "PK_BILLTYPECODE", "billtypename = '合同收款单' ");
|
||||
|
@ -851,7 +857,7 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
headvo.setPk_busitype(pk_busitype.toString());
|
||||
// 往来对象0-客户 2-部门 3-业务员 默认客户
|
||||
headvo.setObjtype(0);
|
||||
headvo.setCustomer(customer);
|
||||
// headvo.setCustomer(customer);
|
||||
|
||||
// pk_currtype 币种编码 默认人民币
|
||||
if (headvo.getPk_currtype() == null || headvo.getPk_currtype().isEmpty()) {
|
||||
|
@ -885,29 +891,34 @@ public class GatheringbillRestResource extends ArapBaseRestResource {
|
|||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
HYPubBO hybo1 = new HYPubBO();
|
||||
String org =hybo1.findColValue("org_adminorg", "pk_adminorg", " code = '" + headvo.getPk_org() + "' ") + "";
|
||||
//根据BIP传的值进行创建自定义档案 def2 合同销售订单号
|
||||
//def6 合同编号
|
||||
//def3 标前项目号
|
||||
if (itemMaps.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream()
|
||||
.map(map -> (String) map.get("def6"))
|
||||
.collect(Collectors.toList()), "zdy-001", headvo.getPk_org().toString()));
|
||||
.collect(Collectors.toList()), "zdy-001", org));
|
||||
}
|
||||
if (itemMaps.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream()
|
||||
.map(map -> (String) map.get("def2"))
|
||||
.collect(Collectors.toList()), "BIP-ddh", headvo.getPk_org().toString()));
|
||||
.collect(Collectors.toList()), "BIP-ddh", org));
|
||||
}
|
||||
if (itemMaps.size() > 0) {
|
||||
NCLocator.getInstance().lookup(IDefdocService.class).insertDefdocs(headvo.getPk_org(), createDefVO(itemMaps.stream()
|
||||
.map(map -> (String) map.get("def3"))
|
||||
.collect(Collectors.toList()), "zdy-023", headvo.getPk_org().toString()));
|
||||
.collect(Collectors.toList()), "zdy-023", org));
|
||||
|
||||
createProjectHeadVO(itemMaps, headvo.getPk_org().toString());
|
||||
}
|
||||
|
||||
if (itemMaps != null && itemMaps.size() > 0) {
|
||||
for (Map<String, Object> item : itemMaps) {
|
||||
if(item.get("def7") != null){
|
||||
item.put("def7", item.get("def7").toString());
|
||||
}
|
||||
GatheringBillItemVO itemvo = (GatheringBillItemVO) fromJsonToVO(item, GatheringBillItemVO.class);
|
||||
|
||||
try {
|
||||
|
|
|
@ -232,7 +232,7 @@ public class myBtnClickAction extends InformerAction implements ICommonAction {
|
|||
vmao.put("paymentMethod", "10");
|
||||
}
|
||||
vmao.put("sourceId", row.get("pk_informer"));
|
||||
vmao.put("bankrelated_code", row.get("bankrelated_code"));
|
||||
vmao.put("bankrelatedCode", row.get("bankrelated_code"));
|
||||
lists.add(vmao);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,8 @@ public class putBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
if (valMap.get("pk_billtypecode").equals("30-Cxx-12")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-02")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-08")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-13")) {
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-13")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-16")) {
|
||||
return;
|
||||
}
|
||||
// 历史数据不考虑
|
||||
|
|
|
@ -55,7 +55,8 @@ public class saveBeforeCheckRule implements IRule<PMOAggVO> {
|
|||
if (valMap.get("pk_billtypecode").equals("30-Cxx-12")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-02")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-08")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-13")) {
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-13")
|
||||
|| valMap.get("pk_billtypecode").equals("30-Cxx-16")) {
|
||||
return;
|
||||
}
|
||||
// 历史数据不考虑
|
||||
|
|
|
@ -136,8 +136,10 @@ public class InvoiceDownloadAction implements ICommonAction {
|
|||
"AND bd.pk_defdoc = '" + ivApplicationHeadVO.getDef2().toString() + "' ";
|
||||
// List<Map<String,Object>> operationresult = (List<Map<String,Object>>) getQueryService().executeQuery(operationSql, new ArrayListProcessor());
|
||||
Map<String, Object> valList = (Map<String, Object>) getQueryService().executeQuery(operationSql, new MapProcessor());
|
||||
if(valList == null){
|
||||
ctcode = ivApplicationHeadVO.getDef2(); // ºÏͬºÅ
|
||||
if(!valList.isEmpty()){
|
||||
ctcode = (String) valList.get("name"); // ºÏͬºÅ
|
||||
}else{
|
||||
ctcode =ivApplicationHeadVO.getDef2();
|
||||
}
|
||||
}
|
||||
if(!ctcode.equals("") && !ctcode.equals("/") ){
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package nc.impl.bd.material.baseinfo;
|
||||
|
||||
import nc.bs.businessevent.IBusinessEvent;
|
||||
import nc.bs.businessevent.IBusinessListener;
|
||||
import nc.bs.businessevent.bd.BDCommonEvent;
|
||||
import nc.bs.ic.general.businessevent.ICGeneralCommonEvent;
|
||||
import nc.vo.ic.m45.entity.PurchaseInBodyVO;
|
||||
import nc.vo.ic.m45.entity.PurchaseInHeadVO;
|
||||
import nc.vo.ic.m45.entity.PurchaseInVO;
|
||||
import nc.vo.ic.m4c.entity.SaleOutVO;
|
||||
import nc.vo.ic.m4d.entity.MaterialOutVO;
|
||||
import nc.vo.pub.AggregatedValueObject;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class BillDateCheckListener implements IBusinessListener {
|
||||
|
||||
public void doAction(IBusinessEvent event) throws BusinessException {
|
||||
ICGeneralCommonEvent.ICGeneralCommonUserObj obj = (ICGeneralCommonEvent.ICGeneralCommonUserObj)event.getUserObject();
|
||||
AggregatedValueObject[] newBillVOs = (AggregatedValueObject[])obj.getNewObjects();
|
||||
if (newBillVOs == null) {
|
||||
newBillVOs = (AggregatedValueObject[])obj.getOldObjects();
|
||||
}
|
||||
// AggregatedValueObject[] oldBillVOs = (AggregatedValueObject[])obj.getOldObjects();
|
||||
//检查日期是否符合 每月24日后在系统做单据的时候,对未改系统日期到次月1日制单的情况,增加提示来提醒更改单据日期,否则无法保存,更改的日期不能超过当月24日后10天。
|
||||
// "1001".equals(event.getEventType())
|
||||
for(int i = 0; i < newBillVOs.length; ++i) {
|
||||
Object newObj = newBillVOs[i];
|
||||
if (newObj instanceof PurchaseInVO) {
|
||||
PurchaseInVO newVO = (PurchaseInVO)newObj;
|
||||
UFDate billDate = newVO.getHead().getDbilldate();
|
||||
|
||||
Date currentDate = new Date();
|
||||
Date billDateObj = billDate.toDate();
|
||||
if (!this.validateBillDate(billDateObj,currentDate)) {
|
||||
throw new BusinessException("当前日期已过当月24号,必须在下月制单且单据日期必须超过当月24号后10天");
|
||||
}
|
||||
}else if(newObj instanceof SaleOutVO){
|
||||
SaleOutVO newVO = (SaleOutVO)newObj;
|
||||
UFDate billDate = newVO.getHead().getDbilldate();
|
||||
|
||||
// Date currentDate = new Date(2025,6,25);
|
||||
Date currentDate = new Date();
|
||||
Date billDateObj = billDate.toDate();
|
||||
|
||||
if (!this.validateBillDate(billDateObj,currentDate)) {
|
||||
throw new BusinessException("当前日期已过当月24号,必须在下月制单且单据日期必须超过当月24号后10天");
|
||||
}
|
||||
|
||||
}else if(newObj instanceof MaterialOutVO){
|
||||
MaterialOutVO newVO = (MaterialOutVO)newObj;
|
||||
UFDate billDate = newVO.getHead().getDbilldate();
|
||||
|
||||
Date currentDate = new Date();
|
||||
Date billDateObj = billDate.toDate();
|
||||
if (!this.validateBillDate(billDateObj,currentDate)) {
|
||||
throw new BusinessException("当前日期已过当月24号,必须在下月制单且单据日期必须超过当月24号后10天");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean validateBillDate(Date billDateObj, Date currentDate) {
|
||||
Calendar currentCal = Calendar.getInstance();
|
||||
currentCal.setTime(currentDate);
|
||||
|
||||
Calendar billCal = Calendar.getInstance();
|
||||
billCal.setTime(billDateObj);
|
||||
|
||||
// 获取当前日期的月份和日
|
||||
int currentDay = currentCal.get(Calendar.DAY_OF_MONTH);
|
||||
int currentMonth = currentCal.get(Calendar.MONTH);
|
||||
int currentYear = currentCal.get(Calendar.YEAR);
|
||||
|
||||
// 只有当当前日期是25号到月底时才需要校验
|
||||
if (currentDay >= 15) {
|
||||
// 1. 计算本月24号+10天的最大允许日期
|
||||
Calendar maxDateCal = Calendar.getInstance();
|
||||
maxDateCal.set(currentYear, currentMonth, 24); // 本月24号
|
||||
maxDateCal.add(Calendar.DATE, 10); // 24号+10天
|
||||
|
||||
// 2. 计算下个月1号的最小允许日期
|
||||
Calendar minDateCal = Calendar.getInstance();
|
||||
minDateCal.set(currentYear, currentMonth, 1); // 本月1号
|
||||
minDateCal.add(Calendar.MONTH, 1); // 下个月1号
|
||||
|
||||
// 3. 检查单据日期是否在下个月范围内
|
||||
boolean isNextMonth = billCal.get(Calendar.MONTH) == minDateCal.get(Calendar.MONTH) &&
|
||||
billCal.get(Calendar.YEAR) == minDateCal.get(Calendar.YEAR);
|
||||
|
||||
// 4. 检查单据日期是否在允许范围内(下个月1号 至 本月24号+10天)
|
||||
if (!isNextMonth || billCal.after(maxDateCal) || billCal.before(minDateCal)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -200,8 +200,60 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999",
|
||||
"BOM保存提交成功部分成功部分失败", true);
|
||||
} else {
|
||||
ExceptionUtils.wrappBusinessException("未匹配到符合条件的三方注册用户账号【"+userCode+"】,请检查!!!");
|
||||
try {
|
||||
IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
|
||||
|
||||
// 检查当前用户是否为排除用户
|
||||
if (httpPostOtherSys.checkIfExcludeUser()) {
|
||||
// 排除用户直接跳过同步处理,执行普通保存逻辑
|
||||
for (AggBomVO aggvo : commitAggvoList) {
|
||||
result = service.insertBom(new AggBomVO[] { aggvo });
|
||||
newAggVOList.add(result[0]);
|
||||
}
|
||||
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "BOM保存成功(排除用户)");
|
||||
}
|
||||
|
||||
// 检查当前组织是否属于金思维MES同步组织(电缆组织)
|
||||
String currentOrgCode = this.orgCodeFlag;
|
||||
boolean isIncludeOrg = httpPostOtherSys.checkIfIncludeOrg(currentOrgCode);
|
||||
|
||||
if (isIncludeOrg) {
|
||||
// 属于金思维MES同步组织,执行特殊处理逻辑
|
||||
for (AggBomVO aggvo : commitAggvoList) {
|
||||
result = service.insertCommitBomWithParam(new AggBomVO[] { aggvo }, true, true);
|
||||
newAggVOList.add(result[0]);
|
||||
}
|
||||
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "BOM保存成功(金思维MES同步组织)");
|
||||
} else {
|
||||
// 不属于金思维MES同步组织,执行默认处理逻辑
|
||||
for (AggBomVO aggvo : commitAggvoList) {
|
||||
try {
|
||||
result = service.insertCommitBomWithParam_RequiresNew(new AggBomVO[] { aggvo }, true, true);
|
||||
newAggVOList.add(result[0]);
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null) {
|
||||
if (e.getMessage().length() > 100) {
|
||||
aggvo.getParent().setAttributeValue("hvdef2", e.getMessage().substring(0, 100));
|
||||
} else {
|
||||
aggvo.getParent().setAttributeValue("hvdef2",
|
||||
e.getMessage().substring(0, e.getMessage().length() - 1));
|
||||
}
|
||||
} else {
|
||||
Throwable unmarsh = ExceptionUtils.unmarsh(e);
|
||||
aggvo.getParent().setAttributeValue("hvdef2", "异常" + unmarsh.getMessage());
|
||||
}
|
||||
newAggVOList.add(aggvo);
|
||||
}
|
||||
}
|
||||
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999",
|
||||
"BOM保存提交成功部分成功部分失败", true);
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
// HTTP工具类调用失败时,回退到原有的异常处理
|
||||
ExceptionUtils.wrappBusinessException("HTTP工具类判断失败:" + e.getMessage() + ",未匹配到符合条件的三方注册用户账号【"+userCode+"】,请检查!!!");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在", "999");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue