wmssend.java 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package restcontroller.webmanage.sale.wmssend;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import common.Controller;
  5. import common.YosException;
  6. import common.annotation.API;
  7. import common.annotation.CACHEING;
  8. import common.data.QuerySQL;
  9. import common.data.Row;
  10. import common.data.Rows;
  11. import common.data.SQLFactory;
  12. import org.apache.commons.lang.StringUtils;
  13. import restcontroller.R;
  14. import java.math.BigDecimal;
  15. import java.util.ArrayList;
  16. @API(title = "立体仓库指令下发")
  17. public class wmssend extends Controller {
  18. public wmssend(JSONObject content) throws YosException {
  19. super(content);
  20. }
  21. @API(title = "指令下发列表", apiversion = R.ID2025060314132803.v1.class)
  22. public String querylist() throws YosException {
  23. /*
  24. * 过滤条件设置
  25. */
  26. StringBuffer where = new StringBuffer(" 1=1 ");
  27. if (content.containsKey("where")) {
  28. JSONObject whereObject = content.getJSONObject("where");
  29. System.err.println(whereObject.containsKey("wmsuploadflag") && !"".equals(whereObject.getString("wmsuploadflag")));
  30. if (whereObject.containsKey("wmsuploadflag") && !"".equals(whereObject.getString("wmsuploadflag"))) {
  31. if(whereObject.getString("wmsuploadflag").equals("全部")){
  32. where.append("and 1=1 ");
  33. } else if(whereObject.getString("wmsuploadflag").equals("已下发")){
  34. where.append("and t1.wmsuploadflag =2");
  35. } else if(whereObject.getString("wmsuploadflag").equals("未下发")){
  36. where.append("and t1.wmsuploadflag !=2");
  37. }
  38. }
  39. if (whereObject.containsKey("stock") && !"".equals(whereObject.getString("stock"))) {
  40. where.append(" and t2.outplace like'%").append(whereObject.getString("stock")).append("%' ");
  41. }
  42. if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
  43. where.append(" and DATE_FORMAT(t2.billdate, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
  44. }
  45. if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
  46. where.append(" and DATE_FORMAT(t2.billdate, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
  47. }
  48. }
  49. QuerySQL querySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items", "qty", "st_stockbill_itemsid","st_stockbillid",
  50. "wmsuploadflag","itemid");
  51. querySQL.setTableAlias("t1");
  52. querySQL.addJoinTable(JOINTYPE.left, "st_stockbill", "t2", "t1.siteid = t2.siteid and t1.st_stockbillid = t2.st_stockbillid","billno","type","rb","billdate","outplace");
  53. querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t3", "t1.siteid=t3.siteid and t1.itemid=t3.itemid","itemno","itemname","model","spec");
  54. querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t2.siteid=t4.siteid and t2.sys_enterpriseid=t4.sys_enterpriseid","agentnum");
  55. querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t2.siteid=t5.siteid and t2.sys_enterpriseid=t5.sys_enterpriseid","enterprisename");
  56. querySQL.setSiteid(siteid);
  57. querySQL.setWhere("t1.wmsuploadflag2 =1");
  58. querySQL.setWhere(where.toString());
  59. querySQL.setPage(pageSize, pageNumber);
  60. querySQL.setOrderBy(pageSorting);
  61. Rows rows = querySQL.query();
  62. return getSucReturnObject().setData(rows).toString();
  63. }
  64. @API(title = "数量汇总", apiversion = R.ID2025060314341703.v1.class)
  65. public String sumqty() throws YosException {
  66. JSONArray st_stockbill_itemsids = content.getJSONArray("st_stockbill_itemsids");
  67. ArrayList<Long> stockbill_itemsids= (ArrayList<Long>) st_stockbill_itemsids.toJavaList(Long.class);
  68. stockbill_itemsids.add(0l);
  69. QuerySQL querySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items", "qty");
  70. querySQL.setTableAlias("t1");
  71. querySQL.setSiteid(siteid);
  72. querySQL.setWhere("st_stockbill_itemsid",stockbill_itemsids);
  73. Rows rows = querySQL.query();
  74. BigDecimal sumqty = rows.sum("qty");
  75. return getSucReturnObject().setData(sumqty).toString();
  76. }
  77. @API(title = "指令下发", apiversion = R.ID2025060314293003.v1.class)
  78. public String wmssendout() throws YosException {
  79. JSONArray st_stockbill_itemsids = content.getJSONArray("st_stockbill_itemsids");
  80. ArrayList<Long> stockbill_itemsids= (ArrayList<Long>) st_stockbill_itemsids.toJavaList(Long.class);
  81. beans.wms.Wms.sendOutOrder(this,stockbill_itemsids);
  82. return getSucReturnObject().toString();
  83. }
  84. @API(title = "立体仓库指令查询", apiversion = R.ID2025073011124403.v1.class)
  85. public String queryOrder() throws YosException {
  86. String outplace =content.getString("outplace");
  87. Rows rows= beans.wms.Wms.queryOrder(outplace);
  88. return getSucReturnObject().setData(rows).toString();
  89. }
  90. @API(title = "谈桥指令删除", apiversion = R.ID2025073011141603.v1.class)
  91. public String deleteTQOrder() throws YosException {
  92. long OutPlanID=content.getLong("OutPlanID");
  93. beans.wms.Wms.deleteTQOrder(OutPlanID);
  94. return getSucReturnObject().toString();
  95. }
  96. @API(title = "马桥指令删除", apiversion = R.ID2025073011151003.v1.class)
  97. public String deleteMQOrder() throws YosException {
  98. String billno=content.getString("billno");
  99. int rowno=content.getInteger("rowno");
  100. beans.wms.Wms.deleteMQOrder(billno,rowno);
  101. return getSucReturnObject().toString();
  102. }
  103. }