870 lines
35 KiB
C#
870 lines
35 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Text;
|
||
using bizFacade;
|
||
using System.Data;
|
||
//using SystemFramework;
|
||
using MesWebFun_MateriallPull.BarCodeServer_Pro;
|
||
|
||
namespace MesWebFun_MateriallPull
|
||
{
|
||
public partial class MesWebFun_MateriallPull
|
||
{
|
||
private static string Init_WorkStationMaterial(string OpName)
|
||
{
|
||
DataTable dt;
|
||
MaterialPull.getWorkStationMaterialInfo(OpName, out dt);
|
||
if (dt != null)
|
||
{
|
||
return JsonHelper.CreateJsonParameters(dt, true, dt.Rows.Count);
|
||
}
|
||
else
|
||
{
|
||
return "";
|
||
}
|
||
}
|
||
|
||
#region 批次接收
|
||
|
||
/// <summary>
|
||
/// 物料号获取
|
||
/// </summary>
|
||
/// <returns></returns
|
||
private static string InitMaterial_Dialog_MaterialNum(string OpName)
|
||
{
|
||
|
||
DataTable dt = null;
|
||
MaterialPull.InitMaterial_Dialog_MaterialNum(OpName, out dt);
|
||
StringBuilder sb = new StringBuilder();
|
||
if (dt != null)
|
||
{
|
||
sb.Append("[{");
|
||
if (dt.Rows.Count == 1)
|
||
{
|
||
sb.Append("\"id\":0,\"text\":\"" + dt.Rows[0][0] + "\",\"selected\":true}]");
|
||
}
|
||
else if (dt.Rows.Count > 1)
|
||
{
|
||
for (int i = 0; i < dt.Rows.Count; i++)
|
||
{
|
||
if (i == 0)
|
||
{
|
||
sb.Append("\"id\":" + i + ",\"text\":\"" + dt.Rows[0][0] + "\",\"selected\":true},{");
|
||
}
|
||
if (i != dt.Rows.Count - 1 & i != 0)
|
||
{
|
||
sb.Append("\"id\":" + i + ",\"text\":\"" + dt.Rows[i][0] + "\"},{");
|
||
}
|
||
else if (i == dt.Rows.Count - 1)
|
||
{
|
||
sb.Append("\"id\":" + i + ",\"text\":\"" + dt.Rows[i][0] + "\"}]");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return sb.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取卡片一览信息
|
||
/// </summary>
|
||
/// <returns></returns
|
||
private static string getMaterialNumInfo(string OpName, string MateraiNum)
|
||
{
|
||
// string MateraiNum = HttpContext.Current.Request["MateraiNum"];
|
||
DataTable dt;
|
||
MaterialPull.getMaterialNumInfo(OpName, MateraiNum, out dt);
|
||
if (dt != null)
|
||
{
|
||
return JsonHelper.CreateJsonParameters(dt, true, dt.Rows.Count);
|
||
}
|
||
else
|
||
{
|
||
//return "";
|
||
return "{ total: 1,rows: }";
|
||
}
|
||
}
|
||
|
||
#endregion 批次接收
|
||
|
||
#region 库存盘点
|
||
|
||
/// <summary>
|
||
/// 物料拉动_库存盘点
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private static string initStockCount(string OpName, string MaterialNum)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
|
||
//string MaterialNum = HttpContext.Current.Request["MaterialNum"];
|
||
MaterialPull.init_StockCount(OpName, MaterialNum, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string Init_MaterialNum_Combobox(string OpName)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
|
||
MaterialPull.Init_MaterialNumCombobox(OpName, out dt);
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
return text;
|
||
}
|
||
|
||
private static string Init_Final_OrderNumber_Combobox()
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
MaterialPull.Init_FinalOrderNumberCombobox(out dt);
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
return text;
|
||
}
|
||
|
||
private static string Consume_stockcount(string OpName, string ConsumeNum, string OrderNumber,string CardNum)
|
||
{
|
||
//string ConsumeNum = HttpContext.Current.Request["ConsumeNum"];
|
||
//string OrderNumber = HttpContext.Current.Request["OrderNumber"];
|
||
|
||
//string CardNum = HttpContext.Current.Request["CardNum"];
|
||
MaterialPull.Consume_StockCount(OrderNumber, ConsumeNum, OpName, CardNum);
|
||
return "";
|
||
}
|
||
|
||
#endregion 库存盘点
|
||
|
||
#region FTT模块
|
||
|
||
/// <summary>
|
||
/// 物料拉动_FTT
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private static string ConvertOpname_Ftt(string Opname)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
MaterialPull.OpName_Convert_Select(Opname, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string Insert_FTT_Confirm(string Opname, string Final_EngineNum, string DefectGroup, string DefectCode)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
//string Final_EngineNum = HttpContext.Current.Request["Final_EngineNum"];
|
||
//string DefectGroup = HttpContext.Current.Request["DefectGroup"];
|
||
//string DefectCode = HttpContext.Current.Request["DefectCode"];
|
||
MaterialPull.Confirm_EngineNum(Final_EngineNum, DefectGroup, DefectCode, Opname, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = dt.Rows[0][0].ToString();
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string Insert_FTT_Informatinon(string Opname, string EngineNum, string DefectGroup, string DefectCode, string ProblemDate, int callCount)
|
||
{
|
||
string Msg = "";
|
||
//string EngineNum = HttpContext.Current.Request["Final_EngineNum"];
|
||
//string DefectGroup = HttpContext.Current.Request["DefectGroup"];
|
||
//string DefectCode = HttpContext.Current.Request["DefectCode"];
|
||
//string ProblemDate = HttpContext.Current.Request["ProblemDate"];
|
||
//int callCount = Convert.ToInt32(HttpContext.Current.Request["callCount"]);
|
||
MaterialPull.Insert_FTTInformation(Opname, "2", EngineNum, DefectGroup, DefectCode, ProblemDate, callCount, out Msg);
|
||
|
||
return Msg;
|
||
}
|
||
|
||
private static string Init_FinalList_Combobox(string Opname)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
MaterialPull.Init_FinalListCombobox(Opname, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string Init_DefectCode_Combobox(string Opname)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
MaterialPull.Init_DefectCodeCombobox(Opname, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
#endregion FTT模块
|
||
|
||
#region 打卡上线模块
|
||
|
||
/// <summary>
|
||
/// 物料拉动_打卡上线
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private static string GetClasses()
|
||
{
|
||
string text = null;
|
||
System.Data.DataTable dt = null;
|
||
MaterialPull.Getclasses(out dt);
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
return text;
|
||
}
|
||
|
||
private static string initOnline(string opName)
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
System.Data.DataTable dt = null;
|
||
string classes = "";
|
||
string operatorName = "";
|
||
string loginTime = "";
|
||
string operatorCode = "";
|
||
string opname = "";
|
||
MaterialPull.Search_OnlineInfo(opName, out dt);
|
||
if (dt != null)
|
||
{
|
||
sb.Append("[");
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < dt.Rows.Count; i++)
|
||
{
|
||
classes = dt.Rows[i]["班次"].ToString();
|
||
System.Data.DataTable dt_output = null;
|
||
MaterialPull.ClassName_Select(classes, out dt_output);
|
||
if (dt_output != null)
|
||
{
|
||
if (dt_output.Rows.Count > 0)
|
||
{
|
||
classes = dt_output.Rows[0]["班次描述"].ToString();
|
||
}
|
||
}
|
||
opname = dt.Rows[i]["工位号"].ToString();
|
||
operatorCode = dt.Rows[i]["操作者工号"].ToString();
|
||
operatorName = dt.Rows[i]["操作者姓名"].ToString();
|
||
loginTime = dt.Rows[i]["操作时间"].ToString();
|
||
sb.Append("{\"工位号\":\"" + opname + "\",\"操作者工号\":\"" + operatorCode + "\",\"操作者姓名\":\"" + operatorName + "\",\"班次\":\"" + classes + "\",\"操作时间\":\"" + loginTime + "\"},");
|
||
}
|
||
sb.Remove(sb.Length - 1, 1);
|
||
}
|
||
}
|
||
sb.Append("]");
|
||
return sb.ToString();
|
||
}
|
||
|
||
private static string Confirmclasses()
|
||
{
|
||
string Confirmclass = "";
|
||
System.Data.DataTable dt_output = null;
|
||
MaterialPull.ConfirmClass(out Confirmclass);
|
||
string ConfirmclassName = "";
|
||
MaterialPull.ClassName_Select(Confirmclass, out dt_output);
|
||
if (dt_output != null)
|
||
{
|
||
if (dt_output.Rows.Count > 0)
|
||
{
|
||
ConfirmclassName = dt_output.Rows[0]["班次描述"].ToString();
|
||
}
|
||
}
|
||
|
||
return ConfirmclassName;
|
||
}
|
||
|
||
private static string WorkingHours_OnlineInfo(string Opname, string Password, string Classes, string OperatorName)
|
||
{
|
||
//string Password = "";
|
||
//string Classes = "";
|
||
//string OperatorName = "";
|
||
string Msg = "";
|
||
//Password = HttpContext.Current.Request["Password"];
|
||
//Classes = HttpContext.Current.Request["Classes"];
|
||
//OperatorName = HttpContext.Current.Request["OperatorName"];
|
||
MaterialPull.Insert_WorkingHours(Opname, OperatorName, Password, Classes, out Msg);
|
||
|
||
return Msg;
|
||
}
|
||
|
||
#endregion 打卡上线模块
|
||
|
||
#region 工时
|
||
|
||
private static string OrderNum_Query(string start_time, string end_time)
|
||
{
|
||
string text = "";
|
||
// string end_time = "";
|
||
// string start_time = "";
|
||
System.Data.DataTable dt = null;
|
||
|
||
// start_time = HttpContext.Current.Request["Plan_start_time"];
|
||
|
||
// end_time = HttpContext.Current.Request["Plan_end_time"];
|
||
|
||
start_time = start_time + " 00:00:00";
|
||
end_time = end_time + " 23:59:59";
|
||
|
||
MaterialPull.Init_OrderNum_Query(start_time, end_time, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
//工时补录初始化
|
||
private static string init_WorkTime(string Opname, string Ordernum)
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
|
||
string text = "";
|
||
int Num = 1;
|
||
string classes = "";
|
||
string opname = "";
|
||
string operatorCode = "";
|
||
string operatorName = "";
|
||
string compeleteCount = "";
|
||
string OrderNum = "";
|
||
string UploadTime = "";
|
||
System.Data.DataTable dt = null;
|
||
// string Ordernum = HttpContext.Current.Request["OrderNum"];
|
||
MaterialPull.Init_Worktime(Ordernum, Opname, Num, out dt);
|
||
if (dt != null)
|
||
{
|
||
sb.Append("[");
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < dt.Rows.Count; i++)
|
||
{
|
||
System.Data.DataTable dt_output = null;
|
||
classes = dt.Rows[i]["班次"].ToString();
|
||
MaterialPull.ClassName_Select(classes, out dt_output);
|
||
if (dt_output != null)
|
||
{
|
||
if (dt_output.Rows.Count > 0)
|
||
{
|
||
classes = dt_output.Rows[0]["班次描述"].ToString();
|
||
}
|
||
}
|
||
OrderNum = dt.Rows[i]["订单号"].ToString();
|
||
opname = dt.Rows[i]["工位号"].ToString();
|
||
operatorCode = dt.Rows[i]["操作者工号"].ToString();
|
||
operatorName = dt.Rows[i]["员工姓名"].ToString();
|
||
compeleteCount = dt.Rows[i]["报工数量"].ToString();
|
||
UploadTime = dt.Rows[i]["报工时间"].ToString();
|
||
sb.Append("{\"订单号\":\"" + OrderNum + "\",\"工位号\":\"" + opname + "\",\"员工姓名\":\"" + operatorName + "\",\"操作者工号\":\"" + operatorCode + "\",\"报工数量\":\"" + compeleteCount + "\",\"班次\":\"" + classes + "\",\"报工时间\":\"" + UploadTime + "\"},");
|
||
}
|
||
sb.Remove(sb.Length - 1, 1);
|
||
}
|
||
}
|
||
sb.Append("]");
|
||
return sb.ToString();
|
||
}
|
||
|
||
private static string Worktime_completeCount(string OrderNum)
|
||
{
|
||
string text = "0";
|
||
System.Data.DataTable dt = null;
|
||
// string OrderNum = HttpContext.Current.Request["OrderNum"];
|
||
MaterialPull.workTime_CompleteCount(OrderNum, out dt);
|
||
if (dt != null)
|
||
{
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = dt.Rows[0][0].ToString();
|
||
}
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string init_Statistics(string Opname, string Ordernum)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
// string Ordernum = HttpContext.Current.Request["OrderNum"];
|
||
MaterialPull.init_Statistics(Ordernum, Opname, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 校验工时补录人员
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private static string Confirm_Person(string OperatorName)
|
||
{
|
||
string text = "0";
|
||
System.Data.DataTable dt = null;
|
||
// string OperatorName = HttpContext.Current.Request["OperatorName"];
|
||
MaterialPull.Confirm_Person(OperatorName, out dt);
|
||
if (dt != null)
|
||
{
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = dt.Rows[0][0].ToString();
|
||
}
|
||
}
|
||
return text;
|
||
}
|
||
|
||
//查询产品型号
|
||
private static string Init_OrderNum_data(string Ordernum)
|
||
{
|
||
string text = "";
|
||
System.Data.DataTable dt = null;
|
||
// string Ordernum = HttpContext.Current.Request["OrderNum"];
|
||
MaterialPull.Init_Ordernum_data(Ordernum, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
text = JsonHelper.DataTableToJson(dt);
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string ClassesCodeSelect(string ClassesName)
|
||
{
|
||
string ClassCode = "";
|
||
System.Data.DataTable dt_output = null;
|
||
// string ClassesName = HttpContext.Current.Request["ClassesName"];
|
||
MaterialPull.ClassCode_Select(ClassesName, out dt_output);
|
||
if (dt_output != null)
|
||
{
|
||
if (dt_output.Rows.Count > 0)
|
||
{
|
||
ClassCode = dt_output.Rows[0]["班次代码"].ToString();
|
||
}
|
||
}
|
||
return ClassCode;
|
||
}
|
||
|
||
//工时补录增加
|
||
private static string Insert_WorkTime(string Opname, string Ordernum, string OperatorName, string Classes, string EngineType, int Count, string UploadTime)
|
||
{
|
||
string text = "";
|
||
//string Ordernum = HttpContext.Current.Request["OrderNum"];
|
||
//string OperatorName = HttpContext.Current.Request["OperatorName"];
|
||
//string Classes = HttpContext.Current.Request["Classes"];
|
||
//string EngineType = HttpContext.Current.Request["EngineType"];
|
||
//int Count = Convert.ToInt32(HttpContext.Current.Request["Count"]);
|
||
//string UploadTime = HttpContext.Current.Request["UploadTime"];
|
||
|
||
MaterialPull.Workinghours_Insert(Ordernum, EngineType, Opname, Count, OperatorName, Classes, UploadTime);
|
||
return text;
|
||
}
|
||
|
||
#endregion 工时
|
||
|
||
#region 配送单接收模块
|
||
|
||
/// <summary>
|
||
/// 物料拉动-配送单接收
|
||
/// </summary>
|
||
/// <returns></returns
|
||
private static string ReceiveDistributionOrder(string distributionNum)
|
||
{
|
||
string text = "";
|
||
try
|
||
{
|
||
// string distributionNum = HttpContext.Current.Request["distributionNum"];
|
||
if (distributionNum == null)
|
||
return text;
|
||
System.Data.DataTable dt_Document;
|
||
MaterialPull.DocumentOutLineInfo_Select(distributionNum, out dt_Document);
|
||
if (dt_Document != null)
|
||
{
|
||
//已经接收
|
||
if (dt_Document.Rows.Count > 0)
|
||
{
|
||
text = "配送单号: " + distributionNum + " 已经接收!";
|
||
return text;
|
||
}
|
||
else
|
||
{
|
||
if (distributionNum == "")
|
||
{
|
||
text = "请扫描配送单号!";
|
||
return text;
|
||
}
|
||
text = MaterialPull_Document_Exec(distributionNum);
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{ }
|
||
return text;
|
||
}
|
||
|
||
private static bool isExec = false;//防止多次接收
|
||
|
||
private static string MaterialPull_Document_Exec(string distributionNum)
|
||
{
|
||
string text = "";
|
||
if (!isExec)//为false才允许接收
|
||
{
|
||
//string distributionNum = HttpContext.Current.Request["distributionNum"];
|
||
isExec = true;
|
||
text = MaterialPull_Document_Select(distributionNum);
|
||
}
|
||
else
|
||
{
|
||
text = "不允许接收!";
|
||
}
|
||
return text;
|
||
}
|
||
|
||
private static string MaterialPull_Document_Select(string distributionNum)
|
||
{
|
||
//string distributionNum = HttpContext.Current.Request["distributionNum"];
|
||
string process_Message;
|
||
try
|
||
{
|
||
string wkc = "";
|
||
System.Data.DataTable dt_wkc;
|
||
MaterialPull.WorkStationInfo_Select(out dt_wkc);
|
||
if (dt_wkc != null)
|
||
{
|
||
if (dt_wkc.Rows.Count > 0)
|
||
{
|
||
wkc = dt_wkc.Rows[0]["工作中心"].ToString();
|
||
}
|
||
}
|
||
if (wkc == "")
|
||
{
|
||
process_Message = "工作中心为空!";
|
||
return process_Message;
|
||
}
|
||
string document_Num = distributionNum.ToString();
|
||
System.Data.DataTable dt_Document;
|
||
//调试、先屏蔽
|
||
var BarCodeServer_Document = new BarCodeServer_Pro.BarCodeSever();
|
||
//sql版本需要用dataset承接
|
||
DataSet ds_Document;
|
||
ds_Document = BarCodeServer_Document.Web_MaterialPull_DocumentNum_Select(document_Num, wkc);
|
||
dt_Document = ds_Document.Tables[0];
|
||
//Orucal版本需要用dataset承接
|
||
//dt_Document = BarCodeServer_Document.Web_MaterialPull_DocumentNum_Select(document_Num, wkc);
|
||
if (dt_Document != null)
|
||
{
|
||
if (dt_Document.Rows.Count > 0)
|
||
{
|
||
//将条码信息插入到"配送单"表,状态标识为0,暂时不做处理
|
||
if (MaterialPull.MaterialPull_DocumentInfo_Add(dt_Document))
|
||
{
|
||
//执行接收处理
|
||
process_Message = MaterialPull_Document_Receive(document_Num, BarCodeServer_Document);
|
||
}
|
||
else
|
||
{
|
||
process_Message = "-1@失败,[" + document_Num + "]不能重复接收!";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
process_Message = "-1@失败,[" + document_Num + "]无此配送单信息!";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
process_Message = "-1@失败,[" + document_Num + "]无此配送单信息!";
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
process_Message = "-1@未知错误,联系管理员!";
|
||
}
|
||
isExec = false;
|
||
return process_Message;
|
||
}
|
||
|
||
//执行接收,传入webservice
|
||
private static string MaterialPull_Document_Receive(string document_Num, BarCodeSever BarCodeServer_Document)
|
||
{
|
||
string process_Message = "";
|
||
try
|
||
{
|
||
string r_source_id = "", r_orderNum = "", r_plant_id = "", r_wkc = "",
|
||
r_workNum = "", r_delivery_num = "", r_item_code = "", r_recept_flag = "", r_type = "";
|
||
string p_GroupId = "";
|
||
string documentInfo = "";
|
||
|
||
//产生接收记录,获得GROUPID,还有一个作用就是防止重复接收
|
||
MaterialPull.MaterialPull_DocumentInfo_CreateRecord(document_Num, out documentInfo);
|
||
if (documentInfo.Length > 2)
|
||
{
|
||
//产生接收记录成功
|
||
if (documentInfo.Substring(0, 2) == "0@")
|
||
{
|
||
p_GroupId = documentInfo.Substring(2, documentInfo.Length - 2);
|
||
if (p_GroupId == "")
|
||
return "-1@失败,[" + document_Num + "]产生接收记录失败";
|
||
System.Data.DataTable dt_record;
|
||
MaterialPull.MaterialPull_DocumentInfo_ReceiveRecord_Select(document_Num, p_GroupId, out dt_record);
|
||
if (dt_record != null)
|
||
{
|
||
if (dt_record.Rows.Count > 0)
|
||
{
|
||
r_source_id = dt_record.Rows[0]["ID"].ToString();
|
||
r_orderNum = dt_record.Rows[0]["订单号"].ToString();
|
||
r_plant_id = dt_record.Rows[0]["工厂"].ToString();
|
||
r_wkc = dt_record.Rows[0]["工作中心"].ToString();
|
||
r_workNum = dt_record.Rows[0]["工位号"].ToString();
|
||
r_delivery_num = dt_record.Rows[0]["配送单号"].ToString();
|
||
r_item_code = dt_record.Rows[0]["物料号"].ToString();
|
||
r_recept_flag = dt_record.Rows[0]["是否接收"].ToString();
|
||
r_type = dt_record.Rows[0]["类型"].ToString();
|
||
|
||
string outResult;
|
||
|
||
outResult = BarCodeServer_Document.Web_MaterialPull_DocumentNum_VerifyOK(r_source_id, r_orderNum, r_plant_id, r_wkc,
|
||
r_workNum, r_delivery_num, r_item_code, r_recept_flag, r_type, p_GroupId);
|
||
if (outResult.Length > 2)
|
||
{
|
||
//调用成功的话 返回“0@成功0@”
|
||
//将调用信息更新到接收记录表中
|
||
//执行调用成功存储过程,将临时表中数据加到库存中
|
||
if (outResult.Substring(0, 2) == "0@")
|
||
{
|
||
System.Data.DataSet Select_AndonCallInfo_DS = BarCodeServer_Document.Select_DocumentReceptCord_Result(document_Num, p_GroupId);
|
||
System.Data.DataTable Select_AndonCallInfo = Select_AndonCallInfo_DS.Tables[0];
|
||
if (Select_AndonCallInfo != null)
|
||
{
|
||
if (Select_AndonCallInfo.Rows.Count > 0)
|
||
{
|
||
string PROCESS_STATUS = Select_AndonCallInfo.Rows[0]["PROCESS_STATUS"].ToString();
|
||
if (PROCESS_STATUS != "SUCCESS")
|
||
{
|
||
MaterialPull.MaterialPull_DocumentInfo_NoticeOK(document_Num, p_GroupId, 0, outResult);
|
||
}
|
||
else
|
||
{
|
||
MaterialPull.MaterialPull_DocumentInfo_NoticeOK(document_Num, p_GroupId, 1, outResult);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MaterialPull.MaterialPull_DocumentInfo_NoticeOK(document_Num, p_GroupId, 0, outResult);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MaterialPull.MaterialPull_DocumentInfo_NoticeOK(document_Num, p_GroupId, 0, outResult);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MaterialPull.MaterialPull_DocumentInfo_NoticeOK(document_Num, p_GroupId, 0, outResult);
|
||
}
|
||
}
|
||
process_Message = outResult + "[" + document_Num + "]";
|
||
}
|
||
else
|
||
{
|
||
process_Message = "-1@失败,[" + document_Num + "]产生接收记录失败";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
process_Message = "-1@失败,[" + document_Num + "]产生接收记录失败";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
process_Message = documentInfo;
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
process_Message = "-1@未知错误,[" + document_Num + "]联系管理员!";
|
||
}
|
||
return process_Message;
|
||
}
|
||
|
||
#endregion 配送单接收模块
|
||
|
||
#region 直供上线模块
|
||
|
||
/// <summary>
|
||
/// 物料拉动-直供上线
|
||
/// </summary>
|
||
/// <returns></returns
|
||
/// <returns></returns>
|
||
private static string initDirectUpload(string OpName,string document_Num)
|
||
{
|
||
string text = "[{}]";
|
||
try
|
||
{
|
||
DataTable dt_VarifyTemp = new DataTable();
|
||
string process_Message;
|
||
|
||
|
||
string wkc = DirectUpload_Ini_WKC();
|
||
// string document_Num = HttpContext.Current.Request["Barcode"];
|
||
if (document_Num == null)
|
||
return text;
|
||
System.Data.DataTable dt_Document;
|
||
System.Data.DataSet ds_Document;
|
||
var direct = new BarCodeServer_Pro.BarCodeSever();
|
||
ds_Document = direct.Web_DirectUpload_Document_Select(document_Num, wkc);
|
||
dt_Document = ds_Document.Tables[0];
|
||
MaterialPull.DirectUpload_VerifyTempTable_Delete(OpName);
|
||
MaterialPull.DirectUpload_VerifyTempTable_Add(OpName, dt_Document);
|
||
MaterialPull.DirectUpload_VerifyTempTable_Select(OpName, document_Num, out process_Message, out dt_VarifyTemp);
|
||
if (dt_VarifyTemp == null)
|
||
{
|
||
process_Message = "条码查询失败!请重新扫描";
|
||
return text = "{\"result\":\"1\"}"; ;
|
||
}
|
||
|
||
if (dt_VarifyTemp.Rows.Count == 0)
|
||
{
|
||
process_Message = "条码查询失败!请重新扫描";
|
||
}
|
||
|
||
text = JsonHelper.DataTableToJson(dt_VarifyTemp);
|
||
}
|
||
catch (Exception ex)
|
||
{ }
|
||
return text;
|
||
}
|
||
|
||
private static string DirectUpload_Ini_WKC()
|
||
{
|
||
string work_center_code = "";
|
||
System.Data.DataTable dt_wkc;
|
||
dt_wkc = MaterialPull.DirectUpload_WorkCenterCode_Select();
|
||
if (dt_wkc != null)
|
||
{
|
||
if (dt_wkc.Rows.Count > 0)
|
||
{
|
||
work_center_code = dt_wkc.Rows[0]["工作中心"].ToString();
|
||
}
|
||
}
|
||
return work_center_code;
|
||
}
|
||
|
||
private static string DirectUpload_Verify(string OpName, string document_Num, string barcode)
|
||
{
|
||
string text = "";
|
||
try
|
||
{
|
||
string process_Message = "";
|
||
//string document_Num = HttpContext.Current.Request["documentNum"];//送货单行条码
|
||
//string barcode = HttpContext.Current.Request["barcode"];//卡片条码
|
||
System.Data.DataTable dt_VarifyTemp;
|
||
MaterialPull.DirectUpload_VerifyTempTable_Barcode_Select(OpName, document_Num, barcode, out process_Message, out dt_VarifyTemp);
|
||
text = JsonHelper.DataTableToJson(dt_VarifyTemp);
|
||
}
|
||
catch
|
||
{ }
|
||
return text;
|
||
}
|
||
|
||
private static string DirectUpload_Barcode_Verify_OK(string OpName, string document_Num)
|
||
{
|
||
string text = "";
|
||
try
|
||
{
|
||
// string document_Num = HttpContext.Current.Request["documentNum"];//送货单行条码
|
||
if (document_Num == null)
|
||
return text;
|
||
string process_Message_verify = "";
|
||
string p_GroupId = "";
|
||
|
||
string r_source_id = "", r_orderNum = "", r_plant_id = "", r_wkc = "",
|
||
r_workNum = "", r_delivery_num = "", r_item_code = "", r_recept_flag = "";
|
||
|
||
System.Data.DataTable dt_ReceiveRecord;
|
||
|
||
MaterialPull.DirectUpload_VerifyTempTable_VerifyOK(OpName, document_Num, out process_Message_verify);
|
||
if (process_Message_verify.Length > 2)
|
||
{
|
||
//产生接收记录成功
|
||
if (process_Message_verify.Substring(0, 2) == "0@")
|
||
{
|
||
p_GroupId = process_Message_verify.Substring(2, process_Message_verify.Length - 2);
|
||
if (p_GroupId == "")
|
||
return text;
|
||
MaterialPull.DirectUpload_ReceiveRecord_Select(OpName, document_Num, p_GroupId, out dt_ReceiveRecord);
|
||
if (dt_ReceiveRecord != null)
|
||
{
|
||
if (dt_ReceiveRecord.Rows.Count > 0)
|
||
{
|
||
r_source_id = dt_ReceiveRecord.Rows[0]["ID"].ToString();
|
||
r_orderNum = dt_ReceiveRecord.Rows[0]["订单号"].ToString();
|
||
r_plant_id = dt_ReceiveRecord.Rows[0]["工厂"].ToString();
|
||
r_wkc = dt_ReceiveRecord.Rows[0]["工作中心"].ToString();
|
||
r_workNum = dt_ReceiveRecord.Rows[0]["工位号"].ToString();
|
||
r_delivery_num = dt_ReceiveRecord.Rows[0]["配送单号"].ToString();
|
||
r_item_code = dt_ReceiveRecord.Rows[0]["物料号"].ToString();
|
||
r_recept_flag = dt_ReceiveRecord.Rows[0]["是否接收"].ToString();
|
||
|
||
r_workNum = DirectUpload_Ini_Opname(r_workNum);//产生接收记录工位号与SAP一致
|
||
|
||
string outResult;
|
||
var direct = new BarCodeServer_Pro.BarCodeSever();
|
||
outResult = direct.Web_DirectUpload_Document_VerifyOK(r_source_id, r_orderNum, r_plant_id, r_wkc,
|
||
r_workNum, r_delivery_num, r_item_code, r_recept_flag, p_GroupId);
|
||
if (outResult.Length > 2)
|
||
{
|
||
//调用成功的话 返回“0@成功0@”
|
||
//将调用信息更新到接收记录表中
|
||
//执行调用成功存储过程,将临时表中数据加到库存中
|
||
if (outResult.Substring(0, 2) == "0@")
|
||
{
|
||
MaterialPull.DirectUpload_VerifyTempTable_NoticeOK(OpName, document_Num, p_GroupId, 1, outResult);
|
||
}
|
||
else
|
||
{
|
||
MaterialPull.DirectUpload_VerifyTempTable_NoticeOK(OpName, document_Num, p_GroupId, 0, outResult);
|
||
}
|
||
text = JsonHelper.ObjectToJson(outResult);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//已经接收,不允许重复接收
|
||
else
|
||
{
|
||
text = JsonHelper.ObjectToJson(process_Message_verify);
|
||
}
|
||
}
|
||
}
|
||
catch
|
||
{ }
|
||
return text;
|
||
}
|
||
|
||
private static string DirectUpload_Ini_Opname(string opName_Ori)
|
||
{
|
||
string opName_Convert = "";
|
||
System.Data.DataTable dt_opName_Convert;
|
||
dt_opName_Convert = MaterialPull.DirectUpload_OpName_Select(opName_Ori);
|
||
if (dt_opName_Convert != null)
|
||
{
|
||
if (dt_opName_Convert.Rows.Count > 0)
|
||
{
|
||
opName_Convert = dt_opName_Convert.Rows[0]["指南工位号"].ToString();
|
||
}
|
||
}
|
||
return opName_Convert;
|
||
}
|
||
|
||
#endregion 直供上线模块
|
||
}
|
||
} |