$PBExportHeader$uo_outware_move.sru forward global type uo_outware_move from nonvisualobject end type type s_outwaremx from structure within uo_outware_move end type end forward type s_outwaremx from structure long mtrlwareid long mtrlid long storageid decimal { 10 } qty decimal { 10 } uqty decimal { 5 } rate string unit string plancode decimal { 10 } cost string mtrlcode string mxdscrp long printid string status long scid integer dxflag long sptid string woodcode string pcode decimal { 10 } price string mtrlcuscode string location string newlocation decimal { 10 } inqty decimal { 10 } outqty integer outtype_mtrl integer ifrel long relid long relprintid string relcode end type global type uo_outware_move from nonvisualobject end type global uo_outware_move uo_outware_move type variables Public ProtectedWrite Long outwareid //出仓单表自动增量id Public ProtectedWrite String outwarecode //所有单据的唯一编号 Public ProtectedWrite DateTime opdate //建立时间,自动 Public ProtectedWrite Int flag = 0 //仓库审核标志,默认0,审核时(变1)才减少库存 Public ProtectedWrite DateTime auditingdate //审核时间 Public ProtectedWrite String auditingrep //审核操作员 Public ProtectedWrite Int d_auditflag = 0 //仓库审核标志,默认0,审核时(变1)才减少库存 Public ProtectedWrite DateTime d_auditingdate //审核时间 Public ProtectedWrite String d_auditingrep //审核操作员 Public ProtectedWrite String operator //建立操作员 Public ProtectedWrite DateTime moddate //修改时间 Public ProtectedWrite String modrep //修改操作员 Public ProtectedWrite Int priceflag = 0 long sscid long dscid Long sstorageid //原仓位 Long dstorageid //目标仓位 DateTime outdate //进仓发生时间 DateTime indate //进仓发生时间 String outrep = '' //经手人 String dscrp = '' //备注 String relcode = '' Int ifauto = 0 //自动建立 long il_newlocation_cnt Boolean if_getid_ture = True Private: s_outwaremx outwaremx[] //明细结构数组 s_outwaremx_barcode s_mx_barcode[] s_outwaremx_barcode s_mx_barcode_in[] Long it_mxbt = 0 //明细结构数组末指针 Long it_mxbt_barcode = 0 Long it_mxbt_barcode_in = 0 Boolean it_newbegin = True //新建标志 Boolean it_updatebegin = False //修改标志 Int uo_option_barcode_outwaremove_paudit Int uo_option_inout_type Int uo_option_noauditingqty_mode Int uo_option_barcodelocation_use_inwaremx_location end variables forward prototypes public function integer add_dscrp (string arg_newdescppart, ref string arg_msg) public function integer p_clearmx () public function integer p_reset () public function integer p_getinfo (long arg_outwareid, ref string arg_msg) public function integer newbegin (ref string arg_msg) public function integer getinfo (long arg_outwareid, ref string arg_msg) public function integer updatebegin (long arg_outwareid, ref string arg_msg) public function integer ss_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit) public function integer c_ds_auditing (ref string arg_msg, boolean arg_ifcommit) public function integer c_ss_auditing (ref string arg_msg, boolean arg_ifcommit) public function integer ds_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit) public function integer cancel (long arg_outwareid, ref string arg_msg, boolean arg_ifcommit) public function integer save (ref string arg_msg, boolean arg_ifcommit) public function integer p_update_cost (long arg_mtrlwareid, long arg_printid, string arg_mtrlcode, ref decimal arg_ref_cost, ref string arg_msg, boolean arg_ifcommit) public function integer uof_update_waredate (boolean arg_ifcommit, ref string arg_msg) public function integer p_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit) public function integer c_p_auditing (ref string arg_msg, boolean arg_ifcommit) public function integer uof_set_qty_equal_bqty (long arg_outwareid, ref string arg_msg, boolean arg_ifcommit) public function integer uof_mod_indate (long arg_outwareid, datetime arg_indate, ref string arg_msg) public function integer uof_noauditingqty_add (ref string arg_msg) public function integer uof_noauditingqty_del (long arg_outwareid, ref string arg_msg) public function integer acceptmx (long arg_mtrlwareid, decimal arg_qty, decimal arg_price, ref string arg_msg, long arg_printid, string arg_mxdscrp, string arg_unit, decimal arg_uqty, decimal arg_rate, string arg_newlocation, integer arg_ifrel, long arg_relid, long arg_relprintid, string arg_relcode) end prototypes public function integer add_dscrp (string arg_newdescppart, ref string arg_msg);//add_dscrp(string arg_newdescppart) //0 fail 1 success int rslt=1 arg_newdescppart=trim(arg_newdescppart) if it_updatebegin or it_newbegin then rslt=0 arg_msg="编辑状态下不可用" goto ext end if update u_outware_move set dscrp = dscrp+' '+:arg_newdescppart where u_outware_move.outwareid = :outwareid; if sqlca.sqlcode<>0 then rollback ; rslt=0 arg_msg="因网络或其它原因导致添加单据备注操作失败"+"~n"+sqlca.sqlerrtext goto ext end if commit; dscrp = dscrp+' '+arg_newdescppart ext: return (rslt) end function public function integer p_clearmx ();//INT p_clearmx() //清除明细 il_newlocation_cnt = 0 it_mxbt = 0 it_mxbt_barcode = 0 it_mxbt_barcode_in = 0 RETURN 1 end function public function integer p_reset ();//int p_reset() //清除对象及其明细 outwareid = 0 outwarecode = '' flag = 0 relcode = '' sstorageid = 0 dstorageid = 0 outrep = '' dscrp = '' d_auditflag = 0 ifauto = 0 it_newbegin = FALSE it_updatebegin = FALSE //清除明细 p_clearmx() RETURN 1 end function public function integer p_getinfo (long arg_outwareid, ref string arg_msg);//getinfo(arg_outwareid,string arg_msg) //0 失败 1成功 Int rslt = 1 IF arg_outwareid <= 0 THEN rslt = 0 arg_msg = "非法调拨单唯一码" GOTO ext END IF SELECT u_outware_move.outwarecode, u_outware_move.opdate, u_outware_move.operator, u_outware_move.flag, u_outware_move.auditingdate, u_outware_move.auditingrep, u_outware_move.moddate, u_outware_move.modrep, u_outware_move.outdate, u_outware_move.indate, u_outware_move.outrep, u_outware_move.dscrp, u_outware_move.sstorageid, u_outware_move.dstorageid, u_outware_move.relcode, u_outware_move.d_auditflag, u_outware_move.d_auditingdate, u_outware_move.d_auditingrep, u_outware_move.ifauto, u_outware_move.priceflag Into :outwarecode, :opdate, :operator, :flag, :auditingdate, :auditingrep, :moddate, :modrep, :outdate, :indate, :outrep, :dscrp, :sstorageid, :dstorageid, :relcode, :d_auditflag, :d_auditingdate, :d_auditingrep, :ifauto, :priceflag From u_outware_move Where u_outware_move.outwareid = :arg_outwareid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败(错误出仓单唯一码),调拨单" GOTO ext END IF SELECT scid INTO :sscid FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败(原仓库分部),调拨单" GOTO ext END IF SELECT scid INTO :dscid FROM u_storage Where storageid = :dstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败(目标仓库分部),调拨单" GOTO ext END IF ext: IF rslt = 0 THEN p_reset() RETURN rslt end function public function integer newbegin (ref string arg_msg);//newbegin(INT arg_billtype,long arg_relid) //从置对象,设定业务类型与关联ID,准备建立新出仓单 //0 fail 1 success LONG RSLT=1,CNT=0 p_reset() it_newbegin=TRUE it_updatebegin=FALSE //EXT: IF RSLT=0 THEN p_reset() return RSLT end function public function integer getinfo (long arg_outwareid, ref string arg_msg);//getinfo(long arg_outwareid,string arg_msg) //0 失败 1成功 Int rslt = 1 Long i = 1,no_mxcheck = 0 Long k = 1,no_mxcheck_barcode = 0 Long j = 1,no_mxcheck_barcode_in = 0 Int li_outtype,li_outtype_in IF arg_outwareid <= 0 THEN rslt = 0 arg_msg = "非法调拨仓单唯一码" GOTO ext END IF IF p_getinfo(arg_outwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF SELECT outtype INTO :li_outtype FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败,调出仓库出仓类型,"+sqlca.SQLErrText GOTO ext END IF SELECT outtype INTO :li_outtype_in FROM u_storage Where storageid = :dstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败,调入仓库出仓类型,"+sqlca.SQLErrText GOTO ext END IF //用游标读取明细 DECLARE cur_outwaermx CURSOR FOR SELECT u_outwaremovemx.mtrlwareid, u_outwaremovemx.mtrlid, u_outwaremovemx.storageid, u_outwaremovemx.qty, u_outwaremovemx.cost, u_outwaremovemx.price, u_mtrldef.mtrlcode, u_outwaremovemx.printid, u_outwaremovemx.mxdscrp, u_outwaremovemx.status, u_outwaremovemx.plancode, u_outwaremovemx.scid, u_outwaremovemx.dxflag, u_outwaremovemx.sptid, u_outwaremovemx.woodcode, u_outwaremovemx.pcode, u_outwaremovemx.unit, u_outwaremovemx.uqty, u_outwaremovemx.rate, u_outwaremovemx.mtrlcuscode, u_outwaremovemx.location, u_outwaremovemx.newlocation, u_outwaremovemx.inqty, u_outwaremovemx.outqty, u_mtrldef.outtype, u_outwaremovemx.ifrel, u_outwaremovemx.relid, u_outwaremovemx.relprintid, u_outwaremovemx.relcode FROM u_outwaremovemx,u_mtrldef WHERE u_outwaremovemx.outwareid = :arg_outwareid AND u_outwaremovemx.mtrlid = u_mtrldef.mtrlid Order By u_outwaremovemx.printid; OPEN cur_outwaermx; FETCH cur_outwaermx INTO :outwaremx[i].mtrlwareid,:outwaremx[i].mtrlid, :outwaremx[i].storageid,:outwaremx[i].qty, :outwaremx[i].cost,:outwaremx[i].price, :outwaremx[i].mtrlcode,:outwaremx[i].printid, :outwaremx[i].mxdscrp,:outwaremx[i].status, :outwaremx[i].plancode,:outwaremx[i].scid, :outwaremx[i].dxflag,:outwaremx[i].sptid, :outwaremx[i].woodcode,:outwaremx[i].pcode, :outwaremx[i].unit,:outwaremx[i].uqty, :outwaremx[i].rate,:outwaremx[i].mtrlcuscode, :outwaremx[i].Location,:outwaremx[i].newlocation, :outwaremx[i].inqty,:outwaremx[i].outqty,:outwaremx[i].outtype_mtrl, :outwaremx[i].ifrel,:outwaremx[i].relid,:outwaremx[i].relprintid,:outwaremx[i].relcode; DO WHILE sqlca.SQLCode = 0 i++ FETCH cur_outwaermx INTO :outwaremx[i].mtrlwareid,:outwaremx[i].mtrlid, :outwaremx[i].storageid,:outwaremx[i].qty, :outwaremx[i].cost,:outwaremx[i].price, :outwaremx[i].mtrlcode,:outwaremx[i].printid, :outwaremx[i].mxdscrp,:outwaremx[i].status, :outwaremx[i].plancode,:outwaremx[i].scid, :outwaremx[i].dxflag,:outwaremx[i].sptid, :outwaremx[i].woodcode,:outwaremx[i].pcode, :outwaremx[i].unit,:outwaremx[i].uqty, :outwaremx[i].rate,:outwaremx[i].mtrlcuscode, :outwaremx[i].Location,:outwaremx[i].newlocation, :outwaremx[i].inqty,:outwaremx[i].outqty,:outwaremx[i].outtype_mtrl, :outwaremx[i].ifrel,:outwaremx[i].relid,:outwaremx[i].relprintid,:outwaremx[i].relcode; LOOP CLOSE cur_outwaermx; //检验明细是否读入完整 SELECT count(*) INTO :no_mxcheck FROM u_outwaremovemx Where u_outwaremovemx.outwareid = :arg_outwareid; IF sqlca.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 //用游标读取调出条码明细 If (li_outtype = 2 Or li_outtype_in = 2 Or li_outtype_in = 3 ) And uo_option_barcode_outwaremove_paudit = 0 Or & li_outtype = 2 And uo_option_barcode_outwaremove_paudit = 1 THEN DECLARE cur_outwaremx_barcode CURSOR FOR SELECT u_outwaremx_mx_barcode.barcode, u_outwaremx_mx_barcode.qty FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :arg_outwareid AND //u_outwaremx_mx_barcode.scid = 0 AND u_outwaremx_mx_barcode.billtype = 50 Order By u_outwaremx_mx_barcode.barcode; OPEN cur_outwaremx_barcode; FETCH cur_outwaremx_barcode Into :s_mx_barcode[k].barcode,:s_mx_barcode[k].qty; DO WHILE sqlca.SQLCode = 0 k++ FETCH cur_outwaremx_barcode Into :s_mx_barcode[k].barcode,:s_mx_barcode[k].qty; LOOP CLOSE cur_outwaremx_barcode; //检验明细是否读入完整 SELECT count(*) INTO :no_mxcheck_barcode FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :arg_outwareid //AND u_outwaremx_mx_barcode.scid = 0 And u_outwaremx_mx_barcode.billtype = 50; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败,调仓单调出条码明细数量" GOTO ext END IF IF k <> (no_mxcheck_barcode+1) THEN rslt = 0 arg_msg = "查询操作失败,调仓单调出条码明细" GOTO ext END IF it_mxbt_barcode = k - 1 END IF //调入条码明细 IF (li_outtype_in = 2 Or li_outtype_in = 3) And uo_option_barcode_outwaremove_paudit = 1 THEN DECLARE cur_outwaremx_barcode_in CURSOR FOR SELECT u_outwaremx_mx_barcode.barcode, u_outwaremx_mx_barcode.qty FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :arg_outwareid AND //u_outwaremx_mx_barcode.scid = 0 AND u_outwaremx_mx_barcode.billtype = 53 Order By u_outwaremx_mx_barcode.barcode; OPEN cur_outwaremx_barcode_in; FETCH cur_outwaremx_barcode_in Into :s_mx_barcode_in[j].barcode,:s_mx_barcode_in[j].qty; DO WHILE sqlca.SQLCode = 0 j++ FETCH cur_outwaremx_barcode_in Into :s_mx_barcode_in[j].barcode,:s_mx_barcode_in[j].qty; LOOP CLOSE cur_outwaremx_barcode_in; //检验明细是否读入完整 SELECT count(*) INTO :no_mxcheck_barcode_in FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :arg_outwareid //AND u_outwaremx_mx_barcode.scid = 0 And u_outwaremx_mx_barcode.billtype = 53; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败,调仓单调入条码明细数量" GOTO ext END IF IF j <> (no_mxcheck_barcode_in+1) THEN rslt = 0 arg_msg = "查询操作失败,调仓单调入条码明细" GOTO ext END IF it_mxbt_barcode_in = j - 1 END IF outwareid = arg_outwareid it_mxbt = i - 1 it_newbegin = False it_updatebegin = False ext: IF rslt = 0 THEN p_reset() RETURN rslt end function public function integer updatebegin (long arg_outwareid, ref string arg_msg);//updatebegin(long arg_outwareid,int arg_billtype,long arg_relid) //从置对象,设定业务类型与关联id,准备更新出仓单 //0 fail 1 success Int rslt = 1,cnt = 0 IF uo_option_barcode_outwaremove_paudit = -1000 THEN rslt = 0 arg_msg = '选项:[204]仓库使用条码流程,仓库调拨单使用先确认扫描后审核流程,读取初始默认值失败,操作取消!' GOTO ext END IF IF arg_outwareid <= 0 THEN rslt = 0 outwareid = 0 GOTO ext END IF rslt = p_getinfo(arg_outwareid,arg_msg) IF rslt = 0 THEN GOTO ext IF uo_option_barcode_outwaremove_paudit = 1 THEN IF priceflag = 1 THEN rslt = 0 arg_msg = '单据已经确认,不可以修改' GOTO ext END IF IF it_mxbt_barcode > 0 THEN arg_msg = '单据已扫描条码,不能修改,如果修改请先清除已扫描条码' rslt = 0 GOTO ext END IF END IF IF flag = 1 THEN rslt = 0 arg_msg = '单据已经审核,不可以修改' GOTO ext END IF outwareid = arg_outwareid p_clearmx() it_newbegin = FALSE it_updatebegin = TRUE ext: IF rslt = 0 THEN p_reset() RETURN rslt end function public function integer ss_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);//调仓单调出审核 Int rslt = 1 Long cnt = 0,i,j,mx_barcode_cnt Long rst_outwareid //调拨出仓id Long s_scid Int li_outtype IF uo_option_inout_type = -1000 THEN rslt = 0 arg_msg = '选项:[142]进出仓高级选项,读取初始默认值失败,操作取消!' GOTO ext END IF IF uo_option_barcode_outwaremove_paudit = -1000 THEN rslt = 0 arg_msg = '选项:[204]仓库使用条码流程,仓库调拨单使用先确认扫描后审核流程,读取初始默认值失败,操作取消!' GOTO ext END IF uo_outware uo_out uo_out = Create uo_outware uo_out.commit_transaction = sqlca uo_out.if_getid_ture = False uo_saletask uo_task uo_task = Create uo_saletask uo_task.commit_transaction = sqlca IF outwareid = 0 THEN rslt = 0 arg_msg = "没有审核对象" GOTO ext END IF SELECT scid,outtype INTO :s_scid,:li_outtype FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询调出仓库所属分部资料,出仓类型失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF IF uo_option_inout_type = 2 And uo_option_barcode_outwaremove_paudit = 1 THEN IF priceflag = 0 THEN arg_msg = '单据未确认,不能调出审核' rslt = 0 GOTO ext END IF END IF IF flag = 1 THEN rslt = 0 arg_msg = "单据已经调出审核" GOTO ext END IF FOR i = 1 To it_mxbt IF li_outtype = 2 And outwaremx[i].outtype_mtrl = 2 THEN mx_barcode_cnt++ IF outwaremx[i].qty <> outwaremx[i].outqty THEN arg_msg = '明细行:'+String(i)+',调出数与调拨数不相符,请检查' rslt = 0 GOTO ext END IF NEXT IF li_outtype = 2 And mx_barcode_cnt > 0 And it_mxbt_barcode = 0 THEN rslt = 0 arg_msg = "单据调出未扫描条码,请检查" GOTO ext END IF UPDATE u_outware_move SET auditingrep = :arg_auditingrep, auditingdate = getdate(), flag = 1 WHERE u_outware_move.outwareid = :outwareid AND flag = 0 And d_auditflag = 0; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致调出审核单据操作失败"+"~n"+sqlca.SQLErrText GOTO ext ELSEIF sqlca.SQLNRows = 0 THEN rslt = 0 arg_msg = "调仓单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText GOTO ext END IF Decimal ld_ref_cost FOR i = 1 To it_mxbt ld_ref_cost = 0 IF p_update_cost(outwaremx[i].mtrlwareid,outwaremx[i].printid,& outwaremx[i].mtrlcode,ld_ref_cost,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF outwaremx[i].cost = ld_ref_cost NEXT //2.原事务生成出仓单 IF uo_out.newbegin(s_scid,12,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF uo_out.relid = outwareid uo_out.outdate = outdate uo_out.outrep = outrep uo_out.part = outwarecode uo_out.dscrp = dscrp uo_out.cusname = '调拨出仓' uo_out.storageid = sstorageid FOR i = 1 To it_mxbt IF uo_out.acceptmx(outwaremx[i].mtrlwareid,& outwaremx[i].qty,outwaremx[i].cost,1,& outwaremx[i].mxdscrp,outwaremx[i].printid,arg_msg,0,0,0,0,'',0,0,& outwaremx[i].unit,outwaremx[i].uqty,outwaremx[i].rate,'','',0,0,'',0,0,0,0,'','') = 0 THEN rslt = 0 GOTO ext END IF NEXT IF uo_out.Save(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF rst_outwareid = uo_out.outwareid //条码 IF li_outtype = 2 THEN FOR j = 1 To it_mxbt_barcode IF uo_out.uof_outbarcode_add(12,s_scid,rst_outwareid,& s_mx_barcode[j].barcode,s_mx_barcode[j].qty,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF NEXT END IF //4.原事务审核出仓单 IF uo_out.getinfo(s_scid,rst_outwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF uo_out.auditing(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //更新库存已开单数(减) IF uof_noauditingqty_del(outwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //完成分部需求单 FOR i = 1 To it_mxbt IF outwaremx[i].relid > 0 THEN IF uo_task.addmxcmpl(sscid,outwaremx[i].relid,outwaremx[i].relprintid,outwaremx[i].uqty,arg_msg,False) <> 1 THEN arg_msg = '行:'+String(i)+','+arg_msg rslt = 0 GOTO ext END IF IF uo_task.trycmplsaletask(sscid,outwaremx[i].relid,arg_msg,False) = 0 THEN arg_msg = '行:'+String(i)+','+arg_msg rslt = 0 GOTO ext END IF END IF NEXT flag = 1 ext: IF rslt = 0 THEN ROLLBACK; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT; END IF Destroy uo_out Destroy uo_task RETURN rslt end function public function integer c_ds_auditing (ref string arg_msg, boolean arg_ifcommit); Long rslt = 1,cnt = 0,i Long rst_inwareid //调拨进仓id Long o_scid Long mx_barcode_cnt Int li_outtype_out,li_outtype_in DateTime null_dt SetNull(null_dt) uo_inware uo_in uo_in = Create uo_inware uo_in.commit_transaction = sqlca uo_in.if_getid_ture = False IF outwareid = 0 THEN rslt = 0 arg_msg = "没有撤审对象" GOTO ext END IF IF d_auditflag = 0 THEN rslt = 0 arg_msg = "单据未调入审核" GOTO ext END IF SELECT outtype INTO :li_outtype_out FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询调出仓库出仓策略失败,"+sqlca.SQLErrText GOTO ext END IF SELECT outtype INTO :li_outtype_in FROM u_storage Where storageid = :dstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询调出仓库出仓策略失败,"+sqlca.SQLErrText GOTO ext END IF //限制条码调入撤审清除条码库存id问题 FOR i = 1 To it_mxbt IF li_outtype_in = 2 And outwaremx[i].outtype_mtrl = 2 THEN mx_barcode_cnt++ NEXT IF li_outtype_in = 2 And li_outtype_out = 2 And mx_barcode_cnt > 0 THEN rslt = 0 arg_msg = '单据已调入审核,明细包含条码不允许撤审,请开仓库调拨单调回' GOTO ext END IF // UPDATE u_outware_move SET d_auditingrep = '', d_auditingdate = :null_dt, d_auditflag = 0 WHERE u_outware_move.outwareid = :outwareid And d_auditflag = 1; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致调入撤审单据操作失败"+"~n"+sqlca.SQLErrText GOTO ext ELSEIF sqlca.SQLNRows = 0 THEN rslt = 0 arg_msg = "调仓单据正在调入撤审,请稍后查询。"+"~n"+sqlca.SQLErrText GOTO ext END IF SELECT scid INTO :o_scid FROM u_storage Where storageid = :dstorageid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询调入仓库所属分部资料失败' rslt = 0 GOTO ext END IF //查询调仓单相关的入仓单 SELECT inwareid INTO :rst_inwareid FROM u_inware WHERE scid = :o_scid AND relid = :outwareid And billtype = 12; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询该调仓单相关入仓单失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF //撤审入仓单,再删除 IF uo_in.getinfo(o_scid,rst_inwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF uo_in.c_auditing(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF uo_in.del(o_scid,rst_inwareid,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF Long ll_scid,ll_mtrlwareid //更新条码调出仓的库存id,注释原因:如果开了条码库存配置调整单,找不到调出条码的库存id //IF li_outtype_in = 2 And li_outtype_out = 2 And mx_barcode_cnt > 0 THEN // FOR i = 1 To it_mxbt_barcode // ll_scid = 0 // ll_mtrlwareid = 0 // SELECT u_mtrlware.scid,u_mtrlware.mtrlwareid // INTO :ll_scid,:ll_mtrlwareid // FROM u_mtrlware,u_getbar,u_mtrlware_mx // WHERE u_mtrlware.storageid = :sstorageid // AND u_mtrlware_mx.barcode = :s_mx_barcode[i].barcode // AND u_getbar.getbarid = u_mtrlware_mx.getbarid // AND u_mtrlware.mtrlid = u_getbar.mtrlid // AND ( u_mtrlware.sptid = u_getbar.cusid AND :li_storagetype_storage = 0 OR // u_mtrlware.sptid = 0 AND :li_storagetype_storage = 1 ) // AND u_mtrlware.status = u_getbar.status // AND u_mtrlware.woodcode = u_getbar.woodcode // AND u_mtrlware.pcode = u_getbar.pcode // AND u_mtrlware.plancode = u_getbar.plancode // AND ( u_mtrlware.mtrlcuscode = u_getbar.mtrlcuscode AND :li_storagetype_storage = 0 OR // u_mtrlware.mtrlcuscode = '' AND :li_storagetype_storage = 1 ) // And u_mtrlware.Location = u_getbar.Location Using commit_transaction; // IF commit_transaction.SQLCode <> 0 THEN // arg_msg = '条码:'+s_mx_barcode[i].barcode+',查询库存资料失败,请检查对应条码单与库存资料,'+commit_transaction.SQLErrText // rslt = 0 // GOTO ext // END IF // NEXT //END IF d_auditflag = 0 ext: IF rslt = 0 THEN ROLLBACK; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT; END IF Destroy uo_in RETURN rslt end function public function integer c_ss_auditing (ref string arg_msg, boolean arg_ifcommit);Long rslt = 1,cnt = 0,i Long rst_outwareid //调拨出仓id Long s_scid DateTime null_dt SetNull(null_dt) uo_outware uo_out uo_out = Create uo_outware uo_out.commit_transaction = sqlca uo_out.if_getid_ture = False uo_saletask uo_task uo_task = Create uo_saletask uo_task.commit_transaction = sqlca If outwareid = 0 Then rslt = 0 arg_msg = "没有撤审对象" Goto ext End If If flag = 0 Then rslt = 0 arg_msg = "单据未调出审核" Goto ext End If If d_auditflag = 1 Then rslt = 0 arg_msg = "单据已调入审核" Goto ext End If Update u_outware_move Set auditingrep = '', auditingdate = :null_dt, flag = 0 Where u_outware_move.outwareid = :outwareid And flag = 1 And d_auditflag = 0; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "因网络或其它原因导致调出撤审单据操作失败"+"~n"+sqlca.SQLErrText Goto ext ElseIf sqlca.SQLNRows = 0 Then rslt = 0 arg_msg = "调仓单据正在调出撤审,请稍后查询。"+"~n"+sqlca.SQLErrText Goto ext End If Select scid Into :s_scid From u_storage Where storageid = :sstorageid; If sqlca.SQLCode <> 0 Then arg_msg = '查询调出仓库所属分部资料失败' rslt = 0 Goto ext End If //查询调仓单相关的入仓单,出仓单 Select outwareid Into :rst_outwareid From u_outware Where scid = :s_scid And relid = :outwareid And billtype = 12; If sqlca.SQLCode <> 0 Then arg_msg = '查询该调仓单相关出仓单失败,'+sqlca.SQLErrText rslt = 0 Goto ext End If //撤审出仓单,再删除 If uo_out.getinfo(s_scid,rst_outwareid,arg_msg) = 0 Then rslt = 0 Goto ext End If If uo_out.c_auditing(False,arg_msg) = 0 Then rslt = 0 Goto ext End If If uo_out.del(s_scid,rst_outwareid,0,arg_msg,False) = 0 Then rslt = 0 Goto ext End If //增加已开单数 If uof_noauditingqty_add(arg_msg) = 0 Then rslt = 0 Goto ext End If //完成分部需求单 FOR i = 1 To it_mxbt IF outwaremx[i].relid > 0 THEN IF uo_task.addmxcmpl(sscid,outwaremx[i].relid,outwaremx[i].relprintid,0 - outwaremx[i].uqty,arg_msg,False) <> 1 THEN arg_msg = '行:'+String(i)+','+arg_msg rslt = 0 GOTO ext END IF IF uo_task.trycmplsaletask(sscid,outwaremx[i].relid,arg_msg,False) = 0 THEN arg_msg = '行:'+String(i)+','+arg_msg rslt = 0 GOTO ext END IF END IF NEXT flag = 0 ext: If rslt = 0 Then Rollback; ElseIf rslt = 1 And arg_ifcommit Then Commit; End If Destroy uo_out Destroy uo_task Return rslt end function public function integer ds_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);//调仓单调入审核 Int rslt = 1 Long cnt = 0,i,j Long rst_inwareid //调拨进仓id Long o_scid Int li_outtype Long mx_barcode_cnt uo_inware uo_in uo_in = Create uo_inware uo_in.commit_transaction = sqlca uo_in.if_getid_ture = False IF outwareid = 0 THEN rslt = 0 arg_msg = "没有审核对象" GOTO ext END IF IF flag = 0 THEN rslt = 0 arg_msg = "单据还未调出审核" GOTO ext END IF IF d_auditflag = 1 THEN rslt = 0 arg_msg = "单据已经调入审核" GOTO ext END IF SELECT scid,outtype INTO :o_scid,:li_outtype FROM u_storage Where storageid = :dstorageid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询调入仓库所属分部资料,出仓类型失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF FOR i = 1 To it_mxbt IF outwaremx[i].inqty <> outwaremx[i].outqty THEN arg_msg = '明细行:'+String(i)+',调出数与调入数不相符,请检查' rslt = 0 GOTO ext END IF NEXT UPDATE u_outware_move SET d_auditingrep = :arg_auditingrep, d_auditingdate = getdate(), d_auditflag = 1 WHERE u_outware_move.outwareid = :outwareid AND d_auditflag = 0 And flag = 1; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致审核单据操作失败"+"~n"+sqlca.SQLErrText GOTO ext ELSEIF sqlca.SQLNRows = 0 THEN rslt = 0 arg_msg = "调仓单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText GOTO ext END IF //3.目标事务建立进仓单 DateTime server_datetime SELECT Top 1 getdate() Into :server_datetime From u_user; //取得系统时间,借用操作员表 IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询目标仓库日期失败" GOTO ext END IF IF uo_in.newbegin(o_scid,12,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF uo_in.relid = outwareid uo_in.indate = indate uo_in.inrep = outrep uo_in.part = outwarecode uo_in.dscrp = dscrp uo_in.storageid = dstorageid uo_in.sptname = '调拨进仓' Decimal ld_uprice FOR i = 1 To it_mxbt ld_uprice = 0 ld_uprice = outwaremx[i].price * outwaremx[i].rate IF uo_in.acceptmx(outwaremx[i].printid,& outwaremx[i].mtrlid,& outwaremx[i].mtrlcode,& outwaremx[i].plancode,& outwaremx[i].status,& outwaremx[i].uqty,& ld_uprice,& 1,& outwaremx[i].mxdscrp,& arg_msg,& 0,0,0,outwaremx[i].woodcode,& outwaremx[i].pcode,& outwaremx[i].sptid,& outwaremx[i].unit,& outwaremx[i].rate,& outwaremx[i].qty,0,0,'','',0,0,& outwaremx[i].mtrlcuscode,& outwaremx[i].newlocation,& outwaremx[i].uqty,& 0) = 0 THEN rslt = 0 GOTO ext END IF NEXT IF uo_in.Save(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF rst_inwareid = uo_in.inwareid //条码 //条码 IF li_outtype = 2 Or li_outtype = 3 THEN IF uo_option_barcode_outwaremove_paudit = 0 THEN FOR j = 1 To it_mxbt_barcode IF uo_in.uof_inbarcode_add(12,o_scid,rst_inwareid,0,& s_mx_barcode[j].barcode,s_mx_barcode[j].qty,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF NEXT ELSE FOR j = 1 To it_mxbt_barcode_in IF uo_in.uof_inbarcode_add(12,o_scid,rst_inwareid,0,& s_mx_barcode_in[j].barcode,s_mx_barcode_in[j].qty,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF NEXT END IF END IF // //4.原事务审核进仓单 IF uo_in.getinfo(o_scid,rst_inwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF uo_in.auditing(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF uof_update_waredate(False,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF d_auditflag = 1 ext: IF rslt = 0 THEN ROLLBACK; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT; END IF Destroy uo_in RETURN rslt end function public function integer cancel (long arg_outwareid, ref string arg_msg, boolean arg_ifcommit);//cancel() //如果单据还没有审核删除单据极其明细 //0 FAIL, 1 SUCCESS Int rslt = 1 If arg_outwareid <= 0 Then rslt = 0 arG_MSG = "没有删除对象,操作取消" Goto ext End If rslt = p_getinfo(arg_outwareid,arG_MSG) If rslt = 0 Then Goto ext If priceflag = 1 Then rslt = 0 arG_MSG = "单据已经确认,不可以删除" Goto ext End If If flag = 1 Then rslt = 0 arG_MSG = "单据已经调出审核,不可以删除" Goto ext End If If d_auditflag = 1 Then rslt = 0 arG_MSG = "单据已经调入审核,不可以删除" Goto ext End If //更新库存已开单数(减) If uof_noauditingqty_del(arg_outwareid,arG_MSG) = 0 Then rslt = 0 Goto ext End If Delete From u_outwaremx_mx_barcode Where u_outwaremx_mx_barcode.outwareid = :arg_outwareid And u_outwaremx_mx_barcode.scid = 0 And u_outwaremx_mx_barcode.billtype = 50; If sqlca.SQLCode <> 0 Then rslt = 0 arG_MSG = "删除单据条码明细操作失败"+"~n"+sqlca.SQLErrText Goto ext End If Delete From u_outwaremx_mx_barcode Where u_outwaremx_mx_barcode.outwareid = :arg_outwareid And u_outwaremx_mx_barcode.scid = 0 And u_outwaremx_mx_barcode.billtype = 53; If sqlca.SQLCode <> 0 Then rslt = 0 arG_MSG = "删除单据条码明细操作失败"+"~n"+sqlca.SQLErrText Goto ext End If Delete From u_outwaremovemx Where u_outwaremovemx.outwareid = :arg_outwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arG_MSG = "删除进仓单明细操作失败"+"~n"+sqlca.SQLErrText Rollback; Goto ext End If Delete From u_outware_move Where u_outware_move.outwareid = :arg_outwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arG_MSG = "删除进仓单操作失败"+"~n"+sqlca.SQLErrText Rollback; Goto ext End If Commit; it_newbegin = False it_updatebegin = False ext: If rslt = 0 Then Rollback; ElseIf rslt = 1 And arg_ifcommit Then Commit; End If p_reset() Return (rslt) end function public function integer save (ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1 Long cnt = 0,i DateTime server_datetime Long ls_newid Decimal ld_inqty,ld_outqty Int li_outtype_storage_s If uo_option_barcode_outwaremove_paudit = -1000 Then rslt = 0 arg_msg = '选项:[204]仓库使用条码流程,仓库调拨单使用先确认扫描后审核流程,读取初始默认值失败,操作取消!' Goto ext End If If IsNull(dscrp) Then dscrp = '' If IsNull(outrep) Then outrep = '' If IsNull(relcode) Then relcode = '' If IsNull(ifauto) Then ifauto = 0 If it_newbegin = False And it_updatebegin = False Then rslt = 0 arg_msg = "非编辑状态不可以提交" Goto ext End If Select Top 1 getdate() Into :server_datetime From u_user ; //取得系统时间,借用操作员表 If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "查询操作失败,日期 " Goto ext End If If it_mxbt = 0 Then //如果输入库存物料资料错则已经清空 rslt = 0 arg_msg = "没有正确出仓内容" Goto ext End If If outrep = '' Then rslt = 0 arg_msg = '请输入经手人' Goto ext End If If f_rst_storage_outtype(sstorageid,li_outtype_storage_s) = 0 Then arg_msg = '查询调出仓库出仓策略失败,请检查' rslt = 0 Goto ext End If If f_check_inoutdate(sstorageid,outdate,True,arg_msg) = 0 Then rslt = 0 Goto ext End If If f_check_inoutdate(dstorageid,outdate,True,arg_msg) = 0 Then rslt = 0 Goto ext End If //检查仓位 cnt = 0 Select count(*) Into :cnt From u_storage Where storageid = :sstorageid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "查询操作失败,调出仓库" Goto ext End If If cnt = 0 Then rslt = 0 arg_msg = "调出仓库未登记或已取消" Goto ext End If cnt = 0 Select count(*) Into :cnt From u_storage Where storageid = :dstorageid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "查询操作失败,调入仓库" Goto ext End If If cnt = 0 Then rslt = 0 arg_msg = "调入仓库未登记或已取消" Goto ext End If opdate = server_datetime //填写单据建立时间(最近修改时间) ////////////////////////////////////////////// //开始区分:新建/更新 处理 If outwareid = 0 Then //新建 ls_newid = f_sys_scidentity(0,"u_outware_move","outwareid",arg_msg,True,id_sqlca) If ls_newid <= 0 Then rslt = 0 Goto ext End If outwarecode = getid(0,"MV",Date(server_datetime),if_getid_ture,sqlca) //取得新单据编号 If outwarecode = "err" Then outwarecode = '' rslt = 0 arg_msg = "无法获取出仓单编号" Goto ext End If Insert Into u_outware_move ( outwareid, outwarecode, sstorageid, dstorageid, opdate, operator, flag, outdate, indate, outrep, dscrp, relcode, ifauto) Values ( :ls_newid, :outwarecode, :sstorageid, :dstorageid, getdate(), :publ_operator, :flag, :outdate, :indate, :outrep, :dscrp, :relcode, :ifauto) ; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "因网络或其它原因导致插入操作失败"+"~n"+sqlca.SQLErrText Goto ext End If outwareid = ls_newid For i = 1 To it_mxbt If uo_option_barcode_outwaremove_paudit = 0 Then ld_inqty = outwaremx[i].qty ld_outqty = outwaremx[i].qty Else If li_outtype_storage_s = 2 And outwaremx[i].outtype_mtrl = 2 Then ld_inqty = 0 ld_outqty = 0 Else ld_inqty = outwaremx[i].qty ld_outqty = outwaremx[i].qty End If End If Insert Into u_outwaremovemx (outwareid, mtrlwareid, mtrlid, storageid, qty, cost, price, printid, mxdscrp, scid, status, plancode, dxflag, sptid, woodcode, pcode, unit, uqty, rate, mtrlcuscode, location, newlocation, inqty, outqty, ifrel, relid, relprintid, relcode) Values (:ls_newid, :outwaremx[i].mtrlwareid, :outwaremx[i].mtrlid, :outwaremx[i].storageid, :outwaremx[i].qty, :outwaremx[i].cost, :outwaremx[i].price, :outwaremx[i].printid, :outwaremx[i].mxdscrp, :outwaremx[i].scid, :outwaremx[i].status, :outwaremx[i].plancode, :outwaremx[i].dxflag, :outwaremx[i].sptid, :outwaremx[i].woodcode, :outwaremx[i].pcode, :outwaremx[i].unit, :outwaremx[i].uqty, :outwaremx[i].rate, :outwaremx[i].mtrlcuscode, :outwaremx[i].location, :outwaremx[i].newlocation, :ld_inqty, :ld_outqty, :outwaremx[i].ifrel, :outwaremx[i].relid, :outwaremx[i].relprintid, :outwaremx[i].relcode); If sqlca.SQLCode <> 0 Then outwareid = 0 //还原outwareid rslt = 0 arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText Goto ext End If Next //更新库存已开单数 If uof_noauditingqty_add(arg_msg) = 0 Then rslt = 0 Goto ext End If Else //////////////////////////////////////////////// //更新 Update u_outware_move Set outdate = :outdate, indate = :indate, outrep = :outrep, dscrp = :dscrp, sstorageid = :sstorageid, dstorageid = :dstorageid, relcode = :relcode, moddate = getdate(), modrep = :publ_operator Where u_outware_move.outwareid = :outwareid And flag = 0; If sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 Then rslt = 0 arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText Goto ext End If //更新库存已开单数(减) If uof_noauditingqty_del(outwareid,arg_msg) = 0 Then rslt = 0 Goto ext End If //删除原有明细 Delete From u_outwaremovemx Where u_outwaremovemx.outwareid = :outwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText Goto ext End If For i = 1 To it_mxbt If uo_option_barcode_outwaremove_paudit = 0 Then ld_inqty = outwaremx[i].qty ld_outqty = outwaremx[i].qty Else If li_outtype_storage_s = 2 And outwaremx[i].outtype_mtrl = 2 Then ld_inqty = 0 ld_outqty = 0 Else ld_inqty = outwaremx[i].qty ld_outqty = outwaremx[i].qty End If End If Insert Into u_outwaremovemx ( outwareid, mtrlwareid, mtrlid, storageid, qty, cost, price, printid, mxdscrp, scid, status, plancode, dxflag, sptid, woodcode, pcode, unit, uqty, rate, mtrlcuscode, location, newlocation, inqty, outqty, ifrel, relid, relprintid, relcode) Values (:outwareid, :outwaremx[i].mtrlwareid, :outwaremx[i].mtrlid, :outwaremx[i].storageid, :outwaremx[i].qty, :outwaremx[i].cost, :outwaremx[i].price, :outwaremx[i].printid, :outwaremx[i].mxdscrp, :outwaremx[i].scid, :outwaremx[i].status, :outwaremx[i].plancode, :outwaremx[i].dxflag, :outwaremx[i].sptid, :outwaremx[i].woodcode, :outwaremx[i].pcode, :outwaremx[i].unit, :outwaremx[i].uqty, :outwaremx[i].rate, :outwaremx[i].mtrlcuscode, :outwaremx[i].location, :outwaremx[i].newlocation, :ld_inqty, :ld_outqty, :outwaremx[i].ifrel, :outwaremx[i].relid, :outwaremx[i].relprintid, :outwaremx[i].relcode); If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText Goto ext End If Next If uof_noauditingqty_add(arg_msg) = 0 Then rslt = 0 Goto ext End If End If it_newbegin = False it_updatebegin = False ext: If rslt = 0 Then Rollback; p_clearmx() ElseIf arg_ifcommit And rslt = 1 Then Commit; End If Return(rslt) end function public function integer p_update_cost (long arg_mtrlwareid, long arg_printid, string arg_mtrlcode, ref decimal arg_ref_cost, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Decimal ld_cost Long ll_storagescid SELECT scid INTO :ll_storagescid FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询仓库分部失败'+ sqlca.SQLErrText GOTO ext END IF SELECT cost INTO :ld_cost FROM u_mtrlware WHERE storageid = :sstorageid AND mtrlwareid = :arg_mtrlwareid AND scid = :ll_storagescid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询行:'+string(arg_printid)+',物料:'+arg_mtrlcode+'库存成本价失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF arg_ref_cost = ld_cost UPDATE u_outwaremovemx SET cost = :ld_cost, price = :ld_cost WHERE outwareid = :outwareid and scid = :ll_storagescid AND mtrlwareid = :arg_mtrlwareid; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询行:'+string(arg_printid)+',物料:'+arg_mtrlcode+'出仓成本价失败,'+sqlca.SQLErrText rslt = 0 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 uof_update_waredate (boolean arg_ifcommit, ref string arg_msg);Int rslt = 1 DateTime ld_waredate,ld_auditingdate,ld_waradate_mx String ls_auditdate,ls_waredate Long i Long ll_mtrlid,ll_sptid,ll_mtrlwareid String ls_status,ls_woodcode ,ls_pcode,ls_plancode String ls_mtrlcuscode,ls_location DateTime ld_waredate_max Long o_scid,s_scid Int li_ifout_notfind_ware,li_o_storagetype Int li_ifpack,li_ifpackpro Select d_Auditingdate Into :ld_auditingdate From u_outware_move Where outwareid = :outwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询单据审核时间失败,'+sqlca.SQLErrText Goto ext End If ls_auditdate = String(ld_auditingdate,'yyyy-mm-dd hh:mm') Select scid,storagetype Into :o_scid,:li_o_storagetype From u_storage Where storageid = :dstorageid; If sqlca.SQLCode <> 0 Then arg_msg = '查询调入仓库所属分部资料失败' rslt = 0 Goto ext End If Select scid Into :s_scid From u_storage Where storageid = :sstorageid; If sqlca.SQLCode <> 0 Then arg_msg = '查询调出仓库所属分部资料失败' rslt = 0 Goto ext End If For i = 1 To it_mxbt If outwaremx[i].uqty = 0 Or outwaremx[i].qty = 0 Then Continue ll_mtrlid = outwaremx[i].mtrlid ll_sptid = outwaremx[i].sptid ls_status = outwaremx[i].status ls_woodcode = outwaremx[i].woodcode ls_pcode = outwaremx[i].pcode ls_plancode = outwaremx[i].plancode ls_mtrlcuscode = outwaremx[i].mtrlcuscode ls_location = outwaremx[i].newlocation ll_mtrlwareid = outwaremx[i].mtrlwareid Select waredate Into :ld_waredate From u_mtrlware Where scid = :s_scid And mtrlwareid = :ll_mtrlwareid; If sqlca.SQLCode = -1 Then rslt = 0 arg_msg = '明细行:'+String(i)+',查询调出库存最近进仓日期失败,'+sqlca.SQLErrText Goto ext ElseIf sqlca.SQLCode = 100 Then li_ifout_notfind_ware = 1 End If Select ifpack,ifpackpro Into :li_ifpack,:li_ifpackpro From u_mtrldef Where mtrlid = :ll_mtrlid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '明细行:'+String(i)+',查询物料属性失败,'+sqlca.SQLErrText Goto ext End If If li_o_storagetype = 1 and li_ifpack <> 2 and li_ifpackpro <> 2 and li_ifpackpro <> 4 Then ll_sptid = 0 ls_mtrlcuscode = '' End If Select waredate Into :ld_waradate_mx From u_mtrlware Where scid = :o_scid And storageid = :dstorageid And mtrlid = :ll_mtrlid And sptid = :ll_sptid And status = :ls_status And woodcode = :ls_woodcode And pcode = :ls_pcode And plancode = :ls_plancode And mtrlcuscode = :ls_mtrlcuscode And Location = :ls_location; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '明细行:'+String(i)+',查询调入新库存最近进仓日期失败,错误:'+String(sqlca.SQLCode)+','+sqlca.SQLErrText Goto ext End If ls_waredate = String(ld_waradate_mx,'yyyy-mm-dd hh:mm') If ls_auditdate = ls_waredate Or li_ifout_notfind_ware = 1 Then Update u_mtrlware Set waredate = :ld_waredate Where scid = :o_scid And storageid = :dstorageid And mtrlid = :ll_mtrlid And sptid = :ll_sptid And status = :ls_status And woodcode = :ls_woodcode And pcode = :ls_pcode And plancode = :ls_plancode And mtrlcuscode = :ls_mtrlcuscode And Location = :ls_location; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '明细行:'+String(i)+',更新调入库存最近进仓日期失败,'+sqlca.SQLErrText Goto ext End If End If Next ext: If rslt = 0 Then Rollback; ElseIf rslt = 1 And arg_ifcommit Then Commit; End If Return rslt end function public function integer p_auditing (string arg_auditingrep, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 IF outwareid = 0 THEN rslt = 0 arg_msg = "没有审核对象" GOTO ext END IF IF priceflag = 1 THEN arg_msg = '单据已确认,请检查' rslt = 0 GOTO ext END IF UPDATE u_outware_move SET priceemp = :arg_auditingrep, pricedate = getdate(), priceflag = 1 WHERE u_outware_move.outwareid = :outwareid AND priceflag = 0; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致确认单据操作失败"+"~n"+sqlca.SQLErrText GOTO ext ELSEIF sqlca.SQLNRows = 0 THEN rslt = 0 arg_msg = "调仓单据正在确认,请稍后查询。"+"~n"+sqlca.SQLErrText GOTO ext END IF priceflag = 1 ext: IF rslt = 0 THEN ROLLBACK; ELSEIF rslt = 1 AND arg_ifcommit THEN COMMIT; END IF RETURN rslt end function public function integer c_p_auditing (ref string arg_msg, boolean arg_ifcommit);Long rslt = 1 DateTime null_dt SetNull(null_dt) IF outwareid = 0 THEN rslt = 0 arg_msg = "没有撤审对象" GOTO ext END IF IF flag = 1 THEN rslt = 0 arg_msg = "单据已调出审核" GOTO ext END IF UPDATE u_outware_move SET priceemp = '', pricedate = :null_dt, priceflag = 0 WHERE u_outware_move.outwareid = :outwareid AND priceflag = 1 AND flag = 0; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "因网络或其它原因导致取消确认单据操作失败"+"~n"+sqlca.SQLErrText GOTO ext ELSEIF sqlca.SQLNRows = 0 THEN rslt = 0 arg_msg = "调仓单据正在取消确认,请稍后查询。"+"~n"+sqlca.SQLErrText GOTO ext END IF DELETE FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :outwareid AND u_outwaremx_mx_barcode.scid = 0 AND u_outwaremx_mx_barcode.billtype = 50; IF sqlca.SQLCode <> 0 THEN rslt = 0 arG_MSG = "删除单据条码明细操作失败"+"~n"+sqlca.SQLErrText GOTO ext END IF DELETE FROM u_outwaremx_mx_barcode WHERE u_outwaremx_mx_barcode.outwareid = :outwareid AND u_outwaremx_mx_barcode.scid = 0 AND u_outwaremx_mx_barcode.billtype = 53; IF sqlca.SQLCode <> 0 THEN rslt = 0 arG_MSG = "删除单据条码明细操作失败"+"~n"+sqlca.SQLErrText GOTO ext END IF priceflag = 0 ext: IF rslt = 0 THEN ROLLBACK; ELSEIF rslt = 1 AND arg_ifcommit THEN COMMIT; END IF RETURN rslt end function public function integer uof_set_qty_equal_bqty (long arg_outwareid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Int li_ref_outtype IF arg_outwareid <= 0 THEN arg_msg = '错误的单据id' rslt = 0 GOTO ext END IF IF p_getinfo(arg_outwareid,arg_msg) = 0 THEN rslt = 0 GOTO ext END IF IF f_rst_storage_outtype(sstorageid,li_ref_outtype) = 0 THEN arg_msg = '查询仓库出仓策略失败,请检查仓库资料' rslt = 0 GOTO ext END IF IF li_ref_outtype <> 2 THEN arg_msg = '仓库出仓策略不是使用条码出仓,操作取消,请检查仓库资料' rslt = 0 GOTO ext END IF IF priceflag = 0 THEN arg_msg = '单据未确认,操作取消' rslt = 0 GOTO ext END IF IF flag = 1 THEN arg_msg = '单据已仓审,操作取消' rslt = 0 GOTO ext END IF UPDATE u_outwaremovemx SET u_outwaremovemx.uqty = u_outwaremovemx.outqty, u_outwaremovemx.qty = u_outwaremovemx.outqty FROM u_outwaremovemx,u_mtrldef WHERE u_outwaremovemx.mtrlid = u_mtrldef.mtrlid AND u_outwaremovemx.outwareid = :arg_outwareid AND u_mtrldef.outtype = 2; IF sqlca.SQLCode <> 0 THEN arg_msg = '更新明细条码调拨数到明细调出数失败,'+sqlca.SQLErrText rslt = 0 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 uof_mod_indate (long arg_outwareid, datetime arg_indate, ref string arg_msg);Int rslt = 1 rslt = p_getinfo(arg_outwareid,arg_msg) IF rslt = 0 THEN GOTO ext IF flag = 0 THEN rslt = 0 arg_msg = '单据未调出审核,不可以操作' GOTO ext END IF IF d_auditflag = 1 THEN rslt = 0 arg_msg = '单据已经调入审核,不可以操作' GOTO ext END IF IF Date(arg_indate) < Date(outdate) THEN arg_msg = '不合理调出日期,调出日期大于调入日期' rslt = 0 GOTO ext END IF UPDATE u_outware_move SET indate = :arg_indate Where u_outware_move.outwareid = :arg_outwareid; IF sqlca.SQLCode <> 0 THEN ROLLBACK ; rslt = 0 arg_msg = "因网络或其它原因导致更新调入日期操作失败"+"~n"+sqlca.SQLErrText GOTO ext END IF COMMIT; ext: Return (rslt) end function public function integer uof_noauditingqty_add (ref string arg_msg);If uo_option_noauditingqty_mode = 0 Then Return 1 Int rslt = 1 Long i For i = 1 To it_mxbt Update u_mtrlware Set noauditingqty = noauditingqty + :outwaremx[i].qty, noauditinguqty = noauditingqty + :outwaremx[i].uqty Where scid = :outwaremx[i].scid And mtrlwareid = :outwaremx[i].mtrlwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '物料:'+String(outwaremx[i].mtrlcode)+',更新明细库存已开单数失败 '+sqlca.SQLErrText Goto ext End If Next ext: Return rslt end function public function integer uof_noauditingqty_del (long arg_outwareid, ref string arg_msg);If uo_option_noauditingqty_mode = 0 Then Return 1 Int rslt = 1 Long i,ll_i i = 1 s_outwaremx arg_s_mx[] Declare cur_outwaremx Cursor For Select u_outwaremovemx.scid, u_outwaremovemx.mtrlwareid, u_outwaremovemx.qty, u_outwaremovemx.uqty, u_mtrldef.mtrlcode From u_outwaremovemx,u_mtrldef Where u_outwaremovemx.outwareid = :arg_outwareid And u_outwaremovemx.mtrlid = u_mtrldef.mtrlid Order By u_outwaremovemx.printid; Open cur_outwaremx; Fetch cur_outwaremx Into :arg_s_mx[i].scid,:arg_s_mx[i].mtrlwareid, :arg_s_mx[i].qty,:arg_s_mx[i].uqty,:arg_s_mx[i].mtrlcode; Do While sqlca.SQLCode = 0 i++ Fetch cur_outwaremx Into :arg_s_mx[i].scid,:arg_s_mx[i].mtrlwareid, :arg_s_mx[i].qty,:arg_s_mx[i].uqty,:arg_s_mx[i].mtrlcode; Loop Close cur_outwaremx; For ll_i = 1 To i - 1 Update u_mtrlware Set noauditingqty = noauditingqty - :arg_s_mx[ll_i].qty, noauditinguqty = noauditingqty - :arg_s_mx[ll_i].uqty Where scid = :arg_s_mx[ll_i].scid And mtrlwareid = :arg_s_mx[ll_i].mtrlwareid; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '物料:'+String(arg_s_mx[ll_i].mtrlcode)+',更新明细库存已开单数失败 '+sqlca.SQLErrText Goto ext End If Next ext: Return rslt end function public function integer acceptmx (long arg_mtrlwareid, decimal arg_qty, decimal arg_price, ref string arg_msg, long arg_printid, string arg_mxdscrp, string arg_unit, decimal arg_uqty, decimal arg_rate, string arg_newlocation, integer arg_ifrel, long arg_relid, long arg_relprintid, string arg_relcode);Long rslt = 1,cnt = 0,ls_i,j Long i_mtrlid,i_storageid,i_scid String i_mtrlcode,i_status,i_plancode,i_woodcode,i_pcode String ls_mtrlcuscode,ls_location Decimal i_cost Int i_dxflag Long i_sptid Decimal i_notauditqty,i_allouseqty String ls_unit String ls_relcode Decimal lde_noconqty, ld_saletqty_task, ld_consignedqty_task, lde_mx_qty, lde_notauditqty Long ll_mtrlid_task String ls_status_task, ls_woodcode_task, ls_pcode_task Int li_status_ck, li_woodcode_ck, li_pcode_ck IF uo_option_barcodelocation_use_inwaremx_location = -1000 THEN rslt = 0 arg_msg = '选项:[287]条码进仓仓位使用进仓单扫描仓位,读取初始默认值失败,操作取消!' GOTO ext END IF IF it_newbegin = False And it_updatebegin = False THEN rslt = 0 arg_msg = "非编辑状态不可以使用,操作取消" GOTO ext END IF //清除空值 IF IsNull(arg_mtrlwareid) THEN arg_mtrlwareid = 0 IF IsNull(arg_qty) THEN arg_qty = 0 IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = '' IF IsNull(arg_unit) THEN arg_unit = '' IF IsNull(arg_printid) THEN arg_printid = 0 IF IsNull(arg_price) THEN arg_price = 0 IF IsNull(arg_uqty) THEN arg_uqty = 0 IF IsNull(arg_rate) THEN arg_rate = 0 IF IsNull(arg_newlocation) THEN arg_newlocation = '' IF IsNull(arg_ifrel) THEN arg_ifrel = 0 IF IsNull(arg_relid) THEN arg_relid = 0 IF IsNull(arg_relprintid) THEN arg_relprintid = 0 IF IsNull(arg_relcode) THEN arg_relcode = '' IF arg_mtrlwareid = 0 Or arg_qty = 0 THEN // 如果出仓数量为 0,或物料编号为空,则不作任何处理 rslt = 1 GOTO ext END IF IF arg_uqty = 0 And arg_rate = 0 THEN rslt = 1 GOTO ext END IF IF arg_uqty = 0 THEN arg_rate = 1 ELSE arg_rate = arg_qty / arg_uqty END IF //检查物料库存id SELECT u_mtrlware.mtrlid, u_mtrlware.storageid, u_mtrlware.cost, u_mtrldef.mtrlcode, u_mtrlware.plancode, u_mtrlware.status, u_mtrlware.scid, u_mtrlware.dxflag, u_mtrlware.sptid, u_mtrlware.woodcode, u_mtrlware.pcode, u_mtrlware.noauditingqty, u_mtrlware.noallocqty, u_mtrldef.unit, u_mtrlware.mtrlcuscode, u_mtrlware.location INTO :i_mtrlid, :i_storageid, :i_cost, :i_mtrlcode, :i_plancode, :i_status, :i_scid, :i_dxflag, :i_sptid, :i_woodcode, :i_pcode, :i_notauditqty, :i_allouseqty, :ls_unit, :ls_mtrlcuscode, :ls_location FROM u_mtrlware ,u_mtrldef WHERE ( u_mtrlware.mtrlwareid = :arg_mtrlwareid ) AND ( u_mtrlware.mtrlid = u_mtrldef.mtrlid ) And ( u_mtrlware.storageid = :sstorageid ); IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = "查询操作失败,库存编号(仓库调拨单)错误,仓库:"+String(sstorageid)+'库存:'+String(arg_mtrlwareid)+',~n'+sqlca.SQLErrText GOTO ext END IF IF IsNull(i_cost) THEN i_cost = 0 IF IsNull(i_mtrlid) THEN i_mtrlid = 0 IF IsNull(i_storageid) THEN i_storageid = 0 IF IsNull(i_status) THEN i_status = '' IF IsNull(i_woodcode) THEN i_woodcode = '' IF IsNull(i_pcode) THEN i_pcode = '' IF IsNull(i_plancode) THEN i_plancode = '' IF IsNull(i_scid) THEN i_scid = 0 IF IsNull(i_dxflag) THEN i_dxflag = 0 IF IsNull(i_sptid) THEN i_sptid = 0 IF IsNull(ls_mtrlcuscode) THEN ls_mtrlcuscode = '' IF IsNull(ls_location) THEN ls_location = '' //IF ls_unit <> arg_unit AND arg_rate = 1 THEN // arg_msg = '行:'+String(arg_printid)+',物料库存单位与采购单位不同,但转换率为1,请检查' // rslt = 0 // GOTO ext //END IF IF ls_unit = arg_unit And arg_rate <> 1 THEN arg_msg = '行:'+String(arg_printid)+',物料库存单位与采购单位相同,但转换率不为1,请检查' rslt = 0 GOTO ext END IF IF arg_price * arg_rate < 0 THEN rslt = 0 arg_msg = '行:'+String(arg_printid)+",单价错误" GOTO ext END IF //*****检查大于未开数不可以开单 IF flag = 0 THEN Int ls_noallocflag SELECT noallocflag INTO :ls_noallocflag FROM u_storage Where storageid = :sstorageid; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询仓库允许使用未开单库存属性失败'+sqlca.SQLErrText GOTO ext END IF Decimal ol_mtrl_qty = 0 IF ls_noallocflag = 1 THEN IF it_updatebegin THEN SELECT sum(u_outwaremovemx.qty) INTO :ol_mtrl_qty FROM u_outwaremovemx WHERE u_outwaremovemx.outwareid = :outwareid And u_outwaremovemx.mtrlwareid = :arg_mtrlwareid; IF sqlca.SQLCode = -1 THEN rslt = 0 arg_msg = '查询原开单数量失败' GOTO ext END IF END IF IF IsNull(ol_mtrl_qty) THEN ol_mtrl_qty = 0 IF arg_qty > ( i_allouseqty - i_notauditqty + ol_mtrl_qty ) THEN rslt = 0 arg_msg = String(i_mtrlcode)+"库存未开单数不够,不能开单.未开单数{"+String(i_allouseqty - i_notauditqty + ol_mtrl_qty,'#####,0.00##')+"}" GOTO ext END IF END IF END IF FOR ls_i = 1 To it_mxbt IF outwaremx[ls_i].mtrlwareid = arg_mtrlwareid And & outwaremx[ls_i].newlocation <> arg_newlocation THEN rslt = 0 arg_msg = '第'+String(arg_printid)+'行存在相同的库存,但调入仓位下相同,不能在同1张单建立,请检查' GOTO ext END IF IF outwaremx[ls_i].mtrlwareid = arg_mtrlwareid THEN outwaremx[ls_i].qty = outwaremx[ls_i].qty + arg_qty outwaremx[ls_i].uqty = outwaremx[ls_i].uqty + arg_uqty rslt = 1 GOTO ext END IF NEXT IF arg_ifrel = 0 THEN arg_relid = 0 arg_relprintid = 0 arg_relcode = '' ELSE IF arg_relid = 0 THEN rslt = 0 arg_msg = '第'+String(arg_printid)+'行,请选择相应分部需求单' GOTO ext END IF SELECT u_saletask.taskcode, u_saletaskmx.saleqty - u_saletaskmx.consignedqty , u_saletaskmx.mtrlid, u_saletaskmx.status, u_saletaskmx.woodcode, u_saletaskmx.pcode, u_saletaskmx.saleqty, u_saletaskmx.consignedqty INTO :ls_relcode, :lde_noconqty, :ll_mtrlid_task, :ls_status_task, :ls_woodcode_task, :ls_pcode_task, :ld_saletqty_task, :ld_consignedqty_task FROM u_saletaskmx,u_saletask WHERE u_saletaskmx.taskid = :arg_relid AND u_saletaskmx.scid = :i_scid AND u_saletaskmx.scid = u_saletask.scid AND u_saletaskmx.printid = :arg_relprintid And u_saletaskmx.taskid = u_saletask.taskid ; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询分部需求单是否有物料:'+i_mtrlcode+'失败' rslt = 0 GOTO ext END IF IF ll_mtrlid_task <> i_mtrlid THEN arg_msg = '第'+String(arg_printid)+'行,分部需求单:'+ls_relcode+',产品:'+i_mtrlcode+' 与库存信息(物料id)不匹配,不允许保存,请检查相关分部需求单与库存信息' rslt = 0 GOTO ext END IF SELECT Top 1 CASE when ltrim(rtrim(:i_status)) = ltrim(rtrim(:ls_status_task)) THEN 0 ELSE 1 END, CASE when ltrim(rtrim(:i_woodcode)) = ltrim(rtrim(:ls_woodcode_task)) THEN 0 ELSE 1 END, CASE when ltrim(rtrim(:i_pcode)) = ltrim(rtrim(:ls_pcode_task)) THEN 0 ELSE 1 END Into :li_status_ck,:li_woodcode_ck,:li_pcode_ck From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN arg_msg = '第'+String(arg_printid)+'行,分部需求单:'+ls_relcode+',产品:'+i_mtrlcode+',3个配置信息与库存3个配置信息是否相同失败,'+sqlca.SQLErrText rslt = 0 GOTO ext END IF IF li_status_ck + li_woodcode_ck + li_pcode_ck > 0 THEN arg_msg = '第'+String(arg_printid)+'行,分部需求单:'+ls_relcode+',产品:'+i_mtrlcode+' 与库存信息不匹配,不允许保存,请检查相关分部需求单与库存信息' rslt = 0 GOTO ext END IF lde_mx_qty = 0 FOR ls_i = 1 To it_mxbt IF i_mtrlid = outwaremx[ls_i].mtrlid And & arg_relid = outwaremx[ls_i].relid And & arg_relprintid = outwaremx[ls_i].relprintid And & i_status = outwaremx[ls_i].status And & i_woodcode = outwaremx[ls_i].woodcode And & i_pcode = outwaremx[ls_i].pcode THEN lde_mx_qty = lde_mx_qty + outwaremx[ls_i].qty END IF NEXT lde_mx_qty = lde_mx_qty + arg_qty //查询相关订单已开发货单未审核数量 SELECT isnull(sum(qty),0) INTO :lde_notauditqty FROM u_outwaremovemx,u_outware_move WHERE u_outwaremovemx.relid = :arg_relid AND u_outwaremovemx.relprintid = :arg_relprintid AND u_outware_move.flag = 0 AND u_outwaremovemx.outwareid = u_outware_move.outwareid AND u_outware_move.outwareid <> :outwareid Using sqlca; IF sqlca.SQLCode <> 0 THEN arg_msg = '查询分部需求单:'+ls_relcode+'产品:'+i_mtrlcode+'已开单未审核数量失败' rslt = 0 GOTO ext END IF IF lde_notauditqty + lde_mx_qty > lde_noconqty THEN arg_msg = '分部需求单:'+ls_relcode+' 产品:'+i_mtrlcode+'未完成数:'+String(lde_noconqty,'#,##0.##########')+',已开单未审核数:'+String(lde_notauditqty,'#,##0.##########')+'不能再开单:'+String(lde_mx_qty,'#,##0.##########') rslt = 0 GOTO ext END IF END IF //*********************************************** //yyx20150428 IF uo_option_barcodelocation_use_inwaremx_location = 1 THEN IF it_mxbt = 0 THEN il_newlocation_cnt = 1 ELSE FOR j = 1 To it_mxbt IF trim(arg_newlocation) <> trim(outwaremx[j].newlocation) THEN il_newlocation_cnt++ END IF NEXT END IF if il_newlocation_cnt <> 1 then arg_msg = '系统开启了[287]条码进仓仓位使用进仓单扫描仓位 系统选项,调拨明细的新仓位多于1个,不能保存单据。~n' arg_msg += '如果调拨明细的新仓位多于1个,请分开建立调拨单。~n' rslt = 0 goto ext end if END IF //写入内容 it_mxbt++ outwaremx[it_mxbt].scid = i_scid outwaremx[it_mxbt].mtrlwareid = arg_mtrlwareid outwaremx[it_mxbt].mtrlid = i_mtrlid outwaremx[it_mxbt].qty = arg_qty outwaremx[it_mxbt].unit = arg_unit outwaremx[it_mxbt].uqty = arg_uqty outwaremx[it_mxbt].rate = arg_rate outwaremx[it_mxbt].storageid = i_storageid outwaremx[it_mxbt].cost = i_cost outwaremx[it_mxbt].mtrlcode = i_mtrlcode outwaremx[it_mxbt].printid = arg_printid outwaremx[it_mxbt].mxdscrp = arg_mxdscrp outwaremx[it_mxbt].status = i_status outwaremx[it_mxbt].plancode = i_plancode outwaremx[it_mxbt].dxflag = i_dxflag outwaremx[it_mxbt].sptid = i_sptid outwaremx[it_mxbt].woodcode = i_woodcode outwaremx[it_mxbt].pcode = i_pcode outwaremx[it_mxbt].price = arg_price outwaremx[it_mxbt].mtrlcuscode = ls_mtrlcuscode outwaremx[it_mxbt].Location = ls_location outwaremx[it_mxbt].newlocation = arg_newlocation outwaremx[it_mxbt].ifrel = arg_ifrel outwaremx[it_mxbt].relid = arg_relid outwaremx[it_mxbt].relprintid = arg_relprintid outwaremx[it_mxbt].relcode = arg_relcode ext: IF rslt = 0 THEN p_clearmx() Return(rslt) end function on uo_outware_move.create call super::create TriggerEvent( this, "constructor" ) end on on uo_outware_move.destroy TriggerEvent( this, "destructor" ) call super::destroy end on event constructor;String str_optionvalue,arg_msg f_get_sys_option_value('204',str_optionvalue,arg_msg) uo_option_barcode_outwaremove_paudit = Long(str_optionvalue) f_get_sys_option_value('142',str_optionvalue,arg_msg) uo_option_inout_type = Long(str_optionvalue) f_get_sys_option_value('390',str_optionvalue,arg_msg) uo_option_noauditingqty_mode = Long(str_optionvalue) f_get_sys_option_value('287',str_optionvalue,arg_msg) uo_option_barcodelocation_use_inwaremx_location = Long(str_optionvalue) end event