123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- $PBExportHeader$uo_fx_pz.sru
- $PBExportComments$协同系统 物料配置 UO (用于选择物料配置)
- forward
- global type uo_fx_pz from nonvisualobject
- end type
- end forward
- global type uo_fx_pz from nonvisualobject
- end type
- global uo_fx_pz uo_fx_pz
- type variables
- long ins_comid // 协同企业ID(供应商 物料所在的企业)
- boolean ins_isReady = false // 当全部获取了10个(7个)配置表的时候,ins_isReady = true
- datastore ins_ds_color, ins_ds_color_w, ins_ds_color_p
- datastore ins_ds_pztype_def, ins_ds_pztype_mx
- datastore ins_ds_configure_type, ins_ds_configure_code, ins_ds_configure_codemx
- datastore ins_ds_configure, ins_ds_configure2
- end variables
- forward prototypes
- public function integer init ()
- public function integer uof_before_ready (ref string arg_msg)
- public function integer uof_get_ready (ref string arg_msg)
- public function string uof_open_pzwin (s_fx_pzwin_open arg_s, ref string arg_msg)
- end prototypes
- public function integer init ();// 初始化
- int rslt = 1
- ins_comid = 0
- ins_isReady = false
- ins_ds_color = create datastore
- ins_ds_color.DataObject = 'ds_fx_color'
- ins_ds_color.Reset()
- ins_ds_color_w = create datastore
- ins_ds_color_w.DataObject = 'ds_fx_color_wood'
- ins_ds_color_w.Reset()
- ins_ds_color_p = create datastore
- ins_ds_color_p.DataObject = 'ds_fx_color_pcode'
- ins_ds_color_p.Reset()
- //ins_ds_pztype_def = create datastore
- //ins_ds_pztype_def.DataObject = 'ds_fx_pztype_def'
- //ins_ds_pztype_def.Reset()
- ins_ds_pztype_mx = create datastore
- ins_ds_pztype_mx.DataObject = 'ds_fx_pztype_mx'
- ins_ds_pztype_mx.Reset()
- //ins_ds_configure_type = create datastore
- //ins_ds_configure_type.DataObject = 'ds_fx_configure_type'
- //ins_ds_configure_type.Reset()
- ins_ds_configure_code = create datastore
- ins_ds_configure_code.DataObject = 'ds_fx_configure_code'
- ins_ds_configure_code.Reset()
- ins_ds_configure_codemx = create datastore
- ins_ds_configure_codemx.DataObject = 'ds_fx_configure_codemx'
- ins_ds_configure_codemx.Reset()
- ins_ds_configure = create datastore
- ins_ds_configure.DataObject = 'ds_fx_mtrl_configure'
- ins_ds_configure.Reset()
- //ins_ds_configure2 = create datastore
- //ins_ds_configure2.DataObject = 'ds_fx_mtrl_configure2'
- //ins_ds_configure2.Reset()
- return rslt
- end function
- public function integer uof_before_ready (ref string arg_msg);// 异步获取供应商全部配置
- int rslt = 1
- if (ins_comid <= 0) then
- rslt = 0
- arg_msg = 'uo_fx_pz供应商参数有误,请联系开发人员'
- goto ext
- end if
- // 异步
- FXAppCom.GetpzByComidAsync(app_token_fx, ins_comid, -1, ref arg_msg) // [-1]获取10个表(7个表)
- if (arg_msg <> '') then
- rslt = 0
- goto ext
- end if
- ext:
- return rslt
- end function
- public function integer uof_get_ready (ref string arg_msg);// 下载配置
- int rslt = 1
- // 若提示找不到GetpzByComid
- // 请注意是否按照uo_pz.init()、uo_pz.ins_comid、uo_pz.uof_before_ready的顺序来调用
- // 对应的DW应该要有statusflag、statustype等共6个配置变量
- oleobject obj
- obj = FXAppCom.GetpzByComid(ref arg_msg)
- if (arg_msg <> '') then
- rslt = 0
- goto ext
- end if
- //arg_msg = obj.GetString('argmsg')
- //if not IsNull(arg_msg) then
- // if (arg_msg <> '') then
- // rslt = 0
- // goto ext
- // end if
- //end if
- oleobject colors, colorWoods, colorPcodes
- oleobject pztypeMxs
- oleobject mtrlConfigs
- oleobject configCodes, configCodeMxs
- colors = obj.GetArrOfPBDictionary('colors')
- colorWoods = obj.GetArrOfPBDictionary('colorWoods')
- colorPcodes = obj.GetArrOfPBDictionary('colorPcodes')
- pztypeMxs = obj.GetArrOfPBDictionary('pztypeMxs')
- mtrlConfigs = obj.GetArrOfPBDictionary('mtrlConfigs')
- configCodes = obj.GetArrOfPBDictionary('configCodes')
- configCodeMxs = obj.GetArrOfPBDictionary('configCodeMxs')
- long i
- oleobject item
- ins_ds_color.Reset()
- if not IsNull(colors) then
- for i = 1 to colors.Count
- item = colors.GetItem(i - 1)
-
- ins_ds_color.Object.comid[i] = item.GetInt('comid')
- ins_ds_color.Object.colorid_erp[i] = item.GetInt('colorid_erp')
- ins_ds_color.Object.colorname[i] = item.GetString('colorname')
- ins_ds_color.Object.printid[i] = item.GetString('printid')
- next
- end if
- ins_ds_color_w.Reset()
- if not IsNull(colorWoods) then
- for i = 1 to colorWoods.Count
- item = colorWoods.GetItem(i - 1)
-
- ins_ds_color_w.Object.comid[i] = item.GetInt('comid')
- ins_ds_color_w.Object.woodcodeid_erp[i] = item.GetInt('woodcodeid_erp')
- ins_ds_color_w.Object.woodcode[i] = item.GetString('woodcode')
- ins_ds_color_w.Object.printid[i] = item.GetString('printid')
- next
- end if
- ins_ds_color_p.Reset()
- if not IsNull(colorPcodes) then
- for i = 1 to colorPcodes.Count
- item = colorPcodes.GetItem(i - 1)
-
- ins_ds_color_p.Object.comid[i] = item.GetInt('comid')
- ins_ds_color_p.Object.pcodeid_erp[i] = item.GetInt('pcodeid_erp')
- ins_ds_color_p.Object.pcode[i] = item.GetString('pcode')
- ins_ds_color_p.Object.printid[i] = item.GetString('printid')
- next
- end if
- ins_ds_pztype_mx.Reset()
- if not IsNull(pztypeMxs) then
- for i = 1 to pztypeMxs.Count
- item = pztypeMxs.GetItem(i - 1)
-
- ins_ds_pztype_mx.Object.comid[i] = item.GetInt('comid')
- ins_ds_pztype_mx.Object.typeid_erp[i] = item.GetInt('typeid_erp')
- ins_ds_pztype_mx.Object.pztype[i] = item.GetInt('pztype')
- ins_ds_pztype_mx.Object.dscrp[i] = item.GetString('dscrp')
- ins_ds_pztype_mx.Object.tdscrp[i] = item.GetString('tdscrp')
- next
- end if
- ins_ds_configure.Reset()
- if not IsNull(mtrlConfigs) then
- for i = 1 to mtrlConfigs.Count
- item = mtrlConfigs.GetItem(i - 1)
-
- ins_ds_configure.Object.comid[i] = item.GetInt('comid')
- ins_ds_configure.Object.cid_erp[i] = item.GetInt('cid_erp')
- ins_ds_configure.Object.Mtrlid_erp[i] = item.GetInt('Mtrlid_erp')
- ins_ds_configure.Object.code[i] = item.GetString('code')
- ins_ds_configure.Object.name[i] = item.GetString('name')
- ins_ds_configure.Object.ename[i] = item.GetString('ename')
- ins_ds_configure.Object.type[i] = item.GetInt('type')
- ins_ds_configure.Object.dscrp[i] = item.GetString('dscrp')
- ins_ds_configure.Object.Planprice[i] = item.GetDouble('Planprice')
- ins_ds_configure.Object.price[i] = item.GetDouble('price')
- ins_ds_configure.Object.DefaultPZ[i] = item.GetInt('DefaultPZ')
- ins_ds_configure.Object.ifzj[i] = item.GetInt('ifzj')
- ins_ds_configure.Object.capacity[i] = item.GetDouble('capacity')
- ins_ds_configure.Object.capaparm[i] = item.GetDouble('capaparm')
- ins_ds_configure.Object.net_weight[i] = item.GetDouble('net_weight')
- ins_ds_configure.Object.gross_weight[i] = item.GetDouble('gross_weight')
- ins_ds_configure.Object.cubage[i] = item.GetDouble('cubage')
- next
- end if
- ins_ds_configure_code.Reset()
- if not IsNull(configCodes) then
- for i = 1 to configCodes.Count
- item = configCodes.GetItem(i - 1)
-
- ins_ds_configure_code.Object.comid[i] = item.GetInt('comid')
- ins_ds_configure_code.Object.typeid_erp[i] = item.GetInt('typeid_erp')
- ins_ds_configure_code.Object.pzid_erp[i] = item.GetInt('pzid_erp')
- ins_ds_configure_code.Object.pzcode[i] = item.GetString('pzcode')
- ins_ds_configure_code.Object.name[i] = item.GetString('name')
- ins_ds_configure_code.Object.inputtype[i] = item.GetInt('inputtype')
- ins_ds_configure_code.Object.configtype[i] = item.GetInt('configtype')
- next
- end if
- ins_ds_configure_codemx.Reset()
- if not IsNull(configCodeMxs) then
- for i = 1 to configCodeMxs.Count
- item = configCodeMxs.GetItem(i - 1)
-
- ins_ds_configure_codemx.Object.comid[i] = item.GetInt('comid')
- ins_ds_configure_codemx.Object.pzid_erp[i] = item.GetInt('pzid_erp')
- ins_ds_configure_codemx.Object.printid[i] = item.GetInt('printid')
- ins_ds_configure_codemx.Object.pzcodemx[i] = item.GetString('pzcodemx')
- ins_ds_configure_codemx.Object.namemx[i] = item.GetString('namemx')
- next
- end if
- ins_isReady = true
- ext:
- return rslt
- end function
- public function string uof_open_pzwin (s_fx_pzwin_open arg_s, ref string arg_msg);
- arg_msg = ''
- string ret = ''
- if (not ins_isReady) then
- arg_msg = '未获取供应商物料配置,请联系开发人员'
- goto ext
- end if
- if IsNull(arg_s.arg_mtrlid) then arg_s.arg_mtrlid = 0 // 协同物料ID
- if IsNull(arg_s.arg_mtrlid_erp) then arg_s.arg_mtrlid_erp = 0
- if IsNull(arg_s.arg_statusflag) then arg_s.arg_statusflag = 0
- if IsNull(arg_s.arg_statustype) then arg_s.arg_statustype = 0
- if IsNull(arg_s.arg_woodcodeflag) then arg_s.arg_woodcodeflag = 0
- if IsNull(arg_s.arg_woodcodetype) then arg_s.arg_woodcodetype = 0
- if IsNull(arg_s.arg_pcodeflag) then arg_s.arg_pcodeflag = 0
- if IsNull(arg_s.arg_pcodetype) then arg_s.arg_pcodetype = 0
- if IsNull(arg_s.arg_colname) then arg_s.arg_colname = ''
- if IsNull(arg_s.arg_x) then arg_s.arg_x = 0
- if IsNull(arg_s.arg_y) then arg_s.arg_y = 0
- if (arg_s.arg_mtrlid <= 0 or arg_s.arg_mtrlid_erp <= 0) then
- arg_msg = '物料ID参数有误,无法打开配置窗口,请联系开发人员'
- goto ext
- end if
- if (arg_s.arg_colname = '') then
- arg_msg = '配置列名参数有误,无法打开配置窗口,请联系开发人员'
- goto ext
- end if
- if (Pos(arg_s.arg_colname, 'status') > 0) then
- choose case arg_s.arg_statusflag
- case 0
- arg_s.arg_ds = ins_ds_color
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 1
- arg_s.arg_ds = ins_ds_pztype_mx
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 2
- arg_s.arg_ds = ins_ds_configure
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 3
- ret = ''
- case 4
- arg_s.arg_ds = ins_ds_configure_code
- arg_s.arg_dsmx = ins_ds_configure_codemx
- OpenWithParm(w_pz_ch_configcode_fx, arg_s)
- ret = Message.StringParm
- case 5
- ret = ''
- case 6
- ret = ''
- case else
- ret = ''
- end choose
- elseif (Pos(arg_s.arg_colname, 'woodcode') > 0) then
- choose case arg_s.arg_woodcodeflag
- case 0
- arg_s.arg_ds = ins_ds_color_w
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 1
- arg_s.arg_ds = ins_ds_pztype_mx
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 4
- arg_s.arg_ds = ins_ds_configure_code
- arg_s.arg_dsmx = ins_ds_configure_codemx
- OpenWithParm(w_pz_ch_configcode_fx, arg_s)
- ret = Message.StringParm
- case 5
- ret = ''
- case else
- ret = ''
- end choose
- elseif (Pos(arg_s.arg_colname, 'pcode') > 0) then
- choose case arg_s.arg_pcodeflag
- case 0
- arg_s.arg_ds = ins_ds_color_p
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 1
- arg_s.arg_ds = ins_ds_pztype_mx
- OpenWithParm(w_pz_ch_fx, arg_s)
- ret = Message.StringParm
- case 4
- arg_s.arg_ds = ins_ds_configure_code
- arg_s.arg_dsmx = ins_ds_configure_codemx
- OpenWithParm(w_pz_ch_configcode_fx, arg_s)
- ret = Message.StringParm
- case 5
- ret = ''
- case else
- ret = ''
- end choose
- else
- ret = ''
- end if
- ext:
- return ret
- end function
- on uo_fx_pz.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_fx_pz.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event constructor;init()
- end event
- event destructor;destroy ins_ds_color
- destroy ins_ds_color_w
- destroy ins_ds_color_p
- destroy ins_ds_pztype_def
- destroy ins_ds_pztype_mx
- destroy ins_ds_configure_type
- destroy ins_ds_configure_code
- destroy ins_ds_configure_codemx
- destroy ins_ds_configure
- destroy ins_ds_configure2
- end event
|