|
|
@@ -119,7 +119,7 @@ public class costProductShipFormAfterSave extends ExecuteListener {
|
|
|
//出库方式
|
|
|
String OUT_RULE = DBSql.getString(conn, "SELECT OUT_RULE FROM BO_EU_DNIVT_PRODUCT WHERE ID=?", new Object[]{fromWarehouseProductBO.getString("PRODUCT_ID")});
|
|
|
|
|
|
- if (OUT_RULE.equals("1032"))//LIFO后进先出
|
|
|
+ if (OUT_RULE != null && OUT_RULE.equals("1032"))//LIFO后进先出
|
|
|
{
|
|
|
lots = SDK.getBOAPI().query("BO_EU_DNIVT_WAREHOUSE_PRODUCT_LOT").addQuery("BINDID=", fromWarehouseProductBO.getBindId()).addQuery("QUANTITY>0", null).orderByCreated().desc().list();
|
|
|
} else {
|
|
|
@@ -206,7 +206,7 @@ public class costProductShipFormAfterSave extends ExecuteListener {
|
|
|
costShipBO.set("CONTRACT_ID", costBO.get("CONTRACT_ID"));
|
|
|
costShipBO.set("COST_CODE_ID", productBO.get("COST_CODE_ID"));
|
|
|
costShipBO.set("COST_CODE_NAME", productBO.get("COST_CODE_NAME"));
|
|
|
- costShipBO.set("NAME", DBSql.getString("select NAME from BO_EU_DND_GENERAL where OID=? AND ORGID=?", new Object[]{productBO.get("SHIPPING_TYPE_ID"), processExecutionContext.getUserContext().getCompanyModel().getId()}));
|
|
|
+ costShipBO.set("NAME", DBSql.getString("select NAME from BO_EU_DND_COST_CODE where OID=? AND ORGID=?", new Object[]{productBO.get("COST_CODE_ID"), processExecutionContext.getUserContext().getCompanyModel().getId()}));
|
|
|
|
|
|
costShipBO.set("DATE_PURCHASED", LocalDate.now());
|
|
|
costShipBO.set("COST_TYPE_ID", 1228);// 运营成本
|
|
|
@@ -233,8 +233,8 @@ public class costProductShipFormAfterSave extends ExecuteListener {
|
|
|
if (DBSql.getInt(conn, "select count(ID) from BO_EU_DNCTT_CONTRACT_COST_PRODUCT where CONTRACT_COST_ID=? AND STATUS_ID<2159 AND CLOSED=0", new Object[]{costBO.getId()}) == 0) {
|
|
|
//已全部配送完成
|
|
|
costBO.set("STATUS_ID", 1237);//已配送
|
|
|
- double UNIT_COST = 0;
|
|
|
- if (OUT_RULE.equals("1030")) {
|
|
|
+ Double UNIT_COST = 0.0;
|
|
|
+ if (OUT_RULE != null && OUT_RULE.equals("1030")) {
|
|
|
//库存平均单元成本
|
|
|
UNIT_COST = DBSql.getDouble(conn, "SELECT UNIT_COST_AVG FROM BO_EU_DNIVT_PRODUCT WHERE ID='" + fromWarehouseProductBO.getString("PRODUCT_ID") + "'", "UNIT_COST_AVG");
|
|
|
|
|
|
@@ -242,8 +242,15 @@ public class costProductShipFormAfterSave extends ExecuteListener {
|
|
|
UNIT_COST = DBSql.getDouble(conn, "SELECT SUM(UNIT_COST*QUANTITY)/SUM(QUANTITY) AS UNIT_COST FROM BO_EU_DNCTT_CONTRACT_COST_PRODUCT WHERE CONTRACT_COST_ID='" + costBO.getId() + "' AND CLOSED=0", "UNIT_COST");
|
|
|
}
|
|
|
|
|
|
- costBO.set("UNIT_COST", UNIT_COST);
|
|
|
- costBO.set("EXTENDED_COST", UNIT_COST * Integer.parseInt(costBO.getString("QUANTITY")));
|
|
|
+ costBO.set("UNIT_COST", UNIT_COST.toString());
|
|
|
+ // costBO.set("EXTENDED_COST", UNIT_COST * (int) Math.round(Double.parseDouble(costBO.getString("QUANTITY"))));
|
|
|
+
|
|
|
+ Double EXTENDED_COST = UNIT_COST * Integer.parseInt(costBO.getString("QUANTITY"));
|
|
|
+
|
|
|
+ costBO.set("EXTENDED_COST", EXTENDED_COST.toString());
|
|
|
+
|
|
|
+ System.out.println("UNIT_COST=" + UNIT_COST);
|
|
|
+ System.out.println("EXTENDED_COST=" + EXTENDED_COST);
|
|
|
|
|
|
dn.recordFormChanges.record(processExecutionContext.getUserContext(), costBO, "产品配送后", conn);
|
|
|
|