Przeglądaj źródła

2021-11-22 11:08 bgj

sjw 4 lat temu
rodzic
commit
ce2a797877

BIN
src.zip


+ 98 - 0
src/apps/hyconfirmationorder/hyconfirmationorder.java

@@ -0,0 +1,98 @@
+package hyconfirmationorder;
+
+import baseclass.PaoCust;
+import p2.p2server.P2Server;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSet;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+import tmaxbillnum.tmaxbillnum;
+
+import java.util.Date;
+
+public class hyconfirmationorder extends PaoCust {
+    /**
+     * ¹¹Ô캯Êý
+     *
+     * @param arg0
+     */
+    public hyconfirmationorder(PaoSet arg0) {
+        super(arg0);
+    }
+
+
+    @Override
+    protected void save() throws P2Exception {
+        super.save();
+
+    }
+
+    @Override
+    public void init() throws P2Exception {
+        super.init();
+    }
+
+    @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);
+        setValue("fbillnum",getbillnum(),11l);
+        setValue("fstatus","н¨",11l);
+
+
+    }
+
+
+    public String getbillnum() throws P2Exception {
+        PaoSetRemote maxbill = P2Server.getP2Server().getPaoSet("tmaxbillnum",
+                getUserInfo());
+        maxbill.setInsertSite(getSite());
+        maxbill.setWhere("app='hyconfirmationorder' and siteid='" + getString("siteid") + "'");
+        maxbill.reset();
+
+        PaoRemote pao = null;
+        if (maxbill.isEmpty()) {
+            pao = maxbill.addAtEnd();
+            pao.setValue("FSERIALNUM", 1);
+            pao.setValue("APP", "hyconfirmationorder");
+            pao.setValue("FLENGTH", 10);
+        } else {
+            pao = maxbill.getPao(0);
+        }
+        String billnum = ((tmaxbillnum) pao).getBillNum();
+        maxbill.save();
+        return billnum;
+    }
+
+    @Override
+    public void fieldAction(Object paoField, String fieldname) throws P2Exception {
+        super.fieldAction(paoField, fieldname);
+    }
+    @Override
+    public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
+        super.fieldValidate(paoField, fieldname);
+
+    }
+
+    @Override
+    public void delete() throws P2Exception {
+        super.delete();
+    }
+
+
+    public void submit(boolean issubmit,String hrid) throws P2Exception {
+        super.submit(issubmit);
+        if(issubmit){
+            setValue("fstatus","Ìá½»",11l);
+            setValue("submitdate",new Date(),11l);
+            setValue("submitby",hrid,11l);
+        }
+
+    }
+}

+ 183 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/MyHyconfirmationorder.java

