ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/FingerMark/CheckConfirm.aspx.cs

241 lines
8.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
namespace FineUIPro.Web.FingerMark
{
public partial class CheckConfirm : PageBase
{
protected int result = 233;
protected string msg = "";
protected string keyId = "";
protected string flag = "";
protected string grid = "";
protected string S = "";
protected string k = "";
protected string stockMan = "";
protected string VerifyTemplate = "", RegisterTemplate = "";
protected void Page_Load(object sender, EventArgs e)
{
checkFinger();
}
private string GetMyFinger(string userId, string def)
{
string strSql = "";
if (def == "1")
{
strSql = "SELECT MyFinger FROM dbo.HJGL_BS_Welder WHERE WED_ID=@UserId";
}
else
{
strSql = "SELECT MyFinger FROM dbo.Weld_Storeman WHERE StoremanId=@UserId";
}
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@UserId", userId));
SqlParameter[] parameter = listStr.ToArray();
return BLL.SQLHelper.getStr(strSql, parameter);
}
private void checkFinger()
{
if (Request.Form["keyId"] != null)//判断页面请求用户名是否为空
{
keyId = Request.Form["keyId"].Trim();
}
if (Request.Form["flag"] != null) //1-焊工2-保管员
{
flag = Request.Form["flag"].Trim();
}
if (Request.Form["grid"] != null) //1-领料2-退料3-退焊条头4-保管员结束确认
{
grid = Request.Form["grid"].Trim();
}
VerifyTemplate = Request.Form["VerifyTemplate"].Trim();
string myFinger = "";
if (grid == "1") // 领料
{
var usingMat = BLL.UsingMatService.GetUsingMatById(keyId);
if (usingMat != null)
{
if (flag == "1")
{
myFinger = GetMyFinger(usingMat.UsingMan, "1");
}
else
{
myFinger = GetMyFinger(usingMat.StoreMan, "2");
}
}
else
{
msg = "请选中要确认的领料记录";
}
}
if (grid == "2") // 退料
{
var recycleMat = BLL.RecycleMatService.GetRecycleMatById(keyId);
if (recycleMat != null)
{
if (flag == "1")
{
myFinger = GetMyFinger(recycleMat.RecycleMan, "1");
}
else
{
myFinger = GetMyFinger(recycleMat.StockMan, "2");
}
}
else
{
msg = "请选中要确认的退料记录";
}
}
//if (grid == "3") // 退焊条头
//{
// var recycleMatTop = BLL.RecycleMatTopService.GetRecycleMatTopById(keyId);
// if (recycleMatTop != null)
// {
// if (flag == "1")
// {
// myFinger = GetMyFinger(recycleMatTop.RecycleMan, "1");
// }
// else
// {
// myFinger = GetMyFinger(recycleMatTop.StockMan, "2");
// }
// }
// else
// {
// msg = "请选中要确认的退还的焊条头记录";
// }
//}
//if (grid == "4") //保管员结束确认
//{
// string strsql = "SELECT StoremanId,MyFinger FROM dbo.Weld_Storeman WHERE MyFinger IS NOT NULL";
// DataTable dt = BLL.SQLHelper.GetDataTableRunText(strsql, null);
// if (dt.Rows.Count > 0)
// {
// for (int i = 0; i < dt.Rows.Count; i++)
// {
// string finger = dt.Rows[i][1].ToString();
// string[] tmpGroup = finger.Split('@');
// for (int n = 0; n < tmpGroup.Length; n++)
// {
// k = tmpGroup[n].Substring(0, tmpGroup[n].IndexOf('#'));
// result = BLL.RefComm.process(k, VerifyTemplate); //指纹模板的对比
// if (result == 1)
// {
// stockMan = dt.Rows[i][0].ToString();
// break;
// }
// }
// if (result == 1)
// {
// break;
// }
// }
// }
//}
if (myFinger != null && myFinger != "")
{
string[] tmpGroup = myFinger.Split('@');
for (int n = 0; n < tmpGroup.Length; n++)
{
k = tmpGroup[n].Substring(0, tmpGroup[n].IndexOf('#'));
result = BLL.RefComm.process(k, VerifyTemplate); //指纹模板的对比
if (result == 1)
{
break;
}
}
}
if (result == 1)
{
if (grid == "1") // 领料
{
if (flag == "1")
{
BLL.UsingMatService.WelderConfirm(keyId, true);
msg = "指纹对比成功,焊工已确认";
}
else
{
BLL.UsingMatService.StoreManConfirm(keyId, true);
msg = "指纹对比成功,保管员已确认";
}
}
if (grid == "2") // 退料
{
if (flag == "1")
{
BLL.RecycleMatService.WelderConfirm(keyId, true);
var recycle = BLL.RecycleMatService.GetRecycleMatById(keyId);
var mat = BLL.UsingMatService.GetUsingMatById(recycle.UsingMatId);
if (!string.IsNullOrEmpty(mat.StockInId))
{
decimal recycleAmount = recycle.RecycleAmount.HasValue ? recycle.RecycleAmount.Value : 0;
BLL.StockInService.UpdateStockInAmount(mat.StockInId, recycleAmount);
}
msg = "指纹对比成功,焊工已确认";
}
else
{
BLL.RecycleMatService.StoreManConfirm(keyId, true);
msg = "指纹对比成功,保管员已确认";
}
}
if (grid == "3") // 退焊条头
{
if (flag == "1")
{
BLL.RecycleMatTopService.WelderConfirm(keyId, true);
msg = "指纹对比成功,焊工已确认";
}
else
{
BLL.RecycleMatTopService.StoreManConfirm(keyId, true);
msg = "指纹对比成功,保管员已确认";
}
}
if (grid == "4")
{
BLL.UsingPlanService.UpdateIsFinish(keyId, stockMan);
var s = BLL.StoremanInfoService.GetStoremanById(stockMan);
msg = "保管员:" + s.StoreName + "确认此计划完成";
}
//Response.Write("<script>window.parent.parent.location.href='~/WeldMat/UsingSentMat/UsingMat.aspx?welderId=" + usingMat.UsingMan + "&&projectId=" + usingMat.ProjectId + "';</script>");
//string itemsString = usingMat.ProjectId + "|" + usingMat.UsingMan;
//PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString)
// + ActiveWindow.GetHidePostBackReference());
}
else
{
msg = "指纹不匹配";
}
}
}
}