|
|
@@ -122,47 +122,45 @@ public class aftersalesmag extends Controller {
|
|
|
for (Row row : sa_aftersalesmag_itemsRows) {
|
|
|
Rows orderitemsRows = rowsMap.get(row.getString("sa_orderitemsid"));
|
|
|
if (orderitemsRows.isEmpty()) {
|
|
|
- return getErrReturnObject().setErrMsg("对应的订单行不存在").toString();
|
|
|
- }
|
|
|
- BigDecimal returnqty = row.getBigDecimal("returnqty");
|
|
|
- BigDecimal qty = row.getBigDecimal("qty");
|
|
|
- BigDecimal undeliqty = row.getBigDecimal("undeliqty");
|
|
|
- BigDecimal canreturnqty = (qty.subtract(undeliqty)).subtract(returnqty);
|
|
|
- ;
|
|
|
- if (row.getBigDecimal("qty").compareTo(canreturnqty) > 0) {
|
|
|
- return getErrReturnObject().setErrMsg("退货数量大于订单可退货数量").toString();
|
|
|
+ //return getErrReturnObject().setErrMsg("对应的订单行不存在").toString();
|
|
|
+ }else{
|
|
|
+ BigDecimal returnqty =orderitemsRows.get(0).getBigDecimal("returnqty");
|
|
|
+ BigDecimal qty = orderitemsRows.get(0).getBigDecimal("qty");
|
|
|
+ BigDecimal undeliqty = orderitemsRows.get(0).getBigDecimal("undeliqty");
|
|
|
+ BigDecimal canreturnqty = (qty.subtract(undeliqty)).subtract(returnqty);
|
|
|
+ if (row.getBigDecimal("qty").compareTo(canreturnqty) > 0) {
|
|
|
+ return getErrReturnObject().setErrMsg("退货数量大于订单可退货数量").toString();
|
|
|
+ }
|
|
|
}
|
|
|
- if (rows.get(0).getString("type").equals("借用归还单") && row.getBoolean("skucontrol")) { //待定 序列号管理
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
- Rows rowsOrder = dbConnect.runSqlQuery("select sa_orderid,status from sa_order where sa_orderid=" + sa_orderid);
|
|
|
- if (!rowsOrder.isEmpty() && rowsOrder.get(0).getString("status").equals("关闭")) {
|
|
|
- //如果订单已经发完了,则判断最后一个物流单的确认收货时间
|
|
|
- Rows sainviceRows = dbConnect.runSqlQuery("select t1.sa_orderid,t2.sa_dispatchid from sa_order t1 inner join sa_dispatch t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.sa_orderid=" + sa_orderid);
|
|
|
- Rows logisticsRows = dbConnect.runSqlQuery("select t1.sa_orderid,t2.sa_dispatchid,t3.lastreceivedate from sa_order t1 inner join sa_dispatch t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid inner join (select t1.sa_dispatchid,t1.siteid,max(t2.receivedate) lastreceivedate from sa_logistics_items t1 inner join sa_logistics t2 on t1.sa_logisticsid=t2.sa_logisticsid and t1.siteid=t2.siteid where t2.status ='收货' group by t1.sa_dispatchid,t1.siteid) t3 on t2.sa_dispatchid=t3.sa_dispatchid and t2.siteid=t3.siteid where t1.sa_orderid=" + sa_orderid);
|
|
|
- if (sainviceRows.size() == logisticsRows.size() && !logisticsRows.isEmpty()) {
|
|
|
- Date latestreceivedate = logisticsRows.get(0).getDate("lastreceivedate");
|
|
|
- for (Row row : logisticsRows) {
|
|
|
- if (row.getDate("lastreceivedate").after(latestreceivedate)) {
|
|
|
- latestreceivedate = row.getDate("lastreceivedate");
|
|
|
- }
|
|
|
- }
|
|
|
- Rows sys_enterpriseRows = dbConnect.runSqlQuery("select t1.sys_enterpriseid,ifnull(t1.limitreturnday,0) limitreturnday from sys_enterprise t1 where t1.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
- if (sys_enterpriseRows.isEmpty()) {
|
|
|
- return getErrReturnObject().setErrMsg("企业不存在").toString();
|
|
|
- } else {
|
|
|
- long limitreturnday = sys_enterpriseRows.get(0).getLong("limitreturnday");
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(latestreceivedate);
|
|
|
- calendar.add(Calendar.DATE, (int) limitreturnday);
|
|
|
- if (calendar.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) {
|
|
|
- return getErrReturnObject().setErrMsg("收货超过" + limitreturnday + "天,不可进行退货操作").toString();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// Rows rowsOrder = dbConnect.runSqlQuery("select sa_orderid,status from sa_order where sa_orderid=" + sa_orderid);
|
|
|
+// if (!rowsOrder.isEmpty() && rowsOrder.get(0).getString("status").equals("关闭")) {
|
|
|
+// //如果订单已经发完了,则判断最后一个物流单的确认收货时间
|
|
|
+// Rows sainviceRows = dbConnect.runSqlQuery("select t1.sa_orderid,t2.sa_dispatchid from sa_order t1 inner join sa_dispatch t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.sa_orderid=" + sa_orderid);
|
|
|
+// Rows logisticsRows = dbConnect.runSqlQuery("select t1.sa_orderid,t2.sa_dispatchid,t3.lastreceivedate from sa_order t1 inner join sa_dispatch t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid inner join (select t1.sa_dispatchid,t1.siteid,max(t2.receivedate) lastreceivedate from sa_logistics_items t1 inner join sa_logistics t2 on t1.sa_logisticsid=t2.sa_logisticsid and t1.siteid=t2.siteid where t2.status ='收货' group by t1.sa_dispatchid,t1.siteid) t3 on t2.sa_dispatchid=t3.sa_dispatchid and t2.siteid=t3.siteid where t1.sa_orderid=" + sa_orderid);
|
|
|
+// if (sainviceRows.size() == logisticsRows.size() && !logisticsRows.isEmpty()) {
|
|
|
+// Date latestreceivedate = logisticsRows.get(0).getDate("lastreceivedate");
|
|
|
+// for (Row row : logisticsRows) {
|
|
|
+// if (row.getDate("lastreceivedate").after(latestreceivedate)) {
|
|
|
+// latestreceivedate = row.getDate("lastreceivedate");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// Rows sys_enterpriseRows = dbConnect.runSqlQuery("select t1.sys_enterpriseid,ifnull(t1.limitreturnday,0) limitreturnday from sys_enterprise t1 where t1.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
+// if (sys_enterpriseRows.isEmpty()) {
|
|
|
+// return getErrReturnObject().setErrMsg("企业不存在").toString();
|
|
|
+// } else {
|
|
|
+// long limitreturnday = sys_enterpriseRows.get(0).getLong("limitreturnday");
|
|
|
+// Calendar calendar = Calendar.getInstance();
|
|
|
+// calendar.setTime(latestreceivedate);
|
|
|
+// calendar.add(Calendar.DATE, (int) limitreturnday);
|
|
|
+// if (calendar.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) {
|
|
|
+// return getErrReturnObject().setErrMsg("收货超过" + limitreturnday + "天,不可进行退货操作").toString();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|