|
@@ -152,9 +152,9 @@ public class OrderItems extends Controller {
|
|
|
BigDecimal defaultprice;
|
|
|
BigDecimal price;
|
|
|
BigDecimal saleprice;
|
|
|
- BigDecimal custamount=new BigDecimal(0);
|
|
|
- BigDecimal rwpricerate=new BigDecimal(1);
|
|
|
- BigDecimal pricerate=new BigDecimal(1);
|
|
|
+ BigDecimal custamount = new BigDecimal(0);
|
|
|
+ BigDecimal rwpricerate = new BigDecimal(1);
|
|
|
+ BigDecimal pricerate = new BigDecimal(1);
|
|
|
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "商品等级价格查询");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
@@ -168,14 +168,14 @@ public class OrderItems extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
- int year= Year.now().getValue();
|
|
|
- int quarter= YearMonth.now().get(IsoFields.QUARTER_OF_YEAR);
|
|
|
- Rows custamountrows =dbConnect.runSqlQuery("select * from sa_agents where sys_enterpriseid="+sys_enterpriseid+" and siteid='"+siteid+"'");
|
|
|
- if(!custamountrows.isEmpty()){
|
|
|
- custamount=custamountrows.get(0).getBigDecimal("custamount");
|
|
|
- if(custamountrows.get(0).getInteger("year")==year && custamountrows.get(0).getInteger("quarter")==quarter){
|
|
|
- if(custamountrows.get(0).getBigDecimal("pricerate").compareTo(BigDecimal.ZERO)>0){
|
|
|
- rwpricerate=custamountrows.get(0).getBigDecimal("pricerate");
|
|
|
+ int year = Year.now().getValue();
|
|
|
+ int quarter = YearMonth.now().get(IsoFields.QUARTER_OF_YEAR);
|
|
|
+ Rows custamountrows = dbConnect.runSqlQuery("select * from sa_agents where sys_enterpriseid=" + sys_enterpriseid + " and siteid='" + siteid + "'");
|
|
|
+ if (!custamountrows.isEmpty()) {
|
|
|
+ custamount = custamountrows.get(0).getBigDecimal("custamount");
|
|
|
+ if (custamountrows.get(0).getInteger("year") == year && custamountrows.get(0).getInteger("quarter") == quarter) {
|
|
|
+ if (custamountrows.get(0).getBigDecimal("pricerate").compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ rwpricerate = custamountrows.get(0).getBigDecimal("pricerate");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -184,11 +184,11 @@ public class OrderItems extends Controller {
|
|
|
if (!item.containsKey("defaultprice")) {
|
|
|
defaultprice = orderItemsHelper.getDefaultprice(itemPrice);
|
|
|
price = orderItemsHelper.getPrice(orderRows.get(0), itemPrice, item, itemRowsMap);
|
|
|
- saleprice = orderItemsHelper.getSalePrice(orderRows.get(0), itemPrice,item,itemRowsMap);
|
|
|
+ saleprice = orderItemsHelper.getSalePrice(orderRows.get(0), itemPrice, item, itemRowsMap);
|
|
|
} else {
|
|
|
defaultprice = item.getBigDecimal("defaultprice");
|
|
|
price = item.getBigDecimal("price");
|
|
|
- saleprice = orderItemsHelper.getSalePrice(orderRows.get(0), itemPrice,item,itemRowsMap);
|
|
|
+ saleprice = orderItemsHelper.getSalePrice(orderRows.get(0), itemPrice, item, itemRowsMap);
|
|
|
if (price.compareTo(price1) != 0) {
|
|
|
sqlList.add(DataContrlLog.createLog(this, "sa_order", sa_orderid, "订单商品【" + itemRow.getString("itemname") + "】由单价:" + price1 + "修改为单价:" + price, "订单修改单价").getSQL());
|
|
|
}
|
|
@@ -198,15 +198,14 @@ public class OrderItems extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
if (isInsert) {
|
|
|
- price=price.multiply(rwpricerate).add(custamount);
|
|
|
- sqlList.add(orderItemsHelper.getInsertSQL(customproperties, sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, itemPrice.getMarketprice(), spec, promotionitems, width, length,custamount,rwpricerate,pricerate).getSQL());
|
|
|
- if(item.getLongValue("sa_workorderid")!=0){
|
|
|
- sqlList.add("update sa_workorder_node_items set sourceid="+sa_orderid+",sourcetable='sa_order' where sa_workorderid="+item.getLongValue("sa_workorderid")+" and itemid="+item.getLong("itemid"));
|
|
|
+ price = price.multiply(rwpricerate).add(custamount);
|
|
|
+ sqlList.add(orderItemsHelper.getInsertSQL(customproperties, sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, itemPrice.getMarketprice(), spec, promotionitems, width, length, custamount, rwpricerate, pricerate).getSQL());
|
|
|
+ if (item.getLongValue("sa_workorderid") != 0) {
|
|
|
+ sqlList.add("update sa_workorder_node_items set sourceid=" + sa_orderid + ",sourcetable='sa_order' where sa_workorderid=" + item.getLongValue("sa_workorderid") + " and itemid=" + item.getLong("itemid"));
|
|
|
}
|
|
|
} else {
|
|
|
- price=price.multiply(rwpricerate).add(item.getBigDecimal("custamount"));
|
|
|
+ price = price.multiply(rwpricerate).add(item.getBigDecimal("custamount"));
|
|
|
sqlList.add(orderItemsHelper.getUpdateSQL(sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, width, length).getSQL());
|
|
|
}
|
|
|
|
|
@@ -450,17 +449,17 @@ public class OrderItems extends Controller {
|
|
|
|
|
|
|
|
|
JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
|
|
|
- String packagetypemxsql ="select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_orderid in(select sa_orderid from sa_orderitems where sa_orderitemsid in"+sa_orderitemsids.toJSONString()+") and t2.packagetypemx in(select distinct t2.packagetypemx from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_orderitemsid in"+sa_orderitemsids.toJSONString()+" and ifnull(t2.packagetypemx,'')!='')";
|
|
|
+ String packagetypemxsql = "select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderid in(select sa_orderid from sa_orderitems where sa_orderitemsid in" + sa_orderitemsids.toJSONString() + ") and t2.packagetypemx in(select distinct t2.packagetypemx from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderitemsid in" + sa_orderitemsids.toJSONString() + " and ifnull(t2.packagetypemx,'')!='')";
|
|
|
packagetypemxsql = packagetypemxsql.replace("[", "(").replace("]", ")");
|
|
|
Rows packagetypemxrows = dbConnect.runSqlQuery(packagetypemxsql);
|
|
|
sa_orderitemsids.addAll(packagetypemxrows.toJsonArray("sa_orderitemsid"));
|
|
|
|
|
|
- String sqldetail ="select sa_workorderid,itemid from sa_orderitems where siteid='"+siteid+"' and sa_orderitemsid in"+sa_orderitemsids.toJSONString();
|
|
|
+ String sqldetail = "select sa_workorderid,itemid from sa_orderitems where siteid='" + siteid + "' and sa_orderitemsid in" + sa_orderitemsids.toJSONString();
|
|
|
sqldetail = sqldetail.replace("[", "(").replace("]", ")");
|
|
|
Rows rowsdetail = dbConnect.runSqlQuery(sqldetail);
|
|
|
- for(Row row : rowsdetail ){
|
|
|
- if(row.getLong("sa_workorderid")!=0){
|
|
|
- dbConnect.runSqlUpdate("update sa_workorder_node_items set sourceid=0,sourcetable='' where sa_workorderid="+row.getLong("sa_workorderid")+" and itemid="+row.getLong("itemid"));
|
|
|
+ for (Row row : rowsdetail) {
|
|
|
+ if (row.getLong("sa_workorderid") != 0) {
|
|
|
+ dbConnect.runSqlUpdate("update sa_workorder_node_items set sourceid=0,sourcetable='' where sa_workorderid=" + row.getLong("sa_workorderid") + " and itemid=" + row.getLong("itemid"));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -655,98 +654,75 @@ public class OrderItems extends Controller {
|
|
|
|
|
|
@API(title = "查询列表", apiversion = R.ID20221109093902.v1.class)
|
|
|
public String selectList() throws YosException, IOException {
|
|
|
- StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
- if (content.containsKey("where")) {
|
|
|
- JSONObject whereObject = content.getJSONObject("where");
|
|
|
- if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t3.spec like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append("or t1.remarks like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
- if (whereObject.containsKey("packagetypemx") && !"".equals(whereObject.getString("packagetypemx"))) {
|
|
|
- where.append(" and(");
|
|
|
- where.append("t4.packagetypemx ='").append(whereObject.getString("packagetypemx")).append("' ");
|
|
|
- where.append(")");
|
|
|
- }
|
|
|
- }
|
|
|
Long sa_orderid = content.getLong("sa_orderid");
|
|
|
Rows orderRows = getOrderRows(this, sa_orderid);
|
|
|
if (orderRows.isNotEmpty()) {
|
|
|
sys_enterpriseid = orderRows.get(0).getLong("sys_enterpriseid");
|
|
|
}
|
|
|
- Long sa_promotionid = orderRows.get(0).getLong("sa_promotionid");
|
|
|
-// boolean isExport = content.getBooleanValue("isExport");
|
|
|
-// SQLFactory sqlFactory = new SQLFactory(this, "订单商品明细_列表", pageSize, pageNumber, pageSorting);
|
|
|
-// if (isExport) {
|
|
|
-// sqlFactory = new SQLFactory(this, "订单商品明细_列表");
|
|
|
-// }
|
|
|
-// sqlFactory.addParameter("siteid", siteid);
|
|
|
-// sqlFactory.addParameter("sa_orderid", sa_orderid);
|
|
|
-// sqlFactory.addParameter_SQL("where", where);
|
|
|
-// Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
-// int year= Year.now().getValue();
|
|
|
-// int quarter= YearMonth.now().get(IsoFields.QUARTER_OF_YEAR);
|
|
|
-
|
|
|
+ Long sa_promotionid = orderRows.get(0).getLong("sa_promotionid");//大于0表示为促销订单
|
|
|
+ String type = orderRows.get(0).getString("type");//订单类型
|
|
|
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_orderitems","*");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_orderitems", "*");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "st_invbal_sale", "t2", "t2.siteid = t1.siteid AND t2.itemid = t1.itemid");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t3", "t3.itemid = t1.itemid and t3.siteid = t1.siteid",
|
|
|
"orderminqty_auxunit", "orderaddqty_auxunit", "spec", "iscustomsize", "widthschemeid", "lengthschemeid", "standards", "k3outcode");
|
|
|
-// querySQL.addJoinTable(JOINTYPE.left, "plm_itemextend", "t4", "t4.itemid = t1.itemid and t4.siteid = t1.siteid",
|
|
|
-// "erpitemno", "erpitemname", "material", "prodline", "device", "specalnote");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_promotion_items", "t4",
|
|
|
- "t4.sa_promotion_itemsid = t1.sa_promotion_itemsid and t4.siteid = t1.siteid and t4.sa_promotionid=" + sa_promotionid,"packagetypemx","saledqty","groupqty");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_workorder", "t5",
|
|
|
- "t1.sa_workorderid=t5.sa_workorderid and t1.siteid=t5.siteid");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_warrantycard", "t6",
|
|
|
- "t6.cardno=t1.cardno and t6.siteid=t1.siteid","sku");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t7",
|
|
|
- "t7.itemid=t6.itemid and t7.siteid=t6.siteid");
|
|
|
-
|
|
|
-// querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t5", "t5.sys_enterpriseid = "+sys_enterpriseid+" and year="+year+" and quarter="+quarter+" AND t5.siteid = t1.siteid");
|
|
|
-
|
|
|
+ if (sa_promotionid > 0) {
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_promotion_items", "t4",
|
|
|
+ "t4.sa_promotion_itemsid = t1.sa_promotion_itemsid and t4.siteid = t1.siteid and t4.sa_promotionid=" + sa_promotionid, "packagetypemx", "saledqty", "groupqty");
|
|
|
+ }
|
|
|
+ if (type.equals("配件订单")) {
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_workorder", "t5",
|
|
|
+ "t1.sa_workorderid=t5.sa_workorderid and t1.siteid=t5.siteid");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_warrantycard", "t6",
|
|
|
+ "t6.cardno=t1.cardno and t6.siteid=t1.siteid", "sku");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t7",
|
|
|
+ "t7.itemid=t6.itemid and t7.siteid=t6.siteid");
|
|
|
+ }
|
|
|
querySQL.addQueryFields("candispatchqty", "ifnull(t2.candispatchqty, 0)");
|
|
|
querySQL.addQueryFields("cansaleqty", "ifnull(t2.cansaleqty, 0)");
|
|
|
querySQL.addQueryFields("totalaty", "ifnull(t2.qty, 0)");
|
|
|
-// querySQL.addQueryFields("rwpricerate", "ifnull(t5.pricerate, 1)");
|
|
|
-
|
|
|
querySQL.addQueryFields("stockstatus", "(SELECT (CASE WHEN t2.cansaleqty>=t3.stockstatus1 THEN '充足' WHEN t2.cansaleqty<=t3.stockstatus2 THEN '缺货' ELSE '紧缺' END))");
|
|
|
- if(sa_promotionid>0){
|
|
|
+ if (sa_promotionid > 0) {
|
|
|
querySQL.addQueryFields("packageqty", "ifnull(t4.packageqty, 0)");
|
|
|
- }else{
|
|
|
+ querySQL.addQueryFields("orderaddqty", "t4.orderaddqty");
|
|
|
+ querySQL.addQueryFields("orderminqty", "t4.orderminqty");
|
|
|
+ } else {
|
|
|
querySQL.addQueryFields("packageqty", "ifnull(t3.packageqty, 0)");
|
|
|
+ querySQL.addQueryFields("orderaddqty", "t3.orderaddqty");
|
|
|
+ querySQL.addQueryFields("orderminqty", "t3.orderminqty");
|
|
|
}
|
|
|
querySQL.addQueryFields("itemdelivery", "ifnull(t3.delivery, 0)");
|
|
|
- querySQL.addQueryFields("orderaddqty", "SELECT (CASE WHEN t4.sa_promotionid>0 THEN t4.orderaddqty ELSE t3.orderaddqty END)");
|
|
|
- querySQL.addQueryFields("orderminqty", "SELECT (CASE WHEN t4.sa_promotionid>0 THEN t4.orderminqty ELSE t3.orderminqty END)");
|
|
|
-
|
|
|
- querySQL.addQueryFields("workorderbillno", "t5.billno");
|
|
|
- querySQL.addQueryFields("workorderdate", "t5.createdate");
|
|
|
- querySQL.addQueryFields("workorderstatus", "t5.status");
|
|
|
- querySQL.addQueryFields("cardname", "t6.name");
|
|
|
- querySQL.addQueryFields("cardphonenumber", "t6.phonenumber");
|
|
|
- querySQL.addQueryFields("cardbegdate", "t6.begdate");
|
|
|
- querySQL.addQueryFields("cardenddate", "t6.enddate");
|
|
|
- querySQL.addQueryFields("machineitemno", "t7.itemno");
|
|
|
- querySQL.addQueryFields("machineitemname", "t7.itemname");
|
|
|
- querySQL.addQueryFields("machinemodel", "t7.model");
|
|
|
- querySQL.addQueryFields("machinespec", "t7.spec");
|
|
|
-
|
|
|
- querySQL.setWhere(where.toString());
|
|
|
+
|
|
|
+ if (type.equals("配件订单")) {
|
|
|
+ querySQL.addQueryFields("workorderbillno", "t5.billno");
|
|
|
+ querySQL.addQueryFields("workorderdate", "t5.createdate");
|
|
|
+ querySQL.addQueryFields("workorderstatus", "t5.status");
|
|
|
+ querySQL.addQueryFields("cardname", "t6.name");
|
|
|
+ querySQL.addQueryFields("cardphonenumber", "t6.phonenumber");
|
|
|
+ querySQL.addQueryFields("cardbegdate", "t6.begdate");
|
|
|
+ querySQL.addQueryFields("cardenddate", "t6.enddate");
|
|
|
+ querySQL.addQueryFields("machineitemno", "t7.itemno");
|
|
|
+ querySQL.addQueryFields("machineitemname", "t7.itemname");
|
|
|
+ querySQL.addQueryFields("machinemodel", "t7.model");
|
|
|
+ querySQL.addQueryFields("machinespec", "t7.spec");
|
|
|
+ }
|
|
|
+
|
|
|
+ querySQL.setCondition("t1.itemno", "t1.itemname", "t1.model", "t3.spec", "t1.remarks");
|
|
|
querySQL.setWhere("t1.siteid", siteid);
|
|
|
querySQL.setWhere("t1.sa_orderid", sa_orderid);
|
|
|
- querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (sa_promotionid > 0 && whereObject.containsKey("packagetypemx") && !"".equals(whereObject.getString("packagetypemx"))) {
|
|
|
+ querySQL.setWhere("t4.packagetypemx", whereObject.getString("packagetypemx"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy("t1.rowno asc");
|
|
|
|
|
|
Rows rows = querySQL.query();
|
|
|
|
|
|
ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
ArrayList<Long> itemnos = rows.toArrayList("itemno", new ArrayList<>());
|
|
|
- RowsMap rowsMap = rows.toRowsMap("itemno");
|
|
|
|
|
|
SQLFactory sqlFactory1 = new SQLFactory(this, "商品发货数量汇总");
|
|
|
sqlFactory1.addParameter("siteid", siteid);
|
|
@@ -768,64 +744,6 @@ public class OrderItems extends Controller {
|
|
|
Rows itempriceRows = dbConnect.runSqlQuery(sqlFactory3);
|
|
|
RowsMap itempriceRowsMap = itempriceRows.toRowsMap("itemno");
|
|
|
|
|
|
-
|
|
|
-// SQLFactory sqlFactory4 = new SQLFactory(this, "商品等级价格查询");
|
|
|
-// sqlFactory4.addParameter("siteid", siteid);
|
|
|
-// sqlFactory4.addParameter_in("itemid", ids);
|
|
|
-// sqlFactory4.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
-// Rows pricegradeRows = dbConnect.runSqlQuery(sqlFactory4);
|
|
|
-// RowsMap pricegradeRowsMap = pricegradeRows.toRowsMap("itemid");
|
|
|
-
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- if(content.getLongValue("onlyquery")==0){
|
|
|
- if (siteid.equalsIgnoreCase("lsa")) {
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("classname", "getIcinvbal");
|
|
|
- object.put("method", "getMsg");
|
|
|
-
|
|
|
- JSONObject content = new JSONObject();
|
|
|
- content.put("fitemnos", rows.toJsonArray("itemno"));
|
|
|
- object.put("content", content);
|
|
|
-
|
|
|
- WebRequest request = new WebRequest();
|
|
|
- String result = request.doPost(object.toString(),
|
|
|
- "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
|
|
|
- if (isJSONArray(result)) {
|
|
|
- jsonArray = JSONArray.parseArray(result);
|
|
|
- }
|
|
|
- for (Object obj : jsonArray) {
|
|
|
- JSONObject jsonObject = (JSONObject) obj;
|
|
|
- if (rowsMap.containsKey(jsonObject.getString("fitemno"))) {
|
|
|
- if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
|
|
|
- rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimal("FQty"));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- ERPDocking erpDocking = new ERPDocking(siteid);
|
|
|
-// if (rows.toJsonArray("itemno").size() != 0) {
|
|
|
-// if (Parameter.getBoolean("system.ccerp_dockswitch")) {
|
|
|
-// jsonArray = erpDocking.getErpIcinvbalRows(1000, 1, rows.toJsonArray("itemno"));
|
|
|
-// }
|
|
|
-// }
|
|
|
- if (!jsonArray.isEmpty()) {
|
|
|
- for (Object object : jsonArray) {
|
|
|
- JSONObject jsonObject = (JSONObject) object;
|
|
|
- if (rowsMap.containsKey(jsonObject.getString("fitemno"))) {
|
|
|
- if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
|
|
|
- for (Row row : rowsMap.get(jsonObject.getString("fitemno"))
|
|
|
- ) {
|
|
|
- row.put("invbalqty", jsonObject.getBigDecimal("fqty"));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//查询附件
|
|
|
RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
for (Row row : rows) {
|
|
@@ -847,33 +765,12 @@ public class OrderItems extends Controller {
|
|
|
if (!row.containsKey("invbalqty")) {
|
|
|
row.put("invbalqty", BigDecimal.ZERO);
|
|
|
}
|
|
|
-// if (pricegradeRowsMap.containsKey(row.getString("itemid"))) {
|
|
|
-// row.put("pricerate",pricegradeRowsMap.get(row.getString("itemid")).get(0).getBigDecimal("discountrate"));
|
|
|
-// }else{
|
|
|
-// row.put("pricerate",new BigDecimal(1));
|
|
|
-// }
|
|
|
-
|
|
|
row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
row.put("contractprice", 0);
|
|
|
//处理日期字段空的情况
|
|
|
row.putIfAbsent("needdate", "");
|
|
|
row.putIfAbsent("deliverydate", "");
|
|
|
}
|
|
|
-
|
|
|
-// if (isExport) {
|
|
|
-// //去除不需要导出项
|
|
|
-// String[] removeFieldList = {"sa_orderitemsid", "itemid", "sa_orderid", "candispatchqty", "cansaleqty",
|
|
|
-// "totalaty", "orderminqty_auxunit", "orderminqty", "orderaddqty_auxunit", "orderaddqty",
|
|
|
-// "spec", "delivery", "erpitemno", "erpitemname", "material", "standards", "stockstatus"};
|
|
|
-// for (String key : removeFieldList) {
|
|
|
-// rows.getFieldList().remove(key);
|
|
|
-// }
|
|
|
-//
|
|
|
-// Rows uploadRows = uploadExcelToObs("order", "订单商品明细_列表", rows, getTitleMap());
|
|
|
-// return getSucReturnObject().setData(uploadRows).toString();
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
@@ -1014,9 +911,9 @@ public class OrderItems extends Controller {
|
|
|
"sa_orderitemsid", "siteid");
|
|
|
t11.addQueryFields("outwarehouseqty", "sum(outwarehouseqty)");
|
|
|
t11.setSiteid(siteid);
|
|
|
- t11.setWhere("sa_orderitemsid",sa_orderitemsid);
|
|
|
+ t11.setWhere("sa_orderitemsid", sa_orderitemsid);
|
|
|
t11.addGroupBy("sa_orderitemsid,siteid");
|
|
|
- RowsMap outwarehouseqtyRowsMap=t11.query().toRowsMap("sa_orderitemsid");
|
|
|
+ RowsMap outwarehouseqtyRowsMap = t11.query().toRowsMap("sa_orderitemsid");
|
|
|
|
|
|
SQLFactory sqlFactory1 = new SQLFactory(this, "订单明细出库数量汇总");
|
|
|
sqlFactory1.addParameter("siteid", siteid);
|
|
@@ -1058,10 +955,10 @@ public class OrderItems extends Controller {
|
|
|
}
|
|
|
row.put("attinfos", attinfoRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
row.put("contractprice", 0);
|
|
|
- if(outwarehouseqtyRowsMap.get(row.getString("sa_orderitemsid")).isNotEmpty()) {
|
|
|
+ if (outwarehouseqtyRowsMap.get(row.getString("sa_orderitemsid")).isNotEmpty()) {
|
|
|
row.put("outwarehouseqty", outwarehouseqtyRowsMap.get(row.getString("sa_orderitemsid")).get(0).getBigDecimal("outwarehouseqty"));
|
|
|
- }else{
|
|
|
- row.put("outwarehouseqty",0);
|
|
|
+ } else {
|
|
|
+ row.put("outwarehouseqty", 0);
|
|
|
}
|
|
|
}
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
@@ -1091,7 +988,7 @@ public class OrderItems extends Controller {
|
|
|
"areaname");
|
|
|
// querySQL.addJoinTable(JOINTYPE.left, t11, "t11", "t11.sa_orderitemsid = t1.sa_orderitemsid and t11.siteid = t1.siteid");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sa_accountclass", "t12", "t12.sa_accountclassid=t5.sa_accountclassid and t12.siteid=t5.siteid");
|
|
|
- querySQL.addJoinTable(JOINTYPE.left, "sa_promotion", "t13", "t13.sa_promotionid=t5.sa_promotionid and t13.siteid=t5.siteid","promnum","promname");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_promotion", "t13", "t13.sa_promotionid=t5.sa_promotionid and t13.siteid=t5.siteid", "promnum", "promname");
|
|
|
querySQL.addQueryFields("accountnames", "if(ifnull(replace(replace(replace(JSON_EXTRACT (t5.sa_accountclassinfos, '$**.accountname' ),'[',''),']',''),'\\\"',''),'')='',t12.accountname,replace(replace(replace(JSON_EXTRACT (t5.sa_accountclassinfos, '$**.accountname' ),'[',''),']',''),'\\\"',''))");
|
|
|
querySQL.addQueryFields("orderremarks", "t5.remarks");
|
|
|
// querySQL.addQueryFields("outwarehouseqty", "ifnull(t11.outwarehouseqty,0)");
|
|
@@ -1245,9 +1142,9 @@ public class OrderItems extends Controller {
|
|
|
sqlFactory.addParameter_SQL("where", where);
|
|
|
// String sql = sqlFactory.getSQL();
|
|
|
// Rows rows = dbConnect.runSqlQuery(sql);
|
|
|
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_site_parameter", "sys_site_parameterid");
|
|
|
querySQL.setTableAlias("t");
|
|
|
- querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "'111' = t.siteid ","*");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.right, sqlFactory, "t1", "'111' = t.siteid ", "*");
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
querySQL.setOrderBy(pageSorting);
|
|
|
Rows rows = querySQL.query();
|
|
@@ -1291,12 +1188,12 @@ public class OrderItems extends Controller {
|
|
|
@API(title = "判断订单中是否存在某个套餐", apiversion = R.ID2024062715055803.v1.class)
|
|
|
@CACHEING
|
|
|
public String jundgePackagetypemx() throws YosException {
|
|
|
- String packagetypemx =content.getString("packagetypemx");
|
|
|
- long sa_orderid=content.getLong("sa_orderid");
|
|
|
- Rows rows =dbConnect.runSqlQuery("select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and t1.sa_orderid="+sa_orderid+" and t2.packagetypemx="+packagetypemx);
|
|
|
- if(rows.isNotEmpty()){
|
|
|
+ String packagetypemx = content.getString("packagetypemx");
|
|
|
+ long sa_orderid = content.getLong("sa_orderid");
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.sa_orderitemsid from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='" + siteid + "' and t1.sa_orderid=" + sa_orderid + " and t2.packagetypemx=" + packagetypemx);
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
return getSucReturnObject().setData(true).toString();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return getSucReturnObject().setData(false).toString();
|
|
|
}
|
|
|
|
|
@@ -1544,7 +1441,7 @@ public class OrderItems extends Controller {
|
|
|
*/
|
|
|
public void updateRowNo(Long sa_orderid) throws YosException {
|
|
|
String sql = "SELECT sa_orderitemsid from sa_orderitems WHERE sa_orderid= " + sa_orderid + " and siteid = '" + siteid + "' ORDER BY createdate ";
|
|
|
- ArrayList<Long> sa_orderitemsids = dbConnect.runSqlQuery(sql).toArrayList("sa_orderitemsid", new ArrayList<>(),false);
|
|
|
+ ArrayList<Long> sa_orderitemsids = dbConnect.runSqlQuery(sql).toArrayList("sa_orderitemsid", new ArrayList<>(), false);
|
|
|
if (sa_orderitemsids.size() > 0) {
|
|
|
int rowno = 1;
|
|
|
StringBuffer where = new StringBuffer("");
|