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.
157 lines
4.8 KiB
157 lines
4.8 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.FJC.Entity.Operation;
|
||
|
using QMAPP.FJC.Entity.ProcessParameter;
|
||
|
using QMAPP.FJC.DAL.Operation;
|
||
|
using QMAPP.FJC.Entity;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMAPP.FJC.DAL;
|
||
|
using QMAPP.FJC.DAL.Basic;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.BLL.Basic;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.Process
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 总成装配操作处理类
|
||
|
/// 作者:闫永刚
|
||
|
/// 日期:2015-05-28
|
||
|
/// </summary>
|
||
|
public class AssembleProcess
|
||
|
{
|
||
|
|
||
|
public void Process(AssembleParameter entity)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
#region 获取加工记录
|
||
|
|
||
|
List<MainOperation> listOperate = new List<MainOperation>();
|
||
|
MainOperationDAL modal = new MainOperationDAL();
|
||
|
MainOperation condition = new MainOperation()
|
||
|
{
|
||
|
OPERATESTATE = EnumGeter.OPERATESTATE.OPERATING.GetHashCode().ToString(),
|
||
|
PROCESSTYPE = EnumGeter.ProcessType.zongchengzhuangpei.GetHashCode().ToString(),
|
||
|
MACHINECODDE = entity.MACHINECODDE
|
||
|
};
|
||
|
|
||
|
if (string.IsNullOrEmpty(entity.PRODUCTCODE) == false)
|
||
|
{
|
||
|
condition.PRODUCTCODE = entity.PRODUCTCODE;
|
||
|
}
|
||
|
|
||
|
//获取正在进行总成装配的产品信息
|
||
|
listOperate = modal.GetList(condition);
|
||
|
//按照升序排列
|
||
|
listOperate = listOperate.OrderBy(o => o.CREATEDATE).ToList<MainOperation>();
|
||
|
MainOperation operate = listOperate[0];
|
||
|
|
||
|
operate.OPERATESTATE = EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString();
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取下一个工序
|
||
|
|
||
|
ProcessSetBLL processSetBLL = new ProcessSetBLL();
|
||
|
ProcessSet nextSet = processSetBLL.GetNextProcess(new ProcessSet()
|
||
|
{
|
||
|
PRODUCTTYPE = EnumGeter.ProductType.benti.GetHashCode().ToString(),
|
||
|
PROCESSTYPE = EnumGeter.ProcessType.zongchengzhuangpei.GetHashCode().ToString()
|
||
|
|
||
|
});
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取本体信息
|
||
|
|
||
|
//获取本体信息
|
||
|
MainDAL maindal = new MainDAL();
|
||
|
Main mainOjb = maindal.Get(new Main() { PID = operate.PDID });
|
||
|
//本体当前
|
||
|
|
||
|
mainOjb.PROCESSSTATE = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
||
|
|
||
|
//存在下一道工序的情况下
|
||
|
if (string.IsNullOrEmpty(nextSet.PID) == false)
|
||
|
{
|
||
|
//修改当前工序类别
|
||
|
mainOjb.PROCESSTYPE = nextSet.PROCESSTYPE;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//没有下一道工序,修改加工完成标记和加工完成时间
|
||
|
mainOjb.COMPLETEFLAG = EnumGeter.COMPLETEFLAG.COMPLETED.GetHashCode().ToString();
|
||
|
mainOjb.COMPLETETIME = System.DateTime.Now;
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 总成装配加工参数
|
||
|
|
||
|
entity.PID = Guid.NewGuid().ToString();
|
||
|
entity.PDID = mainOjb.PID;
|
||
|
entity.PRODUCTCODE = mainOjb.MAINCODE;
|
||
|
entity.MOID = operate.PID;
|
||
|
entity.CREATEDATE = System.DateTime.Now;
|
||
|
entity.PRODUCTTYPE = EnumGeter.ProductType.benti.GetHashCode().ToString();
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 数据库操作
|
||
|
|
||
|
//AssembleParameterDAL apdal = new AssembleParameterDAL();
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
session.OpenTs();
|
||
|
|
||
|
//apdal.BaseSession = session;
|
||
|
maindal.BaseSession = session;
|
||
|
modal.BaseSession = session;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
#region 更新本体信息
|
||
|
|
||
|
maindal.Update(mainOjb);
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 修改加工工序
|
||
|
|
||
|
modal.Update(operate);
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 插入总成装配加工参数
|
||
|
|
||
|
//apdal.Insert(entity);
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
session.CommitTs();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
session.RollbackTs();
|
||
|
throw;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|