123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- package restcontroller.webmanage.sale.wmssend;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import common.Controller;
- import common.YosException;
- import common.annotation.API;
- import common.annotation.CACHEING;
- import common.data.QuerySQL;
- import common.data.Row;
- import common.data.Rows;
- import common.data.SQLFactory;
- import org.apache.commons.lang.StringUtils;
- import restcontroller.R;
- import java.math.BigDecimal;
- import java.util.ArrayList;
- @API(title = "立体仓库指令下发")
- public class wmssend extends Controller {
- public wmssend(JSONObject content) throws YosException {
- super(content);
- }
- @API(title = "指令下发列表", apiversion = R.ID2025060314132803.v1.class)
- public String querylist() throws YosException {
- /*
- * 过滤条件设置
- */
- StringBuffer where = new StringBuffer(" 1=1 ");
- if (content.containsKey("where")) {
- JSONObject whereObject = content.getJSONObject("where");
- System.err.println(whereObject.containsKey("wmsuploadflag") && !"".equals(whereObject.getString("wmsuploadflag")));
- if (whereObject.containsKey("wmsuploadflag") && !"".equals(whereObject.getString("wmsuploadflag"))) {
- if(whereObject.getString("wmsuploadflag").equals("全部")){
- where.append("and 1=1 ");
- } else if(whereObject.getString("wmsuploadflag").equals("已下发")){
- where.append("and t1.wmsuploadflag =2");
- } else if(whereObject.getString("wmsuploadflag").equals("未下发")){
- where.append("and t1.wmsuploadflag !=2");
- }
- }
- if (whereObject.containsKey("stock") && !"".equals(whereObject.getString("stock"))) {
- where.append(" and t2.outplace like'%").append(whereObject.getString("stock")).append("%' ");
- }
- if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
- where.append(" and DATE_FORMAT(t2.billdate, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
- }
- if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
- where.append(" and DATE_FORMAT(t2.billdate, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
- }
- }
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items", "qty", "st_stockbill_itemsid","st_stockbillid",
- "wmsuploadflag","itemid");
- querySQL.setTableAlias("t1");
- querySQL.addJoinTable(JOINTYPE.left, "st_stockbill", "t2", "t1.siteid = t2.siteid and t1.st_stockbillid = t2.st_stockbillid","billno","type","rb","billdate","outplace");
- querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t3", "t1.siteid=t3.siteid and t1.itemid=t3.itemid","itemno","itemname","model","spec");
- querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t4", "t2.siteid=t4.siteid and t2.sys_enterpriseid=t4.sys_enterpriseid","agentnum");
- querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t5", "t2.siteid=t5.siteid and t2.sys_enterpriseid=t5.sys_enterpriseid","enterprisename");
- querySQL.setSiteid(siteid);
- querySQL.setWhere("t1.wmsuploadflag2 =1");
- querySQL.setWhere(where.toString());
- querySQL.setPage(pageSize, pageNumber);
- querySQL.setOrderBy(pageSorting);
- Rows rows = querySQL.query();
- return getSucReturnObject().setData(rows).toString();
- }
- @API(title = "数量汇总", apiversion = R.ID2025060314341703.v1.class)
- public String sumqty() throws YosException {
- JSONArray st_stockbill_itemsids = content.getJSONArray("st_stockbill_itemsids");
- ArrayList<Long> stockbill_itemsids= (ArrayList<Long>) st_stockbill_itemsids.toJavaList(Long.class);
- stockbill_itemsids.add(0l);
- QuerySQL querySQL = SQLFactory.createQuerySQL(this, "st_stockbill_items", "qty");
- querySQL.setTableAlias("t1");
- querySQL.setSiteid(siteid);
- querySQL.setWhere("st_stockbill_itemsid",stockbill_itemsids);
- Rows rows = querySQL.query();
- BigDecimal sumqty = rows.sum("qty");
- return getSucReturnObject().setData(sumqty).toString();
- }
- @API(title = "指令下发", apiversion = R.ID2025060314293003.v1.class)
- public String wmssendout() throws YosException {
- JSONArray st_stockbill_itemsids = content.getJSONArray("st_stockbill_itemsids");
- ArrayList<Long> stockbill_itemsids= (ArrayList<Long>) st_stockbill_itemsids.toJavaList(Long.class);
- beans.wms.Wms.sendOutOrder(this,stockbill_itemsids);
- return getSucReturnObject().toString();
- }
- @API(title = "立体仓库指令查询", apiversion = R.ID2025073011124403.v1.class)
- public String queryOrder() throws YosException {
- String outplace =content.getString("outplace");
- Rows rows= beans.wms.Wms.queryOrder(outplace);
- return getSucReturnObject().setData(rows).toString();
- }
- @API(title = "谈桥指令删除", apiversion = R.ID2025073011141603.v1.class)
- public String deleteTQOrder() throws YosException {
- long OutPlanID=content.getLong("OutPlanID");
- beans.wms.Wms.deleteTQOrder(OutPlanID);
- return getSucReturnObject().toString();
- }
- @API(title = "马桥指令删除", apiversion = R.ID2025073011151003.v1.class)
- public String deleteMQOrder() throws YosException {
- String billno=content.getString("billno");
- int rowno=content.getInteger("rowno");
- beans.wms.Wms.deleteMQOrder(billno,rowno);
- return getSucReturnObject().toString();
- }
- }
|