人脸识别领料

This commit is contained in:
李超 2025-07-29 20:52:21 +08:00
parent 5901a3f6d3
commit 75ceef6a3c
4 changed files with 37 additions and 8 deletions

View File

@ -117,15 +117,35 @@
}
else {
// window.location.href = 'UsingMat.aspx?welderQRCode=' + data.d ;
window.open('UsingMat.aspx?welderCode=' + data.d , '_blank');
//window.open('UsingMat.aspx?welderCode=' + data.d , '_blank');
//var activeWindow = F.getActiveWindow();
//activeWindow.window.backData(data.d);
//activeWindow.hide();
var node = {
iframeUrl: '~\\WeldMat\\UsingSentMat\\UsingMat.aspx?welderCode=' + data.d,
title: "焊材领用",
id: "UsingMat" + getFormattedDate()
};
window.parent.addExampleTab(node);
}
}
})
}
function getFormattedDate() {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
return year + month + day + hours + minutes + seconds;
}
</script>
</body>
</html>

View File

@ -1,4 +1,5 @@
using BLL;
using SgManager.AI;
using System;
using System.Collections.Generic;
using System.Drawing;
@ -13,8 +14,7 @@ namespace FineUIPro.Web.WeldMat.UsingSentMat
public partial class FaceRecognition : Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
}
[WebMethod]
public static string UploadData(string data)

View File

@ -90,7 +90,7 @@
<f:FileUpload ID="filePhoto1" runat="server" ButtonText="上传头像到百度" ButtonOnly="true"
AutoPostBack="true" OnFileSelected="filePhoto1_FileSelected">
</f:FileUpload>
<f:Image ID="imgPhoto1" CssClass="userphoto" runat="server" BoxFlex="1" MarginLeft="10px">
<f:Image ID="imgPhoto1" CssClass="userphoto" runat="server" BoxFlex="1" MarginLeft="10px" CssStyle="width:300px;hight:400px" Width="300px" Height="400px">
</f:Image>
</Items>
</f:FormRow>

View File

@ -1,6 +1,7 @@
namespace FineUIPro.Web.common.WelderManage
{
using BLL;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SgManager.AI;
@ -252,13 +253,14 @@
}
#endregion
public string PersonFace(Model.HJGL_BS_Welder person)
public string PersonFace(Model.HJGL_BS_Welder person)
{
string message = string.Empty;
string filePath = Server.MapPath("~/") + person.PhotoUrl;
string filePath = Server.MapPath(person.PhotoUrl);
List<SgManager.AI.faceResult> kqFace = null;
try
{
ErrLogInfo.WriteLog("filePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePathfilePath:" + filePath);
kqFace = (List<SgManager.AI.faceResult>)SgManager.AI.FaceClass.SearchFileFace(filePath);
if (kqFace != null || kqFace.Count > 0 || kqFace[0].errMess == "SUCCESS")
{
@ -330,7 +332,7 @@
else message = "识别不到人脸";
if (isOK)
{
var faceResult = FaceClass.add(person.WED_ID, person.IdentityCard, System.Configuration.ConfigurationManager.AppSettings["HJGLUrl"].ToString() + person.PhotoUrl, AccessToken.getAccessToken());
var faceResult = FaceClass.add(person.WED_ID, person.IdentityCard, System.Configuration.ConfigurationManager.AppSettings["HJGLUrl"].ToString() + person.PhotoUrl.Replace("~\\", "").Replace("\\","/"), AccessToken.getAccessToken());
var face = JsonConvert.DeserializeObject<dynamic>(faceResult);
// JsonConvert.DeserializeObject<dynamic>(myPunishItem);
if (face.error_code == 0 || face.error_code == 223105)
@ -403,6 +405,13 @@
imgPhoto1.ImageUrl = "~/upload/" + fileName;
// 清空文件上传组件
filePhoto1.Reset();
var welder = Funs.DB.HJGL_BS_Welder.FirstOrDefault(x=>x.WED_ID== WED_ID);
welder.PhotoUrl = imgPhoto1.ImageUrl.Replace("/", "\\");
Funs.DB.SubmitChanges();
Alert.ShowInParent(PersonFace(welder), MessageBoxIcon.Warning);
}
}