1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| --[[
| 编码: JX-90-01
| 名称: 物料-创建前
| 作者:HAN
| 日期:2025-1-29
|
| 级别:固定 (说明本段代码在项目中不太会变化)
|
| 函数: BeforeDataObjCreate
|
| 功能:
| 根据输入的长中短边计算料箱类型
|
| 更改记录:
| V2.0 HAN 20241024
| -- 对长边超出料箱要求的货品进行特别处理
|
| --]]
| jx_base = require( "jx_base" )
|
| function BeforeDataObjCreate ( strLuaDEID )
| local nRet, strRetInfo
| local material
| nRet, material = m3.GetSysCurEditDataObj( strLuaDEID, "Material" )
| if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..cg_detail ) end
|
| local str_cell_type = ''
| -- 设置【料箱类型】信息
| nRet, strRetInfo = jx_base.GetBoxStyle( strLuaDEID, material.long, material.middle, material.short )
| if ( nRet == 0 ) then
| -- 获取最小的 cell_type
| local box_style = json.decode( strRetInfo )
| local n = #box_style
| if ( n > 0 ) then str_cell_type = box_style[n] end
| else
| strRetInfo = ''
| end
|
| local attr_value = {
| { attr = "S_BOX_STYLE", value = strRetInfo },
| { attr = "S_CELL_TYPE", value = str_cell_type },
| { attr = "F_VOLUME", value = material.long * material.middle * material.short }
| }
| nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
| if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【物料】信息失败! "..strRetInfo ) end
| end
|
|