天津投入产出系统后端
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.
 
 
 
 
 
 

60 lines
2.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.TRACING.DAInterface;
using QMAPP.FJC.Entity.SA;
namespace QMAPP.FJC.TRACING.StateActions
{
/// <summary>
/// 数量统计
/// </summary>
public class StatisQTY : IStateAction
{
public void Execute(DAObject data)
{
var shift = data.Shift;
var wqtydal = new FJC.DAL.SA.WorkcellQtyCountDAL();
var wqty = wqtydal.GetByCondition(new WorkcellQtyCount
{
EQUIPMENT_CODE = data.MachineCode,
MATRIAL_CODE = data.WorkLocState.CurrentState.MATERIAL_CODE,
STATIS_DATE = data.Date.Date,
WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE,
SHIFT_CODE = shift.PRODUCESHIFTTCODE
});
if (wqty == null)
{
wqty = new WorkcellQtyCount
{
EQUIPMENT_CODE = data.MachineCode,
MATRIAL_CODE = data.WorkLocState.CurrentState.MATERIAL_CODE,
STATIS_DATE = data.Date.Date,
WORKCELL_CODE = data.WorkLocState.WORKCELL_CODE,
SHIFT_CODE = shift.PRODUCESHIFTTCODE,
CREATEDATE = data.Date,
FACTORY_CODE = "",
NOK_QTY = 0,
OK_QTY = 1,
QTY = 1,
REWORK_QTY = 0,
PID = Guid.NewGuid().ToString(),
WORKCENTER_CODE = data.WorkLocState.WORKCENTER_CODE,
IsNewInfo = true
};
}
else
{
var eqty = data.GetPersistentEntity<WorkcellQtyCount>(wqty.PID);
if (eqty != null)
{
wqty = eqty;
}
wqty.QTY += 1;
wqty.OK_QTY += 1;
}
data.AddToPersistentList(wqty, wqty.PID);
}
}
}