|
|
@@ -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) {
|