$PBExportHeader$w_shopcart_fx.srw $PBExportComments$协同 购物车 forward global type w_shopcart_fx from w_publ_base_style end type type dw_1 from datawindow within w_shopcart_fx end type type cb_retrieve from uo_imflatbutton within w_shopcart_fx end type type cb_to_spt_price from uo_imflatbutton within w_shopcart_fx end type type cb_to_buytask from uo_imflatbutton within w_shopcart_fx end type end forward global type w_shopcart_fx from w_publ_base_style integer width = 4887 integer height = 2616 string title = "我的购物车" boolean maxbox = true boolean resizable = true long backcolor = 16777215 dw_1 dw_1 cb_retrieve cb_retrieve cb_to_spt_price cb_to_spt_price cb_to_buytask cb_to_buytask end type global w_shopcart_fx w_shopcart_fx forward prototypes public subroutine wf_retrieve_shopcart () public subroutine wf_select_group (readonly long a_sptcomid) end prototypes public subroutine wf_retrieve_shopcart ();dw_1.Reset() oleobject parm, ret parm = FXAppCom.CreatePbDictionary() parm.SetString('token', app_token_fx) string arg_msg ret = FXAppCom.GetShopcart(parm, ref arg_msg) if (arg_msg <> '') then MessageBox('提示', '获取购物车操作失败:' + arg_msg) return end if oleobject list, item list = ret.GetArrOfPBDictionary('list') long i, comid, mtrlid string temp_picPath, exePath, temp_filetype exePath = GetCurrentDirectory() dw_1.SetRedraw(false) for i = 1 to list.Count item = list.GetItem(i - 1) comid = item.GetInt('sptcomid') mtrlid = item.GetInt('mtrlid_erp') temp_filetype = item.GetString('filetype') dw_1.Object.userid[i] = item.GetInt('userid') dw_1.Object.sptcomid[i] = comid dw_1.Object.mtrlid_erp[i] = mtrlid dw_1.Object.fxmtrlid[i] = item.GetInt('fxmtrlid') dw_1.Object.price_ori[i] = item.GetDouble('price_ori') dw_1.Object.opdate[i] = item.GetDateTime('opdate') dw_1.Object.qty[i] = item.GetDouble('qty') dw_1.Object.mtrlcode[i] = item.GetString('mtrlcode') dw_1.Object.mtrlname[i] = item.GetString('mtrlname') dw_1.Object.mtrlmode[i] = item.GetString('mtrlmode') dw_1.Object.mtrlsectype[i] = item.GetString('mtrlsectype') dw_1.Object.zxmtrlmode[i] = item.GetString('zxmtrlmode') dw_1.Object.usermtrlmode[i] = item.GetString('usermtrlmode') dw_1.Object.unit[i] = item.GetString('unit') dw_1.Object.comname[i] = item.GetString('comname') dw_1.Object.simplename[i] = item.GetString('simplename') dw_1.Object.filetype[i] = temp_filetype dw_1.Object.now_price[i] = i //now_price temp_picPath = exePath + '\cache\mtrlpic\c_' + string(comid) + '_m_' + string(mtrlid) + '.' + temp_filetype if FileExists(temp_picPath) then dw_1.Object.filepath[i] = temp_picPath else dw_1.Object.filepath[i] = exePath + '\graphics\mtrl_view.png' end if next dw_1.AcceptText() dw_1.SetRedraw(true) end subroutine public subroutine wf_select_group (readonly long a_sptcomid);// 根据sptcomid全选/全反选产品 long i long ch = 0 for i = 1 to dw_1.RowCount() if (dw_1.Object.sptcomid[i] <> a_sptcomid) then continue if (dw_1.Object.ch[i] = 0) then ch = 1 // 存在未选择的情况,则全选,否则全反选 exit end if next for i = 1 to dw_1.RowCount() if (dw_1.Object.sptcomid[i] <> a_sptcomid) then continue dw_1.Object.ch[i] = ch next end subroutine on w_shopcart_fx.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_retrieve=create cb_retrieve this.cb_to_spt_price=create cb_to_spt_price this.cb_to_buytask=create cb_to_buytask iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_retrieve this.Control[iCurrent+3]=this.cb_to_spt_price this.Control[iCurrent+4]=this.cb_to_buytask end on on w_shopcart_fx.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_retrieve) destroy(this.cb_to_spt_price) destroy(this.cb_to_buytask) end on event open;call super::open;string arg_msg if (f_find_fx_user_power(41, ref arg_msg) <> 1 & and f_find_fx_user_power(51, ref arg_msg) <> 1) then // 51-购物车转询价单(新建询价单) 41-供应商询价单新建 cb_to_spt_price.Enabled = false end if if (f_find_fx_user_power(56, ref arg_msg) <> 1 & and f_find_fx_user_power(52, ref arg_msg) <> 1) then // 52-购物车转采购订单(新建采购订单) 56-采购订单新建 cb_to_buytask.Enabled = false end if wf_retrieve_shopcart() end event event resize;call super::resize;if this.width < 4320 then this.Width = 4320 if this.Height < 2680 then this.Height = 2680 dw_1.Width = this.workspacewidth( ) dw_1.Height = this.workspaceheight( ) - dw_1.Y dw_1.Modify('b_add.X = ' + string(this.workspacewidth( ) - (3662 - 3589) - 100)) dw_1.Modify('qty.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100)) dw_1.Modify('b_minus.X = ' + string(this.workspacewidth( ) - (3662 - 3214) - 100)) dw_1.Modify('fx_shopcart_qty_t.X = ' + string(this.workspacewidth( ) - (3662 - 3355) - 100)) dw_1.Modify('t_2.X = ' + string(this.workspacewidth( ) - (3662 - 3374) - 100)) dw_1.Modify('compute_price.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100)) dw_1.Modify('t_4.X = ' + string(this.workspacewidth( ) - (3662 - 3177) - 100)) dw_1.Modify('compute_6.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100)) cb_exit.X = this.workspacewidth( ) - cb_exit.Width end event type cb_func from w_publ_base_style`cb_func within w_shopcart_fx boolean visible = false integer x = 110 integer y = 2228 boolean enabled = false end type type cb_exit from w_publ_base_style`cb_exit within w_shopcart_fx integer x = 2427 end type type ln_bar from w_publ_base_style`ln_bar within w_shopcart_fx end type type ln_bar2 from w_publ_base_style`ln_bar2 within w_shopcart_fx end type type r_bar from w_publ_base_style`r_bar within w_shopcart_fx end type type dw_1 from datawindow within w_shopcart_fx integer y = 168 integer width = 4553 integer height = 1856 integer taborder = 20 boolean bringtotop = true string title = "none" string dataobject = "dw_fx_shopcart" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event scrollhorizontal;this.object.DataWindow.HorizontalScrollPosition = 0 end event event clicked;long qty, comid if (row > 0) then this.SetRow(row) qty = this.Object.qty[row] comid = this.Object.sptcomid[row] if (dwo.Name = 'b_minus' and qty > 1) then this.Object.qty[row] = qty - 1 elseif (dwo.Name = 'b_add') then this.Object.qty[row] = qty + 1 elseif (dwo.Name = 'b_ch') then wf_select_group(comid) end if end if end event type cb_retrieve from uo_imflatbutton within w_shopcart_fx integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "刷新" string normalpicname = "refresh.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;wf_retrieve_shopcart() end event type cb_to_spt_price from uo_imflatbutton within w_shopcart_fx integer x = 151 integer width = 279 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "转询价单" boolean border = false end type event clicked;call super::clicked;if (dw_1.RowCount() <= 0) then return long i, sptcomid, row row = dw_1.Find('ch = 1', 1, dw_1.RowCount()) if (row > 0) then sptcomid = dw_1.Object.sptcomid[row] else MessageBox('提示', '请勾选需要转为询价单的产品') return end if oleobject item, list list = FXAppCom.CreArrOfPbDictionary() for i = 1 to dw_1.RowCount() if (dw_1.Object.ch[i] = 0) then continue if (dw_1.Object.sptcomid[i] <> sptcomid) then MessageBox('提示', '请勾选同一个供应商的产品') return end if item = FXAppCom.CreatePbDictionary() item.SetInt('mtrlid_erp', dw_1.Object.mtrlid_erp[i]) item.SetDouble('qty_min', dw_1.Object.qty[i]) item.SetDouble('qty_max', dw_1.Object.qty[i]) item.SetString('unit', dw_1.Object.unit[i]) list.Add(item) next oleobject parm, retParm parm = FXAppCom.CreatePbDictionary() parm.SetString('token', app_token_fx) parm.SetObject('list', list) parm.SetInt('sptcomid', sptcomid) string arg_msg retParm = FxAppCom.ShopcartToSptPrice(parm, ref arg_msg) if (arg_msg <> '') then MessageBox('提示', '转询价单操作失败:' + arg_msg) return end if string billcode billcode = retParm.GetString('billcode') MessageBox('提示', '操作成功,新的询价单单号为:[' + billcode + ']') if (IsValid(s_win_open[4].win)) then // 4-供应商询价单 Close(s_win_open[4].win) end if Open(w_spt_price_change_fx) end event type cb_to_buytask from uo_imflatbutton within w_shopcart_fx integer x = 430 integer width = 320 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "转采购订单" boolean border = false end type event clicked;call super::clicked;if (dw_1.RowCount() <= 0) then return long i, sptcomid, row row = dw_1.Find('ch = 1', 1, dw_1.RowCount()) if (row > 0) then sptcomid = dw_1.Object.sptcomid[row] else MessageBox('提示', '请勾选需要转为询价单的产品') return end if oleobject item, list list = FXAppCom.CreArrOfPbDictionary() for i = 1 to dw_1.RowCount() if (dw_1.Object.ch[i] = 0) then continue if (dw_1.Object.sptcomid[i] <> sptcomid) then MessageBox('提示', '请勾选同一个供应商的产品') return end if item = FXAppCom.CreatePbDictionary() item.SetInt('fxmtrlid', dw_1.Object.fxmtrlid[i]) item.SetDouble('qty', dw_1.Object.qty[i]) list.Add(item) next oleobject parm, retParm parm = FXAppCom.CreatePbDictionary() parm.SetString('token', app_token_fx) parm.SetObject('list', list) parm.SetInt('sptcomid', sptcomid) string arg_msg retParm = FxAppCom.ShopcartToBuytask(parm, ref arg_msg) if (arg_msg <> '') then MessageBox('提示', '转采购订单操作失败:' + arg_msg) return end if string tid tid = retParm.GetString('tid') MessageBox('提示', '操作成功,新的采购订单单号为:[' + tid + ']') if (IsValid(s_win_open[53].win)) then // 53-采购订单 Close(s_win_open[53].win) end if Open(w_buytask_fx) end event