From 5c8660bba1a64744462ab5eccbf5d13a63f420d9 Mon Sep 17 00:00:00 2001 From: ljw Date: Tue, 5 Nov 2024 17:20:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=E8=AE=A2=E8=88=B1=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=8D=95=E4=BF=A1=E4=BF=9D=E5=9B=9E=E5=A1=AB=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BF=A1=E4=BF=9D=E9=A2=9D=E5=BA=A6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storagetrans/form/StorageTransEdit.java | 106 ++++++++++++------ 1 file changed, 74 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java index a33f83a3..4d4eb0a6 100644 --- a/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java +++ b/src/main/java/com/yem/wm/es/storagetrans/form/StorageTransEdit.java @@ -39,6 +39,7 @@ import kd.bos.util.StringUtils; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; +import java.util.concurrent.TimeUnit; import static com.yem.wm.es.contactbook.op.ContactBookSaveOp.uploadAttachmentPanel; import static com.yem.wm.es.salesorder.from.SalesOrderEdit.carryReportCategoryAndHsCode; @@ -88,8 +89,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele if ("yem_es_materialinfo".equals(entryProp.toString())) { for (int row : rowIndexs) { boolean flag = true; - DynamicObject[] encasement = BusinessDataServiceHelper.load("yem_im_encasement", "" + - "yem_im_materialinfo_mi.yem_sourceentryid,yem_im_materialinfo_mi.yem_packingqty", new QFilter[]{ + DynamicObject[] encasement = BusinessDataServiceHelper.load("yem_im_encasement", "yem_im_materialinfo_mi.yem_sourceentryid,yem_im_materialinfo_mi.yem_packingqty", new QFilter[]{ new QFilter("yem_sourcebillid", QCP.equals, dataEntity.getPkValue()) }); if (materialinfo != null && materialinfo.size() > row) { @@ -220,6 +220,39 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele } } + /** + * 计算台数 + */ + private void qty() { + DynamicObjectCollection yemEsMaterialinfo = this.getModel().getEntryEntity("yem_es_materialinfo"); + if (!yemEsMaterialinfo.isEmpty()) { + Map map = new HashMap<>(); + for (DynamicObject loadSingle : yemEsMaterialinfo) { + String aLong = loadSingle.getString("yem_productmodel.yem_products.number"); + BigDecimal yemQty = loadSingle.getBigDecimal("yem_qty"); + if (map.get(aLong) != null) { + BigDecimal bigDecimal = map.get(aLong); + map.put(aLong, bigDecimal.add(yemQty)); + } else { + map.put(aLong, yemQty); + } + } + DynamicObjectCollection yemEsSalesorderL = this.getModel().getEntryEntity("yem_es_salesorder_l"); + if (yemEsSalesorderL != null) { + for (int i = 0; i < yemEsSalesorderL.size(); i++) { + DynamicObject loadSingle = yemEsSalesorderL.get(i); + DynamicObject yemGiftproactype = loadSingle.getDynamicObject("yem_giftproactype"); + if (yemGiftproactype != null) { + String aLong = yemGiftproactype.getString("number"); + if (map.get(aLong) != null) { + this.getModel().setValue("yem_tsagerqty", map.get(aLong), i); + } + } + } + } + } + } + private void customclass(ChangeData changeData) { Object newValue = changeData.getNewValue(); int rowIndex = changeData.getRowIndex(); @@ -229,17 +262,13 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele String yemUnit = yem_customclass.getString("yem_unit"); DynamicObject bdMeasureunits = BusinessDataServiceHelper.loadSingle("bd_measureunits", "id,number,name" , new QFilter[]{new QFilter("name", QCP.equals, yemUnit)}); - if (bdMeasureunits != null) { -// long aLong = bdMeasureunits.getLong("id"); - this.getModel().setValue("yem_declareunit",bdMeasureunits,rowIndex); - }else { - this.getModel().setValue("yem_declareunit",null,rowIndex); - } - }else { - this.getModel().setValue("yem_declareunit",null,rowIndex); + // long aLong = bdMeasureunits.getLong("id"); + this.getModel().setValue("yem_declareunit", bdMeasureunits, rowIndex); + } else { + this.getModel().setValue("yem_declareunit", null, rowIndex); } - }else { - this.getModel().setValue("yem_declareunit",null,rowIndex); + } else { + this.getModel().setValue("yem_declareunit", null, rowIndex); } } @@ -530,7 +559,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele model.setValue("yem_giftproactype", productType, entryRow);//产品机型 model.setValue("yem_bd_products", productss, entryRow);//产品分类 - model.setValue("yem_tsagerqty", tsagerQty, entryRow);//台数 +// model.setValue("yem_tsagerqty", tsagerQty, entryRow);//台数 model.setValue("yem_singlegiftamt", giveAmo, entryRow);//单台礼品金额 model.setValue("yem_singlegiftamtloc", giveAmoBase, entryRow);//单台礼品金额本位币 model.setValue("yem_giftamt", tsagerQty.multiply(giveAmo), entryRow);//礼品金额 @@ -576,7 +605,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele model.setValue("yem_giftproactype", productType, entryRow);//产品机型 model.setValue("yem_bd_products", productss, entryRow);//产品分类 - model.setValue("yem_tsagerqty", tsagerQty, entryRow);//台数 +// model.setValue("yem_tsagerqty", tsagerQty, entryRow);//台数 model.setValue("yem_singlegiftamt", giveAmo, entryRow);//单台礼品金额 model.setValue("yem_singlegiftamtloc", giveAmoBase, entryRow);//单台礼品金额本位币 model.setValue("yem_giftamt", tsagerQty.multiply(giveAmo), entryRow);//礼品金额 @@ -588,6 +617,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele } } } + qty(); } public void visGiftGive() { @@ -602,11 +632,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele break; } } - if (flag) { - view.setVisible(true, "yem_tabpageap6"); - } else { - view.setVisible(false, "yem_tabpageap6"); - } + view.setVisible(flag, "yem_tabpageap6"); } @@ -781,6 +807,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele /** * 订舱通知单和订舱通知单信保回填之间同步附件 + * * @param dataEntity * @see ContactBookSaveOp#uploadAttachmentPanel(DynamicObject, DynamicObject) */ @@ -812,6 +839,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele if ("bldatebackfilled".equals(actionId) && returnData != null) { Map map = (Map) returnData; Date yem_tddate = (Date) map.get("yem_tddate"); + dataEntity.set("yem_tddate", yem_tddate); if (isLastShip(dataEntity)) { // 同步下单平台状态 syncOrderStatus(); @@ -820,14 +848,13 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele updateCsrCredit(yem_tddate); // 更新订舱通知单 updateStoragetrans(yem_tddate); - dataEntity.set("yem_tddate", yem_tddate); SaveServiceHelper.save(new DynamicObject[]{dataEntity}); IFormView view = this.getView(); view.updateView("yem_tddate"); } if ("yem_es_storagetrans_sfile".equals(actionId) && returnData != null) { - putAttachmentData((Map < String, Object > ) returnData, model, this.getView()); + putAttachmentData((Map) returnData, model, this.getView()); // syncAccessoryPanel(dataEntity); } } @@ -835,6 +862,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele /** * 是否是最后一次发运(订舱) * 是否是最后一批发货 + * * @return */ public static boolean isLastShip(DynamicObject dataEntity) { @@ -888,28 +916,24 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele if (order_lastShip.containsKey(contractnumbersM) && YEM.isNotEmpty(order_lastShip.get(contractnumbersM)) && order_lastShip.get(contractnumbersM).equals(shipmentnumbersM) - ) { + ) { return true; } } return false; } - public void putAttachmentData(Map < String, Object > attachInfor, IDataModel modal, IFormView view) - { + public void putAttachmentData(Map attachInfor, IDataModel modal, IFormView view) { String entityId = view.getEntityId(); view.invokeOperation("refresh"); - if(attachInfor != null) - { - List < Map < String, Object >> retData = (List < Map < String, Object >> ) attachInfor.get("attach"); + if (attachInfor != null) { + List> retData = (List>) attachInfor.get("attach"); Long userId = (Long) attachInfor.get("user"); Date date = (Date) attachInfor.get("date"); DynamicObject dataEntity = modal.getDataEntity(true); // ... - if(retData != null && !retData.isEmpty()) - { - for(Map < String, Object > map: retData) - { + if (retData != null && !retData.isEmpty()) { + for (Map map : retData) { String url = (String) map.get("url"); String name = (String) map.get("name"); // 持久化附件到服务器 @@ -1000,6 +1024,22 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele // long id = csrcreditline.getLong("id"); // DynamicObject yem_im_csrcreditline = BusinessDataServiceHelper.loadSingle(id, "yem_im_csrcreditline"); // if (yem_im_csrcreditline != null) { + Date yemRecentlapse = csrcreditline.getDate("yem_recentlapse"); + BigDecimal yemInactivityperiod = csrcreditline.getBigDecimal("yem_inactivityperiod"); + if (yemRecentlapse != null) { + if (yemInactivityperiod.compareTo(BigDecimal.ZERO) != 0) { + long daysInMilliseconds = yemInactivityperiod.longValue() * TimeUnit.DAYS.toMillis(1); + Date date = new Date(yemRecentlapse.getTime() + daysInMilliseconds); + csrcreditline.set("yem_unused", date); + Date newdate = new Date(); + long millisDifference = date.getTime() - newdate.getTime(); + long daysDifference = TimeUnit.MILLISECONDS.toDays(millisDifference); + BigDecimal bigDecimalDaysDifference = BigDecimal.valueOf(daysDifference); + csrcreditline.set("yem_countdown",bigDecimalDaysDifference); +// } else { +// csrcreditline.set("yem_unused", yemRecentlapse); + } + } DynamicObjectCollection yem_creditdetail = csrcreditline.getDynamicObjectCollection("yem_im_info"); for (int i = 0; i < yem_creditdetail.size(); i++) { DynamicObject dynamicObject = yem_creditdetail.get(i); @@ -1100,6 +1140,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele break; } } + private QFilter filterCustomClass(int index) { IDataModel model = this.getModel(); DynamicObject[] loads = getDeclarationElementsUseF7Select(model, index, "yem_customclass"); @@ -1155,7 +1196,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele public static Date addDays(Date d, int days) { Calendar calendar = Calendar.getInstance(); - if (d!=null){ + if (d != null) { calendar.setTime(d); calendar.add(Calendar.DAY_OF_MONTH, days); return calendar.getTime(); @@ -1166,6 +1207,7 @@ public class StorageTransEdit extends AbstractBillPlugIn implements BeforeF7Sele /** * 订舱通知单计算 出库报关金额值 * 出库报关金额差值 = 出库金额 - 订舱通知单明细的销售金额(价格条款) + * * @param dataEntity */ public static void calculateExportAmount(DynamicObject dataEntity) {