Browse Source

276PA

master
songnan.zhang 2 years ago
parent
commit
8b286e16d8
  1. 1
      APPQ5/QMAPP.FJC.TRACING/QMAPP.FJC.TRACING.csproj
  2. 679
      APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs
  3. 9
      APPQ5/QMAPP.WinForm/App.config
  4. 4
      APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs
  5. 10
      ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config

1
APPQ5/QMAPP.FJC.TRACING/QMAPP.FJC.TRACING.csproj

@ -113,6 +113,7 @@
<Compile Include="StateActions\ReleaseOrder.cs" /> <Compile Include="StateActions\ReleaseOrder.cs" />
<Compile Include="StateActions\RollbackData.cs" /> <Compile Include="StateActions\RollbackData.cs" />
<Compile Include="StateActions\StatisQTY.cs" /> <Compile Include="StateActions\StatisQTY.cs" />
<Compile Include="StateActions\SubmitData276PA.cs" />
<Compile Include="StateActions\SubmitData.cs" /> <Compile Include="StateActions\SubmitData.cs" />
<Compile Include="StateActions\ResetData.cs" /> <Compile Include="StateActions\ResetData.cs" />
<Compile Include="StateActions\ResetInState.cs" /> <Compile Include="StateActions\ResetInState.cs" />

679
APPQ5/QMAPP.FJC.TRACING/StateActions/SubmitData276PA.cs

