定时任务优化

This commit is contained in:
mzr 2025-12-08 16:26:22 +08:00
parent 47e1e4139a
commit bbb77e7695
3 changed files with 30 additions and 31 deletions

View File

@ -24,12 +24,13 @@ import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
import nc.vo.ic.m4d.entity.MaterialOutHeadVO; import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
import nc.vo.ic.m4d.entity.MaterialOutVO; import nc.vo.ic.m4d.entity.MaterialOutVO;
import nc.vo.ic.pub.define.ICPubMetaNameConst; import nc.vo.ic.pub.define.ICPubMetaNameConst;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.mmpac.pickm.entity.AggPickmVO; import nc.vo.mmpac.pickm.entity.AggPickmVO;
import nc.vo.mmpac.pickm.entity.PickmItemVO; import nc.vo.mmpac.pickm.entity.PickmItemVO;
import nc.vo.pub.BusinessException; import nc.vo.pub.BusinessException;
import nc.vo.pub.VOStatus; import nc.vo.pub.VOStatus;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDouble; import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.pub.MathTool;
import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule; import nc.vo.scmpub.check.billvalidate.BillVOsCheckRule;
import nc.vo.scmpub.res.billtype.ICBillType; import nc.vo.scmpub.res.billtype.ICBillType;
import nc.vo.scmpub.util.ArrayUtil; import nc.vo.scmpub.util.ArrayUtil;
@ -180,7 +181,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
MaterialOutHeadVO newVO = vos[0].getHead(); MaterialOutHeadVO newVO = vos[0].getHead();
String cgeneralhid = newVO.getCgeneralhid(); String cgeneralhid = newVO.getCgeneralhid();
if (StringUtils.isEmpty(cgeneralhid)) { if (StringUtils.isEmpty(cgeneralhid)) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
} }
SCMBillQuery<MaterialOutVO> queryTool = SCMBillQuery<MaterialOutVO> queryTool =
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class); new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
@ -193,7 +194,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
}); });
ICLocationUtil.loadLocationVOs(originBills); ICLocationUtil.loadLocationVOs(originBills);
if (ArrayUtils.isEmpty(materialOutVOs)) { if (ArrayUtils.isEmpty(materialOutVOs)) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息请检查数据的表头主键cgeneralhid。"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息请检查数据的表头主键cgeneralhid。"*/);
} else { } else {
List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D"); List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D");
List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D"); List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D");
@ -201,7 +202,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (origVO.getFbillflag() == null || if (origVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) origVO.getFbillflag())) { .compareTo((Integer) origVO.getFbillflag())) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0362")/*@res "不是自由状态,不能修改"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0362")/*@res "不是自由状态,不能修改"*/);
} }
origVO.setStatus(VOStatus.UPDATED); origVO.setStatus(VOStatus.UPDATED);
for (String attr : newVO.getAttributeNames()) { for (String attr : newVO.getAttributeNames()) {
@ -210,7 +211,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
} }
if (headProFields.contains(attr) if (headProFields.contains(attr)
&& !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))) { && !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0363")/*@res "表头字段:"*/ + attr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0363")/*@res "表头字段:"*/ + attr + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
} }
origVO.setAttributeValue(attr, newVO.getAttributeValue(attr)); origVO.setAttributeValue(attr, newVO.getAttributeValue(attr));
} }
@ -232,7 +233,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
for (MaterialOutBodyVO newBvo : vos[0].getBodys()) { for (MaterialOutBodyVO newBvo : vos[0].getBodys()) {
MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid()); MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid());
if (newBvo.getCgeneralbid() == null || roigBvo == null) { if (newBvo.getCgeneralbid() == null || roigBvo == null) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息请检查数据的表体主键cgeneralbid。"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息请检查数据的表体主键cgeneralbid。"*/);
} }
Set<String> bfields = new HashSet<String>(); Set<String> bfields = new HashSet<String>();
for (String battr : newBvo.getAttributeNames()) { for (String battr : newBvo.getAttributeNames()) {
@ -241,7 +242,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
} }
if (bodyProFields.contains(battr) if (bodyProFields.contains(battr)
&& !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))) { && !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0366")/*@res "表体字段:"*/ + battr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0366")/*@res "表体字段:"*/ + battr + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
} }
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr)); roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
bfields.add(battr); bfields.add(battr);
@ -319,7 +320,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0367")/*@res "不是自由状态,不能删除"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0367")/*@res "不是自由状态,不能删除"*/);
} }
} }
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null); return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null);
@ -335,11 +336,11 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0330")/*@res "不是自由状态,不能签字"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0330")/*@res "不是自由状态,不能签字"*/);
} }
if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) { if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) {
if (aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null) { if (aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0392")/*@res "总数量为空,不能签字"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0392")/*@res "总数量为空,不能签字"*/);
} }
} }
@ -358,7 +359,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.SIGN.value()) 0 != ((Integer) ICBillFlag.SIGN.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0332")/*@res "不是签字状态,不能取消签字"*/); throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0332")/*@res "不是签字状态,不能取消签字"*/);
} }
} }
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null); return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null);
@ -384,6 +385,10 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
@Override @Override
public JSONObject destIssue(Map<String, Object> paramMap) throws BusinessException { public JSONObject destIssue(Map<String, Object> paramMap) throws BusinessException {
UFDouble num = new UFDouble(paramMap.get("num").toString());
if (MMValueCheck.isEmpty(num) || MathTool.isZero(num)) {
throw new BusinessException("领料套数不能为0");
}
// 启源领料 // 启源领料
/* /*
1传入数据基本非空校验 1传入数据基本非空校验
@ -392,9 +397,13 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
4处理材料出库VO部分字段的赋值(行数量 = 本次领料套数(启源传入)*单位主用量(备料计划)) 4处理材料出库VO部分字段的赋值(行数量 = 本次领料套数(启源传入)*单位主用量(备料计划))
5调用材料出库的保存方法 5调用材料出库的保存方法
*/ */
List<String> mids; List<String> mids = null;
String sql = "SELECT cpickmid from mm_pickm WHERE dr = 0 AND fbillstatus = 1 AND csourcebillrowid = '[csourcebillrowid]'";
if (MathTool.compareTo(num, UFDouble.ZERO_DBL) < 0) {
// 成套退料-查询审批态和完成态的备料计划
sql = "SELECT cpickmid from mm_pickm WHERE dr = 0 AND fbillstatus in (1,2) AND csourcebillrowid = '[csourcebillrowid]'";
}
try { try {
String sql = "SELECT cpickmid from mm_pickm WHERE dr = 0 AND fbillstatus = 1 AND csourcebillrowid = '[csourcebillrowid]'";
sql = sql.replace("[csourcebillrowid]", paramMap.get("cpmobid").toString()); sql = sql.replace("[csourcebillrowid]", paramMap.get("cpmobid").toString());
mids = (List<String>) getDao().executeQuery(sql, new ColumnListProcessor()); mids = (List<String>) getDao().executeQuery(sql, new ColumnListProcessor());
} catch (DAOException e) { } catch (DAOException e) {
@ -431,24 +440,8 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
newVos.toArray(new AggPickmVO[0]), null, PfButtonClickContext.ClassifyByItfdef); newVos.toArray(new AggPickmVO[0]), null, PfButtonClickContext.ClassifyByItfdef);
// 设置行号 // 设置行号
setMaterialOutRowNum(vos); setMaterialOutRowNum(vos);
UFDouble num = new UFDouble(paramMap.get("num").toString());
for (MaterialOutVO vo : vos) { for (MaterialOutVO vo : vos) {
MaterialOutHeadVO headVo = vo.getHead(); MaterialOutHeadVO headVo = vo.getHead();
UFDate dbilldate = headVo.getDbilldate();
// 因开关账检查的限制需设置单据日期, 如果单据日期小于2025-11-02则单据日期设置为2025-11-02
UFDate ufDate = new UFDate("2025-11-02");
if (dbilldate != null) {
int i = dbilldate.compareTo(ufDate);
if (i < 0) {
headVo.setDbilldate(ufDate);
}
} else {
UFDate nowDate = new UFDate();
int i = nowDate.compareTo(ufDate);
if (i < 0) {
headVo.setDbilldate(ufDate);
}
}
// 设置 vdef9 启源领料id // 设置 vdef9 启源领料id
if (MMValueCheck.isNotEmpty(paramMap.get("vdef9"))) { if (MMValueCheck.isNotEmpty(paramMap.get("vdef9"))) {
headVo.setVdef9(paramMap.get("vdef9").toString()); headVo.setVdef9(paramMap.get("vdef9").toString());

View File

@ -76,7 +76,13 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin {
headJson.put("cpayfinorgvid", "C003");// 应付财务组织最新版本 headJson.put("cpayfinorgvid", "C003");// 应付财务组织最新版本
headJson.put("cpayfinorgoid", "C003");// 应付财务组织 headJson.put("cpayfinorgoid", "C003");// 应付财务组织
headJson.put("creator", "BIP"); headJson.put("creator", "BIP");
headJson.put("billmaker", map.get("billmaker")); if (MMValueCheck.isNotEmpty(map.get("creator"))) {
headJson.put("creator", map.get("creator"));
}
headJson.put("billmaker", "BIP");
if (MMValueCheck.isNotEmpty(map.get("billmaker"))) {
headJson.put("billmaker", map.get("billmaker"));
}
if (map.get("dbilldate") != null && map.get("dbilldate") instanceof Timestamp dbilldate) { if (map.get("dbilldate") != null && map.get("dbilldate") instanceof Timestamp dbilldate) {
String dbilldateStr = DATETIME_FORMATTER.format(dbilldate); String dbilldateStr = DATETIME_FORMATTER.format(dbilldate);
headJson.put("dbilldate", dbilldateStr); // 单据日期 headJson.put("dbilldate", dbilldateStr); // 单据日期

View File

@ -105,7 +105,7 @@ public class MaterialToEpicMesPlugin implements IBackgroundWorkPlugin {
String sql = " SELECT DISTINCT b.pk_material" + String sql = " SELECT DISTINCT b.pk_material" +
" FROM bd_materialstock b" + " FROM bd_materialstock b" +
" LEFT JOIN bd_material a ON a.pk_material = b.pk_material" + " LEFT JOIN bd_material a ON a.pk_material = b.pk_material" +
" WHERE b.dr = 0 AND a.dr = 0 AND def30 != 'Y'" + " WHERE b.dr = 0 AND a.dr = 0 AND a.def30 != 'Y'" +
" AND " + inStrPkOrg + " AND " + inStrPkOrg +
" AND (b.ts > '" + rangeTimeString + "' OR a.ts > '" + rangeTimeString + "')"; " AND (b.ts > '" + rangeTimeString + "' OR a.ts > '" + rangeTimeString + "')";
List<Map<String, String>> pkList = (List<Map<String, String>>) getDao().executeQuery(sql, new MapListProcessor()); List<Map<String, String>> pkList = (List<Map<String, String>>) getDao().executeQuery(sql, new MapListProcessor());