123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- $PBExportHeader$w_outware_fx.srw
- $PBExportComments$分销系统--销售订单发货
- forward
- global type w_outware_fx from w_publ_base_style
- end type
- type dw_1 from u_dw_rbtnfilter within w_outware_fx
- end type
- type st_1 from statictext within w_outware_fx
- end type
- type sle_1 from singlelineedit within w_outware_fx
- end type
- type st_2 from statictext within w_outware_fx
- end type
- type cb_1 from commandbutton within w_outware_fx
- end type
- end forward
- global type w_outware_fx from w_publ_base_style
- integer y = 388
- integer width = 3562
- integer height = 1677
- string title = "发货明细"
- boolean minbox = false
- windowtype windowtype = response!
- long backcolor = 16777215
- string icon = "graphics\chain_link_128px.ico"
- boolean center = true
- dw_1 dw_1
- st_1 st_1
- sle_1 sle_1
- st_2 st_2
- cb_1 cb_1
- end type
- global w_outware_fx w_outware_fx
- type variables
- int ins_rslt = 0 // 0 - 无操作返回 1 - 操作成功返回
- end variables
- forward prototypes
- public function integer wf_retrieve (readonly datastore arg_ds)
- public function integer wf_sendoutware (ref string arg_msg)
- end prototypes
- public function integer wf_retrieve (readonly datastore arg_ds);int rslt = 1
- dw_1.ReSet()
- dw_1.SetRedraw(false)
- long row, i
- Datetime ld_now
- ld_now = DateTime(Today(),Now())
- for i = 1 to arg_ds.RowCount()
- if (arg_ds.Object.qty[i] <= arg_ds.Object.cus_receiveqty[i] + arg_ds.Object.qty_wait[i]) then continue // '齐货' 跳过
-
- row = dw_1.InsertRow(0)
- dw_1.Object.taskid[row] = arg_ds.Object.taskid[i]
- dw_1.Object.printid[row] = arg_ds.Object.printid[i]
- dw_1.Object.mxcode[row] = arg_ds.Object.mxcode[i]
- dw_1.Object.fxmtrlid[row] = arg_ds.Object.fxmtrlid[i]
- dw_1.Object.mtrlid[row] = arg_ds.Object.mtrlid[i]
- dw_1.Object.mtrlcode[row] = arg_ds.Object.mtrlcode[i]
- dw_1.Object.mtrlname[row] = arg_ds.Object.mtrlname[i]
- dw_1.Object.mtrlmode[row] = arg_ds.Object.mtrlmode[i]
- dw_1.Object.status[row] = arg_ds.Object.status[i]
- dw_1.Object.woodcode[row] = arg_ds.Object.woodcode[i]
- dw_1.Object.pcode[row] = arg_ds.Object.pcode[i]
- dw_1.Object.qty[row] = arg_ds.Object.qty[i]
- dw_1.Object.qty_wait[row] = arg_ds.Object.qty_wait[i]
- dw_1.Object.cus_receiveqty[row] = arg_ds.Object.cus_receiveqty[i]
- IF arg_ds.Object.earliestsenddate[i] > ld_now THEN
- dw_1.Object.outqty[row] = 0
- ELSE
- dw_1.Object.outqty[row] = arg_ds.Object.qty[i] - arg_ds.Object.cus_receiveqty[i] - arg_ds.Object.qty_wait[i]
- END IF
-
- dw_1.Object.outwarecode[row] = ''
- dw_1.Object.requiredate[row] = arg_ds.Object.requiredate[i]
- // dw_1.Object.price[row] = arg_ds.Object.price[i]
- dw_1.Object.mxdscrp[row] = arg_ds.Object.mxdscrp[i]
- dw_1.Object.mxdscrp2[row] = arg_ds.Object.mxdscrp2[i]
- dw_1.Object.mtrlcuscode[row] = arg_ds.Object.mtrlcuscode[i]
- dw_1.Object.plancode[row] = arg_ds.Object.plancode[i]
- dw_1.Object.cus_mtrldef_senddays[row] = arg_ds.Object.cus_mtrldef_senddays[i]
- dw_1.Object.earliestsenddate[row] = arg_ds.Object.earliestsenddate[i]
- next
- dw_1.SetRedraw(true)
- return rslt
- end function
- public function integer wf_sendoutware (ref string arg_msg);int rslt = 1
- if (dw_1.RowCount() <= 0) then
- rslt = 0
- arg_msg = '没有发货明细'
- goto ext
- end if
- oleobject item, list
- list = FXAppCom.CreArrOfPbDictionary()
- long i, cnt = 0
- DateTime ld_now
- ld_now = DateTime(Today(),Now())
- for i = 1 to dw_1.RowCount()
- if (dw_1.Object.earliestsenddate[i] > ld_now) then dw_1.Object.outqty[i] = 0
- if (dw_1.Object.outqty[i] <= 0) then continue
-
- cnt ++
- item = FXAppCom.CreatePbDictionary()
- item.SetInt('taskid', dw_1.Object.taskid[i])
- item.SetInt('printid', dw_1.Object.printid[i])
- item.SetDouble('qty', dw_1.Object.outqty[i])
- item.SetString('mxcode', dw_1.Object.outwarecode[i]) // 暂时存放相关发货单号(非明细编号)
- item.SetInt('mtrlid', dw_1.Object.mtrlid[i])
-
- list.Add(item)
- next
- if (cnt <= 0) then
- rslt = 0
- arg_msg = '没有发货数大于0的明细'
- goto ext
- end if
- Open(w_packet_msg_edit_fx)
- s_open_packet s_tran
- s_tran = Message.PowerObjectParm
- if (s_tran.returnflag = 0) then
- rslt = 0
- arg_msg = '操作取消'
- goto ext
- end if
- string postscript
- postscript = s_tran.postscript
- FXAppCom.SendOutwareMx(app_token_fx, postscript, list, ref arg_msg)
- if (arg_msg <> '') then
- rslt = 0
- goto ext
- end if
- ext:
- return rslt
- end function
- on w_outware_fx.create
- int iCurrent
- call super::create
- this.dw_1=create dw_1
- this.st_1=create st_1
- this.sle_1=create sle_1
- this.st_2=create st_2
- this.cb_1=create cb_1
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.dw_1
- this.Control[iCurrent+2]=this.st_1
- this.Control[iCurrent+3]=this.sle_1
- this.Control[iCurrent+4]=this.st_2
- this.Control[iCurrent+5]=this.cb_1
- end on
- on w_outware_fx.destroy
- call super::destroy
- destroy(this.dw_1)
- destroy(this.st_1)
- destroy(this.sle_1)
- destroy(this.st_2)
- destroy(this.cb_1)
- end on
- event open;call super::open;datastore ds
- ds = Message.PowerObjectParm
- if (IsNull(ds)) then
- MessageBox('提示', '打开方式有误')
- Close(this)
- return
- elseif (ds.DataObject <> 'dw_fx_saletaskmx') then
- MessageBox('提示', '传递数据有误')
- Close(this)
- return
- end if
- string arg_msg
- if (f_find_fx_user_power(31, ref arg_msg) <> 1) then // 31-销售订单发货
- MessageBox('权限提示', arg_msg)
- Close(this)
- return
- end if
- wf_retrieve(ds)
- end event
- event close;call super::close;CloseWithReturn(this, ins_rslt)
- end event
- event resize;call super::resize;dw_1.Width = this.workspacewidth( )
- dw_1.Height = this.workspaceheight( ) - dw_1.Y
- cb_exit.X = this.workspacewidth( ) - cb_exit.Width
- end event
- type cb_func from w_publ_base_style`cb_func within w_outware_fx
- integer width = 274
- string text = "确认发货"
- string normalpicname = "ok.bmp"
- integer picsize = 16
- end type
- event cb_func::clicked;call super::clicked;if (dw_1.RowCount() <= 0) then
- MessageBox('提示', '没有发货明细')
- return
- end if
- dw_1.AcceptText()
- boolean pass = true
- string sum_msg
- long i
- DateTime ld_now
- ld_now = DateTime(Today(),Now())
- for i = 1 to dw_1.RowCount()
- if (Trim(dw_1.Object.outwarecode[i]) = '') then
- sum_msg += '第' + string(i) + '行,相关发货单号为空(可选填)~r~n'
- end if
- IF (dw_1.Object.outqty[i] = 0) THEN
- IF dw_1.Object.earliestsenddate[i] > ld_now THEN
- sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],当前时间未到最早发货时间,将跳过本次发货~r~n'
- END IF
- ELSEIF (dw_1.Object.outqty[i] = 0) then
- sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],本次发货数为0~r~n'
- elseif (dw_1.Object.outqty[i] < 0) then
- sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],发货数必须大于0~r~n'
- pass = false
- end if
-
- if (dw_1.Object.outqty[i] + dw_1.Object.cus_receiveqty[i] + dw_1.Object.qty_wait[i] > dw_1.Object.qty[i]) then
- sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],总发货数大于订单下单数~r~n'
- pass = false
- end if
- next
- if (not pass) then
- MessageBox('提示', sum_msg)
- return
- end if
- int ret = 1
- if (sum_msg <> '') then
- ret = MessageBox('提示', sum_msg + '确定继续?', Question!, YesNoCancel!)
- end if
- if (ret <> 1) then return
- string arg_msg
- ret = wf_sendoutware(ref arg_msg)
- if (ret = 0) then
- MessageBox('提示', '发货操作失败:' + arg_msg)
- else
- ins_rslt = 1
- MessageBox('提示', '操作成功!')
- Close(parent)
- end if
- end event
- type cb_exit from w_publ_base_style`cb_exit within w_outware_fx
- integer x = 2754
- end type
- type ln_bar from w_publ_base_style`ln_bar within w_outware_fx
- end type
- type ln_bar2 from w_publ_base_style`ln_bar2 within w_outware_fx
- end type
- type r_bar from w_publ_base_style`r_bar within w_outware_fx
- end type
- type dw_1 from u_dw_rbtnfilter within w_outware_fx
- integer y = 272
- integer width = 3350
- integer height = 1267
- integer taborder = 20
- boolean bringtotop = true
- string dataobject = "dw_fx_outware"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean hsplitscroll = true
- boolean rbutton_setposition_use = true
- boolean titleclick_sort_use = true
- end type
- event clicked;call super::clicked;if (row <= 0) then return
- this.SelectRow(0, false)
- this.SelectRow(row, true)
- end event
- event itemfocuschanged;call super::itemfocuschanged;if (row > 0) then
- this.SelectRow(0, false)
- this.SelectRow(row, true)
- this.SetRow(row)
-
- string colName
- colName = this.GetColumnName()
- if (colName = 'outqty' or colName = 'outwarecode') then
- this.SelectText(1, Len(this.GetText()))
- end if
- end if
- end event
- type st_1 from statictext within w_outware_fx
- integer y = 195
- integer width = 508
- integer height = 48
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 16777215
- string text = "相关发货单号批设置"
- boolean focusrectangle = false
- end type
- type sle_1 from singlelineedit within w_outware_fx
- integer x = 512
- integer y = 179
- integer width = 614
- integer height = 83
- integer taborder = 20
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- event modified;if (dw_1.RowCount() <= 0) then return
- long i
- for i = 1 to dw_1.RowCount()
- dw_1.Object.outwarecode[i] = this.Text
- next
- this.Text = ''
- end event
- type st_2 from statictext within w_outware_fx
- integer x = 1148
- integer y = 195
- integer width = 315
- integer height = 48
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 16777215
- string text = "(回车执行)"
- boolean focusrectangle = false
- end type
- type cb_1 from commandbutton within w_outware_fx
- boolean visible = false
- integer x = 1434
- integer y = 179
- integer width = 439
- integer height = 83
- integer taborder = 30
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "获取新发货单号"
- end type
- event clicked;oleobject request, response
- string arg_msg
- request = FXAppCom.CreatePbDictionary()
- request.SetString('token', app_token_fx)
- request.SetString('prefix', '#')
- request.SetString('suffix', 'FH')
- response = FXAppCom.DoExecute('GetBillCode', request)
- arg_msg = response.GetString('ErrMsg')
- if arg_msg <> '' then
- MessageBox('ERROR', arg_msg)
- return
- end if
- oleobject list
- list = response.GetPBArray('billcodeList')
- long cnt
- cnt = list.Count
- if cnt < 0 then
- MessageBox('ERROR', '单号列表为空')
- return
- end if
- sle_1.Text = list.GetString(0)
- end event
|