|
|
|
@ -11,10 +11,13 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
|
|
|
|
|
private readonly Repository<CwssInputRecord> _cwssRep;
|
|
|
|
|
|
|
|
|
|
public InputRecordServiceImpl(Repository<McsInputRecord> mcsRep,Repository<CwssInputRecord> cwssRep)
|
|
|
|
|
private readonly Repository<RecordMaterialInput> _mesRep;
|
|
|
|
|
|
|
|
|
|
public InputRecordServiceImpl(Repository<McsInputRecord> mcsRep,Repository<CwssInputRecord> cwssRep, Repository<RecordMaterialInput> mesRep)
|
|
|
|
|
{
|
|
|
|
|
_mcsRep = mcsRep;
|
|
|
|
|
_cwssRep = cwssRep;
|
|
|
|
|
_mesRep = mesRep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -48,6 +51,7 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
result = _mcsRep.Insert(mcsInputRecord);
|
|
|
|
|
SaveMesInputRecord(mcsInputRecord, null, out result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
@ -87,6 +91,8 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
result = _cwssRep.Insert(cwssInputRecord);
|
|
|
|
|
|
|
|
|
|
SaveMesInputRecord(null, cwssInputRecord, out result);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
@ -94,5 +100,86 @@ namespace SlnMesnac.Repository.service.Impl
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存Mes投料记录
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="mcsInputRecord"></param>
|
|
|
|
|
/// <param name="cwssInputRecord"></param>
|
|
|
|
|
/// <param name="result"></param>
|
|
|
|
|
private void SaveMesInputRecord(McsInputRecord mcsInputRecord,CwssInputRecord cwssInputRecord,out bool result)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
RecordMaterialInput recordMaterialInput = null;
|
|
|
|
|
if (mcsInputRecord != null)
|
|
|
|
|
{
|
|
|
|
|
/*Pstmminjar pstmminjar = new Pstmminjar()
|
|
|
|
|
{
|
|
|
|
|
Materbarcode = mcsInputRecord.MaterialBarcode,
|
|
|
|
|
EquipCode = "01001",
|
|
|
|
|
ShiftDate = DateTime.Now,
|
|
|
|
|
InTime = mcsInputRecord.RecordTime,
|
|
|
|
|
RealNum = mcsInputRecord.InputQuantity,
|
|
|
|
|
RealWeight = Convert.ToDecimal(mcsInputRecord.InputWeight),
|
|
|
|
|
BDSaveTime = DateTime.Now
|
|
|
|
|
};*/
|
|
|
|
|
recordMaterialInput = new RecordMaterialInput()
|
|
|
|
|
{
|
|
|
|
|
equip_id = mcsInputRecord.EquipId.ToString(),
|
|
|
|
|
can_number = mcsInputRecord.CanNumber,
|
|
|
|
|
equip_type = "mcs",
|
|
|
|
|
input_quantity = mcsInputRecord.InputQuantity,
|
|
|
|
|
input_weight = mcsInputRecord.InputQuantity,
|
|
|
|
|
is_remainder = mcsInputRecord.IsRemainder,
|
|
|
|
|
remainder_quantity = mcsInputRecord.RemainderQuantity,
|
|
|
|
|
remainder_weight = Convert.ToDecimal(mcsInputRecord.RemainderWeight),
|
|
|
|
|
is_open = mcsInputRecord.IsOpen,
|
|
|
|
|
is_flag = mcsInputRecord.IsFlag,
|
|
|
|
|
remark = mcsInputRecord.Remark,
|
|
|
|
|
record_time = mcsInputRecord.RecordTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cwssInputRecord != null)
|
|
|
|
|
{
|
|
|
|
|
/*Pstmminjar pstmminjar = new Pstmminjar()
|
|
|
|
|
{
|
|
|
|
|
Materbarcode = cwssInputRecord.MaterialBarcode,
|
|
|
|
|
EquipCode = "0200"+cwssInputRecord.CanNumber,
|
|
|
|
|
ShiftDate = DateTime.Now,
|
|
|
|
|
InTime = cwssInputRecord.RecordTime,
|
|
|
|
|
RealNum = cwssInputRecord.InputQuantity,
|
|
|
|
|
RealWeight = Convert.ToDecimal(cwssInputRecord.InputWeight),
|
|
|
|
|
BDSaveTime = DateTime.Now
|
|
|
|
|
};*/
|
|
|
|
|
recordMaterialInput = new RecordMaterialInput()
|
|
|
|
|
{
|
|
|
|
|
equip_id = cwssInputRecord.EquipId.ToString(),
|
|
|
|
|
can_number = cwssInputRecord.CanNumber,
|
|
|
|
|
equip_type = "cwss",
|
|
|
|
|
input_quantity = cwssInputRecord.InputQuantity,
|
|
|
|
|
input_weight = cwssInputRecord.InputQuantity,
|
|
|
|
|
is_remainder = cwssInputRecord.IsRemainder,
|
|
|
|
|
remainder_quantity = cwssInputRecord.RemainderQuantity,
|
|
|
|
|
remainder_weight = Convert.ToDecimal(cwssInputRecord.RemainderWeight),
|
|
|
|
|
is_open = cwssInputRecord.IsOpen,
|
|
|
|
|
is_flag = cwssInputRecord.IsFlag,
|
|
|
|
|
remark = cwssInputRecord.Remark,
|
|
|
|
|
record_time = cwssInputRecord.RecordTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (recordMaterialInput != null)
|
|
|
|
|
{
|
|
|
|
|
result = _mesRep.Insert(recordMaterialInput);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
new InvalidOperationException($"保存Mes投料记录异常:{e.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|