123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879 |
- $PBExportHeader$uo_cust_sample.sru
- forward
- global type uo_cust_sample from nonvisualobject
- end type
- end forward
- global type uo_cust_sample from nonvisualobject
- end type
- global uo_cust_sample uo_cust_sample
- type variables
- long sampleid
- int status
- Boolean IT_NEWBEGIN = TRUE //新建标志
- Boolean IT_UPDATEBEGIN = FALSE//修改标志
- int uo_option_cust_sample_secaudit
- end variables
- forward prototypes
- public function integer of_checkstatus (long arg_sampleid, ref string arg_msg)
- public function integer audit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg)
- public function integer caudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg)
- public function integer csecaudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg)
- public function integer secaudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg)
- public function integer cancel (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg)
- public function integer auditstatus (integer arg_type, long arg_sampleid, ref string arg_msg, boolean arg_ifcommit)
- public function integer updatebegin (long arg_sampleid[], ref string arg_msg)
- public function integer save (s_cust_sample arg_s_order, boolean arg_ifcommit, ref string arg_msg)
- public function integer p_reset ()
- public function integer trycmpl (long arg_sampleid, decimal arg_qty, ref string arg_msg, boolean arg_ifcommit)
- public function integer tmpstop (long arg_sampleid, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_sampleid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- public function integer of_checkstatus (long arg_sampleid, ref string arg_msg);Long rslt = 1
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误的销售意向单唯一码!'
- GOTO ext
- END IF
- Long ls_status
- SELECT status
- INTO :ls_status
- FROM u_cust_sample
- Where sampleid = :arg_sampleid;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询操作失败>'+sqlca.SQLErrText
- GOTO ext
- END IF
- status = ls_status
- ext:
- RETURN rslt
- end function
- public function integer audit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
- IF uo_option_cust_sample_secaudit = -1000 THEN
- rslt = 0
- arg_msg = '选项:[372]销售意向单使用二级审核,读取初始默认值失败,操作取消!'
- GOTO ext
- END IF
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误的销售意向单唯一码!'
- GOTO ext
- END IF
- IF of_checkstatus( arg_sampleid, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- UPDATE u_cust_sample
- SET status = 1,
- AuditingEmp = :publ_operator,
- AuditingDate = getdate()
- Where sampleid = :arg_sampleid Using sqlca;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF uo_option_cust_sample_secaudit = 0 THEN
- IF secaudit( arg_sampleid,False, arg_msg) = 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer caudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
- DateTime server_dt
- SetNull(server_dt)
- IF uo_option_cust_sample_secaudit = -1000 THEN
- rslt = 0
- arg_msg = '选项:[372]销售意向单使用二级审核,读取初始默认值失败,操作取消!'
- GOTO ext
- END IF
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误的销售意向单唯一码!'
- GOTO ext
- END IF
- IF of_checkstatus( arg_sampleid, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF uo_option_cust_sample_secaudit = 0 THEN
- IF csecaudit( arg_sampleid,False, arg_msg) = 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- UPDATE u_cust_sample
- SET status = 0,
- AuditingEmp = '',
- AuditingDate = :server_dt
- Where sampleid = :arg_sampleid Using sqlca;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer csecaudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误的销售意向单唯一码!'
- GOTO ext
- END IF
- IF of_checkstatus( arg_sampleid, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- DateTime server_dt
- SetNull(server_dt)
- UPDATE u_cust_sample
- SET status = 1,
- secAuditingEmp = '',
- secAuditingDate = :server_dt
- Where sampleid = :arg_sampleid Using sqlca;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer secaudit (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误的销售意向单唯一码!'
- GOTO ext
- END IF
- IF of_checkstatus( arg_sampleid, arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- UPDATE u_cust_sample
- SET status = 2,
- secAuditingEmp = :publ_operator,
- secAuditingDate = getdate()
- Where sampleid = :arg_sampleid Using sqlca;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新操作失败》审核标记》'+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer cancel (long arg_sampleid, boolean arg_ifcommit, ref string arg_msg);Int rslt = 1
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
- Int li_status
- SELECT status INTO :li_status
- FROM u_cust_sample
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询单据审核标记失败'
- rslt = 0
- GOTO ext
- END IF
- IF li_status <> 0 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以删除'
- GOTO ext
- END IF
- DELETE FROM u_cust_sample Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除单据操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF rslt = 1 AND arg_ifcommit THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer auditstatus (integer arg_type, long arg_sampleid, ref string arg_msg, boolean arg_ifcommit);
- Int rslt = 1
-
- Int li_status
- DateTime ls_null
- SetNull(ls_null)
- Decimal lde_orderqty, lde_acmpqty, lde_stopqty
- SELECT status
- INTO :li_status
- FROM u_cust_sample
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- CHOOSE CASE arg_type
- CASE 1
-
-
- IF li_status <> 2 AND li_status <> 8 THEN
- rslt = 0
- ARG_MSG = "计划只有在进行状态才可以执行暂停,请核对"
- GOTO ext
- END IF
-
- IF li_status = 2 THEN
- UPDATE u_cust_sample
- SET status = 8,
- tmpstopemp = :publ_operator,
- tmpstopdate = getdate()
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致暂停计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE
- UPDATE u_cust_sample
- SET status = 2,
- tmpstopemp = '',
- tmpstopdate = :ls_null
- Where sampleid = :arg_sampleid ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致取消暂停计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
-
- CASE 2
- IF li_status <> 2 AND li_status <> 9 THEN
- rslt = 0
- ARG_MSG = "计划只有在进行状态才可以执行终止,请核对"
- GOTO ext
- END IF
-
- IF li_status = 2 THEN
- UPDATE u_cust_sample
- SET status = 9,
- stopemp = :publ_operator,
- stopdate = getdate()
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致终止计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE
- UPDATE u_cust_sample
- SET status = 2,
- stopemp = '',
- stopdate = :ls_null
- Where sampleid = :arg_sampleid ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致取消终止计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- CASE 3
- IF li_status <> 2 AND li_status <> 6 THEN
- rslt = 0
- ARG_MSG = "计划只有在进行状态才可以执行完成,请核对"
- GOTO ext
- END IF
-
- IF li_status = 2 THEN
- UPDATE u_cust_sample
- SET status = 6,
- Accomplishemp = :publ_operator,
- Accomplishdate = getdate()
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致完成计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE
- UPDATE u_cust_sample
- SET status = 2,
- Accomplishemp = '',
- Accomplishdate = :ls_null
- Where sampleid = :arg_sampleid ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "因网络或其它原因导致取消完成计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- END CHOOSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
-
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT;
- END IF
- Return (rslt)
- end function
- public function integer updatebegin (long arg_sampleid[], ref string arg_msg);Int rslt = 1
- Int li_status,i
- string ls_samplecode
- FOR i = 1 TO UpperBound(arg_sampleid[])
-
- IF arg_sampleid[i] <= 0 THEN
- rslt = 0
- arg_msg = '错误单据唯一码'
- GOTO ext
- END IF
-
- SELECT status,samplecode INTO :li_status,:ls_samplecode
- FROM u_cust_sample
- Where sampleid = :arg_sampleid[i];
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询单据状态标记失败'
- rslt = 0
- GOTO ext
- END IF
-
- IF li_status <> 0 THEN
- rslt = 0
- arg_msg = ls_samplecode+"已经处于审核或完成等状态,不可以修改"
- GOTO ext
- END IF
-
- NEXT
- ext:
- RETURN rslt
- end function
- public function integer save (s_cust_sample arg_s_order, boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1,cnt = 0
- DateTime server_dt
- Long ll_sampleid,ll_i,i,ll_j
- String ls_sccode,ls_samplecode
- if isnull(arg_s_order.cusid) then arg_s_order.cusid = 0
- if isnull(arg_s_order.mtrlid) then arg_s_order.mtrlid = 0
- if isnull(arg_s_order.kind) then arg_s_order.kind = 0
- if isnull(arg_s_order.samplecontent) then arg_s_order.samplecontent = ''
- if isnull(arg_s_order.mtrlcode) then arg_s_order.mtrlcode = ''
- if isnull(arg_s_order.mtrlname) then arg_s_order.mtrlname = ''
- if isnull(arg_s_order.mtrlmode) then arg_s_order.mtrlmode = ''
- if isnull(arg_s_order.unit) then arg_s_order.unit = ''
- if isnull(arg_s_order.simplename) then arg_s_order.simplename = ''
- if isnull(arg_s_order.mtrlcolor) then arg_s_order.mtrlcolor = ''
- if isnull(arg_s_order.configname) then arg_s_order.configname = ''
- if isnull(arg_s_order.cusnarrate) then arg_s_order.cusnarrate = ''
- if isnull(arg_s_order.dscrp) then arg_s_order.dscrp = ''
- if isnull(arg_s_order.relcode) then arg_s_order.relcode = ''
-
- IF Year(Date(arg_s_order.sampledate)) < 2000 THEN
- rslt = 0
- arg_msg = "计划日期为空或不合理"
- GOTO ext
- END IF
- IF Date(arg_s_order.sampledate) > Date(arg_s_order.requiredate) THEN
- rslt = 0
- arg_msg = "计划日期大于交货日期"
- GOTO ext
- END IF
- IF Trim(arg_s_order.saler) = '' THEN
- rslt = 0
- arg_msg = "请输入业务员"
- GOTO ext
- END IF
- If (arg_s_order.CUSID) = 0 THEN
- rslt = 0
- arg_msg = "请输入客户资料"
- GOTO ext
- END IF
- If (arg_s_order.ifrel) = 0 THEN
- arg_s_order.mtrlid = 0
- END IF
- SELECT Top 1 getdate() Into :server_dt From u_user;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- IF arg_s_order.sampleid = 0 THEN //新建
- ll_sampleid = f_sys_scidentity(0,"u_cust_sample","sampleid",arg_msg,False,sqlca)
- IF ll_sampleid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- ls_samplecode = getid(0,ls_sccode + 'PD',Date(server_dt),False,sqlca)
-
- IF ls_samplecode = "err" THEN
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
-
- INSERT INTO u_cust_sample
- (sampleid,
- samplecode,
- status,
- cusid,
- mtrlid,
- saler,
- sampledate,
- requiredate,
- relcode,
- qty,
- dscrp,
- ifrel,
- mtrlcode,
- mtrlname,
- mtrlmode,
- unit,
- opemp,
- opdate,
- kind,
- samplecontent,
- simplename,
- mtrlcolor,
- configname,
- cusnarrate)
- VALUES (
- :ll_sampleid,
- :ls_samplecode,
- :arg_s_order.status,
- :arg_s_order.cusid,
- :arg_s_order.mtrlid,
- :arg_s_order.saler,
- :arg_s_order.sampledate,
- :arg_s_order.requiredate,
- :arg_s_order.relcode,
- :arg_s_order.qty,
- :arg_s_order.dscrp,
- :arg_s_order.ifrel,
- :arg_s_order.mtrlcode,
- :arg_s_order.mtrlname,
- :arg_s_order.mtrlmode,
- :arg_s_order.unit,
- :publ_operator,
- getdate(),
- :arg_s_order.kind,
- :arg_s_order.samplecontent,
- :arg_s_order.simplename,
- :arg_s_order.mtrlcolor,
- :arg_s_order.configname,
- :arg_s_order.cusnarrate
- );
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致建立单据操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE //更新
- UPDATE u_cust_sample SET
- cusid = :arg_s_order.cusid,
- requiredate = :arg_s_order.requiredate,
- qty = :arg_s_order.qty,
- ifdata = :arg_s_order.ifdata,
- status = :arg_s_order.status,
- sampledate = :arg_s_order.sampledate,
- relcode = :arg_s_order.relcode,
- saler = :arg_s_order.saler,
- mtrlid = :arg_s_order.mtrlid,
- dscrp = :arg_s_order.dscrp,
- ifrel = :arg_s_order.ifrel,
- mtrlcode = :arg_s_order.mtrlcode,
- mtrlname = :arg_s_order.mtrlname,
- mtrlmode = :arg_s_order.mtrlmode,
- unit = :arg_s_order.unit,
- moddate = getdate(),
- modemp = :publ_operator,
- kind = :arg_s_order.kind,
- samplecontent = :arg_s_order.samplecontent,
- simplename = :arg_s_order.simplename,
- mtrlcolor = :arg_s_order.mtrlcolor,
- configname = :arg_s_order.configname,
- cusnarrate = :arg_s_order.cusnarrate
- Where sampleid = :arg_s_order.sampleid;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF arg_ifcommit And rslt = 1 THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- public function integer p_reset ();sampleid = 0
- status = 0
- it_newbegin = FALSE
- it_updatebegin = FALSE
- RETURN 1
- end function
- public function integer trycmpl (long arg_sampleid, decimal arg_qty, ref string arg_msg, boolean arg_ifcommit);//trycmplsaletask(arg_sampleid,arg_msg,arg_ifcommit)
- Int rslt = 1,cnt = 0,ll_status
- DateTime null_dt
- SetNull(null_dt)
- Decimal ls_zerook
- Boolean if_finish
-
- IF arg_sampleid <= 0 THEN
- rslt = 0
- arg_msg = '错误销售意向单唯一码'
- GOTO ext
- END IF
- SELECT status INTO :ll_status
- FROM u_cust_sample
- Where sampleid = :arg_sampleid;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '错误销售意向单状态失败'
- GOTO ext
- END IF
- IF ll_status <> 2 AND ll_status <> 5 THEN
- rslt = 0
- IF ll_status <> 2 THEN
- arg_msg = "销售意向单只有在进行状态下才可以执行设完成状态"
- ELSEIF status <> 5 THEN
- arg_msg = "销售意向单只有在完成状态下才可以执行撤消完成状态"
- END IF
- GOTO ext
- END IF
- UPDATE u_cust_sample SET
- consignedqty = consignedqty+:Arg_qty
- Where sampleid = :arg_sampleid;
-
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新销售意向单已开单数量失败'
- GOTO ext
- END IF
- if_finish = TRUE
- SELECT u_cust_sample.qty - u_cust_sample.consignedqty INTO :ls_zerook
- FROM u_cust_sample
- Where ( u_cust_sample.sampleid = :arg_sampleid );
-
- IF ls_zerook > 0 THEN if_finish = FALSE
- IF ll_status = 2 AND if_finish THEN
- UPDATE u_cust_sample
- SET status = 5,
- accomplishdate = getdate(),
- Accomplishemp = :publ_operator
- Where ( u_cust_sample.sampleid = :arg_sampleid );
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其他原因导致销售意向单完成状态设置操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- IF ll_status = 5 AND NOT if_finish THEN
- UPDATE u_cust_sample
- SET status = 2,
- accomplishdate = :null_dt,
- Accomplishemp = ''
- Where ( u_cust_sample.sampleid = :arg_sampleid );
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其他原因导致销售意向单撤消完成状态设置操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING sqlca;
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT USING sqlca;
- END IF
- Return (rslt)
- end function
- public function integer tmpstop (long arg_sampleid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1,cnt = 0
- datetime ls_null
- setnull(ls_null)
- IF arg_sampleid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误单据唯一码'
- GOTO ext
- END IF
- Int li_status
- SELECT status
- INTO :li_status
- FROM u_cust_sample
- Where sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
- rslt = 0
- GOTO ext
- END IF
- IF li_status <> 1 AND li_status <> 2 AND li_status <> 8 THEN
- rslt = 0
- ARG_MSG = "计划只有在进行状态才可以执行暂停,请核对"
- GOTO ext
- END IF
- IF li_status = 2 THEN
- UPDATE u_cust_sample
- SET status = 8,
- tmpstopemp = :publ_operator,
- tmpstopdate=getdate()
- WHERE sampleid = :arg_sampleid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致暂停计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE
- UPDATE u_cust_sample
- SET status = 2,
- tmpstopemp = '',
- tmpstopdate=:ls_null
- WHERE sampleid = :arg_sampleid ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致取消暂停计划操作失败"+"~n"+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
-
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT;
- END IF
- RETURN (rslt)
- end function
- public function integer add_dscrp (long arg_sampleid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);//add_dscrp(string arg_newdescppart)
- //0 fail 1 SUCCESS
- Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF status = 0 THEN
- rslt = 0
- arG_MSG = "未审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_cust_sample
- SET DSCRP = DSCRP+' '+:arg_newdescppart
- Where u_cust_sample.sampleid = :arg_sampleid USING sqlca ;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加单据备注操作失败"+"~n"+ sqlca.SQLErrText
- GOTO ext
- END IF
- //DSCRP = DSCRP+' '+arg_newdescppart
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING sqlca;
- ELSEIF arg_ifcommit THEN
- COMMIT USING sqlca;
- END IF
- p_reset()
- Return (rslt)
- end function
- on uo_cust_sample.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_cust_sample.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event constructor;String str_optionvalue,arg_msg
- f_get_sys_option_value('372',str_optionvalue,arg_msg)
- uo_option_cust_sample_secaudit = Long(str_optionvalue)
- end event
|