Jelajahi Sumber

新增出入库单添加商品(从商品档案)接口

hu 6 bulan lalu
induk
melakukan
139a58dc28

+ 5 - 0
src/custom/restcontroller/R.java

@@ -6756,6 +6756,11 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2025101713485003 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 2 - 1
src/custom/restcontroller/webmanage/sale/stockbill/stockbill.java

@@ -76,7 +76,6 @@ public class stockbill extends Controller {
         String tracknumber = content.getStringValue("tracknumber");
 
         boolean isconfirm = content.getBooleanValue("isconfirm");
-        SQLFactory sqlFactory = new SQLFactory(this, "发货单新增");
 
         if (st_stockbillid <= 0) {
 
@@ -143,6 +142,8 @@ public class stockbill extends Controller {
                     updateSQL.setValue("departmentid", departmentid);
                     updateSQL.setValue("stockid", stockid);
                     updateSQL.setValue("remarks", remarks);
+                    updateSQL.setValue("rb", content.getString("rb"));
+                    updateSQL.setValue("typemx", typemx);
                     updateSQL.setValue("billdate", billdate);
                     updateSQL.setValue("outplace", outplace);
                     updateSQL.setValue("delivery", delivery);

+ 45 - 0
src/custom/restcontroller/webmanage/sale/stockbill/stockbillitems.java

@@ -75,6 +75,51 @@ public class stockbillitems extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+    @API(title = "商品档案添加商品", apiversion = R.ID2025101713485003.v1.class)
+    public String queryItemList() throws YosException {
+        /*
+         * 过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and(");
+                where.append("t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.unit like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.sonum like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t3.typemx like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+            if (whereObject.containsKey("sa_orderid") && !"".equals(whereObject.getString("sa_orderid"))) {
+                Long sa_orderid = whereObject.getLongValue("sa_orderid");
+                if (sa_orderid > 0) {
+                    where.append("  and t1.sa_orderid ='").append(sa_orderid).append("' ");
+                }
+            }
+            if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
+                where.append(" and DATE_FORMAT(t3.checkdate, '%Y-%m-%d') >='").append(whereObject.getString("begindate")).append("' ");
+            }
+            if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
+                where.append(" and DATE_FORMAT(t3.checkdate, '%Y-%m-%d') <='").append(whereObject.getString("enddate")).append("' ");
+            }
+        }
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item",
+                "itemid","itemno","itemname","model","spec","batchcontrol");
+        querySQL.setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("t1.STATUS = '审核' and t1.isused=1");
+        querySQL.setWhere("t1.itemid not in (select itemid from st_stockbill_items where st_stockbillid='"+content.getLongValue("st_stockbillid")+"')");
+        //querySQL.setWhere("t1.sa_orderitemsid not in(select t1.sa_orderitemsid from (select t1.sa_orderitemsid,t1.siteid,SUM(t1.qty) qty from sa_dispatch_items t1 inner join sa_dispatch t2 on t1.sa_dispatchid=t2.sa_dispatchid and t1.siteid=t2.siteid where t2.status in('新建','提交') group by t1.sa_orderitemsid,t1.siteid) t1 inner join  sa_orderitems t3 on t1.sa_orderitemsid=t3.sa_orderitemsid and t1.siteid=t3.siteid where t3.undeliqty=t1.qty)");
+        querySQL.setWhere(where.toString());
+        querySQL.setPage(pageSize, pageNumber);
+        Rows rows = querySQL.query();
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+
     @API(title = "出入库单明细新增更新", apiversion = R.ID2025050614284803.v1.class)
     @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class})
     public String insertormodify_stcokbillItems() throws YosException {