795 lines
34 KiB
C#
795 lines
34 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using WMS.Model.RK;
|
|
using System.Data;
|
|
using WMS.IData;
|
|
using WMS.Common;
|
|
using WMS.Model.Base;
|
|
using WMS.Model.Stock;
|
|
|
|
using WMS.Model;
|
|
|
|
namespace WMS.Business
|
|
{
|
|
public class BussAutoRk : IBussFactory
|
|
{
|
|
public DataSet GetTaksAllData()
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetTaksAllData();
|
|
}
|
|
|
|
public DataTable GetLocDataRow(string decId,string hgh)
|
|
{
|
|
DataTable tb = DataProvider.Instance.AutoRkData.GetLocDataRow(decId,hgh);
|
|
return tb;
|
|
|
|
}
|
|
public DataTable GetStandStorage(string STORAGE_ID)
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetStandStorage(STORAGE_ID);
|
|
return dt;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 拼盘
|
|
/// </summary>
|
|
/// <param name="lotid"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public string MergerCtl(string locId, string newLocid, string oldCtl, string ctl, string STORAGE_ID, string outStand)
|
|
{
|
|
|
|
DataProvider.Instance.AutoRkData.UpdateLocCtlSts(locId, "0", STORAGE_ID);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.MIStock.UpdateMisLocData(newLocid, locId, STORAGE_ID, ctl);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.PickingWaveGoods.DelCtlPickGoods(oldCtl, STORAGE_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
string plcId = DataProvider.Instance.AutoRkData.GetPlcId();
|
|
IBussFactory<BussAutoRk>.Instance().OrderMesAdd("","",plcId, "", outStand, "", STORAGE_ID, ctl, 1, "1", "", "-1");
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
}
|
|
/// <summary>
|
|
/// 查询批次明细
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public List<LotGoodsCode> GetProduceDataList()
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetProduceDataList();
|
|
List<LotGoodsCode> list = ConvertHelper<LotGoodsCode>.ConvertToList(dt);
|
|
return list;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="plcid"></param>
|
|
/// <param name="itemCode">物料</param>
|
|
/// <param name="locator">站台</param>
|
|
/// <param name="locid">库位</param>
|
|
/// <param name="STORAGE_ID">仓储</param>
|
|
/// <param name="podCode">托盘</param>
|
|
/// <param name="quantity">数量</param>
|
|
/// <param name="auto">是否立体库</param>
|
|
/// <param name="whseloc">原库位</param>
|
|
/// <param name="sts">状态</param>
|
|
public void OrderMesAdd(string wipEntityId,string height,string plcid, string itemCode, string locator,
|
|
string locid,string STORAGE_ID,string podCode, decimal quantity, string auto,string whseloc, string sts)
|
|
{
|
|
string taskID = "";
|
|
string lotCode = "";
|
|
AutoRkGoodsInfo onInfo = new AutoRkGoodsInfo();
|
|
onInfo.WAREHOUSING_ID = taskID;
|
|
onInfo.instand = locator;
|
|
onInfo.GOODSID = itemCode;
|
|
onInfo.CTL = podCode;
|
|
onInfo.ProDucLotId = lotCode;
|
|
onInfo.ACC_NUM = quantity;
|
|
onInfo.SHELF_NUM = quantity;
|
|
onInfo.STORAGE_ID = STORAGE_ID;
|
|
onInfo.LOCATION_ID = locid;
|
|
onInfo.STATUS = sts;
|
|
onInfo.Whseloc = whseloc;
|
|
onInfo.LOT_ID = "SHD" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
onInfo.PROVIDER_ID = wipEntityId;
|
|
onInfo.High = height;
|
|
if (auto=="1")
|
|
{
|
|
onInfo.TASKTYPE = "1";
|
|
if (plcid.Trim().Length == 0)
|
|
{
|
|
onInfo.PlcID = DataProvider.Instance.DocumentTable.GetSeq("SEQ_PLC_TASKVAL");
|
|
}
|
|
else
|
|
{
|
|
onInfo.PlcID = plcid;
|
|
}
|
|
}
|
|
else if(auto == "3")
|
|
{
|
|
onInfo.TASKTYPE = "AGV";
|
|
}
|
|
|
|
|
|
DataProvider.Instance.AutoRkData.InsertGoodsInfoShelf(onInfo);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
}
|
|
/// <summary>
|
|
/// 生成上架任务
|
|
/// </summary>
|
|
public void OrderAdd()
|
|
{
|
|
StorageLotModel lotModel = new StorageLotModel();
|
|
List<AutoRkGoodsInfo> allList = new List<AutoRkGoodsInfo>();
|
|
lotModel.STATUS = "0";
|
|
DataTable tb = DataProvider.Instance.StorageLot.GetStorageList(lotModel);
|
|
if(tb!=null)
|
|
{
|
|
if(tb.Rows.Count>0)
|
|
{
|
|
foreach (DataRow row in tb.Rows)
|
|
{
|
|
CodeDiskModel model = new CodeDiskModel();
|
|
model.LOT_ID = row["LOT_ID"].ToString();
|
|
model.STORAGE_ID= row["STO_ID"].ToString();
|
|
DataTable tbInfo = DataProvider.Instance.CodeDisk.GetCodeDisk(model);
|
|
if (tbInfo != null)
|
|
{
|
|
if (tbInfo.Rows.Count > 0)
|
|
{
|
|
string orderId = IBussFactory<WMS.Business.Base.BussDocumentTable>.Instance().GetDocumentStream("上架单");
|
|
List<CodeDiskModel> listDisk = ConvertHelper<CodeDiskModel>.ConvertToList(tbInfo);
|
|
foreach (CodeDiskModel rowInfo in listDisk)
|
|
{
|
|
AutoRkGoodsInfo onInfo = new AutoRkGoodsInfo();
|
|
onInfo.GOODS_MEASURE_ID = rowInfo.GOODS_MEASURE_ID;
|
|
onInfo.ACC_NUM = rowInfo.Goods_Num;
|
|
onInfo.CTL = rowInfo.Pallet_id;
|
|
onInfo.STORAGE_ID = rowInfo.STORAGE_ID;
|
|
onInfo.STORAGE_AREA_ID = rowInfo.Storage_area_id;
|
|
onInfo.UNIT = rowInfo.Unit;
|
|
onInfo.SHELF_NUM = 0;
|
|
onInfo.UPGOODS_ID = orderId;
|
|
onInfo.GOODSID = rowInfo.Goods_id;
|
|
onInfo.WAREHOUSING_ID = rowInfo.Warehousing_id;
|
|
onInfo.PROVIDER_ID = rowInfo.PROVIDER_ID;
|
|
onInfo.LOT_ID = row["LOT_ID"].ToString();
|
|
onInfo.BarCode = rowInfo.BarCode;
|
|
onInfo.Whseloc = "";
|
|
onInfo.instand = rowInfo.ConveyorID;
|
|
onInfo.ProDucLotId = rowInfo.ProDucLotId;
|
|
onInfo.STATUS = "0";
|
|
if (rowInfo.AUTOSTS)
|
|
{
|
|
onInfo.SHELF_NUM = onInfo.ACC_NUM;
|
|
if (allList.Count(r => r.CTL == rowInfo.Pallet_id) > 0)
|
|
{
|
|
onInfo.PlcID = allList.Find(r => r.CTL == rowInfo.Pallet_id).PlcID;
|
|
}
|
|
else
|
|
{
|
|
onInfo.PlcID = plcIdSeq();
|
|
}
|
|
onInfo.TASKTYPE = "LTK";
|
|
}
|
|
else
|
|
{
|
|
onInfo.PlcID = "0";
|
|
onInfo.TASKTYPE = "RF";
|
|
}
|
|
allList.Add(onInfo);
|
|
}
|
|
|
|
//allList.Clear();
|
|
}
|
|
|
|
}
|
|
}
|
|
TaskData(allList, "410", "", "");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 入库单取消任务
|
|
/// </summary>
|
|
/// <param name="producyLotid"></param>
|
|
/// <returns></returns>
|
|
public string CancelTaskLot(string lotId, string goodsId, string ProDucLotId)
|
|
{
|
|
DataProvider.Instance.AutoRkData.DelTaskGoodInfo(lotId, goodsId, ProDucLotId);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.UpdateProductSts(ProDucLotId);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询空库位
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public List<StorageAreaLocationModel> GetNullLocalData()
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetNullLocalData();
|
|
List<StorageAreaLocationModel> list = ConvertHelper<StorageAreaLocationModel>.ConvertToList(dt);
|
|
return list;
|
|
}
|
|
public string UpdatePlcIdData(string locID)
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdatePlcIdData(locID);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
}
|
|
public List<AutoRkGoodsInfo> GetRkData(string taskType)
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetRkData(taskType);
|
|
List<AutoRkGoodsInfo> info = new List<AutoRkGoodsInfo>();
|
|
if (dt!=null)
|
|
{
|
|
info = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(dt);
|
|
}
|
|
return info;
|
|
}
|
|
/// <summary>
|
|
/// 查询入库任务
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public List<AutoRkGoodsInfo> GetTaskInData()
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetTaskInData("");
|
|
List<AutoRkGoodsInfo> list = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(dt);
|
|
return list;
|
|
}
|
|
/// <summary>
|
|
/// 更新入库状态
|
|
/// </summary>
|
|
/// <param name="ctl"></param>
|
|
/// <param name="status"></param>
|
|
/// <returns></returns>
|
|
public string UpadateTaskData(string ctl, string locId, string barcode, string pskw, decimal sheNum, decimal psNum)
|
|
{
|
|
//string ctl = listOnShelfGoodsModel.CTL;
|
|
//string locId = listOnShelfGoodsModel.LOCATION_ID;
|
|
//string goodsId = listOnShelfGoodsModel.GOODSID;
|
|
//decimal SHELF_NUM = listOnShelfGoodsModel.SHELF_NUM;
|
|
DataProvider.Instance.AutoRkData.UpadateTaskData(ctl, locId, barcode, pskw,sheNum, psNum) ;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
|
|
}
|
|
//public List<PakWaitIn> GetCodeData(string code)
|
|
//{
|
|
// DataTable dt = DataProvider.Instance.AutoRkData.GetCodeData(code);
|
|
// List<PakWaitIn> list = ConvertHelper<PakWaitIn>.ConvertToList(dt);
|
|
// return list;
|
|
//}
|
|
/// <summary>
|
|
/// PLC返回查询入库的信息
|
|
/// </summary>
|
|
/// <param name="locId"></param>
|
|
/// <returns></returns>
|
|
|
|
|
|
public List<AutoRkGoodsInfo> GetTaskLocInTask(string locId)
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetTaskLocInTask(locId);
|
|
List<AutoRkGoodsInfo> list = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(dt);
|
|
return list;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 查询空库位
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public StorageAreaLocationModel GetNullLocal(decimal hgt, string sts)
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetNotNullGoodIdLocal(hgt);
|
|
List<StorageAreaLocationModel> list = ConvertHelper<StorageAreaLocationModel>.ConvertToList(dt);
|
|
if (list.Count > 0)
|
|
{
|
|
return list[0];
|
|
}
|
|
return null;
|
|
}
|
|
/// <summary>
|
|
/// 查询异常订单
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataTable GetexceData()
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetexceData();
|
|
}
|
|
public DataTable GetexceData2()
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetExceData2();
|
|
}
|
|
public void UpdateEcxeData(string plcId, string type,string status)
|
|
{
|
|
if (type != "in")
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdateEcxeOutData (plcId, status);
|
|
}
|
|
else
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdateEcxeData(plcId, status);
|
|
}
|
|
}
|
|
|
|
public void DeleteEcxeData(string plcId, string type)
|
|
{
|
|
if (type != "in")
|
|
{
|
|
DataProvider.Instance.AutoRkData.DeleteEcxeOutData(plcId);
|
|
}
|
|
else
|
|
{
|
|
DataProvider.Instance.AutoRkData.DeleteEcxeData(plcId);
|
|
}
|
|
}
|
|
public DataTable GetPlcDataHigh(string decId)
|
|
{
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetPlcDataHigh(decId);
|
|
return dt;
|
|
}
|
|
//string station
|
|
public List<AutoRkGoodsInfo> GetUpShelfGoodsData()
|
|
{
|
|
//if(station!="0")
|
|
//{
|
|
// string[] sl = station.Split(',');
|
|
// if (sl.Length ==0)
|
|
// {
|
|
// return null;
|
|
// }
|
|
// station = sl[0];
|
|
// for (int i=1;i<sl.Length;i++)
|
|
// {
|
|
// station = station + "," + sl[i];
|
|
// }
|
|
|
|
|
|
//}
|
|
DataTable dt = DataProvider.Instance.AutoRkData.GetUpShelfGoodsData("");
|
|
List<AutoRkGoodsInfo> RkgoodsInfo = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(dt);
|
|
return RkgoodsInfo;
|
|
}
|
|
public string DeleteTaskData(string ctl)
|
|
{
|
|
DataTable tb = DataProvider.Instance.AutoRkData.GetWmsData(ctl);
|
|
if (tb != null)
|
|
{
|
|
if (tb.Rows.Count > 0)
|
|
{
|
|
string sts = tb.Rows[0]["status"].ToString();
|
|
if (int.Parse(sts) >2 )//在下发给堆垛机前都能删除任务
|
|
{
|
|
return "不能删除单据,已经安排库位并下发给堆垛机";
|
|
}
|
|
DataProvider.Instance.AutoRkData.DeleteTaskData(ctl);
|
|
return "";
|
|
}
|
|
}
|
|
return "删除失败";
|
|
}
|
|
/// <summary>
|
|
/// 立体库入库完成
|
|
/// </summary>
|
|
/// <param name="goodsInfo"></param>
|
|
public string WriteMisData(string userid)
|
|
{
|
|
//AutoRkGoodsInfo goodsInfo = new AutoRkGoodsInfo();
|
|
DataTable table = DataProvider.Instance.AutoRkData.GetOnShelfGoodsData();
|
|
DataTable erpData = new DataTable();
|
|
if (table != null)
|
|
{
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
string ctl = table.Rows[0]["ctl"].ToString();
|
|
string taskType = table.Rows[0]["taskType"].ToString();
|
|
string STORAGE_ID = table.Rows[0]["STORAGE_ID"].ToString();
|
|
if (taskType == "LTK")
|
|
{
|
|
table = DataProvider.Instance.AutoRkData.GetCtlDataOn(ctl, STORAGE_ID);
|
|
List<AutoRkGoodsInfo> RkgoodsInfo = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(table);
|
|
if (RkgoodsInfo == null)
|
|
{
|
|
|
|
return "Error";
|
|
}
|
|
if(RkgoodsInfo[0].GOODSID=="hk")
|
|
{
|
|
string oldloc = RkgoodsInfo[0].Whseloc;
|
|
string loc = RkgoodsInfo[0].LOCATION_ID;
|
|
string storage = RkgoodsInfo[0].STORAGE_ID;
|
|
DataProvider.Instance.MIStock.UpdateMisLocData(loc, oldloc, storage, "");
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
|
|
DataProvider.Instance.AutoRkData.UpdateLocCtlSts(oldloc, "0", storage);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
}
|
|
foreach (AutoRkGoodsInfo goodsInfo in RkgoodsInfo)
|
|
{
|
|
|
|
MIStockModel miStock = new MIStockModel();
|
|
miStock.AREA_ID = "";
|
|
miStock.BARCODE = goodsInfo.GOODSID;
|
|
miStock.CTL = goodsInfo.CTL;
|
|
miStock.DOCCTNUMBER = goodsInfo.LOT_ID.Trim();
|
|
miStock.ProDucLotId = goodsInfo.ProDucLotId;
|
|
miStock.GOODS_ID = goodsInfo.GOODSID;
|
|
miStock.SHELVES_NUM = goodsInfo.SHELF_NUM;
|
|
// miStock.baozhiqi = goodsInfo.baozhiqi;
|
|
miStock.LOCATION_ID = goodsInfo.LOCATION_ID;
|
|
miStock.UNIT = goodsInfo.UNIT;
|
|
miStock.PRODUCTION_DATE = goodsInfo.PRODUCTION_DATE;
|
|
miStock.PUTIN_ID = goodsInfo.UPGOODS_ID;
|
|
miStock.Whseloc = goodsInfo.Whseloc;
|
|
miStock.High = goodsInfo.High;
|
|
miStock.WGH = goodsInfo.WGH;
|
|
miStock.STORAGE_MODE = goodsInfo.STORAGE_MODE;
|
|
miStock.PACKING_NUM = goodsInfo.GOODSVOLUME;
|
|
miStock.Customer_Id = goodsInfo.Customer_Id;
|
|
|
|
DataProvider.Instance.MIStock.InsertMIStock(miStock);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
///删除任务表写入备份表
|
|
///删除生产任务表写入备份
|
|
///
|
|
}
|
|
|
|
DataProvider.Instance.AutoRkData.InsertUpGoodsBak(RkgoodsInfo[0].CTL, "");
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.DeleteGoodInfo(RkgoodsInfo[0].CTL,"");
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
}
|
|
else
|
|
{
|
|
List<AutoRkGoodsInfo> RkgoodsInfo = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(table);
|
|
MIStockModel miStock = new MIStockModel();
|
|
miStock.AREA_ID = "";
|
|
miStock.BARCODE = RkgoodsInfo[0].BarCode.ToString();
|
|
miStock.CTL = RkgoodsInfo[0].CTL.ToString(); ;
|
|
miStock.DOCCTNUMBER = RkgoodsInfo[0].LOT_ID.Trim();
|
|
miStock.ProDucLotId = RkgoodsInfo[0].ProDucLotId;
|
|
miStock.GOODS_ID = RkgoodsInfo[0].GOODSID;
|
|
miStock.SHELVES_NUM = RkgoodsInfo[0].SHELF_NUM;
|
|
// miStock.baozhiqi = goodsInfo.baozhiqi;
|
|
miStock.LOCATION_ID = RkgoodsInfo[0].LOCATION_ID;
|
|
miStock.UNIT = RkgoodsInfo[0].UNIT;
|
|
miStock.PRODUCTION_DATE = RkgoodsInfo[0].PRODUCTION_DATE;
|
|
miStock.PUTIN_ID = RkgoodsInfo[0].UPGOODS_ID;
|
|
miStock.Whseloc = RkgoodsInfo[0].Whseloc;
|
|
miStock.High = RkgoodsInfo[0].High;
|
|
miStock.WGH = RkgoodsInfo[0].WGH;
|
|
miStock.STORAGE_MODE = RkgoodsInfo[0].STORAGE_MODE;
|
|
miStock.PACKING_NUM = RkgoodsInfo[0].GOODSVOLUME;
|
|
miStock.Customer_Id = RkgoodsInfo[0].Customer_Id;
|
|
miStock.STORAGE_ID = RkgoodsInfo[0].STORAGE_ID;
|
|
miStock.AREA_ID = RkgoodsInfo[0].STORAGE_AREA_ID;
|
|
miStock.GOODS_MEASURE_ID = RkgoodsInfo[0].GOODS_MEASURE_ID;
|
|
DataProvider.Instance.MIStock.InsertMIStock(miStock);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.InsertUpGoodsBak(RkgoodsInfo[0].CTL, miStock.GOODS_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.DeleteGoodInfo(RkgoodsInfo[0].CTL, miStock.GOODS_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
return ErrText;
|
|
}
|
|
/// <summary>
|
|
/// 获取改批次的数量
|
|
/// </summary>
|
|
/// <param name="ProDucLotId"></param>
|
|
/// <returns></returns>
|
|
public string plcIdSeq()
|
|
{
|
|
|
|
string plcIDSeq = DataProvider.Instance.DocumentTable.GetSeq("SEQ_PLC_TASKVAL");
|
|
return plcIDSeq;
|
|
}
|
|
public string UpdateScan2Sts(string code)
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdateScan2Sts(code);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.UpdatePlcData();
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
return ErrText;
|
|
}
|
|
public string GetStrSql(List<string> lis, string conveID)
|
|
{
|
|
string[] MOdeLis = { "202", "204", "205", "208", "209", "212", "213", "216", "217", "219" };
|
|
|
|
|
|
string sqlstr = string.Empty;
|
|
if (MOdeLis.Contains(conveID))
|
|
{
|
|
|
|
sqlstr = "update [T_ConveyorStatus] set AutoMode='" + lis[0] + "',ManualMode='" + lis[1] + "',AlarmMode='" + lis[2] + "',LoadMode='" + lis[3] + "',OverSize='" + lis[4] + "',OutEnable='" + lis[5] + "',InEnable='" + lis[6] + "' ,plcid='" + lis[8] + "' ,Mode='" + lis[7] + "'where ConveyorID='" + conveID + "';";
|
|
}
|
|
else
|
|
{
|
|
sqlstr = "update [T_ConveyorStatus] set AutoMode='" + lis[0] + "',ManualMode='" + lis[1] + "',AlarmMode='" + lis[2] + "',LoadMode='" + lis[3] + "',OverSize='" + lis[4] + "',OutEnable='" + lis[5] + "',InEnable='" + lis[6] + "' ,plcid='" + lis[7] + "'where ConveyorID='" + conveID + "';";
|
|
}
|
|
return sqlstr;
|
|
}
|
|
public bool UpdateConveSts(List<string> lis, string conveID)
|
|
{
|
|
|
|
return DataProvider.Instance.AutoRkData.UpdateConveSts(lis, conveID);
|
|
}
|
|
|
|
public void UpdateYkLoc( string loc)
|
|
{
|
|
DataProvider.Instance.MIStock.UpdateYKLoc(loc);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
}
|
|
|
|
public List<AutoRkGoodsInfo> GetScan2Data(string code)
|
|
{
|
|
DataTable tb = DataProvider.Instance.AutoRkData.GetScan2Data(code);
|
|
if (tb != null)
|
|
{
|
|
return ConvertHelper<AutoRkGoodsInfo>.ConvertToList(tb);
|
|
}
|
|
return null;
|
|
}
|
|
public DataTable GetFdData(string decId,string station)
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetFdData(decId, station);
|
|
}
|
|
public DataTable GetTasks(string decId)
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetTasks(decId);
|
|
}
|
|
public DataTable GetTasks2(string decId)
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetTasks2(decId);
|
|
}
|
|
public void UpdateDecDataSts(string decId,string sts,string STORAGE_ID)
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdateDecDataSts(decId,sts, STORAGE_ID);
|
|
}
|
|
public string UpdateOpSts(string plcID)
|
|
{
|
|
|
|
DataTable tb= DataProvider.Instance.AutoRkData.GetPlcIdOpLoc(plcID);
|
|
if (tb != null)
|
|
{
|
|
if (tb.Rows.Count > 0)
|
|
{
|
|
if (tb.Rows[0]["LOCATION_ID"].ToString() == "")
|
|
{
|
|
DataProvider.Instance.AutoRkData.UpdateOpSts(plcID);
|
|
return "";
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
return "Task not Delete";
|
|
}
|
|
public DataTable GetConveyorModeData(string decid)
|
|
{
|
|
return DataProvider.Instance.AutoRkData.GetConveyorModeData(decid);
|
|
}
|
|
/// <summary>
|
|
///下发任务
|
|
/// </summary>
|
|
/// <param name="shelfGoods"></param>
|
|
/// <param name="goodsInfo"></param>
|
|
/// <returns></returns>
|
|
public string TaskData(List<AutoRkGoodsInfo> goodsInfos, string station,string plcid,string status )
|
|
{
|
|
//string goodsID = "";
|
|
//string ctl = "";
|
|
//decimal num = 0;
|
|
// List<AutoRkGoodsInfo> goodsInfos = new List<AutoRkGoodsInfo>();
|
|
if (goodsInfos != null)
|
|
{
|
|
int i = 0;
|
|
// string plcId = DataProvider.Instance.AutoRkData.GetPlcId();
|
|
foreach (AutoRkGoodsInfo mRk in goodsInfos)
|
|
{
|
|
//写到入库上架表
|
|
//AutoRkGoodsInfo goodsInfo = new AutoRkGoodsInfo();
|
|
//goodsInfo.ONDATE = System.DateTime.Now;
|
|
//goodsInfo.HASVOLUME = 1;
|
|
//goodsInfo.GOODSID = goodsID;
|
|
//goodsInfo.LOCATION_ID = "";
|
|
//goodsInfo.instand = station;
|
|
//goodsInfo.CTL = ctl;
|
|
|
|
//goodsInfo.SHELF_NUM = num;
|
|
//goodsInfo.High = "0";
|
|
//mRk.PlcID = plcid;
|
|
//goodsInfo.STORAGE_MODE = "";
|
|
//goodsInfo.GOODSVOLUME = 0;
|
|
//goodsInfo.STATUS = status;
|
|
DataProvider.Instance.AutoRkData.InsertGoodsInfoShelf(mRk);
|
|
//if (i == 0)
|
|
// {
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
// i++;
|
|
// }
|
|
//写备份表
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.StorageLot.SetDocStatus("1", mRk.LOT_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
return ErrText;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询改条码是否已经入库
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string GetMisLocId(string barcode)
|
|
{
|
|
string locid = string.Empty;
|
|
DataTable tale = DataProvider.Instance.AutoRkData.GetMisLocId(barcode);
|
|
if (tale != null)
|
|
{
|
|
if (tale.Rows.Count > 0)
|
|
{
|
|
locid = tale.Rows[0]["LOCATION_ID"].ToString();
|
|
}
|
|
|
|
}
|
|
return locid;
|
|
|
|
}
|
|
|
|
public List<AutoRkGoodsInfo> GettaskWcs(string sts)
|
|
{
|
|
List<AutoRkGoodsInfo> list = new List<AutoRkGoodsInfo>();
|
|
DataTable tb= DataProvider.Instance.AutoRkData.GetTaskInData(sts);
|
|
if (tb != null)
|
|
{
|
|
list = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(tb);
|
|
}
|
|
return list;
|
|
}
|
|
/// <summary>
|
|
/// 立体库入库完成
|
|
/// </summary>
|
|
/// <param name="goodsInfo"></param>
|
|
public string WriteMesData()
|
|
{
|
|
//AutoRkGoodsInfo goodsInfo = new AutoRkGoodsInfo();
|
|
DataTable table = DataProvider.Instance.AutoRkData.GetOnShelfGoodsData();
|
|
// DataTable erpData = new DataTable();
|
|
if (table != null)
|
|
{
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
string ctl = table.Rows[0]["ctl"].ToString();
|
|
string Whseloc = table.Rows[0]["Whseloc"].ToString();//原库位
|
|
string LOCATION_ID = table.Rows[0]["LOCATION_ID"].ToString();
|
|
string STORAGE_ID = table.Rows[0]["STORAGE_ID"].ToString();
|
|
if (Whseloc.Trim().Length == 0)
|
|
{
|
|
table = DataProvider.Instance.AutoRkData.GetCtlDataOn(ctl, STORAGE_ID);
|
|
if (table != null)
|
|
{
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
List<AutoRkGoodsInfo> RkgoodsInfo = ConvertHelper<AutoRkGoodsInfo>.ConvertToList(table);
|
|
if (RkgoodsInfo == null)
|
|
{
|
|
return "Error";
|
|
}
|
|
|
|
foreach (AutoRkGoodsInfo goodsInfo in RkgoodsInfo)
|
|
{
|
|
|
|
MIStockModel miStock = new MIStockModel();
|
|
miStock.AREA_ID = "";
|
|
miStock.BARCODE = goodsInfo.baozhiqi;
|
|
miStock.CTL = goodsInfo.CTL;
|
|
miStock.DOCCTNUMBER = goodsInfo.LOT_ID.Trim();
|
|
miStock.ProDucLotId = goodsInfo.ProDucLotId;
|
|
miStock.GOODS_ID = goodsInfo.GOODSID;
|
|
miStock.SHELVES_NUM = goodsInfo.SHELF_NUM;
|
|
miStock.LOCATION_ID = goodsInfo.LOCATION_ID;
|
|
miStock.UNIT = goodsInfo.UNIT;
|
|
miStock.PRODUCTION_DATE = goodsInfo.ONDATE;
|
|
miStock.PUTIN_ID = goodsInfo.LOT_ID;
|
|
miStock.WARE_DATE = DateTime.Now;
|
|
miStock.High = goodsInfo.High;
|
|
miStock.WGH = goodsInfo.WGH;
|
|
miStock.STORAGE_MODE = goodsInfo.STORAGE_MODE;
|
|
miStock.PACKING_NUM = goodsInfo.GOODSVOLUME;
|
|
miStock.Customer_Id = goodsInfo.Customer_Id;
|
|
miStock.STORAGE_ID = goodsInfo.STORAGE_ID;
|
|
miStock.PROVIDER_ID = goodsInfo.PROVIDER_ID;
|
|
miStock.REMARK = goodsInfo.REMARK;
|
|
miStock.VERSION = goodsInfo.UNIT;
|
|
|
|
miStock.GOODS_TYPEID = goodsInfo.GOODS_TYPEID;
|
|
miStock.GOODS_TYPENAME= goodsInfo.baozhiqi;
|
|
miStock.GOODS_SKU = goodsInfo.TASKTYPE;
|
|
miStock.GOODS_NAME = goodsInfo.GOODSNAME;
|
|
|
|
DataProvider.Instance.MIStock.InsertMIStock(miStock);
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|
logList.Add(DataProvider.Instance.logData);
|
|
///删除任务表写入备份表
|
|
///删除生产任务表写入备份
|
|
|
|
|
|
DataProvider.Instance.AutoRkData.InsertUpGoodsBak(ctl, miStock.GOODS_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
DataProvider.Instance.AutoRkData.DeleteGoodInfo(ctl, miStock.GOODS_ID);
|
|
logList.Add(DataProvider.Instance.logData);
|
|
TaCmtOrRak();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
//DataProvider.Instance.MIStock.UpdateMisLocData(LOCATION_ID, Whseloc, STORAGE_ID, ctl);
|
|
//Transaction = DataProvider.Instance.TranOracle;
|
|
//logList.Add(DataProvider.Instance.logData);
|
|
//DataProvider.Instance.AutoRkData.UpdateLocCtlSts(Whseloc, "0", STORAGE_ID);
|
|
//logList.Add(DataProvider.Instance.logData);
|
|
//DataProvider.Instance.AutoRkData.InsertUpGoodsBak(ctl, "");
|
|
//logList.Add(DataProvider.Instance.logData);
|
|
//DataProvider.Instance.AutoRkData.DeleteGoodInfo(ctl, "");
|
|
//logList.Add(DataProvider.Instance.logData);
|
|
//TaCmtOrRak();
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
return ErrText;
|
|
}
|
|
}
|
|
}
|