|
|
@ -11,7 +11,7 @@ using System.Data;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ibk.IPD
|
|
|
|
namespace ibk.IPD
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2537,6 +2537,13 @@ namespace ibk.IPD
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2}+{3},不满足取样重量基准:{4}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], ConverDataToDecimal(delAddModel.WGT), delAddModel.SMP_STD_WGT);
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2}+{3},不满足取样重量基准:{4}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], ConverDataToDecimal(delAddModel.WGT), delAddModel.SMP_STD_WGT);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (smpnoWgtDict[smpNoDict] + ConverDataToDecimal(delAddModel.WGT) > 50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2}+{3},不满足取样重量基准:{4}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], ConverDataToDecimal(delAddModel.WGT), delAddModel.SMP_STD_WGT);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -2545,6 +2552,11 @@ namespace ibk.IPD
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2},不满足取样重量基准:{3}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], delAddModel.SMP_STD_WGT);
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2},不满足取样重量基准:{3}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], delAddModel.SMP_STD_WGT);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (smpnoWgtDict[smpNoDict] > 50)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//logger.InfoFormat("试样号:{0},钢板号:{1},取样后重量为:{2},不满足取样重量基准:{3}", smpNoDict, delAddModel.PLATE_NO, smpnoWgtDict[smpNoDict], delAddModel.SMP_STD_WGT);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 并样吨位管控
|
|
|
|
#endregion 并样吨位管控
|
|
|
@ -2621,24 +2633,106 @@ namespace ibk.IPD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void SaveQABSMP_M(IList<PDI_SMP_NO_M> pdi)
|
|
|
|
public void SaveQABSMP_M(IList<PDI_SMP_NO_M> pdi)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.InfoFormat("*******钢板去重前,共:{0}条*******", pdi.Count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IList<string> distinctList = pdi.GroupBy(p => p.SMP_NO_M)
|
|
|
|
|
|
|
|
.Select(g => g.Key)
|
|
|
|
|
|
|
|
.Distinct()
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IList<PDI_SMP_NO_M> pdiDis = new List<PDI_SMP_NO_M>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (string strSmpNoM in distinctList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool blFirst = true;
|
|
|
|
|
|
|
|
if (pdi.Where(p => p.SMP_NO_M == strSmpNoM).Count() > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//同一板坯号优先
|
|
|
|
|
|
|
|
if (pdi.Where(p => p.SMP_NO_M == strSmpNoM && p.PLATE_NO.Substring(0,10)== strSmpNoM.Substring(0,10)).Count()>0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach (var PSNM in pdi.Where(p => p.SMP_NO_M == strSmpNoM && p.PLATE_NO.Substring(0, 10) == strSmpNoM.Substring(0, 10)).ToList())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//钢板号已存在并号集合中不再并号
|
|
|
|
|
|
|
|
if (pdiDis.Where(p => p.PLATE_NO == PSNM.PLATE_NO).Count() > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第一次赋值P,之后赋值N
|
|
|
|
|
|
|
|
if (blFirst)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PSNM.SMP_FLG = "P";
|
|
|
|
|
|
|
|
blFirst = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PSNM.SMP_FLG = "N";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.InfoFormat("同一板坯号优先:{0} 式样号{1}",PSNM.PLATE_NO,strSmpNoM);
|
|
|
|
|
|
|
|
pdiDis.Add(PSNM);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//其他板坯
|
|
|
|
|
|
|
|
foreach (var PSNM in pdi.Where(p => p.SMP_NO_M == strSmpNoM).ToList())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//钢板号已存在并号集合中不再并号
|
|
|
|
|
|
|
|
if (pdiDis.Where(p=>p.PLATE_NO== PSNM.PLATE_NO).Count()>0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//第一次赋值P,之后赋值N
|
|
|
|
|
|
|
|
if (blFirst)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PSNM.SMP_FLG = "P";
|
|
|
|
|
|
|
|
blFirst=false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
PSNM.SMP_FLG = "N";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.InfoFormat("不同板坯号优先:{0} 式样号{1}", PSNM.PLATE_NO, strSmpNoM);
|
|
|
|
|
|
|
|
pdiDis.Add(PSNM);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.InfoFormat("*******钢板去重后,共:{0}条*******", pdiDis.Count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//因为是同时操作两个表, 所以开启事务
|
|
|
|
//因为是同时操作两个表, 所以开启事务
|
|
|
|
db.BeginTransaction();
|
|
|
|
db.BeginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
db.Execute(" DELETE FROM PDI_SMP_NO_M ");//删除获取最新数据
|
|
|
|
db.Execute(" DELETE FROM PDI_SMP_NO_M ");//删除获取最新数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db.Execute(" DELETE FROM CONFIRMSMPNO_M ");//删除获取最新数据
|
|
|
|
|
|
|
|
|
|
|
|
//存储并样去重后信息
|
|
|
|
//存储并样去重后信息
|
|
|
|
foreach (PDI_SMP_NO_M delAddModel in pdi)
|
|
|
|
foreach (PDI_SMP_NO_M delAddModel in pdiDis)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//存储动态挂试样号履历
|
|
|
|
//存储手动并样匹配
|
|
|
|
db.Insert<PDI_SMP_NO_M>(delAddModel);
|
|
|
|
CONFIRMSMPNO_M InsertSmpno = GetSmpnoM(delAddModel);//并样去重后信息
|
|
|
|
logger.InfoFormat("钢板:{0},订单:{1}-{2},试样号:{3}存储成功", delAddModel.PLATE_NO, delAddModel.ORD_NO, delAddModel.ORD_ITEM, delAddModel.SMP_NO);
|
|
|
|
if (InsertSmpno != null && InsertSmpno.SMP_NO != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
db.Insert<CONFIRMSMPNO_M>(InsertSmpno);
|
|
|
|
|
|
|
|
//logger.InfoFormat("钢板:{0},订单:{1}-{2},试样号:{3}存储成功", delAddModel.PLATE_NO, delAddModel.ORD_NO, delAddModel.ORD_ITEM, delAddModel.SMP_NO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//delAddModel.IS_STATE = "1";//下发过存1,没下发默认是0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////存储PDO发送MES
|
|
|
|
|
|
|
|
//TBDIPDO InsertPDO = GetPDO(delAddModel);
|
|
|
|
|
|
|
|
//db.Insert<TBDIPDO>(InsertPDO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//存储动态挂试样号履历
|
|
|
|
|
|
|
|
db.Insert<PDI_SMP_NO_M>(delAddModel);
|
|
|
|
|
|
|
|
logger.InfoFormat("钢板:{0},订单:{1}-{2},试样号:{3}存储成功", delAddModel.PLATE_NO, delAddModel.ORD_NO, delAddModel.ORD_ITEM, delAddModel.SMP_NO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.Commit();
|
|
|
|
db.Commit();
|
|
|
@ -2871,6 +2965,112 @@ namespace ibk.IPD
|
|
|
|
//}
|
|
|
|
//}
|
|
|
|
return Result;
|
|
|
|
return Result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Null转换string
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="obj">参数</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public static string ConverDataToString(string obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (obj == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return string.Empty;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public CONFIRMSMPNO_M GetSmpnoM(PDI_SMP_NO_M pdi)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CONFIRMSMPNO_M Result = new CONFIRMSMPNO_M();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加之前执行删除操作,目前不需要判断
|
|
|
|
|
|
|
|
//if (SurMatSubController.gCONFIRMSMPNO.Where(p => p.PLATE_NO == pdi.PLATE_NO && p.SMP_NO == pdi.SMP_NO).ToList().Count == 0)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
Result.SMP_NO = pdi.SMP_NO;
|
|
|
|
|
|
|
|
//获取原试样标准
|
|
|
|
|
|
|
|
Result.SMP_STDSPEC = pdi.SMP_STDSPEC;
|
|
|
|
|
|
|
|
Result.PLATE_NO = pdi.PLATE_NO;
|
|
|
|
|
|
|
|
Result.PLATE_STDSPEC = pdi.APLY_STDSPEC;
|
|
|
|
|
|
|
|
Result.ORD_NO = pdi.ORD_NO;
|
|
|
|
|
|
|
|
Result.ORD_ITEM = pdi.ORD_ITEM;
|
|
|
|
|
|
|
|
Result.ORD_STDSPEC = pdi.ORD_STDSPEC;
|
|
|
|
|
|
|
|
//Result.INS_DATE = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
|
|
Result.INS_DATE = pdi.INS_DATE;
|
|
|
|
|
|
|
|
Result.PROC_CD = pdi.PROC_CD;
|
|
|
|
|
|
|
|
Result.PLT = pdi.PLT;
|
|
|
|
|
|
|
|
Result.ORD_THK = pdi.ORD_THK;
|
|
|
|
|
|
|
|
Result.TIMESTAMP = GetTimeStamp(); //TIMESTAMP: 1970.1.1 8:00:00 至当前时间的毫秒数
|
|
|
|
|
|
|
|
Result.CERT_TYPE = pdi.CERT_TYPE;
|
|
|
|
|
|
|
|
StringBuilder strData = new StringBuilder();
|
|
|
|
|
|
|
|
strData.Append(("BKDMESMP").PadRight(10));//FORMID:10位 ,BKDERP001 固定
|
|
|
|
|
|
|
|
strData.Append(("").PadRight(12)); // 业务ID号 NUMBER(12) 流水号,需要再应答中带回
|
|
|
|
|
|
|
|
strData.Append((pdi.PLATE_NO).PadRight(14));// 钢板号: VARCHAR2(14)
|
|
|
|
|
|
|
|
strData.Append((pdi.SMP_NO).PadRight(14));// 试样号: VARCHAR2(14)
|
|
|
|
|
|
|
|
strData.Append((pdi.SYNOPSIS.ToString()).PadRight(1));// 标记: VARCHAR2(14)
|
|
|
|
|
|
|
|
Result.DATA = strData.ToString();
|
|
|
|
|
|
|
|
Result.IS_BING = "0";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Result.SMP_FLG = pdi.SMP_FLG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Result.SMP_NO_M = pdi.SMP_NO_M;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(150); //避免时间戳重复
|
|
|
|
|
|
|
|
//D 状态开头的 船板 不并样
|
|
|
|
|
|
|
|
//if (pdi.CERT_TYPE == "S" && pdi.PROC_CD.StartsWith("D"))
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
if (pdi.SMP_NO_M != null )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Result.IS_BING = "2";
|
|
|
|
|
|
|
|
long timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
|
|
|
|
Thread.Sleep(150);
|
|
|
|
|
|
|
|
long timestamp2 = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
|
|
|
|
string timestamp12 = timestamp.ToString().Substring(0, 12);
|
|
|
|
|
|
|
|
string timestamp122 = timestamp.ToString().Substring(0, 12);
|
|
|
|
|
|
|
|
StringBuilder strData2 = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FORMID:10位 ,BKDMESMP01 固定
|
|
|
|
|
|
|
|
// 业务ID号 NUMBER(12) 流水号,需要在应答中带回
|
|
|
|
|
|
|
|
// 钢板号:VARCHAR2(14)
|
|
|
|
|
|
|
|
// 产品代码: VARCHAR2(2)
|
|
|
|
|
|
|
|
// 实际标记: VARCHAR2(1)
|
|
|
|
|
|
|
|
// 位置: VARCHAR2(1)
|
|
|
|
|
|
|
|
// 长度: VARCHAR2(10)
|
|
|
|
|
|
|
|
// 试样号: VARCHAR2(14) 注:倒数第二位(13位)是9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strData2.Append(("BKDMESMP01").PadRight(10));//FORMID:10位 ,BKDERP001 固定
|
|
|
|
|
|
|
|
strData2.Append((timestamp12).PadRight(12)); // 业务ID号 NUMBER(12) 流水号,需要再应答中带回
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.PLATE_NO).PadRight(14));// 钢板号: VARCHAR2(14)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.PROD_CD).PadRight(2));// 产品代码: VARCHAR2(2)
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.SMP_FLG).PadRight(1));// 实际标记: VARCHAR2(1)
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.SMP_LOC).PadRight(1));// 位置: VARCHAR2(1)
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.SMP_LEN).PadRight(10));// 长度: VARCHAR2(10)
|
|
|
|
|
|
|
|
strData2.Append(ConverDataToString(pdi.SMP_NO).PadRight(14));// 试样号: VARCHAR2(14)
|
|
|
|
|
|
|
|
//strData2.Append((pdi.SYNOPSIS.ToString()).PadRight(1));// 标记: VARCHAR2(14)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FORMID:10位 ,BKDMESMP01 固定
|
|
|
|
|
|
|
|
// 业务ID号 NUMBER(12) 流水号,需要在应答中带回
|
|
|
|
|
|
|
|
// 试样号: VARCHAR2(14) 注:倒数第二位(13位)是9
|
|
|
|
|
|
|
|
// 原式样号:VARCHAR2(14)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strData2.Append(("$").PadRight(1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strData2.Append(("BKDMESMP02").PadRight(10));//FORMID:10位 ,BKDERP001 固定
|
|
|
|
|
|
|
|
strData2.Append((timestamp122).PadRight(12)); // 业务ID号 NUMBER(12) 流水号,需要再应答中带回
|
|
|
|
|
|
|
|
strData2.Append((pdi.SMP_NO).PadRight(14));// 试样号: VARCHAR2(14)
|
|
|
|
|
|
|
|
strData2.Append((pdi.SMP_NO_M).PadRight(14));// 试样号: VARCHAR2(14)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Result.DATA = strData2.ToString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CONFIRMSMPNO_TEST GetSmpno_TEST(PDI_SMP_NO pdi)
|
|
|
|
public CONFIRMSMPNO_TEST GetSmpno_TEST(PDI_SMP_NO pdi)
|
|
|
|
{
|
|
|
|
{
|
|
|
|