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 } }