Просмотр исходного кода

Merge branch 'develop' into develop2

hu 9 месяцев назад
Родитель
Сommit
ff966edfc8

+ 91 - 91
src/custom/restcontroller/webmanage/sale/aftersalesmag/aftersalesmag.java

@@ -569,98 +569,98 @@ public class aftersalesmag extends Controller {
 
     }
 
-    @API(title = "反复核", apiversion = R.ID20230523085403.v1.class)
-    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105110903.class, R.ID20230105161503.v1.class}, apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class})
-    public String unrecheck() throws YosException {
-        Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
-        Long sa_orderid = 0L;
-        Rows rows = dbConnect.runSqlQuery(
-                "select t1.sa_aftersalesmagid,t1.status,t1.billno,ifnull(t1.sa_orderid,0) sa_orderid ,t1.returnamount,t1.payamount,t1.sys_enterpriseid,t1.sa_accountclassid,t2.sonum,t1.type from sa_aftersalesmag t1 left join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid ='"
-                        + sa_aftersalesmagid + "' and  t1.siteid='" + siteid + "'");
-        if (rows.isEmpty()) {
-            return getErrReturnObject().setErrMsg("该返退单不存在").toString();
-        } else {
-            sa_orderid = rows.get(0).getLong("sa_orderid");
-            if (!rows.get(0).getString("status").equals("复核")) {
-                return getErrReturnObject().setErrMsg("单号为:【" + rows.get(0).getString("billno") + "】的返退单为非复核状态,无法反复核")
-                        .toString();
-            }
-        }
-        Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill_items t1 inner join st_stockbill t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid inner join sa_aftersalesmag_items t3 on  t1.sa_dispatch_itemsid=t3.sa_aftersalesmag_itemsid and t1.siteid=t3.siteid where t2.status='审核' and t2.rb=0 and t1.siteid='" + siteid + "' and t3.sa_aftersalesmagid=" + sa_aftersalesmagid);
-        if (stockbillRows.isNotEmpty()) {
-            return getErrReturnObject().setErrMsg("单号为:【" + rows.get(0).getString("billno") + "】的返退单在K3中的红字出库单还未删除,无法复核")
-                    .toString();
-        }
-
-        ArrayList<String> sqlList = new ArrayList<>();
-        Rows sa_aftersalesmag_itemsRows = dbConnect.runSqlQuery("select t1.qty,t1.sa_orderitemsid,t2.itemno,t2.itemname from sa_aftersalesmag_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid=" + sa_aftersalesmagid);
-        for (Row row : sa_aftersalesmag_itemsRows) {
-            BigDecimal returnqty = row.getBigDecimal("qty");
-            if (rows.get(0).getString("type").equals("退货单")) {
-                sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
-            }
-        }
-        if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true") ) {
-            ERPDocking erpDocking =new ERPDocking(siteid);
-            if (!erpDocking.getUrl().isEmpty()) {
-                String billno = rows.get(0).getString("billno");
-                String result =erpDocking.recheckErpSareturn(billno,true,this,sa_aftersalesmagid);
-                if(!result.equals("true")){
-                    return getErrReturnObject().setErrMsg(result).toString();
-                }
-            }
-
-        }
-
-        Long sa_cashbillid = 0L;
-        long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
-        String type = rows.get(0).getString("type");
-        if (type.equals("退货单")) {
-            if (rows.get(0).getDouble("returnamount") > 0) {
-                /******** 生成支出凭证 ********/
-                BigDecimal returnamount = rows.get(0).getBigDecimal("returnamount");
-                CashbillEntity cashbillEntity = new CashbillEntity();
-                cashbillEntity.setAmount(returnamount);
-                cashbillEntity.setOwnerid(sa_aftersalesmagid);
-                cashbillEntity.setOwnertable("sa_aftersalesmag");
-                cashbillEntity.setRemarks("由返退单号" + rows.get(0).getString("billno") + "反复核时生成" );
-                cashbillEntity.setSource("退货单反复核");
-                if (!Accountbalance.judgeBalance(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), returnamount)) {
-                    return getErrReturnObject().setErrMsg("经销商账户余额不足无法反复核")
-                            .toString();
-                }
-//                Rows sa_aftersalesmag_itemsRows = dbConnect.runSqlQuery("select t1.qty,t1.sa_orderitemsid,t2.itemno,t2.itemname,t2.skucontrol from sa_aftersalesmag_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid=" + sa_aftersalesmagid);
-//                for (Row row : sa_aftersalesmag_itemsRows) {
-//                    BigDecimal returnqty = row.getBigDecimal("qty");
-//                    if(rows.get(0).getString("type").equals("退货单")){
-//                        sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
-//                    }
+//    @API(title = "反复核", apiversion = R.ID20230523085403.v1.class)
+//    @CACHEING_CLEAN(apiversions = {R.ID20230104160603.v1.class, R.ID20230104160703.v1.class, R.ID20230105110903.class, R.ID20230105161503.v1.class}, apiClass = {aftersalesmag.class, aftersalesmagItems.class, cashbill.class})
+//    public String unrecheck() throws YosException {
+//        Long sa_aftersalesmagid = content.getLong("sa_aftersalesmagid");
+//        Long sa_orderid = 0L;
+//        Rows rows = dbConnect.runSqlQuery(
+//                "select t1.sa_aftersalesmagid,t1.status,t1.billno,ifnull(t1.sa_orderid,0) sa_orderid ,t1.returnamount,t1.payamount,t1.sys_enterpriseid,t1.sa_accountclassid,t2.sonum,t1.type from sa_aftersalesmag t1 left join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid ='"
+//                        + sa_aftersalesmagid + "' and  t1.siteid='" + siteid + "'");
+//        if (rows.isEmpty()) {
+//            return getErrReturnObject().setErrMsg("该返退单不存在").toString();
+//        } else {
+//            sa_orderid = rows.get(0).getLong("sa_orderid");
+//            if (!rows.get(0).getString("status").equals("复核")) {
+//                return getErrReturnObject().setErrMsg("单号为:【" + rows.get(0).getString("billno") + "】的返退单为非复核状态,无法反复核")
+//                        .toString();
+//            }
+//        }
+//        Rows stockbillRows = dbConnect.runSqlQuery("select * from st_stockbill_items t1 inner join st_stockbill t2 on t1.st_stockbillid=t2.st_stockbillid and t1.siteid=t2.siteid inner join sa_aftersalesmag_items t3 on  t1.sa_dispatch_itemsid=t3.sa_aftersalesmag_itemsid and t1.siteid=t3.siteid where t2.status='审核' and t2.rb=0 and t1.siteid='" + siteid + "' and t3.sa_aftersalesmagid=" + sa_aftersalesmagid);
+//        if (stockbillRows.isNotEmpty()) {
+//            return getErrReturnObject().setErrMsg("单号为:【" + rows.get(0).getString("billno") + "】的返退单在K3中的红字出库单还未删除,无法复核")
+//                    .toString();
+//        }
+//
+//        ArrayList<String> sqlList = new ArrayList<>();
+//        Rows sa_aftersalesmag_itemsRows = dbConnect.runSqlQuery("select t1.qty,t1.sa_orderitemsid,t2.itemno,t2.itemname from sa_aftersalesmag_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid=" + sa_aftersalesmagid);
+//        for (Row row : sa_aftersalesmag_itemsRows) {
+//            BigDecimal returnqty = row.getBigDecimal("qty");
+//            if (rows.get(0).getString("type").equals("退货单")) {
+//                sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
+//            }
+//        }
+//        if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true") ) {
+//            ERPDocking erpDocking =new ERPDocking(siteid);
+//            if (!erpDocking.getUrl().isEmpty()) {
+//                String billno = rows.get(0).getString("billno");
+//                String result =erpDocking.recheckErpSareturn(billno,true,this,sa_aftersalesmagid);
+//                if(!result.equals("true")){
+//                    return getErrReturnObject().setErrMsg(result).toString();
 //                }
-                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
-                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
-                sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
-            }
-        }
-
-        SQLFactory sqlFactoryupdate = new SQLFactory(this, "返退单反复核");
-        sqlFactoryupdate.addParameter("siteid", siteid);
-        sqlFactoryupdate.addParameter("sa_aftersalesmagid", sa_aftersalesmagid);
-        sqlFactoryupdate.addParameter("recheckby", username);
-        sqlList.add(sqlFactoryupdate.getSQL());
-        sqlList.add(DataContrlLog.createLog(this, "sa_aftersalesmag", sa_aftersalesmagid, "反复核", "返退单反复核成功").getSQL());
-        dbConnect.runSqlUpdate(sqlList);
-
-
-        if (type.equals("退货单")) {
-            String message = "您的退货单" + rows.get(0).getString("billno") + "已反复核,,退款已从账户扣除,请及时查看!";
-            sendMsg(message, sa_aftersalesmagid, sys_enterpriseid);
-            Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
-        }
-
-
-        return getSucReturnObject().toString();
-
-    }
+//            }
+//
+//        }
+//
+//        Long sa_cashbillid = 0L;
+//        long sys_enterpriseid = rows.get(0).getLong("sys_enterpriseid");
+//        String type = rows.get(0).getString("type");
+//        if (type.equals("退货单")) {
+//            if (rows.get(0).getDouble("returnamount") > 0) {
+//                /******** 生成支出凭证 ********/
+//                BigDecimal returnamount = rows.get(0).getBigDecimal("returnamount");
+//                CashbillEntity cashbillEntity = new CashbillEntity();
+//                cashbillEntity.setAmount(returnamount);
+//                cashbillEntity.setOwnerid(sa_aftersalesmagid);
+//                cashbillEntity.setOwnertable("sa_aftersalesmag");
+//                cashbillEntity.setRemarks("由返退单号" + rows.get(0).getString("billno") + "反复核时生成" );
+//                cashbillEntity.setSource("退货单反复核");
+//                if (!Accountbalance.judgeBalance(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), returnamount)) {
+//                    return getErrReturnObject().setErrMsg("经销商账户余额不足无法反复核")
+//                            .toString();
+//                }
+////                Rows sa_aftersalesmag_itemsRows = dbConnect.runSqlQuery("select t1.qty,t1.sa_orderitemsid,t2.itemno,t2.itemname,t2.skucontrol from sa_aftersalesmag_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_aftersalesmagid=" + sa_aftersalesmagid);
+////                for (Row row : sa_aftersalesmag_itemsRows) {
+////                    BigDecimal returnqty = row.getBigDecimal("qty");
+////                    if(rows.get(0).getString("type").equals("退货单")){
+////                        sqlList.add("update sa_orderitems set returnqty=returnqty-" + returnqty + " where sa_orderitemsid=" + row.getString("sa_orderitemsid"));
+////                    }
+////                }
+//                JSONObject cashbillPay = Accountbalance.createCashbillPay(this, sys_enterpriseid, rows.get(0).getLong("sa_accountclassid"), cashbillEntity, true);
+//                sqlList.addAll(cashbillPay.getJSONArray("sqlList").toJavaList(String.class));
+//                sa_cashbillid = cashbillPay.getLong("sa_cashbillid");
+//            }
+//        }
+//
+//        SQLFactory sqlFactoryupdate = new SQLFactory(this, "返退单反复核");
+//        sqlFactoryupdate.addParameter("siteid", siteid);
+//        sqlFactoryupdate.addParameter("sa_aftersalesmagid", sa_aftersalesmagid);
+//        sqlFactoryupdate.addParameter("recheckby", username);
+//        sqlList.add(sqlFactoryupdate.getSQL());
+//        sqlList.add(DataContrlLog.createLog(this, "sa_aftersalesmag", sa_aftersalesmagid, "反复核", "返退单反复核成功").getSQL());
+//        dbConnect.runSqlUpdate(sqlList);
+//
+//
+//        if (type.equals("退货单")) {
+//            String message = "您的退货单" + rows.get(0).getString("billno") + "已反复核,,退款已从账户扣除,请及时查看!";
+//            sendMsg(message, sa_aftersalesmagid, sys_enterpriseid);
+//            Accountbalance.remindSend(this, sys_enterpriseid, sa_cashbillid);
+//        }
+//
+//
+//        return getSucReturnObject().toString();
+//
+//    }
 
 
     @API(title = "关闭", apiversion = R.ID20230522090403.v1.class)

