优化逻辑

This commit is contained in:
张明 2025-05-21 20:42:01 +08:00
parent aee3473bbd
commit fa9201a2b1
5 changed files with 31 additions and 32 deletions

View File

@ -92,17 +92,17 @@ public class AfterSigningSynchronizeRuleMES implements IRule<PurchaseInVO> {
PsndocVO.NAME, PsndocVO.PK_PSNDOC, hvo.getCwhsmanagerid())); // 保管员 PsndocVO.NAME, PsndocVO.PK_PSNDOC, hvo.getCwhsmanagerid())); // 保管员
dataObj.put("remark", hvo.getVnote()); // 备注 dataObj.put("remark", hvo.getVnote()); // 备注
// 添加采购员信息 - 来自cbizid字段 // 添加采购员信息 - 来自cbizid字段
String purchaser = transferCodeByPk(PsndocVO.getDefaultTableName(), // String purchaser = transferCodeByPk(PsndocVO.getDefaultTableName(),
PsndocVO.NAME, PsndocVO.PK_PSNDOC, hvo.getCbizid()); // PsndocVO.NAME, PsndocVO.PK_PSNDOC, hvo.getCbizid());
if (purchaser != null && !purchaser.isEmpty()) { // if (purchaser != null && !purchaser.isEmpty()) {
dataObj.put("purchaser", purchaser); // 采购员 // dataObj.put("purchaser", purchaser); // 采购员
} // }
// 添加供应商信息 - 来自cvendorid字段 // // 添加供应商信息 - 来自cvendorid字段
String supplier = transferCodeByPk(SupplierVO.getDefaultTableName(), // String supplier = transferCodeByPk(SupplierVO.getDefaultTableName(),
SupplierVO.CODE, SupplierVO.PK_SUPPLIER, hvo.getCvendorid()); // SupplierVO.CODE, SupplierVO.PK_SUPPLIER, hvo.getCvendorid());
if (supplier != null && !supplier.isEmpty()) { // if (supplier != null && !supplier.isEmpty()) {
dataObj.put("supplierId", supplier); // 供应商编码 // dataObj.put("supplierId", supplier); // 供应商编码
} // }
// 构建明细 // 构建明细
List<JSONObject> detailsList = new ArrayList<>(); List<JSONObject> detailsList = new ArrayList<>();
if (bvos != null) { if (bvos != null) {

View File

@ -48,7 +48,7 @@ public class PurchaseReceiptRuleMES implements IRule<PurchaseInVO> {
obmlog.debug("AfterSigningSynchronizeRuleMES-没有需要处理的采购收货单"); obmlog.debug("AfterSigningSynchronizeRuleMES-没有需要处理的采购收货单");
return; return;
} }
// 检查并筛选组织为电缆的采购收货单 // // 检查并筛选组织为电缆的采购收货单
List<PurchaseInVO> filteredPurchaseInVOS = checkAndFilterBills(purchaseInVOS); List<PurchaseInVO> filteredPurchaseInVOS = checkAndFilterBills(purchaseInVOS);
if (filteredPurchaseInVOS.isEmpty()) { if (filteredPurchaseInVOS.isEmpty()) {
obmlog.debug("AfterSigningSynchronizeRuleMES-没有需要处理的需要同步的组织为电缆的采购收货单"); obmlog.debug("AfterSigningSynchronizeRuleMES-没有需要处理的需要同步的组织为电缆的采购收货单");
@ -179,7 +179,7 @@ public class PurchaseReceiptRuleMES implements IRule<PurchaseInVO> {
// 分类必填- 默认为"N"(货物) // 分类必填- 默认为"N"(货物)
data.put("costOrder", "N"); data.put("costOrder", "N");
// 是否退货必填- 映射为freplenishflag如果为Y则为退货 // 是否退货必填- 映射为freplenishflag如果为Y则为退货
data.put("returned", head.getFreplenishflag()); data.put("returned", head.getFreplenishflag() == null ? head.getFreplenishflag().booleanValue() : null);
// 备注 - 映射为vnote // 备注 - 映射为vnote
data.put("remark", head.getVnote()); data.put("remark", head.getVnote());
// 维护人信息 // 维护人信息
@ -192,7 +192,7 @@ public class PurchaseReceiptRuleMES implements IRule<PurchaseInVO> {
for (PurchaseInBodyVO body : bodys) { for (PurchaseInBodyVO body : bodys) {
JSONObject detailItem = new JSONObject(); JSONObject detailItem = new JSONObject();
// 收货单号必填- 在buildSyncData方法中设置 // 收货单号必填- 在buildSyncData方法中设置
detailItem.put("orderNo", dbilldate != null ? dbilldate.toString().substring(0, 10) : null); detailItem.put("orderNo", head.getVbillcode());
// 收货单序号必填- 映射为行号(crowno) // 收货单序号必填- 映射为行号(crowno)
detailItem.put("orderSn", body.getCrowno()); detailItem.put("orderSn", body.getCrowno());
// 事务类型必填- 使用表体字段cbodytranstypecode // 事务类型必填- 使用表体字段cbodytranstypecode

View File

@ -14,6 +14,7 @@ import nc.vo.bd.material.MaterialVO;
import nc.vo.bd.material.measdoc.MeasdocVO; import nc.vo.bd.material.measdoc.MeasdocVO;
import nc.vo.bd.psn.PsndocVO; import nc.vo.bd.psn.PsndocVO;
import nc.vo.bd.rack.RackVO; import nc.vo.bd.rack.RackVO;
import nc.vo.bd.stordoc.StordocVO;
import nc.vo.bd.supplier.SupplierVO; import nc.vo.bd.supplier.SupplierVO;
import nc.vo.ic.m45.entity.PurchaseInVO; import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.ic.m4c.entity.SaleOutBodyVO; import nc.vo.ic.m4c.entity.SaleOutBodyVO;
@ -24,6 +25,7 @@ import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDate; import nc.vo.pub.lang.UFDate;
import nc.vo.pubapp.pattern.exception.ExceptionUtils; import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.pubapp.pattern.pub.SqlBuilder; import nc.vo.pubapp.pattern.pub.SqlBuilder;
import nc.vo.vorg.DeptVersionVO;
import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys;
import net.sf.mpxj.primavera.schema.CurrencyType; import net.sf.mpxj.primavera.schema.CurrencyType;
@ -38,9 +40,8 @@ import java.util.List;
* 销售出库签字后传MES金思维系统 * 销售出库签字后传MES金思维系统
*/ */
public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> { public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> {
private static final String SALE_OUT_URL = "/GTHINKING/AjaxService/N_MISPRO/SaleOrderOutbound.ashx/SaveData"; // 销售出库登记接口 private static final String SALE_OUT_URL = "/GTHINKING/AjaxService/N_KCSJJS/101527003.ashx/gt_rec_api_xsckdj"; // 销售出库登记接口
private static final String logginfo = "OALOG"; private static final Log obmlog = Log.getInstance("OALOG");
private static final Log obmlog = Log.getInstance(logginfo);
private static final BaseDAO dao = new BaseDAO(); private static final BaseDAO dao = new BaseDAO();
public AfterSigningSynchronizeRuleMES() { public AfterSigningSynchronizeRuleMES() {
@ -52,7 +53,7 @@ public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> {
// 初始化HTTP请求工具类 // 初始化HTTP请求工具类
IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class);
if (saleOutVOS == null || saleOutVOS.length == 0) { if (saleOutVOS == null || saleOutVOS.length == 0) {
obmlog.debug("AfterSigningSynchronizeRule-没有需要处理的销售出库单"); obmlog.debug("AfterSigningSynchronizeRule-没有需要处理的销售出库单.");
return; return;
} }
// 检查并筛选组织为电缆的销售出库单 // 检查并筛选组织为电缆的销售出库单
@ -96,14 +97,14 @@ public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> {
// 汇率 默认为1 // 汇率 默认为1
dataObj.put("exRate", 1); dataObj.put("exRate", 1);
// 部门ID - 部门(cdptvid) // 部门ID - 部门(cdptvid)
dataObj.put("departmentId", transferCodeByPk(DeptVO.getDefaultTableName(), dataObj.put("departmentId", transferCodeByPk(DeptVersionVO.getDefaultTableName(),
DeptVO.CODE, DeptVO.PK_DEPT, hvo.getCdptvid())); // 采购部门ID DeptVersionVO.CODE, DeptVersionVO.PK_VID, hvo.getCdptvid())); // 采购部门ID
// 仓库编码 - 仓库(cwarehouseid) // 仓库编码 - 仓库(cwarehouseid)
dataObj.put("storeId", transferCodeByPk(RackVO.getDefaultTableName(), dataObj.put("storeId", transferCodeByPk(StordocVO.getDefaultTableName(),
RackVO.CODE, RackVO.PK_RACK, hvo.getCwarehouseid())); // 仓库编码 StordocVO.CODE, StordocVO.PK_STORDOC, hvo.getCwarehouseid())); // 仓库编码
// 采购员 - 业务员(cbizpersonid) // 采购员 - 业务员(cbizpersonid)
dataObj.put("purchaser", transferCodeByPk(PsndocVO.getDefaultTableName(), dataObj.put("purchaser", transferCodeByPk(PsndocVO.getDefaultTableName(),
PsndocVO.CODE, PsndocVO.PK_PSNDOC, hvo.getCbizid())); PsndocVO.NAME, PsndocVO.PK_PSNDOC, hvo.getCbizid()));
// 客户ID - 订单客户(ccustomerid)这里因为是采购所以用供应商映射 // 客户ID - 订单客户(ccustomerid)这里因为是采购所以用供应商映射
dataObj.put("supplyId", transferCodeByPk(CustomerVO.getDefaultTableName(), dataObj.put("supplyId", transferCodeByPk(CustomerVO.getDefaultTableName(),
CustomerVO.CODE, CustomerVO.PK_CUSTOMER, hvo.getCcustomerid())); CustomerVO.CODE, CustomerVO.PK_CUSTOMER, hvo.getCcustomerid()));
@ -156,11 +157,11 @@ public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> {
detail.put("batchNum", bvo.getVbatchcode()); // 物料批号 - 必填 detail.put("batchNum", bvo.getVbatchcode()); // 物料批号 - 必填
detail.put("scaleFactor", transferSpecialField(bvo.getVchangerate())); // 换算系数 - 必填 detail.put("scaleFactor", transferSpecialField(bvo.getVchangerate())); // 换算系数 - 必填
// 数量信息 - 必填 // 数量信息 - 必填
detail.put("issuedQty", bvo.getNshouldassistnum()); // 应发数量 - 必填 detail.put("issuedQty", bvo.getNshouldassistnum() == null ? bvo.getNshouldassistnum().getDouble() : null); // 应发数量 - 必填
detail.put("mIssuedQty", bvo.getNshouldnum()); // 主应发数量 - 必填 detail.put("mIssuedQty", bvo.getNshouldnum() == null ? bvo.getNshouldnum().getDouble() : null); // 主应发数量 - 必填
detail.put("actQry", bvo.getNassistnum()); // 实发数量 - 必填 detail.put("actQry", bvo.getNassistnum() == null ? bvo.getNassistnum().getDouble() : null); // 实发数量 - 必填
detail.put("mActQry", bvo.getNnum()); // 主实发数量 - 必填 detail.put("mActQry", bvo.getNnum() == null ? bvo.getNnum().getDouble() : null); // 主实发数量 - 必填
detail.put("assistActQry", bvo.getNassistnum()); // 辅助实发数量 - 必填 detail.put("assistActQry", bvo.getNassistnum() == null ? bvo.getNassistnum().getDouble() : null); // 辅助实发数量 - 必填
// 客户和供应商信息 // 客户和供应商信息
detail.put("customId", transferCodeByPk(CustomerVO.getDefaultTableName(), detail.put("customId", transferCodeByPk(CustomerVO.getDefaultTableName(),
CustomerVO.CODE, CustomerVO.PK_CUSTOMER, bvo.getCasscustid())); // 客户ID CustomerVO.CODE, CustomerVO.PK_CUSTOMER, bvo.getCasscustid())); // 客户ID

View File

@ -13,11 +13,9 @@ import nc.vo.bd.material.MaterialVO;
import nc.vo.bd.rack.RackVO; import nc.vo.bd.rack.RackVO;
import nc.vo.bd.stordoc.StordocVO; import nc.vo.bd.stordoc.StordocVO;
import nc.vo.bd.supplier.SupplierVO; import nc.vo.bd.supplier.SupplierVO;
import nc.vo.ic.m4c.entity.SaleOutVO;
import nc.vo.ic.m4r.entity.InvCountBillVO; import nc.vo.ic.m4r.entity.InvCountBillVO;
import nc.vo.ic.m4r.entity.InvCountBodyVO; import nc.vo.ic.m4r.entity.InvCountBodyVO;
import nc.vo.ic.m4r.entity.InvCountHeaderVO; import nc.vo.ic.m4r.entity.InvCountHeaderVO;
import nc.vo.org.DeptVO;
import nc.vo.pub.BusinessException; import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDate; import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDouble; import nc.vo.pub.lang.UFDouble;

View File

@ -200,8 +200,8 @@ public class AfterApprovingSynchronizeRuleMES implements IRule<SaleOrderVO> {
JSONArray properties = new JSONArray(); JSONArray properties = new JSONArray();
JSONObject property = new JSONObject(); JSONObject property = new JSONObject();
// ÐкŠ// ÐкÅ
property.put("propertyFiled", head.getVbillcode()); property.put("propertyFiled", "SXZF15");
property.put("propertyValue", body.getCrowno()); property.put("propertyValue", body.getCsaleorderbid());
properties.add(property); properties.add(property);
detailItem.put("properties", properties); detailItem.put("properties", properties);
details.add(detailItem); details.add(detailItem);