qrmode 에서 wms rcv 태그 인식되게 함
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Management;
|
||||
using System.Data.SqlClient;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
using AR;
|
||||
using AR;
|
||||
using Emgu.CV.BgSegm;
|
||||
using Microsoft.Owin.StaticFiles;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Remoting;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Project
|
||||
{
|
||||
@@ -156,6 +157,18 @@ namespace Project
|
||||
if (iserr) PUB.logDbg.AddE(msg);
|
||||
else PUB.logDbg.Add(div, msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SQL Database Connection String
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetWMSConnectionString()
|
||||
{
|
||||
if (SETTING.Data.WMS_DB_PROD)
|
||||
return Properties.Settings.Default.WMS_PRD;
|
||||
else
|
||||
return Properties.Settings.Default.WMS_DEV;
|
||||
}
|
||||
public static bool SelectModelM(string modelName, bool bUploadConfig = true)
|
||||
{
|
||||
//if (this.InvokeRequired)
|
||||
@@ -212,6 +225,10 @@ namespace Project
|
||||
// }
|
||||
//}
|
||||
|
||||
public static bool UpdateWMS(Class.VisionData Data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public static bool SelectModelV(string modelName, bool bUploadConfig = true)
|
||||
{
|
||||
//
|
||||
@@ -342,8 +359,7 @@ namespace Project
|
||||
return false;
|
||||
}
|
||||
|
||||
//public static List<string> activesid = new List<string>();
|
||||
public static Task<Tuple<bool, string, int>> UpdateSIDInfoByECS()
|
||||
public static Task<Tuple<bool, string, int>> UpdateSIDInfo()
|
||||
{
|
||||
var rlt = Task.Run<Tuple<bool, string, int>>(() =>
|
||||
{
|
||||
@@ -354,122 +370,20 @@ namespace Project
|
||||
System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
|
||||
wat.Restart();
|
||||
|
||||
// activesid.Clear();
|
||||
//아무것도 하지 않는다.
|
||||
if (SETTING.Data.ECSSkip)
|
||||
//기존 SID정보에서 데이터를 취합니다.
|
||||
var mc = AR.SETTING.Data.McName;
|
||||
PUB.log.AddAT($"환경설정에서 ECS SKIP이 되었습니다 기존 정보에서 데이터를 생성합니다 MC={mc}");
|
||||
using (var tainfo = new DataSet1TableAdapters.Component_Reel_SID_InformationTableAdapter())
|
||||
{
|
||||
//기존 SID정보에서 데이터를 취합니다.
|
||||
var mc = AR.SETTING.Data.McName;
|
||||
PUB.log.AddAT($"환경설정에서 ECS SKIP이 되었습니다 기존 정보에서 데이터를 생성합니다 MC={mc}");
|
||||
using (var tainfo = new DataSet1TableAdapters.Component_Reel_SID_InformationTableAdapter())
|
||||
{
|
||||
var cntd = tainfo.DeleteAll("IB");
|
||||
PUB.log.AddAT($"{cntd}건의 자료가 삭제됨");
|
||||
var cnti = tainfo.MakeIBData(mc);
|
||||
PUB.log.AddAT($"{cnti}건의 자료가 복제됨");
|
||||
}
|
||||
message = "ECS-OFF 됨 장비전용 데이터로 진행 함";
|
||||
result = true;
|
||||
rdy = 1;
|
||||
var cntd = tainfo.DeleteAll("IB");
|
||||
PUB.log.AddAT($"{cntd}건의 자료가 삭제됨");
|
||||
var cnti = tainfo.MakeIBData(mc);
|
||||
PUB.log.AddAT($"{cnti}건의 자료가 복제됨");
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "ECS-OFF 됨 장비전용 데이터로 진행 함";
|
||||
result = true;
|
||||
rdy = 1;
|
||||
|
||||
PUB.log.Add($"ECS로부터 SID 정보를 수신 합니다");
|
||||
var url = $@"http://10.131.32.29:8080/api/job?MC={SETTING.Data.McName}";
|
||||
var newbuf = UTIL.GetStrfromurl(url, out bool iserror, 15000);
|
||||
newbuf = newbuf.Replace("k__BackingField", "").Replace("<", "").Replace(">", "");
|
||||
if (newbuf.StartsWith("[") == false || newbuf.EndsWith("]") == false)
|
||||
{
|
||||
wat.Stop();
|
||||
PUB.log.AddE($"ECS수신데이터오류:{newbuf} {wat.ElapsedMilliseconds}ms");
|
||||
message = newbuf;
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Newtonsoft.Json.Linq.JArray data = null;
|
||||
|
||||
try
|
||||
{
|
||||
data = Newtonsoft.Json.Linq.JArray.Parse(newbuf);
|
||||
|
||||
//시드정보를 삭제한다.
|
||||
PUB.log.Add($"sid정보삭제 {PUB.MCCode}");
|
||||
var ta = new DataSet1TableAdapters.Component_Reel_SID_InformationTableAdapter();
|
||||
ta.DeleteAll(PUB.MCCode);
|
||||
|
||||
//신규로드옭한다
|
||||
var dt = new DataSet1.Component_Reel_SID_InformationDataTable();
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var jsondata = data[i]; //데이터가 없는 경우 null반환
|
||||
var v_sid = jsondata["SID"];
|
||||
var v_bat = jsondata["BATCH"];
|
||||
var v_lot = jsondata["VENDOR_LOT"];
|
||||
var v_ccd = jsondata["CUST_CODE"];
|
||||
var v_pat = jsondata["PART_NO"];
|
||||
var v_ivq = jsondata["IVC_QTY"];
|
||||
var v_att = jsondata["ATTACH"];
|
||||
var v_rdy = jsondata["ECS_READY"].ToString().ToLower();
|
||||
|
||||
|
||||
|
||||
var newdr = dt.NewComponent_Reel_SID_InformationRow();
|
||||
newdr.MC = PUB.MCCode;
|
||||
newdr.SID = "";
|
||||
newdr.CustCode = "";
|
||||
newdr.CustName = "";
|
||||
newdr.PartNo = "";
|
||||
newdr.VenderLot = "";
|
||||
newdr.VenderName = "";
|
||||
newdr.Remark = "auto";
|
||||
newdr.qtymax = 0; //인보이스수량
|
||||
newdr.batch = "";
|
||||
newdr.attach = "";
|
||||
newdr.wdate = DateTime.Now;
|
||||
|
||||
//값이존재하는 경우에만 기록
|
||||
if (v_sid != null && v_sid.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.SID = v_sid.ToString();
|
||||
if (v_bat != null && v_bat.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.batch = v_bat.ToString();
|
||||
if (v_lot != null && v_lot.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.VenderLot = v_lot.ToString();
|
||||
if (v_ccd != null && v_ccd.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.CustCode = v_ccd.ToString();
|
||||
if (v_pat != null && v_pat.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.PartNo = v_pat.ToString();
|
||||
if (v_ivq != null && v_ivq.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.qtymax = (int)v_ivq;
|
||||
if (v_att != null && v_att.Type != Newtonsoft.Json.Linq.JTokenType.Null) newdr.attach = v_att.ToString();
|
||||
if (newdr.CustCode.Length == 3) newdr.CustCode = "0" + newdr.CustCode;
|
||||
|
||||
|
||||
if (v_rdy == "true")
|
||||
{
|
||||
rdy += 1;
|
||||
if (newdr.SID.isEmpty() == false)
|
||||
{
|
||||
//if (activesid.Contains(newdr.SID) == false)
|
||||
// activesid.Add(newdr.SID);
|
||||
PUB.log.Add($"{newdr.SID} 값은 활성화 SID입니다(ATTACH:{v_att},MC:{SETTING.Data.McName}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newdr.EndEdit();
|
||||
if (newdr.SID.isEmpty() == false)
|
||||
dt.AddComponent_Reel_SID_InformationRow(newdr);
|
||||
else newdr.Delete();
|
||||
}
|
||||
cnt = ta.Update(dt);
|
||||
if (cnt == 0) message = "No data";
|
||||
result = cnt > 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
wat.Stop();
|
||||
message = ex.Message;
|
||||
PUB.log.AddE($"ECS수신데이터오류:{newbuf},메세지={ex.Message} {wat.ElapsedMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
wat.Stop();
|
||||
PUB.log.Add($"{cnt}건의 sid정보가 추가됨 {wat.ElapsedMilliseconds:N2}ms");
|
||||
return new Tuple<bool, string, int>(result, message, rdy);
|
||||
@@ -477,123 +391,7 @@ namespace Project
|
||||
return rlt;
|
||||
}
|
||||
|
||||
public static List<Tuple<string, string, string, bool>> GetECSActiveSIDList()
|
||||
{
|
||||
List<Tuple<string, string, string, bool>> retval = new List<Tuple<string, string, string, bool>>();
|
||||
bool result = false;
|
||||
string message = string.Empty;
|
||||
int cnt = 0;
|
||||
int rdy = 0;
|
||||
|
||||
//아무것도 하지 않는다.
|
||||
if (SETTING.Data.ECSSkip)
|
||||
{
|
||||
PUB.log.AddAT($"ecs skip 으로 인해 활성sid목록을 가져오지 않습니다");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
PUB.log.Add($"ECS로부터 SID 정보를 수신 합니다");
|
||||
var url = $@"http://10.131.32.29:8080/api/job?MC={SETTING.Data.McName}";
|
||||
var newbuf = UTIL.GetStrfromurl(url, out bool iserror, 15000);
|
||||
newbuf = newbuf.Replace("k__BackingField", "").Replace("<", "").Replace(">", "");
|
||||
if (newbuf.StartsWith("[") == false || newbuf.EndsWith("]") == false)
|
||||
{
|
||||
PUB.log.AddE($"ECS수신데이터오류:{newbuf}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Newtonsoft.Json.Linq.JArray data = null;
|
||||
|
||||
try
|
||||
{
|
||||
data = Newtonsoft.Json.Linq.JArray.Parse(newbuf);
|
||||
|
||||
|
||||
//신규로드옭한다
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
var jsondata = data[i]; //데이터가 없는 경우 null반환
|
||||
var v_sid = jsondata["SID"];
|
||||
var v_bat = jsondata["BATCH"];
|
||||
var v_att = jsondata["ATTACH"];
|
||||
var v_rdy = jsondata["ECS_READY"].ToString().ToLower();
|
||||
|
||||
var str_sid = "";
|
||||
var str_bat = "";
|
||||
var str_att = "";
|
||||
|
||||
//값이존재하는 경우에만 기록
|
||||
if (v_sid != null && v_sid.Type != Newtonsoft.Json.Linq.JTokenType.Null) str_sid = v_sid.ToString();
|
||||
if (v_bat != null && v_bat.Type != Newtonsoft.Json.Linq.JTokenType.Null) str_bat = v_bat.ToString();
|
||||
if (v_att != null && v_att.Type != Newtonsoft.Json.Linq.JTokenType.Null) str_att = v_att.ToString();
|
||||
|
||||
if (str_sid.isEmpty() == false && str_bat.isEmpty() == false)
|
||||
{
|
||||
retval.Add(new Tuple<string, string, string, bool>(
|
||||
str_sid,
|
||||
str_bat,
|
||||
str_att,
|
||||
(v_rdy == "true")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
message = ex.Message;
|
||||
PUB.log.AddE($"ECS수신데이터오류:{newbuf},메세지={ex.Message} ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
//public static Task<bool> GetECSSIDAcitve(string sid, string batch)
|
||||
//{
|
||||
// var rlt = Task.Run<bool>(() =>
|
||||
// {
|
||||
// bool result = false;
|
||||
// string message = string.Empty;
|
||||
// int cnt = 0;
|
||||
// int rdy = 0;
|
||||
// System.Diagnostics.Stopwatch wat = new System.Diagnostics.Stopwatch();
|
||||
// wat.Restart();
|
||||
|
||||
// //아무것도 하지 않는다.
|
||||
// if (SETTING.Data.ECSSkip)
|
||||
// {
|
||||
// result = true;
|
||||
// rdy = 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// PUB.log.Add($"ECS로부터 SID ACTIVE 정보를 수신 합니다");
|
||||
// var url = $@"http://10.131.32.29:8080/api/active?MC={SETTING.Data.McName}&SID={sid}&BATCH={batch}";
|
||||
// var newbuf = UTIL.GetStrfromurl(url, out bool iserror, 15000);
|
||||
// newbuf = newbuf.Replace("k__BackingField", "").Replace("<", "").Replace(">", "");
|
||||
// PUB.log.Add($"ecs active check message={newbuf}");
|
||||
// result = newbuf.ToLower() == "true";
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// PUB.log.AddE(ex.Message);
|
||||
// result = true;
|
||||
// }
|
||||
// }
|
||||
// wat.Stop();
|
||||
// //PUB.log.Add($"{cnt}건의 sid정보가 추가됨 {wat.ElapsedMilliseconds:N2}ms");
|
||||
// return result;
|
||||
// });
|
||||
// return rlt;
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 전체 작업목록을 별도파일에 저장한다
|
||||
/// </summary>
|
||||
@@ -602,8 +400,6 @@ namespace Project
|
||||
/// <param name="file"></param>
|
||||
public static void AddJobList(string seqdate, string seqno, string file)
|
||||
{
|
||||
//저장된 파일은 아래와같은 데이터를 가지고 있다
|
||||
//sb.AppendLine("#Time\tSID\tRID\tRAW");
|
||||
|
||||
//해당 차수로 저장된 파일이 잇는지 체크한다.
|
||||
var savepath = System.IO.Path.Combine(AR.SETTING.Data.Path_Data, "JobData", seqdate.Substring(0, 6), seqdate + "-" + seqno + ".txt");
|
||||
@@ -1478,7 +1274,7 @@ namespace Project
|
||||
}
|
||||
public static Boolean PasswordCheck()
|
||||
{
|
||||
var pass = new Dialog.fPassword();
|
||||
var pass = new AR.Dialog.fPassword();
|
||||
if (pass.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var p = AR.SETTING.Data.Password_Setup;
|
||||
@@ -1689,7 +1485,7 @@ namespace Project
|
||||
}
|
||||
public static double ChangeValuePopup(double value, string title)
|
||||
{
|
||||
var f = new Dialog.fInput(title, value.ToString());
|
||||
var f = new AR.Dialog.fInput(title, value.ToString());
|
||||
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
var val = double.Parse(f.tbInput.Text);
|
||||
@@ -1698,95 +1494,24 @@ namespace Project
|
||||
else return value;
|
||||
|
||||
}
|
||||
//public static bool ImportSIDInfo(DataSet1.Component_Reel_SID_InformationDataTable Component_Reel_SID_Information,
|
||||
// String InputFileName,
|
||||
// System.Windows.Forms.ProgressBar progressBar1 = null)
|
||||
//{
|
||||
// //엑셀을 읽어와서 처리한다.
|
||||
// var fi = new System.IO.FileInfo(InputFileName);
|
||||
// var ext = fi.Extension.ToLower();
|
||||
// libxl.Book book;
|
||||
// if (ext == ".xlsx") book = new libxl.XmlBook();
|
||||
// else if (ext == ".xls") book = new libxl.BinBook();
|
||||
// else return false;
|
||||
|
||||
// var keyinfo = Properties.Settings.Default.libxl.Split('/');
|
||||
// book.setKey(keyinfo[0], keyinfo[1]);
|
||||
// book.load(fi.FullName);
|
||||
// var sheet = book.getSheet(0);
|
||||
public static (bool success, string newid, string message) MakeNewREELID(string sid)
|
||||
{
|
||||
//WMS은 DB에서 생성하낟.
|
||||
var ta = new dsWMSTableAdapters.QueriesTableAdapter();
|
||||
|
||||
// var cs = sheet.firstCol();
|
||||
// var ce = sheet.lastCol();
|
||||
// var rs = sheet.firstRow();
|
||||
// var re = sheet.lastRow();
|
||||
string NewID = string.Empty;
|
||||
string Message = string.Empty;
|
||||
|
||||
// if (progressBar1 != null)
|
||||
// {
|
||||
// progressBar1.Minimum = 0;
|
||||
// progressBar1.Maximum = re;
|
||||
// progressBar1.Value = 0;
|
||||
// }
|
||||
|
||||
// if (rs == 0) rs += 1;
|
||||
|
||||
// int cntA = 0;
|
||||
// int cntU = 0;
|
||||
// for (int row = rs; row <= re; row++)
|
||||
// {
|
||||
// //update progress bar
|
||||
// if (progressBar1 != null)
|
||||
// {
|
||||
// if (progressBar1.Value < progressBar1.Maximum) progressBar1.Value += 1;
|
||||
// }
|
||||
|
||||
|
||||
// var cCustCode = sheet.readStr(row, 0);
|
||||
// var cSID = sheet.readStr(row, 1);
|
||||
// var cPartNo = sheet.readStr(row, 2);
|
||||
|
||||
// if (cCustCode.isEmpty() == false && cCustCode.Length != 4)
|
||||
// cCustCode = cCustCode.PadLeft(4, '0');
|
||||
|
||||
// if (cSID.isEmpty() && cCustCode.isEmpty()) break; //
|
||||
|
||||
// //if (cSID.StartsWith("10"))
|
||||
// //{
|
||||
// EnumerableRowCollection<DataSet1.Component_Reel_SID_InformationRow> plist = null;
|
||||
// plist = Component_Reel_SID_Information.Where(t => t.MC == AR.SETTING.Data.McName && t.SID == cSID && t.CustCode == cCustCode && t.PartNo == cPartNo);
|
||||
|
||||
// if (plist == null || plist.Any() == false)
|
||||
// {
|
||||
// //존재하지않으면 추가한다.
|
||||
// var newdr = Component_Reel_SID_Information.NewComponent_Reel_SID_InformationRow();
|
||||
// newdr.CustCode = cCustCode;
|
||||
// newdr.SID = cSID;
|
||||
// newdr.PartNo = cPartNo;
|
||||
// newdr.MC = AR.SETTING.Data.McName;
|
||||
// newdr.wdate = DateTime.Now;
|
||||
// Component_Reel_SID_Information.AddComponent_Reel_SID_InformationRow(newdr);
|
||||
// cntA += 1;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //있다면 업데이트 해준다.
|
||||
// //foreach (var item in plist)
|
||||
// //{
|
||||
// // if (cSID.isEmpty() == false)
|
||||
// // {
|
||||
// // item.SID = cSID; ;
|
||||
// // item.EndEdit();
|
||||
// // cntU += 1;
|
||||
// // }
|
||||
|
||||
// //}
|
||||
// }
|
||||
// //}
|
||||
|
||||
// }
|
||||
// PUB.log.Add($"Import SID Information : {cntA}");
|
||||
// return true;
|
||||
//}
|
||||
var retval = ta.X_SP_GET_UNIT_ID_LABEL(SETTING.Data.WMS_PROGRAM_ID,
|
||||
SETTING.Data.WMS_CENTER_CD, sid,
|
||||
SETTING.Data.WMS_REG_USERID,
|
||||
PUB.IP,
|
||||
ref NewID,
|
||||
ref Message);
|
||||
|
||||
return ((!NewID.isEmpty() && Message == "OK"), NewID, Message);
|
||||
}
|
||||
|
||||
public static void CheckFreeSpace()
|
||||
{
|
||||
@@ -1842,7 +1567,7 @@ namespace Project
|
||||
public static void ChangeUIPopup(System.Windows.Forms.NumericUpDown valueCtl)
|
||||
{
|
||||
var value = valueCtl.Value.ToString();
|
||||
Dialog.fInput f = new Dialog.fInput("Input value", value);
|
||||
AR.Dialog.fInput f = new AR.Dialog.fInput("Input value", value);
|
||||
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
var val = decimal.Parse(f.tbInput.Text);
|
||||
|
||||
Reference in New Issue
Block a user