Преглед изворни кода

Merge remote-tracking branch 'Gogs/develop' into develop

沈静伟 пре 3 година
родитељ
комит
3bc88f95d9

+ 1 - 1
src/rest/openapi/restcontroller/housekeeper/workorder/SQL/工单列表查询.sql

@@ -1,4 +1,4 @@
-select t.fworknum,convert(char(24),t.createdate,120)createdate,t.ftype,(isnull(t.FPROVINCE,'')+isnull(t.FCITY,'')+isnull(t.FCOUNTY,0)) fcounty,t.faddress,t1.fname projectleader,t.fstatus,t.progress,t.customername,
+select t.customephone,t.fworknum,convert(char(24),t.createdate,120)createdate,t.ftype,(isnull(t.FPROVINCE,'')+isnull(t.FCITY,'')+isnull(t.FCOUNTY,0)) fcounty,t.faddress,t1.fname projectleader,t.fstatus,t.progress,t.customername,
        (
            select count(1) from ordernode t2 where t2.fparentid=t.Workorderid and ischilden=0 and isconfirm=1
        ) confirmcount,

+ 1 - 1
src/rest/openapi/restcontroller/housekeeper/workorder/SQL/服务预约单列表查询.sql

@@ -1,2 +1,2 @@
-select t.fservernum,convert(varchar,t.createdate,120)createdate,t.customername,(isnull(t.FPROVINCE,'')+isnull(t.FCITY,'')+isnull(t.FCOUNTY,0)) fcounty,t.faddress,t.ftype,t.fstatus from Serviceform t
+select t.fservernum,convert(varchar,t.createdate,120)createdate,t.customername,t.customerphone,(isnull(t.FPROVINCE,'')+isnull(t.FCITY,'')+isnull(t.FCOUNTY,0)) fcounty,t.faddress,t.ftype,t.fstatus from Serviceform t
 where t.siteid=$siteid$  and t.fagentnum=$fagentnum$ and t.fstatus<>'´ýÖ¸ÅÉ' and $where$

+ 5 - 0
src/rest/openapi/restcontroller/housekeeper/workorder/Serviceform.java

@@ -73,6 +73,11 @@ public class Serviceform extends Controller {
             if (where.containsKey("enddate") && !StringUtils.isBlank(where.getString("enddate"))) {
                 wherestr += " and t.createdate <= '" + where.getString("enddate") + "'";
             }
+            if (where.containsKey("condtion") && !StringUtils.isBlank(where.getString("condtion"))) {
+            	wherestr += " and (t.customername like '%" + where.getString("condtion") + "%' " + "or t.customerphone like '%"
+						+ where.getString("condtion") + "%' " + "or t.faddress like '%" + where.getString("condtion")
+						+ "%')";
+            }
             SQLFactory factory = new SQLFactory(this, "服务预约单列表查询", pageSize, pageNumber, "case when t.fstatus='待处理' then 1\n" +
             		"when t.fstatus='待验收' then 2\n" +
                     "when t.fstatus='进行中' then 3\n" +

+ 5 - 0
src/rest/openapi/restcontroller/housekeeper/workorder/WorkOrder.java

@@ -50,6 +50,11 @@ public class WorkOrder extends Controller {
             if(where.containsKey("fworknum")&&!StringUtils.isBlank(where.getString("fworknum"))){
                 wherestr+=" and t.fworknum like '%"+where.getString("fworknum")+"%'";
             }
+            if (where.containsKey("condtion") && !StringUtils.isBlank(where.getString("condtion"))) {
+            	wherestr += " and (t.customername like '%" + where.getString("condtion") + "%' " + "or t.customephone like '%"
+						+ where.getString("condtion") + "%' " + "or t.faddress like '%" + where.getString("condtion")
+						+ "%')";
+            }
             SQLFactory factory=new SQLFactory(this,"工单列表查询",pageSize,pageNumber,"case when t.fstatus='待开始' then 1\n" +
                     "when t.fstatus='质保卡审批' then 2\n" +
                     "when t.fstatus='进行中' then 3\n" +

+ 3 - 2
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单出货明细.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid =$siteid$
-select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
+select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,t8.fagentshortname fpayagentnum,t9.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 left join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=t1.siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -20,6 +20,7 @@ inner join sainvoice t3 on t4.siteid=t3.siteid and t4.fparentid=t3.sainvoiceid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t3.fstatus='¹Ø±Õ' and t1.siteid=@siteid) t7 on t7.saorderdetailid=t2.saorderdetailid and t7.siteid=t2.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
-
+left join tagents t8 on fpayagentnum=t8.fagentnum and t1.siteid=t8.siteid
+left join tagents t9 on t1.frecagentnum=t9.fagentnum and t1.siteid=t9.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),SAINVOICE.fdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
 

+ 3 - 2
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单出货明细1.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid =$siteid$
-select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
+select (sainvoicedetail.famount-isnull(sainvoicedetail.finvoiceamount,0)) finvoiceamount ,t1.fsonum,t2.frownum,t8.fagentshortname fpayagentnum,t9.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(sainvoicedetail.famount-isnull(sainvoicedetail.FWRITEOFFAMOUNT1,0)) fwriteoffamount,t1.checkdate,SAINVOICE.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 left join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=t1.siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -20,6 +20,7 @@ inner join sainvoice t3 on t4.siteid=t3.siteid and t4.fparentid=t3.sainvoiceid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t3.fstatus='¹Ø±Õ' and t1.siteid=@siteid) t7 on t7.saorderdetailid=t2.saorderdetailid and t7.siteid=t2.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
-
+left join tagents t8 on fpayagentnum=t8.fagentnum and t1.siteid=t8.siteid
+left join tagents t9 on t1.frecagentnum=t9.fagentnum and t1.siteid=t9.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),SAINVOICE.fdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
 

