1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201 |
- $PBExportHeader$uo_oppose.sru
- forward
- global type uo_oppose from nonvisualobject
- end type
- type s_opposemx_mtrl from structure within uo_oppose
- end type
- type s_opposemx_dept from structure within uo_oppose
- end type
- end forward
- type s_opposemx_mtrl from structure
- long mtrlid
- string status
- decimal { 5 } qty
- string mxdscrp
- long relid
- long relprintid
- long scid
- long mxtype
- end type
- type s_opposemx_dept from structure
- long deptid
- string wkpname
- end type
- global type uo_oppose from nonvisualobject
- end type
- global uo_oppose uo_oppose
- type variables
- public protectedwrite long billid
- public protectedwrite string billcode
- public protectedwrite int billtype
- public protectedwrite datetime opdate
- public protectedwrite string opemp
- public protectedwrite datetime moddate
- public protectedwrite string modemp
- public protectedwrite int flag
- public protectedwrite datetime auditingdate
- public protectedwrite string auditingrep
- long relid
- datetime billdate
- string opposedept
- datetime thdate
- datetime fhdate
- string threason
- string custdscrp
- string saleidea
- string productieda
- string qualityidea
- string manageridea
- string improveidea
- string wkpdscrp
- decimal opposeamt
- long itemid
- String responsibler
- boolean if_getid_ture=true
- transaction commit_transaction
- private:
- long it_mxbt=0
- s_opposemx_mtrl opposemx_mtrl[]
- long it_depmxbt=0
- s_opposemx_dept opposemx_dept[]
- boolean it_newbegin=false
- boolean it_updatebegin=false
-
- end variables
- forward prototypes
- public function integer save (boolean arg_ifcommit, ref string arg_msg)
- public function integer p_clearmx ()
- public function integer p_reset ()
- public function integer getinfo (long arg_scid, long arg_billid, ref string arg_msg)
- public function integer updatebegin (long arg_billid, ref string arg_msg)
- public function integer p_getinfo (long arg_billid, ref string arg_msg)
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
- public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- public function integer c_auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg)
- public function integer newbegin (integer arg_billtype, ref string arg_msg)
- public function long acceptdeptid (long arg_deptid, ref string arg_msg)
- public function integer add_qualityidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_manageridea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_improveidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_productieda (long arg_billid, long arg_deptid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer acceptmx (long arg_mtrlid, string arg_status, decimal arg_qty, string arg_mxdscrp, long arg_mxtype, long arg_scid, long arg_relid, long arg_relprintid, ref string arg_msg)
- end prototypes
- public function integer save (boolean arg_ifcommit, ref string arg_msg);Integer rslt = 1
- Long cnt = 0,i,ll_i
- DateTime server_dt
- Long ls_newid
- String ls_wkpdscrp
- IF IsNull(opposedept) THEN opposedept = ""
- IF IsNull(threason) THEN threason = ""
- IF IsNull(custdscrp) THEN custdscrp = ""
- IF IsNull(saleidea) THEN saleidea = ""
- IF IsNull(productieda) THEN productieda = ""
- IF IsNull(manageridea) THEN manageridea = ""
- IF IsNull(qualityidea) THEN qualityidea = ""
- IF IsNull(relid) THEN relid = 0
- IF IsNull(opposeamt) THEN opposeamt = 0
- IF IsNull(itemid) THEN itemid = 0
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以提交"
- GOTO ext
- END IF
- SELECT Top 1 getdate() Into :server_dt From u_user Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- SELECT count(*) INTO :cnt
- FROM u_oppose_item
- Where itemid = :itemid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询投拆项目资料失败'
- rslt = 0
- GOTO ext
- END IF
- IF cnt = 0 THEN
- arg_msg = '系统不存在项目资料'
- rslt = 0
- GOTO ext
- END IF
- IF billtype = 0 THEN
- IF opposedept = '' THEN
- arg_msg = '请输入投诉部门'
- rslt = 0
- GOTO ext
- END IF
-
- IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
- rslt = 0
- arg_msg = "没有正确产品明细内容"
- GOTO ext
- END IF
-
- IF it_depmxbt = 0 THEN //如果输入物料资料错则已经清空
- rslt = 0
- arg_msg = "没有正确部门明细内容"
- GOTO ext
- END IF
- //***************************
- FOR ll_i = 1 To it_depmxbt
- ls_wkpdscrp = ls_wkpdscrp + opposemx_dept[ll_i].wkpname +','
- NEXT
-
- IF Len(ls_wkpdscrp) > 0 THEN
- ls_wkpdscrp = Left(ls_wkpdscrp,Len(ls_wkpdscrp) - 1)
- END IF
- //****************************
- ELSE
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_spt
- Where sptid = :relid ;
- IF sqlca.SQLCode <> 0 Or cnt = 0 THEN
- arg_msg = '查询供应商资料失败,可能供应商资料不存在'
- rslt = 0
- GOTO ext
- END IF
- END IF
- IF Year(Date(billdate)) < 2000 Or IsNull(billdate) THEN
- rslt = 0
- arg_msg = "缺少发生时间或不合理"
- GOTO ext
- END IF
- //====================================================================
- // script - save ( boolean arg_ifcommit, ref string arg_msg )
- // reason:
- //--------------------------------------------------------------------
- // modified by: yyx date: 2004.01.02
- //--------------------------------------------------------------------
- IF DaysAfter(Date(String(server_dt,'yyyy-mm-dd')),Date(String(billdate,'yyyy-mm-dd'))) > sys_option_input_days THEN
- rslt = 0
- arg_msg = '日期错误,日期不能超前系统日期'
- GOTO ext
- END IF
- IF DaysAfter(Date(String(billdate,'yyyy-mm-dd')),Date(String(server_dt,'yyyy-mm-dd'))) > sys_option_input_days THEN
- rslt = 0
- arg_msg = '日期错误,日期不能落后系统日期'
- GOTO ext
- END IF
- ////////////////////////////////////////////// //开始区分:新建/更新 处理
- IF billid = 0 THEN //新建
- ls_newid = f_sys_scidentity(0,"u_oppose","billid",arg_msg,if_getid_ture,commit_transaction)
- IF ls_newid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- //取得新单据编号
- IF billtype = 0 THEN
- billcode = getid(0,'TS',Date(server_dt),if_getid_ture,commit_transaction)
- ELSE
- billcode = getid(0,'SS',Date(server_dt),if_getid_ture,commit_transaction)
- END IF
-
- IF billcode = "err" THEN
- billcode = ''
- rslt = 0
- arg_msg = "无法获取单据编号"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- INSERT INTO u_oppose(billid,
- billdate,
- opposedept,
- thdate,
- fhdate,
- threason,
- custdscrp,
- saleidea,
- productieda,
- qualityidea,
- manageridea,
- improveidea,
- billcode,
- opdate,
- opemp,
- billtype,
- relid,
- wkpdscrp,
- opposeamt,
- itemid,
- responsibler
- )
- VALUES(:ls_newid,
- :billdate,
- :opposedept,
- :thdate,
- :fhdate,
- :threason,
- :custdscrp,
- :saleidea,
- :productieda,
- :qualityidea,
- :manageridea,
- :improveidea,
- :billcode,
- getdate(),
- :publ_operator,
- :billtype,
- :relid,
- :ls_wkpdscrp,
- :opposeamt,
- :itemid,
- :responsibler
- ) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
-
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_oppose') > 0 THEN
- arg_msg = '插入操作失败,关键字单据ID重复'
- ELSEIF Pos(Lower(commit_transaction.SQLErrText),'IX_u_oppose') > 0 THEN
- arg_msg = '插入操作失败,单据编号重复'
- ELSE
- arg_msg = "插入操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
-
- GOTO ext
- END IF
-
- // FOR i = 1 TO it_depmxbt
- // INSERT INTO u_opposemx_dept(deptid,
- // billid,
- // opemp,
- // opdate)
- // Values (:opposemx_dept[i].deptid,:ls_newid,:publ_operator,getdate()) USING commit_transaction ;
- // IF commit_transaction.SQLCode <> 0 THEN
- // billid = 0
- // rslt = 0
- //
- // IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_opposemx_dept') > 0 THEN
- // arg_msg = '插入明细操作失败,关键字单据ID,序号重复'
- // ELSE
- // arg_msg = "插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- // END IF
- //
- // GOTO ext
- // END IF
- // NEXT
-
- //读取新inwareid
- billid = ls_newid
-
- // FOR i = 1 TO it_mxbt
- // INSERT INTO u_opposemx_mtrl(
- // mtrlid,
- // status,
- // qty,
- // mxdscrp ,
- // billid)
- // VALUES ( :opposemx_mtrl[i].mtrlid,
- // :opposemx_mtrl[i].status,
- // :opposemx_mtrl[i].qty,
- // :opposemx_mtrl[i].mxdscrp,
- // :ls_newid
- // ) USING commit_transaction;
- // IF commit_transaction.SQLCode <> 0 THEN
- // billid = 0 //还原inwareid
- // rslt = 0
- //
- // IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_opposemx_mtrl') > 0 THEN
- // arg_msg = '插入明细操作失败,关键字单据ID,序号重复'
- // ELSE
- // arg_msg = "插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- // END IF
- // GOTO ext
- // END IF
- // NEXT
- ELSE //////////////////////////////////////////////////更新
- UPDATE u_oppose
- SET billid = :billid,
- billdate = :billdate,
- opposedept = :opposedept,
- thdate = :thdate,
- fhdate = :fhdate,
- threason = :threason,
- custdscrp = :custdscrp,
- saleidea = :saleidea,
- productieda = :productieda,
- qualityidea = :qualityidea,
- manageridea = :manageridea,
- improveidea = :improveidea,
- billcode = :billcode,
- moddate = getdate(),
- modemp = :publ_operator,
- relid = :relid,
- wkpdscrp = :ls_wkpdscrp,
- opposeamt = :opposeamt,
- itemid = :itemid,
- responsibler = :responsibler
- WHERE u_oppose.billid = :billid
- And flag = 0 Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 Or commit_transaction.SQLNRows <= 0 THEN
- rslt = 0
- arg_msg = "更新单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM u_opposemx_dept
- Where u_opposemx_dept.billid = :billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM u_opposemx_mtrl
- Where u_opposemx_mtrl.billid = :billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
-
- END IF
- FOR i = 1 To it_depmxbt
- INSERT INTO u_opposemx_dept(deptid,
- billid,
- opemp,
- opdate)
- Values (:opposemx_dept[i].deptid,:billid,:publ_operator,getdate()) Using commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- IF it_newbegin THEN billid = 0
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_opposemx_dept') > 0 THEN
- arg_msg = '插入投诉部门明细操作失败,关键字单据ID,序号重复'
- ELSE
- arg_msg = "插入投诉部门明细操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- NEXT
- FOR i = 1 To it_mxbt
- INSERT INTO u_opposemx_mtrl(
- mtrlid,
- status,
- qty,
- mxdscrp ,
- billid,
- mxtype,
- scid,
- relid,
- relprintid)
- VALUES ( :opposemx_mtrl[i].mtrlid,
- :opposemx_mtrl[i].status,
- :opposemx_mtrl[i].qty,
- :opposemx_mtrl[i].mxdscrp,
- :billid,
- :opposemx_mtrl[i].mxtype,
- :opposemx_mtrl[i].scid,
- :opposemx_mtrl[i].relid,
- :opposemx_mtrl[i].relprintid
- ) Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- IF it_newbegin THEN billid = 0
- rslt = 0
- IF Pos(Lower(commit_transaction.SQLErrText),'PK_u_opposemx_mtrl') > 0 THEN
- arg_msg = '插入投诉产品明细操作失败,关键字单据ID,序号重复'
- ELSE
- arg_msg = "插入投诉产品明细操作失败"+"~n"+commit_transaction.SQLErrText
- END IF
- GOTO ext
- END IF
- NEXT
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- p_clearmx()
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer p_clearmx ();//int p_clearmx()
- //清除明细
- it_mxbt=0
- it_depmxbt=0
- return 1
- end function
- public function integer p_reset ();//int p_reset()
- //清除对象及其明细
-
- billid = 0
- billcode = ''
- opemp = ''
- modemp = ''
- auditingrep = ''
- flag = 0
- opposedept = ''
- threason = ''
- custdscrp = ''
- saleidea = ''
- productieda = ''
- qualityidea = ''
- manageridea = ''
- improveidea = ''
- opposeamt = 0
- itemid = 0
- it_newbegin = false
- it_updatebegin = false
- //清除明细
- p_clearmx()
- return 1
- end function
- public function integer getinfo (long arg_scid, long arg_billid, ref string arg_msg);Int rslt = 1
- Long i = 1,no_mxcheck = 0,j = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- arg_msg = "非法单据唯一码"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- //用游标读取明细
- DECLARE cur_inwaermx CURSOR FOR
- SELECT u_opposemx_mtrl.mtrlid,
- u_opposemx_mtrl.status,
- u_opposemx_mtrl.qty,
- u_opposemx_mtrl.mxdscrp,
- u_opposemx_mtrl.scid,
- u_opposemx_mtrl.relid,
- u_opposemx_mtrl.relprintid
- FROM u_opposemx_mtrl
- Where u_opposemx_mtrl.billid = :arg_billid Using commit_transaction;
-
- OPEN cur_inwaermx;
- FETCH cur_inwaermx INTO :opposemx_mtrl[i].mtrlid,
- :opposemx_mtrl[i].status,:opposemx_mtrl[i].qty ,
- :opposemx_mtrl[i].mxdscrp,
- :opposemx_mtrl[i].scid,
- :opposemx_mtrl[i].relid,
- :opposemx_mtrl[i].relprintid ;
-
- DO WHILE commit_transaction.SQLCode = 0
- i++
- FETCH cur_inwaermx INTO :opposemx_mtrl[i].mtrlid,
- :opposemx_mtrl[i].status,:opposemx_mtrl[i].qty ,
- :opposemx_mtrl[i].mxdscrp ,
- :opposemx_mtrl[i].scid,
- :opposemx_mtrl[i].relid,
- :opposemx_mtrl[i].relprintid ;
- LOOP
- CLOSE cur_inwaermx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_opposemx_mtrl
- WHERE u_opposemx_mtrl.billid = :arg_billid
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,进仓单明细数量"
- GOTO ext
- END IF
- IF i <> (no_mxcheck+1) THEN
- rslt = 0
- arg_msg = "查询操作失败,投诉单产品明细"
- GOTO ext
- END IF
- //用游标读取明细
- DECLARE cur_depmx CURSOR FOR
- SELECT u_opposemx_dept.deptid
- FROM u_opposemx_dept
- Where u_opposemx_dept.billid = :arg_billid Using commit_transaction;
-
- OPEN cur_depmx;
- FETCH cur_depmx Into :opposemx_dept[i].deptid ;
- DO WHILE commit_transaction.SQLCode = 0
- j++
- FETCH cur_depmx Into :opposemx_dept[i].deptid ;
- LOOP
- CLOSE cur_depmx;
- //检验明细是否读入完整
- SELECT count(*) INTO :no_mxcheck
- FROM u_opposemx_dept
- WHERE u_opposemx_dept.billid = :arg_billid
- Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,投诉单部门明细"
- GOTO ext
- END IF
- IF j <> (no_mxcheck+1) THEN
- rslt = 0
- arg_msg = "查询操作失败,进仓单明细"
- GOTO ext
- END IF
- billid = arg_billid
- it_mxbt = i - 1
- it_depmxbt = j - 1
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer updatebegin (long arg_billid, ref string arg_msg);Long rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = '单据已经审核,不可以修改'
- GOTO ext
- END IF
- billid = arg_billid
- it_newbegin = False
- it_updatebegin = True
- p_clearmx() //清除明细
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer p_getinfo (long arg_billid, ref string arg_msg);//p_getinfo(arg_scid,arg_inwareid,arg_msg)
- //0 失败 1成功
- Int rslt = 1
- IF arg_billid <= 0 THEN
- rslt = 0
- arG_MSG = "非法单据唯一码"
- GOTO ext
- END IF
- SELECT u_oppose.billid,
- u_oppose.billdate,
- u_oppose.billtype,
- u_oppose.relid,
- u_oppose.opposedept,
- u_oppose.thdate,
- u_oppose.fhdate,
- u_oppose.threason,
- u_oppose.custdscrp,
- u_oppose.saleidea,
- u_oppose.productieda,
- u_oppose.qualityidea,
- u_oppose.manageridea,
- u_oppose.improveidea,
- u_oppose.billcode,
- u_oppose.opdate,
- u_oppose.opemp,
- u_oppose.moddate,
- u_oppose.modemp,
- u_oppose.flag,
- u_oppose.auditdate,
- u_oppose.auditemp ,
- u_oppose.wkpdscrp,
- u_oppose.opposeamt,
- u_oppose.itemid
- INTO :billid,
- :billdate,
- :billtype,
- :relid,
- :opposedept,
- :thdate,
- :fhdate,
- :threason,
- :custdscrp,
- :saleidea,
- :productieda,
- :qualityidea,
- :manageridea,
- :improveidea,
- :billcode,
- :opdate,
- :opemp,
- :moddate,
- :modemp,
- :flag,
- :auditingdate,
- :auditingrep,
- :wkpdscrp,
- :opposeamt,
- :itemid
- FROM u_oppose
- Where u_oppose.billid = :arg_billid Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "查询操作失败(错误单据唯一码)"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- billid = arg_billid
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);
- Int rslt = 1
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有删除对象,操作取消"
- GOTO ext
- END IF
- rslt = p_getinfo(arg_billid,arg_msg)
- IF rslt = 0 THEN GOTO ext
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核,不可以删除"
- GOTO ext
- END IF
- DELETE FROM u_opposemx_mtrl
- Where u_opposemx_mtrl.billid = :arg_billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除客户投诉单明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_opposemx_dept
- Where u_opposemx_dept.billid = :arg_billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除客户投诉单部门明细操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- DELETE FROM u_oppose
- Where u_oppose.billid = :arg_billid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "删除客户投诉单操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- p_reset()
- RETURN rslt
- end function
- public function integer auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);Long rslt = 1
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arg_msg = "单据已经审核"
- GOTO ext
- END IF
- UPDATE u_oppose
- SET auditemp = :publ_operator,
- auditdate = getdate(),
- flag = 1
- Where u_oppose.billid = :billid And flag = 0 Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- ELSEIF commit_transaction.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- flag = 1
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer c_auditing (long arg_billid, boolean arg_ifcommit, ref string arg_msg);
- Long rslt = 1
- DateTime null_dt
- SetNull(null_dt)
- IF arg_billid = 0 THEN
- rslt = 0
- arg_msg = "没有审核对象"
- GOTO ext
- END IF
- IF it_newbegin Or it_updatebegin THEN
- rslt = 0
- arg_msg = "编辑状态下不可以执行审核"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arg_msg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 0 THEN
- rslt = 0
- arg_msg = "单据还未审核"
- GOTO ext
- END IF
- UPDATE u_oppose
- SET auditemp = '',
- auditdate = :null_dt,
- flag = 0
- WHERE u_oppose.billid = :billid
- And flag = 1 Using commit_transaction;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- ELSEIF commit_transaction.SQLNRows = 0 THEN
- rslt = 0
- arg_msg = "单据正在审核,请稍后查询。"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
- flag = 0
- ext:
- IF rslt = 0 THEN
- ROLLBACK Using commit_transaction;
- ELSEIF rslt = 1 And arg_ifcommit THEN
- COMMIT Using commit_transaction;
- END IF
- RETURN rslt
- end function
- public function integer newbegin (integer arg_billtype, ref string arg_msg);Int rslt = 1
- IF arg_billtype <> 0 And arg_billtype <> 1 THEN
- arg_msg = '错误的单据类型:0-客户/部门投诉单,1-供应商投诉单'
- rslt = 0
- GOTO ext
- END IF
- p_reset()
- it_newbegin = True
- it_updatebegin = False
- billtype = arg_billtype
- ext :
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function long acceptdeptid (long arg_deptid, ref string arg_msg);Int rslt = 1
- Long i
- String ls_wrkGrpName
- IF IsNull(arg_deptid) THEN arg_deptid = 0
- IF arg_deptid = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- SELECT workgroupname INTO :ls_wrkGrpName
- FROM u_workgroup
- Where workgroupid = :arg_deptid;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = '查询责任部门资料失败'
- rslt = 0
- GOTO ext
- END IF
- FOR i = 1 To it_depmxbt
- IF opposemx_dept[i].deptid = arg_deptid THEN
- rslt = 1
- GOTO ext
- END IF
- NEXT
- it_depmxbt++
- opposemx_dept[it_depmxbt].deptid = arg_deptid
- opposemx_dept[it_depmxbt].wkpname = ls_wrkGrpName
- ext:
- IF rslt = 0 THEN p_clearmx()
- RETURN rslt
- end function
- public function integer add_qualityidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin OR it_newbegin THEN
- rslt = 0
- arG_MSG = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_oppose
- SET qualityidea = qualityidea+' '+:arg_newdescppart
- Where u_oppose.billid = :arg_billid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
- GOTO ext
- END IF
- qualityidea = qualityidea+' '+arg_newdescppart
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer add_manageridea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin OR it_newbegin THEN
- rslt = 0
- arG_MSG = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_oppose
- SET manageridea = manageridea+' '+:arg_newdescppart
- Where u_oppose.billid = :arg_billid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
- GOTO ext
- END IF
- manageridea = manageridea+' '+arg_newdescppart
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer add_improveidea (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin OR it_newbegin THEN
- rslt = 0
- arG_MSG = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_oppose
- SET improveidea = improveidea+' '+:arg_newdescppart
- Where u_oppose.billid = :arg_billid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
- GOTO ext
- END IF
- improveidea = improveidea+' '+arg_newdescppart
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer add_productieda (long arg_billid, long arg_deptid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- arg_newdescppart = Trim(arg_newdescppart)
- IF it_updatebegin OR it_newbegin THEN
- rslt = 0
- arG_MSG = "编辑状态下不可用"
- GOTO ext
- END IF
- IF arg_newdescppart = '' THEN
- rslt = 0
- arG_MSG = "要添加内容为空,操作取消"
- GOTO ext
- END IF
- IF p_getinfo(arg_billid,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- arG_MSG = "审核状态下不可用"
- GOTO ext
- END IF
- UPDATE u_opposemx_dept
- SET productieda = productieda+' '+:arg_newdescppart,
- opemp = :publ_operator,
- opdate = getdate()
- WHERE u_opposemx_dept.billid = :arg_billid
- AND u_opposemx_dept.deptid = :arg_deptid USING commit_transaction ;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致添加操作失败"+"~n"+ commit_transaction.SQLErrText
- GOTO ext
- END IF
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN
- ROLLBACK USING commit_transaction;
- ELSEIF arg_ifcommit THEN
- COMMIT USING commit_transaction;
- END IF
- p_reset()
- Return (rslt)
- end function
- public function integer acceptmx (long arg_mtrlid, string arg_status, decimal arg_qty, string arg_mxdscrp, long arg_mxtype, long arg_scid, long arg_relid, long arg_relprintid, ref string arg_msg);Int rslt = 1
- Long cnt = 0,ls_i
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arg_msg = "非编辑状态不可以使用,操作取消"
- GOTO ext
- END IF
- //清除空值
- IF IsNull(arg_mtrlid) THEN arg_mtrlid = 0
- IF IsNull(arg_status) THEN arg_status = ''
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_scid) THEN arg_scid = 0
- IF IsNull(arg_relid) THEN arg_relid = 0
- IF IsNull(arg_relprintid) THEN arg_relprintid = 0
- IF IsNull(arg_mxtype) THEN arg_mxtype = 0
- // 如果进仓数量为 0,或物料编号为空,则不作任何处理
- IF arg_mtrlid = 0 Or arg_qty = 0 THEN
- rslt = 1
- GOTO ext
- END IF
- FOR ls_i = 1 To it_mxbt
- IF opposemx_mtrl[ls_i].mtrlid = arg_mtrlid And opposemx_mtrl[ls_i].status = arg_status THEN
- rslt = 1
- GOTO ext
- END IF
- NEXT
- //写入内容
- it_mxbt++
- opposemx_mtrl[it_mxbt].mtrlid = arg_mtrlid
- opposemx_mtrl[it_mxbt].status = arg_status
- opposemx_mtrl[it_mxbt].qty = arg_qty
- opposemx_mtrl[it_mxbt].mxdscrp = arg_mxdscrp
- opposemx_mtrl[it_mxbt].mxtype = arg_mxtype //0:销售订单; 1:销售发货单
- opposemx_mtrl[it_mxbt].scid = arg_scid
- opposemx_mtrl[it_mxbt].relid = arg_relid
- opposemx_mtrl[it_mxbt].relprintid = arg_relprintid
- ext:
- IF rslt = 0 THEN p_clearmx()
- Return(rslt)
- end function
- on uo_oppose.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_oppose.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|