$PBExportHeader$uo_ljfieb.sru forward global type uo_ljfieb from nonvisualobject end type end forward global type uo_ljfieb from nonvisualobject end type global uo_ljfieb uo_ljfieb type variables Transaction commit_transaction //数据commit事务 end variables forward prototypes public function integer add_mtrldef (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrldef_array arg_s_mtrldef, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_buytask (long arg_scid, long arg_taskid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer feedback_rqdate (s_buytaskmx_feedback_ljfieb arg_s_mx[], long arg_cusid, string arg_relatedcode, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_outware (long arg_scid, long arg_outwareid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_spt_price (long arg_billid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_quote (long arg_scid, long arg_quoteid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_mtrlware (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrlware_ljfieb arg_s_mtrlware[], ref string arg_msg, boolean arg_ifcommit) public function integer send_mtrl_match (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrl_match_ljfieb arg_s_match[], ref string arg_msg, boolean arg_ifcommit) public function integer send_buytask_jd (long arg_scid, long arg_taskid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer add_packet (string arg_serialnum, string arg_tablename, long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, integer arg_billtype, string arg_summary, string arg_postscript, string arg_remark, string arg_relatedserialnum, string arg_relatedcode, long arg_cusid, ref string arg_msg, boolean arg_ifcommit) public function integer update_buytask_jd (string arg_taskcode, ref string arg_msg, boolean arg_ifcommit) public function integer send_reissue (long arg_scid, long arg_reissueid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_reissue_spt (long arg_scid, long arg_reissueid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer uof_chk_receive (integer arg_chktype, ref integer arg_ifecomm, ref string arg_msg) public function integer uof_get_receiveinfo (integer arg_chktype, long arg_chkid, ref long arg_receivecuscommid, ref string arg_commsccode, ref string arg_msg) public function integer uof_get_selfinfo (long arg_scid, ref long arg_sendcuscommid, ref string arg_sendsccode, ref string arg_msg) public function string uof_get_serialnum () public function integer send_mtrltype (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, long arg_mtrltypeid[], ref string arg_msg, boolean arg_ifcommit) public function integer send_post (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_post_ljfieb arg_s_post, ref string arg_msg, boolean arg_ifcommit) public function integer send_cust (long arg_scid, long arg_cusid_arr[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_cust_rep (long arg_scid, long arg_repid_arr[], string arg_summary, string arg_postscript, string arg_remark, boolean arg_setpwd, ref string arg_msg, boolean arg_ifcommit) public function integer send_funcpwreb (long arg_scid, long arg_cusid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_cust_rep_cm (long arg_scid, long arg_repid, string arg_ljemail_arr[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit) public function integer send_web_option (ref string arg_msg) public function integer send_web_scdef (ref string arg_msg) public function integer send_web_currency (ref string arg_msg) public function integer send_web_banktype (ref string arg_msg) public function integer feedback_buytask (string arg_sn, s_buytaskmx_feedback_ljfieb arg_s_mx[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit, string arg_spt_dscrp, string arg_spt_dscrp2) public function integer send_file (long arg_billtype, long arg_scid, long arg_relid[], long arg_relid_mx[], string ls_serialnum, ref string ls_tablename, ref string arg_msg) end prototypes public function integer add_mtrldef (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrldef_array arg_s_mtrldef, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_i,ll_j,ll_k Long ll_typeid[],ll_contfigtypeid[],ll_mtrlid_arr[],ll_mtrlid_arr_con[] Long ll_ittype,ll_itcon,ll_itpz,ll_itconpz Long ll_cid_ds String ls_code_ds,ls_ename_ds,ls_dscrp_ds Long ll_type_ds,ll_mtrlid_ds Decimal ld_planprice_ds,ld_price_ds Long ll_defaultpz_ds,ll_ifzj_ds Decimal ld_capacity_ds,ld_capaparm_ds,ld_net_weight_ds,ld_gross_weight_ds,ld_cubage_ds String ls_SerialNum Long ll_id String ls_name,ls_printid datastore ds_pztype,ds_pztype_mx datastore ds_configure_code,ds_configure_codemx,ds_configure_type datastore ds_mtrl_configure,ds_mtrl_configure2 datastore ds_color,ds_color_pcode,ds_color_wood ds_pztype = Create datastore ds_pztype_mx = Create datastore ds_configure_code = Create datastore ds_configure_codemx = Create datastore ds_configure_type = Create datastore ds_mtrl_configure = Create datastore ds_mtrl_configure2 = Create datastore ds_color = Create datastore ds_color_pcode = Create datastore ds_color_wood = Create datastore ds_pztype.DataObject = 'ds_pztype_ljfieb' ds_pztype_mx.DataObject = 'ds_pztype_mx_ljfieb' ds_configure_code.DataObject = 'ds_configure_code_ljfieb' ds_configure_codemx.DataObject = 'ds_configure_codemx_ljfieb' ds_configure_type.DataObject = 'ds_configure_type_ljfieb' ds_mtrl_configure.DataObject = 'ds_mtrl_configure_ljfieb' ds_mtrl_configure2.DataObject = 'ds_mtrl_configure2_ljfieb' ds_color.DataObject = 'ds_color_ljfieb' ds_color_pcode.DataObject = 'ds_color_pcode_ljfieb' ds_color_wood.DataObject = 'ds_color_wood_ljfieb' ds_pztype.SetTransObject(sqlca) ds_pztype_mx.SetTransObject(sqlca) ds_configure_code.SetTransObject(sqlca) ds_configure_codemx.SetTransObject(sqlca) ds_configure_type.SetTransObject(sqlca) ds_mtrl_configure.SetTransObject(sqlca) ds_mtrl_configure2.SetTransObject(sqlca) ds_color.SetTransObject(sqlca) ds_color_pcode.SetTransObject(sqlca) ds_color_wood.SetTransObject(sqlca) SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF IF UpperBound(arg_s_mtrldef.mtrlid) = 0 THEN rslt = 0 arg_msg = '没有可发送的内容' GOTO ext END IF FOR ll_i = 1 To UpperBound(arg_s_mtrldef.mtrlid) IF arg_s_mtrldef.statusflag[ll_i] = 1 THEN FOR ll_j = 1 To ll_ittype IF ll_typeid[ll_j] = arg_s_mtrldef.statustype[ll_i] THEN GOTO _end_type END IF NEXT ll_ittype++ ll_typeid[ll_ittype] = arg_s_mtrldef.statustype[ll_i] _end_type: END IF IF arg_s_mtrldef.woodcodeflag[ll_i] = 1 THEN FOR ll_j = 1 To ll_ittype IF ll_typeid[ll_j] = arg_s_mtrldef.woodcodeflag[ll_i] THEN GOTO _end_type_2 END IF NEXT ll_ittype++ ll_typeid[ll_ittype] = arg_s_mtrldef.woodcodetype[ll_i] _end_type_2: END IF IF arg_s_mtrldef.pcodeflag[ll_i] = 1 THEN FOR ll_j = 1 To ll_ittype IF ll_typeid[ll_j] = arg_s_mtrldef.pcodeflag[ll_i] THEN GOTO _end_type_3 END IF NEXT ll_ittype++ ll_typeid[ll_ittype] = arg_s_mtrldef.pcodetype[ll_i] _end_type_3: END IF IF arg_s_mtrldef.statusflag[ll_i] = 4 THEN FOR ll_j = 1 To ll_itcon IF ll_contfigtypeid[ll_j] = arg_s_mtrldef.statustype[ll_i] THEN GOTO _end_contype END IF NEXT ll_itcon++ ll_contfigtypeid[ll_itcon] = arg_s_mtrldef.statustype[ll_i] _end_contype: END IF IF arg_s_mtrldef.woodcodeflag[ll_i] = 4 THEN FOR ll_j = 1 To ll_itcon IF ll_contfigtypeid[ll_j] = arg_s_mtrldef.woodcodeflag[ll_i] THEN GOTO _end_contype_2 END IF NEXT ll_itcon++ ll_contfigtypeid[ll_itcon] = arg_s_mtrldef.woodcodetype[ll_i] _end_contype_2: END IF IF arg_s_mtrldef.pcodeflag[ll_i] = 4 THEN FOR ll_j = 1 To ll_itcon IF ll_contfigtypeid[ll_j] = arg_s_mtrldef.pcodeflag[ll_i] THEN GOTO _end_contype_3 END IF NEXT ll_itcon++ ll_contfigtypeid[ll_itcon] = arg_s_mtrldef.pcodetype[ll_i] _end_contype_3: END IF IF arg_s_mtrldef.statusflag[ll_i] = 2 THEN ll_itpz++ ll_mtrlid_arr[ll_itpz] = arg_s_mtrldef.mtrlid[ll_i] END IF IF arg_s_mtrldef.configcodetype[ll_i] > 0 THEN ll_itconpz++ ll_mtrlid_arr_con[ll_itconpz] = arg_s_mtrldef.mtrlid[ll_i] FOR ll_j = 1 To ll_itcon IF ll_contfigtypeid[ll_j] = arg_s_mtrldef.configcodetype[ll_i] THEN GOTO _end_configcodetype END IF NEXT ll_itcon++ ll_contfigtypeid[ll_itcon] = arg_s_mtrldef.configcodetype[ll_i] _end_configcodetype: END IF INSERT INTO LJFIEB_mtrldef_code (mtrlid, mtrlcode, mtrlname, mtrltype, mtrlsectype, mtrlmode, Mtrlorigin, unit, dscrp, isuse, packqty, prdpackcode, net_weight, gross_weight, cubage, mtrlengname, zxmtrlmode, unit_scll, unit_buy, rate_buy, rate_scll, rate_sale, unit_sale, statusflag, statustype, woodcodeflag, woodcodetype, pcodeflag, pcodetype, ifcustom, buyunit, wfjgunit, scllunit, saleunit, buydec, wfjgdec, sclldec, saledec, status_check, woodcode_check, pcode_check, status_config, woodcode_config, pcode_config, configcodetype, configcode, configname, mtrlcolor, handtype, ifpack, ifpackpro, ifpackpz, ifpackpro2, ifpacktype, mtrlprp, serialnum) VALUES (:arg_s_mtrldef.mtrlid[ll_i], :arg_s_mtrldef.mtrlcode[ll_i], :arg_s_mtrldef.mtrlname[ll_i], :arg_s_mtrldef.mtrltype[ll_i], :arg_s_mtrldef.mtrlsectype[ll_i], :arg_s_mtrldef.mtrlmode[ll_i], :arg_s_mtrldef.Mtrlorigin[ll_i], :arg_s_mtrldef.unit[ll_i], :arg_s_mtrldef.dscrp[ll_i], :arg_s_mtrldef.isuse[ll_i], :arg_s_mtrldef.packqty[ll_i], :arg_s_mtrldef.prdpackcode[ll_i], :arg_s_mtrldef.net_weight[ll_i], :arg_s_mtrldef.gross_weight[ll_i], :arg_s_mtrldef.cubage[ll_i], :arg_s_mtrldef.mtrlengname[ll_i], :arg_s_mtrldef.zxmtrlmode[ll_i], :arg_s_mtrldef.unit_scll[ll_i], :arg_s_mtrldef.unit_buy[ll_i], :arg_s_mtrldef.rate_buy[ll_i], :arg_s_mtrldef.rate_scll[ll_i], :arg_s_mtrldef.rate_sale[ll_i], :arg_s_mtrldef.unit_sale[ll_i], :arg_s_mtrldef.statusflag[ll_i], :arg_s_mtrldef.statustype[ll_i], :arg_s_mtrldef.woodcodeflag[ll_i], :arg_s_mtrldef.woodcodetype[ll_i], :arg_s_mtrldef.pcodeflag[ll_i], :arg_s_mtrldef.pcodetype[ll_i], :arg_s_mtrldef.ifcustom[ll_i], :arg_s_mtrldef.buyunit[ll_i], :arg_s_mtrldef.wfjgunit[ll_i], :arg_s_mtrldef.scllunit[ll_i], :arg_s_mtrldef.saleunit[ll_i], :arg_s_mtrldef.buydec[ll_i], :arg_s_mtrldef.wfjgdec[ll_i], :arg_s_mtrldef.sclldec[ll_i], :arg_s_mtrldef.saledec[ll_i], :arg_s_mtrldef.status_check[ll_i], :arg_s_mtrldef.woodcode_check[ll_i], :arg_s_mtrldef.pcode_check[ll_i], :arg_s_mtrldef.status_config[ll_i], :arg_s_mtrldef.woodcode_config[ll_i], :arg_s_mtrldef.pcode_config[ll_i], :arg_s_mtrldef.configcodetype[ll_i], :arg_s_mtrldef.configcode[ll_i], :arg_s_mtrldef.configname[ll_i], :arg_s_mtrldef.mtrlcolor[ll_i], :arg_s_mtrldef.handtype[ll_i], :arg_s_mtrldef.ifpack[ll_i], :arg_s_mtrldef.ifpackpro[ll_i], :arg_s_mtrldef.ifpackpz[ll_i], :arg_s_mtrldef.ifpackpro2[ll_i], :arg_s_mtrldef.ifpacktype[ll_i], :arg_s_mtrldef.mtrlprp[ll_i], :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时物料表失败,'+commit_transaction.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_mtrlid_cusid(serialnum, mtrlid, cusid) VALUES(:ls_SerialNum, :arg_s_mtrldef.mtrlid[ll_i], -1) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时物料关联表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT Long ll_typeid_ds String ls_typename_ds Long ll_pztype_ds String ls_pzdscrp_ds,ls_pztdscrp_ds IF ll_ittype > 0 THEN ds_pztype.Retrieve(ll_typeid) ds_pztype_mx.Retrieve(ll_typeid) FOR ll_i = 1 To ds_pztype.RowCount() ll_typeid_ds = ds_pztype.Object.typeid[ll_i] ls_typename_ds = ds_pztype.Object.typename[ll_i] INSERT INTO LJFIEB_pztype_def (typeid, typename, serialnum) VALUES (:ll_typeid_ds, :ls_typename_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时配置类别表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT FOR ll_i = 1 To ds_pztype_mx.RowCount() ll_typeid_ds = ds_pztype_mx.Object.typeid[ll_i] ll_pztype_ds = ds_pztype_mx.Object.pztype[ll_i] ls_pzdscrp_ds = ds_pztype_mx.Object.dscrp[ll_i] ls_pztdscrp_ds = ds_pztype_mx.Object.tdscrp[ll_i] INSERT INTO LJFIEB_pztype_mx (typeid, pztype, dscrp, tdscrp, serialnum) VALUES (:ll_typeid_ds, :ll_pztype_ds, :ls_pzdscrp_ds, :ls_pztdscrp_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时配置类别明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT END IF Long ll_contfigtypeid_ds,ll_contfigtype_ds String ls_contfigtypename_ds Long ll_pzid_ds String ls_pzcode_ds, ls_name_ds Long ll_inputtype_ds, ll_configtype_ds Long ll_printid_ds String ls_pzcodemx_ds,ls_namemx_ds IF ll_itcon > 0 THEN ds_configure_code.Retrieve(ll_contfigtypeid) ds_configure_codemx.Retrieve(ll_contfigtypeid) ds_configure_type.Retrieve(ll_contfigtypeid) FOR ll_i = 1 To ds_configure_type.RowCount() ll_contfigtypeid_ds = ds_configure_type.Object.contfigtypeid[ll_i] ll_contfigtype_ds = ds_configure_type.Object.contfigtype[ll_i] ls_contfigtypename_ds = ds_configure_type.Object.contfigtypename[ll_i] INSERT INTO LJFIEB_configure_type (contfigtypeid, contfigtypename, contfigtype, serialnum) VALUES (:ll_contfigtypeid_ds, :ls_contfigtypename_ds, :ll_contfigtype_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时部件选配资料表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT FOR ll_i = 1 To ds_configure_code.RowCount() ll_typeid_ds = ds_configure_code.Object.typeid[ll_i] ll_pzid_ds = ds_configure_code.Object.pzid[ll_i] ls_pzcode_ds = ds_configure_code.Object.pzcode[ll_i] ls_name_ds = ds_configure_code.Object.Name[ll_i] ll_inputtype_ds = ds_configure_code.Object.inputtype[ll_i] ll_configtype_ds = ds_configure_code.Object.configtype[ll_i] INSERT INTO LJFIEB_configure_code (typeid, pzid, pzcode, name, inputtype, configtype, serialnum) VALUES (:ll_typeid_ds, :ll_pzid_ds, :ls_pzcode_ds, :ls_name_ds, :ll_inputtype_ds, :ll_configtype_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时部件选配资料明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT FOR ll_i = 1 To ds_configure_codemx.RowCount() ll_pzid_ds = ds_configure_codemx.Object.u_configure_codemx_pzid[ll_i] ll_printid_ds = ds_configure_codemx.Object.u_configure_codemx_printid[ll_i] ls_pzcodemx_ds = ds_configure_codemx.Object.u_configure_codemx_pzcodemx[ll_i] ls_namemx_ds = ds_configure_codemx.Object.u_configure_codemx_namemx[ll_i] INSERT INTO LJFIEB_configure_codemx (pzid, printid, pzcodemx, namemx, serialnum) VALUES (:ll_pzid_ds, :ll_printid_ds, :ls_pzcodemx_ds, :ls_namemx_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时部件选配资料明细表2失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT END IF IF ll_itpz > 0 THEN ds_mtrl_configure.Retrieve(ll_mtrlid_arr) FOR ll_i = 1 To ds_mtrl_configure.RowCount() ll_cid_ds = ds_mtrl_configure.Object.cid[ll_i] ll_mtrlid_ds = ds_mtrl_configure.Object.mtrlid[ll_i] ls_code_ds = ds_mtrl_configure.Object.code[ll_i] ls_name_ds = ds_mtrl_configure.Object.Name[ll_i] ls_ename_ds = ds_mtrl_configure.Object.ename[ll_i] ll_type_ds = ds_mtrl_configure.Object.Type[ll_i] ls_dscrp_ds = ds_mtrl_configure.Object.dscrp[ll_i] ld_planprice_ds = ds_mtrl_configure.Object.planprice[ll_i] ld_price_ds = ds_mtrl_configure.Object.price[ll_i] ll_defaultpz_ds = ds_mtrl_configure.Object.defaultpz[ll_i] ll_ifzj_ds = ds_mtrl_configure.Object.ifzj[ll_i] ld_capacity_ds = ds_mtrl_configure.Object.capacity[ll_i] ld_capaparm_ds = ds_mtrl_configure.Object.capaparm[ll_i] ld_net_weight_ds = ds_mtrl_configure.Object.net_weight[ll_i] ld_gross_weight_ds = ds_mtrl_configure.Object.gross_weight[ll_i] ld_cubage_ds = ds_mtrl_configure.Object.cubage[ll_i] INSERT INTO LJFIEB_mtrl_configure (cid, Mtrlid, code, name, ename, type, dscrp, Planprice, price, DefaultPZ, ifzj, capacity, capaparm, net_weight, gross_weight, cubage, serialnum) VALUES (:ll_cid_ds, :ll_Mtrlid_ds, :ls_code_ds, :ls_name_ds, :ls_ename_ds, :ll_type_ds, :ls_dscrp_ds, :ld_Planprice_ds, :ld_price_ds, :ll_DefaultPZ_ds, :ll_ifzj_ds, :ld_capacity_ds, :ld_capaparm_ds, :ld_net_weight_ds, :ld_gross_weight_ds, :ld_cubage_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时产品组合配置表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT END IF Long ll_scid_ds String ls_pzname_ds,ls_pznamemx_ds IF ll_itconpz > 0 THEN ds_mtrl_configure2.Retrieve(ll_mtrlid_arr_con) FOR ll_i = 1 To ds_mtrl_configure2.RowCount() ll_scid_ds = ds_mtrl_configure2.Object.scid[ll_i] ll_pzid_ds = ds_mtrl_configure2.Object.pzid[ll_i] ll_printid_ds = ds_mtrl_configure2.Object.printid[ll_i] ll_mtrlid_ds = ds_mtrl_configure2.Object.mtrlid[ll_i] ls_pzcode_ds = ds_mtrl_configure2.Object.pzcode[ll_i] ls_pzname_ds = ds_mtrl_configure2.Object.pzname[ll_i] ls_pzcodemx_ds = ds_mtrl_configure2.Object.pzcodemx[ll_i] ls_pznamemx_ds = ds_mtrl_configure2.Object.pznamemx[ll_i] INSERT INTO LJFIEB_mtrl_configure2 (scid, pzid, printid, Mtrlid, pzcode, pzname, pzcodemx, pznamemx, serialnum) VALUES (:ll_scid_ds, :ll_pzid_ds, :ll_printid_ds, :ll_mtrlid_ds, :ls_pzcode_ds, :ls_pzname_ds, :ls_pzcodemx_ds, :ls_pznamemx_ds, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时产品配置表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT END IF //color,color_pcode,color_wood ds_color.Retrieve() FOR ll_i = 1 To ds_color.RowCount() ll_id = ds_color.Object.colorid[ll_i] ls_name = ds_color.Object.colorname[ll_i] ls_printid = ds_color.Object.printid[ll_i] INSERT INTO LJFIEB_color (colorid, colorname, printid, serialnum) VALUES (:ll_id, :ls_name, :ls_printid, :ls_SerialNum)Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时配置表(LJFIEB_color)失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT ds_color_wood.Retrieve() FOR ll_i = 1 To ds_color_wood.RowCount() ll_id = ds_color_wood.Object.woodcodeid[ll_i] ls_name = ds_color_wood.Object.woodcode[ll_i] ls_printid = ds_color_wood.Object.printid[ll_i] INSERT INTO LJFIEB_color_wood (woodcodeid, woodcode, printid, serialnum) VALUES (:ll_id, :ls_name, :ls_printid, :ls_SerialNum)Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时配置表(LJFIEB_color_wood)失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT ds_color_pcode.Retrieve() FOR ll_i = 1 To ds_color_pcode.RowCount() ll_id = ds_color_pcode.Object.pcodeid[ll_i] ls_name = ds_color_pcode.Object.pcode[ll_i] ls_printid = ds_color_pcode.Object.printid[ll_i] INSERT INTO LJFIEB_color_pcode (pcodeid, pcode, printid, serialnum) VALUES (:ll_id, :ls_name, :ls_printid, :ls_SerialNum)Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时配置表(LJFIEB_color_pcode)失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'LJFIEB_mtrldef_code,LJFIEB_mtrlid_cusid' IF ll_ittype > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_pztype_def,LJFIEB_pztype_mx' END IF IF ll_itcon > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_configure_type,LJFIEB_configure_code,LJFIEB_configure_codemx' END IF IF ll_itpz > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_mtrl_configure' END IF IF ll_itconpz > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_mtrl_configure2' END IF IF ds_color.RowCount() > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_color' END IF IF ds_color_pcode.RowCount() > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_color_pcode' END IF IF ds_color_wood.RowCount() > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_color_wood' END IF IF add_packet(ls_SerialNum,ls_tablename,arg_sendcuscommid,arg_sendsccode,arg_receivecuscommid,arg_receivesccode,9,arg_summary,arg_postscript,arg_remark,'','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds_pztype Destroy ds_pztype_mx Destroy ds_configure_code Destroy ds_configure_codemx Destroy ds_configure_type Destroy ds_mtrl_configure Destroy ds_mtrl_configure2 Destroy ds_color Destroy ds_color_pcode Destroy ds_color_wood RETURN rslt end function public function integer send_buytask (long arg_scid, long arg_taskid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit); Int rslt = 1 string ls_summary Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i Long scid Long TaskID String TaskCode Long orderid Long Kind Long sptID DateTime requiredate DateTime accomplishdate String finishemp Long Status String Opemp String Modemp DateTime moddate String Assign_Emp String Permit_Emp DateTime Permit_date String Dscrp DateTime opdate String stopemp Long ctmint Long printnum String relcode Long banktypeid String train String reason Long billtype String firpermitemp DateTime firpermitdate Decimal billamt Long moneyid Decimal mrate Long MtrlID, iforder Decimal Qty, fprice, rebate, Price, AssignQty, consignedqty, uprice, rate,uqty, stopqty, rebuyqty Decimal fpqty, ffpqty, autostopqty, enprice, tax String status_mx, dscrp_mx, unit, stopemp_mx,sptmtrlname,relrqbuycode,delayreason,buybargaincode Long printid, storageid, orderid_mx, ctmint_mx, stopflag, rqmxprintid, requestbuyid, wrkGrpid, taskmxprintid Long buybargainid, buybargainprintid, admtrlid, relprintid DateTime Requiredate_mx,accomplishdate_mx,stopdate,sptbackdate String woodcode, pcode,stopreason String ls_banktypename,ls_moneyname String sptmtrlcode,sptmtrlmode String mtrlcode, mtrlmode, mtrlname Long arr_relid[], arr_relid_mx[] arr_relid[1] = arg_taskid String ls_m_table,ls_mx_table s_mtrldef_array s_post_mtrl datastore ds_buytaskmx ds_buytaskmx = Create datastore ds_buytaskmx.DataObject = 'ds_buytaskmx_send_ljfieb' ds_buytaskmx.SetTransObject(sqlca) SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+commit_transaction.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = :arg_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT u_spt.ifecomm, u_spt.commcode, u_spt.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_buyTask INNER JOIN u_spt ON u_buyTask.sptID = u_spt.sptid WHERE u_buyTask.scid = :arg_scid And u_buyTask.TaskID = :arg_taskid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单相关供应商通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '供应商没有使用电子商务,不能发送单据' GOTO ext END IF SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商相关通信设置失败,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID = 0 THEN rslt = 0 arg_msg = '供应商相关的通信设置不正确,请检查' GOTO ext END IF SELECT scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, Status, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, billtype, moneyid, mrate INTO :scid, :TaskID, :TaskCode, :orderid, :Kind, :sptID, :requiredate, :accomplishdate, :finishemp, :Status, :Opemp, :Modemp, :moddate, :Assign_Emp, :Permit_Emp, :Permit_date, :Dscrp, :opdate, :stopemp, :ctmint, :printnum, :relcode, :banktypeid, :train, :billtype, :moneyid, :mrate FROM u_buyTask WHERE scid = :arg_scid And TaskID = :arg_taskid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单信息失败,'+sqlca.SQLErrText GOTO ext END IF SELECT banktypename INTO :ls_banktypename FROM cw_banktype Where banktypeid = :banktypeid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单结算方式失败,'+sqlca.SQLErrText GOTO ext END IF SELECT name INTO :ls_moneyname FROM cw_currency Where moneyid = :moneyid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单币种失败,'+sqlca.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_tempbuyTask (scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, Status, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, reason, billtype, firpermitemp, firpermitdate, billamt, moneyid, mrate, serialnum,banktypename,moneyname) VALUES (:scid, :TaskID, :TaskCode, :orderid, :Kind, :sptID, :requiredate, :accomplishdate, :finishemp, :Status, :Opemp, :Modemp, :moddate, :Assign_Emp, :Permit_Emp, :Permit_date, :Dscrp, :opdate, :stopemp, :ctmint, :printnum, :relcode, :banktypeid, :train, :reason, :billtype, :firpermitemp, :firpermitdate, :billamt, :moneyid, :mrate, :ls_SerialNum, :ls_banktypename, :ls_moneyname) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单表失败,'+commit_transaction.SQLErrText GOTO ext END IF ds_buytaskmx.Retrieve(arg_scid,arg_taskid) FOR ll_i = 1 To ds_buytaskmx.RowCount() arr_relid_mx[ll_i] = printid MtrlID = ds_buytaskmx.Object.MtrlID[ll_i] iforder = ds_buytaskmx.Object.iforder[ll_i] Qty = ds_buytaskmx.Object.Qty[ll_i] fprice = ds_buytaskmx.Object.fprice[ll_i] rebate = ds_buytaskmx.Object.rebate[ll_i] Price = ds_buytaskmx.Object.Price[ll_i] AssignQty = ds_buytaskmx.Object.AssignQty[ll_i] status_mx = ds_buytaskmx.Object.Status[ll_i] Dscrp = ds_buytaskmx.Object.Dscrp[ll_i] printid = ds_buytaskmx.Object.printid[ll_i] consignedqty = ds_buytaskmx.Object.consignedqty[ll_i] requiredate = ds_buytaskmx.Object.requiredate[ll_i] storageid = ds_buytaskmx.Object.storageid[ll_i] orderid = ds_buytaskmx.Object.orderid[ll_i] ctmint = ds_buytaskmx.Object.ctmint[ll_i] sptmtrlname = ds_buytaskmx.Object.sptmtrlname[ll_i] uqty = ds_buytaskmx.Object.uqty[ll_i] uprice = ds_buytaskmx.Object.uprice[ll_i] unit = ds_buytaskmx.Object.unit[ll_i] rate = ds_buytaskmx.Object.rate[ll_i] stopflag = ds_buytaskmx.Object.stopflag[ll_i] stopemp = ds_buytaskmx.Object.stopemp[ll_i] stopdate = ds_buytaskmx.Object.stopdate[ll_i] stopreason = ds_buytaskmx.Object.stopreason[ll_i] woodcode = ds_buytaskmx.Object.woodcode[ll_i] pcode = ds_buytaskmx.Object.pcode[ll_i] rqmxprintid = ds_buytaskmx.Object.rqmxprintid[ll_i] requestbuyid = ds_buytaskmx.Object.requestbuyid[ll_i] relrqbuycode = ds_buytaskmx.Object.relrqbuycode[ll_i] wrkGrpid = ds_buytaskmx.Object.wrkGrpid[ll_i] taskmxprintid = ds_buytaskmx.Object.taskmxprintid[ll_i] sptbackdate = ds_buytaskmx.Object.sptbackdate[ll_i] delayreason = ds_buytaskmx.Object.delayreason[ll_i] stopqty = ds_buytaskmx.Object.stopqty[ll_i] rebuyqty = ds_buytaskmx.Object.rebuyqty[ll_i] buybargainid = ds_buytaskmx.Object.buybargainid[ll_i] buybargainprintid = ds_buytaskmx.Object.buybargainprintid[ll_i] buybargaincode = ds_buytaskmx.Object.buybargaincode[ll_i] accomplishdate = ds_buytaskmx.Object.accomplishdate[ll_i] admtrlid = ds_buytaskmx.Object.admtrlid[ll_i] relprintid = ds_buytaskmx.Object.relprintid[ll_i] fpqty = ds_buytaskmx.Object.fpqty[ll_i] ffpqty = ds_buytaskmx.Object.ffpqty[ll_i] autostopqty = ds_buytaskmx.Object.autostopqty[ll_i] enprice = ds_buytaskmx.Object.enprice[ll_i] tax = ds_buytaskmx.Object.tax[ll_i] SELECT mtrlcode, mtrlmode, mtrlname INTO :mtrlcode, :mtrlmode, :mtrlname FROM u_mtrldef Where MtrlID = :MtrlID Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(ll_i)+'行,查询物料信息失败,'+sqlca.SQLErrText GOTO ext END IF SELECT sptmtrlcode, sptmtrlmode INTO :sptmtrlcode, :sptmtrlmode FROM u_sptmtrlname WHERE sptid = :sptid And MtrlID = :MtrlID Using sqlca; IF sqlca.SQLCode <> 0 THEN sptmtrlcode = '' sptmtrlmode = '' IF f_ljfieb_fillmtrl(mtrlcode, 0, s_post_mtrl, arg_msg) <> 1 THEN rslt = 0 arg_msg = '第'+String(ll_i)+'行,' + arg_msg GOTO ext END IF // rslt = 0 // arg_msg = '第'+String(ll_i)+'行,查询供应商物料别名信息失败,'+sqlca.SQLErrText // GOTO ext END IF ls_summary = ls_summary + '['+sptmtrlcode+']' + sptmtrlname + '数量:'+string(uqty,'#,##0.##########')+unit+',' INSERT INTO LJFIEB_tempbuyTaskMx (scid, TaskID, MtrlID, iforder, Qty, fprice, rebate, Price, AssignQty, status, dscrp, printid, consignedqty, Requiredate, storageid, orderid, ctmint, sptmtrlname, uqty, uprice, unit, rate, stopflag, stopemp, stopdate, stopreason, woodcode, pcode, rqmxprintid, requestbuyid, relrqbuycode, wrkGrpid, taskmxprintid, sptbackdate, delayreason, stopqty, rebuyqty, buybargainid, buybargainprintid, buybargaincode, accomplishdate, admtrlid, relprintid, fpqty, ffpqty, autostopqty, enprice, tax, serialnum, sptmtrlcode, sptmtrlmode, mtrlcode, mtrlmode, mtrlname) VALUES (:arg_scid, :arg_taskid, :MtrlID, :iforder, :Qty, :fprice, :rebate, :Price, :AssignQty, :status_mx, :dscrp, :printid, :consignedqty, :Requiredate, :storageid, :orderid, :ctmint, :sptmtrlname, :uqty, :uprice, :unit, :rate, :stopflag, :stopemp, :stopdate, :stopreason, :woodcode, :pcode, :rqmxprintid, :requestbuyid, :relrqbuycode, :wrkGrpid, :taskmxprintid, :sptbackdate, :delayreason, :stopqty, :rebuyqty, :buybargainid, :buybargainprintid, :buybargaincode, :accomplishdate, :admtrlid, :relprintid, :fpqty, :ffpqty, :autostopqty, :enprice, :tax, :ls_SerialNum, :sptmtrlcode, :sptmtrlmode, :mtrlcode, :mtrlmode, :mtrlname) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'LJFIEB_tempbuyTask,LJFIEB_tempbuyTaskMx' IF lena(ls_Summary) > 100 THEN ls_Summary = LeftA(ls_Summary,90) + '......' arg_summary = ls_Summary long arr_tmp[] arr_tmp[1] = 0 // DONE: 发附件 采购订单附件billtype IF send_file(401, arg_scid, arr_relid, arr_tmp, ls_SerialNum, Ref ls_m_table, Ref arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF IF ls_m_table <> '' THEN ls_tablename += ',' + ls_m_table END IF // DONE: 发明细附件 采购订单明细附件billtype IF send_file(9401, arg_scid, arr_relid, arr_relid_mx, ls_SerialNum, Ref ls_mx_table, Ref arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF IF ls_m_table = '' AND ls_mx_table <> '' THEN ls_tablename += ',' + ls_mx_table END IF IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,2,arg_summary,arg_postscript,arg_remark,'',TaskCode,0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF IF UpperBound(s_post_mtrl.MtrlID) > 0 THEN IF add_mtrldef(ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,s_post_mtrl,arg_summary,arg_postscript,arg_remark,arg_msg,False) <> 1 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds_buytaskmx RETURN rslt end function public function integer feedback_rqdate (s_buytaskmx_feedback_ljfieb arg_s_mx[], long arg_cusid, string arg_relatedcode, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_SendCusCommID, ll_ReceiveCusCommID String ls_SendSCcode, ls_ReceiveSCcode String ls_SerialNum,ls_RelatedCode,ls_commcode Int li_ifecomm Long ll_i decimal ld_spt_uqty string ls_unit string ls_status,ls_woodcode,ls_pcode SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm WHERE CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT commcode,commsccode,ifecomm INTO :ls_commcode ,:ls_ReceiveSCcode,:li_ifecomm FROM u_cust Where cusid = :arg_cusid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询客户通信信息失败,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '客户没有使用电子商务功能,请检查设置' GOTO ext END IF SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm WHERE CusCode = :ls_commcode Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询客户通信信息失败,'+commit_transaction.SQLErrText GOTO ext END IF Long ll_printid DateTime ldt_spt_requiredate String ls_sptmtrlcode,ls_sptmtrlname,ls_sptmtrlmode,ls_delayreason FOR ll_i = 1 To UpperBound(arg_s_mx) ll_printid = arg_s_mx[ll_i].printid ldt_spt_requiredate = arg_s_mx[ll_i].spt_Requiredate ls_sptmtrlcode = arg_s_mx[ll_i].sptmtrlcode ls_sptmtrlname = arg_s_mx[ll_i].sptmtrlname ls_sptmtrlmode = arg_s_mx[ll_i].sptmtrlmode ls_delayreason = arg_s_mx[ll_i].delayreason ld_spt_uqty = arg_s_mx[ll_i].spt_uqty ls_unit = arg_s_mx[ll_i].unit ls_status = arg_s_mx[ll_i].status ls_woodcode = arg_s_mx[ll_i].woodcode ls_pcode = arg_s_mx[ll_i].pcode INSERT INTO LJFIEB_tempbuyTaskMx (printid, sptmtrlcode, sptmtrlname, sptmtrlmode, spt_Requiredate, delayreason, serialnum, spt_uqty, unit, status, woodcode, pcode) VALUES (:ll_printid, :ls_sptmtrlcode, :ls_sptmtrlname, :ls_sptmtrlmode, :ldt_spt_requiredate, :ls_delayreason, :ls_SerialNum, :ld_spt_uqty, :ls_unit, :ls_status, :ls_woodcode, :ls_pcode) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入更新采购订单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'LJFIEB_tempbuyTaskMx' IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_ReceiveSCcode,12,arg_summary,arg_postscript,arg_remark,'',arg_RelatedCode,0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_outware (long arg_scid, long arg_outwareid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i datastore ds_outwaremx ds_outwaremx = Create datastore ds_outwaremx.DataObject = 'ds_outwaremx_send_ljfieb' ds_outwaremx.SetTransObject(sqlca) datastore ds_outwaremx_mx ds_outwaremx_mx = Create datastore ds_outwaremx_mx.DataObject = 'ds_outwaremx_mx_send_ljfieb' ds_outwaremx_mx.SetTransObject(sqlca) datastore ds_outwaremx_barcode ds_outwaremx_barcode = Create datastore ds_outwaremx_barcode.DataObject = 'ds_outwaremx_mx_barcode_send_ljfieb' ds_outwaremx_barcode.SetTransObject(sqlca) //u_outware 变量 String outwarecode Int billtype Long relid, StorageID DateTime opdate, moddate, auditingdate, outdate String opemp, Modemp, auditingrep,outrep Int flag String part, dscrp Long cusid String cusname Long balcflag,balcdateint, thflag, secflag DateTime secauditingdate String secauditingrep Long wagemth Decimal otheramt String relstr_1, relstr_2, relstr_3 Long relint_1, relint_2, relint_3 Long priceflag DateTime pricedate String priceemp,rel_address,rel_tele,rel_fax,rel_rep Decimal mrate, damt String upname Long ifauto DateTime viewdate Long deptid string ls_banktypename,ls_moneyname //u_outwaremx 变量 Long mtrlwareid_mx,mtrlid_mx,storageid_mx String plancode_mx,status_mx Decimal qty_mx,fprice_mx,rebate_mx,price_mx,costamt_mx,planprice_mx String mxdscrp_mx Long Sptid_mx,Dxflag_mx,printid_mx,ifrel_mx,olmtrlid_mx Decimal packqty_mx String woodcode_mx,relcode_mx,pcode_mx Decimal enprice_mx,newpriceamt_mx Long outtype_mx Decimal dftsaleprice_mx,cost_mx,planqty_mx Long relprintid_mx Decimal uqty_mx,rate_mx String unit_mx Decimal scidprice_mx String outtypestr_mx Decimal overqty_mx String mtrlcuscode_mx,location_mx String pricetype_mx,formula_mx Decimal capacity_mx,saleqty_mx Decimal net_weight_mx,gross_weight_mx,cubage_mx String mxdscrp2_mx Decimal taxrate_mx String sptmtrlcode_mx,sptmtrlname_mx,sptmtrlmode_mx string fiebrelcode_mx // u_outwaremx_mx 变量 Long printid_mx_mx,mxprintid_mx_mx,mtrlwareid_mx_mx,storageid_mx_mx,mtrlid_mx_mx String plancode_mx_mx,status_mx_mx,woodcode_mx_mx,pcode_mx_mx,mtrlcuscode_mx_mx,location_mx_mx Long sptid_mx_mx,dxflag_mx_mx Decimal planqty_mx_mx,qty_mx_mx String mxdscrp_mx_mx String sptmtrlcode_mx_mx,sptmtrlname_mx_mx,sptmtrlmode_mx_mx //u_outwaremx_mx_barcode 变量 Long billtype_mx_b,printid_mx_b String barcode_mx_b Decimal qty_mx_b SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = :arg_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT u_cust.ifecomm, u_cust.commcode, u_cust.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_outware INNER JOIN u_cust ON u_outware.cusid = u_cust.cusid WHERE u_outware.scid = :arg_scid And u_outware.outwareid = :arg_outwareid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询销售发货单相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '客户没有使用电子商务,不能发送单据' GOTO ext END IF If li_ifecomm = 2 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where CusType = 5 Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '请先确认已设置电子商务网站通讯连接!' Goto ext End If ElseIf li_ifecomm = 1 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '客户相关的通信设置不正确,请检查' Goto ext End If End If damt = 0 upname = '' ifauto = 0 viewdate = datetime(today()) deptid = 0 SELECT outwarecode, billtype, relid, StorageID, opdate, opemp, Modemp, moddate, auditingdate, auditingrep, outdate, outrep, part, dscrp, cusid, cusname, balcflag, balcdateint, thflag, wagemth, otheramt, relstr_1, relstr_2, relstr_3, relint_1, relint_2, relint_3, priceflag, pricedate, priceemp, rel_address, rel_tele, rel_fax, rel_rep, mrate INTO :outwarecode, :billtype, :relid, :StorageID, :opdate, :opemp, :Modemp, :moddate, :auditingdate, :auditingrep, :outdate, :outrep, :part, :dscrp, :cusid, :cusname, :balcflag, :balcdateint, :thflag, :wagemth, :otheramt, :relstr_1, :relstr_2, :relstr_3, :relint_1, :relint_2, :relint_3, :priceflag, :pricedate, :priceemp, :rel_address, :rel_tele, :rel_fax, :rel_rep, :mrate FROM u_outware WHERE scid = :arg_scid And outwareid = :arg_outwareid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询销售发货单信息失败,'+sqlca.SQLErrText GOTO ext END IF SELECT banktypename INTO :ls_banktypename FROM cw_banktype Where banktypeid = :relint_1 Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单结算方式失败,'+sqlca.SQLErrText GOTO ext END IF SELECT name INTO :ls_moneyname FROM cw_currency Where moneyid = :relint_2 Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询采购订单币种失败,'+sqlca.SQLErrText GOTO ext END IF //insert into INSERT INTO LJFIEB_tempoutware (scid, outwareid,outwarecode, billtype, relid, StorageID, opdate, opemp, Modemp, moddate, auditingdate, auditingrep, outdate, outrep, part, dscrp, cusid, cusname, balcflag, balcdateint, thflag, wagemth, otheramt, relstr_1, relstr_2, relstr_3, relint_1, relint_2, relint_3, priceflag, pricedate, priceemp, rel_address, rel_tele, rel_fax, rel_rep, mrate, damt, upname, ifauto, viewdate, deptid,serialnum, banktypename,moneyname) VALUES (:arg_scid, :arg_outwareid, :outwarecode, :billtype, :relid, :StorageID, :opdate, :opemp, :Modemp, :moddate, :auditingdate, :auditingrep, :outdate, :outrep, :part, :dscrp, :cusid, :cusname, :balcflag, :balcdateint, :thflag, :wagemth, :otheramt, :relstr_1, :relstr_2, :relstr_3, :relint_1, :relint_2, :relint_3, :priceflag, :pricedate, :priceemp, :rel_address, :rel_tele, :rel_fax, :rel_rep, :mrate, :damt, :upname, :ifauto, :viewdate, :deptid, :ls_SerialNum, :ls_banktypename, :ls_moneyname) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入销售发货单临时表失败,'+commit_transaction.SQLErrText GOTO ext END IF ds_outwaremx.Retrieve(arg_scid,arg_outwareid) FOR ll_i = 1 To ds_outwaremx.RowCount() mtrlwareid_mx = ds_outwaremx.Object.mtrlwareid[ll_i] mtrlid_mx = ds_outwaremx.Object.mtrlid[ll_i] storageid_mx = ds_outwaremx.Object.StorageID[ll_i] plancode_mx = ds_outwaremx.Object.plancode[ll_i] status_mx = ds_outwaremx.Object.status[ll_i] qty_mx = ds_outwaremx.Object.qty[ll_i] fprice_mx = ds_outwaremx.Object.fprice[ll_i] rebate_mx = ds_outwaremx.Object.rebate[ll_i] price_mx = ds_outwaremx.Object.price[ll_i] costamt_mx = ds_outwaremx.Object.costamt[ll_i] planprice_mx = ds_outwaremx.Object.planprice[ll_i] mxdscrp_mx = ds_outwaremx.Object.mxdscrp[ll_i] Sptid_mx = ds_outwaremx.Object.sptid[ll_i] Dxflag_mx = ds_outwaremx.Object.dxflag[ll_i] printid_mx = ds_outwaremx.Object.printid[ll_i] ifrel_mx = ds_outwaremx.Object.ifrel[ll_i] olmtrlid_mx = ds_outwaremx.Object.olmtrlid[ll_i] packqty_mx = ds_outwaremx.Object.packqty[ll_i] woodcode_mx = ds_outwaremx.Object.woodcode[ll_i] relcode_mx = ds_outwaremx.Object.relcode[ll_i] pcode_mx = ds_outwaremx.Object.pcode[ll_i] enprice_mx = ds_outwaremx.Object.enprice[ll_i] newpriceamt_mx = ds_outwaremx.Object.newpriceamt[ll_i] outtype_mx = ds_outwaremx.Object.outtype[ll_i] dftsaleprice_mx = ds_outwaremx.Object.dftsaleprice[ll_i] cost_mx = ds_outwaremx.Object.cost[ll_i] planqty_mx = qty_mx // relprintid_mx = ds_outwaremx.Object.relprintid[ll_i] uqty_mx = ds_outwaremx.Object.uqty[ll_i] rate_mx = ds_outwaremx.Object.rate[ll_i] unit_mx = ds_outwaremx.Object.unit[ll_i] scidprice_mx = 0 // outtypestr_mx = '' // overqty_mx = 0 // mtrlcuscode_mx = ds_outwaremx.Object.mtrlcuscode[ll_i] location_mx = '' // pricetype_mx = '' // formula_mx = ds_outwaremx.Object.formula[ll_i] capacity_mx = 0 // saleqty_mx =0 // net_weight_mx = ds_outwaremx.Object.net_weight[ll_i] gross_weight_mx = 0 //ds_outwaremx.Object.gross_weight[ll_i] cubage_mx = 0 //ds_outwaremx.Object.cubage[ll_i] mxdscrp2_mx = ds_outwaremx.Object.mxdscrp2[ll_i] taxrate_mx = 0 //ds_outwaremx.Object.taxrate[ll_i] sptmtrlcode_mx = ds_outwaremx.Object.u_mtrldef_mtrlcode[ll_i] sptmtrlname_mx = ds_outwaremx.Object.u_mtrldef_mtrlname[ll_i] sptmtrlmode_mx = ds_outwaremx.Object.u_mtrldef_mtrlmode[ll_i] fiebrelcode_mx = '' //ds_outwaremx.Object.u_saletask_fiebrelcode[ll_i] ls_summary = ls_summary + '['+sptmtrlcode_mx+']' + sptmtrlname_mx + '数量:'+string(qty_mx,'#,##0.##########')+unit_mx+',' INSERT INTO LJFIEB_tempoutwaremx (scid, outwareid, mtrlwareid, mtrlid, storageid, plancode, status, qty, fprice, rebate, price, costamt, planprice, mxdscrp, Sptid, Dxflag, printid, ifrel, olmtrlid, packqty, woodcode, relcode, pcode, enprice, newpriceamt, outtype, dftsaleprice, cost, planqty, relprintid, uqty, rate, unit, scidprice, outtypestr, overqty, mtrlcuscode, location, pricetype, formula, capacity, saleqty, net_weight, gross_weight, cubage, mxdscrp2, taxrate, serialnum, sptmtrlcode, sptmtrlname, sptmtrlmode, fiebrelcode) VALUES (:arg_scid, :arg_outwareid, :mtrlwareid_mx, :mtrlid_mx, :storageid_mx, :plancode_mx, :status_mx, :qty_mx, :fprice_mx, :rebate_mx, :price_mx, :costamt_mx, :planprice_mx, :mxdscrp_mx, :Sptid_mx, :Dxflag_mx, :printid_mx, :ifrel_mx, :olmtrlid_mx, :packqty_mx, :woodcode_mx, :relcode_mx, :pcode_mx, :enprice_mx, :newpriceamt_mx, :outtype_mx, :dftsaleprice_mx, :cost_mx, :planqty_mx, :relprintid_mx, :uqty_mx, :rate_mx, :unit_mx, :scidprice_mx, :outtypestr_mx, :overqty_mx, :mtrlcuscode_mx, :location_mx, :pricetype_mx, :formula_mx, :capacity_mx, :saleqty_mx, :net_weight_mx, :gross_weight_mx, :cubage_mx, :mxdscrp2_mx, :taxrate_mx, :ls_serialnum, :sptmtrlcode_mx, :sptmtrlname_mx, :sptmtrlmode_mx, :fiebrelcode_mx) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入销售发货单临时明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT //ds_outwaremx_mx.Retrieve(arg_scid,arg_outwareid) // //FOR ll_i = 1 To ds_outwaremx_mx.RowCount() // printid_mx_mx = ds_outwaremx_mx.Object.printid[ll_i] // mxprintid_mx_mx = ds_outwaremx_mx.Object.mxprintid[ll_i] // mtrlwareid_mx_mx = ds_outwaremx_mx.Object.mtrlwareid[ll_i] // storageid_mx_mx = ds_outwaremx_mx.Object.StorageID[ll_i] // mtrlid_mx_mx = ds_outwaremx_mx.Object.mtrlid[ll_i] // plancode_mx_mx = ds_outwaremx_mx.Object.plancode[ll_i] // status_mx_mx = ds_outwaremx_mx.Object.status[ll_i] // woodcode_mx_mx = ds_outwaremx_mx.Object.woodcode[ll_i] // pcode_mx_mx = ds_outwaremx_mx.Object.pcode[ll_i] // mtrlcuscode_mx_mx = ds_outwaremx_mx.Object.mtrlcuscode[ll_i] // location_mx_mx = ds_outwaremx_mx.Object.Location[ll_i] // sptid_mx_mx = ds_outwaremx_mx.Object.sptid[ll_i] // dxflag_mx_mx = ds_outwaremx_mx.Object.dxflag[ll_i] // planqty_mx_mx = ds_outwaremx_mx.Object.planqty[ll_i] // qty_mx_mx = ds_outwaremx_mx.Object.qty[ll_i] // mxdscrp_mx_mx = ds_outwaremx_mx.Object.mxdscrp[ll_i] // sptmtrlcode_mx_mx = ds_outwaremx_mx.Object.u_mtrldef_mtrlcode[ll_i] // sptmtrlname_mx_mx = ds_outwaremx_mx.Object.u_mtrldef_mtrlname[ll_i] // sptmtrlmode_mx_mx = ds_outwaremx_mx.Object.u_mtrldef_mtrlmode[ll_i] // // INSERT INTO LJFIEB_tempoutwaremx_mx // (scid, // outwareid, // printid, // mxprintid, // mtrlwareid, // storageid, // mtrlid, // plancode, // status, // woodcode, // pcode, // mtrlcuscode, // location, // sptid, // dxflag, // planqty, // qty, // mxdscrp, // serialnum, // sptmtrlcode, // sptmtrlname, // sptmtrlmode) // VALUES (:arg_scid, // :arg_outwareid, // :printid_mx_mx, // :mxprintid_mx_mx, // :mtrlwareid_mx_mx, // :storageid_mx_mx, // :mtrlid_mx_mx, // :plancode_mx_mx, // :status_mx_mx, // :woodcode_mx_mx, // :pcode_mx_mx, // :mtrlcuscode_mx_mx, // :location_mx_mx, // :sptid_mx_mx, // :dxflag_mx_mx, // :planqty_mx_mx, // :qty_mx_mx, // :mxdscrp_mx_mx, // :ls_serialnum, // :sptmtrlcode_mx_mx, // :sptmtrlname_mx_mx, // :sptmtrlmode_mx_mx) Using commit_transaction; // IF commit_transaction.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '插入销售发货单包件临时明细表失败,'+commit_transaction.SQLErrText // GOTO ext // END IF //NEXT // //ds_outwaremx_barcode.Retrieve(arg_scid,arg_outwareid) // //FOR ll_i = 1 To ds_outwaremx_barcode.RowCount() // billtype_mx_b = ds_outwaremx_barcode.Object.billtype[ll_i] // barcode_mx_b = ds_outwaremx_barcode.Object.barcode[ll_i] // qty_mx_b = ds_outwaremx_barcode.Object.qty[ll_i] // printid_mx_b = ds_outwaremx_barcode.Object.printid[ll_i] // // INSERT INTO LJFIEB_tempoutwaremx_mx_barcode // (scid, // outwareid, // billtype, // barcode, // qty, // serialnum, // printid) // VALUES (:arg_scid, // :arg_outwareid, // :billtype_mx_b, // :barcode_mx_b, // :qty_mx_b, // :ls_serialnum, // :printid_mx_b) Using commit_transaction; // IF commit_transaction.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '插入销售发货单临时条码表失败,'+commit_transaction.SQLErrText // GOTO ext // END IF //NEXT String ls_tablename ls_tablename = 'LJFIEB_tempoutware,LJFIEB_tempoutwaremx' IF ds_outwaremx_mx.RowCount() > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_tempoutwaremx_mx' END IF IF ds_outwaremx_barcode.RowCount() > 0 THEN ls_tablename = ls_tablename + ',LJFIEB_tempoutwaremx_mx_barcode' END IF IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,4,ls_summary,arg_postscript,arg_remark,'',outwarecode,cusid,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds_outwaremx; Destroy ds_outwaremx_mx; Destroy ds_outwaremx_barcode; RETURN rslt end function public function integer send_spt_price (long arg_billid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit); Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i datastore ds_pricemx ds_pricemx = Create datastore ds_pricemx.DataObject = 'ds_spt_price_changemx_send_ljfieb' ds_pricemx.SetTransObject(sqlca) SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = 0 Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT u_spt.ifecomm, u_spt.commcode, u_spt.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_spt_price_change INNER JOIN u_spt ON u_spt_price_change.sptID = u_spt.sptid Where u_spt_price_change.billid = :arg_billid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商询价单相关供应商通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '供应商没有使用电子商务,不能发送单据' GOTO ext END IF SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商相关通信设置失败,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID = 0 THEN rslt = 0 arg_msg = '供应商相关的通信设置不正确,请检查' GOTO ext END IF Long billid,moneyid,sptID String billcode ,inrep, dscrp, opemp,ls_moneyname DateTime billdate,opdate moneyid = 11 //默认本位币 SELECT billid, billcode, billdate, inrep, dscrp, opemp, opdate,sptid INTO :billid, :billcode, :billdate,:inrep, :dscrp, :opemp, :opdate,:sptid FROM u_spt_price_change Where billid = :arg_billid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商询价单信息失败,'+sqlca.SQLErrText GOTO ext END IF SELECT name INTO :ls_moneyname FROM cw_currency Where moneyid = :moneyid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商询价单币种失败,'+sqlca.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_tempspt_price_change (serialnum, billid, billcode, billdate, inrep, dscrp, opemp, opdate, moneyname) VALUES (:ls_SerialNum, :billid, :billcode, :billdate, :inrep, :dscrp, :opemp, :opdate, :ls_moneyname) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时供应商询价单表失败,'+commit_transaction.SQLErrText GOTO ext END IF ds_pricemx.Retrieve(arg_billid) Long billid_mx, printid_mx, mtrlid_mx String unit_mx, dscrp_mx Decimal price_mx, qty_mx, qty1_mx String sptmtrlcode, sptmtrlname,sptmtrlmode string status_mx,woodcode_mx,pcode_mx,jgdscrp_mx FOR ll_i = 1 To ds_pricemx.RowCount() printid_mx = ds_pricemx.Object.printid[ll_i] mtrlid_mx = ds_pricemx.Object.mtrlid[ll_i] unit_mx = ds_pricemx.Object.unit[ll_i] price_mx = ds_pricemx.Object.price[ll_i] qty_mx = ds_pricemx.Object.qty[ll_i] qty1_mx = ds_pricemx.Object.qty1[ll_i] dscrp_mx = ds_pricemx.Object.dscrp[ll_i] status_mx = ds_pricemx.Object.status[ll_i] woodcode_mx = ds_pricemx.Object.woodcode[ll_i] pcode_mx = ds_pricemx.Object.pcode[ll_i] jgdscrp_mx = ds_pricemx.Object.jgdscrp[ll_i] SELECT sptmtrlcode, sptmtrlname,sptmtrlmode INTO :sptmtrlcode, :sptmtrlname,:sptmtrlmode FROM u_sptmtrlname WHERE sptid = :sptid And mtrlid = :mtrlid_mx Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '第'+String(ll_i)+'行,查询供应商物料别名信息失败,'+sqlca.SQLErrText GOTO ext END IF ls_summary = ls_summary + '['+sptmtrlcode+']' + sptmtrlname + ',' INSERT INTO LJFIEB_tempspt_price_changemx (serialnum, billid, printid, mtrlid, sptmtrlcode, sptmtrlname, sptmtrlmode, unit, price, qty, qty1, dscrp, status, woodcode, pcode, jgdscrp) VALUES (:ls_serialnum, :billid, :printid_mx, :mtrlid_mx, :sptmtrlcode, :sptmtrlname, :sptmtrlmode, :unit_mx, :price_mx, :qty_mx, :qty1_mx, :dscrp_mx, :status_mx, :woodcode_mx, :pcode_mx, :jgdscrp_mx)Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时供应商询价单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'LJFIEB_tempspt_price_change,LJFIEB_tempspt_price_changemx' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,0,ls_summary,arg_postscript,arg_remark,'',billcode,0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds_pricemx RETURN rslt end function public function integer send_quote (long arg_scid, long arg_quoteid, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i Long cnt s_mtrldef_array s_post_mtrl datastore ds_pricemx ds_pricemx = Create datastore ds_pricemx.DataObject = 'ds_quotemx_send_ljfieb' ds_pricemx.SetTransObject(sqlca) SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = :arg_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT u_cust.ifecomm, u_cust.commcode, u_cust.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_quote INNER JOIN u_cust ON u_quote.cusid = u_cust.cusid WHERE u_quote.scid = :arg_scid And u_quote.quoteid = :arg_quoteid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询销售报价单相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '客户没有使用电子商务,不能发送单据' GOTO ext END IF If li_ifecomm = 2 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where CusType = 5 Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '请先确认已设置电子商务网站通讯连接!' Goto ext End If ElseIf li_ifecomm = 1 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '客户相关的通信设置不正确,请检查' Goto ext End If End If String quotecode Long cusid,moneyid DateTime quotedate String assign_emp, relcode, dscrp, opemp,ls_moneyname,fiebrelcode DateTime opdate moneyid = 11 //默认本位币 SELECT quotecode, cusid, quotedate, assign_emp, relcode, dscrp, opemp, opdate, fiebrelcode INTO :quotecode, :cusid, :quotedate, :assign_emp, :relcode, :dscrp, :opemp, :opdate, :fiebrelcode FROM u_quote WHERE scid = :arg_scid And quoteid = :arg_quoteid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询销售报价单信息失败,'+sqlca.SQLErrText GOTO ext END IF SELECT name INTO :ls_moneyname FROM cw_currency Where moneyid = :moneyid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询供应商询价单币种失败,'+sqlca.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_tempquote (serialnum, scid, quoteid, quotecode, cusid, quotedate, assign_emp, relcode, dscrp, opemp, opdate, moneyname, fiebrelcode) VALUES (:ls_serialnum, :arg_scid, :arg_quoteid, :quotecode, :cusid, :quotedate, :assign_emp, :relcode, :dscrp, :opemp, :opdate, :ls_moneyname, :fiebrelcode) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时销售报价单表失败,'+commit_transaction.SQLErrText GOTO ext END IF ds_pricemx.Retrieve(arg_scid,arg_quoteid) Long printid_mx, mtrlid_mx String mtrlcode_mx, mtrlname_mx, mtrlmode_mx, unit_mx Decimal price_mx, rebate_mx, qty_mx, qty1_mx String mxdscrp_mx, status_mx, woodcode_mx, pcode_mx FOR ll_i = 1 To ds_pricemx.RowCount() printid_mx = ds_pricemx.Object.printid[ll_i] mtrlid_mx = ds_pricemx.Object.mtrlid[ll_i] mtrlcode_mx = ds_pricemx.Object.u_mtrldef_mtrlcode[ll_i] mtrlname_mx = ds_pricemx.Object.u_mtrldef_mtrlname[ll_i] mtrlmode_mx = ds_pricemx.Object.u_mtrldef_mtrlmode[ll_i] unit_mx = ds_pricemx.Object.u_mtrldef_unit[ll_i] price_mx = ds_pricemx.Object.sumprice_1[ll_i] rebate_mx = ds_pricemx.Object.rebate[ll_i] qty_mx = ds_pricemx.Object.qty[ll_i] qty1_mx = ds_pricemx.Object.qty1[ll_i] mxdscrp_mx = ds_pricemx.Object.mxdscrp[ll_i] status_mx = ds_pricemx.Object.status[ll_i] woodcode_mx = ds_pricemx.Object.woodcode[ll_i] pcode_mx = ds_pricemx.Object.pcode[ll_i] SELECT count(0) INTO :cnt FROM u_cusmtrlname WHERE cusid = :cusid And mtrlid = :mtrlid_mx Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询客户别名失败,' + sqlca.SQLErrText GOTO ext END IF IF cnt = 0 THEN IF f_ljfieb_fillmtrl(mtrlcode_mx,0,s_post_mtrl,arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF END IF INSERT INTO LJFIEB_tempquotemx (serialnum, scid, quoteid, printid, mtrlid, mtrlcode, mtrlname, mtrlmode, unit, price, rebate, qty, qty1, mxdscrp, status, woodcode, pcode) VALUES (:ls_serialnum, :arg_scid, :arg_quoteid, :printid_mx, :mtrlid_mx, :mtrlcode_mx, :mtrlname_mx, :mtrlmode_mx, :unit_mx, :price_mx, :rebate_mx, :qty_mx, :qty1_mx, :mxdscrp_mx, :status_mx, :woodcode_mx, :pcode_mx) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时销售询价单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'LJFIEB_tempquote,LJFIEB_tempquotemx' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,1,ls_summary,arg_postscript,arg_remark,'',quotecode,cusid,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF IF UpperBound(s_post_mtrl.MtrlID) > 0 THEN IF add_mtrldef(ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,s_post_mtrl,ls_summary,arg_postscript,arg_remark,arg_msg,False) <> 1 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds_pricemx RETURN rslt end function public function integer send_mtrlware (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrlware_ljfieb arg_s_mtrlware[], ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_i String ls_SerialNum,ls_tablename SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF IF UpperBound(arg_s_mtrlware) = 0 THEN rslt = 0 arg_msg = '没有可发送的内容' GOTO ext END IF FOR ll_i = 1 To UpperBound(arg_s_mtrlware) INSERT INTO LJFIEB_mtrlware (SerialNum, scid, mtrlwareid, mtrlid, storagename, status, woodcode, pcode, plancode, mtrlcuscode, location, notauditnoallocqty, mtrlcode, mtrlname) VALUES (:ls_SerialNum, :arg_s_mtrlware[ll_i].scid, :arg_s_mtrlware[ll_i].mtrlwareid, :arg_s_mtrlware[ll_i].mtrlid, :arg_s_mtrlware[ll_i].storagename, :arg_s_mtrlware[ll_i].status, :arg_s_mtrlware[ll_i].woodcode, :arg_s_mtrlware[ll_i].pcode, :arg_s_mtrlware[ll_i].plancode, :arg_s_mtrlware[ll_i].mtrlcuscode, :arg_s_mtrlware[ll_i].location, :arg_s_mtrlware[ll_i].notauditnoallocqty, :arg_s_mtrlware[ll_i].mtrlcode, :arg_s_mtrlware[ll_i].mtrlname) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时库存表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT ls_tablename = 'LJFIEB_mtrlware' IF add_packet(ls_SerialNum,ls_tablename,arg_sendcuscommid,arg_sendsccode,arg_receivecuscommid,arg_receivesccode,18,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_mtrl_match (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_mtrl_match_ljfieb arg_s_match[], ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_i String ls_SerialNum,ls_tablename SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF IF UpperBound(arg_s_match) = 0 THEN rslt = 0 arg_msg = '没有可发送的内容' GOTO ext END IF FOR ll_i = 1 To UpperBound(arg_s_match) INSERT INTO LJFIEB_mtrl_match (serialnum, mtrlcode_spt, mtrlcode_self, mtrlname_self, mtrlmode_self) VALUES (:ls_SerialNum, :arg_s_match[ll_i].mtrlcode_spt, :arg_s_match[ll_i].mtrlcode_self, :arg_s_match[ll_i].mtrlname_self, :arg_s_match[ll_i].mtrlmode_self) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时资料匹配反馈表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT ls_tablename = 'LJFIEB_mtrl_match' IF add_packet(ls_SerialNum,ls_tablename,arg_sendcuscommid,arg_sendsccode,arg_receivecuscommid,arg_receivesccode,19,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_buytask_jd (long arg_scid, long arg_taskid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i,ll_cusid String ls_fiebrelcode Long ll_status datastore ds_jd ds_jd = Create datastore ds_jd.DataObject = 'ds_buytask_jd_ljfieb' ds_jd.SetTransObject(sqlca) SELECT u_cust.ifecomm, u_cust.commcode, u_cust.commsccode, u_cust.cusid, u_saletask.fiebrelcode, u_saletask.status INTO :li_ifecomm, :ls_commcode, :ls_commsccode, :ll_cusid, :ls_fiebrelcode, :ll_status FROM u_saletask INNER JOIN u_cust ON u_saletask.cusid = u_cust.cusid WHERE u_saletask.scid = :arg_scid And u_saletask.taskid = :arg_taskid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询销售订单相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF ll_status <= 0 THEN ll_status = 1 END IF IF li_ifecomm = 0 THEN rslt = 0 arg_msg = '客户没有使用电子商务,不能发送单据' GOTO ext END IF SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = :arg_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF IF li_ifecomm = 2 THEN SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID = 0 THEN rslt = 0 arg_msg = '请先确认已设置电子商务网站通讯连接!' GOTO ext END IF ELSEIF li_ifecomm = 1 THEN SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID = 0 THEN rslt = 0 arg_msg = '客户相关的通信设置不正确,请检查' GOTO ext END IF END IF ds_jd.Retrieve(arg_scid,arg_taskid) IF ds_jd.RowCount() <= 0 THEN rslt = 0 arg_msg = '没有可发送的进度内容' GOTO ext END IF String ls_taskcode Long ll_printid String ls_mtrlcode,ls_mtrlname Decimal ld_orderqty,ld_acmpqty,ld_saleoutqty,ld_outwareqty DateTime ldt_perfinishdate FOR ll_i = 1 To ds_jd.RowCount() // ls_taskcode = ds_jd.Object.u_saletask_taskcode[ll_i] ll_printid = ds_jd.Object.u_saletaskmx_printid[ll_i] ls_mtrlcode = ds_jd.Object.u_mtrldef_mtrlcode[ll_i] ls_mtrlname = ds_jd.Object.u_mtrldef_mtrlname[ll_i] ld_orderqty = ds_jd.Object.v_order_ml_orderqty[ll_i] ld_acmpqty = ds_jd.Object.v_order_ml_acmpqty[ll_i] ld_saleoutqty = ds_jd.Object.u_saletaskmx_saleoutqty[ll_i] ld_outwareqty = ds_jd.Object.u_saletaskmx_consignedqty[ll_i] ldt_perfinishdate = ds_jd.Object.v_order_ml_perfinishdate[ll_i] INSERT INTO LJFIEB_buytask_jd (SerialNum, taskcode, printid, mtrlcode, mtrlname, orderqty, perfinishdate, acmpqty, saleoutqty, outwareqty) VALUES (:ls_SerialNum, :ls_fiebrelcode, :ll_printid, :ls_mtrlcode, :ls_mtrlname, :ld_orderqty, :ldt_perfinishdate, :ld_acmpqty, :ld_saleoutqty, :ld_outwareqty)Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单进度表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT INSERT INTO LJFIEB_tempbuyTask (scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, Status, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, reason, billtype, firpermitemp, firpermitdate, billamt, moneyid, mrate, serialnum, sys_changetime, banktypename, moneyname, dscrp2, station_name, station_tel, shouhuoren, shouhuoren_tel, shouhuoren_address, childCusID, spt_dscrp, spt_dscrp2, cusid) SELECT TOP 1 scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, :ll_status, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, reason, billtype, firpermitemp, firpermitdate, billamt, moneyid, mrate, :ls_SerialNum, GETDATE(), banktypename, moneyname, dscrp2, station_name, station_tel, shouhuoren, shouhuoren_tel, shouhuoren_address, childCusID, spt_dscrp, spt_dscrp2, cusid FROM LJFIEB_tempbuyTask AS LJFIEB_tempbuyTask_1 WHERE (TaskCode = :ls_fiebrelcode) ORDER BY sys_changetime DESC Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单状态失败,'+commit_transaction.SQLErrText GOTO ext END IF IF commit_transaction.SQLNRows <> 1 THEN rslt = 0 arg_msg = '插入临时采购订单状态失败' GOTO ext END IF String ls_tablename ls_tablename = 'LJFIEB_buytask_jd,LJFIEB_tempbuyTask' IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,23,arg_summary,arg_postscript,arg_remark,'',ls_fiebrelcode,ll_cusid,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 add_packet (string arg_serialnum, string arg_tablename, long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, integer arg_billtype, string arg_summary, string arg_postscript, string arg_remark, string arg_relatedserialnum, string arg_relatedcode, long arg_cusid, ref string arg_msg, boolean arg_ifcommit); Int rslt = 1 Long cnt IF IsNull(arg_SerialNum) THEN arg_SerialNum = '' IF IsNull(arg_TableName) THEN arg_TableName = '' IF IsNull(arg_SendCusCommID) THEN arg_SendCusCommID = 0 IF IsNull(arg_SendSCcode) THEN arg_SendSCcode = '' IF IsNull(arg_ReceiveCusCommID) THEN arg_ReceiveCusCommID = 0 IF IsNull(arg_ReceiveSCcode) THEN arg_ReceiveSCcode = '' IF IsNull(arg_billtype) THEN arg_billtype = 0 IF IsNull(arg_Summary) THEN arg_Summary = '' IF IsNull(arg_Postscript) THEN arg_Postscript = '' IF IsNull(arg_Remark) THEN arg_Remark = '' IF IsNull(arg_RelatedCode) THEN arg_RelatedCode = '' IF arg_relatedserialnum = '' THEN SetNull(arg_relatedserialnum) IF IsNull(arg_cusid) THEN arg_cusid = 0 IF arg_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF IF arg_SendCusCommID = 0 THEN rslt = 0 arg_msg = '错误的发送者企业编号' GOTO ext END IF IF arg_ReceiveCusCommID = 0 THEN rslt = 0 arg_msg = '错误的接收者企业编号' GOTO ext END IF SELECT count(*) INTO :cnt FROM LJFIEB_CusComm Where CusCommID = :arg_ReceiveCusCommID Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询接收者信息失败,'+commit_transaction.SQLErrText GOTO ext END IF IF cnt = 0 THEN rslt = 0 arg_msg = '没有找到接收者的相关信息,请先设定' GOTO ext ELSEIF cnt <> 1 THEN rslt = 0 arg_msg = '找到多个接收者,请先确认接收者设置信息' GOTO ext END IF String ls_SendCusID, ls_ReceiveCusID SELECT CusID INTO :ls_ReceiveCusID FROM LJFIEB_CusComm Where CusCommID = :arg_ReceiveCusCommID Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询接收者唯一码失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT CusID INTO :ls_SendCusID FROM LJFIEB_CusComm Where CusCommID = :arg_SendCusCommID Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询发送者唯一码失败,'+commit_transaction.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_packet (SerialNum, TableName, SendCusCommID, SendSCcode, AddUser, AddTime, ReceiveCusCommID, ReceiveSCcode, Status, BillType, Summary, Postscript, Remark, RelatedCode, RelatedSerialNum, SendTime, cusid, SendCusID, ReceiveCusID) VALUES (:arg_SerialNum, :arg_TableName, :arg_SendCusCommID, :arg_SendSCcode, :publ_operator, getdate(), :arg_ReceiveCusCommID, :arg_ReceiveSCcode, 0, :arg_BillType, :arg_Summary, :arg_Postscript, :arg_Remark, :arg_RelatedCode, :arg_relatedserialnum, getdate(), :arg_cusid, :ls_SendCusID, :ls_ReceiveCusID) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入数据交换表失败,'+commit_transaction.SQLErrText GOTO ext END IF 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 update_buytask_jd (string arg_taskcode, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_sn long ll_i datetime ldt_SendTime datastore ds_jd ds_jd = create datastore ds_jd.dataobject = 'ds_buytask_jd_get_ljfieb' ds_jd.settransobject(commit_transaction) Select top 1 SerialNum,SendTime Into :ls_sn,:ldt_SendTime From LJFIEB_packet Where billtype = 23 And RelatedCode = :arg_taskcode Order By sendtime Desc Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询通讯数据库订单进度资料失败,'+commit_transaction.SQLErrText Goto ext ElseIf commit_transaction.SQLCode = 100 Then rslt = 0 arg_msg = '没有找到订单进度数据' Goto ext End If ds_jd.retrieve(ls_sn,arg_taskcode) if ds_jd.rowcount() <= 0 then rslt = 0 arg_msg = '没有找到订单进度数据' Goto ext End If String ls_taskcode Long ll_printid String ls_mtrlcode,ls_mtrlname Decimal ld_orderqty,ld_acmpqty,ld_saleoutqty,ld_outwareqty DateTime ldt_perfinishdate DELETE FROM u_buytask_jd Where u_buytask_jd.taskcode = :arg_taskcode Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 ARG_MSG = "删除采购订单原进度数据操作失败"+"~n"+sqlca.SQLErrText GOTO ext END IF For ll_i = 1 To ds_jd.RowCount() ls_taskcode = ds_jd.Object.taskcode[ll_i] ll_printid = ds_jd.Object.printid[ll_i] ls_mtrlcode = ds_jd.Object.mtrlcode[ll_i] ls_mtrlname = ds_jd.Object.mtrlname[ll_i] ld_orderqty = ds_jd.Object.orderqty[ll_i] ld_acmpqty = ds_jd.Object.acmpqty[ll_i] ld_saleoutqty = ds_jd.Object.saleoutqty[ll_i] ld_outwareqty = ds_jd.Object.outwareqty[ll_i] ldt_perfinishdate = ds_jd.Object.perfinishdate[ll_i] Insert Into u_buytask_jd (taskcode, printid, mtrlcode, mtrlname, orderqty, perfinishdate, acmpqty, saleoutqty, outwareqty, sendtime) Values (:ls_taskcode, :ll_printid, :ls_mtrlcode, :ls_mtrlname, :ld_orderqty, :ldt_perfinishdate, :ld_acmpqty, :ld_saleoutqty, :ld_outwareqty, :ldt_SendTime)Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '插入采购订单进度表失败,'+sqlca.SQLErrText Goto ext End If Next //更新本地通信记录 UPDATE LJFIEB_packet SET status = 6, Complete = 1, ConfirmTime = getdate(), ConfirmUser = :publ_operator Where billtype = 23 And RelatedCode = :arg_taskcode and Complete = 0 and SendTime <= :ldt_SendTime Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '更新本地通信记录失败,'+commit_transaction.SQLErrText goto ext END IF ext: IF rslt = 0 THEN ROLLBACK Using sqlca; ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using sqlca; COMMIT Using commit_transaction; END IF RETURN rslt end function public function integer send_reissue (long arg_scid, long arg_reissueid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i datastore ds_mx ds_mx = Create datastore ds_mx.DataObject = 'ds_reissuemx_ljfieb' ds_mx.SetTransObject(sqlca) Select TOP 1 NEWID() Into :ls_SerialNum From u_user Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText Goto ext End If If IsNull(ls_SerialNum) Then ls_SerialNum = '' If ls_SerialNum = '' Then rslt = 0 arg_msg = '错误的发送序列号' Goto ext End If //查询本企业通信信息 Select CusCommID Into :ll_SendCusCommID From LJFIEB_CusComm Where CusType = 0 Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+commit_transaction.SQLErrText Goto ext End If Select sccode Into :ls_SendSCcode From u_scdef Where scid = :arg_scid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText Goto ext End If Select u_cust.ifecomm, u_cust.commcode, u_cust.commsccode Into :li_ifecomm, :ls_commcode, :ls_commsccode From u_reissue LEFT Outer JOIN u_cust ON u_reissue.cusid = u_cust.cusid Where u_reissue.scid = :arg_scid And u_reissue.reissueid = :arg_reissueid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户费用单相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText Goto ext End If If li_ifecomm = 0 Then rslt = 0 arg_msg = '客户没有使用电子商务,不能发送单据' Goto ext End If If li_ifecomm = 2 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where CusType = 5 Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '请先确认已设置电子商务网站通讯连接!' Goto ext End If ElseIf li_ifecomm = 1 Then Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '客户相关的通信设置不正确,请检查' Goto ext End If End If String cuscode,cusname DateTime reissuedate,opdate,moddate,auditingdate String relcode,reissueemp,itemcode,dscrp,opemp,modemp,auditingrep,reissuecode Int li_type String itemname,banktypename,moneyname long cusid Select u_cust.cuscode, u_cust.name, u_reissue.reissuedate, u_reissue.relcode, u_reissue.reissueemp, u_itemdef.itemcode, u_reissue.dscrp, u_reissue.opemp, u_reissue.opdate, u_reissue.modemp, u_reissue.moddate, u_reissue.auditingrep, u_reissue.auditingdate, u_reissue.reissuecode, u_reissue.type, u_itemdef.itemname, cw_banktype.banktypename, cw_currency.name, u_cust.cusid Into :cuscode, :cusname, :reissuedate, :relcode, :reissueemp, :itemcode, :dscrp, :opemp, :opdate, :modemp, :moddate, :auditingrep, :auditingdate, :reissuecode, :li_type, :itemname, :banktypename, :moneyname, :cusid From u_reissue LEFT Outer JOIN cw_currency ON u_reissue.moneyid = cw_currency.moneyid LEFT Outer JOIN cw_banktype ON u_reissue.relid = cw_banktype.banktypeid LEFT Outer JOIN u_itemdef ON u_reissue.itemid = u_itemdef.itemid LEFT Outer JOIN u_cust ON u_reissue.cusid = u_cust.cusid Where u_reissue.reissueid = :arg_reissueid And u_reissue.scid = :arg_scid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户费用单信息失败,'+sqlca.SQLErrText Goto ext End If Insert Into LJFIEB_reissue (serialnum, scid, reissueid, reissuecode, cuscode, cusname, reissuedate, banktypename, moneyname, relcode, reissueemp, itemcode, itemname, dscrp, opemp, opdate, modemp, moddate, auditingrep, auditingdate, type) Values (:ls_SerialNum, :arg_scid, :arg_reissueid, :reissuecode, :cuscode, :cusname, :reissuedate, :banktypename, :moneyname, :relcode, :reissueemp, :itemcode, :itemname, :dscrp, :opemp, :opdate, :modemp, :moddate, :auditingrep, :auditingdate, :li_type) Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时客户费用单表失败,'+commit_transaction.SQLErrText Goto ext End If ds_mx.Retrieve(arg_scid,arg_reissueid) Long printid String ExpensesCode,ExpensesName Decimal Qty,amt,price,tax String mxdscrp For ll_i = 1 To ds_mx.RowCount() printid = ds_mx.Object.u_reissuemx_printid[ll_i] ExpensesCode = ds_mx.Object.u_expenses_expensescode[ll_i] ExpensesName = ds_mx.Object.u_expenses_expensesname[ll_i] Qty = ds_mx.Object.u_reissuemx_qty[ll_i] amt = ds_mx.Object.u_reissuemx_amt[ll_i] price = ds_mx.Object.u_reissuemx_price[ll_i] // tax = ds_mx.Object.u_reissuemx_tax[ll_i] mxdscrp = ds_mx.Object.u_reissuemx_dscrp[ll_i] Insert Into LJFIEB_reissuemx (serialnum, scid, reissueid, printid, expensescode, expensesname, qty, amt, price, dscrp) Values (:ls_SerialNum, :arg_scid, :arg_reissueid, :printid, :expensescode, :expensesname, :qty, :amt, :price, :mxdscrp) Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时客户费用单明细表失败,'+commit_transaction.SQLErrText Goto ext End If Next String ls_tablename,ls_Summary ls_tablename = 'LJFIEB_reissue,LJFIEB_reissuemx' If lena(ls_Summary) > 100 Then ls_Summary = LeftA(ls_Summary,90) + '......' arg_summary = ls_Summary If add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,16,arg_summary,arg_postscript,arg_remark,'',reissuecode,cusid,arg_msg,False) = 0 Then rslt = 0 Goto ext End If ext: If rslt = 0 Then Rollback Using commit_transaction; ElseIf rslt = 1 And arg_ifcommit Then Commit Using commit_transaction; End If Destroy ds_mx Return rslt end function public function integer send_reissue_spt (long arg_scid, long arg_reissueid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_SendCusCommID String ls_SendSCcode Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i datastore ds_mx ds_mx = Create datastore ds_mx.DataObject = 'ds_reissuemx_ljfieb' ds_mx.SetTransObject(sqlca) Select TOP 1 NEWID() Into :ls_SerialNum From u_user Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText Goto ext End If If IsNull(ls_SerialNum) Then ls_SerialNum = '' If ls_SerialNum = '' Then rslt = 0 arg_msg = '错误的发送序列号' Goto ext End If //查询本企业通信信息 Select CusCommID Into :ll_SendCusCommID From LJFIEB_CusComm Where CusType = 0 Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+commit_transaction.SQLErrText Goto ext End If Select sccode Into :ls_SendSCcode From u_scdef Where scid = :arg_scid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText Goto ext End If Select u_spt.ifecomm, u_spt.commcode, u_spt.commsccode Into :li_ifecomm, :ls_commcode, :ls_commsccode From u_reissue LEFT Outer JOIN u_spt ON u_reissue.cusid = u_spt.sptid Where u_reissue.scid = :arg_scid And u_reissue.reissueid = :arg_reissueid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询供应商费用单相关供应商通信信息失败,请检查设置,'+sqlca.SQLErrText Goto ext End If If li_ifecomm = 0 Then rslt = 0 arg_msg = '供应商没有使用电子商务,不能发送单据' Goto ext End If Select CusCommID Into :ll_ReceiveCusCommID From LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText Goto ext End If If ll_ReceiveCusCommID = 0 Then rslt = 0 arg_msg = '客户相关的通信设置不正确,请检查' Goto ext End If String cuscode,cusname DateTime reissuedate,opdate,moddate,auditingdate String relcode,reissueemp,itemcode,dscrp,opemp,modemp,auditingrep,reissuecode Int li_type String itemname,banktypename,moneyname Select u_spt.sptcode, u_spt.name, u_reissue.reissuedate, u_reissue.relcode, u_reissue.reissueemp, u_itemdef.itemcode, u_reissue.dscrp, u_reissue.opemp, u_reissue.opdate, u_reissue.modemp, u_reissue.moddate, u_reissue.auditingrep, u_reissue.auditingdate, u_reissue.reissuecode, u_reissue.type, u_itemdef.itemname, cw_banktype.banktypename, cw_currency.name Into :cuscode, :cusname, :reissuedate, :relcode, :reissueemp, :itemcode, :dscrp, :opemp, :opdate, :modemp, :moddate, :auditingrep, :auditingdate, :reissuecode, :li_type, :itemname, :banktypename, :moneyname From u_reissue LEFT Outer JOIN cw_currency ON u_reissue.moneyid = cw_currency.moneyid LEFT Outer JOIN cw_banktype ON u_reissue.relid = cw_banktype.banktypeid LEFT Outer JOIN u_itemdef ON u_reissue.itemid = u_itemdef.itemid LEFT Outer JOIN u_spt ON u_reissue.cusid = u_spt.sptid Where u_reissue.reissueid = :arg_reissueid And u_reissue.scid = :arg_scid Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '查询供应商费用单信息失败,'+sqlca.SQLErrText Goto ext End If Insert Into LJFIEB_reissue (serialnum, scid, reissueid, reissuecode, cuscode, cusname, reissuedate, banktypename, moneyname, relcode, reissueemp, itemcode, itemname, dscrp, opemp, opdate, modemp, moddate, auditingrep, auditingdate, type) Values (:ls_SerialNum, :arg_scid, :arg_reissueid, :reissuecode, :cuscode, :cusname, :reissuedate, :banktypename, :moneyname, :relcode, :reissueemp, :itemcode, :itemname, :dscrp, :opemp, :opdate, :modemp, :moddate, :auditingrep, :auditingdate, :li_type) Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时供应商费用单表失败,'+commit_transaction.SQLErrText Goto ext End If ds_mx.Retrieve(arg_scid,arg_reissueid) Long printid String ExpensesCode,ExpensesName Decimal Qty,amt,price,tax String mxdscrp For ll_i = 1 To ds_mx.RowCount() printid = ds_mx.Object.u_reissuemx_printid[ll_i] ExpensesCode = ds_mx.Object.u_expenses_expensescode[ll_i] ExpensesName = ds_mx.Object.u_expenses_expensesname[ll_i] Qty = ds_mx.Object.u_reissuemx_qty[ll_i] amt = ds_mx.Object.u_reissuemx_amt[ll_i] price = ds_mx.Object.u_reissuemx_price[ll_i] // tax = ds_mx.Object.u_reissuemx_tax[ll_i] mxdscrp = ds_mx.Object.u_reissuemx_dscrp[ll_i] Insert Into LJFIEB_reissuemx (serialnum, scid, reissueid, printid, expensescode, expensesname, qty, amt, price, dscrp) Values (:ls_SerialNum, :arg_scid, :arg_reissueid, :printid, :expensescode, :expensesname, :qty, :amt, :price, :mxdscrp) Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时供应商费用单明细表失败,'+commit_transaction.SQLErrText Goto ext End If Next String ls_tablename,ls_Summary ls_tablename = 'LJFIEB_reissue,LJFIEB_reissuemx' If lena(ls_Summary) > 100 Then ls_Summary = LeftA(ls_Summary,90) + '......' arg_summary = ls_Summary If add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,21,arg_summary,arg_postscript,arg_remark,'',reissuecode,0,arg_msg,False) = 0 Then rslt = 0 Goto ext End If ext: If rslt = 0 Then Rollback Using commit_transaction; ElseIf rslt = 1 And arg_ifcommit Then Commit Using commit_transaction; End If Destroy ds_mx Return rslt end function public function integer uof_chk_receive (integer arg_chktype, ref integer arg_ifecomm, ref string arg_msg);//ChkType : 0:自己; 1:供应商; 2:客户; 3:龙嘉网; 4: ; 5:电子商务 //uof_chk_receive Int rslt = 1 Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID //查询对方企业 IF arg_chktype = 0 THEN //自己 ELSEIF arg_chktype = 1 THEN //供应商 // SELECT SptID.ifecomm, // SptID.commcode, // SptID.commsccode // INTO :li_ifecomm, // :ls_commcode, // :ls_commsccode // FROM u_spt // Where SptID = :arg_chkid Using sqlca; // IF sqlca.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '查询相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText // GOTO ext // END IF ELSEIF arg_chktype = 2 THEN //客户 // SELECT u_cust.ifecomm, // u_cust.commcode, // u_cust.commsccode // INTO :li_ifecomm, // :ls_commcode, // :ls_commsccode // FROM u_cust // Where CusID = :arg_chkid Using sqlca; // IF sqlca.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '查询相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText // GOTO ext // END IF ELSEIF arg_chktype = 3 THEN //龙嘉网 ELSEIF arg_chktype = 5 THEN //电子商务 网站数据库 SELECT CusCommID, cuscode INTO :ll_ReceiveCusCommID, :ls_commcode FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN arg_ifecomm = 0 GOTO ext END IF IF ll_ReceiveCusCommID > 0 THEN arg_ifecomm = 1 END IF // SELECT sccode // INTO :ls_commsccode // FROM u_scdef // Where scid = :arg_scid Using sqlca; // IF sqlca.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText // GOTO ext // END IF END IF ext: RETURN rslt end function public function integer uof_get_receiveinfo (integer arg_chktype, long arg_chkid, ref long arg_receivecuscommid, ref string arg_commsccode, ref string arg_msg);//ChkType : 0:自己; 1:供应商; 2:客户; 3:龙嘉网; 4: ; 5:电子商务 //uof_get_ReceiveInfo Int rslt = 1 Int li_ifecomm String ls_commcode,ls_commsccode Long ll_ReceiveCusCommID //查询对方企业 IF arg_chktype = 0 THEN //自己 ELSEIF arg_chktype = 1 THEN //供应商 SELECT SptID.ifecomm, SptID.commcode, SptID.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_spt Where SptID = :arg_chkid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF ELSEIF arg_chktype = 2 THEN //客户 SELECT u_cust.ifecomm, u_cust.commcode, u_cust.commsccode INTO :li_ifecomm, :ls_commcode, :ls_commsccode FROM u_cust Where CusID = :arg_chkid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询相关客户通信信息失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF ELSEIF arg_chktype = 3 THEN //龙嘉网 ELSEIF arg_chktype = 5 THEN //电子商务 网站数据库 SELECT CusCommID, cuscode INTO :ll_ReceiveCusCommID, :ls_commcode FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务服务信息失败,请检查设置,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID > 0 THEN li_ifecomm = 1 END IF // SELECT sccode // INTO :ls_commsccode // FROM u_scdef // Where scid = :arg_scid Using sqlca; // IF sqlca.SQLCode <> 0 THEN // rslt = 0 // arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText // GOTO ext // END IF END IF IF li_ifecomm = 0 THEN rslt = 0 IF arg_chktype = 1 THEN //供应商 arg_msg = '供应商没有使用电子商务,不能发送数据' ELSEIF arg_chktype = 2 THEN //客户 arg_msg = '客户没有使用电子商务,不能发送数据' ELSEIF arg_chktype = 5 THEN //电子商务 arg_msg = '电子商务服务未设置,不能发送数据' ELSE arg_msg = '对方没有使用电子商务,不能发送数据' END IF GOTO ext END IF SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where cuscode = :ls_commcode Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询客户相关通信设置失败,'+commit_transaction.SQLErrText GOTO ext END IF IF ll_ReceiveCusCommID = 0 THEN rslt = 0 IF arg_chktype = 1 THEN //供应商 arg_msg = '供应商相关的通信设置不正确,请检查' ELSEIF arg_chktype = 2 THEN //客户 arg_msg = '客户相关的通信设置不正确,请检查' ELSEIF arg_chktype = 5 THEN //电子商务 arg_msg = '电子商务服务设置不正确,请检查' ELSE arg_msg = '对方相关的通信设置不正确,请检查' END IF GOTO ext END IF arg_ReceiveCusCommID = ll_ReceiveCusCommID arg_commsccode = ls_commsccode ext: RETURN rslt end function public function integer uof_get_selfinfo (long arg_scid, ref long arg_sendcuscommid, ref string arg_sendsccode, ref string arg_msg);//uof_get_SendInfo Int rslt = 1 Long ll_SendCusCommID String ls_SendSCcode //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本企业通信信息失败,请检查设置,'+commit_transaction.SQLErrText GOTO ext END IF SELECT sccode INTO :ls_SendSCcode FROM u_scdef Where scid = :arg_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询分部代号失败,请检查设置,'+sqlca.SQLErrText GOTO ext END IF arg_sendcuscommid = ll_SendCusCommID arg_sendsccode = ls_SendSCcode ext: return rslt end function public function string uof_get_serialnum ();String ls_SerialNum SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN ls_SerialNum = "" END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' RETURN ls_SerialNum end function public function integer send_mtrltype (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, long arg_mtrltypeid[], ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_i String ls_SerialNum,ls_tablename datastore ds_mtrltype ds_mtrltype = Create datastore ds_mtrltype.DataObject = 'ds_mtrltype_propel_ljfieb' ds_mtrltype.SetTransObject(sqlca) Select TOP 1 NEWID() Into :ls_SerialNum From u_user Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText Goto ext End If If IsNull(ls_SerialNum) Then ls_SerialNum = '' If ls_SerialNum = '' Then rslt = 0 arg_msg = '错误的发送序列号' Goto ext End If If UpperBound(arg_mtrltypeid) = 0 Then rslt = 0 arg_msg = '没有可发送的内容' Goto ext End If ds_mtrltype.Retrieve(arg_mtrltypeid) If ds_mtrltype.RowCount() <= 0 Then rslt = 0 arg_msg = '没有查询到可发送的物料类别' Goto ext End If Long mtrltypeid String mtrltype,handtype Long sonflag,parentid,mtrlprp String typecode,typecodestr For ll_i = 1 To ds_mtrltype.RowCount() mtrltypeid = ds_mtrltype.Object.mtrltypeid[ll_i] mtrltype = ds_mtrltype.Object.mtrltype[ll_i] handtype = ds_mtrltype.Object.handtype[ll_i] sonflag = ds_mtrltype.Object.sonflag[ll_i] parentid = ds_mtrltype.Object.parentid[ll_i] mtrlprp = ds_mtrltype.Object.mtrlprp[ll_i] typecode = ds_mtrltype.Object.typecode[ll_i] typecodestr = ds_mtrltype.Object.typecodestr[ll_i] Insert Into LJFIEB_mtrltype (mtrltypeid, mtrltype, handtype, sonflag, parentid, mtrlprp, typecode, typecodestr, serialnum) Values (:mtrltypeid, :mtrltype, :handtype, :sonflag, :parentid, :mtrlprp, :typecode, :typecodestr, :ls_SerialNum) Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时物料类别表失败,'+commit_transaction.SQLErrText Goto ext End If Next ls_tablename = 'LJFIEB_mtrltype' If add_packet(ls_SerialNum,ls_tablename,arg_sendcuscommid,arg_sendsccode,arg_receivecuscommid,arg_receivesccode,22,'','','','','',0,arg_msg,False) = 0 Then rslt = 0 Goto ext End If ext: If rslt = 0 Then Rollback Using commit_transaction; ElseIf rslt = 1 And arg_ifcommit Then Commit Using commit_transaction; End If destroy ds_mtrltype Return rslt end function public function integer send_post (long arg_sendcuscommid, string arg_sendsccode, long arg_receivecuscommid, string arg_receivesccode, s_post_ljfieb arg_s_post, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 Long ll_i String ls_SerialNum,ls_tablename Select TOP 1 NEWID() Into :ls_SerialNum From u_user Using sqlca; If sqlca.SQLCode <> 0 Then rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText Goto ext End If If IsNull(ls_SerialNum) Then ls_SerialNum = '' If ls_SerialNum = '' Then rslt = 0 arg_msg = '错误的发送序列号' Goto ext End If If arg_s_post.postid = 0 Then rslt = 0 arg_msg = '没有发送的公告内容' Goto ext End If Insert Into LJFIEB_sys_post (serialnum, CusCommID, postid, sdate, edate, dscrp, opemp, opdate, areaname, sys_changetime) Values (:ls_SerialNum, :arg_sendcuscommid, :arg_s_post.postid, :arg_s_post.sdate, :arg_s_post.edate, :arg_s_post.dscrp, :arg_s_post.opemp, :arg_s_post.opdate, :arg_s_post.areaname, getdate())Using commit_transaction; If commit_transaction.SQLCode <> 0 Then rslt = 0 arg_msg = '插入临时公告表失败,'+commit_transaction.SQLErrText Goto ext End If ls_tablename = 'LJFIEB_sys_post' If add_packet(ls_SerialNum,ls_tablename,arg_sendcuscommid,arg_sendsccode,arg_receivecuscommid,arg_receivesccode,8,'','','','','',0,arg_msg,False) = 0 Then rslt = 0 Goto ext End If 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 send_cust (long arg_scid, long arg_cusid_arr[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode String ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i //查询序列号 ls_SerialNum = uof_get_serialnum() IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 IF uof_get_SelfInfo(arg_scid, ll_SendCusCommID, ls_SendSCcode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //查询对方通信信息 IF uof_get_ReceiveInfo(5, 0, ll_ReceiveCusCommID, ls_commsccode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF Long ll_cusid Long ll_maxmtnum, ll_pricelistid,ll_cusareaid, ll_state, ll_peoplenum, ll_viewdaynum, ll_banktypeid, ll_styleid, ll_moneyid,ll_transday Decimal lde_givebackrate, lde_saleamt,lde_rebate DateTime ldt_opdate,ldt_modate, ldt_auditdate Integer li_ifself, li_ifecomm, li_inuse String ls_cuscode, ls_name, ls_custype, ls_rep, ls_tele, ls_tele1, ls_bank, ls_cunt, ls_address, ls_code, ls_dscrp String ls_faxno, ls_opemp, ls_cusareaname String ls_areaname , ls_email, ls_freight, ls_freight_tele, ls_upname, ls_modemp String ls_mainmarket, ls_nethttp, ls_trade, ls_corporation, ls_grade String ls_cuskind, ls_sinplename,ls_subid, ls_tele_sms String ls_auditemp, ls_commcode, ls_commsccode_cus int li_ifsecaudit FOR ll_i = 1 To UpperBound(arg_cusid_arr) ll_cusid = arg_cusid_arr[ll_i] SELECT cuscode, name, custype, rep, tele, tele1, bank, cunt, address, code, dscrp, faxno, maxmtnum, pricelistid, inuse, opdate, opemp, cusareaid, cusareaname, areaname, email, givebackrate, freight, freight_tele, upname, moddate, modemp, state, peoplenum, mainmarket, saleamt, nethttp, trade, corporation, grade, ifself, cuskind, simplename, viewdaynum, subid, tele_sms, banktypeid, 0 as styleid, moneyid, '' as auditemp, null as auditdate, 0 as rebate, 0 as transday, ifecomm, commcode, commsccode, 0 as ifsecaudit INTO :ls_cuscode, :ls_name, :ls_custype, :ls_rep, :ls_tele, :ls_tele1, :ls_bank, :ls_cunt, :ls_address, :ls_code, :ls_dscrp, :ls_faxno, :ll_maxmtnum, :ll_pricelistid, :li_inuse, :ldt_opdate, :ls_opemp, :ll_cusareaid, :ls_cusareaname, :ls_areaname , :ls_email, :lde_givebackrate, :ls_freight, :ls_freight_tele, :ls_upname, :ldt_modate, :ls_modemp, :ll_state, :ll_peoplenum, :ls_mainmarket, :lde_saleamt, :ls_nethttp, :ls_trade, :ls_corporation, :ls_grade, :li_ifself, :ls_cuskind, :ls_sinplename, :ll_viewdaynum, :ls_subid, :ls_tele_sms, :ll_banktypeid, :ll_styleid, :ll_moneyid, :ls_auditemp, :ldt_auditdate, :lde_rebate, :ll_transday, :li_ifecomm, :ls_commcode, :ls_commsccode_cus,:li_ifsecaudit FROM u_cust WHERE cusid = :ll_cusid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询信息失败,'+sqlca.SQLErrText GOTO ext END IF INSERT INTO ros_cust (cusid, cuscode, name, custype, rep, tele, tele1, bank, cunt, address, code, dscrp, faxno, maxmtnum, pricelistid, inuse, opdate, opemp, cusareaid, cusareaname, areaname, email, givebackrate, freight, freight_tele, upname, moddate, modemp, state, peoplenum, mainmarket, saleamt, nethttp, trade, corporation, grade, ifself, cuskind, simplename, viewdaynum, subid, tele_sms, banktypeid, styleid, moneyid, auditemp, auditdate, rebate, transday, ifecomm, commcode, commsccode, serialnum,ifsecaudit) VALUES ( :ll_cusid, :ls_cuscode, :ls_name, :ls_custype, :ls_rep, :ls_tele, :ls_tele1, :ls_bank, :ls_cunt, :ls_address, :ls_code, :ls_dscrp, :ls_faxno, :ll_maxmtnum, :ll_pricelistid, :li_inuse, :ldt_opdate, :ls_opemp, :ll_cusareaid, :ls_cusareaname, :ls_areaname , :ls_email, :lde_givebackrate, :ls_freight, :ls_freight_tele, :ls_upname, :ldt_modate, :ls_modemp, :ll_state, :ll_peoplenum, :ls_mainmarket, :lde_saleamt, :ls_nethttp, :ls_trade, :ls_corporation, :ls_grade, :li_ifself, :ls_cuskind, :ls_sinplename, :ll_viewdaynum, :ls_subid, :ls_tele_sms, :ll_banktypeid, :ll_styleid, :ll_moneyid, :ls_auditemp, :ldt_auditdate, :lde_rebate, :ll_transday, :li_ifecomm, :ls_commcode, :ls_commsccode_cus, :ls_SerialNum,:li_ifsecaudit) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'ros_cust' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' arg_summary = ls_summary IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,9,arg_summary,arg_postscript,arg_remark,'','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_cust_rep (long arg_scid, long arg_repid_arr[], string arg_summary, string arg_postscript, string arg_remark, boolean arg_setpwd, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode String ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i //查询序列号 ls_SerialNum = uof_get_serialnum() IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 IF uof_get_SelfInfo(arg_scid, ll_SendCusCommID, ls_SendSCcode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //查询对方通信信息 IF uof_get_ReceiveInfo(5, 0, ll_ReceiveCusCommID, ls_commsccode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF Long ll_repid Long ll_cusid Integer li_reptype DateTime ldt_opdate, ldt_moddate String ls_repname, ls_duty, ls_sex, ls_officetel, ls_handtel, ls_faxno, ls_email, ls_dscrp, ls_deptname String ls_interest, ls_mainproduct, ls_opemp, ls_modemp, ls_qqcode, ls_msncode, ls_address String ls_Permissions, ls_password, ls_loginname FOR ll_i = 1 To UpperBound(arg_repid_arr) ll_repid = arg_repid_arr[ll_i] SELECT cusid, repname, duty, sex, officetel, handtel, faxno, email, dscrp, deptname, interest, mainproduct, opdate, opemp, moddate, modemp, qqcode, msncode, address, Permissions, password, loginname, reptype INTO :ll_cusid, :ls_repname, :ls_duty, :ls_sex, :ls_officetel, :ls_handtel, :ls_faxno, :ls_email, :ls_dscrp, :ls_deptname, :ls_interest, :ls_mainproduct, :ldt_opdate, :ls_opemp, :ldt_moddate, :ls_modemp, :ls_qqcode, :ls_msncode, :ls_address, :ls_Permissions, :ls_password, :ls_loginname, :li_reptype FROM ros_cust_rep WHERE repid = :ll_repid Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询信息失败,'+sqlca.SQLErrText GOTO ext END IF IF Not arg_setpwd THEN //不传送密码 ls_password = "" END IF INSERT INTO ros_cust_rep (repid, cusid, repname, duty, sex, officetel, handtel, faxno, email, dscrp, deptname, interest, mainproduct, opdate, opemp, moddate, modemp, qqcode, msncode, address, Permissions, password, loginname, reptype, serialnum) VALUES (:ll_repid, :ll_cusid, :ls_repname, :ls_duty, :ls_sex, :ls_officetel, :ls_handtel, :ls_faxno, :ls_email, :ls_dscrp, :ls_deptname, :ls_interest, :ls_mainproduct, :ldt_opdate, :ls_opemp, :ldt_moddate, :ls_modemp, :ls_qqcode, :ls_msncode, :ls_address, :ls_Permissions, :ls_password, :ls_loginname, :li_reptype, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'ros_cust_rep' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' arg_summary = ls_summary IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,9,arg_summary,arg_postscript,arg_remark,'','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_funcpwreb (long arg_scid, long arg_cusid, string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);//send_FuncPwrEB 发送电子商务权限 Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode String ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i datastore ds, ds1 ds = Create datastore ds1 = Create datastore //查询序列号 ls_SerialNum = uof_get_serialnum() IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //ll_SendCusCommID = 11 //ls_SendSCcode = "00" //ll_ReceiveCusCommID = 12 //ls_commsccode = "01" //查询本企业通信信息 IF uof_get_SelfInfo(arg_scid, ll_SendCusCommID, ls_SendSCcode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //查询对方企业 IF uof_get_ReceiveInfo(5, 0, ll_ReceiveCusCommID, ls_commsccode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF ds.DataObject = "ds_func_pwr_eb" Long i Long ll_funcid Long ll_parentid Long ll_mainid Long ll_functype String ll_treename String ll_menuname Long ll_if_use Long ll_sortflag Long ll_ebtype String ll_SerialNum FOR i = 1 To ds.RowCount() ll_funcid = ds.Object.funcid[i] ll_parentid = ds.Object.parentid[i] ll_mainid = ds.Object.mainid[i] ll_functype = ds.Object.functype[i] ll_treename = ds.Object.treename[i] ll_menuname = ds.Object.MenuName[i] ll_if_use = ds.Object.if_use[i] ll_sortflag = ds.Object.sortflag[i] ll_ebtype = ds.Object.ebtype[i] ll_SerialNum = ls_SerialNum INSERT INTO sys_func_pwr_eb (funcid, parentid, mainid, functype, treename, menuname, if_use, sortflag, ebtype, SerialNum) VALUES (:ll_funcid,:ll_parentid,:ll_mainid,:ll_functype,:ll_treename,:ll_menuname,:ll_if_use,:ll_sortflag,:ll_ebtype,:ll_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入权限信息失败,' + commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'sys_func_pwr_eb' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' arg_summary = ls_summary IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,9,arg_summary,arg_postscript,arg_remark,'','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF ext: IF rslt = 0 THEN ROLLBACK Using commit_transaction; ELSEIF rslt = 1 And arg_ifcommit THEN COMMIT Using commit_transaction; END IF Destroy ds Destroy ds1 RETURN rslt end function public function integer send_cust_rep_cm (long arg_scid, long arg_repid, string arg_ljemail_arr[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1 String ls_summary Long ll_SendCusCommID String ls_SendSCcode String ls_commsccode Long ll_ReceiveCusCommID String ls_SerialNum Long ll_i //查询序列号 ls_SerialNum = uof_get_serialnum() IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF //查询本企业通信信息 IF uof_get_SelfInfo(arg_scid, ll_SendCusCommID, ls_SendSCcode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF //查询对方通信信息 IF uof_get_ReceiveInfo(5, 0, ll_ReceiveCusCommID, ls_commsccode, arg_msg) = 0 THEN rslt = 0 GOTO ext END IF Long ll_repid string ls_ljemail, ls_username, ls_dscrp Integer li_cmtype ll_repid = arg_repid FOR ll_i = 1 To UpperBound(arg_ljemail_arr) ls_ljemail = arg_ljemail_arr[ll_i] SELECT username, cmtype, dscrp INTO :ls_username, :li_cmtype, :ls_dscrp FROM ros_cust_rep_CM WHERE repid = :ll_repid and ljemail = :ls_ljemail Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询信息失败,'+sqlca.SQLErrText GOTO ext END IF INSERT INTO ros_cust_rep_CM (repid, ljemail, username, cmtype, dscrp, serialnum) VALUES (:ll_repid, :ls_ljemail, :ls_username, :li_cmtype, :ls_dscrp, :ls_SerialNum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT String ls_tablename ls_tablename = 'ros_cust_rep_CM' IF lena(ls_summary) > 100 THEN ls_summary = LeftA(ls_summary,90) + '......' arg_summary = ls_summary IF add_packet(ls_SerialNum,ls_tablename,ll_SendCusCommID,ls_SendSCcode,ll_ReceiveCusCommID,ls_commsccode,9,arg_summary,arg_postscript,arg_remark,'','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF 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 send_web_option (ref string arg_msg);Int rslt = 1 Long ll_sendcuscommid Long ll_commid_ec SELECT CusCommID INTO :ll_sendcuscommid FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本公司企业编号失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT CusCommID INTO :ll_commid_ec FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接'+commit_transaction.SQLErrText GOTO ext END IF String ls_serialnum SELECT top 1 newid() INTO :ls_serialnum From u_user; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询通信ID失败,' + sqlca.SQLErrText GOTO ext END IF String arr_optionid[] arr_optionid[1] = '041' arr_optionid[2] = '042' arr_optionid[3] = '128' arr_optionid[4] = '029' arr_optionid[5] = '027' arr_optionid[6] = '028' string arr_optionid_ew[] arr_optionid_ew[1] = '012' arr_optionid_ew[2] = '013' arr_optionid_ew[3] = '-1' arr_optionid_ew[4] = '029' arr_optionid_ew[5] = '027' arr_optionid_ew[6] = '028' Long cnt = 0 String ls_optionname, ls_optionvalue Long i FOR i = 1 To UpperBound(arr_optionid) SELECT optionname, optionvalue INTO :ls_optionname, :ls_optionvalue FROM sys_option Where optionid = :arr_optionid_ew[i]; IF sqlca.SQLCode <> 0 THEN CONTINUE END IF INSERT INTO LJFIEB_option(optionid, optionname, optionvalue, SerialNum) VALUES(:arr_optionid[i], :ls_optionname, :ls_optionvalue, :ls_serialnum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入选项通信表失败,' + commit_transaction.SQLErrText GOTO ext END IF cnt++ NEXT IF cnt > 0 THEN String ls_tablename ls_tablename = 'LJFIEB_option' IF add_packet(ls_serialnum,ls_tablename,ll_sendcuscommid,'',ll_commid_ec,'',24,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 1 THEN COMMIT Using commit_transaction; ELSE ROLLBACK Using commit_transaction; END IF RETURN rslt end function public function integer send_web_scdef (ref string arg_msg);Int rslt = 1 Long ll_sendcuscommid Long ll_commid_ec SELECT CusCommID INTO :ll_sendcuscommid FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本公司企业编号失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT CusCommID INTO :ll_commid_ec FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接'+commit_transaction.SQLErrText GOTO ext END IF String ls_serialnum SELECT top 1 newid() INTO :ls_serialnum From u_user; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询通信ID失败,' + sqlca.SQLErrText GOTO ext END IF Long ll_scid String ll_scname String ll_sccode long cnt = 0 DECLARE cur1 CURSOR FOR SELECT scid, scname, sccode From u_scdef; OPEN cur1; FETCH cur1 Into :ll_scid, :ll_scname, :ll_sccode; DO WHILE sqlca.SQLCode = 0 INSERT INTO LJFIEB_scdef(scid, scname, sccode, serialnum) Values(:ll_scid, :ll_scname, :ll_sccode, :ls_serialnum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入分部通信表失败,' + commit_transaction.sqlerrtext GOTO ext END IF cnt ++ FETCH cur1 Into :ll_scid, :ll_scname, :ll_sccode; LOOP close cur1; IF cnt > 0 THEN String ls_tablename ls_tablename = 'LJFIEB_scdef' IF add_packet(ls_serialnum,ls_tablename,ll_sendcuscommid,'',ll_commid_ec,'',24,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 1 THEN COMMIT Using commit_transaction; ELSE ROLLBACK Using commit_transaction; END IF RETURN rslt end function public function integer send_web_currency (ref string arg_msg);Int rslt = 1 Long ll_sendcuscommid Long ll_commid_ec SELECT CusCommID INTO :ll_sendcuscommid FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本公司企业编号失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT CusCommID INTO :ll_commid_ec FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接'+commit_transaction.SQLErrText GOTO ext END IF String ls_serialnum SELECT top 1 newid() INTO :ls_serialnum From u_user; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询通信ID失败,' + sqlca.SQLErrText GOTO ext END IF Long ll_accsetid long ll_moneyid string ll_code string ll_name decimal ll_rate long ll_native long cnt = 0 DECLARE cur1 CURSOR FOR SELECT accsetid, moneyid, code, name, rate, native From cw_currency; OPEN cur1; FETCH cur1 Into :ll_accsetid, :ll_moneyid, :ll_code, :ll_name, :ll_rate, :ll_native; DO WHILE sqlca.SQLCode = 0 INSERT INTO LJFIEB_currency(accsetid, moneyid, code, name, rate, native, serialnum) Values( :ll_accsetid, :ll_moneyid, :ll_code, :ll_name, :ll_rate, :ll_native, :ls_serialnum) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入分部通信表失败,' + commit_transaction.sqlerrtext GOTO ext END IF cnt ++ FETCH cur1 Into :ll_accsetid, :ll_moneyid, :ll_code, :ll_name, :ll_rate, :ll_native; LOOP close cur1; IF cnt > 0 THEN String ls_tablename ls_tablename = 'LJFIEB_currency' IF add_packet(ls_serialnum,ls_tablename,ll_sendcuscommid,'',ll_commid_ec,'',24,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 1 THEN COMMIT Using commit_transaction; ELSE ROLLBACK Using commit_transaction; END IF RETURN rslt end function public function integer send_web_banktype (ref string arg_msg);Int rslt = 1 Long ll_sendcuscommid Long ll_commid_ec SELECT CusCommID INTO :ll_sendcuscommid FROM LJFIEB_CusComm Where CusType = 0 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询本公司企业编号失败,'+commit_transaction.SQLErrText GOTO ext END IF SELECT CusCommID INTO :ll_commid_ec FROM LJFIEB_CusComm Where CusType = 5 Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询电子商务网站通讯连接失败,请先确认已设置电子商务网站通讯连接'+commit_transaction.SQLErrText GOTO ext END IF String ls_serialnum SELECT top 1 newid() INTO :ls_serialnum From u_user; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询通信ID失败,' + sqlca.SQLErrText GOTO ext END IF Long ll_accsetid Long ll_banktypeid String ll_banktype String ll_banktypename Long ll_btype Long ll_accountsid long ll_inuse long ll_ifconfirm Long cnt = 0 DECLARE cur1 CURSOR FOR SELECT accsetid, banktypeid, banktype, banktypename, btype, accountsid, inuse, ifconfirm From cw_banktype; OPEN cur1; FETCH cur1 Into :ll_accsetid, :ll_banktypeid, :ll_banktype, :ll_banktypename, :ll_btype, :ll_accountsid, :ll_inuse, :ll_ifconfirm; DO WHILE sqlca.SQLCode = 0 INSERT INTO LJFIEB_banktype(accsetid, banktypeid, banktype, banktypename, btype, accountsid, serialnum, inuse, ifconfirm) Values( :ll_accsetid, :ll_banktypeid, :ll_banktype, :ll_banktypename, :ll_btype, :ll_accountsid, :ls_serialnum, :ll_inuse, :ll_ifconfirm) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入分部通信表失败,' + commit_transaction.SQLErrText GOTO ext END IF cnt ++ FETCH cur1 Into :ll_accsetid, :ll_banktypeid, :ll_banktype, :ll_banktypename, :ll_btype, :ll_accountsid, :ll_inuse, :ll_ifconfirm; LOOP close cur1; IF cnt > 0 THEN String ls_tablename ls_tablename = 'LJFIEB_banktype' IF add_packet(ls_serialnum,ls_tablename,ll_sendcuscommid,'',ll_commid_ec,'',24,'','','','','',0,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF END IF ext: IF rslt = 1 THEN COMMIT Using commit_transaction; ELSE ROLLBACK Using commit_transaction; END IF RETURN rslt end function public function integer feedback_buytask (string arg_sn, s_buytaskmx_feedback_ljfieb arg_s_mx[], string arg_summary, string arg_postscript, string arg_remark, ref string arg_msg, boolean arg_ifcommit, string arg_spt_dscrp, string arg_spt_dscrp2);Int rslt = 1 Long ll_SendCusCommID, ll_ReceiveCusCommID String ls_SendSCcode, ls_ReceiveSCcode String ls_SerialNum,ls_RelatedCode Long ll_i long ll_cusid SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF SELECT SendCusCommID, SendSCcode, ReceiveCusCommID, ReceiveSCcode, RelatedCode, cusid INTO :ll_SendCusCommID, :ls_SendSCcode, :ll_ReceiveCusCommID, :ls_ReceiveSCcode, :ls_RelatedCode, :ll_cusid FROM LJFIEB_packet Where SerialNum = :arg_sn Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询发送记录信息失败,'+commit_transaction.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_tempbuyTask (scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, Status, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, reason, billtype, firpermitemp, firpermitdate, billamt, moneyid, mrate, serialnum,banktypename,moneyname, cusid) SELECT scid, TaskID, TaskCode, orderid, kind, sptID, requiredate, accomplishdate, finishemp, 8, Opemp, Modemp, moddate, Assign_Emp, Permit_Emp, Permit_date, Dscrp, opdate, stopemp, ctmint, printnum, relcode, banktypeid, train, reason, billtype, firpermitemp, firpermitdate, billamt, moneyid, mrate, :ls_SerialNum,banktypename,moneyname, cusid FROM LJFIEB_tempbuyTask WHERE SerialNum = :arg_sn Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单表失败,'+commit_transaction.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_tempbuyTaskMx (scid, TaskID, MtrlID, iforder, Qty, fprice, rebate, Price, AssignQty, status, dscrp, printid, consignedqty, Requiredate, storageid, orderid, ctmint, sptmtrlname, uqty, uprice, unit, rate, stopflag, stopemp, stopdate, stopreason, woodcode, pcode, rqmxprintid, requestbuyid, relrqbuycode, wrkGrpid, taskmxprintid, sptbackdate, delayreason, stopqty, rebuyqty, buybargainid, buybargainprintid, buybargaincode, accomplishdate, admtrlid, relprintid, fpqty, ffpqty, autostopqty, enprice, tax, serialnum, sptmtrlcode, sptmtrlmode, spt_uqty, spt_enprice, spt_Requiredate) SELECT scid, TaskID, MtrlID, iforder, Qty, fprice, rebate, Price, AssignQty, status, dscrp, printid, consignedqty, Requiredate, storageid, orderid, ctmint, sptmtrlname, uqty, uprice, unit, rate, stopflag, stopemp, stopdate, stopreason, woodcode, pcode, rqmxprintid, requestbuyid, relrqbuycode, wrkGrpid, taskmxprintid, sptbackdate, delayreason, stopqty, rebuyqty, buybargainid, buybargainprintid, buybargaincode, accomplishdate, admtrlid, relprintid, fpqty, ffpqty, autostopqty, enprice, tax, :ls_serialnum, sptmtrlcode, sptmtrlmode, uqty, enprice, Requiredate FROM LJFIEB_tempbuyTaskMx WHERE SerialNum = :arg_sn Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时采购订单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF Long ll_printid Decimal ld_spt_uqty,ld_spt_enprice DateTime ldt_spt_requiredate UPDATE LJFIEB_tempbuyTask SET spt_dscrp = :arg_spt_dscrp, spt_dscrp2 = :arg_spt_dscrp2 Where SerialNum = :ls_SerialNum Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入更新采购订单表失败,'+commit_transaction.SQLErrText GOTO ext END IF FOR ll_i = 1 To UpperBound(arg_s_mx) ll_printid = arg_s_mx[ll_i].printid ld_spt_uqty = arg_s_mx[ll_i].spt_uqty ld_spt_enprice = arg_s_mx[ll_i].spt_enprice ldt_spt_requiredate = arg_s_mx[ll_i].spt_Requiredate UPDATE LJFIEB_tempbuyTaskMx SET spt_uqty = :ld_spt_uqty, spt_enprice = :ld_spt_enprice, spt_requiredate = :ldt_spt_requiredate, spt_status = :arg_s_mx[ll_i].spt_status, spt_woodcode = :arg_s_mx[ll_i].spt_woodcode, spt_pcode = :arg_s_mx[ll_i].spt_pcode, spt_dscrp = :arg_s_mx[ll_i].spt_dscrp WHERE printid = :ll_printid and SerialNum = :ls_serialnum Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入更新采购订单明细表失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT string ls_tablename ls_tablename = 'LJFIEB_tempbuyTask,LJFIEB_tempbuyTaskMx' IF add_packet(ls_SerialNum,ls_tablename,ll_receivecuscommid,ls_ReceiveSCcode,ll_sendcuscommid,ls_sendsccode,3,arg_summary,arg_postscript,arg_remark,arg_sn,ls_RelatedCode,ll_cusid,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF //更新本地通信记录 UPDATE LJFIEB_packet SET status = 9, Complete = 1, ConfirmTime = getdate(), ConfirmUser = :publ_operator Where SerialNum = :arg_sn Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '更新本地通信记录失败,'+commit_transaction.SQLErrText goto ext END IF String ls_SerialNum_fb SELECT TOP 1 NEWID() INTO :ls_SerialNum_fb From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '生成序列号失败,'+sqlca.SQLErrText GOTO ext END IF IF IsNull(ls_SerialNum_fb) THEN ls_SerialNum_fb = '' IF ls_SerialNum_fb = '' THEN rslt = 0 arg_msg = '错误的发送序列号' GOTO ext END IF IF add_packet(ls_SerialNum_fb,'',ll_receivecuscommid,ls_ReceiveSCcode,ll_sendcuscommid,ls_sendsccode,10,'','','',arg_sn,ls_RelatedCode,ll_cusid,arg_msg,false) = 0 THEN rslt = 0 arg_msg = '发送反馈确认指令失败 '+arg_msg goto ext END IF 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 send_file (long arg_billtype, long arg_scid, long arg_relid[], long arg_relid_mx[], string ls_serialnum, ref string ls_tablename, ref string arg_msg);Int rslt = 1 datastore ds_file ds_file = Create datastore ds_file.DataObject = 'ds_file' ls_tablename = '' IF sys_fileDB_sqlca.DBHandle() <= 0 THEN rslt = 0 arg_msg = '附件数据库连接失败' GOTO ext END IF ds_file.SetTransObject(sys_fileDB_sqlca) Long ll_classid, arr_classid[], ll_files = 0, ll_i Long ll_fileid String ls_displayname String ls_filename String ls_filetype String ls_dscrp DateTime ld_opdate String ls_opemp Long ll_relid Long ll_relid_mx Long ll_scid Long ll_billtype String ls_relcode String ls_relcode_mx Blob lb_filedata DECLARE cur1 Cursor FOR SELECT classid From u_FileClass Where billtype = :arg_billtype And ifsend = 1; OPEN cur1; FETCH cur1 Into :ll_classid; DO WHILE sqlca.SQLCode = 0 arr_classid[UpperBound(arr_classid) + 1] = ll_classid FETCH cur1 Into :ll_classid; LOOP CLOSE cur1; IF UpperBound(arr_classid) > 0 THEN ll_files = ds_file.Retrieve(arg_billtype, arg_scid, arg_relid, arg_relid_mx, arr_classid) if ll_files < 0 then rslt = 0 arg_msg = '查询附件失败,ds_file' goto ext end if FOR ll_i = 1 To ds_file.RowCount() ll_fileid = ds_file.Object.fileid[ll_i] ls_displayname = ds_file.Object.DisplayName[ll_i] ls_filename = ds_file.Object.Filename[ll_i] ll_classid = ds_file.Object.classid[ll_i] ls_filetype = ds_file.Object.FileType[ll_i] ls_dscrp = ds_file.Object.dscrp[ll_i] ld_opdate = ds_file.Object.opdate[ll_i] ls_opemp = ds_file.Object.opemp[ll_i] ll_relid = ds_file.Object.relid[ll_i] ll_relid_mx = ds_file.Object.relid_mx[ll_i] ll_scid = ds_file.Object.scid[ll_i] ll_billtype = ds_file.Object.billtype[ll_i] ls_relcode = ds_file.Object.relcode[ll_i] ls_relcode_mx = ds_file.Object.relcode_mx[ll_i] SelectBlob filedata Into :lb_filedata From u_file Where fileid = :ll_fileid Using sys_fileDB_sqlca; IF sys_fileDB_sqlca.SQLCode <> 0 THEN rslt = 0 arg_msg = '查询附件数据失败,' + sys_fileDB_sqlca.SQLErrText GOTO ext END IF INSERT INTO LJFIEB_file (FileID ,serialnum ,DisplayName ,FileName ,ClassID ,FileType ,Dscrp ,Opdate ,Opemp ,relid ,relid_mx ,scid ,billtype ,relcode ,relcode_mx) VALUES (:ll_fileid ,:ls_SerialNum ,:ls_DisplayName ,:ls_filename ,:ll_classid ,:ls_filetype ,:ls_dscrp ,:ld_opdate ,:ls_opemp ,:ll_relid ,:ll_relid_mx ,:ll_scid ,:ll_billtype ,:ls_relcode ,:ls_relcode_mx) Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入临时附件表(LJFIEB_file)失败,'+commit_transaction.SQLErrText GOTO ext END IF UpdateBlob LJFIEB_file Set filedata = :lb_filedata Where fileid = :ll_fileid And serialnum = :ls_SerialNum Using commit_transaction; IF commit_transaction.SQLCode <> 0 THEN rslt = 0 arg_msg = '插入更新附件表(LJFIEB_file)失败,'+commit_transaction.SQLErrText GOTO ext END IF NEXT END IF if ll_files > 0 then ls_tablename = 'LJFIEB_file' end if ext: destroy ds_file RETURN rslt end function on uo_ljfieb.create call super::create TriggerEvent( this, "constructor" ) end on on uo_ljfieb.destroy TriggerEvent( this, "destructor" ) call super::destroy end on