@ -0,0 +1,679 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.FJC.DAL.QT;
using QMAPP.FJC.Entity.QT;
using QMAPP.FJC.TRACING.DAInterface;
using QMAPP.FJC.DAL.Produce;
using QMAPP.FJC.DAL.Basic;
using QMAPP.FJC.Entity.Operation;
using QMAPP.FJC.DAL.Operation;
using QMAPP.FJC.Entity.Basic;
using QMAPP.MD.Entity;
using QMAPP.MD.DAL;
using QMAPP.MD.Entity.View;
using WorkCellDAL = QMAPP.MD.DAL.WorkCellDAL;
using QMAPP.FJC.Entity;
using QMAPP.FJC.DAL.Injection;
using QMAPP.FJC.Entity.Injection;
namespace QMAPP.FJC.TRACING.StateActions
{
/// <summary>
/// 提交数据
/// </summary>
public class SubmitData276PA : IStateAction
{
/// <summary>
/// 执行
/// </summary>
/// <param name="data"></param>
public void Execute(DAObject data)
{
//搜索确认产品物料号
SearchMaterial(data);
WorkCellRunStateDAL wcrsdal = new WorkCellRunStateDAL();
var state = wcrsdal.GetNextState(data.WorkLocState.WORKCELL_CODE, data.WorkLocState.CurrentState.STATE_SEQ);
bool workcellend = state == null; //如果当前为工序最终状态
var product = SaveProduct(data, workcellend);
SaveProcessRecord(product, data, workcellend);
//List<DAICache> unsavedDai = new List<DAICache>();
foreach (var dai in data.WorkLocState.DataCache)
{
if (!dai.SAVED.Contains(data.MouldCode)&&!string.IsNullOrWhiteSpace(dai.DA_VALUE)) //过滤已保存过的和采集值为空值的
{
switch (dai.DATA_TYPE)
{
case "SN": //零件序列号
case "BN": //零件批次号
{
SaveProductStructure(product, dai, data);
break;
}
case "MN": //模具编号
{
SaveProcessParam(product, dai, data);
break;
}
case "PARM": //加工参数
{
//SaveProcessParam(product,dai,data);
break;
}
}
dai.SAVED = dai.SAVED + data.MouldCode;
data.AddToPersistentList(dai, dai.PID);
}
if (workcellend && !string.IsNullOrWhiteSpace(dai.MATERIAL_CODE) && !dai.MATERIAL_CODE.Equals(product.MATERIAL_CODE)) //如果采集的物料号于产品物料号一直则不保存产品组成
{
StringBuilder sql = new StringBuilder();
sql.AppendLine("MERGE INTO [T_AW_PRODUCTCOUNT] C ");
sql.AppendLine("USING (SELECT @materialcode AS [MATERIAL_CODE]) V ");
sql.AppendLine("ON (C.MATERIAL_CODE=V.MATERIAL_CODE AND C.[PROTYPE]=1) ");
sql.AppendLine("WHEN MATCHED THEN ");
sql.AppendLine(" UPDATE SET C.[COUNTVALUE]=C.[COUNTVALUE]+1 ");
sql.AppendLine("WHEN NOT MATCHED THEN ");
sql.AppendLine(" INSERT ([PID],[MATERIAL_CODE],[COUNTVALUE],[PROTYPE],[UPDATETIME]) ");
sql.AppendLine(" VALUES (NEWID(),V.[MATERIAL_CODE],1,1,GETDATE());");
data.SQLCommands.Add(new SQLCommand(sql.ToString(), new DataParameter("materialcode", dai.MATERIAL_CODE)));
}
}
//DAICacheDAL dcdal = new DAICacheDAL();
//dcdal.Update(unsavedDai, data.DataSession);
}
///// <summary>
///// 搜索确定加工后的产品物料号及加工消耗的物料号
///// </summary>
///// <param name="data"></param>
///// <returns>返回加工消耗物料</returns>
//private string[] SearchMaterial(DAObject data)
//{
// var materials = (from da in data.WorkLocState.DataCache
// where !string.IsNullOrWhiteSpace(da.MATERIAL_CODE)
// select da.MATERIAL_CODE).ToArray();
// if (materials.Length == 1) //单一物料加工
// {
// data.WorkLocState.CurrentState.MATERIAL_CODE = materials[0];
// var dai = data.WorkLocState.DataCache.FirstOrDefault(p=>p.MATERIAL_CODE==materials[0]);
// data.WorkLocState.CurrentState.PROCESS_CODE = dai.DA_VALUE;
// data.WorkLocState.CurrentState.PRODUCT_PID = dai.OBJ_PID;
// }
// else //多物料组成
// {
// var bomlocation = GetBomLocation(materials.Distinct().ToArray());
// if (bomlocation == null) //未定位到
// {
// materials = (from da in data.WorkLocState.DataCache
// where !string.IsNullOrWhiteSpace(da.MATERIAL_CODE)
// && !string.Equals(da.DA_MODE, "2") //过滤掉可省略的采集点
// select da.MATERIAL_CODE).ToArray();
// bomlocation = GetBomLocation(materials.Distinct().ToArray());
// if (bomlocation == null) //仍未定位到BOM信息 抛出异常
// {
// throw new Exception("采集数据有误,无法确定生产BOM,请检查采集点配置和BOM配置!");
// }
// }
// string upperlevelmaterial = "";
// if (bomlocation.ItemNo > 0) //如果Bom定位为明细项
// {
// PbomDAL pbidal = new PbomDAL();
// var bomitem = pbidal.GetByLocate(bomlocation);
// if (bomitem != null)
// {
// upperlevelmaterial = bomitem.MATERIAL_CODE;
// }
// }
// else //如果Bom定位为Bom头
// {
// var bom = new PbomDAL().GetByCode(bomlocation.BOMCode);
// if (bom != null)
// {
// upperlevelmaterial = bom.MATERIAL_CODE;
// }
// }
// data.WorkLocState.CurrentState.MATERIAL_CODE = upperlevelmaterial; //取得产品物料号
// }
// return materials.Distinct().ToArray();
//}
/// <summary>
/// 搜索确定加工后的产品物料号及加工消耗的物料号
/// </summary>
/// <param name="data"></param>
/// <returns>返回加工消耗物料</returns>
private string[] SearchMaterial(DAObject data)
{
var materials = (from da in data.WorkLocState.DataCache
where !string.IsNullOrWhiteSpace(da.MATERIAL_CODE)
select da.MATERIAL_CODE).ToArray();
BomLocation bomlocation = null;
bomlocation = GetBomLocation(materials.Distinct().ToArray());
if (bomlocation == null) //未定位到
{
materials = (from da in data.WorkLocState.DataCache
where !string.IsNullOrWhiteSpace(da.MATERIAL_CODE)
&& !string.Equals(da.DA_MODE, "2") //过滤掉可省略的采集点
select da.MATERIAL_CODE).ToArray();
bomlocation = GetBomLocation(materials.Distinct().ToArray());
if (bomlocation == null) //仍未定位到BOM信息 抛出异常
{
if (materials.Length == 1) //单一物料加工
{
data.WorkLocState.CurrentState.MATERIAL_CODE = materials[0];
var dai = data.WorkLocState.DataCache.FirstOrDefault(p => p.MATERIAL_CODE == materials[0]);
data.WorkLocState.CurrentState.PROCESS_CODE = dai.DA_VALUE;
data.WorkLocState.CurrentState.PRODUCT_PID = dai.OBJ_PID;
return materials.Distinct().ToArray();
}
else
{
throw new Exception("采集数据有误,无法确定生产BOM,请检查采集点配置和BOM配置!");
}
}
}
PbomDAL pbidal = new PbomDAL();
if (materials.Length == 1) //单一物料加工
{
var oneitem = pbidal.GetBomDetail(new MD.Entity.PbomItem { PBOM_CODE = bomlocation.BOMCode, MATERIAL_CODE = materials[0], GMP = data.WorkLocState.WORKCELL_CODE });
if (oneitem == null)//并且当前工序不是此物料的发料工序
{
data.WorkLocState.CurrentState.MATERIAL_CODE = materials[0];
var dai = data.WorkLocState.DataCache.FirstOrDefault(p => p.MATERIAL_CODE == materials[0]);
data.WorkLocState.CurrentState.PROCESS_CODE = dai.DA_VALUE;
data.WorkLocState.CurrentState.PRODUCT_PID = dai.OBJ_PID;
return materials.Distinct().ToArray();
}
}
string upperlevelmaterial = "";
if (bomlocation.ItemNo > 0) //如果Bom定位为明细项
{
var bomitem = pbidal.GetByLocate(bomlocation);
if (bomitem != null)
{
upperlevelmaterial = bomitem.MATERIAL_CODE;
}
}
else //如果Bom定位为Bom头
{
var bom = pbidal.GetByCode(bomlocation.BOMCode);
if (bom != null)
{
upperlevelmaterial = bom.MATERIAL_CODE;
}
}
data.WorkLocState.CurrentState.MATERIAL_CODE = upperlevelmaterial; //取得产品物料号
return materials.Distinct().ToArray();
}
/// <summary>
/// 保存产品组成信息
/// </summary>
/// <param name="product">产品</param>
/// <param name="dai"></param>
/// <param name="data"></param>
private void SaveProductStructure(Product product, DAICache dai, DAObject data)
{
if (!dai.MATERIAL_CODE.Equals(product.MATERIAL_CODE)) //如果采集的物料号于产品物料号一直则不保存产品组成
{
QMAPP.FJC.DAL.Produce.ProductDAL proddal = new QMAPP.FJC.DAL.Produce.ProductDAL();
Product part = null;
part= data.GetPersistentEntity<Product>(dai.OBJ_PID);
if (part == null)
{
part = data.GetObjectFromCache<Product>(p => p.PID == dai.OBJ_PID);
if (part == null)
{
part = proddal.GetByPID(dai.OBJ_PID);
}
}
data.ObjectCacheList.Add(part);
part.USINGCOUNT = part.USINGCOUNT + 1;
part.USINGSTATE = part.CAPACITY > part.USINGCOUNT ? "1" : "2";
//part.UPDATEDATE = DateTime.Now;
part.UPDATEUSER=data.UserID;
part.WORKLOC_CODE = data.WorkLocState.WORKLOC_CODE;
//proddal.Update(part, data.DataSession);
data.AddToPersistentList(part, dai.OBJ_PID);
ProductStructure structure = new ProductStructure()
{
PART_PID = part.PID,
PID = Guid.NewGuid().ToString(),
PROCESS_CODE = product.PRODUCTCODE,
PRODUCT_PID = product.PID,
IsNewInfo=true
};
//ProductStructureDAL psdal = new ProductStructureDAL();
//psdal.Insert(structure, data.DataSession);
data.AddToPersistentList(structure, structure.PID);
}
}
/// <summary>
/// 保存加工参数
/// </summary>
/// <param name="product"></param>
/// <param name="dai"></param>
private void SaveProcessParam(Product product, DAICache dai,DAObject data)
{
ProcessParameters param = new ProcessParameters()
{
DA_CODE = dai.DA_CODE,
DA_MODEL = "1",
DA_TIME = dai.UPDATEDATE,
EQUIPMENT_CODE = "",
MEMBER_CODE = "",
PARM_ITEM = "",
PARM_VAL = dai.DA_VALUE,
PRODUCT_PID = product.PID,
SHIFT_CODE = "",
PID = Guid.NewGuid().ToString(),
TEAM_CODE = "",
WORKCELL_CODE = dai.WORKCELL_CODE,
WORKLOC_CODE = dai.WORKLOC_CODE,
IsNewInfo=true,
};
//ProcessParametersDAL ppdal = new ProcessParametersDAL();
//ppdal.Insert(param, data.DataSession);
data.AddToPersistentList(param, param.PID);
}
/// <summary>
/// 保存加工记录
/// </summary>
private void SaveProcessRecord(Product product, DAObject data, bool workcellend)
{
//QMAPP.FJC.DAL.Operation.ProductDAL pdal = new DAL.Operation.ProductDAL();
//pdal.BaseSession = data.DataSession;
//product = pdal.Get(product);
ProcessRecordDAL prdal = new ProcessRecordDAL();
ProcessRecord record = null;
record = data.GetPersistentEntity<ProcessRecord>(product.PID);//加工记录的ID使用PRODUCT的ID代替
if (record == null)
{
record = prdal.Get(product.PID, data.WorkLocState.WORKCELL_CODE);
}
if (record != null)
{
//
record.MANUAL_PASS = data.DAI == null ? "1" : "0";
//if (string.IsNullOrEmpty(record.PROCESS_STATE))
//{
//record.PROCESS_STATE = workcellend ? "1" : "0";
//}
if (record.MANUAL_PASS == "1")
{
record.PROCESS_STATE = "2";
}
else
{
record.PROCESS_STATE = workcellend ? "1" : "0";
}
record.WORKLOC_CODE = data.WorkLocState.WORKLOC_CODE;
if (workcellend)
{
record.WORK_END_TIME = DateTime.Now;
}
//prdal.Update(record, data.DataSession);
}
else
{
record = new ProcessRecord()
{
IN_WORKCELL_TIME = DateTime.Now,
PID = Guid.NewGuid().ToString(),
MANUAL_PASS = data.DAI == null ? "1" : "0",
//PROCESS_STATE = workcellend ? "1" : "0",
PRODUCT_PID = product.PID,
WORK_START_TIME = DateTime.Now,
WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE,
WORKLOC_CODE = data.WorkLocState.WORKLOC_CODE,
MODULE_CODE = data.MouldCode,
IsNewInfo = true
};
if (record.MANUAL_PASS == "1")
{
record.PROCESS_STATE = "2";
}
else
{
record.PROCESS_STATE = workcellend ? "1" : "0";
}
if (workcellend)
{
record.WORK_END_TIME = DateTime.Now;
}
//prdal.Insert(record, data.DataSession);
}
data.AddToPersistentList(record, product.PID);//加工记录的ID使用PRODUCT的ID代替
data.WorkLocState.CurrentState.RECORD_PID = record.PID;
if (workcellend)
{
#region 插入加工记录
//闫永刚 20170923
MainOperation mo = new MainOperation();
mo.PID = record.PID;
mo.PDID = product.PID;
mo.PROCESSTYPE = data.WorkLocState.CURRENTPROCESS;
mo.PRODUCTTYPE = "";
mo.PRODUCTCODE = product.PRODUCTCODE;
mo.MACHINECODDE = data.MachineCode;
mo.MOLDNUMBER = data.MouldCode;
mo.MACHINENAME = data.MachineName;
mo.STATUS = EnumGeter.STATUS.QUALIFIED.GetHashCode().ToString();
mo.OPERATESTATE = data.DAI == null ? EnumGeter.OPERATESTATE.RELEASED.GetHashCode().ToString(): EnumGeter.OPERATESTATE.COMPLETED.GetHashCode().ToString();
//mo.OPERATEDDATE = System.DateTime.Now;
mo.CURRENTPROCESS = "";
//mo.PRODUCELINE = "B9";
mo.MODELSTATION = "1";
mo.OPERATEDDATE = DateTime.Now;
mo.CREATEDATE = record.IN_WORKCELL_TIME;//DateTime.Now;
mo.CURRENTPROCESS = data.WorkLocState.CURRENTPROCESS;
mo.MATERIAL_CODE = product.MATERIAL_CODE;
mo.MATERIAL_NAME = product.MATERIAL_NAME;
mo.MATERIAL_TYPE_CODE = product.MATERIAL_TYPE;
mo.WORKCENTER_CODE = product.WORKCENTER_CODE;
mo.WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE;
mo.CREATEUSER = product.CREATEUSER;
mo.IsNewInfo = true;
//MainOperationDAL moDal = new MainOperationDAL();
//moDal.Insert(mo);
data.AddToPersistentList(mo, mo.PID);
#endregion
#region 更新产品状态
#region 产品下道工序设置
//直接获取下道工序信息
QMAPP.MD.Entity.WorkCell nextCell = new WorkCellDAL().GetNextWorkCell(new QMAPP.MD.Entity.WorkCell() { WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE });
if (nextCell != null && string.IsNullOrEmpty(nextCell.PID) == false)
{
product.WORKCELL_CODE = nextCell.WORKCELL_CODE;
product.WORKCENTER_CODE = nextCell.WORKCENTER_CODE;
product.TEAM_CODE = "";
product.WORKLOC_CODE = "";
product.CURRENTPROCESS = nextCell.CURRENTPROCESS;
}
else
{
//获取其他工艺路线的
#region 通过零件号获取BOM
//判断当前零件号是否是总成零件号
//如果不是继续判断下一个工序
//List<Pbom> pbomList = new PbomDAL().GetList(new Pbom() { MATERIAL_CODE = product.MATERIAL_CODE });
//if (pbomList.Count == 0)
//{
ProcessRouteWithWorkCellSeqDAL seqdal = new ProcessRouteWithWorkCellSeqDAL();
ProcessRouteWithWorkCellSeq seq = seqdal.GetNextWorkCellBetweenRoute(new Product() { WORKCELL_CODE = product.WORKCELL_CODE, MATERIAL_CODE = product.MATERIAL_CODE }); ;
product.WORKCELL_CODE = seq != null ? seq.WORKCELL_CODE : "";
QMAPP.MD.Entity.WorkCell workcell = new WorkCellDAL().GetByCondition(new QMAPP.MD.Entity.WorkCell() { WORKCELL_CODE = product.WORKCELL_CODE });
product.CURRENTPROCESS = workcell.CURRENTPROCESS;
//}
#endregion
}
//pdal.Update(product);
#endregion
#endregion
//product.STATUS = (int.Parse(record.PROCESS_STATE) - 1).ToString();
}
}
/// <summary>
/// 获取/创建产品信息
/// </summary>
/// <param name="data"></param>
/// <param name="workcellend">工序结束</param>
/// <returns></returns>
private Product SaveProduct(DAObject data,bool workcellend)
{
MD.DAL.ProcessRouteDAL routedal = new MD.DAL.ProcessRouteDAL();
var route = routedal.LocateRoute(data.WorkLocState.WORKCELL_CODE);
if (route == null)
{
throw new Exception("无法定位工艺路线!请检查工序和工艺路线设置。");
}
DAL.Basic.ProcessRouteWithWorkCellSeqDAL routeseqdal = new ProcessRouteWithWorkCellSeqDAL();
var endofroute = routeseqdal.EndOfRoute(route.RouteCode, data.WorkLocState.WORKCELL_CODE);
var materialdal = new DAL.MD.MaterialDAL();
var material = materialdal.Get(data.WorkLocState.CurrentState.MATERIAL_CODE);
QMAPP.FJC.DAL.Produce.ProductDAL dal = new QMAPP.FJC.DAL.Produce.ProductDAL();
if (!string.IsNullOrEmpty(data.WorkLocState.CurrentState.PROCESS_CODE)) //如果已存在产品条码则获取产品信息
{
Product product=null;
if (!string.IsNullOrWhiteSpace(data.WorkLocState.CurrentState.PRODUCT_PID))//如果记录了产品ID 则通过产品ID获取产品
{
product = data.GetPersistentEntity<Product>(data.WorkLocState.CurrentState.PRODUCT_PID);
if (product == null)
{
product = data.GetObjectFromCache<Product>(p => p.PID == data.WorkLocState.CurrentState.PRODUCT_PID);
if (product == null)
{
product = dal.GetByPID(data.WorkLocState.CurrentState.PRODUCT_PID);
}
}
}
else
{
product = data.GetObjectFromCache<Product>(p => p.PRODUCTCODE == data.WorkLocState.CurrentState.PROCESS_CODE && p.MATERIAL_CODE == data.WorkLocState.CurrentState.MATERIAL_CODE);
if (product == null)
{
product = dal.GetByCode(data.WorkLocState.CurrentState.PROCESS_CODE, data.WorkLocState.CurrentState.MATERIAL_CODE);
}
}
data.ObjectCacheList.Add(product);
product.WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE;
product.WORKCENTER_CODE = data.WorkLocState.WORKCENTER_CODE;
product.WORKLOC_CODE = data.WorkLocState.WORKLOC_CODE;
product.MATERIAL_TYPE = material == null ? "" : material.MATERIAL_TYPE_CODE;
if (material != null)
{
product.MATERIAL_CODE = material.MATERIAL_CODE;
}
//product.UPDATEDATE = DateTime.Now;
product.UPDATEUSER = data.UserID;
if (workcellend)
{
product.STATUS = workcellend ? "0" : "";
product.USINGSTATE = workcellend ? "0" : "";
product.OUTFLAG = workcellend ? "0" : "";
}
if (endofroute)
{
product.ENDOFLINE = "1";
}
data.AddToPersistentList(product, product.PID);
//dal.Update(product, data.DataSession);
data.WorkLocState.CurrentState.PRODUCT_PID = product.PID;
return product;
}
else //不存在则创建产品信息
{
string sn = (from da in data.WorkLocState.DataCache
where string.Equals(da.ISPROCESSCODE, "1")
select da.DA_VALUE).FirstOrDefault();
if (string.IsNullOrEmpty(sn))
{
//TODO:根据物料号的不同 分别生成产品序列号
//sn = "";
ICodeGenerator cgtor = new CodeGenerators.ProductCodeGenerator();
sn = cgtor.Generate(data.WorkLocState.CurrentState.MATERIAL_CODE, DateTime.Now, null);
}
Product product = new Product()
{
CAPACITY = 1,
MATERIAL_CODE = data.WorkLocState.CurrentState.MATERIAL_CODE,
CREATEDATE = DateTime.Now,
CREATEUSER = data.UserID,
PID = Guid.NewGuid().ToString(),
PRODUCTCODE = sn,
STATUS = workcellend ? "0" : "",
TEAM_CODE = "",
USINGCOUNT = 0,
WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE,
WORKCENTER_CODE = data.WorkLocState.WORKCENTER_CODE,
WORKLOC_CODE = data.WorkLocState.WORKLOC_CODE,
PRODUCESHIFTTCODE = data.Shift.PRODUCESHIFTTCODE,
USINGSTATE = workcellend ? "0" : "",
PRODUCTSOURCE = "0",
OUTFLAG = workcellend ? "0" : "",
MACHINECODDE = data.MachineCode,
MACHINENAME = data.MachineName,
MATERIAL_TYPE = material == null ? "" : material.MATERIAL_TYPE_CODE,
IsNewInfo = true
};
if (endofroute)
{
product.ENDOFLINE = "1";
}
data.AddToPersistentList(product, product.PID);
//dal.Insert(product, data.DataSession);
//判断是否为浇注工序
if (data.WorkLocState.WORKCELL_CODE == "FOAMING_VW371")
{
List<InjectionRecorder> updateInjectList = new List<InjectionRecorder>();
List<ProductInjection> addInjectItemList = new List<ProductInjection>();
addInjectItemList = this.GetProductInjectionList(product, ref updateInjectList);
ProductInjectionDAL proInDal = new ProductInjectionDAL();
if (addInjectItemList.Count > 0)
{
foreach (ProductInjection item in addInjectItemList)
{
proInDal.Insert(item);
}
}
}
data.WorkLocState.CurrentState.PROCESS_CODE = sn;
data.WorkLocState.CurrentState.PRODUCT_PID = product.PID;
return product;
}
}
/// <summary>
/// 根据物料组获取上层物料号
/// </summary>
/// <param name="materials"></param>
/// <returns></returns>
private BomLocation GetBomLocation(params string[] materials)
{
PbomDAL pbidal = new PbomDAL();
var bomlocations = pbidal.LocateBom(materials);
//确定物料组成数量一致
var bomlocation = bomlocations.FirstOrDefault(p => p.SubCount == materials.Length);
return bomlocation;
}
#region 投料
/// <summary>
///
/// </summary>
/// <param name="products"></param>
/// <param name="machine"></param>
/// <param name="updateInjectList"></param>
/// <returns></returns>
public List<ProductInjection> GetProductInjectionList(Product product, ref List<InjectionRecorder> updateInjectList)
{
InjectionRecorderDAL injectDal = new InjectionRecorderDAL();
updateInjectList = new List<InjectionRecorder>();
List<ProductInjection> addInjectItemList = new List<ProductInjection>();
//List<InjectionRecorder> ruleList = injectDal.GetCastLastRecorderWithBom(new InjectionRecorder() { MATERIALCODE = product.MATERIAL_CODE });
//去BOMItem
List<MD.Entity.PbomItem> ruleList = new PbomDAL().GetSubItem(product.MATERIAL_CODE);
//遍历规则信息
foreach (MD.Entity.PbomItem pm in ruleList)
{
#region 获取相应的投料信息
InjectionRecorder inRecorder = null;
List<InjectionRecorder> list = injectDal.GetCastLastRecorderWithMAterial(new InjectionRecorder()
{
MATERIALCODE = pm.MATERIAL_CODE
});
#endregion
if (list.Count > 0)
{
#region 修改投料记录
inRecorder = updateInjectList.Find(m => m.PID.Equals(list[0].PID));
if (inRecorder != null)
{
inRecorder.USEDWEIGHTSUM += pm.UNIT_SUM;
}
else
{
inRecorder = list[0];
inRecorder.USEDWEIGHTSUM += pm.UNIT_SUM;
//updateInjectList.Add(inRecorder);
InjectionRecorderDAL recoderDal = new InjectionRecorderDAL();
recoderDal.Update(inRecorder);
}
//recoderDal.Update(item);
#endregion
}
if (inRecorder != null)
{
#region 零件投料关联记录
ProductInjection proInject = new ProductInjection();
proInject.PID = Guid.NewGuid().ToString();
proInject.IPID = inRecorder.PID;
proInject.MPPID = product.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 = pm.UNIT_SUM;
proInject.CREATEDATE = System.DateTime.Now;
proInject.CREATEUSER = inRecorder.CREATEUSER;
proInject.UPDATEUSER = inRecorder.UPDATEUSER;
addInjectItemList.Add(proInject);
#endregion
}
}
return addInjectItemList;
}
#endregion
}
}