@@ -0,0 +1,183 @@
+package openapi.restcontroller.hyworkorder.webapp.hyconfirmationorder;
+
+import hyconfirmationorder.hyconfirmationorder;
+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.db.DBConnect;
+import org.apache.commons.lang.StringUtils;
+import p2.pao.PaoRemote;
+import p2.pao.PaoSetRemote;
+import p2.util.P2Exception;
+
+public class MyHyconfirmationorder extends Controller {
+
+
+    public MyHyconfirmationorder(JSONObject content) {
+        super(content);
+    }
+
+
+
+    /**创建售后服务确认单**/
+    public String create(){
+        JSONObject where = content.getJSONObject("where");
+        String s[] = {"fworknum"};
+        for (String s1 : s) {
+            if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+                return getReturnObject_err("缺少" + s1 + "参数").toString();
+        }
+        try {
+            PaoSetRemote hyWorkorderset = getpaoset("hyWorkorder");
+            hyWorkorderset.setInsertSite(siteid);
+            hyWorkorderset.setWhere("fworknum='"+where.getString("fworknum")+"'");
+            hyWorkorderset.reset();
+            if(hyWorkorderset.isEmpty())return getReturnObject_err("没有此工单").toString();
+            PaoRemote pao = hyWorkorderset.getPao(0);
+            PaoSetRemote hyconfirmationorder = pao.getPaoSet("hyconfirmationorder");
+            hyconfirmationorder.setWhere("fstatus='新建'");
+            hyconfirmationorder.reset();
+            if(!hyconfirmationorder.isEmpty())return getReturnObject_err("已存在新建的确认单").toString();
+            PaoRemote remote = hyconfirmationorder.addAtEnd();
+            remote.setValue("createby",hrid,11l);
+            hyconfirmationorder.save();
+            Row row=new Row();
+            row.put("fbillnum",remote.getString("fbillnum"));
+            return getReturnObject_suc(row,false).toString();
+        } catch (P2Exception e) {
+            return getReturnObject_err(e.getMessage()).toString();
+        }
+
+    }
+
+    /**售后服务确认单详情**/
+    public String detail(){
+        JSONObject where = content.getJSONObject("where");
+        String s[] = {"fbillnum"};
+        for (String s1 : s) {
+            if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+                return getReturnObject_err("缺少" + s1 + "参数").toString();
+        }
+
+        DBConnect dbConnect=new DBConnect();
+        SQLFactory factory_detail = new SQLFactory(this, "售后服务确认单详情");
+        factory_detail.addParameter("fbillnum",where.getString("fbillnum"));
+        Rows rows = dbConnect.runSqlQuery(factory_detail.getSQL());
+        if(rows.isEmpty())return getReturnObject_err("没有该单号").toString();
+        Row result=new Row();
+        Row detail = rows.get(0);
+
+        SQLFactory factory_titems = new SQLFactory(this, "售后商品查询");
+        factory_titems.addParameter("fparentid",detail.getInteger("afterserviceordeid"));
+        Rows titems = dbConnect.runSqlQuery(factory_titems.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);
+        result.put("url",urls);
+
+        return getReturnObject_suc(result,false).toString();
+    }
+
+    /**售后服务确认单列表**/
+    public String list(){
+        JSONObject where = content.getJSONObject("where");
+        String s[] = {"fworknum"};
+        for (String s1 : s) {
+            if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+                return getReturnObject_err("缺少" + s1 + "参数").toString();
+        }
+
+        DBConnect dbConnect=new DBConnect();
+        SQLFactory sqlFactory_list = new SQLFactory(this, "售后服务确认单列表");
+        sqlFactory_list.addParameter("fworknum",where.getString("fworknum"));
+        Rows rows = dbConnect.runSqlQuery(sqlFactory_list.getSQL());
+        return getReturnObject_suc(rows,false).toString();
+    }
+
+    /**售后服务确认单更新**/
+    public String update()  {
+        JSONObject where = content.getJSONObject("where");
+        String s[] = {"fbillnum"};
+        for (String s1 : s) {
+            if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+                return getReturnObject_err("缺少" + s1 + "参数").toString();
+        }
+
+        try {
+            PaoSetRemote hyconfirmationorder = getpaoset("hyconfirmationorder");
+            hyconfirmationorder.setInsertSite(siteid);
+            hyconfirmationorder.setWhere("fbillnum='"+where.getString("fbillnum")+"'");
+            hyconfirmationorder.reset();
+            if(hyconfirmationorder.isEmpty())return getReturnObject_err("没有该单号").toString();
+            PaoRemote pao = hyconfirmationorder.getPao(0);
+            if(where.containsKey("problemmsg")){
+                pao.setValue("Problemmsg",where.getString("problemmsg"),11l);
+            }
+            if(where.containsKey("treatmentmeasures")){
+                pao.setValue("Treatmentmeasures",where.getString("treatmentmeasures"),11l);
+            }
+            if(where.containsKey("nexthandledate")){
+                pao.setValue("nexthandledate",where.getString("nexthandledate"),11l);
+            }
+            if(where.containsKey("itemdescription")){
+                pao.setValue("Itemdescription",where.getString("itemdescription"),11l);
+            }
+            if(where.containsKey("result")){
+                pao.setValue("result",where.getString("result"),11l);
+            }
+            if(where.containsKey("result_msg")){
+                pao.setValue("result_msg",where.getString("result_msg"),11l);
+            }
+            if(where.containsKey("cooperativeattitude")){
+                pao.setValue("Cooperativeattitude",where.getDouble("cooperativeattitude"),11l);
+            }
+            if(where.containsKey("reactionrate")){
+                pao.setValue("reactionrate",where.getDouble("reactionrate"),11l);
+            }
+            //nextreturndate
+            if(where.containsKey("nextreturndate")){
+                pao.setValue("nextreturndate",where.getString("nextreturndate"),11l);
+            }
+
+            hyconfirmationorder.save();
+            return getReturnObject_suc().toString();
+        } catch (P2Exception e) {
+            return getReturnObject_err(e.getMessage()).toString();
+        }
+
+
+    }
+
+    /**提交服务确认单**/
+    public String submit(){
+        JSONObject where = content.getJSONObject("where");
+        String s[] = {"fbillnum"};
+        for (String s1 : s) {
+            if (!where.containsKey(s1) && !StringUtils.isBlank(where.getString(s1)))
+                return getReturnObject_err("缺少" + s1 + "参数").toString();
+        }
+        try {
+            PaoSetRemote hyconfirmationorderset = getpaoset("hyconfirmationorder");
+            hyconfirmationorderset.setInsertSite(siteid);
+            hyconfirmationorderset.setWhere("fbillnum='"+where.getString("fbillnum")+"'");
+            hyconfirmationorderset.reset();
+            if(hyconfirmationorderset.isEmpty())return getReturnObject_err("没有该单号").toString();
+//            System.out.println(hyconfirmationorderset.getPao(0).getClass().toString());
+            hyconfirmationorder pao = (hyconfirmationorder)hyconfirmationorderset.getPao(0);
+            pao.submit(true,hrid);
+            hyconfirmationorderset.save();
+            return getReturnObject_suc().toString();
+        } catch (P2Exception e) {
+            return getReturnObject_err(e.getMessage()).toString();
+        }
+    }
+
+}

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

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

