using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using ICSSoft.Frame.Data.DAL; using ICSSoft.Frame.Data.Entity; namespace ICSSoft.Frame.Data.BLL { public class ICSITEMLOTBLL { #region AddandEdit public static void AddandEdit(ICSITEMLot itemlot, string Appconstr) { try { ICSITEMLOTDAL.Add(itemlot, Appconstr); } catch (Exception ex) { throw ex; } } #endregion #region delete public static void delete(List guidList, string dsconn) { ICSITEMLOTDAL.deleteInfo(guidList, dsconn); } #endregion #region Detaildelete public static void Detaildelete(List guidList, string dsconn) { ICSITEMLOTDAL.DetaildeleteInfo(guidList, dsconn); } #endregion #region DetailAddandEdit public static void DetailAddandEdit(ICSITEMLotDetail itemlot, string Appconstr) { try { ICSITEMLOTDAL.DetailADD(itemlot, Appconstr); } catch (Exception ex) { throw ex; } } #endregion public static void InsertINV(string NO, string code, int count) { ICSITEMLOTDAL.insert(NO, code, count); } public static void DeleteINV(string NO, string code, int count) { ICSITEMLOTDAL.delete(NO, code, count); } /// /// 获取条码状态 /// /// /// /// public static string CheckLotNo(string lotNo, string workpointCode, string dsconn) { string errormessage = ""; DataTable dt = ICSITEMLOTDAL.CheckLotNO(lotNo, workpointCode, dsconn); if (dt.Rows.Count == 0) { errormessage = "条码不存在!"; } else { if (dt.Rows[0]["TYPE"].ToString() != "采购原料" && dt.Rows[0]["TYPE"].ToString() != "原材料") { errormessage = "条码不是采购条码,不能进行到货扫描!"; } else if (dt.Rows[0]["BarCode"].ToString() != "" && dt.Rows[0]["BarCode"].ToString() != null) { errormessage = "条码已经上架!"; } else { errormessage = "1"; } } string result = ""; if (errormessage == "1") { result = string.Format("{{\"code\":\"0\",\"msg\":\" \"}}"); } else { result = string.Format("{{\"code\":\"1\",\"msg\":\"{0}\"}}", errormessage); } return result; } /// /// 验证ASN单信息 /// /// /// /// /// public static string CheckASNNo(string lotNo, string workpointCode, string dsconn) { string errormessage = ""; DataTable dt = ICSITEMLOTDAL.CheckASNNO(lotNo, workpointCode, dsconn); if (dt.Rows.Count == 0) { errormessage = "ASN单不存在!"; } else { errormessage = "1"; } string result = ""; if (errormessage == "1") { result = string.Format("{{\"code\":\"0\",\"msg\":\" \"}}"); } else { result = string.Format("{{\"code\":\"1\",\"msg\":\"{0}\"}}", errormessage); } return result; } /// /// 验证编码信息 /// /// /// /// /// public static string CheckLOTNum(string INVCode, string workpointCode, string dsconn) { string errormessage = ""; DataTable dt = ICSITEMLOTDAL.CheckLOTNum(INVCode, workpointCode, dsconn); if (dt.Rows.Count == 0) { errormessage = "此编码对应物料不存在!"; } else { errormessage = "1"; } string result = ""; if (errormessage == "1") { result = string.Format("{{\"code\":\"0\",\"msg\":\" \"}}"); } else { result = string.Format("{{\"code\":\"1\",\"msg\":\"{0}\"}}", errormessage); } return result; } /// /// 获取条码信息 /// /// /// /// public static DataTable GetLotData(string barCode, string workpointCode, string dsconn) { DataTable dt = ICSITEMLOTDAL.GetLotData(barCode, workpointCode, dsconn); return dt; } /// /// 获取条码信息 /// /// /// /// public static DataTable GetLotDataForPO(string barCode, string workpointCode, string dsconn) { DataTable dt = ICSITEMLOTDAL.GetLotDataForPO(barCode, workpointCode, dsconn); return dt; } /// /// 获取条码信息(半成品入库) /// /// /// /// /// public static DataTable GetLotDataForMo(string barCode, string workpointCode, string dsconn) { DataTable dt = ICSITEMLOTDAL.GetLotDataForMO(barCode, workpointCode, dsconn); return dt; } /// /// 获取条码信息 /// /// /// /// /// public static DataTable GetLotNumData(string INVCode, string workpointCode, string dsconn) { DataTable dt = ICSITEMLOTDAL.GetLotNumData(INVCode, workpointCode, dsconn); return dt; } /// /// 获取ASN单信息(半成品入库) /// /// /// /// /// public static DataTable GetASNDataForMO(string barCode, string workpointCode, string dsconn) { DataTable dt = ICSITEMLOTDAL.GetASNDataForMO(barCode, workpointCode, dsconn); return dt; } #region 生成到货单 public static string CreateRCV(List rcv, string connection, out string docno, out string user, out string time) { try { string result = ""; string errormessage = ICSITEMLOTDAL.CreateRCV(rcv, connection, out docno, out user, out time); if (errormessage == "OK") { result = string.Format("{{\"code\":\"0\",\"msg\":\" \"}}"); } else { result = string.Format("{{\"code\":\"1\",\"msg\":\"{0}\"}}", errormessage); } return result; } catch (Exception ex) { throw ex; } } #endregion #region 删除分批获得的跟踪单 public static void DeleteInfoBySplit(List LotNoList, string dsconn) { ICSITEMLOTDAL.DeleteInfoBySplit(LotNoList, dsconn); } #endregion #region 删除分批获得的跟踪单 public static void DeleteInfoBySplit(List LotNoList) { ICSITEMLOTDAL.DelSplitLotNoList(LotNoList); } #endregion public static ICSITEMLot GetICSITEMLot(string LotNo, string dsconn) { try { return ICSITEMLOTDAL.GetICSITEMLot(LotNo, dsconn); } catch (Exception ex) { throw ex; } } public static ICSLOTSIMULATION GetICSLOTSIMULATION(string simID, string dsconn) { try { return ICSITEMLOTDAL.GetICSLOTSIMULATION(simID, dsconn); } catch (Exception ex) { throw ex; } } #region 采集过程中分批用新增 public static void SplitAdd(string simID, string LotNo, List itemLotList, List simList, List loginfoList, List mo2UserList, bool isnew, string dsconn) { try { if (string.IsNullOrWhiteSpace(dsconn)) { throw new Exception("请输入......"); } ICSITEMLOTDAL.SplitAdd(simID, LotNo, itemLotList, simList, loginfoList, mo2UserList, isnew, dsconn); } catch (Exception ex) { throw ex; } } #endregion public static void SpliteLotNo(string LotNo, decimal SplitQty, string SplitReason, string dsconn) { try { ICSITEMLOTDAL.SpliteLotNo(LotNo, SplitQty, SplitReason, dsconn); } catch (Exception ex) { throw ex; } } /// /// 更改mes条码入库状态 /// /// /// /// /// public static void UpdateLotnoStatus(string lotno, string muser, DateTime date,decimal transqty,string conn) { try { ICSITEMLOTDAL.UpdateLotnoStatus(lotno, muser, date,transqty, conn); } catch (Exception ex) { throw ex; } } public static void GetLotnoMes(string lotno,string conn,T t) { try { ICSITEMLOTDAL.GetLotnoMes(lotno,conn,t); } catch (Exception ex) { throw ex; } } public static void GetLotnoMes2(string lotno, string conn, LOTMES t) { try { ICSITEMLOTDAL.GetLotnoMes2(lotno, conn, t); } catch (Exception ex) { throw ex; } } public static void UpdateOAMes(ICSOAMES mes, string conn) { try { ICSITEMLOTDAL.UpdateOAMes(mes, conn); } catch (Exception ex) { throw ex; } } } }