1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084 |
- using Cksoft.Data;
- using Cksoft.Data.Repository;
- using Cksoft.Unity;
- using Cksoft.Unity.Log4NetConfig;
- using DllEapDal;
- using DllEapEntity;
- using Newtonsoft.Json;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- namespace DllEapBll
- {
- public class EapBll : IDisposable
- {
- private string CurrDbCode = "sqlconn";
- private IDatabase CurrDb = null;
- public EapBll(string dbcode)
- {
- CurrDbCode = dbcode;
- CurrDb = DbFactory.Base(CurrDbCode);
- }
- public void Dispose()
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- public Hashtable Login(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- //errorinfo = "到了登录函数Login";
- //return null;
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Staff entity = JsonConvert.DeserializeObject<Staff>((string)imputds[nameof(Staff)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- StaffDal tempdal = new StaffDal(CurrDb);
- entity = tempdal.Login(entity, ref errorinfo);
- if (entity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(Staff), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable IUMacModel(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- MacModel entity = JsonConvert.DeserializeObject<MacModel>((string)imputds[nameof(MacModel)]);
- List<MMSecDetail> details = JsonConvert.DeserializeObject<List<MMSecDetail>>((string)imputds[nameof(MMSecDetail)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- MacModelDal tempdal = new MacModelDal(CurrDb);
- entity = tempdal.IUMacModel(entity, details, order.usercode, ref errorinfo);
- if (entity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(MacModel), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable DelMacModel(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<MacModel> details = JsonConvert.DeserializeObject<List<MacModel>>((string)imputds[nameof(MacModel)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- MacModelDal tempdal = new MacModelDal(CurrDb);
- foreach (var item in details)
- {
- //entity = tempdal.IUMacModel(entity, details, order.usercode, ref errorinfo);
- //if (entity == null)
- //{
- // CurrDb.Rollback();
- // return null;
- //}
- }
- Hashtable reds = new Hashtable();
- //reds.Add(nameof(MacModel), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable IUMachine(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Machine entity = JsonConvert.DeserializeObject<Machine>((string)imputds[nameof(Machine)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- MachineDal tempdal = new MachineDal(CurrDb);
- entity = tempdal.IUMachine(entity, order.usercode, ref errorinfo);
- if (entity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(Machine), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- LogHelper<Machine>.LogFatal("新增Machine-->" + Json.ToJson(entity), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable IUOrderMst(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- List<OrderDetail> details = JsonConvert.DeserializeObject<List<OrderDetail>>((string)imputds[nameof(OrderDetail)]);
- List<OrderData> datas = JsonConvert.DeserializeObject<List<OrderData>>((string)imputds[nameof(OrderData)]);
- List<OrderDetailSec> secs = JsonConvert.DeserializeObject<List<OrderDetailSec>>((string)imputds[nameof(OrderDetailSec)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- entity = tempdal.IUOrderMst(entity, details, datas, secs, order.usercode, ref errorinfo);
- if (entity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- LogHelper<OrderMst>.LogFatal("新增OrderMst-->" + Json.ToJson(entity), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable AutoProcessOac(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.AutoProcessOac(entity.ID, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- LogHelper<OrderMst>.LogFatal("AutoProcessOac-->" + Json.ToJson(entity), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable AddVersionOrder(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.AddVersionOrder(entity, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- LogHelper<OrderMst>.LogFatal("新增OrderMst-->" + Json.ToJson(entity), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable CopyOrderDetailTo(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<OrderMst> desordermst = JsonConvert.DeserializeObject<List<OrderMst>>((string)imputds[nameof(OrderMst)]);
- List<OrderDetail> orgorderdetails = JsonConvert.DeserializeObject<List<OrderDetail>>((string)imputds[nameof(OrderDetail)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- foreach (var item in desordermst)
- {
- int result = tempdal.CopyOrderDetail(orgorderdetails, item, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(desordermst[0]));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- finally
- {
- if (CurrDb != null)
- CurrDb.Close();
- }
- }
- public Hashtable CopyOrder(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.CopyOrder(entity, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable DelOrderMst(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<OrderMst> entitys = JsonConvert.DeserializeObject<List<OrderMst>>((string)imputds[nameof(OrderMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.DelOrderMst(entitys, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entitys[0]));
- CurrDb.Commit();
- LogHelper<OrderMst>.LogFatal("删除OrderMst-->" + Json.ToJson(entitys), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable OrderRelationMca(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- List<Machine> entitys = JsonConvert.DeserializeObject<List<Machine>>((string)imputds[nameof(Machine)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.OrderRelationMca(entity, entitys, usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable IUSec(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Sec entity = JsonConvert.DeserializeObject<Sec>((string)imputds[nameof(Sec)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- SecDal tempdal = new SecDal(CurrDb);
- Sec reentity = tempdal.IUSec(entity, usercode, ref errorinfo);
- if (reentity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(Sec), JsonConvert.SerializeObject(reentity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable DelReportMst(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<ReportMst> entitys = JsonConvert.DeserializeObject<List<ReportMst>>((string)imputds[nameof(ReportMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- ReportMstDal tempdal = new ReportMstDal(CurrDb);
- int result = tempdal.DelReportMst(entitys, ref errorinfo);
- if (result < 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ReportMst), JsonConvert.SerializeObject(entitys[0]));
- CurrDb.Commit();
- LogHelper<ReportMst>.LogFatal("删除ReportMst-->" + Json.ToJson(entitys), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable IUReportMst(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- ReportMst entity = JsonConvert.DeserializeObject<ReportMst>((string)imputds[nameof(ReportMst)]);
- List<ReportDetail> details = JsonConvert.DeserializeObject<List<ReportDetail>>((string)imputds[nameof(ReportDetail)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- ReportMstDal tempdal = new ReportMstDal(CurrDb);
- ReportMst reentity = tempdal.IUReportMst(entity, details, usercode, ref errorinfo);
- if (reentity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ReportMst), JsonConvert.SerializeObject(reentity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable CopyReportMst(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- ReportMst entity = JsonConvert.DeserializeObject<ReportMst>((string)imputds[nameof(ReportMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- ReportMstDal tempdal = new ReportMstDal(CurrDb);
- ReportMst reentity = tempdal.CopyReportMst(entity, usercode, ref errorinfo);
- if (reentity == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ReportMst), JsonConvert.SerializeObject(reentity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable DelMachine(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<Machine> details = JsonConvert.DeserializeObject<List<Machine>>((string)imputds[nameof(Machine)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- MachineDal tempdal = new MachineDal(CurrDb);
- object result = tempdal.DelMachine(details, ref errorinfo);
- if (result == null)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add("result", JsonConvert.SerializeObject(result));
- CurrDb.Commit();
- LogHelper<Machine>.LogFatal("删除Machine-->" + Json.ToJson(details), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable DelMacOrder(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<MacOrder> entitys = JsonConvert.DeserializeObject<List<MacOrder>>((string)imputds[nameof(MacOrder)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.DelMacOrder(entitys);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(MacOrder), JsonConvert.SerializeObject(entitys[0]));
- CurrDb.Commit();
- LogHelper<MacOrder>.LogFatal("删除MacOrder-->" + Json.ToJson(entitys), "用户操作", usercode);
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable IUOrderEvent(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<OrderEvent> details = JsonConvert.DeserializeObject<List<OrderEvent>>((string)imputds[nameof(OrderEvent)]);
- List<EventReportDetail> datas = JsonConvert.DeserializeObject<List<EventReportDetail>>((string)imputds[nameof(EventReportDetail)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.IUOrderEvent(details, datas, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ConstOrder), JsonConvert.SerializeObject(order));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable IUOrderStatus(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<OrderStatus> details = JsonConvert.DeserializeObject<List<OrderStatus>>((string)imputds[nameof(OrderStatus)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.IUOrderStatus(details, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ConstOrder), JsonConvert.SerializeObject(order));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable AccountOrderSecDetail(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.AccountOrderSecDetail(entity, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ConstOrder), JsonConvert.SerializeObject(order));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable UOrderSecDetail(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- //List<OrderSecDetail> details = JsonConvert.DeserializeObject<List<OrderSecDetail>>((string)imputds[nameof(OrderSecDetail)]);
- //string usercode = order.usercode;
- //CurrDb.BeginTrans();
- //OrderMstDal tempdal = new OrderMstDal(CurrDb);
- //int result = tempdal.UOrderSecDetail(details, order.usercode, ref errorinfo);
- //if (result <= 0)
- //{
- // CurrDb.Rollback();
- // return null;
- //}
- Hashtable reds = new Hashtable();
- reds.Add(nameof(ConstOrder), JsonConvert.SerializeObject(order));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable CopyOrderToModel(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- OrderMst entity = JsonConvert.DeserializeObject<OrderMst>((string)imputds[nameof(OrderMst)]);
- MacModel model = JsonConvert.DeserializeObject<MacModel>((string)imputds[nameof(MacModel)]);
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- OrderMstDal tempdal = new OrderMstDal(CurrDb);
- int result = tempdal.CopyOrderToModel(entity, model, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add(nameof(OrderMst), JsonConvert.SerializeObject(entity));
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- public Hashtable ImportFileParams(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- List<FileParams> entity = JsonConvert.DeserializeObject<List<FileParams>>((string)imputds[nameof(FileParams)]);
- if (entity.Count <= 0)
- {
- errorinfo = "未找到传入的机型参数。";
- return null;
- }
- string usercode = order.usercode;
- CurrDb.BeginTrans();
- int modelid = entity[0].ModelID;
- FileParamsDal tempdal = new FileParamsDal(CurrDb);
- int result = tempdal.ImportFileParams(modelid, entity, order.usercode, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add("result", result);
- CurrDb.Commit();
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- CurrDb.Rollback();
- return null;
- }
- }
- /// <summary>
- /// 根据机台编号,时间范围,读取机台对应的日志信息
- /// </summary>
- /// <param name="imputds"></param>
- /// <param name="errorinfo"></param>
- /// <param name="error"></param>
- /// <returns></returns>
- public Hashtable ReadLog(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Machine mac = JsonConvert.DeserializeObject<Machine>((string)imputds[nameof(Machine)]);
- //DateTime starttime= JsonConvert.DeserializeObject<DateTime>((string)imputds["starttime"]);
- //DateTime endtime = JsonConvert.DeserializeObject<DateTime>((string)imputds["endtime"]);
- DateTime starttime = DateTime.Parse(imputds["starttime"].ToString());
- DateTime endtime = DateTime.Parse(imputds["endtime"].ToString());
- string usercode = order.usercode;
- LogDal tempdal = new LogDal(CurrDb);
- List<string> logs = tempdal.ReadLog(mac, starttime, endtime, ref errorinfo);
- if (logs == null)
- {
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add("log", JsonConvert.SerializeObject(logs));
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- return null;
- }
- }
- public Hashtable ReadBusinessLog(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Machine mac = JsonConvert.DeserializeObject<Machine>((string)imputds[nameof(Machine)]);
- //DateTime starttime= JsonConvert.DeserializeObject<DateTime>((string)imputds["starttime"]);
- //DateTime endtime = JsonConvert.DeserializeObject<DateTime>((string)imputds["endtime"]);
- DateTime starttime = DateTime.Parse(imputds["starttime"].ToString());
- DateTime endtime = DateTime.Parse(imputds["endtime"].ToString());
- string usercode = order.usercode;
- LogDal tempdal = new LogDal(CurrDb);
- List<string> logs = tempdal.ReadBusinessLog(mac, starttime, endtime, ref errorinfo);
- if (logs == null)
- {
- return null;
- }
- Hashtable reds = new Hashtable();
- reds.Add("log", JsonConvert.SerializeObject(logs));
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- return null;
- }
- }
- public Hashtable SaveProgram(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- Machine mac = JsonConvert.DeserializeObject<Machine>((string)imputds[nameof(Machine)]);
- CurrDb.BeginTrans();
- string usercode = order.usercode;
- MacProgram resultprogram = null;
- if (mac.SupplierFCode == "KNS")
- {
- KnsProgramDal dal = new KnsProgramDal(CurrDb);
- resultprogram = dal.SaveProgram(mac.FCode, usercode, ref errorinfo);
- }
- else
- {
- AsmProgramDal dal = new AsmProgramDal(CurrDb);
- resultprogram = dal.SaveProgram(mac.FCode, usercode, ref errorinfo);
- }
- int result = 1;
- if (resultprogram == null)
- {
- result = -1;
- }
- Hashtable reds = new Hashtable();
- reds.Add("result", result.ToString());
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- return null;
- }
- }
- public Hashtable SendStopOrder(Hashtable imputds, ref string errorinfo, ref int error)
- {
- try
- {
- if (imputds == null)
- {
- errorinfo = "传入数据不能为空,请确认";
- error = 1;
- return null;
- }
- ConstOrder order = JsonConvert.DeserializeObject<ConstOrder>((string)imputds[nameof(ConstOrder)]);
- string maccode = (string)imputds["maccode"];
- CurrDb.BeginTrans();
- MacOrderSendDal dal = new MacOrderSendDal(CurrDb);
- int result = dal.SendStopMac(maccode, ref errorinfo);
- Hashtable reds = new Hashtable();
- reds.Add("result", result.ToString());
- return reds;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- error = 1;
- return null;
- }
- }
- public int ModifyProgramName(string maccode, string orgname, string desname, ref string errorinfo)
- {
- try
- {
- CurrDb.BeginTrans();
- MacProgramDal dal = new MacProgramDal(CurrDb);
- int result = dal.ModifyProgramName(maccode, orgname, desname, ref errorinfo);
- if (result <= 0)
- {
- CurrDb.Rollback();
- return -1;
- }
- CurrDb.Commit();
- return 1;
- }
- catch (Exception ex)
- {
- errorinfo = ex.Message.ToString();
- CurrDb.Rollback();
- return -1;
- }
- }
- }
- }
|