using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.DAL.WipService;
using QMAPP.FJC.Entity.ProduceManage;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.WIPManage;
namespace QMAPP.FJC.BLL.WipService
{
///
/// 模块编号:M19
/// 作 用:定时查询在制品库存
/// 作 者:王济
/// 编写日期:2015年07月13日
///
public class CheckWipBLL : BaseBLL
{
///
/// 定时查询在制品库存
///
public void WipProecessCheck()
{
List pst = new CheckWipDAL().WipProecessCheck();
List sa = new List();
//StorageAlarm
List pdp = new List();
int multiple;
foreach (ProcessSet pt in pst)
{
multiple = 0;
if (pt.MINVALUE > pt.TEMP && pt.PRODUCEMINVALUE != 0)
{
multiple = (pt.MINVALUE + pt.PRODUCEMINVALUE - pt.TEMP) / pt.PRODUCEMINVALUE;
pdp.Add(new ProducePlan {
PID = Guid.NewGuid().ToString(),
PROCESSTYPE = pt.PROCESSTYPE,
PRODUCTTYPE = pt.PRODUCTTYPE,
MINPRODUCECOUNT = pt.PRODUCEMINVALUE,
PRODUCECOUNT = pt.PRODUCEMINVALUE * multiple,
PLANSTATUS = "0",
CREATETYPE = "0",
CREATEDATE = DateTime.Now,
UPDATEDATE = DateTime.Now,
PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString(),
PLANCODE = DateTime.Now.ToString("yyyyMMddHHmmss"),
PASTFLAG="0",
PRODUCESHIFTTCODE = pt.PRODUCESHIFTTCODE
});
sa.Add(new StorageAlarm {
PID = Guid.NewGuid().ToString(),
PROCESSTYPE = pt.PROCESSTYPE,
MINVALUE = pt.MINVALUE,
PRODUCEMINVALUE = pt.PRODUCEMINVALUE,
CURRENTSTORAGE = pt.TEMP,
ALARMSTATUS = "0",
PRODUCESHIFTNAME = pt.PRODUCESHIFTNAME,
PRODUCESHIFTTCODE = pt.PRODUCESHIFTTCODE,
CREATEDATE = DateTime.Now
});
}
}
new CheckWipDAL().Update();
try
{
new CheckWipDAL().Insert(pdp);
new CheckWipDAL().Insert(sa);
}
catch (Exception ex)
{
throw ex;
}
}
}
}