箱变请购单修改时更新下游采购订单到货时间
This commit is contained in:
parent
7798eef23a
commit
742a08be8e
|
|
@ -6,21 +6,29 @@
|
||||||
package nc.impl.pu.m20.action;
|
package nc.impl.pu.m20.action;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nc.bs.dao.BaseDAO;
|
||||||
import nc.bs.pu.m20.maintain.PraybillInsertReviseBP;
|
import nc.bs.pu.m20.maintain.PraybillInsertReviseBP;
|
||||||
import nc.bs.pu.m20.maintain.PraybillUpdateReviseBP;
|
import nc.bs.pu.m20.maintain.PraybillUpdateReviseBP;
|
||||||
import nc.bs.pu.m20.maintain.rule.delete.ReviseDeleteBeforeEventRule;
|
import nc.bs.pu.m20.maintain.rule.delete.ReviseDeleteBeforeEventRule;
|
||||||
import nc.bs.pu.m20.plugin.PraybillPluginPoint;
|
import nc.bs.pu.m20.plugin.PraybillPluginPoint;
|
||||||
|
import nc.bs.uapbd.util.MyHelper;
|
||||||
import nc.impl.pubapp.pattern.data.bill.BillDelete;
|
import nc.impl.pubapp.pattern.data.bill.BillDelete;
|
||||||
import nc.impl.pubapp.pattern.data.bill.BillQuery;
|
import nc.impl.pubapp.pattern.data.bill.BillQuery;
|
||||||
import nc.impl.pubapp.pattern.data.bill.BillUpdate;
|
import nc.impl.pubapp.pattern.data.bill.BillUpdate;
|
||||||
import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
|
import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
|
||||||
import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
|
import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
|
||||||
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
|
||||||
|
import nc.jdbc.framework.processor.MapListProcessor;
|
||||||
|
import nc.vo.org.OrgVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillHeaderVO;
|
import nc.vo.pu.m20.entity.PraybillHeaderVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillItemVO;
|
import nc.vo.pu.m20.entity.PraybillItemVO;
|
||||||
import nc.vo.pu.m20.entity.PraybillVO;
|
import nc.vo.pu.m20.entity.PraybillVO;
|
||||||
import nc.vo.pu.m20.enumeration.EnumRevise;
|
import nc.vo.pu.m20.enumeration.EnumRevise;
|
||||||
import nc.vo.pu.pub.enumeration.POEnumBillStatus;
|
import nc.vo.pu.pub.enumeration.POEnumBillStatus;
|
||||||
|
import nc.vo.pub.BusinessException;
|
||||||
import nc.vo.pub.lang.UFBoolean;
|
import nc.vo.pub.lang.UFBoolean;
|
||||||
import nc.vo.pub.lang.UFDate;
|
import nc.vo.pub.lang.UFDate;
|
||||||
import nc.vo.pubapp.AppContext;
|
import nc.vo.pubapp.AppContext;
|
||||||
|
|
@ -30,11 +38,12 @@ import nccloud.commons.lang.ArrayUtils;
|
||||||
public class PraybillRAction {
|
public class PraybillRAction {
|
||||||
public PraybillRAction() {
|
public PraybillRAction() {
|
||||||
}
|
}
|
||||||
|
private Map<String, String> configParams;
|
||||||
public PraybillVO[] revise(PraybillVO[] orderVos) {
|
public PraybillVO[] revise(PraybillVO[] orderVos) throws BusinessException {
|
||||||
if (ArrayUtils.isEmpty(orderVos)) {
|
if (ArrayUtils.isEmpty(orderVos)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
BaseDAO dao = new BaseDAO();
|
||||||
BillTransferTool<PraybillVO> tool = new BillTransferTool(orderVos);
|
BillTransferTool<PraybillVO> tool = new BillTransferTool(orderVos);
|
||||||
PraybillVO[] voOrginal = (PraybillVO[])tool.getOriginBills();
|
PraybillVO[] voOrginal = (PraybillVO[])tool.getOriginBills();
|
||||||
PraybillVO[] voRevised;
|
PraybillVO[] voRevised;
|
||||||
|
|
@ -45,14 +54,50 @@ public class PraybillRAction {
|
||||||
this.insertNewVO(orderVos);
|
this.insertNewVO(orderVos);
|
||||||
voRevised = this.saveNewVO(orderVos, voOrginal);
|
voRevised = this.saveNewVO(orderVos, voOrginal);
|
||||||
this.saveOriginVos(voOrginal);
|
this.saveOriginVos(voOrginal);
|
||||||
} else {
|
} else {
|
||||||
voRevised = this.updateVO(orderVos, voOrginal);
|
voRevised = this.updateVO(orderVos, voOrginal);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 2025-11-12
|
||||||
|
* 箱变请购单修改时更新下游采购订单到货时间
|
||||||
|
*/
|
||||||
|
for (PraybillVO vo : voRevised) {
|
||||||
|
configParams = MyHelper.getConfigParams("xb-config", null);
|
||||||
|
if (configParams.isEmpty()) {
|
||||||
|
throw new BusinessException("箱变的QMS接口缺少配置");
|
||||||
|
}
|
||||||
|
String pkOrg = vo.getHVO().getPk_org();
|
||||||
|
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
|
||||||
|
if (checkIfOrg(orgCode, configParams)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (PraybillItemVO itemVO: vo.getBVO()){
|
||||||
|
String ordersql = "select pk_order_b from po_order_b where csourcebid ='" + itemVO.getPk_srcpraybillb() + "' and dr = 0";
|
||||||
|
List<Map<String, Object>> orders = (List<Map<String, Object>>) dao.executeQuery(ordersql, new MapListProcessor());
|
||||||
|
for (Map<String, Object> order : orders) {
|
||||||
|
// 更新采购订单
|
||||||
|
String updateOrderSql = "update po_order_b set dplanarrvdate='" + itemVO.getDreqdate().toStdString()+" 00:00:00"+ "' where pk_order_b='"
|
||||||
|
+ order.get("pk_order_b") + "'";
|
||||||
|
dao.executeUpdate(updateOrderSql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return voRevised;
|
return voRevised;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
|
||||||
|
String targetCode = configParams.get("xbOrg");
|
||||||
|
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
|
||||||
|
throw new BusinessException("未配置组织参数");
|
||||||
|
}
|
||||||
|
String[] orgItem = targetCode.split(",");
|
||||||
|
for (String orgCode : orgItem) {
|
||||||
|
if (!orgCode.isEmpty() && orgCode.equals(code)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public PraybillVO[] reviseDelete(PraybillVO[] orderVos) {
|
public PraybillVO[] reviseDelete(PraybillVO[] orderVos) {
|
||||||
if (ArrayUtils.isEmpty(orderVos)) {
|
if (ArrayUtils.isEmpty(orderVos)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue