388 lines
14 KiB
C#
388 lines
14 KiB
C#
|
|
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
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更改库位的容积,长,高
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="mData"></param>
|
|||
|
|
public void UpdateLoc(StorageAreaLocationModel mData)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.StorageAreaLocation.UpdateLoc(mData);
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询是否有该库位
|
|||
|
|
/// </summary>
|
|||
|
|
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<BussMIStock> GetMistockLocData(string devid)
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.MIStock.GetMistockLocData(devid);
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
List<BussMIStock> model = ConvertHelper<BussMIStock>.ConvertToList(table);
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
public void InsertLocArea(LocAreaModel model)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.LocArea.InsertLocArea(model);
|
|||
|
|
}
|
|||
|
|
public void InsertLocAreaList(List<LocAreaModel> 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);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新库位的库区信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="STORAGE_ID"></param>
|
|||
|
|
/// <param name="STORAGE_AREA_ID"></param>
|
|||
|
|
/// <param name="locID"></param>
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取开始库位和结束库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="strAreaInfoID"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public List<StorageAreaLocationModel> GetLocationInfoBeginEnd(string staorgid, string strAreaInfoID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DataTable table= DataProvider.Instance.StorageAreaLocation.GetLocationInfoBeginEnd(staorgid, strAreaInfoID);
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
if (DataLogErrWrite(table, "获取仓库信息结果集"))
|
|||
|
|
{
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public List<StorageAreaLocationModel> GetLocationStatus(string hgh)
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationStatus(hgh);
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.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;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="decId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public List<StorageAreaLocationModel> GetTableDecId(string decId,string STORAGE_ID)
|
|||
|
|
{
|
|||
|
|
DataSet table = DataProvider.Instance.StorageAreaLocation.GetTableDecId(decId, STORAGE_ID);
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> model = new List<StorageAreaLocationModel>();
|
|||
|
|
if (table.Tables.Count > 1)
|
|||
|
|
{
|
|||
|
|
model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table.Tables[0]);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
public List<StorageAreaLocationModel> GetLocStsData(string decID)
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocStsData(decID);
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> model = new List<StorageAreaLocationModel>();
|
|||
|
|
if (table.Rows.Count > 1)
|
|||
|
|
{
|
|||
|
|
model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取库位信息结果集
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="areaInfoModel">库位信息</param>
|
|||
|
|
/// <returns>库位信息结果集</returns>
|
|||
|
|
|
|||
|
|
public List<StorageAreaLocationModel> GetLocationInfoDS()
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS();
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
public List<StorageAreaLocationModel> GetLocationInfoDS(StorageAreaLocationModel locationInfoModel)
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(locationInfoModel);
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取库位信息结果集
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="areaInfoModel">库位信息</param>
|
|||
|
|
/// <returns>库位信息结果集</returns>
|
|||
|
|
public List<StorageAreaLocationModel> GetLocationInfoDS(StorageAreaLocationModel locationInfoModel, ref List<LocAreaModel> locAreaList)
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.StorageAreaLocation.GetLocationInfoDS(locationInfoModel);
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
|
|||
|
|
LocAreaModel m = new LocAreaModel();
|
|||
|
|
m.LOCATION_ID = locationInfoModel.LOCATION_ID;
|
|||
|
|
table = DataProvider.Instance.LocArea.GetLocAreaDT(m);
|
|||
|
|
locAreaList = ConvertHelper<LocAreaModel>.ConvertToList(table);
|
|||
|
|
|
|||
|
|
if (DataLogErrWrite(table, "获取仓库信息结果集"))
|
|||
|
|
{
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
public List<StorageAreaLocationModel> GetMistockLocData()
|
|||
|
|
{
|
|||
|
|
DataTable table = DataProvider.Instance.MIStock.GetMistockLocData();
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> model = ConvertHelper<StorageAreaLocationModel>.ConvertToList(table);
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 批量新增库位信息(排、列、层)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="locationInfoModel">库位信息</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据库位编号、仓库编号删除库位信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="strLocationInfoId">库位编号</param>
|
|||
|
|
/// <param name="strStorageInfoID">仓库编号</param>
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据库区编号停用或启用库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="strAreaInfoID">库区编号</param>
|
|||
|
|
/// <param name="flag">0停用1正常</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
public string CloseLocationInfoByAreaInfoID(string strAreaInfoID,int flag)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.StorageAreaLocation.CloseLocationInfoByAreaInfoID(strAreaInfoID,flag);
|
|||
|
|
|
|||
|
|
DataLogErrWrite("根据库区编号停用库位");
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据仓库编号停用或启用库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="strStorageInfoID">仓库编号</param>
|
|||
|
|
/// <param name="flag">0停用1正常</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
public string CloseLocationInfoByStorageInfoID(string strStorageInfoID, int flag)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.StorageAreaLocation.CloseLocationInfoByStorageInfoID(strStorageInfoID,flag);
|
|||
|
|
|
|||
|
|
DataLogErrWrite("根据仓库编号停用库位");
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|