12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- $PBExportHeader$f_pack_dscrp.srf
- global type f_pack_dscrp from function_object
- end type
- forward prototypes
- global function string f_pack_dscrp (long arg_mtrlid, decimal arg_qty, string arg_prdpackcode, decimal arg_packqty, string arg_unit)
- end prototypes
- global function string f_pack_dscrp (long arg_mtrlid, decimal arg_qty, string arg_prdpackcode, decimal arg_packqty, string arg_unit);//返回包装
- //f_pack_dscrp(arg_mtrlid,arg_qty,arg_prdpackcode,arg_packqty,arg_unit)
- String rst_dscrp = ''
- Decimal lde_packqty_Tol, lde_qty
- String ls_format
- arg_qty = abs(arg_qty)
- arg_prdpackcode = Trim(arg_prdpackcode)
- IF arg_prdpackcode = '' Or arg_packqty = 0 THEN
- ls_format = f_GetStringFormat(0, arg_qty)
- rst_dscrp = String(arg_qty,ls_format) + arg_unit
- GOTO ext
- END IF
- Int li_ifpacktype
- SELECT ifpacktype INTO :li_ifpacktype
- FROM u_mtrldef
- Where mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- li_ifpacktype = 1
- END IF
- IF li_ifpacktype = 0 THEN //乘法
- lde_packqty_Tol = arg_qty * arg_packqty
- ls_format = f_GetStringFormat(0, lde_packqty_Tol)
- rst_dscrp = String(lde_packqty_Tol,ls_format) + arg_prdpackcode
- ELSE //除法
- lde_packqty_Tol = truncate(arg_qty / arg_packqty, 0)
- lde_qty = Mod(arg_qty, arg_packqty)
- rst_dscrp = ""
-
- IF lde_packqty_Tol > 0 THEN
- rst_dscrp = String(lde_packqty_Tol) + arg_prdpackcode
- END IF
-
- IF lde_qty > 0 THEN
- ls_format = f_GetStringFormat(0, lde_qty)
- rst_dscrp += String(lde_qty,ls_format) + arg_unit
- END IF
-
- // IF Long(arg_qty/arg_packqty) <= 0 THEN //不够一包
- // ls_format = f_GetStringFormat(0, arg_qty)
- // rst_dscrp = String(arg_qty,ls_format) + arg_unit
- // ELSE
- // IF Mod ( arg_qty, arg_packqty ) = 0 THEN
- // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode)
- // ELSE
- // IF Mod(Mod ( arg_qty, arg_packqty ),1) = 0 THEN
- // IF Truncate(arg_qty/arg_packqty,0) = 0 THEN
- // rst_dscrp = String(Mod ( arg_qty, arg_packqty ),'#####0') + arg_unit
- // ELSE
- // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode) + String(Mod ( arg_qty, arg_packqty ),'#####0') + arg_unit
- // END IF
- // ELSE
- // IF Truncate(arg_qty/arg_packqty,0) = 0 THEN
- // rst_dscrp = String(Mod ( arg_qty, arg_packqty ),'#####0.00##') + arg_unit
- // ELSE
- // rst_dscrp = String(Truncate(arg_qty/arg_packqty,0)) + Trim(arg_prdpackcode) + String(Mod ( arg_qty, arg_packqty ),'#####0.00##') + arg_unit
- // END IF
- // END IF
- // END IF
- // END IF
- END IF
- ext:
- RETURN rst_dscrp
- end function
|