|
@@ -578,37 +578,37 @@ 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"));
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @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()) {
|
|
@@ -620,56 +620,56 @@ public class aftersalesmag extends Controller {
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
-//
|
|
|
-// 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();
|
|
|
+
|
|
|
+ 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"));
|
|
|
+// }
|
|
|
// }
|
|
|
-//// 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();
|
|
|
-//
|
|
|
-// }
|
|
|
+ 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)
|