+ 4 - 2
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -891,7 +891,7 @@ public class dispatch extends Controller {
                         }
                     }
                 }
-
+                logger.info("进入前:");
                 for (Row row : rowsDispatchDetailGroupByItem) {
                     if (sumQtyRowsMap.containsKey(row.getString("itemno"))) {
                         RowsMap rowsMapByBatchno = sumQtyRowsMap.get(row.getString("itemno")).toRowsMap("batchno");
@@ -912,12 +912,14 @@ public class dispatch extends Controller {
                     response.put("sumQtyRows",sumQtyRows);
                     response.put("rowsDispatchDetailGroupByItem",rowsDispatchDetailGroupByItem);
                     response.put("errcode",0);
-
+                    logger.info("进入后:");
                     if (row.getBigDecimal("qty").compareTo(row.getBigDecimal("delinvbalqty")) > 0) {
+                        logger.info("response:"+response);
                         erpDocking.saveLog(this, "sa_dispatch", sa_dispatchid, "发货单复核", "", response, dispatchRows.get(0).getString("billno"));
                         return getErrReturnObject().setErrMsg("发货商品" + row.getString("itemno") + ",库存不足,无法操作复核!")
                                 .toString();
                     }else{
+                        logger.info("response:"+response);
                         erpDocking.saveLog(this, "sa_dispatch", sa_dispatchid, "发货单复核", "", response, dispatchRows.get(0).getString("billno"));
                     }
                 }

+ 1 - 0
src/custom/utility/ERPDocking.java

@@ -697,6 +697,7 @@ public class ERPDocking extends BaseClass {
                 issuccess = false;
             }
             sqlFactory.addParameter("status", response.getString("errcode"));
+            logger.info("sql:"+sqlFactory.getSQL());
             controller.dbConnect.runSqlUpdate(sqlFactory);
         } catch (Exception e) {
             e.printStackTrace();