123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- $PBExportHeader$uo_taobao_outware.sru
- forward
- global type uo_taobao_outware from nonvisualobject
- end type
- end forward
- global type uo_taobao_outware from nonvisualobject
- end type
- global uo_taobao_outware uo_taobao_outware
- forward prototypes
- public function integer add_tranfy (long arg_scid, long arg_outwareid, long arg_itemid, decimal arg_amt, ref string arg_msg, boolean arg_if_commit)
- public function integer save_transcode (string arg_outwarecode, string arg_relstr_1, string arg_transcode, decimal arg_weight, ref string arg_msg, boolean arg_ifcommit)
- public function integer save_transcode (string arg_outwarecode, string arg_relstr_1, string arg_transcode, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- public function integer add_tranfy (long arg_scid, long arg_outwareid, long arg_itemid, decimal arg_amt, ref string arg_msg, boolean arg_if_commit);Int rslt = 1
- UPDATE u_outware SET
- transcode = transcode
- WHERE scid = :arg_scid
- And outwareid = :arg_outwareid;
- // 加锁,避免其他人修改单据
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '对销售发货单加锁失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- IF sqlca.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = '对应销售发货单已经被删除'
- GOTO ext
- END IF
- Long secflag
- SELECT secflag
- INTO :secflag
- FROM u_outware
- WHERE scid = :arg_scid
- And outwareid = :arg_outwareid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询销售发货单财审状态失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- IF secflag = 1 THEN
- rslt = 0
- arg_msg = '销售发货单已经财审,不能录入运费'
- GOTO ext
- END IF
- Long ll_dfttype
- SELECT dfttype
- INTO :ll_dfttype
- FROM u_itemdef
- Where itemid = :arg_itemid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询收支项目类型失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- IF ll_dfttype <> 15 THEN
- rslt = 0
- arg_msg = '收支项目类型不是默认淘宝运费'
- GOTO ext
- END IF
- //Long ll_cnt
- //SELECT COUNT(0)
- // INTO :ll_cnt
- // FROM u_outware_itemmx INNER JOIN
- // u_itemdef ON u_outware_itemmx.itemid = u_itemdef.itemid
- // Where (u_itemdef.dfttype = 15);
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arg_msg = '查询现有运费失败,' + sqlca.SQLErrText
- // GOTO ext
- //END IF
- //IF ll_cnt > 1 THEN
- //
- //ELSEIF ll_cnt = 1 THEN
- //
- //ELSE
- //
- //END IF
- DELETE FROM u_outware_itemmx
- FROM u_outware_itemmx INNER JOIN
- u_itemdef ON u_outware_itemmx.itemid = u_itemdef.itemid
- WHERE (u_itemdef.dfttype = 15)
- AND (u_outware_itemmx.scid = :arg_scid)
- And (u_outware_itemmx.outwareid = :arg_outwareid);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除旧运费失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- Long printid
- SELECT isnull(max(printid), 0)
- INTO :printid
- FROM u_outware_itemmx
- WHERE scid = :arg_scid
- And outwareid = :arg_outwareid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '获取费用明细序号失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- printid ++
- INSERT INTO u_outware_itemmx(scid, outwareid, printid, itemid, amt)
- Values(:arg_scid, :arg_outwareid, :printid, :arg_itemid, :arg_amt);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '添加费用明细失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- UPDATE u_outware_itemmx
- SET IsCusAmt = 0
- WHERE scid = :arg_scid
- AND outwareid = :arg_outwareid
- And printid = :printid;
- ext:
- IF arg_if_commit THEN
- IF rslt = 1 THEN
- COMMIT;
- ELSE
- ROLLBACK;
- END IF
- END IF
- RETURN rslt
- end function
- public function integer save_transcode (string arg_outwarecode, string arg_relstr_1, string arg_transcode, decimal arg_weight, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- //rslt = 0
- //arg_msg = '需要子类实现'
- //GOTO ext
- UPDATE u_outware
- SET relstr_1 = :arg_relstr_1,
- transcode = :arg_transcode,
- tb_weight = :arg_weight
- WHERE outwarecode = :arg_outwarecode
- And secflag = 0;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = arg_outwarecode + '更新发货单货运单号失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- IF sqlca.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = arg_outwarecode + '更新发货单货运单号失败,发货单已经审核或被删除'
- GOTO ext
- END IF
- ext:
- IF arg_ifcommit THEN
- IF rslt = 1 THEN
- COMMIT;
- ELSE
- ROLLBACK;
- END IF
- END IF
- RETURN rslt
- end function
- public function integer save_transcode (string arg_outwarecode, string arg_relstr_1, string arg_transcode, ref string arg_msg, boolean arg_ifcommit);return save_transcode(arg_outwarecode, arg_relstr_1, arg_transcode, 0, ref arg_msg, arg_ifcommit)
- end function
- on uo_taobao_outware.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_taobao_outware.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|