2.内码扫描 | aws_get_barcsft620new | 扫描内部外箱标签二维码,同时获取内码批号、料号、数量(内码通用接口) |
项目 | 说明 |
函式说明 | 扫描内部条码, 返回料号、批号、数量等 |
函式名称 | aws_get_barcsft620new 接口名:GetBarCsft620new |
更多源码下载 https://pan.baidu.com/s/1Qb1QIUZITfIPPN_WcflscA?pwd=k4tk
aws_get_barcsft620new.4gl 源码
# Prog. Version..: '5.30.03-12.09.18(00000)'
# Program name...: aws_get_barcsft620new.4gl
# Descriptions...截取內部條碼信息并返回前端
# Date & Author..: 2022-08-09 By Lian
DATABASE ds
GLOBALS "../../../tiptop/config/top.global"
GLOBALS "../../../tiptop/aws/4gl/aws_ttsrv_global.4gl"
FUNCTION aws_get_barcsft620new()
WHENEVER ERROR CONTINUE
CALL aws_ttsrv_preprocess() #呼叫服務前置處理程序 #FUN-860037
IF g_status.code = "0" THEN
CALL aws_get_barcsft620new_process()
END IF
CALL aws_ttsrv_postprocess() #呼叫服務後置處理程序
END FUNCTION
FUNCTION aws_get_barcsft620new_process()
DEFINE l_username LIKE type_file.chr20
DEFINE l_barcode LIKE type_file.chr100
DEFINE l_n LIKE type_file.num5
DEFINE l_length LIKE type_file.num5
DEFINE l_node om.DomNode
DEFINE l_sfb01 LIKE sfb_file.sfb01 #工單號
DEFINE l_nbbarcode LIKE type_file.chr1000
DEFINE l_kh_b LIKE type_file.chr1000
DEFINE l_kh_o LIKE type_file.chr1000
DEFINE l_cnt1,l_i,l_len,l_len1 LIKE type_file.num5
DEFINE l_statu4 RECORD #返回內部條碼信息
tc_ade01 LIKE sfb_file.sfb01, #工單號
tc_ade041 LIKE sfb_file.sfb05, #料號
tc_ade042 LIKE sfv_file.sfv07, #批號
tc_ade043 LIKE sfb_file.sfb08, #條碼數量
khpartno LIKE ima_file.ima02, #客戶產品編號
ima02 LIKE ima_file.ima02, #品名
ima021 LIKE ima_file.ima021, #規格
ta_sfv01 LIKE type_file.chr1000, #包裝方式 格式:包裝方式1@每箱數量1%包裝方式2@每箱量2
wipqty LIKE sfb_file.sfb08
END RECORD
DEFINE l_snt LIKE type_file.num10
DEFINE l_barcode1 STRING
DEFINE l_sql STRING
DEFINE l_sfb05,l_nb_sfb05 LIKE sfb_file.sfb05
DEFINE l_sfb02 LIKE sfb_file.sfb02 #No.FUN-190510
DEFINE l_bzfs LIKE obe_file.obe01
DEFINE l_valbar LIKE type_file.chr50
DEFINE g_ecm RECORD LIKE ecm_file.*
DEFINE l_wip_qty LIKE shb_file.shb111
DEFINE l_prog_id,g_in_type LIKE type_file.chr1
# 條碼規則:料號%客戶產品編號%批號%數量%日期
# 說明:批號即為工單號
LET l_nbbarcode = aws_ttsrv_getParameter("nbbarcode") #外箱條碼
LET l_prog_id = aws_ttsrv_getParameter("prog_id") #哪支作業調用的本接口: 1~6 ; 1-入庫生成;2-入庫上架;3-一般銷售出貨;4-多角銷售出貨;5-採購收貨;6-倉庫盤點
LET g_in_type = aws_ttsrv_getParameter("in_type") ##1:生成入??及?工? 2:?生成?工?
IF g_in_type IS NULL THEN
LET g_in_type = '1'
END IF
IF l_prog_id IS NULL OR l_prog_id NOT MATCHES '[123456]' THEN
LET g_status.code = '-1'
LET g_status.description = '作業ID值須為【1~6】,請檢查確認!'
RETURN
END IF
IF l_nbbarcode IS NULL THEN
LET g_status.code = '-1'
LET g_status.description = '掃描傳入外箱條碼為空,請檢查確認!'
RETURN
END IF
#解析處理條碼
# select length(regexp_replace(l_nbbarcode,'[^%]','')) INTO l_snt from dual;
SELECT SUBSTR(l_nbbarcode,instr(l_nbbarcode,'%',1,4)+1, ((instr(l_nbbarcode,'%',1,4)-1) )) INTO l_valbar FROM dual
IF NOT cl_null(l_valbar) THEN #只有格式為【料號%客戶產品編號%批號%數量%日期】 條碼才合法
-----------------------------------------------------------------------------------------START
SELECT SUBSTR(l_nbbarcode,1,instr(l_nbbarcode,'%',1,1)-1)
INTO l_statu4.tc_ade041 #截取條碼料號
FROM dual
IF cl_null(l_statu4.tc_ade041 ) THEN
LET g_status.code = '-1'
LET g_status.description = '截取條碼料號失敗,請檢查條碼!'
RETURN
END IF
SELECT SUBSTR(l_nbbarcode,instr(l_nbbarcode,'%',1,1)+1,((instr(l_nbbarcode,'%',1,2)-1)-instr(l_nbbarcode,'%',1,1)))
INTO l_statu4.khpartno #截取條碼客戶產品編號
FROM dual
IF cl_null(l_statu4.khpartno ) THEN
LET g_status.code = '-1'
LET g_status.description = '截取條碼客戶產品編號失敗,請檢查條碼!'
RETURN
END IF
SELECT SUBSTR(l_nbbarcode,instr(l_nbbarcode,'%',1,2)+1,((instr(l_nbbarcode,'%',1,3)-1)-instr(l_nbbarcode,'%',1,2)))
INTO l_statu4.tc_ade01 #截取條碼工單,即批號
FROM dual
IF cl_null(l_statu4.tc_ade01 ) THEN
LET g_status.code = '-1'
LET g_status.description = '截取條碼工單(批號)失敗,請檢查條碼!'
RETURN
END IF
LET l_statu4.tc_ade042 =l_statu4.tc_ade01 #批號=工單號
SELECT SUBSTR(l_nbbarcode,instr(l_nbbarcode,'%',1,3)+1,((instr(l_nbbarcode,'%',1,4)-1)-instr(l_nbbarcode,'%',1,3)))
INTO l_statu4.tc_ade043 #截取條碼數量
FROM dual
IF cl_null(l_statu4.tc_ade041 ) THEN
LET g_status.code = '-1'
LET g_status.description = '截取條碼數量失敗,請檢查條碼!'
RETURN
END IF
-----------------------------------------------------------------------------------------END
CALL aws_ttsrv_addParameterRecord(base.TypeInfo.create(l_statu4)) #返回
# LET l_node= aws_ttsrv_addMasterRecord(base.TypeInfo.create(l_statu1), "Master") #Response
ELSE
LET g_status.code = "-1"
LET g_status.description = "非法的物料條碼,請檢查條碼格式是否正確!"
RETURN
END IF
END FUNCTION
SOAPUI提交的数据
nbbarcode 内部条码
05001746%2689082(B)%230715SA-A11418T11%100%001
条码规则:料号%客户产品编号%批号%每箱数量%箱号
prog_id 扫描程序的ID
<Request>
<Access>
<Authentication password="tiptop" user="liyuhan"/>
<Connection application="APP" source=""/>
<Organization name="0TDGCS "/>
<Locale language="zh_cn"/>
</Access>
<RequestContent>
<Parameter>
<Record>
<Field name="prog_id" value="1"/>
<Field name="nbbarcode" value="05001746%2689082(B)%230715SA-A11418T11%100%001"/>
</Record>
</Parameter>
<Document/>
</RequestContent>
</Request>
返回的信息
tc_ade01 工单编号
tc_ade041 料号
tc_ade042 批号
tc_ade043 数量
ima02 品名
ima021 产品编号
<Response>
<Execution>
<Status code="0" sqlcode="0" description=""/>
</Execution>
<ResponseContent>
<Parameter>
<Record>
<Field name="tc_ade041" value="05001746"/>
<Field name="tc_ade042" value="230715SA-A11418T11"/>
<Field name="tc_ade043" value="100.000"/>
<Field name="ima02" value="BOYP CH LYL BYFS HGL"/>
<Field name="ima021" value="2170477X"/>
</Record>
</Parameter>
<Document/>
</ResponseContent>
</Response>