|
@@ -22,6 +22,15 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
this.content = controller.content;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public void checkOffOrderItems(Long sa_orderid, String tablename) throws YosException {
|
|
|
+ Rows iteminfos = dbConnect.runSqlQuery("select t2.itemno from " + tablename + " t1 inner join plm_item t2 on t1.siteid=t2.siteid and t1.itemid=t2.itemid where t1.sa_orderid="
|
|
|
+ + sa_orderid + " and t1.siteid='" + controller.siteid + "' and t2.isonsale!=1");
|
|
|
+ if (iteminfos.isNotEmpty()) {
|
|
|
+ new YosException(false, "检测到品号" + iteminfos.get(0).getString("itemno") + "未上架,请删除后重试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 是否符合商品起订量和增量判断
|
|
|
*
|
|
@@ -137,7 +146,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
*/
|
|
|
public String getCustomSpec(RowsMap itemRowsMap, JSONObject item) throws YosException {
|
|
|
|
|
|
- String spec="";
|
|
|
+ String spec = "";
|
|
|
Rows customschemeRows = dbConnect.runSqlQuery("select * from sa_customscheme_items where siteid='" + controller.siteid + "'");
|
|
|
RowsMap customschemeRowsMap = customschemeRows.toRowsMap("sa_customschemeid");
|
|
|
|
|
@@ -145,9 +154,9 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
if (itemRowsMap.containsKey(itemid)) {
|
|
|
if (itemRowsMap.get(itemid).isNotEmpty()) {
|
|
|
if (!itemRowsMap.get(itemid).get(0).getBoolean("iscustomsize")) {
|
|
|
- spec=itemRowsMap.get(itemid).get(0).getString("spec");
|
|
|
+ spec = itemRowsMap.get(itemid).get(0).getString("spec");
|
|
|
} else {
|
|
|
- spec=item.getStringValue("length") + "*" + item.getStringValue("width");
|
|
|
+ spec = item.getStringValue("length") + "*" + item.getStringValue("width");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -195,11 +204,11 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
|
|
|
String sa_orderitems = "sa_orderitems";
|
|
|
|
|
|
- public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price,BigDecimal saleprice, BigDecimal marketprice,String spec, Rows promotionitems) throws YosException {
|
|
|
+ public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice, String spec, Rows promotionitems) throws YosException {
|
|
|
Long itemid = item.getLong("itemid");
|
|
|
BigDecimal qty = item.getBigDecimalValue("qty");
|
|
|
RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
|
|
|
- String signaturecode="";
|
|
|
+ String signaturecode = "";
|
|
|
if (type.equals("促销订单")) {
|
|
|
if (promotionitemsRowsMap.containsKey(item.getString("sa_promotion_itemsid"))) {
|
|
|
if (promotionitemsRowsMap.get(item.getString("sa_promotion_itemsid")).isNotEmpty()) {
|
|
@@ -215,7 +224,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
insertSQL.setValue("sa_orderid", content.getLongValue("sa_orderid"));
|
|
|
insertSQL.setValue("rowno", 1);
|
|
|
insertSQL.setValue("itemid", itemid);
|
|
|
- insertSQL.setValue("remarks", item.getStringValue("remarks")+signaturecode);
|
|
|
+ insertSQL.setValue("remarks", item.getStringValue("remarks") + signaturecode);
|
|
|
insertSQL.setValue("itemno", itemRow.getString("itemno"));
|
|
|
insertSQL.setValue("itemname", itemRow.getString("itemname"));
|
|
|
insertSQL.setValue("model", itemRow.getString("model"));
|
|
@@ -225,8 +234,8 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
insertSQL.setValue("stockno", item.getOrDefault("stockno", "null"));
|
|
|
insertSQL.setValue("position", item.getOrDefault("position", "null"));
|
|
|
insertSQL.setValue("batchno", item.getOrDefault("batchno", "null"));
|
|
|
- insertSQL.setValue("spec",spec);
|
|
|
- insertSQL.setValue("sa_promotion_itemsid",item.getLongValue("sa_promotion_itemsid"));
|
|
|
+ insertSQL.setValue("spec", spec);
|
|
|
+ insertSQL.setValue("sa_promotion_itemsid", item.getLongValue("sa_promotion_itemsid"));
|
|
|
String deliverydate = item.getStringValue("deliverydate");
|
|
|
Rows rows = dbConnect.runSqlQuery("SELECT deliverydate,defaultprice from sa_orderitems WHERE sa_orderitemsid =" + sa_orderitemsid);
|
|
|
if (deliverydate.isEmpty()) {
|
|
@@ -287,7 +296,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
return insertSQL;
|
|
|
}
|
|
|
|
|
|
- public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price,BigDecimal saleprice) throws YosException {
|
|
|
+ public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice) throws YosException {
|
|
|
BigDecimal qty = item.getBigDecimalValue("qty");
|
|
|
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_orderitems);
|
|
@@ -391,6 +400,7 @@ public class OrderItemsHelper extends BaseClass {
|
|
|
|
|
|
return price;
|
|
|
}
|
|
|
+
|
|
|
public BigDecimal getSalePrice(Row orderRow, ItemPrice itemPrice) throws YosException {
|
|
|
String type = orderRow.getString("type");
|
|
|
Long sa_promotionid = orderRow.getLong("sa_promotionid");
|