You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
718 lines
28 KiB
718 lines
28 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.FJC.Entity.Basic;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.FJC.DAL.Operation;
|
|
using QMAPP.FJC.Entity;
|
|
using QMAPP.FJC.BLL.Basic;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.DAL.Injection;
|
|
using QMAPP.FJC.Entity.Injection;
|
|
using QMFrameWork.Common.Task;
|
|
using QMFrameWork.Log;
|
|
using QMAPP.FJC.Entity.QT;
|
|
using QMAPP.FJC.DAL.QT;
|
|
using QMAPP.FJC.DAL.Basic;
|
|
using QMAPP.MD.DAL;
|
|
using QMAPP.MD.Entity;
|
|
|
|
|
|
namespace QMAPP.FJC.BLL.Process
|
|
{
|
|
/// <summary>
|
|
/// 加工操作处理类
|
|
/// 作者:闫永刚
|
|
/// 日期:2015-05-28
|
|
/// </summary>
|
|
public class OperateProcess
|
|
{
|
|
#region IProcess 成员
|
|
|
|
public void Process(MachineInfo machine, List<ParameterConfig> parConfigList)
|
|
{
|
|
MainDAL mainDal = new MainDAL();
|
|
ProductDAL productDal = new ProductDAL();
|
|
|
|
try
|
|
{
|
|
#region 获取加工记录
|
|
|
|
List<MainOperation> listOperate = new List<MainOperation>();
|
|
MainOperationDAL modal = new MainOperationDAL();
|
|
|
|
var moldNumber = "1";
|
|
if (machine.PROCESSTYPE == EnumGeter.ProcessType.jiaozhu.GetHashCode().ToString())
|
|
{
|
|
moldNumber = parConfigList.First(o => o.COLUMNCODE.Contains("MCNO")).PARAVALUE.ToString();
|
|
}
|
|
|
|
MainOperation condition = new MainOperation()
|
|
{
|
|
OPERATESTATE = EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString(),
|
|
PROCESSTYPE = machine.PROCESSTYPE,
|
|
MACHINECODDE = machine.MACHINECODDE,
|
|
MOLDNUMBER = moldNumber,
|
|
PRODUCELINE = machine.PRODUCELINE
|
|
};
|
|
|
|
|
|
//获取正在加工中的加工记录
|
|
List<MainOperation> mainOperatingList = modal.GetList(condition)
|
|
.OrderByDescending(o => o.CREATEDATE).ToList<MainOperation>();
|
|
|
|
#endregion
|
|
|
|
//加工操作
|
|
if (mainOperatingList.Count > 0)
|
|
{
|
|
List<ProductInjection> addInjectItemList = new List<ProductInjection>();
|
|
|
|
//获取加工工序记录
|
|
MainOperation mainOpe = mainOperatingList[0];
|
|
|
|
using (MutexLock stockLock = new MutexLock(machine.MACHINECODDE + ":Complete"))
|
|
{
|
|
#region 处理本体或是产品对象
|
|
|
|
//初始化本体对象
|
|
|
|
Main mainObj = new Main();
|
|
|
|
//初始化零件对象
|
|
|
|
Product product = new Product();
|
|
|
|
//判断加工工序产品的产品类别,获取对应的对象
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-2:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
|
|
//获取本体对象
|
|
mainObj = mainDal.Get(new Main() { PID = mainOpe.PDID });
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-2:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
}
|
|
else
|
|
{
|
|
//获取产品对象
|
|
product = productDal.Get(new Product() { PID = mainOpe.PDID });
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 如果浇注操作关联浇注投料信息
|
|
|
|
if (machine.PROCESSTYPE == EnumGeter.ProcessType.jiaozhu.GetHashCode().ToString())
|
|
{
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-3:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
InjectionRecorderDAL injectDal = new InjectionRecorderDAL();
|
|
|
|
List<InjectionRecorder> list = injectDal.GetCastLastRecorder(new InjectionRecorder()
|
|
{
|
|
MACHINECODDE = machine.MACHINECODDE,
|
|
});
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
foreach (var inRecorder in list)
|
|
{
|
|
|
|
#region 零件投料关联记录
|
|
|
|
ProductInjection proInject = new ProductInjection();
|
|
|
|
proInject.PID = Guid.NewGuid().ToString();
|
|
proInject.IPID = inRecorder.PID;
|
|
proInject.MPPID = mainObj.PID;
|
|
proInject.MATERIALNAME = inRecorder.MATERIALNAME;
|
|
proInject.MATERIALCODE = inRecorder.MATERIALCODE;
|
|
proInject.MATERIALTYPE = inRecorder.MATERIALTYPE;
|
|
proInject.MATERIALBATCH = inRecorder.MATERIALBATCH;
|
|
proInject.MATERIALCODE = inRecorder.MATERIALCODE;
|
|
proInject.INJECTIONINDEX = inRecorder.INJECTIONINDEX;
|
|
proInject.INJECTIONTERMINAL = inRecorder.INJECTIONTERMINAL;
|
|
proInject.USEDWEIGHT = 0;
|
|
proInject.CREATEDATE = System.DateTime.Now;
|
|
proInject.CREATEUSER = inRecorder.CREATEUSER;
|
|
proInject.UPDATEUSER = inRecorder.UPDATEUSER;
|
|
|
|
addInjectItemList.Add(proInject);
|
|
|
|
#endregion
|
|
}
|
|
|
|
}
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-3:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 加工结果
|
|
|
|
//目前只对冷刀弱化判断最后的加工结果
|
|
string productState = EnumGeter.PRODUCTSTAUTS.QUALIFIED.GetHashCode().ToString();
|
|
if (mainOpe.PROCESSTYPE == EnumGeter.ProcessType.lengdaoruohua.GetHashCode().ToString())
|
|
{
|
|
List<ParameterConfig> resultList = parConfigList.Where(o => o.COLUMNCODE.ToUpper() == "RESULT")
|
|
.ToList<ParameterConfig>();
|
|
|
|
if (resultList.Count == 0)
|
|
{
|
|
productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
}
|
|
else
|
|
{
|
|
ParameterConfig resultPC = resultList.First();
|
|
|
|
//2016-5-31闫永刚 由于冷刀设备有时候取不到加工结果,同时切割成功,所以暂时将得到NOK的值设置加工失败
|
|
//当没有获取到加工结果时,不确定是否切割成功
|
|
//if (resultPC.PARAVALUE == null )
|
|
//{
|
|
// productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
//}
|
|
|
|
if (resultPC.PARAVALUE != null && resultPC.PARAVALUE.ToString().Trim() == "NOK")
|
|
{
|
|
productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-4:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
|
|
#endregion
|
|
|
|
#region 获取一下道工序
|
|
|
|
//获取当前工序设置信息
|
|
ProcessSetBLL processSetBLL = new ProcessSetBLL();
|
|
//该产品的下一道工序信息
|
|
ProcessSet nextSet = processSetBLL.GetNextProcess(new ProcessSet()
|
|
{
|
|
PRODUCTTYPE = mainOpe.PRODUCTTYPE,
|
|
PRODUCELINE = mainOpe.PRODUCELINE,
|
|
PROCESSTYPE = mainOpe.PROCESSTYPE
|
|
});
|
|
|
|
#endregion
|
|
|
|
#region 本体或是产品信息
|
|
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
#region 工序设置
|
|
|
|
if (nextSet != null && string.IsNullOrEmpty(nextSet.PID) == false)
|
|
{
|
|
mainObj.CURRENTPROCESS = nextSet.PROCESSTYPE;
|
|
}
|
|
else
|
|
{
|
|
//没有下一道工序,修改加工完成标记和加工完成时间
|
|
mainObj.COMPLETEFLAG = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
|
mainObj.PROCESSSTATE = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
|
mainObj.COMPLETETIME = System.DateTime.Now;
|
|
}
|
|
|
|
#endregion
|
|
mainObj.PROCESSSTATE = EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString();
|
|
mainObj.STATUS = productState;
|
|
|
|
}
|
|
else
|
|
{
|
|
product.CURRENTPROCESS = nextSet.PROCESSTYPE;
|
|
product.STATUS = productState;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 修改加工记录
|
|
|
|
mainOpe.OPERATESTATE = EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString();
|
|
mainOpe.OPERATEDDATE = System.DateTime.Now;
|
|
|
|
#endregion
|
|
|
|
#region 数据库操作
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.OpenTs();
|
|
|
|
modal.BaseSession = session;
|
|
productDal.BaseSession = session;
|
|
mainDal.BaseSession = session;
|
|
|
|
try
|
|
{
|
|
|
|
//更新加工工序对象
|
|
modal.Update(mainOpe);
|
|
|
|
#region 更新设备模架的加工状态为空闲
|
|
|
|
//2016-6-27 闫永刚
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-8:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
|
|
MainMolderStatusDAL mmdal = new MainMolderStatusDAL();
|
|
mmdal.BaseSession = session;
|
|
mmdal.Update(new MainMolderStatus() { MACHINECODDE = mainOpe.MACHINECODDE, OPERATIONFLAG = Convert.ToInt32(EnumGeter.OPERATIONFLAG.FREE.GetHashCode().ToString()), MOLDNUMBER = mainOpe.MOLDNUMBER, BARCODE = "" });
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-8:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
|
|
#endregion
|
|
|
|
#region 更新本体或是零件信息
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-9:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
//更新本体信息
|
|
|
|
mainDal.Update(mainObj);
|
|
}
|
|
else
|
|
{
|
|
//更新零件信息
|
|
|
|
productDal.Update(product);
|
|
}
|
|
|
|
LogManager.LogHelper.Info(new LogInfo() { Info = machine.MACHINECODDE + "Test-9:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
|
|
|
|
#endregion
|
|
|
|
#region 浇注投料信息
|
|
|
|
if (machine.PROCESSTYPE == EnumGeter.ProcessType.jiaozhu.GetHashCode().ToString())
|
|
{
|
|
CastCounterDAL castdal = new CastCounterDAL();
|
|
castdal.BaseSession = session;
|
|
castdal.UpdateCounter();
|
|
}
|
|
|
|
|
|
if (addInjectItemList.Count > 0)
|
|
{
|
|
ProductInjectionDAL proInDal = new ProductInjectionDAL();
|
|
proInDal.BaseSession = session;
|
|
|
|
foreach (var p in addInjectItemList)
|
|
{
|
|
proInDal.Insert(p);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
ParameterDeal deal = new ParameterDeal();
|
|
|
|
deal.InsertParameter(parConfigList, mainOpe, session);
|
|
|
|
session.CommitTs();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
session.RollbackTs();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
public MainOperation ProcessPLC(MachineInfo machine,string MOULDCODE, List<ParameterConfig> parConfigList)
|
|
{
|
|
//最后要返回加工参数对象
|
|
MainOperation mo = new MainOperation();
|
|
|
|
ProductDAL productDal = new ProductDAL();
|
|
ProcessRecordDAL processRecordDal = new ProcessRecordDAL();
|
|
WorkCellDAL workcelldal = new WorkCellDAL();
|
|
WorkLocDAL workLocDal = new WorkLocDAL();
|
|
|
|
#region 获取工位信息
|
|
|
|
WorkLoc workloc = new WorkLoc();
|
|
List<WorkLoc> worklocList = workLocDal.GetList(new WorkLoc() { WORKLOC_CODE = machine.WORKLOC_CODE });
|
|
if (worklocList.Count > 0)
|
|
{
|
|
workloc = worklocList[0];
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获取工序信息
|
|
|
|
WorkCell workcell = workcelldal.GetWorkCellByCode(workloc.WORKCELL_CODE);
|
|
|
|
#endregion
|
|
|
|
#region 获取加工记录
|
|
|
|
WorkCellRunStateDAL wrundal = new WorkCellRunStateDAL();
|
|
string recordID=wrundal.GetWorkingRecordID(machine.WORKLOC_CODE, MOULDCODE);
|
|
|
|
if (string.IsNullOrEmpty(recordID))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
//20180624,闫永刚获取该工位最近加工的记录
|
|
//获取加工中的记录
|
|
//List<ProcessRecord> recordList = processRecordDal.GetList(
|
|
// new ProcessRecord()
|
|
// {
|
|
// WORKLOC_CODE = machine.WORKLOC_CODE,
|
|
// WORKCELL_CODE = workcell.WORKCELL_CODE,
|
|
// MODULE_CODE=MOULDCODE,
|
|
// IN_WORKCELL_TIME = System.DateTime.Now.AddHours(-2)
|
|
// }).OrderByDescending(o => o.IN_WORKCELL_TIME).ToList<ProcessRecord>();
|
|
|
|
//if (recordList.Count == 0)
|
|
//{
|
|
// return null;
|
|
//}
|
|
|
|
ProcessRecord record = processRecordDal.GetByPID(recordID); //recordList[0];
|
|
|
|
#endregion
|
|
|
|
#region 获取产品信息
|
|
|
|
Product product = new Product();
|
|
//获取产品对象
|
|
product = productDal.Get(new Product() { PID = record.PRODUCT_PID });
|
|
|
|
#endregion
|
|
|
|
#region 加工记录
|
|
|
|
mo.PID = record.PID;
|
|
mo.PDID = record.PRODUCT_PID;
|
|
mo.PRODUCTCODE = product.PRODUCTCODE;
|
|
mo.MACHINECODDE = machine.MACHINECODDE;
|
|
mo.MACHINENAME = machine.MACHINENAME;
|
|
mo.MOLDNUMBER = record.MODULE_CODE;
|
|
#endregion
|
|
|
|
try
|
|
{
|
|
/*
|
|
using (MutexLock stockLock = new MutexLock(machine.WORKLOC_CODE + ":Complete"))
|
|
{
|
|
#region 加工结果
|
|
|
|
//目前只对冷刀弱化判断最后的加工结果
|
|
string productState = EnumGeter.PRODUCTSTAUTS.QUALIFIED.GetHashCode().ToString();
|
|
if (machine.WORKLOC_CODE == EnumGeter.ProcessType.lengdaoruohua.GetHashCode().ToString())
|
|
{
|
|
List<ParameterConfig> resultList = parConfigList.Where(o => o.COLUMNCODE.ToUpper() == "RESULT")
|
|
.ToList<ParameterConfig>();
|
|
|
|
if (resultList.Count == 0)
|
|
{
|
|
productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
}
|
|
else
|
|
{
|
|
ParameterConfig resultPC = resultList.First();
|
|
|
|
if (resultPC.PARAVALUE != null && resultPC.PARAVALUE.ToString().Trim() == "NOK")
|
|
{
|
|
productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
}
|
|
}
|
|
//加工合格
|
|
record.PROCESS_STATE = "3";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 对加工记录的处理
|
|
|
|
record.PROCESS_STATE = "1";
|
|
|
|
#endregion
|
|
|
|
#region 提交数据库
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.OpenTs();
|
|
processRecordDal.BaseSession = session;
|
|
processRecordDal.Update(record);
|
|
session.CommitTs();
|
|
|
|
}
|
|
|
|
#endregion
|
|
}*/
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
return mo;
|
|
}
|
|
|
|
|
|
public void Interrupt(MachineInfo machine, List<ParameterConfig> parConfigList)
|
|
{
|
|
MainDAL mainDal = new MainDAL();
|
|
ProductDAL productDal = new ProductDAL();
|
|
|
|
try
|
|
{
|
|
#region 获取加工记录
|
|
|
|
List<MainOperation> listOperate = new List<MainOperation>();
|
|
MainOperationDAL modal = new MainOperationDAL();
|
|
|
|
var moldNumber = "1";
|
|
|
|
MainOperation condition = new MainOperation()
|
|
{
|
|
OPERATESTATE = EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString(),
|
|
PROCESSTYPE = machine.PROCESSTYPE,
|
|
MACHINECODDE = machine.MACHINECODDE,
|
|
MOLDNUMBER = moldNumber,
|
|
PRODUCELINE = machine.PRODUCELINE
|
|
};
|
|
|
|
|
|
//获取正在加工中的加工记录
|
|
List<MainOperation> mainOperatingList = modal.GetList(condition)
|
|
.OrderByDescending(o => o.CREATEDATE).ToList<MainOperation>();
|
|
|
|
|
|
#endregion
|
|
|
|
//加工操作
|
|
if (mainOperatingList.Count > 0)
|
|
{
|
|
List<ProductInjection> addInjectItemList = new List<ProductInjection>();
|
|
|
|
//获取加工工序记录
|
|
MainOperation mainOpe = mainOperatingList[0];
|
|
|
|
#region 处理本体或是产品对象
|
|
|
|
//初始化本体对象
|
|
|
|
Main mainObj = new Main();
|
|
|
|
//初始化零件对象
|
|
|
|
Product product = new Product();
|
|
|
|
//判断加工工序产品的产品类别,获取对应的对象
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
//获取本体对象
|
|
mainObj = mainDal.Get(new Main() { PID = mainOpe.PDID });
|
|
}
|
|
else
|
|
{
|
|
//获取产品对象
|
|
product = productDal.Get(new Product() { PID = mainOpe.PDID });
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 加工结果
|
|
|
|
//目前只对冷刀弱化判断最后的加工结果
|
|
string productState = EnumGeter.PRODUCTSTAUTS.CANCEL.GetHashCode().ToString();
|
|
|
|
#endregion
|
|
|
|
#region 本体或是产品信息
|
|
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
//没有下一道工序,修改加工完成标记和加工完成时间
|
|
//mainObj.COMPLETEFLAG = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
|
mainObj.PROCESSSTATE = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
|
mainObj.COMPLETETIME = System.DateTime.Now;
|
|
mainObj.STATUS = productState;
|
|
|
|
}
|
|
else
|
|
{
|
|
product.STATUS = productState;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 修改加工记录
|
|
|
|
mainOpe.OPERATESTATE = EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString();
|
|
mainOpe.OPERATEDDATE = System.DateTime.Now;
|
|
|
|
#endregion
|
|
|
|
#region 数据库操作
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
session.OpenTs();
|
|
|
|
modal.BaseSession = session;
|
|
productDal.BaseSession = session;
|
|
mainDal.BaseSession = session;
|
|
|
|
try
|
|
{
|
|
//更新加工工序对象
|
|
modal.Update(mainOpe);
|
|
|
|
#region 更新本体或是零件信息
|
|
|
|
if (mainOpe.PRODUCTTYPE == EnumGeter.ProductType.benti.GetHashCode().ToString())
|
|
{
|
|
//更新本体信息
|
|
|
|
mainDal.Update(mainObj);
|
|
}
|
|
else
|
|
{
|
|
//更新零件信息
|
|
|
|
productDal.Update(product);
|
|
}
|
|
#endregion
|
|
|
|
ParameterDeal deal = new ParameterDeal();
|
|
deal.InsertParameter(parConfigList, mainOpe, session);
|
|
|
|
session.CommitTs();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
session.RollbackTs();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 浇注转台
|
|
/// </summary>
|
|
/// <param name="machine"></param>
|
|
/// <param name="parConfigList"></param>
|
|
public void CastProcess(MachineInfo machine, List<ParameterConfig> parConfigList)
|
|
{
|
|
List<MainOperation> listOperate = new List<MainOperation>();
|
|
MainOperationDAL modal = new MainOperationDAL();
|
|
|
|
MainOperation condition = new MainOperation()
|
|
{
|
|
OPERATESTATE = EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString(),
|
|
PROCESSTYPE = machine.PROCESSTYPE,
|
|
MACHINECODDE = machine.MACHINECODDE,
|
|
MOLDNUMBER = parConfigList.First(o => o.COLUMNCODE.Contains("MCNO")).PARAVALUE.ToString(),
|
|
PRODUCELINE = machine.PRODUCELINE
|
|
};
|
|
|
|
ProductDAL productDal = new ProductDAL();
|
|
|
|
//获取正在加工中的加工记录
|
|
List<MainOperation> mainOperatingList = modal.GetList(condition)
|
|
.OrderByDescending(o => o.CREATEDATE).ToList<MainOperation>();
|
|
|
|
|
|
#region 获取产品加工记录
|
|
//获取表皮信息
|
|
MainOperation slushMainOpe = mainOperatingList.First(o => o.PRODUCTTYPE == EnumGeter.ProductType.biaopi.GetHashCode().ToString());
|
|
|
|
//获取骨架信息
|
|
MainOperation frameMainOpe = mainOperatingList.First(o => o.PRODUCTTYPE == EnumGeter.ProductType.gujia.GetHashCode().ToString());
|
|
|
|
#endregion
|
|
|
|
#region 获取产品信息
|
|
|
|
//获取表皮
|
|
Product slushProduct = productDal.Get(new Product() { PID = slushMainOpe.PDID });
|
|
|
|
//获取骨架
|
|
Product frameProduct = productDal.Get(new Product() { PID = frameMainOpe.PDID });
|
|
|
|
#endregion
|
|
|
|
#region 获取本体信息
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
InjectionRecorderDAL injectDal = new InjectionRecorderDAL();
|
|
|
|
List<InjectionRecorder> list = injectDal.GetLastRecorder(new InjectionRecorder()
|
|
{
|
|
MACHINECODDE = machine.MACHINECODDE,
|
|
});
|
|
|
|
if (list.Count > 0)
|
|
{
|
|
|
|
InjectionRecorder inRecorder = list[0];
|
|
#region 零件投料关联记录
|
|
|
|
ProductInjection proInject = new ProductInjection();
|
|
|
|
proInject.PID = Guid.NewGuid().ToString();
|
|
proInject.IPID = inRecorder.PID;
|
|
//proInject.MPPID = mainObj.PID;
|
|
proInject.MATERIALNAME = inRecorder.MATERIALNAME;
|
|
proInject.MATERIALCODE = inRecorder.MATERIALCODE;
|
|
proInject.MATERIALTYPE = inRecorder.MATERIALTYPE;
|
|
proInject.MATERIALBATCH = inRecorder.MATERIALBATCH;
|
|
proInject.MATERIALCODE = inRecorder.MATERIALCODE;
|
|
proInject.INJECTIONINDEX = inRecorder.INJECTIONINDEX;
|
|
proInject.INJECTIONTERMINAL = inRecorder.INJECTIONTERMINAL;
|
|
proInject.USEDWEIGHT = 0;
|
|
proInject.CREATEDATE = System.DateTime.Now;
|
|
proInject.CREATEUSER = inRecorder.CREATEUSER;
|
|
proInject.UPDATEUSER = inRecorder.UPDATEUSER;
|
|
|
|
//addInjectItemList.Add(proInject);
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
|