Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS100
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7c33e71c
由
LN
编写于
2026-01-13 15:34:48 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
nexim对接修改。
1 个父辈
a8383be3
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
591 行增加
和
64 行删除
BLL/Config.cs
BLL/Extension/Item_General.cs
BLL/Nexim/NeximApiUtil.cs
Model/Http.cs
SmartScan/ScanWork.cs
SmartScan/SetControl/WPF/WPF_MaterialTemplate.xaml.cs
BLL/Config.cs
查看文件 @
7c33e71
...
...
@@ -375,6 +375,7 @@ namespace BLL
public
static
MyConfig
<
string
>
Nexim_UserName
=
""
;
public
static
MyConfig
<
string
>
Nexim_Password
=
""
;
public
static
MyConfig
<
string
>
Nexim_RegisterDidInfoUrl
=
""
;
public
static
MyConfig
<
string
>
Nexim_PartMastersUrl
=
""
;
/// <summary>
/// Nexim参数,key=需要的参数,value=对应的关键字
/// </summary>
...
...
BLL/Extension/Item_General.cs
查看文件 @
7c33e71
...
...
@@ -479,10 +479,10 @@ namespace BLL
LogNet
.
log
.
Info
(
"ex"
+
ex
.
ToString
());
}
if
(!
DidRegisterValidate
(
key
,
out
errmsg
))
{
return
false
;
}
//
if(!DidRegisterValidate(key, out errmsg))
//
{
//
return false;
//
}
//SaveRetrospect?.Invoke(key);
return
true
;
...
...
@@ -490,30 +490,30 @@ namespace BLL
}
private
bool
DidRegisterValidate
(
Dictionary
<
string
,
string
>
content
,
out
string
errmsg
)
{
errmsg
=
""
;
try
{
if
(
BLLCommon
.
neximApiUtils
.
registerNewDid
(
content
,
out
string
msg
))
{
return
true
;
}
else
{
errmsg
=
msg
;
//Register Failure Notice
MessageboxNeo
.
Show
(
"Register Failure Notice"
,
errmsg
,
"NEO SCAN"
,
true
);
return
false
;
}
//
private bool DidRegisterValidate(Dictionary<string, string> content, out string errmsg)
//
{
//
errmsg = "";
//
try
//
{
//
if (BLLCommon.neximApiUtils.registerNewDid(content, out string msg))
//
{
//
return true;
//
}
//
else
//
{
//
errmsg = msg;
//
//Register Failure Notice
//
MessageboxNeo.Show("Register Failure Notice", errmsg, "NEO SCAN", true);
//
return false;
//
}
}
catch
(
Exception
ex
)
{
LogNet
.
log
.
Info
(
"DidRegisterValidate"
+
ex
.
ToString
());
}
return
false
;
}
//
}
//
catch (Exception ex)
//
{
//
LogNet.log.Info("DidRegisterValidate" + ex.ToString());
//
}
//
return false;
//
}
public
void
Update
()
{
...
...
BLL/Nexim/NeximApiUtil.cs
查看文件 @
7c33e71
...
...
@@ -16,15 +16,13 @@ namespace BLL
public
bool
IsEnalbe
()
{
//判断 Nexim_AuthUrl 是否为空
if
(
string
.
IsNullOrEmpty
(
Config
.
Nexim_AuthUrl
))
if
(
string
.
IsNullOrEmpty
(
Config
.
Nexim_AuthUrl
)
||
string
.
IsNullOrEmpty
(
Config
.
Nexim_PartMastersUrl
)
)
{
return
false
;
}
return
true
;
}
private
string
OK
=
"ok"
;
private
string
ERROE
=
"error"
;
/**
* 获取登录的token
* @return
...
...
@@ -71,7 +69,7 @@ namespace BLL
}
p
rivate
string
getReelInfo
(
Dictionary
<
string
,
string
>
reelData
,
string
key
)
p
ublic
string
getReelInfo
(
Dictionary
<
string
,
string
>
reelData
,
string
key
)
{
string
dataKey
=
key
;
Dictionary
<
string
,
string
>
paramKeyM
=
GetParamMap
();
...
...
@@ -103,6 +101,15 @@ namespace BLL
return
0
;
}
private
T
getDataValue
<
T
>(
Dictionary
<
string
,
object
>
dataMap
,
string
key
)
{
if
(
dataMap
.
ContainsKey
(
key
)&&
dataMap
[
key
]
is
T
)
{
return
(
T
)
dataMap
[
key
];
}
return
default
(
T
);
}
private
string
RI
=
"RI"
;
private
string
PN
=
"PN"
;
private
string
QTY
=
"QTY"
;
...
...
@@ -130,7 +137,68 @@ namespace BLL
return
_paramKeyMap
;
}
public
bool
registerNewDid
(
Dictionary
<
string
,
string
>
reelData
,
out
string
msg
)
private
Dictionary
<
string
,
object
>
buildDidParams
(
Dictionary
<
string
,
string
>
reelData
,
Dictionary
<
string
,
object
>
pnDataMap
)
{
DIDModel
didModel
=
new
DIDModel
();
Dictionary
<
string
,
object
>
paramsMap
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
object
>>(
JsonConvert
.
SerializeObject
(
didModel
));
if
(
pnDataMap
!=
null
)
{
foreach
(
var
kv
in
pnDataMap
)
{
paramsMap
[
kv
.
Key
]
=
kv
.
Value
;
}
}
paramsMap
[
"did"
]
=
getReelInfo
(
reelData
,
RI
);
paramsMap
[
"originalPartBarcode"
]
=
getReelInfo
(
reelData
,
RI
);
string
v
=
getReelInfo
(
reelData
,
PN
);
if
(!
string
.
IsNullOrEmpty
(
v
))
{
paramsMap
[
"partBarcode"
]
=
v
;
paramsMap
[
"partNumber"
]
=
v
;
}
int
q
=
getIntReelInfo
(
reelData
,
QTY
);
if
(
q
>
0
)
{
paramsMap
[
"quantity"
]
=
q
;
paramsMap
[
"partsoutWarning"
]
=
q
;
paramsMap
[
"splicingWarning"
]
=
q
;
}
v
=
getReelInfo
(
reelData
,
SP
);
if
(!
string
.
IsNullOrEmpty
(
v
))
{
paramsMap
[
"vendorName"
]
=
v
;
}
v
=
getReelInfo
(
reelData
,
BATCH
);
if
(!
string
.
IsNullOrEmpty
(
v
))
{
paramsMap
[
"lotName"
]
=
v
;
}
v
=
getReelInfo
(
reelData
,
PRODATE
);
if
(!
string
.
IsNullOrEmpty
(
v
))
{
paramsMap
[
"dateCode"
]
=
v
;
}
if
(!
paramsMap
.
ContainsKey
(
"packageType"
)
||
string
.
IsNullOrEmpty
(
Convert
.
ToString
(
paramsMap
[
"packageType"
])))
{
paramsMap
[
"packageType"
]
=
"paper"
;
}
//paramsMap.Add("location", "");
//paramsMap.Add("memo", "");
//paramsMap.Add("note1", "");
//paramsMap.Add("note2", "");
//paramsMap.Add("note3", "");
//paramsMap.Add("note4", "");
//paramsMap.Add("useSplicing", true);
//paramsMap.Add("useTrayPackage", false);
//paramsMap.Add("trayStackCount", 0);
//paramsMap.Add("trayPickupPositionX", 0);
//paramsMap.Add("trayPickupPositionY", 0);
//paramsMap.Add("traySizeX", 0);
//paramsMap.Add("traySizeY", 0);
return
paramsMap
;
}
public
bool
registerNewDid
(
Dictionary
<
string
,
string
>
reelData
,
Dictionary
<
string
,
object
>
pnDataMap
,
out
string
msg
)
{
msg
=
""
;
if
(!
IsEnalbe
())
...
...
@@ -148,32 +216,8 @@ namespace BLL
}
headerMap
.
Add
(
"fujiAccessToken"
,
token
);
Dictionary
<
string
,
Object
>
paramsMap
=
new
Dictionary
<
string
,
object
>();
paramsMap
.
Add
(
"did"
,
getReelInfo
(
reelData
,
RI
));
paramsMap
.
Add
(
"partBarcode"
,
getReelInfo
(
reelData
,
PN
));
paramsMap
.
Add
(
"quantity"
,
getReelInfo
(
reelData
,
QTY
));
paramsMap
.
Add
(
"packageType"
,
"paper"
);
//默认是paper,
paramsMap
.
Add
(
"partsoutWarning"
,
getIntReelInfo
(
reelData
,
QTY
));
paramsMap
.
Add
(
"splicingWarning"
,
getIntReelInfo
(
reelData
,
QTY
));
paramsMap
.
Add
(
"partNumber"
,
getReelInfo
(
reelData
,
PN
));
paramsMap
.
Add
(
"vendorName"
,
getReelInfo
(
reelData
,
SP
));
paramsMap
.
Add
(
"lotName"
,
getReelInfo
(
reelData
,
BATCH
));
paramsMap
.
Add
(
"dateCode"
,
getReelInfo
(
reelData
,
PRODATE
));
paramsMap
.
Add
(
"location"
,
""
);
paramsMap
.
Add
(
"memo"
,
""
);
paramsMap
.
Add
(
"note1"
,
""
);
paramsMap
.
Add
(
"note2"
,
""
);
paramsMap
.
Add
(
"note3"
,
""
);
paramsMap
.
Add
(
"note4"
,
""
);
paramsMap
.
Add
(
"useSplicing"
,
true
);
paramsMap
.
Add
(
"useTrayPackage"
,
false
);
paramsMap
.
Add
(
"trayStackCount"
,
0
);
paramsMap
.
Add
(
"trayPickupPositionX"
,
0
);
paramsMap
.
Add
(
"trayPickupPositionY"
,
0
);
paramsMap
.
Add
(
"traySizeX"
,
0
);
paramsMap
.
Add
(
"traySizeY"
,
0
);
List
<
Dictionary
<
string
,
object
>>
paramList
=
new
List
<
Dictionary
<
string
,
object
>>();
paramList
.
Add
(
paramsMap
);
paramList
.
Add
(
buildDidParams
(
reelData
,
pnDataMap
)
);
//string paramStr = JSON.toJSONstring(params);
//LogNet.log.Info("注册Fuji的did参数为:" + paramStr);
string
result
=
""
;
...
...
@@ -193,13 +237,6 @@ namespace BLL
return
true
;
}
}
//if (resultObj != null && resultObj.ContainsKey("details"))
//{
// string details = resultObj["details"].ToString();
// msg ="Register new did failed: "+ details+". result="+result;
//}
//else
{
msg
=
"Register new did failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
...
...
@@ -214,6 +251,384 @@ namespace BLL
return
false
;
}
public
Dictionary
<
string
,
object
>
searchDids
(
string
code
,
out
string
msg
)
{
msg
=
""
;
Dictionary
<
string
,
object
>
resultMap
=
new
Dictionary
<
string
,
object
>();
if
(!
IsEnalbe
())
{
return
resultMap
;
}
Dictionary
<
string
,
string
>
headerMap
=
new
Dictionary
<
string
,
string
>();
string
token
=
getAccessToken
(
out
string
errmsg
);
if
(
String
.
IsNullOrEmpty
(
token
))
{
//获取token为空
msg
=
"getAccessToken fail:"
+
errmsg
;
LogNet
.
log
.
Info
(
"getAccessToken fail"
);
return
resultMap
;
}
headerMap
.
Add
(
"fujiAccessToken"
,
token
);
String
search
=
"did == \""
+
code
+
"\""
;
String
orderBy
=
"did asc"
;
int
pageToken
=
0
;
int
pageSize
=
200
;
Dictionary
<
string
,
object
>
paramList
=
new
Dictionary
<
string
,
object
>();
paramList
.
Add
(
"pageToken"
,
pageToken
);
paramList
.
Add
(
"pageSize"
,
pageSize
);
paramList
.
Add
(
"search"
,
search
);
paramList
.
Add
(
"orderBy"
,
orderBy
);
string
result
=
""
;
string
apiUrl
=
Config
.
Nexim_RegisterDidInfoUrl
;
try
{
string
body
=
JsonConvert
.
SerializeObject
(
paramList
);
result
=
Http
.
GetWithHeader
(
apiUrl
,
headerMap
,
paramList
);
LogNet
.
log
.
Info
(
"searchDids Result:"
+
result
);
List
<
Dictionary
<
string
,
object
>>
retMap
=
JsonConvert
.
DeserializeObject
<
List
<
Dictionary
<
string
,
object
>>>(
result
);
if
(
retMap
!=
null
&&
retMap
.
Count
>=
0
)
{
resultMap
=
retMap
[
0
];
if
(
resultMap
!=
null
&&
resultMap
.
ContainsKey
(
"did"
))
{
return
resultMap
;
}
}
else
{
msg
=
"searchDids failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
}
catch
(
Exception
e
)
{
//改为英文提示
msg
=
"searchDids failed:"
+
e
.
Message
;
LogNet
.
log
.
Info
(
"searchDids Failed:"
,
e
);
}
return
resultMap
;
}
public
Dictionary
<
string
,
object
>
getDid
(
string
code
,
out
string
msg
)
{
msg
=
""
;
Dictionary
<
string
,
object
>
resultMap
=
new
Dictionary
<
string
,
object
>();
if
(!
IsEnalbe
())
{
return
resultMap
;
}
Dictionary
<
string
,
string
>
headerMap
=
new
Dictionary
<
string
,
string
>();
string
token
=
getAccessToken
(
out
string
errmsg
);
if
(
String
.
IsNullOrEmpty
(
token
))
{
//获取token为空
msg
=
"getAccessToken fail:"
+
errmsg
;
LogNet
.
log
.
Info
(
"getAccessToken fail"
);
return
resultMap
;
}
headerMap
.
Add
(
"fujiAccessToken"
,
token
);
string
result
=
""
;
string
apiUrl
=
Config
.
Nexim_RegisterDidInfoUrl
+
"/"
+
code
;
try
{
result
=
Http
.
GetWithHeader
(
apiUrl
,
headerMap
,
null
);
LogNet
.
log
.
Info
(
"getDid Result:"
+
result
);
Dictionary
<
string
,
Dictionary
<
string
,
object
>>
reMap
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
Dictionary
<
string
,
object
>>>(
result
);
if
(
reMap
!=
null
&&
reMap
.
Count
>=
0
&&
reMap
.
ContainsKey
(
"did"
))
{
resultMap
=
reMap
[
"did"
];
if
(
resultMap
!=
null
&&
resultMap
.
ContainsKey
(
"did"
))
{
return
resultMap
;
}
}
else
{
msg
=
"getDid failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
}
catch
(
Exception
e
)
{
//改为英文提示
msg
=
"getDid failed:"
+
e
.
Message
;
LogNet
.
log
.
Info
(
"getDid Failed:"
,
e
);
}
return
resultMap
;
}
public
Dictionary
<
string
,
object
>
getPartMasters
(
string
originalPartBarcode
,
out
string
msg
)
{
msg
=
""
;
Dictionary
<
string
,
object
>
resultMap
=
new
Dictionary
<
string
,
object
>();
if
(!
IsEnalbe
())
{
return
resultMap
;
}
Dictionary
<
string
,
string
>
headerMap
=
new
Dictionary
<
string
,
string
>();
string
token
=
getAccessToken
(
out
string
errmsg
);
if
(
String
.
IsNullOrEmpty
(
token
))
{
//获取token为空
msg
=
"getAccessToken fail:"
+
errmsg
;
LogNet
.
log
.
Info
(
"getAccessToken fail"
);
return
resultMap
;
}
headerMap
.
Add
(
"fujiAccessToken"
,
token
);
string
result
=
""
;
string
apiUrl
=
Config
.
Nexim_PartMastersUrl
+
"/"
+
originalPartBarcode
;
try
{
result
=
Http
.
GetWithHeader
(
apiUrl
,
headerMap
,
null
);
LogNet
.
log
.
Info
(
"getPartMasters Result:"
+
result
);
Dictionary
<
string
,
Dictionary
<
string
,
object
>>
reMap
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
Dictionary
<
string
,
object
>>>(
result
);
if
(
reMap
!=
null
&&
reMap
.
Count
>=
0
&&
reMap
.
ContainsKey
(
"partMaster"
))
{
resultMap
=
reMap
[
"partMaster"
];
string
partNumber
=
getDataValue
<
String
>(
resultMap
,
"partNumber"
);
if
(!
String
.
IsNullOrEmpty
(
partNumber
))
{
return
resultMap
;
}
else
{
msg
=
"getPartMasters failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
}
else
{
msg
=
"getPartMasters failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
}
catch
(
Exception
e
)
{
//改为英文提示
msg
=
"getPartMasters failed:"
+
e
.
Message
;
LogNet
.
log
.
Info
(
"getPartMasters Failed:"
,
e
);
}
return
resultMap
;
}
public
bool
postPartMasters
(
Dictionary
<
string
,
string
>
reelData
,
out
string
msg
)
{
msg
=
""
;
if
(!
IsEnalbe
())
{
return
true
;
}
Dictionary
<
string
,
string
>
headerMap
=
new
Dictionary
<
string
,
string
>();
string
token
=
getAccessToken
(
out
string
errmsg
);
if
(
String
.
IsNullOrEmpty
(
token
))
{
//获取token为空
msg
=
"getAccessToken fail:"
+
errmsg
;
LogNet
.
log
.
Info
(
"getAccessToken fail"
);
return
false
;
}
headerMap
.
Add
(
"fujiAccessToken"
,
token
);
List
<
PartMasterModel
>
paramList
=
new
List
<
PartMasterModel
>();
PartMasterModel
model
=
new
PartMasterModel
();
// Map fields from reelData
model
.
originalPartBarcode
=
getReelInfo
(
reelData
,
RI
);
model
.
partNumber
=
getReelInfo
(
reelData
,
PN
);
model
.
partBarcode
=
getReelInfo
(
reelData
,
PN
);
model
.
quantity
=
getIntReelInfo
(
reelData
,
QTY
);
model
.
vendorName
=
getReelInfo
(
reelData
,
SP
);
model
.
lotName
=
getReelInfo
(
reelData
,
BATCH
);
string
dateCode
=
getReelInfo
(
reelData
,
PRODATE
);
if
(!
string
.
IsNullOrEmpty
(
dateCode
))
{
model
.
dateCode
=
dateCode
;
}
model
.
defaultValue
();
paramList
.
Add
(
model
);
string
result
=
""
;
string
apiUrl
=
Config
.
Nexim_PartMastersUrl
;
try
{
string
body
=
JsonConvert
.
SerializeObject
(
paramList
);
result
=
Http
.
PostWithHeader
(
apiUrl
,
body
,
headerMap
);
LogNet
.
log
.
Info
(
"postPartMasters Result=:"
+
result
);
Dictionary
<
string
,
object
>
resultObj
=
JsonConvert
.
DeserializeObject
<
Dictionary
<
string
,
object
>>(
result
);
if
(
resultObj
!=
null
&&
resultObj
.
ContainsKey
(
"addedCount"
))
{
int
addedCount
=
Convert
.
ToInt32
(
resultObj
[
"addedCount"
]);
if
(
addedCount
>
0
)
{
return
true
;
}
}
{
msg
=
"postPartMasters failed : "
+
result
.
Replace
(
"\t"
,
""
).
Replace
(
"\n"
,
""
);
}
}
catch
(
Exception
e
)
{
//改为英文提示
msg
=
"postPartMasters failed:"
+
e
.
Message
;
LogNet
.
log
.
Info
(
"postPartMasters Failed:"
,
e
);
}
return
false
;
}
private
class
DIDModel
{
public
string
did
{
get
;
set
;
}
public
string
partNumber
{
get
;
set
;
}
public
string
partBarcode
{
get
;
set
;
}
public
string
originalPartBarcode
{
get
;
set
;
}
public
int
quantity
{
get
;
set
;
}
public
string
packageType
{
get
;
set
;
}
=
"paper"
;
public
int
partsoutWarning
{
get
;
set
;
}
public
int
splicingWarning
{
get
;
set
;
}
public
string
vendorName
{
get
;
set
;
}
public
string
lotName
{
get
;
set
;
}
public
string
dateCode
{
get
;
set
;
}
public
string
area
{
get
;
set
;
}
public
string
location
{
get
;
set
;
}
public
string
machine
{
get
;
set
;
}
public
int
module
{
get
;
set
;
}
public
int
stageNo
{
get
;
set
;
}
public
int
slotNo
{
get
;
set
;
}
public
string
createdUser
{
get
;
set
;
}
public
string
createdDate
{
get
;
set
;
}
public
string
updatedUser
{
get
;
set
;
}
public
string
updatedDate
{
get
;
set
;
}
public
string
dryStatus
{
get
;
set
;
}
public
string
boxLife
{
get
;
set
;
}
public
string
floorLife
{
get
;
set
;
}
public
string
memo
{
get
;
set
;
}
public
string
lightingClass
{
get
;
set
;
}
public
int
lightingLimit
{
get
;
set
;
}
public
string
note1
{
get
;
set
;
}
public
string
note2
{
get
;
set
;
}
public
string
note3
{
get
;
set
;
}
public
string
note4
{
get
;
set
;
}
public
bool
useSplicing
{
get
;
set
;
}
=
true
;
public
bool
useTrayPackage
{
get
;
set
;
}
=
false
;
public
int
trayStackCount
{
get
;
set
;
}
=
1
;
public
int
trayPickupPositionX
{
get
;
set
;
}
=
1
;
public
int
trayPickupPositionY
{
get
;
set
;
}
=
1
;
public
int
traySizeX
{
get
;
set
;
}
=
1
;
public
int
traySizeY
{
get
;
set
;
}
=
1
;
}
private
class
PartMasterModel
{
public
PartMasterModel
()
{
}
public
void
defaultValue
()
{
// Set other fields with default values from the requirement
this
.
bodyThickness
=
null
;
this
.
msLevel
=
null
;
this
.
trayPartQuantity
=
0
;
this
.
partsOutWarning
=
0
;
this
.
splicingWarning
=
0
;
this
.
location
=
null
;
this
.
memo
=
null
;
this
.
packageType
=
"paper"
;
this
.
indexPitch
=
0
;
this
.
reelWidth
=
0
;
this
.
lightingClassRequired
=
false
;
this
.
lightingLimit
=
0
;
this
.
note1
=
null
;
this
.
note2
=
null
;
this
.
note3
=
null
;
this
.
note4
=
null
;
this
.
traySizeX
=
0
;
this
.
traySizeY
=
0
;
this
.
useTrayPackage
=
false
;
this
.
useSplicing
=
true
;
this
.
verifyPolicy
=
"every_time"
;
this
.
applicableMachineCheck
=
false
;
this
.
didAffixChecks
=
false
;
this
.
markCheckHint
=
null
;
this
.
markCheckAnswer
=
null
;
this
.
directionCheck
=
0
;
this
.
mpnCheck
=
null
;
this
.
useLCRChecking
=
false
;
this
.
lcrMeasurementType
=
"L"
;
this
.
unit
=
"string"
;
this
.
lcrMeasurementMethod
=
"None"
;
this
.
normalValue
=
0
;
this
.
upperLimit
=
0
;
this
.
lowerLimit
=
0
;
this
.
frequency
=
0
;
this
.
voltage
=
0
;
}
public
string
originalPartBarcode
{
get
;
set
;
}
public
string
partNumber
{
get
;
set
;
}
public
string
partBarcode
{
get
;
set
;
}
public
string
bodyThickness
{
get
;
set
;
}
public
string
msLevel
{
get
;
set
;
}
public
int
quantity
{
get
;
set
;
}
public
int
trayPartQuantity
{
get
;
set
;
}
public
int
partsOutWarning
{
get
;
set
;
}
public
int
splicingWarning
{
get
;
set
;
}
public
string
vendorName
{
get
;
set
;
}
public
string
lotName
{
get
;
set
;
}
public
string
dateCode
{
get
;
set
;
}
public
string
location
{
get
;
set
;
}
public
string
memo
{
get
;
set
;
}
public
string
packageType
{
get
;
set
;
}
public
int
indexPitch
{
get
;
set
;
}
public
int
reelWidth
{
get
;
set
;
}
public
bool
lightingClassRequired
{
get
;
set
;
}
public
int
lightingLimit
{
get
;
set
;
}
public
string
note1
{
get
;
set
;
}
public
string
note2
{
get
;
set
;
}
public
string
note3
{
get
;
set
;
}
public
string
note4
{
get
;
set
;
}
public
int
traySizeX
{
get
;
set
;
}
public
int
traySizeY
{
get
;
set
;
}
public
bool
useTrayPackage
{
get
;
set
;
}
public
bool
useSplicing
{
get
;
set
;
}
public
string
verifyPolicy
{
get
;
set
;
}
public
bool
applicableMachineCheck
{
get
;
set
;
}
public
bool
didAffixChecks
{
get
;
set
;
}
public
string
markCheckHint
{
get
;
set
;
}
public
string
markCheckAnswer
{
get
;
set
;
}
public
int
directionCheck
{
get
;
set
;
}
public
string
mpnCheck
{
get
;
set
;
}
public
bool
useLCRChecking
{
get
;
set
;
}
public
string
lcrMeasurementType
{
get
;
set
;
}
public
string
unit
{
get
;
set
;
}
public
string
lcrMeasurementMethod
{
get
;
set
;
}
public
int
normalValue
{
get
;
set
;
}
public
int
upperLimit
{
get
;
set
;
}
public
int
lowerLimit
{
get
;
set
;
}
public
int
frequency
{
get
;
set
;
}
public
int
voltage
{
get
;
set
;
}
}
}
}
Model/Http.cs
查看文件 @
7c33e71
...
...
@@ -145,6 +145,42 @@ namespace Model
LogNet
.
log
.
Info
(
"[Post]URL:"
+
url
+
"Return:"
+
s
);
return
FormatContent
(
s
);
}
public
static
string
GetWithHeader
(
string
url
,
Dictionary
<
string
,
string
>
headerMap
,
Dictionary
<
string
,
object
>
queryParams
=
null
)
{
if
(
queryParams
!=
null
&&
queryParams
.
Count
>
0
)
{
var
queryString
=
HttpUtility
.
ParseQueryString
(
string
.
Empty
);
foreach
(
var
param
in
queryParams
)
{
queryString
.
Add
(
param
.
Key
,
param
.
Value
?.
ToString
());
}
if
(
url
.
Contains
(
"?"
))
url
+=
"&"
+
queryString
.
ToString
();
else
url
+=
"?"
+
queryString
.
ToString
();
}
LogNet
.
log
.
Info
(
"[Get]URL:"
+
url
);
RestClient
client
=
new
(
url
)
{
Timeout
=
10000
};
RestRequest
request
=
new
(
Method
.
GET
);
if
(
headerMap
!=
null
&&
headerMap
.
Count
>
0
)
{
foreach
(
var
head
in
headerMap
)
{
request
.
AddHeader
(
head
.
Key
,
head
.
Value
);
}
}
IRestResponse
response
=
client
.
Execute
(
request
);
if
(
response
.
ErrorException
!=
null
)
{
LogNet
.
log
.
Error
(
"[Get]URL:"
+
url
+
" Error: "
+
response
.
ErrorException
.
ToString
());
throw
response
.
ErrorException
;
}
string
s
=
response
.
Content
;
LogNet
.
log
.
Info
(
"[Get]URL:"
+
url
+
"Return:"
+
s
);
return
FormatContent
(
s
);
}
}
public
class
CustSerialize
:
RestSharp
.
Serialization
.
IRestSerializer
{
...
...
SmartScan/ScanWork.cs
查看文件 @
7c33e71
...
...
@@ -168,6 +168,18 @@ namespace SmartScan
isMatched
=
Request_API_C2
(
matchedTexts
);
}
Dictionary
<
string
,
string
>
lastKey
=
BLLCommon
.
extension
.
GetUIKeywords
();
if
(
lastKey
==
null
)
lastKey
=
new
Dictionary
<
string
,
string
>(
workCodeKeyword
);
else
lastKey
=
new
Dictionary
<
string
,
string
>(
lastKey
,
StringComparer
.
OrdinalIgnoreCase
);
//nexim对接
if
(
isMatched
&&
(!
DidRegisterValidate
(
lastKey
,
out
string
errmsg
)))
{
isMatched
=
false
;
LogNet
.
log
.
Info
(
"DidRegisterValidate error ,isMatched = false"
);
}
if
(
isMatched
)
{
Check2s
?.
Invoke
(
"2"
);
...
...
@@ -223,6 +235,67 @@ namespace SmartScan
}
}
private
bool
DidRegisterValidate
(
Dictionary
<
string
,
string
>
content
,
out
string
errmsg
)
{
errmsg
=
""
;
if
(!
BLLCommon
.
neximApiUtils
.
IsEnalbe
())
{
return
true
;
}
try
{
string
pn
=
BLLCommon
.
neximApiUtils
.
getReelInfo
(
content
,
"PN"
);
string
msg
;
bool
result
;
Dictionary
<
string
,
object
>
pmData
=
BLLCommon
.
neximApiUtils
.
getPartMasters
(
pn
,
out
msg
);
if
(!
string
.
IsNullOrEmpty
(
msg
))
{
LogNet
.
log
.
Error
(
$
"getPartMasters failed, pn={pn}, msg={msg},开始注册PN"
);
result
=
BLLCommon
.
neximApiUtils
.
postPartMasters
(
content
,
out
msg
);
if
(
result
)
{
LogNet
.
log
.
Info
(
$
"postPartMasters OK, pn={pn}"
);
}
else
{
LogNet
.
log
.
Error
(
$
"getPartMasters failed, pn={pn}, msg={msg}"
);
errmsg
=
msg
;
MessageboxNeo
.
Show
(
"Register PartMasters Failure Notice"
,
errmsg
,
"NEO SCAN"
,
false
);
return
false
;
}
}
else
{
string
reelId
=
BLLCommon
.
neximApiUtils
.
getReelInfo
(
content
,
"RI"
);
//获取did信息,获取成功直接返回
Dictionary
<
string
,
object
>
didData
=
BLLCommon
.
neximApiUtils
.
getDid
(
reelId
,
out
msg
);
LogNet
.
log
.
Error
(
$
"getPartMasters OK, getDid OK,直接返回 true"
);
if
(
string
.
IsNullOrEmpty
(
msg
))
{
return
true
;
}
}
if
(
BLLCommon
.
neximApiUtils
.
registerNewDid
(
content
,
pmData
,
out
msg
))
{
return
true
;
}
else
{
errmsg
=
msg
;
//Register Failure Notice
MessageboxNeo
.
Show
(
"Register Failure Notice"
,
errmsg
,
"NEO SCAN"
,
false
);
return
false
;
}
}
catch
(
Exception
ex
)
{
LogNet
.
log
.
Info
(
"DidRegisterValidate"
+
ex
.
ToString
());
}
return
false
;
}
private
bool
Request_API_C2
(
List
<
string
>
matchedTexts
)
{
string
url
=
config
.
HttpLabelReport
.
Trim
();
...
...
SmartScan/SetControl/WPF/WPF_MaterialTemplate.xaml.cs
查看文件 @
7c33e71
...
...
@@ -119,6 +119,8 @@ namespace SmartScan.SetControl.WPF
{
codeItems
.
Add
(
item
);
}
data3
.
ItemsSource
=
null
;
data3
.
ItemsSource
=
codeItems
;
if
(
data3
.
Items
.
Count
>
0
)
data3
.
SelectedIndex
=
-
1
;
bmp
=
(
Bitmap
)
ImgShow
.
Image
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论