| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package restcontroller.webmanage.lsak3.aftersalesmag;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import common.Controller;
- import common.YosException;
- import common.annotation.API;
- import common.data.Row;
- import common.data.Rows;
- import restcontroller.R;
- import java.util.ArrayList;
- public class aftersalesmag extends Controller {
- /**
- * 构造函数
- *
- * @param content
- */
- public aftersalesmag(JSONObject content) throws YosException {
- super(content);
- }
- /**
- * 获取DRP返退单
- *
- * @return
- */
- @API(title = "获取DRP返退单", apiversion = R.ID20230715093903.v1.class,accesstoken = false)
- public String getAftersalesmag() throws YosException{
- Rows rows = dbConnect.runSqlQuery("select t2.k3outcode fk3outcode,t1.updatek3flag fupdatek3flag,t1.sa_aftersalesmagid salereturnbillid,t1.billno fbillnum,t1.createby,t1.billdate fdate,t2.agentnum fagentnum,t1.reason fnotes from sa_aftersalesmag t1 inner join sa_agents t2 on t1.sys_enterpriseid=t2.sys_enterpriseid and t1.siteid=t2.siteid where (t1.updatek3flag='0' or t1.updatek3flag='2') and t1.createby !='LSA总0001' and t1.siteid='lsa1986'");
- for (Row row : rows) {
- String sa_aftersalesmagid = row.getString("sa_aftersalesmagid");
- Rows detailRows = dbConnect.runSqlQuery("select t2.k3outcode fk3outcode,t1.st_stockbill_itemsid salereturnbilldeid,t2.itemno fitemno,t1.qty fqty,t1.price fprice,t1.reason fnotes,t4.billno fsaleissuebillno, t3.rowno fsaleissuebillentryid from sa_aftersalesmag_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid left join st_stockbill_items t3 on t1.st_stockbill_itemsid=t3.st_stockbill_itemsid and t1.siteid=t3.siteid left join st_stockbill t4 on t3.st_stockbillid=t4.st_stockbillid and t3.siteid=t4.siteid where t1.sa_aftersalesmagid='" + sa_aftersalesmagid + "' and t1.siteid='lsa1986'");
- row.put("salereturnbilldetil", detailRows.toJsonArray());
- }
- if(rows.isEmpty()) {
- JSONArray array = new JSONArray();
- return array.toString();
- }
- return rows.toJsonArray().toString();
- }
- /**
- * 获取DRP返退单返回成功消息
- *
- * @return
- */
- @API(title = "获取DRP返退单返回成功消息", apiversion = R.ID20230715094003.v1.class,accesstoken = false)
- public String getAftersalesmagFeedBack() throws YosException{
- JSONArray idsarray = content.getJSONArray("ids");
- ArrayList<String> sqllist = new ArrayList<>();
- for (Object object:idsarray) {
- String id = (String) object;
- sqllist.add("update sa_aftersalesmag set updatek3flag='1' where siteid='lsa' and sa_aftersalesmagid=" + id);
- }
- int count =dbConnect.runSqlUpdate(sqllist);
- JSONObject returnObject =new JSONObject();
- if (count>0) {
- returnObject.put("msg", "");
- returnObject.put("code", 1);
- } else {
- returnObject.put("msg", "true");
- returnObject.put("code", 0);
- }
- return returnObject.toString();
- }
- }
|