|
|
@@ -4,6 +4,7 @@ import beans.clear.ClearData;
|
|
|
import beans.data.BatchDeleteErr;
|
|
|
import beans.datacontrllog.DataContrlLog;
|
|
|
import beans.remind.Remind;
|
|
|
+import beans.stockbill.Stockbill;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import common.Controller;
|
|
|
@@ -631,10 +632,6 @@ public class cashbill extends Controller {
|
|
|
@CACHEING_CLEAN(apiversions = {R.ID20221009102903.v1.class, R.ID20221010102903.v1.class, R.ID20221009103003.v1.class, R.ID20221008145903.v1.class, R.ID20221009160003.v1.class, R.ID20230111103403.v1.class})
|
|
|
public String release() throws YosException {
|
|
|
long sa_cashbillid = content.getLong("sa_cashbillid");
|
|
|
- String[] s = {"sa_cashbillid"};
|
|
|
- for (String s1 : s) {
|
|
|
- if (!content.containsKey(s1)) return getErrReturnObject().setErrMsg("缺少" + s1 + "参数").toString();
|
|
|
- }
|
|
|
//List<String> list = sa_creditbillids.toJavaList(String.class);
|
|
|
//String[] stringArray = list.toArray(new String[0]);
|
|
|
//SQLFactory sqlFactoryquery = new SQLFactory(this, "信用额度调整单状态查询");
|
|
|
@@ -643,10 +640,10 @@ public class cashbill extends Controller {
|
|
|
Rows rows = dbConnect.runSqlQuery("select t1.sa_cashbillid,t1.sys_enterpriseid,t1.sa_accountclassid,t1.status,t1.billno,t1.amount,ifnull(t1.discountamount,0) discountamount,t1.type,t1.ownerid,t2.accountname,t1.remarks from sa_cashbill t1 left join sa_accountclass t2 on t1.sa_accountclassid=t2.sa_accountclassid and t1.siteid=t2.siteid where t1.sa_cashbillid ='" + sa_cashbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
for (Row row : rows) {
|
|
|
if (row.getString("status").equals("审核")) {
|
|
|
- return getErrReturnObject().setErrMsg("单号为:【" + row.getString("billno") + "】的收支凭证已审核,无法再次审核").toString();
|
|
|
+ throw new YosException("单号为:【" + row.getString("billno") + "】的收支凭证已审核,无法再次审核");
|
|
|
}
|
|
|
if (!row.getString("status").equals("新建")) {
|
|
|
- return getErrReturnObject().setErrMsg("单号为:【" + row.getString("billno") + "】的收支凭证为非新建状态,无法审核").toString();
|
|
|
+ throw new YosException("单号为:【" + row.getString("billno") + "】的收支凭证为非新建状态,无法审核");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -697,7 +694,7 @@ public class cashbill extends Controller {
|
|
|
// sqlFactory.addParameter("userid", userid);
|
|
|
// sqlFactory.addParameter("username", username);
|
|
|
// sqlList.add(sqlFactory.getSQL());
|
|
|
- return getErrReturnObject().setErrMsg("该营销账户不存在,支出凭证无法审核").toString();
|
|
|
+ throw new YosException("该营销账户不存在,支出凭证无法审核");
|
|
|
} else {
|
|
|
BigDecimal canuseamount = rowsaccountbalance.get(0).getBigDecimal("creditquota").add(rowsaccountbalance.get(0).getBigDecimal("amount")).add(rowsaccountbalance.get(0).getBigDecimal("discountamount"));
|
|
|
if (rows.get(0).getBigDecimal("amount").compareTo(canuseamount) == 1 && rows.get(0).getBigDecimal("amount").compareTo(BigDecimal.ZERO)>=0) {
|
|
|
@@ -735,6 +732,35 @@ public class cashbill extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "收支凭证审核(批量)", apiversion = R.ID202251219210303.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiversions = {R.ID20221009102903.v1.class, R.ID20221010102903.v1.class, R.ID20221009103003.v1.class, R.ID20221008145903.v1.class, R.ID20221009160003.v1.class, R.ID20230111103403.v1.class})
|
|
|
+ public String release_pl() throws YosException {
|
|
|
+ JSONArray sa_cashbillids = content.getJSONArray("sa_cashbillids");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_cashbill", "billno", "sa_cashbillid");
|
|
|
+ querySQL.setTableAlias("t1");
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere("t1.sa_cashbillid", sa_cashbillids);
|
|
|
+ Rows cashbillrows = querySQL.query();
|
|
|
+ BatchDeleteErr batchDeleteErr = BatchDeleteErr.create(this, cashbillrows.size());
|
|
|
+ for (Row row : cashbillrows) {
|
|
|
+ long sa_cashbillid = row.getLong("sa_cashbillid");
|
|
|
+ String billno = row.getString("billno");
|
|
|
+ try {
|
|
|
+ content.put("sa_cashbillid",sa_cashbillid);
|
|
|
+ release();
|
|
|
+ } catch (Exception e) {
|
|
|
+ batchDeleteErr.addErr(billno, e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ HashMap<String, Object> result = new HashMap<>();
|
|
|
+ String success = "共审核" + cashbillrows.size() + "张凭证,其中失败" + batchDeleteErr.size() + "张!";
|
|
|
+ result.put("success", success);
|
|
|
+ result.put("errinfo", batchDeleteErr.getReturnObject());
|
|
|
+ return getSucReturnObject().setData(result).toString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 收支凭证反审核
|
|
|
*
|