diff --git a/uapbd/src/private/nc/bs/uapbd/task/ProductReportGyImsPlugin.java b/uapbd/src/private/nc/bs/uapbd/task/ProductReportGyImsPlugin.java index 2cc8eae9..69a061e5 100644 --- a/uapbd/src/private/nc/bs/uapbd/task/ProductReportGyImsPlugin.java +++ b/uapbd/src/private/nc/bs/uapbd/task/ProductReportGyImsPlugin.java @@ -39,8 +39,8 @@ import java.util.*; * @date 20250929 */ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin { - private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - private SimpleDateFormat sdf_ts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + private SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd"); + private SimpleDateFormat DATETIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // BIP数据源 public static final BaseDAO baseDAO = new BaseDAO(); // IMS数据源 @@ -98,15 +98,13 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin { hvo.setCreator("BIP"); hvo.setBillmaker("BIP"); String dmakedateStr = ""; - if (mainMap.get("dmakedate") != null) { - Timestamp dmakedate1 = (Timestamp) mainMap.get("dmakedate"); - dmakedateStr = sdf.format(dmakedate1); + if (mainMap.get("dmakedate") != null && mainMap.get("dmakedate") instanceof Timestamp dmakedate1) { + dmakedateStr = DATE_FORMATTER.format(dmakedate1); UFDate dmakedate = new UFDate(dmakedateStr); hvo.setDmakedate(dmakedate); } - if (mainMap.get("creationtime") != null) { - Timestamp creationtime1 = (Timestamp) mainMap.get("creationtime"); - String creationtimeStr = sdf_ts.format(creationtime1); + if (mainMap.get("creationtime") != null && mainMap.get("creationtime") instanceof Timestamp creationtime1) { + String creationtimeStr = DATETIME_FORMATTER.format(creationtime1); UFDateTime creationtime = new UFDateTime(creationtimeStr); hvo.setCreationtime(creationtime); } @@ -125,8 +123,9 @@ public class ProductReportGyImsPlugin implements IBackgroundWorkPlugin { // 如果物料不相等,则BIP物料替换为IMS物料 String cbmaterialvid = bvo.getCbmaterialvid(); String goodsCode = detailMap.get("cbmaterialvid") + ""; + String whereSql = MaterialVO.CODE + " = '" + goodsCode + "'" + " and pk_org = '" + hvo.getPk_org() + "'"; String goodsId = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.PK_MATERIAL, - MaterialVO.CODE + " = '" + goodsCode + "'"); + whereSql); if (!cbmaterialvid.equals(goodsId)) { bvo.setCbmaterialvid(goodsId); }