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.
594 lines
31 KiB
594 lines
31 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using QMAPP.BLL;
|
||
|
using QMAPP.Entity;
|
||
|
using QMAPP.FJC.BLL.FIS;
|
||
|
using QMAPP.FJC.DAL.Basic;
|
||
|
using QMAPP.FJC.DAL.FIS;
|
||
|
using QMAPP.FJC.DAL.MesB9;
|
||
|
using QMAPP.FJC.DAL.ProductionPlan;
|
||
|
using QMAPP.FJC.DAL.QdFis;
|
||
|
using QMAPP.FJC.Entity.Basic;
|
||
|
using QMAPP.FJC.Entity.FileCopy.FIS;
|
||
|
using QMAPP.FJC.Entity.FIS;
|
||
|
using QMAPP.FJC.Entity.MesB9;
|
||
|
using QMAPP.FJC.Entity.QdFis;
|
||
|
using QMAPP.MD.BLL;
|
||
|
using QMAPP.MD.Entity;
|
||
|
using QMFrameWork.Data;
|
||
|
using QMFrameWork.Log;
|
||
|
using Resource = QMAPP.FJC.Entity.Resource;
|
||
|
|
||
|
namespace QMAPP.FJC.BLL.QdFis
|
||
|
{
|
||
|
public class mbM100BLL : BaseBLL
|
||
|
{
|
||
|
List<Material> materialList = null;
|
||
|
|
||
|
/// <summary>
|
||
|
/// 传入没有空格".-"的Code返回正确格式的零件号
|
||
|
/// </summary>
|
||
|
/// <param name="materialCode"></param>
|
||
|
/// <returns></returns>
|
||
|
//private string getMaterialCode(string materialCode)
|
||
|
//{
|
||
|
// //查询零件号和名称
|
||
|
// if (materialList == null)
|
||
|
// {
|
||
|
// materialList = new MaterialBLL().GetAllList(new Material());
|
||
|
// }
|
||
|
// foreach (var material in materialList)
|
||
|
// {
|
||
|
// var mCode = material.MATERIAL_CODE;
|
||
|
// mCode = mCode.Replace("-", "");
|
||
|
// mCode = mCode.Replace(".", "");
|
||
|
// mCode = mCode.Replace(" ", "");
|
||
|
// if (mCode == materialCode)
|
||
|
// {
|
||
|
// return material.MATERIAL_CODE;
|
||
|
// }
|
||
|
// }
|
||
|
// return "";
|
||
|
//}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 根据模块物料号和选装包物料号从BOM中查询总成物料号
|
||
|
/// </summary>
|
||
|
/// <param name="DModul">门板模块物料号</param>
|
||
|
/// <param name="SlaveModuls">选装包物料号</param>
|
||
|
/// <returns></returns>
|
||
|
//private string GetMaterialFromBOM(string DModul, string SlaveModuls,string CarModel)
|
||
|
//{
|
||
|
// DAL.QT.MaterialBindingDAL mbdal = new DAL.QT.MaterialBindingDAL();
|
||
|
// var bind= mbdal.GetBindingTarget(CarModel, DModul);
|
||
|
// if (bind != null)
|
||
|
// {
|
||
|
// DModul = bind.TARGET_CODE;
|
||
|
// }
|
||
|
|
||
|
// MD.DAL.PbomDAL bomdal = new MD.DAL.PbomDAL();
|
||
|
|
||
|
// Pbom pbom = null;
|
||
|
// if (!string.IsNullOrWhiteSpace(SlaveModuls))
|
||
|
// {
|
||
|
// pbom = bomdal.GetBomWithMaterials(DModul, SlaveModuls);
|
||
|
// }
|
||
|
// else
|
||
|
// {
|
||
|
// pbom = bomdal.GetBomWithMaterials(DModul);
|
||
|
// }
|
||
|
// if (pbom != null)
|
||
|
// {
|
||
|
// return pbom.MATERIAL_CODE;
|
||
|
// }
|
||
|
// return "";
|
||
|
//}
|
||
|
|
||
|
//查询零件号名称
|
||
|
private string getMaterialName(string materialCode)
|
||
|
{
|
||
|
//查询零件号和名称
|
||
|
//var materialList = new MaterialBLL().GetAllList(new Material
|
||
|
//{
|
||
|
// MATERIAL_CODE = materialCode
|
||
|
//});
|
||
|
//return materialList.Count <= 0 ? "" : materialList[0].MATERIAL_NAME;
|
||
|
if (materialList == null)
|
||
|
{
|
||
|
materialList = new MaterialBLL().GetAllList(new Material());
|
||
|
}
|
||
|
var mt = materialList.FirstOrDefault(p => p.MATERIAL_CODE == materialCode);
|
||
|
return mt == null ? "" : mt.MATERIAL_NAME;
|
||
|
}
|
||
|
//查询工作中心
|
||
|
private string getWorkcenterCode(string materialCode)
|
||
|
{
|
||
|
var initList =
|
||
|
new MaterialCodeInitDAL().GetList(new MaterialCodeInit
|
||
|
{
|
||
|
MATERIAL_CODE = materialCode
|
||
|
});
|
||
|
return initList.Count <= 0 ? "" : initList[0].WORKCENTER_CODE;
|
||
|
}
|
||
|
|
||
|
//执行task程序
|
||
|
//暂时不生成订单--周晓东20180226
|
||
|
public void SelectQdFisInsertPPtable()
|
||
|
{
|
||
|
var sessionMB = AppDataFactory.CreateSession("maindbMB");
|
||
|
string IsPlan = System.Configuration.ConfigurationManager.AppSettings["IsPlan"];
|
||
|
var mbM100Dal = new mbM100DAL { BaseSession = sessionMB };
|
||
|
//获取QdFisMB数据库T_FISORDER_M100表数据
|
||
|
var mbList100 = mbM100Dal.GetList100();
|
||
|
///获取QdFisMB数据库T_FISORDER_M110表数据
|
||
|
var mbList110 = mbM100Dal.GetList110();
|
||
|
|
||
|
#region m100
|
||
|
|
||
|
if (mbList100 != null && mbList100.Count>0)
|
||
|
{
|
||
|
foreach (var item in mbList100)
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var orderPlanBll = new OrderPlanBLL();
|
||
|
var fisOrderDAL = new FISOrderDAL { BaseSession = session };
|
||
|
var fisOrderSendDetialDAL = new FISOrederSendDetialDAL { BaseSession = session };
|
||
|
var orderPlanDAL = new OrderPlanDAL { BaseSession = session };
|
||
|
var workOrderDAL = new WorkOrderDAL { BaseSession = session };
|
||
|
|
||
|
//var ds = item.m100dtm + "00";
|
||
|
FISOrder fisOrder = new FISOrder
|
||
|
{
|
||
|
VWSEQ = item.SEQ,
|
||
|
KIN = item.KIN,
|
||
|
VIN = item.VIN,
|
||
|
M100_ONLINEDATE = item.ScanDtm,
|
||
|
M110_ONLINEDATE = item.ScanDtm,
|
||
|
LINENO= "BORADPASSY",
|
||
|
CREATETIME = DateTime.Now,
|
||
|
SCANSTATE = "0",
|
||
|
FLAGDEL="0"
|
||
|
};
|
||
|
OrderPlan orderPlan = new OrderPlan
|
||
|
{
|
||
|
//PLAN_NO = fisOrder.ORDER_NO,
|
||
|
PLAN_SEQ = fisOrder.VWSEQ,
|
||
|
PLAN_STATE = "0",
|
||
|
QTY = 1,
|
||
|
COMPLETE_QTY = 0,
|
||
|
PLAN_DATE = fisOrder.M100_ONLINEDATE,
|
||
|
PLANSOURCE = "0",
|
||
|
PRODUCEREQUIRE = "1"
|
||
|
};
|
||
|
|
||
|
//分配选装包物料号
|
||
|
//string FLOptional = "", FROptional = "", RLOptional = "", RROptional = "";
|
||
|
//if ((!string.IsNullOrEmpty(item.Modules)) && item.Modules.Split('+').Length == 2)
|
||
|
//{
|
||
|
// FLOptional = getMaterialCode(item.Modules.Split('+')[0]);
|
||
|
// FROptional = getMaterialCode(item.Modules.Split('+')[1]);
|
||
|
// RLOptional = getMaterialCode(item.Modules.Split('+')[0]);
|
||
|
// RROptional = getMaterialCode(item.Modules.Split('+')[1]);
|
||
|
//}
|
||
|
//int i = 0;
|
||
|
//foreach (var model in item.Modules.Split('+'))
|
||
|
//{
|
||
|
// switch (i)
|
||
|
// {
|
||
|
// case 0:
|
||
|
// {
|
||
|
// FLOptional = getMaterialCode(model);
|
||
|
// break;
|
||
|
// }
|
||
|
// case 1:
|
||
|
// {
|
||
|
// FROptional = getMaterialCode(model);
|
||
|
// break;
|
||
|
// }
|
||
|
// case 2:
|
||
|
// {
|
||
|
// RLOptional = getMaterialCode(model);
|
||
|
// break;
|
||
|
// }
|
||
|
// case 3:
|
||
|
// {
|
||
|
// RROptional = getMaterialCode(model);
|
||
|
// break;
|
||
|
// }
|
||
|
// }
|
||
|
// i++;
|
||
|
//}
|
||
|
|
||
|
var maped= mbM100Dal.MapMES(item.CarModel, item.ModulFL, item.ModulFR, item.ModulRL, item.ModulRR, item.Modules);
|
||
|
if (maped == null)
|
||
|
{
|
||
|
maped = new FISMap();
|
||
|
}
|
||
|
|
||
|
// 开始事务
|
||
|
session.OpenTs();
|
||
|
|
||
|
//插入T_PP_FISORDER表(因为Mes_B4表里有4个ProdNo,所以要插入4条记录)
|
||
|
//插入T_PP_ORDERPLAN表,T_PP_WORKORDER表.(因为Mes_B4表里有4个ProdNo,所以要插入4条记录)
|
||
|
//查询是否存在110数据
|
||
|
var fisOrderList = fisOrderDAL.FISOrderIsNull(fisOrder);
|
||
|
if (fisOrderList != null && fisOrderList.Count>0)
|
||
|
{
|
||
|
//更新
|
||
|
|
||
|
#region ModulFL //前 左
|
||
|
//更新之前m110存进来的数据
|
||
|
fisOrderList[0].M100_ONLINEDATE = item.ScanDtm;
|
||
|
fisOrderList[0].PRODNO = maped.DPMaterial_LF;//GetMaterialFromBOM(getMaterialCode(item.ModulFL),FLOptional,item.CarModel);
|
||
|
fisOrderList[0].ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "LF" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrderList[0].CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrderList[0].CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Update(fisOrderList[0]);
|
||
|
|
||
|
//插入FISOrederSendDetial --周晓东20180228
|
||
|
FISOrederSendDetial fisOrderSendDetial0 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrderList[0].PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrderList[0].PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrderList[0].PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial0);
|
||
|
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan=="1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrderList[0].PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrderList[0].ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRL //后 左
|
||
|
//更新之前m110存进来的数据
|
||
|
fisOrderList[1].M100_ONLINEDATE = item.ScanDtm;
|
||
|
fisOrderList[1].PRODNO = maped.DPMaterial_LR;//GetMaterialFromBOM(getMaterialCode(item.ModulRL), RLOptional, item.CarModel);
|
||
|
fisOrderList[1].ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "LR" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrderList[1].CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrderList[1].CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Update(fisOrderList[1]);
|
||
|
//放开下面代码。因为m110不做插入动作了,这里直接插入。
|
||
|
FISOrederSendDetial fisOrderSendDetial1 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrderList[1].PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrderList[1].PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrderList[1].PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial1);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrderList[1].PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrderList[1].ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulFR //前 右
|
||
|
//更新之前m110存进来的数据
|
||
|
fisOrderList[2].PRODNO = maped.DPMaterial_RF;//GetMaterialFromBOM(getMaterialCode(item.ModulFR), FROptional, item.CarModel);
|
||
|
fisOrderList[2].ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "RF" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrderList[2].M100_ONLINEDATE = item.ScanDtm;
|
||
|
fisOrderList[2].CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrderList[2].CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Update(fisOrderList[2]);
|
||
|
|
||
|
//放开下面代码。因为m110不做插入动作了,这里直接插入。
|
||
|
FISOrederSendDetial fisOrderSendDetial2 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrderList[2].PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrderList[2].PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrderList[2].PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial2);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrderList[2].PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrderList[2].ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRR //后 右
|
||
|
//更新之前m110存进来的数据
|
||
|
fisOrderList[3].PRODNO = maped.DPMaterial_RR;//GetMaterialFromBOM(getMaterialCode(item.ModulRR), RROptional, item.CarModel);
|
||
|
fisOrderList[3].ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "RR" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrderList[3].M100_ONLINEDATE = item.ScanDtm;
|
||
|
fisOrderList[3].CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrderList[3].CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Update(fisOrderList[3]);
|
||
|
|
||
|
//放开下面代码。因为m110不做插入动作了,这里直接插入。
|
||
|
FISOrederSendDetial fisOrderSendDetial3 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrderList[3].PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrderList[3].PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrderList[3].PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial3);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrderList[3].PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrderList[3].ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//新增
|
||
|
|
||
|
#region ModulFL //前 左
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
fisOrder.PRODNO = maped.DPMaterial_LF;//GetMaterialFromBOM(getMaterialCode(item.ModulFL), FLOptional, item.CarModel);
|
||
|
fisOrder.ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "LF" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrder.CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrder.CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Insert(fisOrder);
|
||
|
//插入FISOrederSendDetial --周晓东20180228
|
||
|
FISOrederSendDetial fisOrderSendDetial0 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrder.PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrder.PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrder.PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial0);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrder.PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrder.ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRL //后 左
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
fisOrder.PRODNO = maped.DPMaterial_LR;//GetMaterialFromBOM(getMaterialCode(item.ModulRL), RLOptional, item.CarModel);
|
||
|
fisOrder.ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "LR" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrder.CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrder.CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Insert(fisOrder);
|
||
|
//插入FISOrederSendDetial --周晓东20180228
|
||
|
FISOrederSendDetial fisOrderSendDetial1 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrder.PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrder.PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrder.PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial1);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrder.PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrder.ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulFR //前 右
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
fisOrder.PRODNO = maped.DPMaterial_RF;//GetMaterialFromBOM(getMaterialCode(item.ModulFR), FROptional, item.CarModel);
|
||
|
fisOrder.ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "RF" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrder.CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrder.CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Insert(fisOrder);
|
||
|
//插入FISOrederSendDetial --周晓东20180228
|
||
|
FISOrederSendDetial fisOrderSendDetial2 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrder.PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrder.PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrder.PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial2);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrder.PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrder.ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRR //后 右
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
fisOrder.PRODNO = maped.DPMaterial_RR;//GetMaterialFromBOM(getMaterialCode(item.ModulRR), RROptional, item.CarModel);
|
||
|
fisOrder.ORDER_NO = "DPFIS" + item.ScanDtm.ToString("yyyyMMdd") + "RR" + item.SEQ.Substring(item.SEQ.Length - 4);
|
||
|
fisOrder.CARSETDESC_CN = getMaterialName(fisOrder.PRODNO);
|
||
|
fisOrder.CP5A = fisOrder.M100_ONLINEDATE.ToString("yyyyMMddHHmm");
|
||
|
session.Insert(fisOrder);
|
||
|
//插入FISOrederSendDetial --周晓东20180228
|
||
|
FISOrederSendDetial fisOrderSendDetial3 = new FISOrederSendDetial
|
||
|
{
|
||
|
PID = Guid.NewGuid().ToString(),
|
||
|
FIS_PID = fisOrder.PID,
|
||
|
STATE = "0",
|
||
|
MATERIAL_CODE = fisOrder.PRODNO,
|
||
|
MATERIAL_NAME = getMaterialName(fisOrder.PRODNO),
|
||
|
WORKCENTER_CODE = getWorkcenterCode(fisOrder.PRODNO)
|
||
|
};
|
||
|
session.Insert(fisOrderSendDetial3);
|
||
|
//读取配置文件,等于1的时候执行计划代码,等于0时不执行。20180408 周晓东
|
||
|
if (IsPlan == "1")
|
||
|
{
|
||
|
orderPlan.PID = Guid.NewGuid().ToString();
|
||
|
orderPlan.MATERIAL_CODE = fisOrder.PRODNO;
|
||
|
orderPlan.PLAN_NO = fisOrder.ORDER_NO;
|
||
|
orderPlanBll.InsertOrderPlanAndWorkOrder(orderPlan, session);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
|
||
|
//插入本地数据库T_FISORDER_M100表
|
||
|
session.Insert(item);
|
||
|
|
||
|
// 事务提交
|
||
|
session.CommitTs();
|
||
|
|
||
|
//更新QdFisMB数据库T_FISORDER_M100表
|
||
|
mbM100Dal.Update100(item);
|
||
|
|
||
|
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
session.RollbackTs();
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = e,
|
||
|
Tag = e.StackTrace,
|
||
|
Info = "门板FIS同步-M100"
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region m110
|
||
|
|
||
|
if (mbList110 != null && mbList110.Count > 0)
|
||
|
{
|
||
|
foreach (var item in mbList110)
|
||
|
{
|
||
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
var fisOrderDAL = new FISOrderDAL { BaseSession = session };
|
||
|
|
||
|
FISOrder fisOrder = new FISOrder
|
||
|
{
|
||
|
VWSEQ = item.SEQ,
|
||
|
KIN = item.KIN,
|
||
|
VIN = item.VIN,
|
||
|
M100_ONLINEDATE = item.ScanDtm,
|
||
|
M110_ONLINEDATE = item.ScanDtm,
|
||
|
LINENO = "BORADPASSY",
|
||
|
CREATETIME = DateTime.Now,
|
||
|
SCANSTATE = "0",
|
||
|
FLAGDEL="0"
|
||
|
};
|
||
|
|
||
|
// 开始事务
|
||
|
session.OpenTs();
|
||
|
|
||
|
//插入T_PP_FISORDER表(因为Mes_B4表里有4个ProdNo,所以要插入4条记录)
|
||
|
//插入T_PP_ORDERPLAN表,T_PP_WORKORDER表.(因为Mes_B4表里有4个ProdNo,所以要插入4条记录)
|
||
|
var fisOrderList = fisOrderDAL.FISOrderIsNull(fisOrder);
|
||
|
if (fisOrderList != null && fisOrderList.Count > 0)
|
||
|
{
|
||
|
//更新4个表的m110
|
||
|
foreach (var fo in fisOrderList)
|
||
|
{
|
||
|
fo.M110_ONLINEDATE = item.ScanDtm;
|
||
|
session.Update(fo);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//新增4条m110记录
|
||
|
//PRODNO字段不允许为空
|
||
|
fisOrder.PRODNO = "M110";
|
||
|
|
||
|
#region ModulFL
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
session.Insert(fisOrder);
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRL
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
session.Insert(fisOrder);
|
||
|
#endregion
|
||
|
|
||
|
#region ModulFR
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
session.Insert(fisOrder);
|
||
|
#endregion
|
||
|
|
||
|
#region ModulRR
|
||
|
fisOrder.PID = Guid.NewGuid().ToString();
|
||
|
session.Insert(fisOrder);
|
||
|
#endregion
|
||
|
}
|
||
|
|
||
|
//插入本地数据库T_FISORDER_M100表
|
||
|
session.Insert(item);
|
||
|
|
||
|
// 事务提交
|
||
|
session.CommitTs();
|
||
|
|
||
|
//更新QdFisMB数据库T_FISORDER_M100表
|
||
|
mbM100Dal.Update110(item);
|
||
|
|
||
|
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
session.RollbackTs();
|
||
|
LogManager.LogHelper.Error(new LogInfo()
|
||
|
{
|
||
|
ErrorInfo = e,
|
||
|
Tag = e.StackTrace,
|
||
|
Info = "门板FIS同步-M110"
|
||
|
});
|
||
|
continue;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|