فهرست منبع

宁波工单物料查询过滤已添加的物料

hu 3 سال پیش
والد
کامیت
0afae1a726

+ 9 - 1
src/rest/openapi/restcontroller/housekeeper/titem/AgentTitem.java

@@ -27,8 +27,15 @@ public class AgentTitem extends Controller {
         if(StringUtils.isBlank(siteid))return getReturnObject_err("siteid为空").toString();
         JSONObject where = content.getJSONObject("where");
         String wherestr="1=1";
+        
         if(where!=null){
             DBConnect dbConnect=new DBConnect();
+            /**节点关联物料查询**/
+            Rows rows_titem = dbConnect.runSqlQuery("select t.fitemno,t.fitemname,t.fmodel,t.fspec,t.fqty from \n" +
+                    "workorder_titem t\n" +
+                    "where EXISTS(select 1 from Workorder t1 where t1.fworknum='"+where.getString("fworknum")+"' and t1.Workorderid=t.fparentid)\n" +
+                    " and t.sourcenode='"+where.getString("frownum")+"'");
+          
             if(where.containsKey("fitemname")&&!StringUtils.isBlank(where.getString("fitemname"))){
                 wherestr+=" and (t.fitemname like '%"+where.getString("fitemname")+"%' " +
                         "or t.fitemno like '%"+where.getString("fitemname")+"%' "+
@@ -45,8 +52,9 @@ public class AgentTitem extends Controller {
             SQLFactory factory=new SQLFactory(this,"本站物料查询",pageSize,pageNumber,"t.fitemno");
             factory.addParameter("siteid",siteid);
             factory.addParameter("fagentnum",fagentnum);
+            factory.addParameter_SQL("fitemno",  rows_titem.getInWhere("fitemno"));
             factory.addParameter_SQL("where",wherestr);
-
+            System.out.println("111:"+factory.getSQL());
             Rows rows = dbConnect.runSqlQuery(factory.getSQL());
             SQLFactory imagefactory=new SQLFactory(this,"本站物料图片查询");
             imagefactory.addParameter("siteid",siteid);

+ 1 - 1
src/rest/openapi/restcontroller/housekeeper/titem/SQL/本站物料查询.sql

@@ -2,4 +2,4 @@ select t.fitemno,t.fitemname,t.fmodel,t.fspec,t.fisused,t2.fbrand,t2.fieldname,
 case when t.titemid is null then '±¾Õ¾ÎïÁÏ' else '×ܲ¿ÎïÁÏ' end type
 from TAGENTS_titem t
 left join titem t2 on t.fitemno=t2.fitemno and t2.siteid=t.siteid
-where t.fagentnum=$fagentnum$ and t.siteid=$siteid$ and $where$
+where t.fagentnum=$fagentnum$ and t.siteid=$siteid$ and t.fitemno not in $fitemno$ and $where$