+ 3 - 1
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单审核明细.sql

@@ -1,6 +1,6 @@
 declare @siteid varchar(20)
 set @siteid = $siteid$
-select t1.fsonum,t2.frownum,fpayagentnum,t1.frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(t2.frateamount-isnull(t2.fwriteoffamount,0)) fwriteoffamount,CONVERT(VARCHAR(10),t1.checkdate,120) checkdate,t6.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate,(t2.frateamount-isnull(t2.finvoiceamount,0)) finvoiceamount from saorder t1
+select t1.fsonum,t2.frownum,t5.fagentshortname fpayagentnum,t7.fagentshortname frecagentnum,pp_hr.displayname,t2.fitemname,t2.fspec,t2.fmodel,tunit.fname,t2.fqty,t2.fprice,t2.frateamount,(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0)) fwriteoffamount,CONVERT(VARCHAR(10),t1.checkdate,120) checkdate,t6.fdate,t3.fmaterial,t3.fdevice,t3.fspecalnote,t3.fitemno,t3.fnotes,TPROJECT.fprojectname,t4.kaipiaodate,(t2.frateamount-isnull(t2.finvoiceamount,0)) finvoiceamount from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid 
 inner join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=@siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
@@ -14,5 +14,7 @@ inner join titem t3 on  t2.fitemno=t3.fitemno and t2.siteid=t3.siteid
 left join TPROJECT on TPROJECT.fprojectnum=t1.fprojectnum and TPROJECT.siteid=t1.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid 
                              left join TINVOICEAPPLY on TINVOICEAPPLY.TINVOICEAPPLYID=TINVOICEAPPLYORDER.TINVOICEAPPLYID and TINVOICEAPPLY.siteid=TINVOICEAPPLYORDER.siteid where TINVOICEAPPLY.checkdate is not null  group by saorderdetail.SAORDERDETAILID ) t4 on t2.saorderdetailid=t4.saorderdetailid
+left join tagents t5 on fpayagentnum=t5.fagentnum and t1.siteid=t5.siteid
+left join tagents t7 on t1.frecagentnum=t7.fagentnum and t1.siteid=t7.siteid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=@siteid and CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) and t1.fagentnum=$fagentnum$ and $where$ order by t1.fsonum desc,t2.frownum asc
 

+ 6 - 6
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单审核未收款账期统计查询.sql

@@ -2,27 +2,27 @@ declare @siteid varchar(20)
 set @siteid = $siteid$
 select t1.fagentnum,fagentname,fagentshortname,pp_hr.displayname,isnull(t2.famount1,0) famount1,isnull(t3.famount2,0) famount2,isnull(t4.famount3,0) famount3,isnull(t5.famount4,0) famount4,isnull(t6.famount5,0) famount5,isnull(t7.famount6,0) ftotalamount from tagents t1 
 inner join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount6 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount6 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) group by t1.fagentnum,fsaler) t7 on t1.fagentnum=t7.fagentnum 
 left join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount1 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount1 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and  CONVERT(VARCHAR(10),t1.checkdate,120)>CONVERT(VARCHAR(10),DATEADD(mm,-1,getdate()),120) and  CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,0,getdate()),120) group by t1.fagentnum,fsaler) t2 on t7.fagentnum=t2.fagentnum and t7.fsaler=t2.fsaler
 left join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount2 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount2 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and  CONVERT(VARCHAR(10),t1.checkdate,120)>CONVERT(VARCHAR(10),DATEADD(mm,-3,getdate()),120) and  CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,-1,getdate()),120) group by t1.fagentnum,fsaler) t3 on t7.fagentnum=t3.fagentnum and t7.fsaler=t3.fsaler
 left join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount3 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount3 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and  CONVERT(VARCHAR(10),t1.checkdate,120)>CONVERT(VARCHAR(10),DATEADD(mm,-6,getdate()),120) and  CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,-3,getdate()),120) group by t1.fagentnum,fsaler) t4 on t7.fagentnum=t4.fagentnum and t7.fsaler=t4.fsaler
 left join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount4 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount4 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid and  CONVERT(VARCHAR(10),t1.checkdate,120)>CONVERT(VARCHAR(10),DATEADD(mm,-12,getdate()),120) and  CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,-6,getdate()),120) group by t1.fagentnum,fsaler) t5 on t7.fagentnum=t5.fagentnum and t7.fsaler=t5.fsaler
 left join
-(select fsaler,t1.fagentnum,sum(t2.frateamount-isnull(t2.fwriteoffamount,0))famount5 from saorder t1
+(select fsaler,t1.fagentnum,sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0))famount5 from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('审核','关闭') and t1.siteid=@siteid  and CONVERT(VARCHAR(10),t1.checkdate,120)<=CONVERT(VARCHAR(10),DATEADD(mm,-12,getdate()),120) group by t1.fagentnum,fsaler) t6 on t7.fagentnum=t6.fagentnum and t7.fsaler=t6.fsaler
 inner join pp_hr on pp_hr.hrid=t7.fsaler where $where$ order by  ftotalamount desc

+ 1 - 1
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单审核未收款金额查询.sql

@@ -1,3 +1,3 @@
-select sum(t2.frateamount-isnull(t2.fwriteoffamount,0)) famount from saorder t1
+select sum(t2.frateamount-t2.frateprice*isnull(t2.freturnqty,0)-isnull(t2.fwriteoffamount,0)) famount from saorder t1
 inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 where t1.fstatus in('ÉóºË','¹Ø±Õ') and t1.siteid=$siteid$ and $where$