123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931 |
- $PBExportHeader$uo_incase.sru
- forward
- global type uo_incase from nonvisualobject
- end type
- type s_incasemx_array from structure within uo_incase
- end type
- type s_incasemx from structure within uo_incase
- end type
- end forward
- type s_incasemx from structure
- long mtrlid
- string mtrlstatus
- string pfcode
- string mtrlmode
- string packunit
- long printid
- decimal { 10 } qty
- decimal { 10 } packqty
- decimal { 10 } grossweight
- string mxdscrp
- decimal { 10 } netweight
- decimal { 10 } cubage
- integer ifson_flag
- long fathermtrlid
- string packsize
- string packcode
- decimal { 10 } price
- long relid
- long relprintid
- string relcode
- string mxdscrp2
- string mxdscrp3
- string status
- string woodcode
- string pcode
- decimal { 10 } onepackqty
- end type
- global type uo_incase from nonvisualobject
- end type
- global uo_incase uo_incase
- type variables
- PUBLIC PROTECTEDWRITE Long scid = 0
- PUBLIC PROTECTEDWRITE Long incaseID = 0
- PUBLIC PROTECTEDWRITE String incaseCode = ''
- PUBLIC PROTECTEDWRITE DateTime opdate
- PUBLIC PROTECTEDWRITE String operator = ''
- PUBLIC PROTECTEDWRITE String Permit_emp = ''//审核操作员
- public protectedwrite datetime moddate //修改时间,自动
- public protectedwrite string modemp //修改操作员
- public protectedwrite int flag=0 //审核标志
- public protectedwrite datetime auditingdate //审核时间
- Long relid = 0
- Long custID = 0
- String Assign_emp
- DateTime incasedate
- String dscrp
- string relcode
- string freight
- string freight_tele
- Transaction commit_transaction
- PRIVATE:
- s_incasemx incasemx[] //明细结构数组
- Long it_MXBT = 0 //明细结构数组末指针
- Boolean IT_NEWBEGIN = FALSE //新建标志
- Boolean IT_UPDATEBEGIN = FALSE//修改标志
- end variables
- forward prototypes
- public function integer p_reset ()
- public function integer p_clearmx ()
- public function integer newbegin (long arg_scid, ref string arg_msg)
- public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit)
- public function integer updatebegin (long arg_scid, long arg_incased, ref string arg_msg)
- public function integer p_getinfo (long arg_scid, long arg_incaseid, ref string arg_msg)
- public function integer cancel (long arg_scid, long arg_incaseid, ref string arg_msg, boolean arg_ifcommit)
- public function integer add_dscrp (long arg_scid, long arg_incaseid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
- public function integer audit (long arg_scid, long arg_incaseid, string arg_emp, ref string arg_msg, boolean arg_ifcommit)
- public function integer cancelaudit (long arg_scid, long arg_incaseid, ref string arg_msg, boolean arg_ifcommit)
- public function integer getinfo (integer arg_scid, long arg_incaseid, ref string arg_msg)
- public function integer acceptmx (long arg_mtrlid, string arg_mtrlstatus, string arg_pfcode, decimal arg_qty, decimal arg_price, string arg_packunit, string arg_packcode, string arg_packsize, string arg_mxdscrp, decimal arg_packqty, ref string arg_msg, long arg_printid, decimal arg_grossweight, decimal arg_netweight, decimal arg_cubage, integer arg_ifson_flag, integer arg_fathermtrlid, long arg_relid, long arg_relprintid, string arg_relcode, string arg_mxdscrp2, string arg_mxdscrp3, decimal arg_onepackqty, string arg_status, string arg_woodcode, string arg_pcode)
- end prototypes
- public function integer p_reset ();//INT p_RESET()
- //清除对象及其明细
- scid = 0
- incaseID = 0
- incaseCode = ''
- relid = 0
- custID = 0
- Assign_emp = ''
- dscrp = ''
- relcode = ''
- freight = ''
- freight_tele = ''
- it_newbegin=FALSE
- it_updatebegin=FALSE
- //清除明细
- P_CLEARMX()
- RETURN 1
- end function
- public function integer p_clearmx ();//INT p_clearmx()
- //清除明细
- it_mxbt=0
- RETURN 1
- end function
- public function integer newbegin (long arg_scid, ref string arg_msg);//重置对象,设定业务类型与关联ID,准备建立新单
- //0 fail 1 success
- long rslt=1,CNT=0
- if arg_scid < 0 then
- arg_msg = '请选择分部'
- rslt = 0
- goto ext
- end if
- p_reset()
- it_newbegin=TRUE
- it_updatebegin=FALSE
- scid=arg_scid
- ext:
- if rslt = 0 then p_reset()
- return rslt
- end function
- public function integer save (string arg_operator, ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0,i
- DateTime server_dt
- Long ll_incaseid
- String ls_sccode
- IF IsNull(dscrp) THEN dscrp = ''
- IF IsNull(assign_emp) THEN assign_emp = ''
- IF IsNull(arg_operator) THEN arg_operator = ''
- //====================================================================
- // Script - save ( ref string arg_msg, boolean arg_ifcommit )
- // Reason:
- //--------------------------------------------------------------------
- // Modified By: yyx Date: 2004.02.20
- //--------------------------------------------------------------------
- //IF Len(dscrp) > 0 THEN dscrp = ' ' + dscrp
- //====================================================================
- operator = arg_operator
- IF it_newbegin = False And it_updatebegin = False THEN
- rslt = 0
- arG_MSG = "非编辑状态不可以提交"
- GOTO ext
- END IF
- IF Trim(assign_emp) = '' THEN
- rslt = 0
- arG_MSG = "请输入装箱单经手人"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_cust
- Where cusid = :custID Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "查询操作失败,客户资料"
- GOTO ext
- END IF
- IF cnt = 0 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
- IF Year(Date(incasedate)) < 2000 Or IsNull(incasedate) THEN
- rslt = 0
- arG_MSG = "缺少装箱发生时间或不合理"
- GOTO ext
- END IF
- IF DaysAfter(Date(String(server_dt,'yyyy-mm-dd')),Date(String(incasedate,'yyyy-mm-dd'))) > 30 THEN
- rslt = 0
- arG_MSG = '装箱单日期错误,日期不能超前系统日期'
- GOTO ext
- END IF
- IF DaysAfter(Date(String(incasedate,'yyyy-mm-dd')),Date(String(server_dt,'yyyy-mm-dd'))) > 30 THEN
- rslt = 0
- arG_MSG = '装箱单日期错误,日期不能落后系统日期'
- GOTO ext
- END IF
- IF it_mxbt = 0 THEN //如果输入物料资料错则已经清空
- rslt = 0
- arG_MSG = "没有正确装箱单单明细内容"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_user
- Where username = :operator Using commit_transaction ;
- IF commit_transaction.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_dt //填写单据建立时间(最近修改时间)
- //////////////////////////////////////////////// //开始区分:新建/更新 处理
- IF incaseID = 0 THEN //新建
-
- ll_incaseid = f_sys_scidentity(scid,"u_incase","incaseid",arG_MSG,True,id_sqlca) //数据commit事务)
- IF ll_incaseid <= 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- IF f_get_sccode(scid,commit_transaction,ls_sccode,arG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
-
- incaseCode = getid(scid,ls_sccode + 'ZX',Date(server_dt),False,commit_transaction)
- IF incaseCode = "err" THEN
- incaseCode = ''
- rslt = 0
- arG_MSG = "无法获取装箱单编号"+"~n"+commit_transaction.SQLErrText
- GOTO ext
- END IF
-
- INSERT INTO u_incase
- ( scid,
- incaseid,
- incaseCode,
- cusID,
- incasedate,
- Assign_Emp,
- relcode,
- Dscrp,
- opemp,
- opdate,
- relid,
- freight,
- freight_tele
- )
- VALUES ( :scid,
- :ll_incaseid,
- :incaseCode,
- :custID,
- :incasedate,
- :Assign_Emp,
- :relcode,
- :Dscrp,
- :operator,
- :server_dt,
- :relid,
- :freight,
- :freight_tele) Using commit_transaction ;
-
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致插入装箱单操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
-
- //读取新incaseid
- incaseID = ll_incaseid
-
-
- ELSE //////////////////////////////////////////////// //更新
- UPDATE u_incase
- SET cusID = :custID,
- incasedate = :incasedate,
- Assign_Emp = :Assign_Emp,
- Dscrp = :Dscrp,
- moddate = getdate(),
- Modemp = :publ_operator,
- relcode = :relcode,
- freight = :freight,
- freight_tele = :freight_tele
- WHERE u_incase.incaseid = :incaseID
- AND scid = :scid
- And flag = 0 Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 Or sqlca.SQLNRows <= 0 THEN
- rslt = 0
- arG_MSG = "因网络或其它原因导致更新装箱单操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
-
- //删除原有明细
- DELETE FROM u_incasemx
- Where u_incasemx.incaseID = :incaseID And scid = :scid Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- arG_MSG = "删除旧有明细操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK Using commit_transaction;
- GOTO ext
- END IF
- END IF
- FOR i = 1 To it_mxbt
- INSERT INTO u_incasemx
- ( scid,
- incaseid,
- mtrlid,
- mtrlstatus,
- pfcode,
- printid,
- packunit,
- packcode,
- packsize,
- qty,
- packqty,
- grossweight,
- netweight,
- cubage,
- ifson_flag,
- fathermtrlid,
- mxdscrp,
- price,
- relid,
- relprintid,
- relcode,
- mxdscrp2,
- mxdscrp3,
- onepackqty,
- status,
- woodcode,
- pcode)
- VALUES (:scid,
- :incaseID,
- :incasemx[i].mtrlid,
- :incasemx[i].mtrlstatus,
- :incasemx[i].pfcode,
- :incasemx[i].printid,
- :incasemx[i].packunit ,
- :incasemx[i].packcode,
- :incasemx[i].packsize ,
- :incasemx[i].qty,
- :incasemx[i].packqty,
- :incasemx[i].grossweight,
- :incasemx[i].netweight,
- :incasemx[i].cubage,
- :incasemx[i].ifson_flag,
- :incasemx[i].fathermtrlid,
- :incasemx[i].mxdscrp,
- :incasemx[i].price,
- :incasemx[I].relid,
- :incasemx[I].relprintid,
- :incasemx[I].relcode,
- :incasemx[I].mxdscrp2,
- :incasemx[I].mxdscrp3,
- :incasemx[I].onepackqty,
- :incasemx[I].status,
- :incasemx[I].woodcode,
- :incasemx[I].pcode) Using commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- IF it_newbegin THEN incaseID = 0 //还原incaseID
- rslt = 0
- arG_MSG = "因网络或其它原因导致插入明细操作失败"+"~n"+commit_transaction.SQLErrText
- //ROLLBACK USING commit_transaction;
- GOTO ext
- END IF
- NEXT
- it_newbegin = False
- it_updatebegin = False
- ext:
- IF rslt = 0 THEN
- p_clearmx()
- ROLLBACK Using commit_transaction;
- ELSEIF arg_ifcommit And rslt = 1 THEN
- COMMIT Using commit_transaction;
- END IF
- Return(rslt)
- end function
- public function integer updatebegin (long arg_scid, long arg_incased, ref string arg_msg);//UPDATEbegin(long arg_taskid,ref string arg_msg)
- //从置对象,设定业务类型与关联ID,准备更新进仓单
- //0 fail 1 success
- long rslt=1,CNT=0
- if arg_scid < 0 then
- arg_msg = '请选择分部'
- rslt = 0
- goto ext
- end if
- IF arg_incased<=0 THEN
- rslt=0
- ARG_MSG='错误装箱单唯一码'
- goto ext
- end if
- if p_getinfo(arg_scid,arg_incased,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- if flag=1 then
- rslt=0
- ARG_MSG='已经处于审核状态,不可以修改,要修改请先撤销审核'
- goto ext
- end if
- it_newbegin=FALSE
- it_updatebegin=TRUE
- p_clearmx() //清除明细
- scid=arg_scid
- incaseID=arg_incased
- ext:
- if rslt=0 then p_reset()
- return rslt
- end function
- public function integer p_getinfo (long arg_scid, long arg_incaseid, ref string arg_msg);Int rslt = 1
-
- SELECT
- incaseid,
- incasecode,
- cusid,
- incasedate,
- assign_emp,
- relcode,
- dscrp,
- opemp,
- opdate,
- flag
- INTO :incaseid,
- :incasecode,
- :custid,
- :incasedate,
- :assign_emp,
- :relcode,
- :dscrp,
- :operator,
- :opdate,
- :flag
- FROM u_incase
- Where u_incase.incaseid = :arg_incaseid AND
- u_incase.scid = :arg_scid USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = '查询装箱单内容失败(错误订单唯一码)'+sqlca.sqlerrtext
- GOTO ext
- END IF
- scid = arg_scid
- incaseID= arg_incaseid
- ext:
- RETURN rslt
- end function
- public function integer cancel (long arg_scid, long arg_incaseid, ref string arg_msg, boolean arg_ifcommit);//删除未审核的装箱单
- //0 FAIL, 1 SUCCESS
- INT rslt=1
- IF arg_incaseid<=0 THEN
- rslt=0
- ARG_MSG='错误装箱单唯一码'
- goto ext
- end if
- if p_getinfo(arg_scid,arg_incaseid,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- IF flag=1 THEN
- rslt=0
- arG_MSG="装箱单已经审核,不可以删除"
- goto ext
- END IF
- DELETE FROM u_incase
- WHERE u_incase.incaseid = :arg_incaseid and u_incase.scid=:arg_scid using commit_transaction;
- if commit_transaction.sqlcode<>0 then
- rslt=0
- arG_MSG="删除装箱单操作失败"+"~n"+commit_transaction.SQLErrText
- ROLLBACK using commit_transaction;
- goto ext
- end if
- DELETE FROM u_incasemx
- WHERE u_incasemx.incaseid = :arg_incaseid and u_incasemx.scid=:arg_scid using commit_transaction;
- if commit_transaction.sqlcode<>0 then
- rslt=0
- arG_MSG="删除装箱单明细操作失败"+"~n"+SQLCA.SQLErrText
- ROLLBACK using commit_transaction;
- goto ext
- end if
- it_newbegin=FALSE
- it_updatebegin=FALSE
- if arg_ifcommit then
- COMMIT using commit_transaction;
- end if
- EXT:
- p_reset()
- return (rslt)
- end function
- public function integer add_dscrp (long arg_scid, long arg_incaseid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);//add_dscrp(string arg_newdescppart)
- //0 fail 1 SUCCESS
- INT rslt=1
- arg_newdescppart=TRIM(arg_newdescppart)
- IF 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_scid,arg_incaseid,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- IF flag=0 THEN
- rslt=0
- arG_MSG="待审核状态下不可用"
- goto ext
- END IF
- UPDATE u_incase
- SET DSCRP = DSCRP+' '+:arg_newdescppart
- WHERE u_incase.incaseid = :arg_incaseid using commit_transaction;
- if commit_transaction.SQLCode<>0 then
- rslt=0
- arG_MSG="因网络或其它原因导致添加装箱单备注操作失败"+"~n"+commit_transaction.SQLErrText
- rollback using commit_transaction;
- goto ext
- end if
- DSCRP = DSCRP+' '+arg_newdescppart
- it_newbegin=FALSE
- it_updatebegin=FALSE
- EXT:
- if arg_ifcommit and rslt=1 then
- COMMIT using commit_transaction;
- end if
- p_reset()
- return (rslt)
- end function
- public function integer audit (long arg_scid, long arg_incaseid, string arg_emp, ref string arg_msg, boolean arg_ifcommit);
- Int rslt = 1,cnt = 0
- IF arg_incaseid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误装箱单唯一码'
- GOTO ext
- END IF
- IF getinfo(arg_scid,arg_incaseid,ARG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- IF flag = 1 THEN
- rslt = 0
- ARG_MSG = "装箱单已经审核,操作取消"
- GOTO ext
- END IF
- IF it_MXBT <= 0 THEN
- rslt = 0
- ARG_MSG = "装箱单明细错误,操作取消"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_user
- Where username = :arg_emp USING commit_transaction;
- IF commit_transaction.SQLCode <> 0 THEN
- rslt = 0
- ARG_MSG = "查询操作失败,操作员!"
- GOTO ext
- END IF
- IF cnt = 0 THEN
- rslt = 0
- ARG_MSG = "操作员姓名未登记或已取消!"
- GOTO ext
- END IF
- //更新审核标记
- UPDATE u_incase
- SET auditingrep = :arg_emp, auditingdate = getdate(),
- flag = 1
- Where u_incase.incaseid = :arg_incaseid AND u_incase.scid = :arg_scid AND u_incase.flag = 0 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 cancelaudit (long arg_scid, long arg_incaseid, ref string arg_msg, boolean arg_ifcommit);INT rslt=1,cnt=0
- datetime ls_auditingdate
- setnull(ls_auditingdate)
- IF arg_incaseid<=0 THEN
- rslt=0
- ARG_MSG='错误装箱单唯一码'
- goto ext
- end if
- if p_getinfo(arg_scid,arg_incaseid,arg_msg)=0 then
- rslt=0
- goto ext
- end if
- IF flag = 0 THEN
- rslt=0
- arG_MSG="装箱只有在已审核状态才可以执行撤消审核,请核对"
- goto ext
- END IF
- UPDATE u_incase
- SET flag = 0,auditingrep='',auditingdate=:ls_auditingdate
- WHERE u_incase.incaseid = :arg_incaseid and u_incase.scid=:arg_scid and u_incase.flag=1 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 getinfo (integer arg_scid, long arg_incaseid, ref string arg_msg);//getinfo(long arg_taskid,string arg_msg)
- //0 失败 1成功
- Int rslt = 1,I = 1,NO_MXCHECK = 0
- IF arg_incaseid <= 0 THEN
- rslt = 0
- ARG_MSG = '错误采购订单唯一码'
- GOTO ext
- END IF
- IF p_getinfo(arg_scid,arg_incaseid,ARG_MSG) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- //用游标读取明细
- DECLARE CUR_INCASEMX CURSOR FOR
- SELECT
- mtrlid,
- mtrlstatus,
- printid,
- packunit,
- pfcode,
- packcode,
- packsize,
- qty,
- packqty,
- grossweight,
- netweight,
- cubage,
- ifson_flag,
- fathermtrlid,
- mxDscrp,
- price,
- relid,
- relprintid,
- relcode
- FROM u_incasemx
- WHERE u_incasemx.INCASEid = :arg_incaseid AND
- u_incasemx.scid = :arg_scid
- order by u_incasemx.printid USING commit_transaction;
-
- OPEN CUR_INCASEMX;
- FETCH CUR_INCASEMX INTO :incasemx[I].mtrlid,:incasemx[I].mtrlstatus,:incasemx[I].printid,
- :incasemx[I].packunit,:incasemx[I].pfcode,
- :incasemx[I].packcode,:incasemx[I].packsize,:incasemx[I].qty,
- :incasemx[I].packqty,:incasemx[I].grossweight,:incasemx[I].netweight,
- :incasemx[I].cubage,:incasemx[I].ifson_flag,:incasemx[I].fathermtrlid,:incasemx[I].mxDscrp,
- :incasemx[I].price,:incasemx[I].relid,:incasemx[I].relprintid,:incasemx[I].relcode;
- DO WHILE commit_transaction.SQLCode = 0
- I++
- FETCH CUR_INCASEMX INTO :incasemx[I].mtrlid,:incasemx[I].mtrlstatus,:incasemx[I].printid,
- :incasemx[I].packunit,:incasemx[I].pfcode,
- :incasemx[I].packcode,:incasemx[I].packsize,:incasemx[I].qty,
- :incasemx[I].packqty,:incasemx[I].grossweight,:incasemx[I].netweight,
- :incasemx[I].cubage,:incasemx[I].ifson_flag,:incasemx[I].fathermtrlid,:incasemx[I].mxDscrp,
- :incasemx[I].price,:incasemx[I].relid,:incasemx[I].relprintid,:incasemx[I].relcode;
- LOOP
- CLOSE CUR_INCASEMX;
- //检验明细是否读入完整
- SELECT COUNT(*) INTO :NO_MXCHECK
- FROM u_incasemx
- WHERE u_incasemx.incaseid = :arg_incaseid AND
- u_incasemx.scid = :arg_scid 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
- it_mxbt = I - 1
- it_newbegin = FALSE
- it_updatebegin = FALSE
- ext:
- IF rslt = 0 THEN p_reset()
- RETURN rslt
- end function
- public function integer acceptmx (long arg_mtrlid, string arg_mtrlstatus, string arg_pfcode, decimal arg_qty, decimal arg_price, string arg_packunit, string arg_packcode, string arg_packsize, string arg_mxdscrp, decimal arg_packqty, ref string arg_msg, long arg_printid, decimal arg_grossweight, decimal arg_netweight, decimal arg_cubage, integer arg_ifson_flag, integer arg_fathermtrlid, long arg_relid, long arg_relprintid, string arg_relcode, string arg_mxdscrp2, string arg_mxdscrp3, decimal arg_onepackqty, string arg_status, string arg_woodcode, string arg_pcode);Long rslt = 1,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_fathermtrlid) THEN arg_fathermtrlid = 0
- IF IsNull(arg_qty) THEN arg_qty = 0
- IF IsNull(arg_price) THEN arg_qty = 0
- IF IsNull(arg_packqty) THEN arg_packqty = 0
- IF IsNull(arg_mtrlstatus) THEN arg_mtrlstatus = ''
- IF IsNull(arg_packunit) THEN arg_packunit = ''
- IF IsNull(arg_packcode) THEN arg_packcode = ''
- IF IsNull(arg_packsize) THEN arg_packsize = ''
- IF IsNull(arg_mxdscrp) THEN arg_mxdscrp = ''
- IF IsNull(arg_ifson_flag) THEN arg_ifson_flag = 0
- IF IsNull(arg_grossweight) THEN arg_grossweight = 0
- IF IsNull(arg_netweight) THEN arg_netweight = 0
- IF IsNull(arg_cubage) THEN arg_cubage = 0
- IF IsNull(arg_printid) THEN arg_printid = 0
- IF IsNull(arg_pfcode) THEN arg_pfcode = ''
- IF IsNull(arg_relid) THEN arg_relid = 0
- IF IsNull(arg_relprintid) THEN arg_relprintid = 0
- IF IsNull(arg_relcode) THEN arg_relcode = ''
- IF IsNull(arg_mxdscrp2) THEN arg_mxdscrp2 = ''
- IF IsNull(arg_mxdscrp3) THEN arg_mxdscrp3 = ''
- IF IsNull(arg_status) THEN arg_status = ''
- IF IsNull(arg_woodcode) THEN arg_woodcode = ''
- IF IsNull(arg_pcode) THEN arg_pcode = ''
- IF IsNull(arg_onepackqty) THEN arg_onepackqty = 0
- IF arg_mtrlid = 0 THEN // 如果物料编号为空,则不作任何处理
- rslt = 1
- GOTO ext
- END IF
- IF arg_printid = 0 THEN // 如果序号为空,则不作任何处理
- rslt = 1
- GOTO ext
- END IF
- ////检查物料ID
- //SELECT COUNT(*)
- // INTO :cnt
- // FROM u_mtrldef
- // Where u_mtrldef.mtrlid = :arg_mtrlid ;
- //IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arG_MSG = "查询操作失败,物料编号"
- // GOTO ext
- //END IF
- //
- //IF cnt = 0 THEN
- // rslt = 0
- // arG_MSG = "错误的构成配方: "+String(arg_mtrlstatus)
- // GOTO ext
- //END IF
- //
- ////检查配方
- //if arg_ifson_flag=1 then
- // cnt=0
- // select count(*)
- // into :cnt
- // from u_prdpf
- // where u_prdpf.mtrlid=:arg_fathermtrlid and u_prdpf.sonmtrlid=:arg_mtrlid;
- // IF sqlca.SQLCode <> 0 THEN
- // rslt = 0
- // arG_MSG = "查询操作失败,配方"
- // GOTO ext
- // END IF
- // IF cnt = 0 THEN
- // rslt = 0
- // arG_MSG = "错误的配方: "+string(arg_pfcode)+String(arg_mtrlstatus)
- // GOTO ext
- // END IF
- //end if
- //FOR LS_i = 1 TO it_mxbt //合并重复项(产品)
- // IF incasemx[it_mxbt].mtrlid = arg_mtrlid AND &
- // incasemx[it_mxbt].ifson_flag = arg_ifson_flag AND &
- // arg_ifson_flag = 0 THEN
- // rslt = 0
- // arG_MSG = "存在相同的产品,在"+incasemx[it_mxbt].mtrlstatus+",请自行手动合并"
- // GOTO ext
- // END IF
- //NEXT
- //写入内容
- it_mxbt++
- incasemx[it_mxbt].mtrlid = arg_mtrlid
- incasemx[it_mxbt].mtrlstatus = arg_mtrlstatus
- incasemx[it_mxbt].pfcode = arg_pfcode
- incasemx[it_mxbt].Qty = arg_qty
- incasemx[it_mxbt].packunit = arg_packunit
- incasemx[it_mxbt].packcode = arg_packcode
- incasemx[it_mxbt].packsize = arg_packsize
- incasemx[it_mxbt].mxdscrp = arg_mxdscrp
- incasemx[it_mxbt].packqty = arg_packqty
- incasemx[it_mxbt].printid = arg_printid
- incasemx[it_mxbt].grossweight = arg_grossweight
- incasemx[it_mxbt].netweight = arg_netweight
- incasemx[it_mxbt].cubage = arg_cubage
- incasemx[it_mxbt].ifson_flag = arg_ifson_flag
- incasemx[it_mxbt].fathermtrlid = arg_fathermtrlid
- incasemx[it_mxbt].price = arg_price
- incasemx[it_mxbt].relid = arg_relid
- incasemx[it_mxbt].relprintid = arg_relprintid
- incasemx[it_mxbt].relcode = arg_relcode
- incasemx[it_mxbt].mxdscrp2 = arg_mxdscrp2
- incasemx[it_mxbt].mxdscrp3 = arg_mxdscrp3
- incasemx[it_mxbt].onepackqty = arg_onepackqty
- incasemx[it_mxbt].status = arg_status
- incasemx[it_mxbt].woodcode = arg_woodcode
- incasemx[it_mxbt].pcode = arg_pcode
- ext:
- IF rslt = 0 THEN p_clearmx()
- Return(rslt)
- end function
- on uo_incase.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on uo_incase.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
|