Bläddra i källkod

台州工单及服务确认单功能开发2022年3月31日14:52:41

hu 4 år sedan
förälder
incheckning
8e9d6120a1

+ 8 - 7
src/apps/hyconfirmationorder/hyconfirmationorder.java

@@ -35,13 +35,14 @@ public class hyconfirmationorder extends PaoCust {
     @Override
     public void add() throws P2Exception {
         super.add();
-
-        PaoSetRemote hyordernode = getOwner().getPaoSet("HYORDERNODE");
-        hyordernode.setWhere("ischilden=0");
-        hyordernode.setOrderBy("FROWNUM desc");
-        hyordernode.reset();
-        if(!hyordernode.isEmpty())
-            setValue("fnotes",hyordernode.getPao(0).getString("fnotes"),11l);
+        if(getSite().equals("HY")) {
+        	PaoSetRemote hyordernode = getOwner().getPaoSet("HYORDERNODE");
+            hyordernode.setWhere("ischilden=0");
+            hyordernode.setOrderBy("FROWNUM desc");
+            hyordernode.reset();
+            if(!hyordernode.isEmpty())
+                setValue("fnotes",hyordernode.getPao(0).getString("fnotes"),11l);
+        }    
         setValue("fbillnum",getbillnum(),11l);
         setValue("fstatus","н¨",11l);
 

+ 7 - 2
src/apps/hyworkorder/hyworkorder.java

@@ -138,6 +138,8 @@ public class hyworkorder extends PaoCust {
 							remote.setValue("fisconfirmation", pao.getString("fisconfirmation"), 11l);
 							remote.setValue("fiscontract", pao.getString("fiscontract"), 11l);
 							remote.setValue("FISCOMPLETE", pao.getString("FISCOMPLETE"), 11l);
+							remote.setValue("FISADDTRAINING", pao.getString("FISADDTRAINING"), 11l);
+							remote.setValue("FISADDTRAININGTITEM", pao.getString("FISADDTRAININGTITEM"), 11l);
 
 						} else {
 							System.out.println(555);
@@ -154,7 +156,9 @@ public class hyworkorder extends PaoCust {
 							remote.setValue("fisconfirmation", pao.getString("fisconfirmation"), 11l);
 							remote.setValue("fiscontract", pao.getString("fiscontract"), 11l);
 							remote.setValue("FISCOMPLETE", pao.getString("FISCOMPLETE"), 11l);
-
+							remote.setValue("FISADDTRAINING", pao.getString("FISADDTRAINING"), 11l);
+							remote.setValue("FISADDTRAININGTITEM", pao.getString("FISADDTRAININGTITEM"), 11l);
+							
 							for (int j = 0; j < templatenode2.count(); j++) {
 								PaoRemote templatenode2_pao = templatenode2.getPao(j);
 								System.out.println(templatenode2_pao.getString("twoprocessname"));
@@ -173,7 +177,8 @@ public class hyworkorder extends PaoCust {
 										11l);
 								remote2.setValue("fiscontract", templatenode2_pao.getString("fiscontract"), 11l);
 								remote2.setValue("FISCOMPLETE", templatenode2_pao.getString("FISCOMPLETE"), 11l);
-
+								remote2.setValue("FISADDTRAINING", templatenode2_pao.getString("FISADDTRAINING"), 11l);
+								remote2.setValue("FISADDTRAININGTITEM", templatenode2_pao.getString("FISADDTRAININGTITEM"), 11l);
 							}
 						}
 					}

+ 185 - 6
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/MyHyconfirmationorder.java

@@ -1,11 +1,13 @@
 package openapi.restcontroller.hyworkorder.webapp.hyconfirmationorder;
 
 import hyconfirmationorder.hyconfirmationorder;
+import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import openapi.base.Controller;
 import openapi.base.SQLFactory;
 import openapi.base.data.Row;
 import openapi.base.data.Rows;
+import openapi.base.data.RowsMap;
 import openapi.base.data.db.DBConnect;
 import openapi.restcontroller.wechatapp.system.OBSDocManage;
 import openapi.restcontroller.wechatapp.system.docManage;
@@ -53,9 +55,99 @@ public class MyHyconfirmationorder extends Controller {
             if(!hyconfirmationorder.isEmpty())return getReturnObject_err("已存在新建的确认单").toString();
             PaoRemote remote = hyconfirmationorder.addAtEnd();
             remote.setValue("createby",hrid,11l);
-            if(pao.getString("ERRORMSG")!=null && pao.getString("ERRORMSG").length()!=0){
-            	 remote.setValue("PROBLEMMSG", pao.getString("ERRORMSG"));
-            }
+            if (siteid.equals("HY")) {
+            	 if(pao.getString("ERRORMSG")!=null && pao.getString("ERRORMSG").length()!=0){
+                	 remote.setValue("PROBLEMMSG", pao.getString("ERRORMSG"));
+                }
+			}else if(siteid.equals("TZ")) {
+				
+				DBConnect dbConnect = new DBConnect();
+				SQLFactory factory = new SQLFactory(this, "工单节点明细查询");
+				factory.addParameter("siteid", siteid);
+				factory.addParameter("hyworkorderid", pao.getUniqueIDValue());
+				Rows rows = dbConnect.runSqlQuery(factory.getSQL());
+				RowsMap rowsMap = rows.toRowsMap("frownum");
+				if(pao.getString("ftype").equals("安装调试")) {
+					remote.setValue("FISPRODUCT", pao.getBoolean("FISTITEM"));
+					remote.setValue("FISSHELFLIFE", pao.getBoolean("FISPERIOD"));
+					if(!rowsMap.get("2_1").isEmpty() && rowsMap.get("2_1").get(0).getString("ftext")!=null &&rowsMap.get("2_1").get(0).getString("ftext").length()!=0) {
+						remote.setValue("fnotes", rowsMap.get("2_1").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("2_2").isEmpty() && rowsMap.get("2_2").get(0).getString("ftext")!=null &&rowsMap.get("2_2").get(0).getString("ftext").length()!=0) {
+						remote.setValue("fnotes2", rowsMap.get("2_2").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("2_3").isEmpty() && rowsMap.get("2_3").get(0).getString("ftext")!=null &&rowsMap.get("2_3").get(0).getString("ftext").length()!=0) {
+						remote.setValue("TREATMENTMEASURES", rowsMap.get("2_3").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("2_3").isEmpty() && rowsMap.get("2_3").get(0).getString("ftext")!=null &&rowsMap.get("2_3").get(0).getString("ftext").length()!=0) {
+						remote.setValue("FMAINTENANCECYCLE", rowsMap.get("2_3").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("3_1").isEmpty() && rowsMap.get("3_1").get(0).getString("ftext")!=null &&rowsMap.get("3_1").get(0).getString("ftext").length()!=0) {
+						remote.setValue("FAMOUNT", rowsMap.get("3_1").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("3_3").isEmpty() && rowsMap.get("3_3").get(0).getString("ftext")!=null &&rowsMap.get("3_3").get(0).getString("ftext").length()!=0) {
+						remote.setValue("RESULT", rowsMap.get("3_3").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("4_1").isEmpty() && rowsMap.get("4_1").get(0).getString("ftext")!=null &&rowsMap.get("4_1").get(0).getString("ftext").length()!=0) {
+						remote.setValue("RESULT_MSG", rowsMap.get("4_1").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("4_2").isEmpty() && rowsMap.get("4_2").get(0).getString("ftext")!=null &&rowsMap.get("4_2").get(0).getString("ftext").length()!=0) {
+						remote.setValue("FONSITEACCOUNT", rowsMap.get("4_2").get(0).getString("ftext"));
+					}
+					PaoSetRemote paoSetRemote=pao.getPaoSet("AFTERSERVICEORDER").getPao(0).getPaoSet("HYAFTERSERVICEORDER_TITEM");
+					if(!paoSetRemote.isEmpty()) {
+						for (int i=0;i<paoSetRemote.count();i++) {
+							PaoSetRemote HYCONFIRMATIONORDER_TITEM=remote.getPaoSet("HYCONFIRMATIONORDER_TITEM");
+							 PaoRemote remote1 = HYCONFIRMATIONORDER_TITEM.addAtEnd();
+							 remote1.setValue("fitemno", paoSetRemote.getPao(i).getString("fitemno"));
+						}
+					}
+				}else if(pao.getString("ftype").equals("安装培训")) {
+					if(!rowsMap.get("2_3").isEmpty() && rowsMap.get("2_3").get(0).getString("ftext")!=null &&rowsMap.get("2_3").get(0).getString("ftext").length()!=0) {
+						remote.setValue("RESULT", rowsMap.get("2_3").get(0).getString("ftext"));
+					}
+					if(!rowsMap.get("3_1").isEmpty() && rowsMap.get("3_1").get(0).getString("ftext")!=null &&rowsMap.get("3_1").get(0).getString("ftext").length()!=0) {
+						remote.setValue("RESULT_MSG", rowsMap.get("3_1").get(0).getString("ftext"));
+					}
+					PaoSetRemote HYORDERNODE_TITEM=pao.getPaoSet("HYORDERNODE_TITEM");
+					PaoSetRemote HYORDERNODE_TRAINERS=pao.getPaoSet("HYORDERNODE_TRAINERS");
+					if(!HYORDERNODE_TITEM.isEmpty()) {
+						for (int i=0;i<HYORDERNODE_TITEM.count();i++) {
+							PaoSetRemote HYCONFIRMATIONORDER_TITEM=remote.getPaoSet("HYCONFIRMATIONORDER_TITEM");
+							 PaoRemote remote1 = HYCONFIRMATIONORDER_TITEM.addAtEnd();
+							 if(!StringUtils.isBlank(HYORDERNODE_TITEM.getPao(i).getString("fitemno"))) {
+								 remote1.setValue("fitemno", HYORDERNODE_TITEM.getPao(i).getString("fitemno"));
+							 }
+							 if(!StringUtils.isBlank(HYORDERNODE_TITEM.getPao(i).getString("fqty"))) {
+								 remote1.setValue("fqty", HYORDERNODE_TITEM.getPao(i).getString("fqty"));
+							 }
+							 
+						}
+					}
+					if(!HYORDERNODE_TRAINERS.isEmpty()) {
+						for (int i=0;i<HYORDERNODE_TRAINERS.count();i++) {
+							PaoSetRemote HYCONFIRMATIONORDER_TRAIN=remote.getPaoSet("HYCONFIRMATIONORDER_TRAIN");
+							 PaoRemote remote1 = HYCONFIRMATIONORDER_TRAIN.addAtEnd();
+							 if(!StringUtils.isBlank(HYORDERNODE_TRAINERS.getPao(i).getString("fname"))) {
+								 remote1.setValue("fname", HYORDERNODE_TRAINERS.getPao(i).getString("fname"));
+							 }
+							 if(!StringUtils.isBlank(HYORDERNODE_TRAINERS.getPao(i).getString("job"))) {
+								 remote1.setValue("job", HYORDERNODE_TRAINERS.getPao(i).getString("job"));
+							 }
+							 if(!StringUtils.isBlank(HYORDERNODE_TRAINERS.getPao(i).getString("phone"))) {
+								 remote1.setValue("phone", HYORDERNODE_TRAINERS.getPao(i).getString("phone"));
+							 }
+							 if(!StringUtils.isBlank(HYORDERNODE_TRAINERS.getPao(i).getString("fagentnum"))) {
+								 remote1.setValue("fagentnum", HYORDERNODE_TRAINERS.getPao(i).getString("fagentnum"));
+							 }
+							
+						}
+					}
+				}
+			
+				
+			}
+           
             hyconfirmationorder.save();
             Row row=new Row();
             row.put("fbillnum",remote.getString("fbillnum"));
@@ -87,14 +179,28 @@ public class MyHyconfirmationorder extends Controller {
         factory_titems.addParameter("fparentid",detail.getInteger("afterserviceordeid"));
         Rows titems = dbConnect.runSqlQuery(factory_titems.getSQL());
 
-
+        SQLFactory factory_trainstitems = new SQLFactory(this, "售后服务确认单商品查询");
+        factory_trainstitems.addParameter("fparentid",detail.getInteger("ownerid"));
+        System.out.println(factory_trainstitems.getSQL());
+        Rows trainstitems = dbConnect.runSqlQuery(factory_trainstitems.getSQL());
+        
+        SQLFactory factory_trainers = new SQLFactory(this, "售后服务确认单测试人员查询");
+        factory_trainers.addParameter("fparentid",detail.getInteger("ownerid"));
+        Rows trainers = dbConnect.runSqlQuery(factory_trainers.getSQL());
+        
         SQLFactory factory_url = new SQLFactory(this, "售后服务确认单附件查询");
         factory_url.addParameter("ownerid",detail.getInteger("ownerid"));
         Rows urls = dbConnect.runSqlQuery(factory_url.getSQL());
 
 
         result.put("detail",detail);
-        result.put("titems",titems);
+        if(detail.getString("siteid").equals("HY")) {
+        	result.put("titems",titems);
+        	}else if(detail.getString("siteid").equals("TZ")) {
+        		result.put("trainstitems",trainstitems);
+        		result.put("trainers",trainers);
+        	}
+      
         result.put("url",urls);
 
         return getReturnObject_suc(result,false).toString();
@@ -132,6 +238,30 @@ public class MyHyconfirmationorder extends Controller {
             hyconfirmationorder.reset();
             if(hyconfirmationorder.isEmpty())return getReturnObject_err("没有该单号").toString();
             PaoRemote pao = hyconfirmationorder.getPao(0);
+            if(where.containsKey("fisproduct")){
+                pao.setValue("fisproduct",where.getString("fisproduct"),11l);
+            }
+            if(where.containsKey("fispaid")){
+                pao.setValue("fispaid",where.getString("fispaid"),11l);
+            }
+            if(where.containsKey("fisrepairedonline")){
+                pao.setValue("fisrepairedonline",where.getString("fisrepairedonline"),11l);
+            }
+            if(where.containsKey("fisreturnfactory")){
+                pao.setValue("fisreturnfactory",where.getString("fisreturnfactory"),11l);
+            }
+            if(where.containsKey("fisshelflife")){
+                pao.setValue("fisshelflife",where.getString("fisshelflife"),11l);
+            }
+            if(where.containsKey("famount")){
+                pao.setValue("famount",where.getString("famount"),11l);
+            }
+            if(where.containsKey("fmaintenancecycle")){
+            	 pao.setValue("fmaintenancecycle",where.getString("fmaintenancecycle"),11l);
+            }
+            if(where.containsKey("fonsiteaccount")){
+                pao.setValue("fonsiteaccount",where.getString("fonsiteaccount"),11l);
+            }
             if(where.containsKey("problemmsg")){
                 pao.setValue("Problemmsg",where.getString("problemmsg"),11l);
             }
@@ -163,7 +293,56 @@ public class MyHyconfirmationorder extends Controller {
             if(where.containsKey("fnotes")&&!StringUtils.isBlank(where.getString("fnotes"))){
                 pao.setValue("fnotes",where.getString("fnotes"),11l);
             }
-
+            if(where.containsKey("fnotes2")&&!StringUtils.isBlank(where.getString("fnotes2"))){
+                pao.setValue("fnotes2",where.getString("fnotes2"),11l);
+            }
+            if(where.containsKey("titems")) {
+
+				JSONArray titems = where.getJSONArray("titems");
+				PaoSetRemote HYCONFIRMATIONORDER_TITEM = pao.getPaoSet("HYCONFIRMATIONORDER_TITEM");
+				HYCONFIRMATIONORDER_TITEM.deleteAll();
+
+				for (Object o : titems) {
+					 JSONObject resultObject = (JSONObject) o;
+					PaoSetRemote ordernode_traintitem1 = pao.getPaoSet("HYCONFIRMATIONORDER_TITEM");
+					PaoRemote remote = ordernode_traintitem1.addAtEnd();
+					if(resultObject.containsKey("fitemno") && resultObject.getString("fitemno")!=null && resultObject.getString("fitemno").length()!=0) {
+						remote.setValue("fitemno", resultObject.getString("fitemno"), 2l);
+					}
+					if(resultObject.containsKey("fqty") && resultObject.getString("fqty")!=null && resultObject.getString("fqty").length()!=0) {
+						remote.setValue("fqty", resultObject.getString("fqty"), 2l);
+					}
+					
+					
+				}
+			
+            }
+            if(where.containsKey("trainers")) {
+
+				JSONArray trainers = where.getJSONArray("trainers");
+				PaoSetRemote ordernode_trainers = pao.getPaoSet("HYCONFIRMATIONORDER_TRAIN");
+				ordernode_trainers.deleteAll();
+
+				for (Object o : trainers) {
+					 JSONObject resultObject = (JSONObject) o;
+					PaoSetRemote ordernode_trainers1 = pao.getPaoSet("HYCONFIRMATIONORDER_TRAIN");
+					PaoRemote remote = ordernode_trainers1.addAtEnd();
+					
+					if(resultObject.containsKey("fname") && resultObject.getString("fname")!=null && resultObject.getString("fname").length()!=0) {
+						remote.setValue("fname", resultObject.getString("fname"), 2l);
+					}
+					if(resultObject.containsKey("job") && resultObject.getString("job")!=null && resultObject.getString("job").length()!=0) {
+						remote.setValue("job", resultObject.getString("job"), 2l);
+					}
+					if(resultObject.containsKey("phone") && resultObject.getString("phone")!=null && resultObject.getString("phone").length()!=0) {
+						remote.setValue("phone", resultObject.getString("phone"), 2l);
+					}
+					if(resultObject.containsKey("fagentnum") && resultObject.getString("fagentnum")!=null && resultObject.getString("fagentnum").length()!=0) {
+						remote.setValue("fagentnum", resultObject.getString("fagentnum"), 2l);
+					}
+					
+				}
+            }
             hyconfirmationorder.save();
             return getReturnObject_suc().toString();
         } catch (P2Exception e) {

+ 4 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/售后服务确认单商品查询.sql

@@ -0,0 +1,4 @@
+select t1.fitemno,t1.fitemname,t1.fspec,t1.fmodel,t2.fitemclsname,t.fqty from HYCONFIRMATIONORDER_TITEM t
+left join titem t1 on t.FITEMNO=t1.FITEMNO and t.siteid=t1.siteid
+left join TITEMCLASS_VIEW t2 on t2.FITEMCLSNUM=t1.FSALECLSNUM and  t2.fclasstype='ÓªÏúÀà±ð'and t2.siteid=t1.siteid
+where fparentid=$fparentid$

+ 3 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/售后服务确认单测试人员查询.sql

@@ -0,0 +1,3 @@
+select t.fname,t.job,t.phone,t.fagentnum,t1.fagentshortname from HYCONFIRMATIONORDER_TRAIN t
+ left join tagents t1 on t.fagentnum=t1.fagentnum and t.siteid=t1.siteid
+where fparentid=$fparentid$

+ 2 - 2
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/售后服务确认单详情.sql

@@ -1,7 +1,7 @@
-select t.fbillnum,t.fstatus,t1.fisperiod,t1.repairprice,t1.scenefname,t1.scenephone,t2.appsystem,t2.errcategory,t.problemmsg,t.treatmentmeasures,
+select t.fbillnum,t.fstatus,t1.fisperiod,t1.repairprice,t1.scenefname,t1.scenephone,t2.appsystem,t2.errcategory,t.problemmsg,t.treatmentmeasures,t.siteid,
        CONVERT(varchar,t.nexthandledate,120)nexthandledate,t.itemdescription,t.result,t.result_msg,t.fnotes,CONVERT(varchar(16),t.nextreturndate,120)nextreturndate,t.reactionrate,t.cooperativeattitude,
        t.hyconfirmationorid ownerid,t2.afterserviceordeid,convert(varchar,t.createdate,120)createdate,case when t3.ftype='ÏîÄ¿¶©µ¥' then t4.FPROJECTNAME else t3.FPROJECTNOTES end fprojectname,
-       t1.faddress
+       t1.faddress,t2.servicetype,t.famount,t.cooperativeattitude,t.fispaid,t.fisproduct,t.fisrepairedonline,t.fisreturnfactory,t.fisshelflife,t.fmaintenancecycle,t.fnotes2,t.fonsiteaccount,t.reactionrate
 from hyconfirmationorder t
          join hyWorkorder t1 on t.fparentid=t1.hyWorkorderid
          join Afterserviceorder t2 on t2.Servicenum=t1.servernum

+ 4 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/工单节点明细查询.sql

@@ -0,0 +1,4 @@
+select convert(varchar,t1.frownum)+'_'+convert(varchar,t2.frownum) frownum,ftext from 
+(select ROW_NUMBER() OVER (ORDER BY frownum) AS frownum,hyordernodeid from HYORDERNODE where fparentid=$hyworkorderid$ and oneprocessname is not null and  siteid=$siteid$) t1 
+inner join 
+(select dense_rank() over(partition by supid order by frownum) AS frownum,ftext,supid,hyordernodeid from HYORDERNODE where fparentid=$hyworkorderid$ and supid is not null and siteid=$siteid$) t2 on t1.hyordernodeid=t2.supid

+ 126 - 6
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/HyWorkOrder.java

@@ -170,11 +170,11 @@ public class HyWorkOrder extends Controller {
 						String[] from_nodes = { "frownum", "oneprocessname", "twoprocessname", "operating",
 								"operatingtime", "fnotes", "ownerid", "supid", "ischilden", "isconfirm", "fisupload",
 								"fisaddtitem", "fiscomplete", "fisOperator", "fistext", "fisconfirmation",
-								"fiscontract","confirmation" };
+								"fiscontract","confirmation","fisaddtraining","fisaddtrainingtitem"};
 						String[] to_nodes = { "frownum", "oneprocessname", "twoprocessname", "operating",
 								"operatingtime", "fnotes", "hyordernodeid", "supid", "ischilden", "isconfirm",
 								"fisupload", "fisaddtitem", "fiscomplete", "fisOperator", "fistext", "fisconfirmation",
-								"fiscontract","confirmation"};
+								"fiscontract","confirmation","fisaddtraining","fisaddtrainingtitem"};
 						for (int i = 0; i < ordernode.count(); i++) {
 
 							PaoRemote pao = ordernode.getPao(i);
@@ -236,11 +236,11 @@ public class HyWorkOrder extends Controller {
 							String[] from_nodes2 = { "frownum", "oneprocessname", "twoprocessname", "operating",
 									"operatingtime", "fnotes", "ownerid", "supid", "ischilden", "isconfirm",
 									"fisupload", "fisaddtitem", "fiscomplete", "fisOperator", "fistext",
-									"fisconfirmation", "fiscontract","confirmation" };
+									"fisconfirmation", "fiscontract","confirmation","fisaddtraining","fisaddtrainingtitem"};
 							String[] to_nodes2 = { "frownum", "oneprocessname", "twoprocessname", "operating",
 									"operatingtime", "fnotes", "hyordernodeid", "supid", "ischilden", "isconfirm",
 									"fisupload", "fisaddtitem", "fiscomplete", "fisOperator", "fistext",
-									"fisconfirmation", "fiscontract","confirmation" };
+									"fisconfirmation", "fiscontract","confirmation","fisaddtraining","fisaddtrainingtitem"};
 							for (int j = 0; j < ordernode2.count(); j++) {
 								PaoRemote pao1 = ordernode2.getPao(j);
 								Row row1 = getrow(from_nodes2, to_nodes2, pao1);
@@ -424,6 +424,16 @@ public class HyWorkOrder extends Controller {
 						+ "hyworkorder_titem t\n" + "where EXISTS(select 1 from hyWorkorder t1 where t1.fworknum='"
 						+ where.getString("fworknum") + "' and t1.hyWorkorderid=t.fparentid)\n" + " and t.sourcenode='"
 						+ where.getString("frownum") + "'");
+				
+				/** 节点关联培训物料查询 **/
+				Rows rows_traintitem = dbConnect.runSqlQuery("select t.fitemno,t2.fitemname,t2.fmodel,t2.fspec,t.fqty  from HYORDERNODE_TITEM t left join titem t2 on t.fitemno=t2.fitemno and t.siteid=t2.siteid\n"
+						+ "where EXISTS(select 1 from hyordernode t1 where t1.hyordernodeid=t.fparentid and t1.hyordernodeid="
+						+ rowdetail.getInteger("ownerid") + ") and t.siteid='" + siteid + "'");
+				
+				/** 节点关联培训人员查询 **/
+				Rows rows_trainers= dbConnect.runSqlQuery("select t.fname,t.job,t.phone,t.fagentnum,t2.fagentshortname  from HYORDERNODE_trainers t left join tagents t2 on t.fagentnum=t2.fagentnum and t.siteid=t2.siteid\n"
+						+ "where EXISTS(select 1 from hyordernode t1 where t1.hyordernodeid=t.fparentid and t1.hyordernodeid="
+						+ rowdetail.getInteger("ownerid") + ") and t.siteid='" + siteid + "'");
 
 //                SQLFactory factory_imgurl = new SQLFactory(this, "物料图片查询");
 //                factory_imgurl.addParameter("fagentnum", rowdetail.getString("fagentnum"));
@@ -441,7 +451,8 @@ public class HyWorkOrder extends Controller {
 
 				rowdetail.put("team", rows_team);
 				rowdetail.put("titem", rows_titem);
-
+				rowdetail.put("traintitem", rows_traintitem);
+				rowdetail.put("trainers", rows_trainers);
 				return getReturnObject_suc(rowdetail, false).toString();
 
 			}
@@ -508,6 +519,56 @@ public class HyWorkOrder extends Controller {
 								remote.setValue("hyworkernum", s1, 2l);
 							}
 						}
+						
+						/** 添加培训人员 **/
+						if (where.containsKey("trainers")) {
+							JSONArray trainers = where.getJSONArray("trainers");
+							PaoSetRemote ordernode_trainers = ordernodePao.getPaoSet("HYORDERNODE_TRAINERS");
+							ordernode_trainers.deleteAll();
+
+							for (Object o : trainers) {
+								 JSONObject resultObject = (JSONObject) o;
+								PaoSetRemote ordernode_trainers1 = ordernodePao.getPaoSet("HYORDERNODE_TRAINERS");
+								PaoRemote remote = ordernode_trainers1.addAtEnd();
+								remote.setValue("fworknum",where.getString("fworknum"),11l);
+								System.out.println(555);
+								if(resultObject.containsKey("fname") && resultObject.getString("fname")!=null && resultObject.getString("fname").length()!=0) {
+									remote.setValue("fname", resultObject.getString("fname"), 2l);
+								}
+								if(resultObject.containsKey("job") && resultObject.getString("job")!=null && resultObject.getString("job").length()!=0) {
+									remote.setValue("job", resultObject.getString("job"), 2l);
+								}
+								if(resultObject.containsKey("phone") && resultObject.getString("phone")!=null && resultObject.getString("phone").length()!=0) {
+									remote.setValue("phone", resultObject.getString("phone"), 2l);
+								}
+								if(resultObject.containsKey("fagentnum") && resultObject.getString("fagentnum")!=null && resultObject.getString("fagentnum").length()!=0) {
+									remote.setValue("fagentnum", resultObject.getString("fagentnum"), 2l);
+								}
+								
+							}
+						}
+						
+						/** 添加培训商品 **/
+						if (where.containsKey("traintitem")) {
+							JSONArray traintitem = where.getJSONArray("traintitem");
+							PaoSetRemote ordernode_traintitem = ordernodePao.getPaoSet("HYORDERNODE_TITEM");
+							ordernode_traintitem.deleteAll();
+
+							for (Object o : traintitem) {
+								 JSONObject resultObject = (JSONObject) o;
+								PaoSetRemote ordernode_traintitem1 = ordernodePao.getPaoSet("HYORDERNODE_TITEM");
+								PaoRemote remote = ordernode_traintitem1.addAtEnd();
+								remote.setValue("fworknum",where.getString("fworknum"),11l);
+								if(resultObject.containsKey("fitemno") && resultObject.getString("fitemno")!=null && resultObject.getString("fitemno").length()!=0) {
+									remote.setValue("fitemno", resultObject.getString("fitemno"), 2l);
+								}
+								if(resultObject.containsKey("fqty") && resultObject.getString("fqty")!=null && resultObject.getString("fqty").length()!=0) {
+									remote.setValue("fqty", resultObject.getString("fqty"), 2l);
+								}
+								
+								
+							}
+						}
 						/** 添加是否合格项 **/
 //                        if(where.containsKey("qualified")){
 //                            ordernodePao.setValue("qualified",where.getBoolean("qualified"),11l);
@@ -1122,5 +1183,64 @@ public class HyWorkOrder extends Controller {
         rows.add(row9);
         return getReturnObject_suc(rows,true).toString();
     }
-
+    /** 经销商列表 **/
+	public String querytagents() {
+		if (StringUtils.isBlank(hrid))
+			return getReturnObject_err("hrid为空").toString();
+//        if(StringUtils.isBlank(fagentnum))return getReturnObject_err("fagentnum为空").toString();
+		if (StringUtils.isBlank(siteid))
+			return getReturnObject_err("siteid为空").toString();
+		JSONObject where = content.getJSONObject("where");
+		String wherestr = "1=1";
+//		String s[] = { "fstatus" };
+//		for (String s1 : s) {
+//			if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+//				return getReturnObject_err("缺少" + s1 + "参数").toString();
+//		}
+		if (where != null) {
+			DBConnect dbConnect = new DBConnect();
+			if (where.containsKey("condtion") && !StringUtils.isBlank(where.getString("condtion"))) {
+				wherestr += " and (fagentnum like '%" + where.getString("condtion") + "%' or fagentshortname like '%" + where.getString("condtion") +"%')";
+			}
+		
+			SQLFactory factory = new SQLFactory(this, "经销商查询", pageSize, pageNumber,"fagentnum asc");
+			//factory.addParameter("hrid", hrid);
+			factory.addParameter("siteid", siteid);
+			factory.addParameter_SQL("where", wherestr);
+			Rows rows = dbConnect.runSqlQuery(factory.getSQL());
+			return getReturnObject_suc_page(rows, true, 0).toString();
+		}
+		return getReturnObject_err("缺少where参数").toString();
+	}
+	 /** 经销商列表 **/
+		public String querytitem() {
+			if (StringUtils.isBlank(hrid))
+				return getReturnObject_err("hrid为空").toString();
+//	        if(StringUtils.isBlank(fagentnum))return getReturnObject_err("fagentnum为空").toString();
+			if (StringUtils.isBlank(siteid))
+				return getReturnObject_err("siteid为空").toString();
+			JSONObject where = content.getJSONObject("where");
+			String wherestr = "1=1";
+//			String s[] = { "fstatus" };
+//			for (String s1 : s) {
+//				if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+//					return getReturnObject_err("缺少" + s1 + "参数").toString();
+//			}
+			if (where != null) {
+				DBConnect dbConnect = new DBConnect();
+				if (where.containsKey("condtion") && !StringUtils.isBlank(where.getString("condtion"))) {
+					wherestr += " and (fitemno like '%" + where.getString("condtion") + "%' "
+							+ "or fitemname like '%" + where.getString("condtion") +"%' "
+							+ "or fmodel like '%" + where.getString("condtion") +"%')";
+				}
+			
+				SQLFactory factory = new SQLFactory(this, "培训物料查询", pageSize, pageNumber,"fitemno asc");
+				//factory.addParameter("hrid", hrid);
+				factory.addParameter("siteid", siteid);
+				factory.addParameter_SQL("where", wherestr);
+				Rows rows = dbConnect.runSqlQuery(factory.getSQL());
+				return getReturnObject_suc_page(rows, true, 0).toString();
+			}
+			return getReturnObject_err("缺少where参数").toString();
+		}
 }

+ 1 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/培训物料查询.sql

@@ -0,0 +1 @@
+select fitemno,fitemname,fmodel,fspec from titem where siteid=$siteid$ and $where$

+ 3 - 1
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/工单节点详情查询.sql

@@ -20,7 +20,9 @@ select t.frownum,(isnull(t.oneprocessname,'')+isnull(t.twoprocessname,'')) conte
        t4.ffisaddtitem,
        t4.ffistext,
        t4.ffiscontract,
-       t4.ffisconfirmation
+       t4.ffisconfirmation,
+       t.fisaddtraining,
+       t.fisaddtrainingtitem
 from hyordernode t
          join hyWorkorder t3 on t3.hyWorkorderid=t.fparentid
          left join hyworker t1 on t1.hyworkernum=t.Operator

+ 1 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/经销商查询.sql

@@ -0,0 +1 @@
+select fagentnum,fagentshortname from tagents where siteid=$siteid$ and $where$