Merge remote-tracking branch 'origin/main'

This commit is contained in:
lihao 2025-11-05 08:44:57 +08:00
commit b9dcae9677
5 changed files with 97 additions and 28 deletions

View File

@ -160,10 +160,9 @@ public class ManualMaterialPickupRule implements IRule<PurchaseInVO> {
for (PMOItemVO item : items) {
String cmoid = item.getCmoid();
if (mobid.equals(cmoid)) {
if (!PMOFItemStatusEnum.PUT.equalsValue(item.getFitemstatus()) &&
!PMOFItemStatusEnum.AUDIT.equalsValue(item.getFitemstatus())
) {
ExceptionUtils.wrappBusinessException("流程生产订单明细未完成,无法进行领料");
// 自由=0,审批通过=4,投放=1,完工=2,关闭=3
if (PMOFItemStatusEnum.PLAN.equalsValue(item.getFitemstatus())) {
ExceptionUtils.wrappBusinessException("流程生产订单行状态为自由态(明细id-" + cmoid + "),无法进行领料");
}
pmoItemVO = item;
}

View File

@ -87,9 +87,13 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin {
headJson.put("cpayfinorgoid", "C003");// 应付财务组织
headJson.put("creator", "BIP");
headJson.put("billmaker", "BIP");
if (map.get("dbilldate") != null && map.get("dbilldate") instanceof Timestamp dbilldate) {
String dbilldateStr = DATETIME_FORMATTER.format(dbilldate);
headJson.put("dbilldate", dbilldateStr); // 单据日期
}
if (map.get("dmakedate") != null && map.get("dmakedate") instanceof Timestamp dmakedate1) {
String dmakedateStr = DATETIME_FORMATTER.format(dmakedate1);
headJson.put("dmakedate", dmakedateStr); // µ¥¾ÝÈÕÆÚ
headJson.put("dmakedate", dmakedateStr); // 制单日期
}
if (map.get("creationtime") != null && map.get("creationtime") instanceof Timestamp creationtime1) {
String creationtimeStr = DATETIME_FORMATTER.format(creationtime1);
@ -106,12 +110,27 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin {
bodyJson.put("nnum", body.get("nnum"));// 实收主数量
bodyJson.put("nassistnum", body.get("nassistnum"));// 实收数量
bodyJson.put("vchangerate", "1/1");// 换算率
// bodyJson.put("nqtprice", body.get("nqtprice"));//
// bodyJson.put("nqttaxprice", body.get("nqttaxprice"));//
// bodyJson.put("norigtaxmny", body.get("norigtaxmny"));//
// bodyJson.put("ntaxmny", body.get("ntaxmny"));//
// bodyJson.put("nmny", body.get("nmny"));//
// bodyJson.put("ntax", body.get("ntax"));//
Object nqtorigprice = body.get("nqtorigprice");// 无税单价
Object nqtorigtaxprice = body.get("nqtorigtaxprice");// 含税单价
bodyJson.put("nqtorignetprice", nqtorigprice);// 无税净价
bodyJson.put("nqtorigtaxnetprice", nqtorigtaxprice);// 含税净价
bodyJson.put("nqtnetprice", nqtorigprice);// 本币无税净价
bodyJson.put("nqttaxnetprice", nqtorigtaxprice);// 本币含税净价
bodyJson.put("norigprice", nqtorigprice);// 主无税单价
bodyJson.put("norigtaxprice", nqtorigtaxprice);// 主含税单价
bodyJson.put("nprice", nqtorigprice);// 主本币无税单价
bodyJson.put("ntaxprice", nqtorigtaxprice);// 主本币含税单价
bodyJson.put("nqtorigprice", nqtorigprice);// 无税单价
bodyJson.put("nqtorigtaxprice", nqtorigtaxprice);// 含税单价
bodyJson.put("nqtprice", nqtorigprice);// 本币无税单价
bodyJson.put("nqttaxprice", nqtorigtaxprice);// 本币含税单价
bodyJson.put("norigmny", body.get("norigmny"));// 无税金额
bodyJson.put("norigtaxmny", body.get("norigtaxmny"));// 价税合计
bodyJson.put("nmny", body.get("norigmny"));// 本币无税金额
bodyJson.put("ntaxmny", body.get("norigtaxmny"));// 本币价税合计
bodyJson.put("ntaxrate", body.get("ntaxrate"));// 税率
bodyJson.put("vnotebody", body.get("vnotebody"));// 行备注
bodyJsonArr.add(bodyJson);

View File

@ -116,6 +116,11 @@ public class MaterialOutGyImsPlugin implements IBackgroundWorkPlugin {
whereStorSql);
// NCCForUAPLogger.debug("cwarehouseid = " + cwarehouseid);
hvo.setCwarehouseid(warehousePk);
if (mainMap.get("dbilldate") != null && mainMap.get("dbilldate") instanceof Timestamp dbilldate) {
String dbilldateStr = DATETIME_FORMATTER.format(dbilldate);
UFDate dbilldate1 = new UFDate(dbilldateStr);
hvo.setDbilldate(dbilldate1);
}
if (mainMap.get("dmakedate") != null && mainMap.get("dmakedate") instanceof Timestamp dmakedate1) {
String dmakedateStr = DATE_FORMATTER.format(dmakedate1);
UFDate dmakedate = new UFDate(dmakedateStr);

View File

@ -12,18 +12,22 @@ import nc.itf.uap.pf.busiflow.PfButtonClickContext;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.jdbc.framework.processor.MapListProcessor;
import nc.util.mmf.busi.service.PFPubService;
import nc.util.mmf.framework.base.MMStringUtil;
import nc.util.mmf.framework.base.MMValueCheck;
import nc.util.mmpac.wr.WrItemKeyToQualityItemKeyUtil;
import nc.vo.fi.pub.SqlUtils;
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
import nc.vo.mmpac.wr.entity.AggWrVO;
import nc.vo.mmpac.wr.entity.WrItemVO;
import nc.vo.mmpac.wr.entity.WrQualityVO;
import nc.vo.mmpac.wr.entity.WrVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.VOStatus;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.scmpub.res.billtype.MMBillType;
import uap.mw.trans.TransactionFactory;
import java.math.BigDecimal;
import java.sql.Timestamp;
@ -64,8 +68,6 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
try {
IPMOQueryService pmoQueryService = NCLocator.getInstance().lookup(IPMOQueryService.class);
IWrMaintainService wrService = NCLocator.getInstance().lookup(IWrMaintainService.class);
// 手动开启事务
TransactionFactory.getTMProxy().begin(3, 0);
String selSql = "select * from BIPReportMainTab where status = 'C'";
List<Map<String, Object>> mainList = (List<Map<String, Object>>) getImsDao().executeQuery(selSql, new MapListProcessor());
Set<String> pkWrSet = new HashSet<>();
@ -103,7 +105,7 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
hvo.setFbillstatus(2);
String dmakedateStr = "";
if (mainMap.get("dmakedate") != null && mainMap.get("dmakedate") instanceof Timestamp dmakedate1) {
dmakedateStr = DATE_FORMATTER.format(dmakedate1);
dmakedateStr = DATETIME_FORMATTER.format(dmakedate1);
UFDate dmakedate = new UFDate(dmakedateStr);
hvo.setDmakedate(dmakedate);
}
@ -112,6 +114,11 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
UFDateTime creationtime = new UFDateTime(creationtimeStr);
hvo.setCreationtime(creationtime);
}
if (mainMap.get("dbilldate") != null && mainMap.get("dbilldate") instanceof Timestamp dbilldate) {
String dbilldateStr = DATETIME_FORMATTER.format(dbilldate);
UFDate dbilldate1 = new UFDate(dbilldateStr);
hvo.setDbilldate(dbilldate1);
}
for (WrItemVO bvo : bvos) {
bvo.setFbproducttype(1);// 产品类型 1.主产品
bvo.setTbstarttime(new UFDateTime(dmakedateStr + " 00:00:00"));// 开始时间
@ -122,8 +129,10 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
// 物料或数量替换
bvo.setNbplanwrnum(new UFDouble((BigDecimal) detailMap.get("nbplanwrnum")));// 计划完工主数量
bvo.setNbplanwrastnum(new UFDouble((BigDecimal) detailMap.get("nbplanwrastnum")));// 计划完工数量
bvo.setNbwrnum(new UFDouble((BigDecimal) detailMap.get("nbwrnum")));// 完工主数量
bvo.setNbwrastnum(new UFDouble((BigDecimal) detailMap.get("nbwrastnum")));// 完工数量
UFDouble nbwrnum = new UFDouble((BigDecimal) detailMap.get("nbwrnum"));
bvo.setNbwrnum(nbwrnum);// 完工主数量
UFDouble nbwrastnum = new UFDouble((BigDecimal) detailMap.get("nbwrastnum"));
bvo.setNbwrastnum(nbwrastnum);// 完工数量
// 如果物料不相等则BIP物料替换为IMS物料
String cbmaterialvid = bvo.getCbmaterialvid();
String pkOrg = hvo.getPk_org();
@ -138,14 +147,18 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
if (!cbmaterialvid.equals(goodsId)) {
bvo.setCbmaterialvid(goodsId);
}
WrQualityVO bvoQualityVO = new WrQualityVO();
bvoQualityVO.setNgastnum(nbwrastnum);// 处理数量
bvoQualityVO.setNgnum(nbwrnum);// 处理主数量
bvoQualityVO.setFgprocessmethod(1);// 处理方式 默认传1.合格
bvo.setQualityvos(new WrQualityVO[]{bvoQualityVO});
fillQualityVOs(bvo);
}
}
}
AggWrVO[] resultvos = null;
try {
if ("C".equals(status)) {
resultvos = wrService.insert(vos);
}
} catch (BusinessException e) {
logger.error("ProductReportGyImsPlugin Error: ", e);
// NCCForUAPLogger.debug("ProductReportGyImsPlugin Error: " + e.getMessage());
@ -166,16 +179,50 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin {
String updateSql = "update BIPReportMainTab set status = '2' where " + inSql;
getImsDao().executeUpdate(updateSql);
}
// 正常结束
TransactionFactory.getTMProxy().end(null);
logger.error("---end----任务结束运行--");
} catch (Exception e) {
// 异常回滚
TransactionFactory.getTMProxy().end(e);
logger.error("ProductReportGyImsPlugin Error: ", e);
// NCCForUAPLogger.debug("ProductReportGyImsPlugin Error: " + e.getMessage());
}
return null;
}
/**
* 填充生产报告的质量信息
*/
private void fillQualityVOs(WrItemVO item) {
for (WrQualityVO qualityVO : item.getQualityvos()) {
if (MMValueCheck.isEmpty(qualityVO.getNgnum()) && MMValueCheck.isEmpty(qualityVO.getNgastnum())) {
ExceptionUtils.wrappBusinessException("处理数量不能为空");
}
if (MMValueCheck.isEmpty(qualityVO.getFgprocessmethod())) {
ExceptionUtils.wrappBusinessException("处理方式不能为空");
}
for (String[] itemKeyMap : WrItemKeyToQualityItemKeyUtil.itemNoMaterialKeyToQualityKey) {
if (MMValueCheck.isEmpty(itemKeyMap)) {
break;
}
if (MMValueCheck.isEmpty(qualityVO.getAttributeValue(itemKeyMap[1])) && MMValueCheck.isNotEmpty(item.getAttributeValue(itemKeyMap[0]))) {
qualityVO.setAttributeValue(itemKeyMap[1], item.getAttributeValue(itemKeyMap[0]));
}
}
if (MMValueCheck.isEmpty(qualityVO.getCgmaterialid()) || MMStringUtil.isEqual(qualityVO.getCgmaterialid(), item.getCbmaterialid())) {
for (String[] itemKeyMap : WrItemKeyToQualityItemKeyUtil.itemMaterialKeyToQualityKey) {
if (MMValueCheck.isEmpty(itemKeyMap)) {
break;
}
if (MMValueCheck.isEmpty(qualityVO.getAttributeValue(itemKeyMap[1])) && MMValueCheck.isNotEmpty(item.getAttributeValue(itemKeyMap[0]))) {
qualityVO.setAttributeValue(itemKeyMap[1], item.getAttributeValue(itemKeyMap[0]));
}
}
}
qualityVO.setStatus(VOStatus.NEW);
}
}
}

View File

@ -12,8 +12,6 @@ import nc.vo.bd.material.plan.MaterialPlanVO;
import nc.vo.org.OrgVO;
import nc.vo.pub.BusinessException;
import java.util.Map;
/**
* 精密-物料计划信息保存前校验
*
@ -35,12 +33,13 @@ public class MaterialSaveBeforeCheckJMListener implements IBusinessListener {
for (Object obj : objs) {
if (obj instanceof MaterialPlanVO planVO) {
String pkOrg = planVO.getPk_org();
String pkMaterialplan = planVO.getPk_materialplan();
// 组织判断精密的才需校验
if (MMValueCheck.isNotEmpty(orgId) && orgId.equals(pkOrg)) {
String def2 = planVO.getDef2();// 启源物料编码/原系统物料编码
if (MMValueCheck.isNotEmpty(def2)) {
String countSql = "select count(1) from bd_materialplan where pk_org = '[pk_org]' and def2 = '[def2]'";
countSql = countSql.replace("[pk_org]", pkOrg).replace("[def2]", def2);
String countSql = "select count(1) from bd_materialplan where pk_org = '[pk_org]' and pk_materialplan != '[pkMaterialplan]' and def2 = '[def2]'";
countSql = countSql.replace("[pk_org]", pkOrg).replace("[def2]", def2).replace("[pkMaterialplan]", pkMaterialplan);
Integer num = (Integer) baseDAO.executeQuery(countSql, new ColumnProcessor());
if (num > 0) {
throw new BusinessException("原系统物料编码重复,请检查!");