材料出库签字后修改高压ims-代码调整

This commit is contained in:
mzr 2025-11-19 14:00:35 +08:00
parent 6c784436d8
commit 79c6682b5d
1 changed files with 13 additions and 9 deletions

View File

@ -1,14 +1,14 @@
package nc.bs.ic.m4d.sign.rule;
import nc.bs.dao.BaseDAO;
import nc.bs.uapbd.util.ImsDaoUtil;
import nc.bs.logging.Log;
import nc.bs.uapbd.util.MyHelper;
import nc.vo.fi.pub.SqlUtils;
import nc.vo.ic.m4d.entity.MaterialOutVO;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
import nc.vo.ic.m4d.entity.MaterialOutVO;
import nc.vo.org.OrgVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import java.util.HashSet;
import java.util.Map;
@ -21,6 +21,8 @@ import java.util.stream.Collectors;
* 本月(2025-11-30)
*/
public class UpdateGyimsRule implements IRule<MaterialOutVO> {
private static final String LOG_INFO_NAME = "gyimslog";
private static final Log logger = Log.getInstance(LOG_INFO_NAME);
// IMS数据源
public BaseDAO imsDao;
private Map<String, String> configParams;
@ -49,14 +51,14 @@ public class UpdateGyimsRule implements IRule<MaterialOutVO> {
throw new BusinessException("高压的gyims接口缺少配置");
}
for (MaterialOutVO materialOutVO : materialOutVOS) {
MaterialOutHeadVO head = materialOutVO.getHead();
// 判断物料的业务单元是否是高压公司不是则跳过
String pkOrg = materialOutVO.getHead().getPk_org();
String pkOrg = head.getPk_org();
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
if (checkIfOrg(orgCode, configParams)) {
continue;
}
imsIdSet.add(materialOutVO.getHead().getVbillcode());
imsIdSet.add(head.getVbillcode());
}
if (!imsIdSet.isEmpty()) {
// 修改状态为 完成优化SQL条件拼接避免语法错误和SQL注入风险
@ -69,13 +71,15 @@ public class UpdateGyimsRule implements IRule<MaterialOutVO> {
String updateSql = "update BIPOutMainTab set status = '2' where vbillcode in (" + ids + ")";
// 3. 执行更新注意这里不需要再传递参数SQL已拼接完成
int rows = ImsDaoUtil.executeUpdate(updateSql,ids);
int rows = getImsDao().executeUpdate(updateSql);
}
} catch (BusinessException e) {
throw new RuntimeException(e);
logger.error("UpdateGyimsRule-exp:" + e.getMessage(), e);
ExceptionUtils.wrappException(e);
}
}
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
String targetCode = configParams.get("imsOrg");
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {