123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617 |
- $PBExportHeader$w_post_propel_edit_ljfieb.srw
- forward
- global type w_post_propel_edit_ljfieb from w_publ_base
- end type
- type dw_1 from datawindow within w_post_propel_edit_ljfieb
- end type
- type cb_1 from uo_imflatbutton within w_post_propel_edit_ljfieb
- end type
- type dw_mx from u_dw_rbtnfilter within w_post_propel_edit_ljfieb
- end type
- type cb_cus_ch from uo_imflatbutton within w_post_propel_edit_ljfieb
- end type
- type cb_spt_ch from uo_imflatbutton within w_post_propel_edit_ljfieb
- end type
- type cb_delmx from uo_imflatbutton within w_post_propel_edit_ljfieb
- end type
- type dw_mx_ori from datawindow within w_post_propel_edit_ljfieb
- end type
- end forward
- global type w_post_propel_edit_ljfieb from w_publ_base
- integer width = 2309
- integer height = 2380
- string title = "发公告"
- boolean minbox = false
- windowtype windowtype = response!
- dw_1 dw_1
- cb_1 cb_1
- dw_mx dw_mx
- cb_cus_ch cb_cus_ch
- cb_spt_ch cb_spt_ch
- cb_delmx cb_delmx
- dw_mx_ori dw_mx_ori
- end type
- global w_post_propel_edit_ljfieb w_post_propel_edit_ljfieb
- type variables
- long ins_postid
- uo_ljfieb uo_fieb
- Transaction tr_eb_sqlca
- end variables
- on w_post_propel_edit_ljfieb.create
- int iCurrent
- call super::create
- this.dw_1=create dw_1
- this.cb_1=create cb_1
- this.dw_mx=create dw_mx
- this.cb_cus_ch=create cb_cus_ch
- this.cb_spt_ch=create cb_spt_ch
- this.cb_delmx=create cb_delmx
- this.dw_mx_ori=create dw_mx_ori
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.dw_1
- this.Control[iCurrent+2]=this.cb_1
- this.Control[iCurrent+3]=this.dw_mx
- this.Control[iCurrent+4]=this.cb_cus_ch
- this.Control[iCurrent+5]=this.cb_spt_ch
- this.Control[iCurrent+6]=this.cb_delmx
- this.Control[iCurrent+7]=this.dw_mx_ori
- end on
- on w_post_propel_edit_ljfieb.destroy
- call super::destroy
- destroy(this.dw_1)
- destroy(this.cb_1)
- destroy(this.dw_mx)
- destroy(this.cb_cus_ch)
- destroy(this.cb_spt_ch)
- destroy(this.cb_delmx)
- destroy(this.dw_mx_ori)
- end on
- event open;call super::open;ins_postid = Message.DoubleParm
- tr_eb_sqlca = sys_email_sqlca // 电子商务连接
- uo_fieb = Create uo_ljfieb
- uo_fieb.commit_transaction = tr_eb_sqlca
- dw_1.SetTransObject(sqlca)
- dw_mx.SetTransObject(sqlca)
- dw_mx_ori.SetTransObject(sqlca)
- If ins_postid = 0 Then
- dw_1.InsertRow(0)
- Else
- dw_1.Retrieve(ins_postid)
- dw_mx.retrieve(ins_postid)
- dw_mx_ori.retrieve(ins_postid)
- End If
- dw_1.SetFocus()
- end event
- event close;call super::close;destroy uo_fieb
- end event
- type cb_func from w_publ_base`cb_func within w_post_propel_edit_ljfieb
- boolean visible = false
- end type
- type cb_exit from w_publ_base`cb_exit within w_post_propel_edit_ljfieb
- integer x = 1170
- integer y = 2172
- integer picsize = 16
- end type
- type dw_1 from datawindow within w_post_propel_edit_ljfieb
- integer x = 23
- integer y = 16
- integer width = 2249
- integer height = 868
- integer taborder = 30
- boolean bringtotop = true
- string title = "none"
- string dataobject = "dw_post_propel_edit_ljfieb"
- boolean livescroll = true
- borderstyle borderstyle = stylelowered!
- end type
- event rbuttondown;Long ll_row,ll_column
- ll_row = This.GetRow()
- ll_column = This.GetColumn()
- If ll_row <= 0 Then Return
- If ll_column <= 0 Then Return
- If Left( This.Describe( dwo.Name+ ".coltype"),4) = 'date' Then
- s_calender_arg s_calender
-
- s_calender.PointerX = This.PointerX()
- s_calender.PointerY = This.PointerY()
- s_calender.X = This.X + Parent.X
- s_calender.Y = This.Y + Parent.Y
-
- OpenWithParm(w_calendar,s_calender)
- This.SetItem(ll_row,ll_column,id_date_selected)
- End If
- end event
- type cb_1 from uo_imflatbutton within w_post_propel_edit_ljfieb
- integer x = 731
- integer y = 2172
- integer width = 311
- integer height = 96
- integer taborder = 20
- boolean bringtotop = true
- string text = "提交"
- string normalpicname = "ok.bmp"
- integer picsize = 16
- end type
- event clicked;call super::clicked;Long ll_scid,ll_deptid,ll_postid,ll_newid
- DateTime ld_sdate,ld_edate
- String ls_dscrp
- String errmsg
- Long ll_i,ll_j
- String ls_commcode, ls_commsccode, ls_commname
- Int li_kind
- dw_1.AcceptText()
- dw_mx.AcceptText()
- Long ll_row
- ll_row = dw_1.GetRow()
- If ll_row <= 0 Then
- MessageBox('系统提示','没有可保存的内容')
- Return
- End If
- ll_postid = dw_1.Object.postid[ll_row]
- ld_sdate = dw_1.Object.sdate[ll_row]
- ld_edate = dw_1.Object.edate[ll_row]
- ls_dscrp = dw_1.Object.dscrp[ll_row]
- ld_sdate = DateTime(Date(ld_sdate),Time(0))
- ld_edate = DateTime(Date(ld_edate),Time('23:59:59'))
- If ld_edate < ld_sdate Then
- MessageBox('系统提示','结束日期不能早于开始日期')
- Return
- End If
- If Trim(ls_dscrp) = '' Then
- MessageBox('系统提示','请输入公告内容')
- Return
- End If
- If dw_mx.RowCount() = 0 Then
- MessageBox('系统提示','请先选择要推送公告的对象')
- Return
- End If
- If MessageBox('询问','是否确定要发布公告?',question!,yesno!) = 2 Then Return
- If ll_postid = 0 Then
-
- ll_newid = f_sys_scidentity(0,"u_post_propel","postid",errmsg,True,sqlca)
- If ll_newid <= 0 Then
- MessageBox(publ_operator,errmsg)
- Return
- End If
-
- Insert Into u_post_propel
- (postid, sdate, edate, dscrp, opemp, opdate)
- Values (:ll_newid, :ld_sdate, :ld_edate, :ls_dscrp,:publ_operator,getdate());
- If sqlca.SQLCode <> 0 Then
- Rollback;
- MessageBox('Error','新建公告失败,'+sqlca.SQLErrText)
- Return
- End If
-
- For ll_i = 1 To dw_mx.RowCount()
-
- ls_commcode = dw_mx.Object.commcode[ll_i]
- ls_commsccode = dw_mx.Object.commsccode[ll_i]
- ls_commname = dw_mx.Object.commname[ll_i]
- li_kind = dw_mx.Object.Kind[ll_i]
-
- Insert Into u_post_propel_mx
- (postid,
- commcode,
- commsccode,
- commname,
- kind)
- Values (:ll_newid,
- :ls_commcode,
- :ls_commsccode,
- :ls_commname,
- :li_kind);
- If sqlca.SQLCode <> 0 Then
- Rollback;
- MessageBox('Error','插入推送对象列表失败,'+sqlca.SQLErrText)
- Return
- End If
-
- Next
-
- Else
- Update u_post_propel
- Set sdate = :ld_sdate,
- edate = :ld_edate,
- dscrp = :ls_dscrp,
- opemp = :publ_operator,
- opdate = getdate()
- Where postid = :ll_postid;
- If sqlca.SQLCode <> 0 Then
- Rollback;
- MessageBox('Error','更新公告失败,'+sqlca.SQLErrText)
- Return
- End If
-
- Delete From u_post_propel_mx
- Where postid = :ll_postid;
- If sqlca.SQLCode <> 0 Then
- Rollback;
- MessageBox('Error','删除原推送对象列表失败,'+sqlca.SQLErrText)
- Return
- End If
-
- For ll_i = 1 To dw_mx.RowCount()
-
- ls_commcode = dw_mx.Object.commcode[ll_i]
- ls_commsccode = dw_mx.Object.commsccode[ll_i]
- ls_commname = dw_mx.Object.commname[ll_i]
- li_kind = dw_mx.Object.Kind[ll_i]
-
- Insert Into u_post_propel_mx
- (postid,
- commcode,
- commsccode,
- commname,
- kind)
- Values (:ll_postid,
- :ls_commcode,
- :ls_commsccode,
- :ls_commname,
- :li_kind);
- If sqlca.SQLCode <> 0 Then
- Rollback;
- MessageBox('Error','插入推送对象列表失败,'+sqlca.SQLErrText)
- Return
- End If
-
- Next
-
- End If
- Commit;
- //推送
- Long ll_sendcuscommid,ll_receivecuscommid
- String arg_msg_err,arg_msg_tmp
- DateTime server_dt
- Long ll_suc,ll_fail
- s_post_ljfieb arg_s_post
- String ls_RelatedCode
- String ls_SerialNum
- Select CusCommID
- Into :ll_sendcuscommid
- From LJFIEB_CusComm
- Where CusType = 0 Using tr_eb_sqlca;
- If tr_eb_sqlca.SQLCode <> 0 Then
- MessageBox('Error','查询本公司企业编号失败,'+tr_eb_sqlca.SQLErrText)
- Return
- End If
- Select Top 1 getdate() Into :server_dt From u_user ;
- If sqlca.SQLCode <> 0 Then
- MessageBox('error',"查询操作失败,日期 ")
- Return
- End If
- If ll_postid = 0 Then
- arg_s_post.postid = ll_newid
- Else
- arg_s_post.postid = ll_postid
- End If
- arg_s_post.sdate = ld_sdate
- arg_s_post.edate = ld_edate
- arg_s_post.dscrp = ls_dscrp
- arg_s_post.opemp = publ_operator
- arg_s_post.opdate = server_dt
- For ll_i = 1 To dw_mx.RowCount()
-
- ls_commcode = dw_mx.Object.commcode[ll_i]
- ls_commsccode = dw_mx.Object.commsccode[ll_i]
- ls_commname = dw_mx.Object.commname[ll_i]
-
- Select CusCommID
- Into :ll_receivecuscommid
- From LJFIEB_CusComm
- Where cuscode = :ls_commcode Using tr_eb_sqlca;
- If tr_eb_sqlca.SQLCode <> 0 Then
- ll_receivecuscommid = 0
- End If
-
- If ll_receivecuscommid = 0 Then
- arg_msg_err = arg_msg_err + '第'+String(ll_i)+'行,'+ls_commname+',找不到对应的企业编号,请检查' + '~r~n'
- Continue
- End If
-
- If uo_fieb.send_post(ll_sendcuscommid,'',ll_receivecuscommid,ls_commsccode,arg_s_post,arg_msg_tmp,True) = 0 Then
- arg_msg_err = arg_msg_err + '第'+String(ll_i)+'行,'+ls_commname+',推送公告失败,'+arg_msg_tmp + '~r~n'
- ll_fail++
- Continue
- End If
- ll_suc++
-
- Next
- //发送删除指令给修改删除的推送方
- If ins_postid > 0 Then
- ls_RelatedCode = String(ll_sendcuscommid) + '_' + String(ins_postid)
-
-
-
- For ll_i = 1 To dw_mx_ori.RowCount()
- For ll_j = 1 To dw_mx.RowCount()
- If dw_mx_ori.Object.commcode[ll_i] = dw_mx.Object.commcode[ll_j] And dw_mx_ori.Object.commsccode[ll_i] = dw_mx.Object.commsccode[ll_j] Then
- Goto _next
- End If
- Next
-
- ls_commcode = dw_mx_ori.Object.commcode[ll_i]
- ls_commsccode = dw_mx_ori.Object.commsccode[ll_i]
- ls_commname = dw_mx_ori.Object.commname[ll_i]
-
-
- Select TOP 1 NEWID() Into :ls_SerialNum
- From u_user Using sqlca;
- If sqlca.SQLCode <> 0 Then
- Rollback Using sqlca;
- MessageBox('Error', '第'+String(ll_i)+'行明细,生成序列号失败,'+sqlca.SQLErrText)
- Return
- End If
-
- Select CusCommID
- Into :ll_receivecuscommid
- From LJFIEB_CusComm
- Where cuscode = :ls_commcode Using tr_eb_sqlca;
- If tr_eb_sqlca.SQLCode <> 0 Then
- ll_receivecuscommid = 0
- End If
-
- If ll_receivecuscommid = 0 Then
- arg_msg_err = arg_msg_err + ls_commname+',找不到对应的企业编号,请检查' + '~r~n'
- Continue
- End If
-
- If uo_fieb.add_packet(ls_SerialNum,'',ll_sendcuscommid,'',ll_receivecuscommid,ls_commsccode,20,'','','','',ls_RelatedCode,0,arg_msg_tmp,True) = 0 Then
- arg_msg_err = arg_msg_err +ls_commname+',发送删除公告指令失败,'+arg_msg_tmp + '~r~n'
- ll_fail++
- Continue
- End If
-
- _next:
- Next
- End If
- MessageBox(publ_operator,'推送完成!成功:'+String(ll_suc)+',失败:'+String(ll_fail))
- If ll_fail > 0 Then
- OpenWithParm(w_message_err,arg_msg_err)
- Else
- Close(Parent)
- End If
- end event
- type dw_mx from u_dw_rbtnfilter within w_post_propel_edit_ljfieb
- integer x = 23
- integer y = 1004
- integer width = 2249
- integer height = 1148
- integer taborder = 20
- boolean bringtotop = true
- string dataobject = "dw_post_propel_mx_edit_ljfieb"
- boolean hscrollbar = true
- boolean vscrollbar = true
- end type
- event rowfocuschanged;call super::rowfocuschanged;IF currentrow > 0 THEN
- THIS.SelectRow(0,FALSE)
- THIS.SelectRow(currentrow,TRUE)
- END IF
- end event
- type cb_cus_ch from uo_imflatbutton within w_post_propel_edit_ljfieb
- integer x = 46
- integer y = 896
- integer taborder = 40
- boolean bringtotop = true
- string text = "选客户"
- string normalpicname = "mx1.BMP"
- integer picsize = 16
- end type
- event clicked;call super::clicked;Long uc_row,ls_j
- Long child_row,ll_receivecuscommid
- If Not IsValid(w_cust_comm_ch) Then
- s_edit_index_tran s_open //传递参数使用
- s_open.if_select_any = True
- s_open.b_string = ''
-
-
- This.Enabled = False
- OpenWithParm(w_cust_comm_ch,s_open)
- This.Enabled = True
-
- s_custom_arr s_inscust
- s_inscust = Message.PowerObjectParm //接受返回结构
-
- dw_mx.SetRedraw(False)
- For ls_j = 1 To UpperBound(s_inscust.cusid)
- If s_inscust.cusid[ls_j] > 0 Then //正常返回值则可以取以下值
-
- If dw_mx.Find("commcode ='" + s_inscust.commcode[ls_j]+"' and commsccode = '"+s_inscust.commsccode[ls_j]+"'", 1, dw_mx.RowCount()) > 0 Then Continue
-
- If dw_mx.GetRow() > 0 Then
- If dw_mx.Object.commname[dw_mx.GetRow()] <> '' Then
- child_row = dw_mx.InsertRow (0)
- Else
- child_row = dw_mx.GetRow()
- End If
- Else
- child_row = dw_mx.InsertRow (0)
- End If
-
- dw_mx.Object.Kind[child_row] = 0
- dw_mx.Object.commname[child_row] = s_inscust.Name[ls_j]
- dw_mx.Object.commcode[child_row] = s_inscust.commcode[ls_j]
- dw_mx.Object.commsccode[child_row] = s_inscust.commsccode[ls_j]
-
- End If
- Next
-
- dw_mx.SetRedraw(True)
- End If
- end event
- type cb_spt_ch from uo_imflatbutton within w_post_propel_edit_ljfieb
- integer x = 366
- integer y = 896
- integer width = 379
- integer taborder = 50
- boolean bringtotop = true
- string text = "选供应商"
- string normalpicname = "mx2.BMP"
- integer picsize = 16
- end type
- event clicked;call super::clicked;Long uc_row,ls_j
- Long child_row,ll_receivecuscommid
- If Not IsValid(w_spt_ecomm_ch) Then
- s_edit_index_tran s_open //传递参数使用
- s_open.if_select_any = True
- s_open.b_string = ''
-
-
- This.Enabled = False
- OpenWithParm(w_spt_ecomm_ch,s_open)
- This.Enabled = True
-
- s_custom_arr s_inscust
- s_inscust = Message.PowerObjectParm //接受返回结构
-
- dw_mx.SetRedraw(False)
- For ls_j = 1 To UpperBound(s_inscust.cusid)
- If s_inscust.cusid[ls_j] > 0 Then //正常返回值则可以取以下值
-
- If dw_mx.Find("commcode ='" + s_inscust.commcode[ls_j]+"' and commsccode = '"+s_inscust.commsccode[ls_j]+"'", 1, dw_mx.RowCount()) > 0 Then Continue
-
- If dw_mx.GetRow() > 0 Then
- If dw_mx.Object.commname[dw_mx.GetRow()] <> '' Then
- child_row = dw_mx.InsertRow (0)
- Else
- child_row = dw_mx.GetRow()
- End If
- Else
- child_row = dw_mx.InsertRow (0)
- End If
-
- dw_mx.Object.Kind[child_row] = 1
- dw_mx.Object.commname[child_row] = s_inscust.Name[ls_j]
- dw_mx.Object.commcode[child_row] = s_inscust.commcode[ls_j]
- dw_mx.Object.commsccode[child_row] = s_inscust.commsccode[ls_j]
-
- End If
- Next
-
- dw_mx.SetRedraw(True)
- End If
- end event
- type cb_delmx from uo_imflatbutton within w_post_propel_edit_ljfieb
- integer x = 782
- integer y = 896
- integer width = 379
- integer taborder = 50
- boolean bringtotop = true
- string text = "删除明细"
- string normalpicname = "DELETE.BMP"
- integer picsize = 16
- end type
- event clicked;call super::clicked;Long ll_row
- ll_row = dw_mx.GetRow()
- If ll_row <= 0 Then
- MessageBox('系统提示','请先选择要删除的行')
- Return
- End If
- If MessageBox('询问','是否确定要删除当前选中的推送对象?',question!,yesno!) = 2 Then Return
- dw_mx.DeleteRow (ll_row)
- If ll_row - 1 > 0 And ll_row - 1 <= dw_mx.RowCount() Then
- dw_mx.SelectRow(0,False)
- dw_mx.SelectRow(ll_row - 1,True)
- Else
- If dw_mx.RowCount() > 0 Then
- dw_mx.SelectRow(0,False)
- dw_mx.SelectRow(1,True)
- End If
- End If
- end event
- type dw_mx_ori from datawindow within w_post_propel_edit_ljfieb
- boolean visible = false
- integer x = 1280
- integer y = 936
- integer width = 686
- integer height = 400
- integer taborder = 60
- boolean bringtotop = true
- string title = "none"
- string dataobject = "dw_post_propel_mx_edit_ljfieb"
- boolean livescroll = true
- borderstyle borderstyle = stylelowered!
- end type
|