9
APPQ5/QMAPP.WinForm/App.config

@ -14,12 +14,12 @@
<add name="maindbBZD" connectionString="Data Source=.;Initial Catalog=BZD;User Id=sa;Password=Microsoft2008;" providerName="System.Data.SqlClient"/>--> <add name="maindbBZD" connectionString="Data Source=.;Initial Catalog=BZD;User Id=sa;Password=Microsoft2008;" providerName="System.Data.SqlClient"/>-->
<!--<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/> <!--<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>
<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_VW276PA_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>
--> -->
<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_VW276PA_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>
<!--
<add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/> <add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>
<!--<add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>--> <add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>-->
<!--<add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>--> <!--<add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>-->
@ -217,6 +217,9 @@
<endpoint address="http://localhost:8938/LoginService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeneralService" contract="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" /> <endpoint address="http://localhost:8938/LoginService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeneralService" contract="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" />
<endpoint address="net.tcp://127.0.0.1:4444/OpcService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IOpcService" contract="ServiceOpc.IOpcService" name="NetTcpBinding_IOpcService" /> <endpoint address="net.tcp://127.0.0.1:4444/OpcService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IOpcService" contract="ServiceOpc.IOpcService" name="NetTcpBinding_IOpcService" />
<!--<endpoint address="http://10.122.213.105:8938/GeneralService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeneralService" contract="CenterGeneralService.IGeneralService" name="BasicHttpBinding_IGeneralService" />
<endpoint address="http://10.122.213.105:8938/LoginService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGeneralService" contract="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" />
<endpoint address="net.tcp://127.0.0.1:4444/OpcService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IOpcService" contract="ServiceOpc.IOpcService" name="NetTcpBinding_IOpcService" />-->
</client> </client>
</system.serviceModel> </system.serviceModel>

