质检报告推送qms优化,备注字段改为从收货单子表获取

This commit is contained in:
lihao 2025-10-20 20:31:58 +08:00
parent 393be18782
commit d68f368111
3 changed files with 59 additions and 180 deletions

View File

@ -81,16 +81,16 @@ public class QCRptDataPushtoQmsAction implements ICommonAction {
boolean needSkip = false; // 标记是否需要跳过当前ArriveVO
// 检查当前到货单的所有明细只要有一个明细的vbdef23为Y/y就跳过整个到货单
if (bvos != null && bvos.length > 0) {
for (ArriveItemVO itemVO : bvos) {
// 获取vbdef23字段值处理null情况
String vbdef23 = (String) itemVO.getAttributeValue("vbdef23");
if (vbdef23 != null && "Y".equalsIgnoreCase(vbdef23)) {
needSkip = true;
break; // 只要有一个明细符合直接跳出明细循环
}
}
}
// if (bvos != null && bvos.length > 0) {
// for (ArriveItemVO itemVO : bvos) {
// // 获取vbdef32字段值处理null情况
// String vbdef32 = (String) itemVO.getAttributeValue("vbdef32");
// if (vbdef32 != null && "Y".equalsIgnoreCase(vbdef32)) {
// needSkip = true;
// break; // 只要有一个明细符合直接跳出明细循环
// }
// }
// }
// 不需要跳过的加入有效列表
if (!needSkip) {
@ -166,22 +166,29 @@ public class QCRptDataPushtoQmsAction implements ICommonAction {
itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格
itemObj.put("sjsl", reportHeaderVO.getNapplynum().toString()); // 送检数量设计单位按设计计量单位统计的送检数量
itemObj.put("jldw", cunitname); // 计量单位
itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注用于填写该送检物料的补充说明
itemObj.put("bz", getBz(bvo,reportItemVO.getCfirstbid())); // 明细备注用于填写该送检物料的补充说明
itemObj.put("bipzyid", pkReportbill); // 质检报告ID
itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID
contentArray.add(itemObj);
}
singleObj.put("Content", contentArray);
// pushData(singleObj);
// update.add(hvo.getPk_arriveorder());
// updateArrveOrder(hvo.getPk_arriveorder());
pushData(singleObj);
update.add(hvo.getPk_arriveorder());
updateArrveOrder(hvo.getPk_arriveorder());
}
}
private Object getBz(ArriveItemVO[] bvo, String cfirstbid) {
for (ArriveItemVO arriveItemVO : bvo) {
if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) {
return arriveItemVO.getVmemob();
}
}
return null;
}
private void updateArrveOrder(String pkArriveorder) throws DAOException {
BaseDAO dao = new BaseDAO();
String sql = "update po_arriveorder_b set vbdef23='Y' where pk_arriveorder='"
String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='"
+ pkArriveorder + "'";
dao.executeUpdate(sql);
}
@ -215,87 +222,6 @@ public class QCRptDataPushtoQmsAction implements ICommonAction {
return cghth;
}
private void buildSyncData1(ReportVO[] useVOs) throws BusinessException {
for (ReportVO vo : useVOs) {
ReportHeaderVO hvo = vo.getHVO();
ReportItemVO[] bvo = vo.getBVO();
// 判断物料的业务单元是否是箱变公司不是则跳过
String pkOrg = hvo.getPk_org();
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
if (checkIfOrg(orgCode, configParams)) {
continue;
}
// 查询供应商信息
String pk_supplier_v = hvo.getPk_supplier_v();
SupplierVersionVO supplierVersionVO = new SupplierVersionVO();
if (pk_supplier_v != null && !pk_supplier_v.isEmpty() && !"~".equals(pk_supplier_v)) {
ISupplierBaseInfoQryService baseQryService = NCLocator.getInstance().lookup(ISupplierBaseInfoQryService.class);
supplierVersionVO = baseQryService.querySupplierVersionByVID(pk_supplier_v);
}
// 查询人员信息
String pkApplyer = hvo.getPk_applyer();
String applyerName = MyHelper.getStrValByCondition(PsndocVO.getDefaultTableName(), PsndocVO.NAME,
PsndocVO.PK_PSNDOC + " = '" + pkApplyer + "'");
String bz = "", cghth = "";
if (bvo != null && bvo.length > 0) {
bz = bvo[0].getVbdef1(); // BOM备注
cghth = bvo[0].getVbdef2(); // 采购单号
}
// 组装数据
JSONObject singleObj = new JSONObject();
long cts = System.currentTimeMillis();
singleObj.put("batchid", cts);
singleObj.put("csdh", hvo.getVapplybillcode());// 送检单号采购送检单的唯一标识编号
singleObj.put("sjrq", hvo.getDapplydate().toString());// 送检日期格式建议为 yyyy-MM-dd
singleObj.put("wlgysid", supplierVersionVO.getCode());// 供应商编码
singleObj.put("wlgysmc", supplierVersionVO.getName());// 供应商名称
singleObj.put("sjr", applyerName);// 送检人负责提交送检单的人员姓名
singleObj.put("cghth", cghth);// 采购合同号关联对应的采购合同
singleObj.put("bz", hvo.getVmemo());// 摘要备注用于填写送检单的补充说明信息
String pkMaterial = hvo.getPk_material();
Map<String, Object> materialMap = MyHelper.getMapValByCondition(MaterialVO.getDefaultTableName(), "code,name,materialspec,materialtype",
"pk_material = '" + pkMaterial + "'");
String cunitid = hvo.getCunitid();// 主单位
String cunitname = MyHelper.getStrValByCondition(MeasdocVO.getDefaultTableName(), MeasdocVO.NAME,
MeasdocVO.PK_MEASDOC + " = '" + cunitid + "'");
// 处理Content数组
JSONArray contentArray = new JSONArray();
JSONObject itemObj = new JSONObject();
itemObj.put("wlbh", materialMap.getOrDefault("code", "")); // 物料编码
itemObj.put("wlmc", materialMap.getOrDefault("name", "")); // 物料名称
String materialtype = skipNull(materialMap.get("materialtype"));
String materialspec = skipNull(materialMap.get("materialspec"));
itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格
itemObj.put("sjsl", hvo.getNapplynum().toString()); // 送检数量设计单位按设计计量单位统计的送检数量
itemObj.put("jldw", cunitname); // 计量单位
itemObj.put("bz", bz); // 明细备注用于填写该送检物料的补充说明
contentArray.add(itemObj);
singleObj.put("Content", contentArray);
/* {
"batchid": "10002",
"csdh": "SJ202405001",
"sjrq": "2024-05-20",
"wlgysid": "GY001",
"wlgysmc": "XX 金属材料有限公司",
"sjr": "张三",
"cghth": "HT202405003",
"bz": "紧急送检,需优先检测",
"Content": [
{
"wlbh": "ACC26711",
"wlmc": "铜排",
"wlxhgg": "15558190831",
"jldw": "",
"sjsl": "50",
"bz": "无特殊要求"
}
]
}*/
pushData(singleObj);
}
}
/**
* 推送同步数据

View File

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Log;
import nc.bs.trade.business.HYPubBO;
@ -169,15 +171,30 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> {
}
itemObj.put("jldw", cunitname); // 计量单位
itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注
itemObj.put("bz", getBz(bvo,reportItemVO.getCfirstbid())); // Ã÷ϸ±¸×¢ ËÍ»õµ¥±¸×¢
itemObj.put("bipzyid", pkReportbill); // 质检报告ID
itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID
contentArray.add(itemObj);
}
singleObj.put("Content", contentArray);
pushData(singleObj);
updateArrveOrder(hvo.getPk_arriveorder());
}
}
private void updateArrveOrder(String pkArriveorder) throws DAOException {
BaseDAO dao = new BaseDAO();
String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='"
+ pkArriveorder + "'";
dao.executeUpdate(sql);
}
private Object getBz(ArriveItemVO[] bvo, String cfirstbid) {
for (ArriveItemVO arriveItemVO : bvo) {
if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) {
return arriveItemVO.getVmemob();
}
}
return null;
}
// 以下方法与原逻辑一致未做修改
private String getCghthVal(ArriveHeaderVO hvo, ArriveItemVO[] bvo) throws BusinessException {

View File

@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Log;
import nc.bs.trade.business.HYPubBO;
@ -139,15 +141,30 @@ public class SyncQcQmsRule implements IRule<ReportVO> {
itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格
itemObj.put("sjsl", reportHeaderVO.getNapplynum().toString()); // 送检数量设计单位按设计计量单位统计的送检数量
itemObj.put("jldw", cunitname); // 计量单位
itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注用于填写该送检物料的补充说明
itemObj.put("bz", getBz(bvo,reportItemVO.getCfirstbid())); // Ã÷ϸ±¸×¢£¬ËÍ»õµ¥±¸×¢
itemObj.put("bipzyid", pkReportbill); // 质检报告ID
itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID
contentArray.add(itemObj);
}
singleObj.put("Content", contentArray);
pushData(singleObj);
updateArrveOrder(hvo.getPk_arriveorder());
}
}
private void updateArrveOrder(String pkArriveorder) throws DAOException {
BaseDAO dao = new BaseDAO();
String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='"
+ pkArriveorder + "'";
dao.executeUpdate(sql);
}
private Object getBz(ArriveItemVO[] bvo, String cfirstbid) {
for (ArriveItemVO arriveItemVO : bvo) {
if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) {
return arriveItemVO.getVmemob();
}
}
return null;
}
private String getCghthVal(ArriveHeaderVO hvo, ArriveItemVO[] bvo) throws BusinessException {
String cghth = "";
@ -178,87 +195,6 @@ public class SyncQcQmsRule implements IRule<ReportVO> {
return cghth;
}
private void buildSyncData1(ReportVO[] useVOs) throws BusinessException {
for (ReportVO vo : useVOs) {
ReportHeaderVO hvo = vo.getHVO();
ReportItemVO[] bvo = vo.getBVO();
// 判断物料的业务单元是否是箱变公司不是则跳过
String pkOrg = hvo.getPk_org();
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
if (checkIfOrg(orgCode, configParams)) {
continue;
}
// 查询供应商信息
String pk_supplier_v = hvo.getPk_supplier_v();
SupplierVersionVO supplierVersionVO = new SupplierVersionVO();
if (pk_supplier_v != null && !pk_supplier_v.isEmpty() && !"~".equals(pk_supplier_v)) {
ISupplierBaseInfoQryService baseQryService = NCLocator.getInstance().lookup(ISupplierBaseInfoQryService.class);
supplierVersionVO = baseQryService.querySupplierVersionByVID(pk_supplier_v);
}
// 查询人员信息
String pkApplyer = hvo.getPk_applyer();
String applyerName = MyHelper.getStrValByCondition(PsndocVO.getDefaultTableName(), PsndocVO.NAME,
PsndocVO.PK_PSNDOC + " = '" + pkApplyer + "'");
String bz = "", cghth = "";
if (bvo != null && bvo.length > 0) {
bz = bvo[0].getVbdef1(); // BOM备注
cghth = bvo[0].getVbdef2(); // 采购单号
}
// 组装数据
JSONObject singleObj = new JSONObject();
long cts = System.currentTimeMillis();
singleObj.put("batchid", cts);
singleObj.put("csdh", hvo.getVapplybillcode());// 送检单号采购送检单的唯一标识编号
singleObj.put("sjrq", hvo.getDapplydate().toString());// 送检日期格式建议为 yyyy-MM-dd
singleObj.put("wlgysid", supplierVersionVO.getCode());// 供应商编码
singleObj.put("wlgysmc", supplierVersionVO.getName());// 供应商名称
singleObj.put("sjr", applyerName);// 送检人负责提交送检单的人员姓名
singleObj.put("cghth", cghth);// 采购合同号关联对应的采购合同
singleObj.put("bz", hvo.getVmemo());// 摘要备注用于填写送检单的补充说明信息
String pkMaterial = hvo.getPk_material();
Map<String, Object> materialMap = MyHelper.getMapValByCondition(MaterialVO.getDefaultTableName(), "code,name,materialspec,materialtype",
"pk_material = '" + pkMaterial + "'");
String cunitid = hvo.getCunitid();// 主单位
String cunitname = MyHelper.getStrValByCondition(MeasdocVO.getDefaultTableName(), MeasdocVO.NAME,
MeasdocVO.PK_MEASDOC + " = '" + cunitid + "'");
// 处理Content数组
JSONArray contentArray = new JSONArray();
JSONObject itemObj = new JSONObject();
itemObj.put("wlbh", materialMap.getOrDefault("code", "")); // 物料编码
itemObj.put("wlmc", materialMap.getOrDefault("name", "")); // 物料名称
String materialtype = skipNull(materialMap.get("materialtype"));
String materialspec = skipNull(materialMap.get("materialspec"));
itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格
itemObj.put("sjsl", hvo.getNapplynum().toString()); // 送检数量设计单位按设计计量单位统计的送检数量
itemObj.put("jldw", cunitname); // 计量单位
itemObj.put("bz", bz); // 明细备注用于填写该送检物料的补充说明
contentArray.add(itemObj);
singleObj.put("Content", contentArray);
/* {
"batchid": "10002",
"csdh": "SJ202405001",
"sjrq": "2024-05-20",
"wlgysid": "GY001",
"wlgysmc": "XX 金属材料有限公司",
"sjr": "张三",
"cghth": "HT202405003",
"bz": "紧急送检,需优先检测",
"Content": [
{
"wlbh": "ACC26711",
"wlmc": "铜排",
"wlxhgg": "15558190831",
"jldw": "",
"sjsl": "50",
"bz": "无特殊要求"
}
]
}*/
pushData(singleObj);
}
}
/**
* 推送同步数据