$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