4
APPQ5/QMAPP.WinForm/Properties/AssemblyInfo.cs

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2022.09.01.01")] [assembly: AssemblyVersion("2022.09.23.01")]
[assembly: AssemblyFileVersion("2022.09.01.01")] [assembly: AssemblyFileVersion("2022.09.23.01")]

10
ServicesCenter/WCF/QMFrameWork.WebServiceHost/Web.config

@ -73,15 +73,15 @@
<!--<add name="maindb" connectionString="Data Source=123.56.115.74;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=qwe123$%^;" providerName="System.Data.SqlClient" />--> <!--<add name="maindb" connectionString="Data Source=123.56.115.74;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=qwe123$%^;" providerName="System.Data.SqlClient" />-->
<!--<add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>--> <!--<add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>
<!--<add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>
<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_VW276PA_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/> <add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>
--> -->
<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_VW276PA_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>
<!--
<add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/> <add name="maindb" connectionString="Data Source=10.122.213.104;Initial Catalog=ADIENT_VW276_MES;User Id=MES;Password=Password1;" providerName="System.Data.SqlClient"/>
<!--<add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>--> <add name="maindb" connectionString="Data Source=dev.ccwin-in.com,6191;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=Microsoft@2021;" providerName="System.Data.SqlClient"/>-->
<!--<add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>--> <!--<add name="maindb" connectionString="Data Source=10.117.133.48;Initial Catalog=ADIENT_TJ_MES;User Id=sa;Password=ASDqwe123!@#;" providerName="System.Data.SqlClient"/>-->

Loading…
Cancel
Save