大连融科 WMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

94 lines
3.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Data;
namespace SiaSun.LMS.Implement
{
/// <summary>
/// 申请下架
/// </summary>
public class ApplyMoveDown : ApplyBase
{
public bool ApplyHandle(Model.IO_CONTROL_APPLY mIO_CONTROL_APPLY, out string sResult)
{
bool bResult = true;
sResult = string.Empty;
int START_CELL_ID = 0;
int end_cell_id = 0;
try
{
mIO_CONTROL_APPLY.STOCK_BARCODE = string.Empty;
string STOCK_BARCODE = mIO_CONTROL_APPLY.STOCK_BARCODE.ToUpper();
bResult = this.Validate(mIO_CONTROL_APPLY, out START_CELL_ID,out sResult);
this._log.Fatal(string.Format("成功申请{0} {1} {2} {3}", mIO_CONTROL_APPLY.CONTROL_APPLY_ID, mIO_CONTROL_APPLY.STOCK_BARCODE,mIO_CONTROL_APPLY.CONTROL_ID,mIO_CONTROL_APPLY.DEVICE_CODE));
//查申请站台ID
string sql1 = string.Format("select * from wh_cell where cell_code='{0}'", mIO_CONTROL_APPLY.DEVICE_CODE);
DataTable dt1 = this.GetList(sql1);
//查14003申请个数
string sql2 = string.Format("select * from io_control_apply where DEVICE_CODE='{0}'", mIO_CONTROL_APPLY.DEVICE_CODE);
DataTable dt2 = this.GetList(sql2);
if (mIO_CONTROL_APPLY.DEVICE_CODE == "12086")
{
////申请状态改成3,挂着申请
//mIO_CONTROL_APPLY.APPLY_TASK_STATUS = 5;
//this._P_IO_CONTROL_APPLY.Update(mIO_CONTROL_APPLY);
//申请数量是2个的时候,先从库里出一个,第二个等直供。3个的时候前两个都下出库任务,
if(dt2.Rows.Count >= 2)
{
bResult = new StockOut().ManageCreate("wcs", "StockOut", 909, string.Empty, 1, START_CELL_ID, true, true, out sResult);
if(bResult)
{
//下成功任务删申请
this._P_IO_CONTROL_APPLY.Delete(mIO_CONTROL_APPLY.CONTROL_APPLY_ID);
}
else
{
System.Threading.Thread.Sleep(4000);
//申请状态改成3,挂着申请
mIO_CONTROL_APPLY.APPLY_TASK_STATUS = 0;
this._P_IO_CONTROL_APPLY.Update(mIO_CONTROL_APPLY);
}
}
//else if (dt2.Rows.Count <= 1)
//{
//}
return bResult;
}
}
catch (Exception ex)
{
bResult = false;
sResult = ex.Message;
this._log.Fatal(string.Format("调用方法{0}发生异常。", MethodBase.GetCurrentMethod().Name), ex);
}
//finally
//{
// this.WriteHisData(mIO_CONTROL_APPLY, sResult);
//}
return bResult;
}
}
}