using System; using System.Collections.Generic; using System.Linq; using System.Text; using WMS.Model.Base; using WMS.IData; using System.Data; using WMS.Common; using System.Net; using WMS.Business.Stock; namespace WMS.Business.Base { public class BussStorageAreaLocation : IBussFactory { /// /// 更改库位的容积,长,高 /// /// public void UpdateLoc(StorageAreaLocationModel mData) { DataProvider.Instance.StorageAreaLocation.UpdateLoc(mData); Transaction = DataProvider.Instance.TranOracle; logList.Add(DataProvider.Instance.logData); TaCmtOrRak(); } /// /// 查询是否有该库位 /// public int GetCtLocData(string STORAGE_ID,string locID) { DataTable tb= DataProvider.Instance.StorageAreaLocation.GetCtLocData(STORAGE_ID, locID); if(tb!=null) { if(tb.Rows.Count>0) { return int.Parse(tb.Rows[0]["a"].ToString()); } } return 0; } public DataTable GetCtLocData(string decidD) { DataTable tb = DataProvider.Instance.StorageAreaLocation.GetLocData(decidD, ""); return tb; } public List GetMistockLocData(string devid) { DataTable table = DataProvider.Instance.MIStock.GetMistockLocData(devid); if (table != null) { List model = ConvertHelper.ConvertToList(table); return model; } return null; } public void InsertLocArea(LocAreaModel model) { DataProvider.Instance.LocArea.InsertLocArea(model); } public void InsertLocAreaList(List listData) { DataTable tb = DataProvider.Instance.StorageAreaLocation.GetCtLocData(listData[0].STORAGE_ID, listData[0].LOCATION_ID); if (tb != null) { if (int.Parse(tb.Rows[0]["a"].ToString()) == 0) { return; } } DataProvider.Instance.LocArea.DeleteLocArea(listData[0]); foreach (LocAreaModel model in listData) { DataProvider.Instance.LocArea.InsertLocArea(model); } } /// /// 更新库位的库区信息 /// /// /// /// public void UpdateAgeId( string STORAGE_AREA_ID, string locID) { DataProvider.Instance.StorageAreaLocation.UpdateAgeId( STORAGE_AREA_ID, locID); Transaction = DataProvider.Instance.TranOracle; logList.Add(DataProvider.Instance.logData); TaCmtOrRak(); } public void UpdateLocCtlSts(string locId, string STATUS,string STORAGE_ID) { DataProvider.Instance.AutoRkData.UpdateLocCtlSts(locId, STATUS, STORAGE_ID); Transaction = DataProvider.Instance.TranOracle; logList.Add(DataProvider.Instance.logData); TaCmtOrRak(); } public void UpdateLocislocklSts(string locId, string STATUS, string STORAGE_ID) { DataProvider.Instance.AutoRkData.UpdateLocislockSts(locId, STATUS, STORAGE_ID); Transaction = DataProvider.Instance.TranOracle; logList.Add(DataProvider.Instance.logData); TaCmtOrRak(); } /// /// 获取开始库位和结束库位 /// /// /// public List GetLocationInfoBeginEnd(string staorgid, string strAreaInfoID) { DataTable table= DataProvider.Instance.StorageAreaLocation.GetLocationInfoBeginEnd(staorgid, strAreaInfoID); List model = ConvertHelper.ConvertToList(table); if (DataLogErrWrite(table, "获取仓库信息结果集")) { return model; } return null; } public List GetLocationStatus(string hgh) { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationStatus(hgh); List model = ConvertHelper.ConvertToList(table); if (DataLogErrWrite(table, "error")) { return model; } return null; } public DataSet GetLocationInfo(string staorgid, string strAreaInfoID) { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoBeginEnd(staorgid, strAreaInfoID); DataSet ds = new DataSet(); ds.Tables.Add(table); return ds; } /// /// /// /// /// public List GetTableDecId(string decId,string STORAGE_ID) { DataSet table = DataProvider.Instance.StorageAreaLocation.GetTableDecId(decId, STORAGE_ID); if (table != null) { List model = new List(); if (table.Tables.Count > 1) { model = ConvertHelper.ConvertToList(table.Tables[0]); } return model; } return null; } public List GetLocStsData(string decID) { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocStsData(decID); if (table != null) { List model = new List(); if (table.Rows.Count > 1) { model = ConvertHelper.ConvertToList(table); } return model; } return null; } /// /// 获取库位信息结果集 /// /// 库位信息 /// 库位信息结果集 public List GetLocationInfoDS() { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(); if (table != null) { List model = ConvertHelper.ConvertToList(table); return model; } return null; } public List GetLocationInfoDS(StorageAreaLocationModel locationInfoModel) { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(locationInfoModel); List model = ConvertHelper.ConvertToList(table); return model; } /// /// 获取库位信息结果集 /// /// 库位信息 /// 库位信息结果集 public List GetLocationInfoDS(StorageAreaLocationModel locationInfoModel, ref List locAreaList) { DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(locationInfoModel); List model = ConvertHelper.ConvertToList(table); LocAreaModel m = new LocAreaModel(); m.LOCATION_ID = locationInfoModel.LOCATION_ID; table = DataProvider.Instance.LocArea.GetLocAreaDT(m); locAreaList = ConvertHelper.ConvertToList(table); if (DataLogErrWrite(table, "获取仓库信息结果集")) { return model; } return null; } public List GetMistockLocData() { DataTable table = DataProvider.Instance.MIStock.GetMistockLocData(); if (table != null) { List model = ConvertHelper.ConvertToList(table); return model; } return null; } /// /// 批量新增库位信息(排、列、层) /// /// 库位信息 /// 是否成功 public string InsertLocationInfo( int row, int cln, int lay, decimal hgt) { decimal id = 18; //for (int i =4; i <= 4; i++) //{ // for (int j = 1; j <= cln; j++) // { // for (int k = 1; k <= lay; k++) // { // //加库位 // StorageAreaLocationModel model = new StorageAreaLocationModel(); // model.row = i.ToString().PadLeft(2,'0'); // model.cln = j.ToString().PadLeft(3,'0'); // model.layer = k.ToString().PadLeft(2,'0'); // model.STORAGE_ID = "VSGASRS"; // model.LOCATION_ID = model.row.PadLeft(2, '0') + model.cln.PadLeft(3, '0')+ model.layer.PadLeft(2, '0'); // model.decId = "2"; // model.instand = "117"; // model.outStand = "116"; // model.STATUS = "0"; // model.LOCATION_HEIGHT = hgt; // model.SORT =id; // model.HASVOLUME = 0; // //if (DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(model).Rows.Count == 0) // //{//如果某库位编号的库位未存在,添加 // DataProvider.Instance.StorageAreaLocation.InsLocationInfo(model); // Transaction = DataProvider.Instance.TranOracle; // logList.Add(DataProvider.Instance.logData); // // } // id ++; // } // id =id+17; // } // TaCmtOrRak(); //} string dc = "02"; int sr = 355; for (int p =8; p >6; p--) { int abc = 265; if(p==7) { sr =356; } for (int i = 1; i < 23; i++) { for (int j = 1; j < 5; j++) { //string loc = dc + p.ToString().PadLeft(2, '0') + i.ToString().PadLeft(3, '0') + j.ToString().PadLeft(2, '0'); StorageAreaLocationModel model = new StorageAreaLocationModel(); model.row1 = p.ToString().PadLeft(2, '0'); model.cln = i.ToString().PadLeft(3, '0'); model.layer1 = j.ToString().PadLeft(2, '0'); model.STORAGE_ID = "XALTK"; model.LOCATION_ID =model.row1.PadLeft(2, '0') + model.cln.PadLeft(3, '0') + model.layer1.PadLeft(2, '0'); model.decId = dc; model.instand = "002"; model.outStand = "003"; model.STATUS = "0"; model.LOCATION_HEIGHT = 0; model.SORT = sr; model.HASVOLUME = 0; model.ABC_ID = abc.ToString(); DataProvider.Instance.StorageAreaLocation.InsLocationInfo(model); if(j==1) { Transaction = DataProvider.Instance.TranOracle; } logList.Add(DataProvider.Instance.logData); abc++; // abc = j % 2 == 0 ? abc++ : abc=abc; sr = sr+4; } TaCmtOrRak(); } } return ErrText; } /// /// 根据库位编号、仓库编号删除库位信息 /// /// 库位编号 /// 仓库编号 public string DeleteLocationInfo(string strLocationInfoId, string strStorageInfoID) { DataProvider.Instance.StorageAreaLocation.DeleteLocationInfo(strLocationInfoId, strStorageInfoID); logList.Add(DataProvider.Instance.logData); Transaction = DataProvider.Instance.TranOracle; TaCmtOrRak(); return ErrText; } /// /// 根据库区编号停用或启用库位 /// /// 库区编号 /// 0停用1正常 /// 是否成功 public string CloseLocationInfoByAreaInfoID(string strAreaInfoID,int flag) { DataProvider.Instance.StorageAreaLocation.CloseLocationInfoByAreaInfoID(strAreaInfoID,flag); DataLogErrWrite("根据库区编号停用库位"); return ErrText; } /// /// 根据仓库编号停用或启用库位 /// /// 仓库编号 /// 0停用1正常 /// 是否成功 public string CloseLocationInfoByStorageInfoID(string strStorageInfoID, int flag) { DataProvider.Instance.StorageAreaLocation.CloseLocationInfoByStorageInfoID(strStorageInfoID,flag); DataLogErrWrite("根据仓库编号停用库位"); return ErrText; } } }