+ 8 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/售后服务确认单列表.sql

@@ -0,0 +1,8 @@
+select t.fbillnum,t.fstatus,convert(varchar,t.createdate,120)createdate,convert(varchar,t.submitdate,120)submitdate,problemmsg,submitby,
+       (
+
+           select top 1 fobsurl from tattachment t3 where ownertable='HYCONFIRMATIONORDER' and ownerid=t.hyconfirmationorid and type='È·Èϵ¥Ô¤ÀÀͼ'
+       )fobsurl
+from hyconfirmationorder t
+         join hyWorkorder t1 on t.fparentid=t1.hyWorkorderid
+where t1.fworknum=$fworknum$

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

@@ -0,0 +1,10 @@
+select t.fbillnum,t.fstatus,t1.fisperiod,t1.repairprice,t1.scenefname,t1.scenephone,t2.appsystem,t2.errcategory,t.problemmsg,t.treatmentmeasures,
+       CONVERT(varchar,t.nexthandledate,120)nexthandledate,t.Itemdescription,t.result,t.result_msg,t.fnotes,t.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
+from hyconfirmationorder t
+         join hyWorkorder t1 on t.fparentid=t1.hyWorkorderid
+         join Afterserviceorder t2 on t2.Servicenum=t1.servernum
+         left join saorder t3 on t3.fsonum=t2.fsonum
+         left join TPROJECT t4 on t4.fprojectnum=t3.fprojectnum
+where t.fbillnum=$fbillnum$

+ 1 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/hyconfirmationorder/SQL/售后服务确认单附件查询.sql

@@ -0,0 +1 @@
+select fobsurl,postfix,type,fdocument,tattachmentid from tattachment where ownertable='HYCONFIRMATIONORDER' and ownerid=$ownerid$

+ 2 - 0
src/rest/openapi/restcontroller/hyworkorder/webapp/workorder/SQL/工单开始前确认.sql

@@ -0,0 +1,2 @@
+select fisscenefname,fistitem,fisperiod,fiserror,repairprice,errormsg,scenefname,scenephone,ftext,faddress,hyWorkorderid ownerid from hyWorkorder
+where fworknum=$fworknum$